Sync to Wine-20050111:
Mike McCormack <mike(a)codeweavers.com>
- Add proxy authentication dialog.
Michael Stefaniuc <mstefani(a)redhat.de>
- Do not check for non NULL pointer before HeapFree'ing it. It's
redundant.
Modified: trunk/reactos/lib/mpr/mpr.rc
Modified: trunk/reactos/lib/mpr/mpr_En.rc
Modified: trunk/reactos/lib/mpr/mprres.h
Modified: trunk/reactos/lib/mpr/nps.c
Modified: trunk/reactos/lib/mpr/wnet.c
_____
Modified: trunk/reactos/lib/mpr/mpr.rc
--- trunk/reactos/lib/mpr/mpr.rc 2005-01-11 23:17:12 UTC (rev
12940)
+++ trunk/reactos/lib/mpr/mpr.rc 2005-01-11 23:19:40 UTC (rev
12941)
@@ -19,6 +19,7 @@
*/
#include "windef.h"
#include "winbase.h"
+#include "winuser.h"
#include "mprres.h"
#include "version.rc"
_____
Modified: trunk/reactos/lib/mpr/mpr_En.rc
--- trunk/reactos/lib/mpr/mpr_En.rc 2005-01-11 23:17:12 UTC (rev
12940)
+++ trunk/reactos/lib/mpr/mpr_En.rc 2005-01-11 23:19:40 UTC (rev
12941)
@@ -24,3 +24,23 @@
{
IDS_ENTIRENETWORK "Entire Network"
}
+
+IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Enter Network Password"
+FONT 8, "Helv"
+{
+ LTEXT "Please enter your username and password:", IDC_EXPLAIN, 40, 6,
150, 15
+ LTEXT "Proxy", -1, 40, 26, 50, 10
+/* LTEXT "Realm", -1, 40, 46, 50, 10 */
+ LTEXT "User", -1, 40, 66, 50, 10
+ LTEXT "Password", -1, 40, 86, 50, 10
+ LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
+ LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
+ EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER |
WS_TABSTOP
+ EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER |
WS_TABSTOP | ES_PASSWORD
+ CHECKBOX "&Save this password (Insecure)", IDC_SAVEPASSWORD,
+ 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP |
BS_DEFPUSHBUTTON
+ PUSHBUTTON "Cancel", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
+}
_____
Modified: trunk/reactos/lib/mpr/mprres.h
--- trunk/reactos/lib/mpr/mprres.h 2005-01-11 23:17:12 UTC (rev
12940)
+++ trunk/reactos/lib/mpr/mprres.h 2005-01-11 23:19:40 UTC (rev
12941)
@@ -20,4 +20,13 @@
#define IDS_ENTIRENETWORK 1
+#define IDD_PROXYDLG 0x400
+
+#define IDC_PROXY 0x401
+#define IDC_REALM 0x402
+#define IDC_USERNAME 0x403
+#define IDC_PASSWORD 0x404
+#define IDC_SAVEPASSWORD 0x405
+#define IDC_EXPLAIN 0x406
+
#endif /* ndef __WINE_MPRRES_H__ */
_____
Modified: trunk/reactos/lib/mpr/nps.c
--- trunk/reactos/lib/mpr/nps.c 2005-01-11 23:17:12 UTC (rev 12940)
+++ trunk/reactos/lib/mpr/nps.c 2005-01-11 23:19:40 UTC (rev 12941)
@@ -2,6 +2,7 @@
* 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
@@ -18,24 +19,109 @@
* 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 "winnetwk.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
)
{
- FIXME( "(%p): stub\n", lpAuthDlgStruct );
- return WN_NOT_SUPPORTED;
+ 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 );
}
/*****************************************************************
_____
Modified: trunk/reactos/lib/mpr/wnet.c
--- trunk/reactos/lib/mpr/wnet.c 2005-01-11 23:17:12 UTC (rev
12940)
+++ trunk/reactos/lib/mpr/wnet.c 2005-01-11 23:19:40 UTC (rev
12941)
@@ -198,8 +198,7 @@
{
WARN("Provider %s didn't export NPGetCaps\n",
debugstr_w(provider));
- if (name)
- HeapFree(GetProcessHeap(), 0, name);
+ HeapFree(GetProcessHeap(), 0, name);
FreeLibrary(hLib);
}
}
@@ -312,8 +311,7 @@
HeapFree(GetProcessHeap(), 0,
providerTable->table[i].name);
FreeModule(providerTable->table[i].hLib);
}
- if (providerTable->entireNetwork)
- HeapFree(GetProcessHeap(), 0,
providerTable->entireNetwork);
+ HeapFree(GetProcessHeap(), 0, providerTable->entireNetwork);
HeapFree(GetProcessHeap(), 0, providerTable);
providerTable = NULL;
}
@@ -372,8 +370,7 @@
{
if (lpNet)
{
- if (lpNet->lpRemoteName)
- HeapFree(GetProcessHeap(), 0, lpNet->lpRemoteName);
+ HeapFree(GetProcessHeap(), 0, lpNet->lpRemoteName);
HeapFree(GetProcessHeap(), 0, lpNet);
}
}