Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
6b15db87
Commit
6b15db87
authored
Jul 23, 2009
by
Hans Leidekker
Committed by
Alexandre Julliard
Jul 23, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Add a regular authentication dialog.
parent
29162c65
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
149 additions
and
9 deletions
+149
-9
dialogs.c
dlls/wininet/dialogs.c
+127
-9
resource.h
dlls/wininet/resource.h
+2
-0
wininet_En.rc
dlls/wininet/wininet_En.rc
+20
-0
No files found.
dlls/wininet/dialogs.c
View file @
6b15db87
...
...
@@ -95,6 +95,34 @@ done:
}
/***********************************************************************
* WININET_GetServer
*
* Determine the name of the web server
*/
static
BOOL
WININET_GetServer
(
HINTERNET
hRequest
,
LPWSTR
szBuf
,
DWORD
sz
)
{
http_request_t
*
lpwhr
;
http_session_t
*
lpwhs
=
NULL
;
BOOL
ret
=
FALSE
;
lpwhr
=
(
http_request_t
*
)
WININET_GetObject
(
hRequest
);
if
(
NULL
==
lpwhr
)
goto
done
;
lpwhs
=
lpwhr
->
lpHttpSession
;
if
(
NULL
==
lpwhs
)
goto
done
;
lstrcpynW
(
szBuf
,
lpwhs
->
lpszHostName
,
sz
);
ret
=
TRUE
;
done:
WININET_Release
(
&
lpwhr
->
hdr
);
return
ret
;
}
/***********************************************************************
* WININET_GetAuthRealm
*
* Determine the name of the (basic) Authentication realm
...
...
@@ -349,6 +377,90 @@ static INT_PTR WINAPI WININET_ProxyPasswordDialog(
}
/***********************************************************************
* WININET_PasswordDialog
*/
static
INT_PTR
WINAPI
WININET_PasswordDialog
(
HWND
hdlg
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
HWND
hitem
;
struct
WININET_ErrorDlgParams
*
params
;
WCHAR
szRealm
[
0x80
],
szServer
[
0x80
];
if
(
uMsg
==
WM_INITDIALOG
)
{
TRACE
(
"WM_INITDIALOG (%08lx)
\n
"
,
lParam
);
/* save the parameter list */
params
=
(
struct
WININET_ErrorDlgParams
*
)
lParam
;
SetWindowLongPtrW
(
hdlg
,
GWLP_USERDATA
,
lParam
);
/* extract the Realm from the response and show it */
if
(
WININET_GetAuthRealm
(
params
->
hRequest
,
szRealm
,
sizeof
szRealm
/
sizeof
(
WCHAR
),
FALSE
)
)
{
hitem
=
GetDlgItem
(
hdlg
,
IDC_REALM
);
SetWindowTextW
(
hitem
,
szRealm
);
}
/* extract the name of the server */
if
(
WININET_GetServer
(
params
->
hRequest
,
szServer
,
sizeof
szServer
/
sizeof
(
WCHAR
))
)
{
hitem
=
GetDlgItem
(
hdlg
,
IDC_SERVER
);
SetWindowTextW
(
hitem
,
szServer
);
}
WININET_GetSetPassword
(
hdlg
,
szServer
,
szRealm
,
FALSE
);
return
TRUE
;
}
params
=
(
struct
WININET_ErrorDlgParams
*
)
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
)
GetWindowTextW
(
hitem
,
username
,
sizeof
username
/
sizeof
(
WCHAR
)
);
password
[
0
]
=
0
;
hitem
=
GetDlgItem
(
hdlg
,
IDC_PASSWORD
);
if
(
hitem
)
GetWindowTextW
(
hitem
,
password
,
sizeof
password
/
sizeof
(
WCHAR
)
);
hitem
=
GetDlgItem
(
hdlg
,
IDC_SAVEPASSWORD
);
if
(
hitem
&&
SendMessageW
(
hitem
,
BM_GETSTATE
,
0
,
0
)
&&
WININET_GetAuthRealm
(
params
->
hRequest
,
szRealm
,
sizeof
szRealm
/
sizeof
(
WCHAR
),
FALSE
)
&&
WININET_GetServer
(
params
->
hRequest
,
szServer
,
sizeof
szServer
/
sizeof
(
WCHAR
))
)
{
WININET_GetSetPassword
(
hdlg
,
szServer
,
szRealm
,
TRUE
);
}
WININET_SetAuthorization
(
params
->
hRequest
,
username
,
password
,
FALSE
);
EndDialog
(
hdlg
,
ERROR_INTERNET_FORCE_RETRY
);
return
TRUE
;
}
if
(
wParam
==
IDCANCEL
)
{
EndDialog
(
hdlg
,
0
);
return
TRUE
;
}
break
;
}
return
FALSE
;
}
/***********************************************************************
* WININET_GetConnectionStatus
*/
static
INT
WININET_GetConnectionStatus
(
HINTERNET
hRequest
)
...
...
@@ -392,17 +504,23 @@ DWORD WINAPI InternetErrorDlg(HWND hWnd, HINTERNET hRequest,
switch
(
dwError
)
{
case
ERROR_SUCCESS
:
if
(
!
(
dwFlags
&
FLAGS_ERROR_UI_FILTER_FOR_ERRORS
)
)
case
ERROR_INTERNET_INCORRECT_PASSWORD
:
if
(
!
dwError
&&
!
(
dwFlags
&
FLAGS_ERROR_UI_FILTER_FOR_ERRORS
)
)
return
0
;
dwStatus
=
WININET_GetConnectionStatus
(
hRequest
);
if
(
HTTP_STATUS_PROXY_AUTH_REQ
!=
dwStatus
)
return
ERROR_SUCCESS
;
return
DialogBoxParamW
(
hwininet
,
MAKEINTRESOURCEW
(
IDD_PROXYDLG
),
hWnd
,
WININET_ProxyPasswordDialog
,
(
LPARAM
)
&
params
);
case
ERROR_INTERNET_INCORRECT_PASSWORD
:
return
DialogBoxParamW
(
hwininet
,
MAKEINTRESOURCEW
(
IDD_PROXYDLG
),
hWnd
,
WININET_ProxyPasswordDialog
,
(
LPARAM
)
&
params
);
dwStatus
=
WININET_GetConnectionStatus
(
hRequest
);
switch
(
dwStatus
)
{
case
HTTP_STATUS_PROXY_AUTH_REQ
:
return
DialogBoxParamW
(
hwininet
,
MAKEINTRESOURCEW
(
IDD_PROXYDLG
),
hWnd
,
WININET_ProxyPasswordDialog
,
(
LPARAM
)
&
params
);
case
HTTP_STATUS_DENIED
:
return
DialogBoxParamW
(
hwininet
,
MAKEINTRESOURCEW
(
IDD_AUTHDLG
),
hWnd
,
WININET_PasswordDialog
,
(
LPARAM
)
&
params
);
default:
WARN
(
"unhandled status %u
\n
"
,
dwStatus
);
return
0
;
}
case
ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR
:
case
ERROR_INTERNET_INVALID_CA
:
...
...
dlls/wininet/resource.h
View file @
6b15db87
...
...
@@ -21,6 +21,7 @@
#include <windef.h>
#include <winuser.h>
#define IDD_AUTHDLG 0x399
#define IDD_PROXYDLG 0x400
#define IDC_PROXY 0x401
...
...
@@ -28,5 +29,6 @@
#define IDC_USERNAME 0x403
#define IDC_PASSWORD 0x404
#define IDC_SAVEPASSWORD 0x405
#define IDC_SERVER 0x406
#define IDS_LANCONNECTION 0x500
dlls/wininet/wininet_En.rc
View file @
6b15db87
...
...
@@ -40,6 +40,26 @@ FONT 8, "MS Shell Dlg"
PUSHBUTTON "Cancel", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}
IDD_AUTHDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Authentication Required"
FONT 8, "MS Shell Dlg"
{
LTEXT "Please enter your username and password:", -1, 40, 6, 150, 15
LTEXT "Server", -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_SERVER, 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
}
STRINGTABLE DISCARDABLE
{
IDS_LANCONNECTION "LAN Connection"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment