ReactOS 0.4.16-dev-197-g92996da
dialogs.c File Reference
#include "ws2tcpip.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winreg.h"
#include "wininet.h"
#include "winnetwk.h"
#include "wine/debug.h"
#include "winerror.h"
#include "shlwapi.h"
#include "cryptuiapi.h"
#include "internet.h"
#include "resource.h"
Include dependency graph for dialogs.c:

Go to the source code of this file.

Classes

struct  WININET_ErrorDlgParams
 

Macros

#define NO_SHLWAPI_STREAM
 
#define MAX_STRING_LEN   1024
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wininet)
 
static BOOL WININET_GetAuthRealm (HINTERNET hRequest, LPWSTR szBuf, DWORD sz, BOOL proxy)
 
DWORD WINAPI WNetCachePassword (LPSTR, WORD, LPSTR, WORD, BYTE, WORD)
 
DWORD WINAPI WNetGetCachedPassword (LPSTR, WORD, LPSTR, LPWORD, BYTE)
 
static BOOL WININET_GetSetPassword (HWND hdlg, LPCWSTR szServer, LPCWSTR szRealm, BOOL bSet)
 
static BOOL WININET_SetAuthorization (http_request_t *request, LPWSTR username, LPWSTR password, BOOL proxy)
 
static INT_PTR WINAPI WININET_ProxyPasswordDialog (HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR WINAPI WININET_PasswordDialog (HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR WINAPI WININET_InvalidCertificateDialog (HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
DWORD WINAPI InternetErrorDlg (HWND hWnd, HINTERNET hRequest, DWORD dwError, DWORD dwFlags, LPVOID *lppvData)
 
BOOL WINAPI InternetShowSecurityInfoByURLA (LPCSTR url, HWND window)
 
BOOL WINAPI InternetShowSecurityInfoByURLW (LPCWSTR url, HWND window)
 
DWORD WINAPI ParseX509EncodedCertificateForListBoxEntry (LPBYTE cert, DWORD len, LPSTR szlistbox, LPDWORD listbox)
 
DWORD WINAPI ShowX509EncodedCertificate (HWND parent, LPBYTE cert, DWORD len)
 

Macro Definition Documentation

◆ MAX_STRING_LEN

#define MAX_STRING_LEN   1024

Definition at line 44 of file dialogs.c.

◆ NO_SHLWAPI_STREAM

#define NO_SHLWAPI_STREAM

Definition at line 36 of file dialogs.c.

Function Documentation

◆ InternetErrorDlg()

DWORD WINAPI InternetErrorDlg ( HWND  hWnd,
HINTERNET  hRequest,
DWORD  dwError,
DWORD  dwFlags,
LPVOID lppvData 
)

Definition at line 472 of file dialogs.c.

474{
478
479 TRACE("%p %p %d %08x %p\n", hWnd, hRequest, dwError, dwFlags, lppvData);
480
483
484 if(hRequest) {
486 if(!req)
488 if(req->hdr.htype != WH_HHTTPREQ)
489 return ERROR_SUCCESS; /* Yes, that was tested */
490 }
491
492 params.req = req;
493 params.hWnd = hWnd;
494 params.dwError = dwError;
495 params.dwFlags = dwFlags;
496 params.lppvData = lppvData;
497
498 switch( dwError )
499 {
500 case ERROR_SUCCESS:
503 break;
504 if(!req)
506
507 switch(req->status_code) {
511 break;
515 break;
516 default:
517 WARN("unhandled status %u\n", req->status_code);
518 }
519 break;
520 }
528 break;
529 }
530 if(!req)
532
533
535 FIXME("%08x contains unsupported flags.\n", dwFlags);
536
539 break;
542 FIXME("Need to display dialog for error %d\n", dwError);
544 break;
545 default:
547 }
548
549 if(req)
551 return res;
552}
HWND hWnd
Definition: settings.c:17
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define ERROR_NOT_SUPPORTED
Definition: compat.h:100
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
static INT_PTR WINAPI WININET_InvalidCertificateDialog(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.c:364
static INT_PTR WINAPI WININET_PasswordDialog(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.c:287
static INT_PTR WINAPI WININET_ProxyPasswordDialog(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.c:212
BOOL WININET_Release(object_header_t *info)
Definition: internet.c:211
object_header_t * get_handle_object(HINTERNET hinternet)
Definition: internet.c:176
HMODULE WININET_hModule
Definition: internet.c:73
#define IDD_INVCERTDLG
Definition: resource.h:26
#define IDD_AUTHDLG
Definition: resource.h:27
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613
GLenum const GLfloat * params
Definition: glext.h:5645
@ WH_HHTTPREQ
Definition: internet.h:240
#define IDD_PROXYDLG
Definition: mprres.h:26
#define TRACE(s)
Definition: solgame.cpp:4
http_request_t * req
Definition: dialogs.c:50
WH_TYPE htype
Definition: internet.h:273
object_header_t hdr
Definition: internet.h:345
DWORD status_code
Definition: internet.h:357
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
LONG_PTR LPARAM
Definition: windef.h:208
#define ERROR_CANCELLED
Definition: winerror.h:726
#define HTTP_STATUS_PROXY_AUTH_REQ
Definition: winhttp.h:262
#define HTTP_STATUS_DENIED
Definition: winhttp.h:256
#define ERROR_INTERNET_SEC_CERT_CN_INVALID
Definition: wininet.h:2026
#define ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR
Definition: wininet.h:2027
#define FLAGS_ERROR_UI_FILTER_FOR_ERRORS
Definition: wininet.h:1906
#define ERROR_INTERNET_INVALID_CA
Definition: wininet.h:2033
#define ERROR_INTERNET_INCORRECT_PASSWORD
Definition: wininet.h:2003
#define ERROR_INTERNET_SEC_CERT_DATE_INVALID
Definition: wininet.h:2025
#define FLAGS_ERROR_UI_FLAGS_NO_UI
Definition: wininet.h:1909
#define ERROR_INTERNET_POST_IS_NON_SECURE
Definition: wininet.h:2031
#define ERROR_INTERNET_SEC_CERT_REV_FAILED
Definition: wininet.h:2044
#define ERROR_INTERNET_SEC_CERT_ERRORS
Definition: wininet.h:2042
#define FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS
Definition: wininet.h:1907
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by handle_http_error(), and test_InternetErrorDlg().

◆ InternetShowSecurityInfoByURLA()

BOOL WINAPI InternetShowSecurityInfoByURLA ( LPCSTR  url,
HWND  window 
)

Definition at line 557 of file dialogs.c.

558{
559 FIXME("stub: %s %p\n", url, window);
560 return FALSE;
561}
#define FALSE
Definition: types.h:117
static const WCHAR url[]
Definition: encode.c:1432
static IHTMLWindow2 * window
Definition: events.c:77

◆ InternetShowSecurityInfoByURLW()

BOOL WINAPI InternetShowSecurityInfoByURLW ( LPCWSTR  url,
HWND  window 
)

Definition at line 566 of file dialogs.c.

567{
568 FIXME("stub: %s %p\n", debugstr_w(url), window);
569 return FALSE;
570}
#define debugstr_w
Definition: kernel32.h:32

◆ ParseX509EncodedCertificateForListBoxEntry()

DWORD WINAPI ParseX509EncodedCertificateForListBoxEntry ( LPBYTE  cert,
DWORD  len,
LPSTR  szlistbox,
LPDWORD  listbox 
)

Definition at line 575 of file dialogs.c.

576{
577 FIXME("stub: %p %d %s %p\n", cert, len, debugstr_a(szlistbox), listbox);
579}
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
GLenum GLsizei len
Definition: glext.h:6722
#define debugstr_a
Definition: kernel32.h:31
static BYTE cert[]
Definition: msg.c:1437

◆ ShowX509EncodedCertificate()

DWORD WINAPI ShowX509EncodedCertificate ( HWND  parent,
LPBYTE  cert,
DWORD  len 
)

Definition at line 584 of file dialogs.c.

585{
587 cert, len);
588 DWORD ret;
589
590 if (certContext)
591 {
593
594 memset(&view, 0, sizeof(view));
595 view.hwndParent = parent;
596 view.pCertContext = certContext;
599 else
600 ret = GetLastError();
601 CertFreeCertificateContext(certContext);
602 }
603 else
604 ret = GetLastError();
605 return ret;
606}
BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:371
PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded)
Definition: cert.c:316
BOOL WINAPI CryptUIDlgViewCertificateW(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, BOOL *pfPropertiesChanged)
Definition: main.c:4413
r parent
Definition: btrfs.c:3010
#define memset(x, y, z)
Definition: compat.h:39
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wininet  )

◆ WININET_GetAuthRealm()

static BOOL WININET_GetAuthRealm ( HINTERNET  hRequest,
LPWSTR  szBuf,
DWORD  sz,
BOOL  proxy 
)
static

Definition at line 62 of file dialogs.c.

63{
64 LPWSTR p, q;
66
67 if (proxy)
69 else
71
72 /* extract the Realm from the response and show it */
73 index = 0;
74 if( !HttpQueryInfoW( hRequest, query, szBuf, &sz, &index) )
75 return FALSE;
76
77 /*
78 * FIXME: maybe we should check that we're
79 * dealing with 'Basic' Authentication
80 */
81 p = wcschr( szBuf, ' ' );
82 if( !p || wcsncmp( p+1, L"realm=", lstrlenW(L"realm=") ) )
83 {
84 ERR("response wrong? (%s)\n", debugstr_w(szBuf));
85 return FALSE;
86 }
87
88 /* remove quotes */
89 p += 7;
90 if( *p == '"' )
91 {
92 p++;
93 q = wcsrchr( p, '"' );
94 if( q )
95 *q = 0;
96 }
97 lstrcpyW( szBuf, p );
98
99 return TRUE;
100}
#define index(s, c)
Definition: various.h:29
#define ERR(fmt,...)
Definition: precomp.h:57
#define TRUE
Definition: types.h:120
#define wcschr
Definition: compat.h:17
#define wcsrchr
Definition: compat.h:16
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:3870
int proxy
Definition: main.c:67
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLuint index
Definition: glext.h:6031
GLfloat GLfloat p
Definition: glext.h:8902
#define L(x)
Definition: ntvdm.h:50
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define HTTP_QUERY_PROXY_AUTHENTICATE
Definition: wininet.h:1564
#define HTTP_QUERY_WWW_AUTHENTICATE
Definition: wininet.h:1563
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by WININET_PasswordDialog(), and WININET_ProxyPasswordDialog().

◆ WININET_GetSetPassword()

static BOOL WININET_GetSetPassword ( HWND  hdlg,
LPCWSTR  szServer,
LPCWSTR  szRealm,
BOOL  bSet 
)
static

Definition at line 109 of file dialogs.c.

111{
112 WCHAR szResource[0x80], szUserPass[0x40];
113 LPWSTR p;
114 HWND hUserItem, hPassItem;
115 DWORD r, dwMagic = 19;
116 UINT r_len, u_len;
117 WORD sz;
118
119 hUserItem = GetDlgItem( hdlg, IDC_USERNAME );
120 hPassItem = GetDlgItem( hdlg, IDC_PASSWORD );
121
122 /* now try fetch the username and password */
123 lstrcpyW( szResource, szServer);
124 lstrcatW( szResource, L"/");
125 lstrcatW( szResource, szRealm);
126
127 /*
128 * WNetCachePassword is only concerned with the length
129 * of the data stored (which we tell it) and it does
130 * not use strlen() internally so we can add WCHAR data
131 * instead of ASCII data and get it back the same way.
132 */
133 if( bSet )
134 {
135 szUserPass[0] = 0;
136 GetWindowTextW( hUserItem, szUserPass, ARRAY_SIZE( szUserPass ) - 1 );
137 lstrcatW(szUserPass, L":");
138 u_len = lstrlenW( szUserPass );
139 GetWindowTextW( hPassItem, szUserPass+u_len, ARRAY_SIZE( szUserPass ) - u_len );
140
141 r_len = (lstrlenW( szResource ) + 1)*sizeof(WCHAR);
142 u_len = (lstrlenW( szUserPass ) + 1)*sizeof(WCHAR);
143 r = WNetCachePassword( (CHAR*)szResource, r_len,
144 (CHAR*)szUserPass, u_len, dwMagic, 0 );
145
146 return ( r == WN_SUCCESS );
147 }
148
149 sz = sizeof szUserPass;
150 r_len = (lstrlenW( szResource ) + 1)*sizeof(WCHAR);
151 r = WNetGetCachedPassword( (CHAR*)szResource, r_len,
152 (CHAR*)szUserPass, &sz, dwMagic );
153 if( r != WN_SUCCESS )
154 return FALSE;
155
156 p = wcschr( szUserPass, ':' );
157 if( p )
158 {
159 *p = 0;
160 SetWindowTextW( hUserItem, szUserPass );
161 SetWindowTextW( hPassItem, p+1 );
162 }
163
164 return TRUE;
165}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define IDC_USERNAME
Definition: resource.h:82
#define IDC_PASSWORD
Definition: resource.h:20
DWORD WINAPI WNetGetCachedPassword(LPSTR, WORD, LPSTR, LPWORD, BYTE)
Definition: pwcache.c:180
DWORD WINAPI WNetCachePassword(LPSTR, WORD, LPSTR, WORD, BYTE, WORD)
Definition: pwcache.c:85
unsigned short WORD
Definition: ntddk_ex.h:93
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
unsigned int UINT
Definition: ndis.h:50
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1384
#define WN_SUCCESS
Definition: winnetwk.h:111
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175

Referenced by WININET_PasswordDialog(), and WININET_ProxyPasswordDialog().

◆ WININET_InvalidCertificateDialog()

static INT_PTR WINAPI WININET_InvalidCertificateDialog ( HWND  hdlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 364 of file dialogs.c.

366{
368 HWND hitem;
369 WCHAR buf[1024];
370
371 if( uMsg == WM_INITDIALOG )
372 {
373 TRACE("WM_INITDIALOG (%08lx)\n", lParam);
374
375 /* save the parameter list */
378
379 switch( params->dwError )
380 {
383 break;
386 break;
389 break;
391 /* FIXME: We should fetch information about the
392 * certificate here and show all the relevant errors.
393 */
395 break;
396 default:
397 FIXME( "No message for error %d\n", params->dwError );
398 buf[0] = '\0';
399 }
400
401 hitem = GetDlgItem( hdlg, IDC_CERT_ERROR );
402 SetWindowTextW( hitem, buf );
403
404 return TRUE;
405 }
406
409
410 switch( uMsg )
411 {
412 case WM_COMMAND:
413 if( wParam == IDOK )
414 {
416 {
417 http_request_t *req = params->req;
418 DWORD flags, size = sizeof(flags);
419
421 switch( params->dwError )
422 {
425 break;
428 break;
431 break;
434 break;
444 break;
445 }
446 /* FIXME: Use helper function */
451 }
452
453 EndDialog( hdlg, ERROR_SUCCESS );
454 return TRUE;
455 }
456 if( wParam == IDCANCEL )
457 {
458 TRACE("Pressed cancel.\n");
459
460 EndDialog( hdlg, ERROR_CANCELLED );
461 return TRUE;
462 }
463 break;
464 }
465
466 return FALSE;
467}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2697
#define IDS_CERT_CN_INVALID
Definition: resource.h:41
#define IDS_CERT_DATE_INVALID
Definition: resource.h:40
#define IDC_CERT_ERROR
Definition: resource.h:36
#define IDS_CERT_ERRORS
Definition: resource.h:42
#define IDS_CERT_CA_INVALID
Definition: resource.h:39
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
#define _SECURITY_FLAG_CERT_REV_FAILED
Definition: internet.h:472
#define _SECURITY_FLAG_CERT_INVALID_CN
Definition: internet.h:474
#define _SECURITY_FLAG_CERT_INVALID_DATE
Definition: internet.h:475
BOOL is_valid_netconn(netconn_t *) DECLSPEC_HIDDEN
#define _SECURITY_FLAG_CERT_INVALID_CA
Definition: internet.h:473
HINTERNET hInternet
Definition: internet.h:275
DWORD security_flags
Definition: internet.h:352
netconn_t * netconn
Definition: internet.h:351
DWORD security_flags
Definition: internet.h:81
#define GWLP_USERDATA
Definition: treelist.c:63
#define SECURITY_FLAG_IGNORE_CERT_DATE_INVALID
Definition: winhttp.h:282
#define SECURITY_FLAG_SECURE
Definition: winhttp.h:285
#define SECURITY_FLAG_IGNORE_UNKNOWN_CA
Definition: winhttp.h:281
#define SECURITY_FLAG_IGNORE_CERT_CN_INVALID
Definition: winhttp.h:283
#define INTERNET_OPTION_SECURITY_FLAGS
Definition: wininet.h:725
#define SECURITY_FLAG_IGNORE_REVOCATION
Definition: wininet.h:829
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define IDCANCEL
Definition: winuser.h:834
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define WM_COMMAND
Definition: winuser.h:1743
#define WM_INITDIALOG
Definition: winuser.h:1742
#define IDOK
Definition: winuser.h:833
#define SetWindowLongPtrW
Definition: winuser.h:5358
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by InternetErrorDlg().

◆ WININET_PasswordDialog()

static INT_PTR WINAPI WININET_PasswordDialog ( HWND  hdlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 287 of file dialogs.c.

289{
290 HWND hitem;
292 WCHAR szRealm[0x80];
293
294 if( uMsg == WM_INITDIALOG )
295 {
296 TRACE("WM_INITDIALOG (%08lx)\n", lParam);
297
298 /* save the parameter list */
301
302 /* extract the Realm from the response and show it */
303 if( WININET_GetAuthRealm( params->req->hdr.hInternet,
304 szRealm, ARRAY_SIZE( szRealm ), FALSE ) )
305 {
306 hitem = GetDlgItem( hdlg, IDC_REALM );
307 SetWindowTextW( hitem, szRealm );
308 }
309
310 hitem = GetDlgItem( hdlg, IDC_SERVER );
311 SetWindowTextW( hitem, params->req->session->hostName );
312
313 WININET_GetSetPassword( hdlg, params->req->session->hostName, szRealm, FALSE );
314
315 return TRUE;
316 }
317
320
321 switch( uMsg )
322 {
323 case WM_COMMAND:
324 if( wParam == IDOK )
325 {
326 WCHAR username[0x20], password[0x20];
327
328 username[0] = 0;
329 hitem = GetDlgItem( hdlg, IDC_USERNAME );
330 if( hitem )
332
333 password[0] = 0;
334 hitem = GetDlgItem( hdlg, IDC_PASSWORD );
335 if( hitem )
337
338 hitem = GetDlgItem( hdlg, IDC_SAVEPASSWORD );
339 if( hitem &&
340 SendMessageW( hitem, BM_GETSTATE, 0, 0 ) &&
341 WININET_GetAuthRealm( params->req->hdr.hInternet,
342 szRealm, ARRAY_SIZE( szRealm ), FALSE ))
343 {
344 WININET_GetSetPassword( hdlg, params->req->session->hostName, szRealm, TRUE );
345 }
347
349 return TRUE;
350 }
351 if( wParam == IDCANCEL )
352 {
353 EndDialog( hdlg, 0 );
354 return TRUE;
355 }
356 break;
357 }
358 return FALSE;
359}
static BOOL WININET_GetSetPassword(HWND hdlg, LPCWSTR szServer, LPCWSTR szRealm, BOOL bSet)
Definition: dialogs.c:109
static BOOL WININET_SetAuthorization(http_request_t *request, LPWSTR username, LPWSTR password, BOOL proxy)
Definition: dialogs.c:170
static BOOL WININET_GetAuthRealm(HINTERNET hRequest, LPWSTR szBuf, DWORD sz, BOOL proxy)
Definition: dialogs.c:62
#define IDC_SERVER
Definition: resource.h:35
static WCHAR password[]
Definition: url.c:33
static WCHAR username[]
Definition: url.c:32
#define IDC_REALM
Definition: mprres.h:29
#define IDC_SAVEPASSWORD
Definition: mprres.h:32
#define ERROR_INTERNET_FORCE_RETRY
Definition: wininet.h:2021
#define BM_GETSTATE
Definition: winuser.h:1923
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by InternetErrorDlg().

◆ WININET_ProxyPasswordDialog()

static INT_PTR WINAPI WININET_ProxyPasswordDialog ( HWND  hdlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 212 of file dialogs.c.

214{
215 HWND hitem;
217 WCHAR szRealm[0x80];
218
219 if( uMsg == WM_INITDIALOG )
220 {
221 TRACE("WM_INITDIALOG (%08lx)\n", lParam);
222
223 /* save the parameter list */
226
227 /* extract the Realm from the proxy response and show it */
228 if( WININET_GetAuthRealm( params->req->hdr.hInternet,
229 szRealm, ARRAY_SIZE( szRealm ), TRUE ) )
230 {
231 hitem = GetDlgItem( hdlg, IDC_REALM );
232 SetWindowTextW( hitem, szRealm );
233 }
234
235 hitem = GetDlgItem( hdlg, IDC_PROXY );
236 SetWindowTextW( hitem, params->req->session->appInfo->proxy );
237
238 WININET_GetSetPassword( hdlg, params->req->session->appInfo->proxy, szRealm, FALSE );
239
240 return TRUE;
241 }
242
245
246 switch( uMsg )
247 {
248 case WM_COMMAND:
249 if( wParam == IDOK )
250 {
251 WCHAR username[0x20], password[0x20];
252
253 username[0] = 0;
254 hitem = GetDlgItem( hdlg, IDC_USERNAME );
255 if( hitem )
257
258 password[0] = 0;
259 hitem = GetDlgItem( hdlg, IDC_PASSWORD );
260 if( hitem )
262
263 hitem = GetDlgItem( hdlg, IDC_SAVEPASSWORD );
264 if( hitem &&
265 SendMessageW( hitem, BM_GETSTATE, 0, 0 ) &&
266 WININET_GetAuthRealm( params->req->hdr.hInternet,
267 szRealm, ARRAY_SIZE( szRealm ), TRUE) )
268 WININET_GetSetPassword( hdlg, params->req->session->appInfo->proxy, szRealm, TRUE );
270
272 return TRUE;
273 }
274 if( wParam == IDCANCEL )
275 {
276 EndDialog( hdlg, 0 );
277 return TRUE;
278 }
279 break;
280 }
281 return FALSE;
282}
#define IDC_PROXY
Definition: mprres.h:28

Referenced by InternetErrorDlg().

◆ WININET_SetAuthorization()

static BOOL WININET_SetAuthorization ( http_request_t request,
LPWSTR  username,
LPWSTR  password,
BOOL  proxy 
)
static

Definition at line 170 of file dialogs.c.

172{
173 http_session_t *session = request->session;
174 LPWSTR p, q;
175
177 if( !p )
178 return FALSE;
179
181 if( !q )
182 {
183 heap_free(p);
184 return FALSE;
185 }
186
187 if (proxy)
188 {
189 appinfo_t *hIC = session->appInfo;
190
192 hIC->proxyUsername = p;
193
195 hIC->proxyPassword = q;
196 }
197 else
198 {
199 heap_free(session->userName);
200 session->userName = p;
201
202 heap_free(session->password);
203 session->password = q;
204 }
205
206 return TRUE;
207}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: edit.c:4312
LPWSTR proxyPassword
Definition: internet.h:296
LPWSTR proxyUsername
Definition: internet.h:295
Definition: tftpd.h:86

Referenced by WININET_PasswordDialog(), and WININET_ProxyPasswordDialog().

◆ WNetCachePassword()

DWORD WINAPI WNetCachePassword ( LPSTR  pbResource,
WORD  cbResource,
LPSTR  pbPassword,
WORD  cbPassword,
BYTE  nType,
WORD  x 
)

Definition at line 85 of file pwcache.c.

93{
94 HKEY hkey;
95 DWORD r;
96 LPSTR valname;
97
98 WARN( "(%p(%s), %d, %p(%s), %d, %d, 0x%08x): totally insecure\n",
99 pbResource, debugstr_a(pbResource), cbResource,
100 pbPassword, debugstr_a(pbPassword), cbPassword,
101 nType, x );
102
103 /* @@ Wine registry key: HKCU\Software\Wine\Wine\Mpr */
105 if( r )
106 return WN_ACCESS_DENIED;
107
108 valname = MPR_GetValueName( pbResource, cbResource, nType );
109 if( valname )
110 {
111 r = RegSetValueExA( hkey, valname, 0, REG_BINARY,
112 (LPBYTE)pbPassword, cbPassword );
113 if( r )
114 r = WN_CANCEL;
115 else
116 r = WN_SUCCESS;
117 HeapFree( GetProcessHeap(), 0, valname );
118 }
119 else
121
122 RegCloseKey( hkey );
123
124 return r;
125}
#define RegCloseKey(hKey)
Definition: registry.h:49
LONG WINAPI RegCreateKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1179
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4799
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define REG_BINARY
Definition: nt_native.h:1496
static LPSTR MPR_GetValueName(LPCSTR pbResource, WORD cbResource, BYTE nType)
Definition: pwcache.c:53
static const char mpr_key[]
Definition: pwcache.c:33
unsigned char * LPBYTE
Definition: typedefs.h:53
#define WN_CANCEL
Definition: winnetwk.h:114
#define WN_OUT_OF_MEMORY
Definition: winnetwk.h:125
#define WN_ACCESS_DENIED
Definition: winnetwk.h:122
#define HKEY_CURRENT_USER
Definition: winreg.h:11
char * LPSTR
Definition: xmlstorage.h:182

Referenced by InitFunctionPtrs(), and WININET_GetSetPassword().

◆ WNetGetCachedPassword()

DWORD WINAPI WNetGetCachedPassword ( LPSTR  pbResource,
WORD  cbResource,
LPSTR  pbPassword,
LPWORD  pcbPassword,
BYTE  nType 
)

Definition at line 180 of file pwcache.c.

186{
187 HKEY hkey;
188 DWORD r, type = 0, sz;
189 LPSTR valname;
190
191 WARN( "(%p(%s), %d, %p, %p, %d): totally insecure\n",
192 pbResource, debugstr_a(pbResource), cbResource,
193 pbPassword, pcbPassword, nType );
194
195 memset( pbPassword, 0, *pcbPassword);
196
197 /* @@ Wine registry key: HKCU\Software\Wine\Wine\Mpr */
199 if( r )
200 return WN_ACCESS_DENIED;
201
202 valname = MPR_GetValueName( pbResource, cbResource, nType );
203 if( valname )
204 {
205 sz = *pcbPassword;
206 r = RegQueryValueExA( hkey, valname, 0, &type, (LPBYTE)pbPassword, &sz );
207 *pcbPassword = sz;
208 if( r )
209 r = WN_CANCEL;
210 else
211 r = WN_SUCCESS;
212 HeapFree( GetProcessHeap(), 0, valname );
213 }
214 else
216
217 return r;
218}
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by InitFunctionPtrs(), and WININET_GetSetPassword().