MPR: add proxy authentication dialog
Mike McCormack
mike at codeweavers.com
Fri Jan 7 09:26:06 CST 2005
This allows native wininet to ask for a proxy password.
Mike
ChangeLog:
* add proxy authentication dialog
-------------- next part --------------
? dlls/mpr/version.res
Index: dlls/mpr/mpr.rc
===================================================================
RCS file: /home/wine/wine/dlls/mpr/mpr.rc,v
retrieving revision 1.9
diff -u -r1.9 mpr.rc
--- dlls/mpr/mpr.rc 27 Oct 2004 00:47:53 -0000 1.9
+++ dlls/mpr/mpr.rc 7 Jan 2005 15:24:35 -0000
@@ -19,6 +19,7 @@
*/
#include "windef.h"
#include "winbase.h"
+#include "winuser.h"
#include "mprres.h"
#include "version.rc"
Index: dlls/mpr/mpr_En.rc
===================================================================
RCS file: /home/wine/wine/dlls/mpr/mpr_En.rc,v
retrieving revision 1.1
diff -u -r1.1 mpr_En.rc
--- dlls/mpr/mpr_En.rc 5 Apr 2004 23:14:26 -0000 1.1
+++ dlls/mpr/mpr_En.rc 7 Jan 2005 15:24:35 -0000
@@ -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
+}
Index: dlls/mpr/mprres.h
===================================================================
RCS file: /home/wine/wine/dlls/mpr/mprres.h,v
retrieving revision 1.1
diff -u -r1.1 mprres.h
--- dlls/mpr/mprres.h 5 Apr 2004 23:14:26 -0000 1.1
+++ dlls/mpr/mprres.h 7 Jan 2005 15:24:35 -0000
@@ -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__ */
Index: dlls/mpr/nps.c
===================================================================
RCS file: /home/wine/wine/dlls/mpr/nps.c,v
retrieving revision 1.5
diff -u -r1.5 nps.c
--- dlls/mpr/nps.c 5 Sep 2003 23:08:36 -0000 1.5
+++ dlls/mpr/nps.c 7 Jan 2005 15:24:35 -0000
@@ -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 );
}
/*****************************************************************
More information about the wine-patches
mailing list