set svn:eol-style to native
[reactos.git] / reactos / lib / mpr / nps.c
index 980c58a..7fe1556 100644 (file)
-/*\r
- * MPR Network Provider Services functions\r
- *\r
- * Copyright 1999 Ulrich Weigand\r
- * Copyright 2004 Mike McCormack for CodeWeavers Inc.\r
- *\r
- * This library is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU Lesser General Public\r
- * License as published by the Free Software Foundation; either\r
- * version 2.1 of the License, or (at your option) any later version.\r
- *\r
- * This library is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
- * Lesser General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- */\r
-\r
-#include "config.h"\r
-\r
-#include <stdarg.h>\r
-\r
-#include "windef.h"\r
-#include "winbase.h"\r
-#include "winuser.h"\r
-#include "netspi.h"\r
-#include "wine/debug.h"\r
-#include "winerror.h"\r
-\r
-WINE_DEFAULT_DEBUG_CHANNEL(mpr);\r
-\r
-#include "wine/unicode.h"\r
-\r
-#include "mprres.h"\r
-\r
-/***********************************************************************\r
- *         NPS_ProxyPasswordDialog\r
- */\r
-static INT_PTR WINAPI NPS_ProxyPasswordDialog(\r
-    HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam )\r
-{\r
-    HWND hitem;\r
-    LPAUTHDLGSTRUCTA lpAuthDlgStruct;\r
-\r
-    if( uMsg == WM_INITDIALOG )\r
-    {\r
-        TRACE("WM_INITDIALOG (%08lx)\n", lParam);\r
-\r
-        /* save the parameter list */\r
-        lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) lParam;\r
-        SetWindowLongPtrW( hdlg, GWLP_USERDATA, lParam );\r
-\r
-        if( lpAuthDlgStruct->lpExplainText )\r
-        {\r
-            hitem = GetDlgItem( hdlg, IDC_EXPLAIN );\r
-            SetWindowTextA( hitem, lpAuthDlgStruct->lpExplainText );\r
-        }\r
-\r
-        /* extract the Realm from the proxy response and show it */\r
-        if( lpAuthDlgStruct->lpResource )\r
-        {\r
-            hitem = GetDlgItem( hdlg, IDC_REALM );\r
-            SetWindowTextA( hitem, lpAuthDlgStruct->lpResource );\r
-        }\r
-\r
-        return TRUE;\r
-    }\r
-\r
-    lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) GetWindowLongPtrW( hdlg, GWLP_USERDATA );\r
-\r
-    switch( uMsg )\r
-    {\r
-    case WM_COMMAND:\r
-        if( wParam == IDOK )\r
-        {\r
-            WCHAR username[0x20], password[0x20];\r
-\r
-            username[0] = 0;\r
-            hitem = GetDlgItem( hdlg, IDC_USERNAME );\r
-            if( hitem )\r
-                GetWindowTextA( hitem, lpAuthDlgStruct->lpUsername, lpAuthDlgStruct->cbUsername );\r
-            \r
-            password[0] = 0;\r
-            hitem = GetDlgItem( hdlg, IDC_PASSWORD );\r
-            if( hitem )\r
-                GetWindowTextA( hitem, lpAuthDlgStruct->lpPassword, lpAuthDlgStruct->cbPassword );\r
-\r
-            EndDialog( hdlg, WN_SUCCESS );\r
-            return TRUE;\r
-        }\r
-        if( wParam == IDCANCEL )\r
-        {\r
-            EndDialog( hdlg, WN_CANCEL );\r
-            return TRUE;\r
-        }\r
-        break;\r
-    }\r
-    return FALSE;\r
-}\r
-\r
-/*****************************************************************\r
- *  NPSAuthenticationDialogA [MPR.@]\r
- */\r
-DWORD WINAPI NPSAuthenticationDialogA( LPAUTHDLGSTRUCTA lpAuthDlgStruct )\r
-{\r
-    HMODULE hwininet = GetModuleHandleA( "mpr.dll" );\r
-\r
-    TRACE("%p\n", lpAuthDlgStruct);\r
-\r
-    if( !lpAuthDlgStruct )\r
-        return WN_BAD_POINTER;\r
-    if( lpAuthDlgStruct->cbStructure < sizeof *lpAuthDlgStruct )\r
-        return WN_BAD_POINTER;\r
-\r
-    TRACE("%s %s %s\n",lpAuthDlgStruct->lpResource,\r
-          lpAuthDlgStruct->lpOUTitle, lpAuthDlgStruct->lpExplainText);\r
-\r
-    return DialogBoxParamW( hwininet, MAKEINTRESOURCEW( IDD_PROXYDLG ),\r
-             lpAuthDlgStruct->hwndOwner, NPS_ProxyPasswordDialog, \r
-             (LPARAM) lpAuthDlgStruct );\r
-}\r
-\r
-/*****************************************************************\r
- *  NPSGetProviderHandleA [MPR.@]\r
- */\r
-DWORD WINAPI NPSGetProviderHandleA( PHPROVIDER phProvider )\r
-{\r
-    FIXME( "(%p): stub\n", phProvider );\r
-    return WN_NOT_SUPPORTED;\r
-}\r
-\r
-/*****************************************************************\r
- *  NPSGetProviderNameA [MPR.@]\r
- */\r
-DWORD WINAPI NPSGetProviderNameA( HPROVIDER hProvider, LPCSTR *lpszProviderName )\r
-{\r
-    FIXME( "(%p, %p): stub\n", hProvider, lpszProviderName );\r
-    return WN_NOT_SUPPORTED;\r
-}\r
-\r
-/*****************************************************************\r
- *  NPSGetSectionNameA [MPR.@]\r
- */\r
-DWORD WINAPI NPSGetSectionNameA( HPROVIDER hProvider, LPCSTR *lpszSectionName )\r
-{\r
-    FIXME( "(%p, %p): stub\n", hProvider, lpszSectionName );\r
-    return WN_NOT_SUPPORTED;\r
-}\r
-\r
-/*****************************************************************\r
- *  NPSSetExtendedErrorA [MPR.@]\r
- */\r
-DWORD WINAPI NPSSetExtendedErrorA( DWORD NetSpecificError, LPSTR lpExtendedErrorText )\r
-{\r
-    FIXME( "(%08lx, %s): stub\n", NetSpecificError, debugstr_a(lpExtendedErrorText) );\r
-    return WN_NOT_SUPPORTED;\r
-}\r
-\r
-/*****************************************************************\r
- *  NPSSetCustomTextA [MPR.@]\r
- */\r
-VOID WINAPI NPSSetCustomTextA( LPSTR lpCustomErrorText )\r
-{\r
-    FIXME( "(%s): stub\n", debugstr_a(lpCustomErrorText) );\r
-}\r
-\r
-/*****************************************************************\r
- *  NPSCopyStringA [MPR.@]\r
- */\r
-DWORD WINAPI NPSCopyStringA( LPCSTR lpString, LPVOID lpBuffer, LPDWORD lpdwBufferSize )\r
-{\r
-    FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpString), lpBuffer, lpdwBufferSize );\r
-    return WN_NOT_SUPPORTED;\r
-}\r
-\r
-/*****************************************************************\r
- *  NPSDeviceGetNumberA [MPR.@]\r
- */\r
-DWORD WINAPI NPSDeviceGetNumberA( LPSTR lpLocalName, LPDWORD lpdwNumber, LPDWORD lpdwType )\r
-{\r
-    FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpLocalName), lpdwNumber, lpdwType );\r
-    return WN_NOT_SUPPORTED;\r
-}\r
-\r
-/*****************************************************************\r
- *  NPSDeviceGetStringA [MPR.@]\r
- */\r
-DWORD WINAPI NPSDeviceGetStringA( DWORD dwNumber, DWORD dwType, LPSTR lpLocalName, LPDWORD lpdwBufferSize )\r
-{\r
-    FIXME( "(%ld, %ld, %p, %p): stub\n", dwNumber, dwType, lpLocalName, lpdwBufferSize );\r
-    return WN_NOT_SUPPORTED;\r
-}\r
-\r
-/*****************************************************************\r
- *  NPSNotifyRegisterA [MPR.@]\r
- */\r
-DWORD WINAPI NPSNotifyRegisterA( enum NOTIFYTYPE NotifyType, NOTIFYCALLBACK pfNotifyCallBack )\r
-{\r
-    FIXME( "(%d, %p): stub\n", NotifyType, pfNotifyCallBack );\r
-    return WN_NOT_SUPPORTED;\r
-}\r
-\r
-/*****************************************************************\r
- *  NPSNotifyGetContextA [MPR.@]\r
- */\r
-LPVOID WINAPI NPSNotifyGetContextA( NOTIFYCALLBACK pfNotifyCallBack )\r
-{\r
-    FIXME( "(%p): stub\n", pfNotifyCallBack );\r
-    return NULL;\r
-}\r
+/*
+ * MPR Network Provider Services functions
+ *
+ * Copyright 1999 Ulrich Weigand
+ * Copyright 2004 Mike McCormack for CodeWeavers Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "netspi.h"
+#include "wine/debug.h"
+#include "winerror.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(mpr);
+
+#include "wine/unicode.h"
+
+#include "mprres.h"
+
+/***********************************************************************
+ *         NPS_ProxyPasswordDialog
+ */
+static INT_PTR WINAPI NPS_ProxyPasswordDialog(
+    HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
+{
+    HWND hitem;
+    LPAUTHDLGSTRUCTA lpAuthDlgStruct;
+
+    if( uMsg == WM_INITDIALOG )
+    {
+        TRACE("WM_INITDIALOG (%08lx)\n", lParam);
+
+        /* save the parameter list */
+        lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) lParam;
+        SetWindowLongPtrW( hdlg, GWLP_USERDATA, lParam );
+
+        if( lpAuthDlgStruct->lpExplainText )
+        {
+            hitem = GetDlgItem( hdlg, IDC_EXPLAIN );
+            SetWindowTextA( hitem, lpAuthDlgStruct->lpExplainText );
+        }
+
+        /* extract the Realm from the proxy response and show it */
+        if( lpAuthDlgStruct->lpResource )
+        {
+            hitem = GetDlgItem( hdlg, IDC_REALM );
+            SetWindowTextA( hitem, lpAuthDlgStruct->lpResource );
+        }
+
+        return TRUE;
+    }
+
+    lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) GetWindowLongPtrW( hdlg, GWLP_USERDATA );
+
+    switch( uMsg )
+    {
+    case WM_COMMAND:
+        if( wParam == IDOK )
+        {
+            WCHAR username[0x20], password[0x20];
+
+            username[0] = 0;
+            hitem = GetDlgItem( hdlg, IDC_USERNAME );
+            if( hitem )
+                GetWindowTextA( hitem, lpAuthDlgStruct->lpUsername, lpAuthDlgStruct->cbUsername );
+            
+            password[0] = 0;
+            hitem = GetDlgItem( hdlg, IDC_PASSWORD );
+            if( hitem )
+                GetWindowTextA( hitem, lpAuthDlgStruct->lpPassword, lpAuthDlgStruct->cbPassword );
+
+            EndDialog( hdlg, WN_SUCCESS );
+            return TRUE;
+        }
+        if( wParam == IDCANCEL )
+        {
+            EndDialog( hdlg, WN_CANCEL );
+            return TRUE;
+        }
+        break;
+    }
+    return FALSE;
+}
+
+/*****************************************************************
+ *  NPSAuthenticationDialogA [MPR.@]
+ */
+DWORD WINAPI NPSAuthenticationDialogA( LPAUTHDLGSTRUCTA lpAuthDlgStruct )
+{
+    HMODULE hwininet = GetModuleHandleA( "mpr.dll" );
+
+    TRACE("%p\n", lpAuthDlgStruct);
+
+    if( !lpAuthDlgStruct )
+        return WN_BAD_POINTER;
+    if( lpAuthDlgStruct->cbStructure < sizeof *lpAuthDlgStruct )
+        return WN_BAD_POINTER;
+
+    TRACE("%s %s %s\n",lpAuthDlgStruct->lpResource,
+          lpAuthDlgStruct->lpOUTitle, lpAuthDlgStruct->lpExplainText);
+
+    return DialogBoxParamW( hwininet, MAKEINTRESOURCEW( IDD_PROXYDLG ),
+             lpAuthDlgStruct->hwndOwner, NPS_ProxyPasswordDialog, 
+             (LPARAM) lpAuthDlgStruct );
+}
+
+/*****************************************************************
+ *  NPSGetProviderHandleA [MPR.@]
+ */
+DWORD WINAPI NPSGetProviderHandleA( PHPROVIDER phProvider )
+{
+    FIXME( "(%p): stub\n", phProvider );
+    return WN_NOT_SUPPORTED;
+}
+
+/*****************************************************************
+ *  NPSGetProviderNameA [MPR.@]
+ */
+DWORD WINAPI NPSGetProviderNameA( HPROVIDER hProvider, LPCSTR *lpszProviderName )
+{
+    FIXME( "(%p, %p): stub\n", hProvider, lpszProviderName );
+    return WN_NOT_SUPPORTED;
+}
+
+/*****************************************************************
+ *  NPSGetSectionNameA [MPR.@]
+ */
+DWORD WINAPI NPSGetSectionNameA( HPROVIDER hProvider, LPCSTR *lpszSectionName )
+{
+    FIXME( "(%p, %p): stub\n", hProvider, lpszSectionName );
+    return WN_NOT_SUPPORTED;
+}
+
+/*****************************************************************
+ *  NPSSetExtendedErrorA [MPR.@]
+ */
+DWORD WINAPI NPSSetExtendedErrorA( DWORD NetSpecificError, LPSTR lpExtendedErrorText )
+{
+    FIXME( "(%08lx, %s): stub\n", NetSpecificError, debugstr_a(lpExtendedErrorText) );
+    return WN_NOT_SUPPORTED;
+}
+
+/*****************************************************************
+ *  NPSSetCustomTextA [MPR.@]
+ */
+VOID WINAPI NPSSetCustomTextA( LPSTR lpCustomErrorText )
+{
+    FIXME( "(%s): stub\n", debugstr_a(lpCustomErrorText) );
+}
+
+/*****************************************************************
+ *  NPSCopyStringA [MPR.@]
+ */
+DWORD WINAPI NPSCopyStringA( LPCSTR lpString, LPVOID lpBuffer, LPDWORD lpdwBufferSize )
+{
+    FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpString), lpBuffer, lpdwBufferSize );
+    return WN_NOT_SUPPORTED;
+}
+
+/*****************************************************************
+ *  NPSDeviceGetNumberA [MPR.@]
+ */
+DWORD WINAPI NPSDeviceGetNumberA( LPSTR lpLocalName, LPDWORD lpdwNumber, LPDWORD lpdwType )
+{
+    FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpLocalName), lpdwNumber, lpdwType );
+    return WN_NOT_SUPPORTED;
+}
+
+/*****************************************************************
+ *  NPSDeviceGetStringA [MPR.@]
+ */
+DWORD WINAPI NPSDeviceGetStringA( DWORD dwNumber, DWORD dwType, LPSTR lpLocalName, LPDWORD lpdwBufferSize )
+{
+    FIXME( "(%ld, %ld, %p, %p): stub\n", dwNumber, dwType, lpLocalName, lpdwBufferSize );
+    return WN_NOT_SUPPORTED;
+}
+
+/*****************************************************************
+ *  NPSNotifyRegisterA [MPR.@]
+ */
+DWORD WINAPI NPSNotifyRegisterA( enum NOTIFYTYPE NotifyType, NOTIFYCALLBACK pfNotifyCallBack )
+{
+    FIXME( "(%d, %p): stub\n", NotifyType, pfNotifyCallBack );
+    return WN_NOT_SUPPORTED;
+}
+
+/*****************************************************************
+ *  NPSNotifyGetContextA [MPR.@]
+ */
+LPVOID WINAPI NPSNotifyGetContextA( NOTIFYCALLBACK pfNotifyCallBack )
+{
+    FIXME( "(%p): stub\n", pfNotifyCallBack );
+    return NULL;
+}