ReactOS  0.4.14-dev-98-gb0d4763
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 "wine/unicode.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 43 of file dialogs.c.

◆ NO_SHLWAPI_STREAM

#define NO_SHLWAPI_STREAM

Definition at line 33 of file dialogs.c.

Function Documentation

◆ InternetErrorDlg()

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

Definition at line 476 of file dialogs.c.

478 {
482 
483  TRACE("%p %p %d %08x %p\n", hWnd, hRequest, dwError, dwFlags, lppvData);
484 
486  return ERROR_INVALID_HANDLE;
487 
488  if(hRequest) {
489  req = (http_request_t*)get_handle_object(hRequest);
490  if(!req)
491  return ERROR_INVALID_HANDLE;
492  if(req->hdr.htype != WH_HHTTPREQ)
493  return ERROR_SUCCESS; /* Yes, that was tested */
494  }
495 
496  params.req = req;
497  params.hWnd = hWnd;
498  params.dwError = dwError;
499  params.dwFlags = dwFlags;
500  params.lppvData = lppvData;
501 
502  switch( dwError )
503  {
504  case ERROR_SUCCESS:
507  break;
508  if(!req)
509  return ERROR_INVALID_HANDLE;
510 
511  switch(req->status_code) {
515  break;
516  case HTTP_STATUS_DENIED:
519  break;
520  default:
521  WARN("unhandled status %u\n", req->status_code);
522  }
523  break;
524  }
532  break;
533  }
534  if(!req)
535  return ERROR_INVALID_HANDLE;
536 
537 
539  FIXME("%08x contains unsupported flags.\n", dwFlags);
540 
543  break;
546  FIXME("Need to display dialog for error %d\n", dwError);
547  res = ERROR_SUCCESS;
548  break;
549  default:
551  }
552 
553  if(req)
555  return res;
556 }
static INT_PTR WINAPI WININET_ProxyPasswordDialog(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.c:216
#define ERROR_INTERNET_SEC_CERT_CN_INVALID
Definition: wininet.h:2026
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INTERNET_SEC_CERT_REV_FAILED
Definition: wininet.h:2044
#define WARN(fmt,...)
Definition: debug.h:111
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
HWND hWnd
Definition: settings.c:17
http_request_t * req
Definition: dialogs.c:49
#define IDD_AUTHDLG
Definition: resource.h:27
static INT_PTR WINAPI WININET_PasswordDialog(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.c:291
#define IDD_PROXYDLG
Definition: mprres.h:26
#define FLAGS_ERROR_UI_FILTER_FOR_ERRORS
Definition: wininet.h:1906
GLenum const GLfloat * params
Definition: glext.h:5645
#define FLAGS_ERROR_UI_FLAGS_NO_UI
Definition: wininet.h:1909
HMODULE WININET_hModule
Definition: internet.c:77
#define FIXME(fmt,...)
Definition: debug.h:110
#define FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS
Definition: wininet.h:1907
object_header_t hdr
Definition: internet.h:346
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_INTERNET_SEC_CERT_ERRORS
Definition: wininet.h:2042
LONG_PTR LPARAM
Definition: windef.h:208
#define IDD_INVCERTDLG
Definition: resource.h:26
#define HTTP_STATUS_DENIED
Definition: winhttp.h:256
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define HTTP_STATUS_PROXY_AUTH_REQ
Definition: winhttp.h:262
#define ERROR_INTERNET_POST_IS_NON_SECURE
Definition: wininet.h:2031
BOOL WININET_Release(object_header_t *info)
Definition: internet.c:220
DWORD status_code
Definition: internet.h:358
#define ERROR_INTERNET_SEC_CERT_DATE_INVALID
Definition: wininet.h:2025
#define ERROR_INTERNET_INVALID_CA
Definition: wininet.h:2033
#define ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR
Definition: wininet.h:2027
#define ERROR_CANCELLED
Definition: winerror.h:726
static INT_PTR WINAPI WININET_InvalidCertificateDialog(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.c:368
#define ERROR_INTERNET_INCORRECT_PASSWORD
Definition: wininet.h:2003
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
GLuint res
Definition: glext.h:9613
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WH_TYPE htype
Definition: internet.h:274
object_header_t * get_handle_object(HINTERNET hinternet)
Definition: internet.c:185

Referenced by handle_http_error(), and test_InternetErrorDlg().

◆ InternetShowSecurityInfoByURLA()

BOOL WINAPI InternetShowSecurityInfoByURLA ( LPCSTR  url,
HWND  window 
)

Definition at line 561 of file dialogs.c.

562 {
563  FIXME("stub: %s %p\n", url, window);
564  return FALSE;
565 }
#define FIXME(fmt,...)
Definition: debug.h:110
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 570 of file dialogs.c.

571 {
572  FIXME("stub: %s %p\n", debugstr_w(url), window);
573  return FALSE;
574 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static const WCHAR url[]
Definition: encode.c:1432
static IHTMLWindow2 * window
Definition: events.c:77

◆ ParseX509EncodedCertificateForListBoxEntry()

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

Definition at line 579 of file dialogs.c.

580 {
581  FIXME("stub: %p %d %s %p\n", cert, len, debugstr_a(szlistbox), listbox);
583 }
#define FIXME(fmt,...)
Definition: debug.h:110
static BYTE cert[]
Definition: msg.c:1437
#define debugstr_a
Definition: kernel32.h:31
GLenum GLsizei len
Definition: glext.h:6722
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ ShowX509EncodedCertificate()

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

Definition at line 588 of file dialogs.c.

589 {
591  cert, len);
592  DWORD ret;
593 
594  if (certContext)
595  {
597 
598  memset(&view, 0, sizeof(view));
599  view.hwndParent = parent;
600  view.pCertContext = certContext;
602  ret = ERROR_SUCCESS;
603  else
604  ret = GetLastError();
605  CertFreeCertificateContext(certContext);
606  }
607  else
608  ret = GetLastError();
609  return ret;
610 }
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:371
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
smooth NULL
Definition: ftsmooth.c:416
static BYTE cert[]
Definition: msg.c:1437
r parent
Definition: btrfs.c:2897
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded)
Definition: cert.c:316
GLenum GLsizei len
Definition: glext.h:6722
BOOL WINAPI CryptUIDlgViewCertificateW(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, BOOL *pfPropertiesChanged)
Definition: main.c:4397
static IOleDocumentView * view
Definition: activex.c:1749
#define memset(x, y, z)
Definition: compat.h:39

◆ 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 61 of file dialogs.c.

62 {
63  LPWSTR p, q;
64  DWORD index, query;
65  static const WCHAR szRealm[] = { 'r','e','a','l','m','=',0 };
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 = strchrW( szBuf, ' ' );
82  if( !p || strncmpW( p+1, szRealm, strlenW(szRealm) ) )
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 = strrchrW( p, '"' );
94  if( q )
95  *q = 0;
96  }
97  strcpyW( szBuf, p );
98 
99  return TRUE;
100 }
int proxy
Definition: main.c:67
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define HTTP_QUERY_PROXY_AUTHENTICATE
Definition: wininet.h:1564
#define HTTP_QUERY_WWW_AUTHENTICATE
Definition: wininet.h:1563
WINE_UNICODE_INLINE int strncmpW(const WCHAR *str1, const WCHAR *str2, int n)
Definition: unicode.h:235
#define debugstr_w
Definition: kernel32.h:32
GLuint index
Definition: glext.h:6031
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:3807
#define index(s, c)
Definition: various.h:29
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
#define ERR(fmt,...)
Definition: debug.h:109
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
GLenum query
Definition: glext.h:7781

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  static const WCHAR szColon[] = { ':',0 };
119  static const WCHAR szbs[] = { '/', 0 };
120 
121  hUserItem = GetDlgItem( hdlg, IDC_USERNAME );
122  hPassItem = GetDlgItem( hdlg, IDC_PASSWORD );
123 
124  /* now try fetch the username and password */
125  lstrcpyW( szResource, szServer);
126  lstrcatW( szResource, szbs);
127  lstrcatW( szResource, szRealm);
128 
129  /*
130  * WNetCachePassword is only concerned with the length
131  * of the data stored (which we tell it) and it does
132  * not use strlen() internally so we can add WCHAR data
133  * instead of ASCII data and get it back the same way.
134  */
135  if( bSet )
136  {
137  szUserPass[0] = 0;
138  GetWindowTextW( hUserItem, szUserPass,
139  (sizeof szUserPass-1)/sizeof(WCHAR) );
140  lstrcatW(szUserPass, szColon);
141  u_len = strlenW( szUserPass );
142  GetWindowTextW( hPassItem, szUserPass+u_len,
143  (sizeof szUserPass)/sizeof(WCHAR)-u_len );
144 
145  r_len = (strlenW( szResource ) + 1)*sizeof(WCHAR);
146  u_len = (strlenW( szUserPass ) + 1)*sizeof(WCHAR);
147  r = WNetCachePassword( (CHAR*)szResource, r_len,
148  (CHAR*)szUserPass, u_len, dwMagic, 0 );
149 
150  return ( r == WN_SUCCESS );
151  }
152 
153  sz = sizeof szUserPass;
154  r_len = (strlenW( szResource ) + 1)*sizeof(WCHAR);
155  r = WNetGetCachedPassword( (CHAR*)szResource, r_len,
156  (CHAR*)szUserPass, &sz, dwMagic );
157  if( r != WN_SUCCESS )
158  return FALSE;
159 
160  p = strchrW( szUserPass, ':' );
161  if( p )
162  {
163  *p = 0;
164  SetWindowTextW( hUserItem, szUserPass );
165  SetWindowTextW( hPassItem, p+1 );
166  }
167 
168  return TRUE;
169 }
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WN_SUCCESS
Definition: winnetwk.h:111
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
char CHAR
Definition: xmlstorage.h:175
static const WCHAR szServer[]
Definition: http.c:120
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
DWORD WINAPI WNetCachePassword(LPSTR, WORD, LPSTR, WORD, BYTE, WORD)
Definition: pwcache.c:85
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_USERNAME
Definition: resource.h:77
#define lstrcpyW
Definition: compat.h:406
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
DWORD WINAPI WNetGetCachedPassword(LPSTR, WORD, LPSTR, LPWORD, BYTE)
Definition: pwcache.c:180
unsigned int UINT
Definition: ndis.h:50
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static const WCHAR szbs[]
Definition: domdoc.c:1161
#define IDC_PASSWORD
Definition: resource.h:12

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 368 of file dialogs.c.

370 {
372  HWND hitem;
373  WCHAR buf[1024];
374 
375  if( uMsg == WM_INITDIALOG )
376  {
377  TRACE("WM_INITDIALOG (%08lx)\n", lParam);
378 
379  /* save the parameter list */
382 
383  switch( params->dwError )
384  {
387  break;
390  break;
393  break;
395  /* FIXME: We should fetch information about the
396  * certificate here and show all the relevant errors.
397  */
399  break;
400  default:
401  FIXME( "No message for error %d\n", params->dwError );
402  buf[0] = '\0';
403  }
404 
405  hitem = GetDlgItem( hdlg, IDC_CERT_ERROR );
406  SetWindowTextW( hitem, buf );
407 
408  return TRUE;
409  }
410 
411  params = (struct WININET_ErrorDlgParams*)
413 
414  switch( uMsg )
415  {
416  case WM_COMMAND:
417  if( wParam == IDOK )
418  {
420  {
421  http_request_t *req = params->req;
422  DWORD flags, size = sizeof(flags);
423 
425  switch( params->dwError )
426  {
429  break;
432  break;
435  break;
438  break;
448  break;
449  }
450  /* FIXME: Use helper function */
455  }
456 
457  EndDialog( hdlg, ERROR_SUCCESS );
458  return TRUE;
459  }
460  if( wParam == IDCANCEL )
461  {
462  TRACE("Pressed cancel.\n");
463 
464  EndDialog( hdlg, ERROR_CANCELLED );
465  return TRUE;
466  }
467  break;
468  }
469 
470  return FALSE;
471 }
#define ERROR_INTERNET_SEC_CERT_CN_INVALID
Definition: wininet.h:2026
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define SECURITY_FLAG_IGNORE_UNKNOWN_CA
Definition: winhttp.h:281
#define ERROR_SUCCESS
Definition: deptool.c:10
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define ERROR_INTERNET_SEC_CERT_REV_FAILED
Definition: wininet.h:2044
http_request_t * req
Definition: dialogs.c:49
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define GetWindowLongPtrW
Definition: winuser.h:4730
#define SECURITY_FLAG_IGNORE_CERT_CN_INVALID
Definition: winhttp.h:283
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define SECURITY_FLAG_IGNORE_REVOCATION
Definition: wininet.h:829
GLenum const GLfloat * params
Definition: glext.h:5645
HMODULE WININET_hModule
Definition: internet.c:77
#define IDS_CERT_DATE_INVALID
Definition: resource.h:40
#define FIXME(fmt,...)
Definition: debug.h:110
#define FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS
Definition: wininet.h:1907
#define IDS_CERT_ERRORS
Definition: resource.h:42
#define GWLP_USERDATA
Definition: treelist.c:63
object_header_t hdr
Definition: internet.h:346
#define ERROR_INTERNET_SEC_CERT_ERRORS
Definition: wininet.h:2042
DWORD security_flags
Definition: internet.h:82
netconn_t * netconn
Definition: internet.h:352
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define IDS_CERT_CA_INVALID
Definition: resource.h:39
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define _SECURITY_FLAG_CERT_INVALID_CN
Definition: internet.h:474
#define IDS_CERT_CN_INVALID
Definition: resource.h:41
GLbitfield flags
Definition: glext.h:7161
DWORD security_flags
Definition: internet.h:353
#define WM_COMMAND
Definition: winuser.h:1722
HINTERNET hInternet
Definition: internet.h:276
#define SECURITY_FLAG_IGNORE_CERT_DATE_INVALID
Definition: winhttp.h:282
#define ERROR_INTERNET_SEC_CERT_DATE_INVALID
Definition: wininet.h:2025
#define ERROR_INTERNET_INVALID_CA
Definition: wininet.h:2033
#define ERROR_CANCELLED
Definition: winerror.h:726
BOOL is_valid_netconn(netconn_t *) DECLSPEC_HIDDEN
#define INTERNET_OPTION_SECURITY_FLAGS
Definition: wininet.h:725
#define _SECURITY_FLAG_CERT_INVALID_DATE
Definition: internet.h:475
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2576
#define _SECURITY_FLAG_CERT_INVALID_CA
Definition: internet.h:473
#define SECURITY_FLAG_SECURE
Definition: winhttp.h:285
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define IDC_CERT_ERROR
Definition: resource.h:36
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define _SECURITY_FLAG_CERT_REV_FAILED
Definition: internet.h:472

Referenced by InternetErrorDlg().

◆ WININET_PasswordDialog()

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

Definition at line 291 of file dialogs.c.

293 {
294  HWND hitem;
296  WCHAR szRealm[0x80], szServer[0x80];
297 
298  if( uMsg == WM_INITDIALOG )
299  {
300  TRACE("WM_INITDIALOG (%08lx)\n", lParam);
301 
302  /* save the parameter list */
305 
306  /* extract the Realm from the response and show it */
307  if( WININET_GetAuthRealm( params->req->hdr.hInternet,
308  szRealm, sizeof szRealm/sizeof(WCHAR), FALSE ) )
309  {
310  hitem = GetDlgItem( hdlg, IDC_REALM );
311  SetWindowTextW( hitem, szRealm );
312  }
313 
314  hitem = GetDlgItem( hdlg, IDC_SERVER );
315  SetWindowTextW( hitem, params->req->session->hostName );
316 
317  WININET_GetSetPassword( hdlg, szServer, szRealm, FALSE );
318 
319  return TRUE;
320  }
321 
322  params = (struct WININET_ErrorDlgParams*)
324 
325  switch( uMsg )
326  {
327  case WM_COMMAND:
328  if( wParam == IDOK )
329  {
330  WCHAR username[0x20], password[0x20];
331 
332  username[0] = 0;
333  hitem = GetDlgItem( hdlg, IDC_USERNAME );
334  if( hitem )
335  GetWindowTextW( hitem, username, sizeof username/sizeof(WCHAR) );
336 
337  password[0] = 0;
338  hitem = GetDlgItem( hdlg, IDC_PASSWORD );
339  if( hitem )
340  GetWindowTextW( hitem, password, sizeof password/sizeof(WCHAR) );
341 
342  hitem = GetDlgItem( hdlg, IDC_SAVEPASSWORD );
343  if( hitem &&
344  SendMessageW( hitem, BM_GETSTATE, 0, 0 ) &&
345  WININET_GetAuthRealm( params->req->hdr.hInternet,
346  szRealm, sizeof szRealm/sizeof(WCHAR), FALSE ))
347  {
348  WININET_GetSetPassword( hdlg, params->req->session->hostName, szRealm, TRUE );
349  }
351 
353  return TRUE;
354  }
355  if( wParam == IDCANCEL )
356  {
357  EndDialog( hdlg, 0 );
358  return TRUE;
359  }
360  break;
361  }
362  return FALSE;
363 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define BM_GETSTATE
Definition: winuser.h:1902
static BOOL WININET_GetSetPassword(HWND hdlg, LPCWSTR szServer, LPCWSTR szRealm, BOOL bSet)
Definition: dialogs.c:109
static const WCHAR szServer[]
Definition: http.c:120
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define GetWindowLongPtrW
Definition: winuser.h:4730
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
static BOOL WININET_GetAuthRealm(HINTERNET hRequest, LPWSTR szBuf, DWORD sz, BOOL proxy)
Definition: dialogs.c:61
GLenum const GLfloat * params
Definition: glext.h:5645
#define GWLP_USERDATA
Definition: treelist.c:63
static WCHAR username[]
Definition: url.c:32
#define IDC_SAVEPASSWORD
Definition: mprres.h:32
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDC_USERNAME
Definition: resource.h:77
T1_FIELD_DICT_PRIVATE password
Definition: t1tokens.h:64
static BOOL WININET_SetAuthorization(http_request_t *request, LPWSTR username, LPWSTR password, BOOL proxy)
Definition: dialogs.c:174
#define WM_COMMAND
Definition: winuser.h:1722
#define ERROR_INTERNET_FORCE_RETRY
Definition: wininet.h:2021
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define IDC_REALM
Definition: mprres.h:29
#define IDC_SERVER
Definition: resource.h:35
#define IDC_PASSWORD
Definition: resource.h:12

Referenced by InternetErrorDlg().

◆ WININET_ProxyPasswordDialog()

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

Definition at line 216 of file dialogs.c.

218 {
219  HWND hitem;
221  WCHAR szRealm[0x80], szServer[0x80];
222 
223  if( uMsg == WM_INITDIALOG )
224  {
225  TRACE("WM_INITDIALOG (%08lx)\n", lParam);
226 
227  /* save the parameter list */
230 
231  /* extract the Realm from the proxy response and show it */
232  if( WININET_GetAuthRealm( params->req->hdr.hInternet,
233  szRealm, sizeof szRealm/sizeof(WCHAR), TRUE ) )
234  {
235  hitem = GetDlgItem( hdlg, IDC_REALM );
236  SetWindowTextW( hitem, szRealm );
237  }
238 
239  hitem = GetDlgItem( hdlg, IDC_PROXY );
240  SetWindowTextW( hitem, params->req->session->appInfo->proxy );
241 
242  WININET_GetSetPassword( hdlg, szServer, szRealm, FALSE );
243 
244  return TRUE;
245  }
246 
247  params = (struct WININET_ErrorDlgParams*)
249 
250  switch( uMsg )
251  {
252  case WM_COMMAND:
253  if( wParam == IDOK )
254  {
255  WCHAR username[0x20], password[0x20];
256 
257  username[0] = 0;
258  hitem = GetDlgItem( hdlg, IDC_USERNAME );
259  if( hitem )
260  GetWindowTextW( hitem, username, sizeof username/sizeof(WCHAR) );
261 
262  password[0] = 0;
263  hitem = GetDlgItem( hdlg, IDC_PASSWORD );
264  if( hitem )
265  GetWindowTextW( hitem, password, sizeof password/sizeof(WCHAR) );
266 
267  hitem = GetDlgItem( hdlg, IDC_SAVEPASSWORD );
268  if( hitem &&
269  SendMessageW( hitem, BM_GETSTATE, 0, 0 ) &&
270  WININET_GetAuthRealm( params->req->hdr.hInternet,
271  szRealm, sizeof szRealm/sizeof(WCHAR), TRUE) )
272  WININET_GetSetPassword( hdlg, params->req->session->appInfo->proxy, szRealm, TRUE );
274 
276  return TRUE;
277  }
278  if( wParam == IDCANCEL )
279  {
280  EndDialog( hdlg, 0 );
281  return TRUE;
282  }
283  break;
284  }
285  return FALSE;
286 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define BM_GETSTATE
Definition: winuser.h:1902
static BOOL WININET_GetSetPassword(HWND hdlg, LPCWSTR szServer, LPCWSTR szRealm, BOOL bSet)
Definition: dialogs.c:109
#define IDC_PROXY
Definition: mprres.h:28
static const WCHAR szServer[]
Definition: http.c:120
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define GetWindowLongPtrW
Definition: winuser.h:4730
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
static BOOL WININET_GetAuthRealm(HINTERNET hRequest, LPWSTR szBuf, DWORD sz, BOOL proxy)
Definition: dialogs.c:61
GLenum const GLfloat * params
Definition: glext.h:5645
#define GWLP_USERDATA
Definition: treelist.c:63
static WCHAR username[]
Definition: url.c:32
#define IDC_SAVEPASSWORD
Definition: mprres.h:32
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDC_USERNAME
Definition: resource.h:77
T1_FIELD_DICT_PRIVATE password
Definition: t1tokens.h:64
static BOOL WININET_SetAuthorization(http_request_t *request, LPWSTR username, LPWSTR password, BOOL proxy)
Definition: dialogs.c:174
#define WM_COMMAND
Definition: winuser.h:1722
#define ERROR_INTERNET_FORCE_RETRY
Definition: wininet.h:2021
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define IDC_REALM
Definition: mprres.h:29
#define IDC_PASSWORD
Definition: resource.h:12

Referenced by InternetErrorDlg().

◆ WININET_SetAuthorization()

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

Definition at line 174 of file dialogs.c.

176 {
177  http_session_t *session = request->session;
178  LPWSTR p, q;
179 
181  if( !p )
182  return FALSE;
183 
185  if( !q )
186  {
187  heap_free(p);
188  return FALSE;
189  }
190 
191  if (proxy)
192  {
193  appinfo_t *hIC = session->appInfo;
194 
195  heap_free(hIC->proxyUsername);
196  hIC->proxyUsername = p;
197 
198  heap_free(hIC->proxyPassword);
199  hIC->proxyPassword = q;
200  }
201  else
202  {
203  heap_free(session->userName);
204  session->userName = p;
205 
206  heap_free(session->password);
207  session->password = q;
208  }
209 
210  return TRUE;
211 }
int proxy
Definition: main.c:67
#define TRUE
Definition: types.h:120
LPWSTR userName
Definition: internet.h:307
LPWSTR proxyUsername
Definition: internet.h:296
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
appinfo_t * appInfo
Definition: internet.h:305
static WCHAR username[]
Definition: url.c:32
LPWSTR proxyPassword
Definition: internet.h:297
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
T1_FIELD_DICT_PRIVATE password
Definition: t1tokens.h:64
Definition: tftpd.h:85
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPWSTR password
Definition: internet.h:308
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by WININET_PasswordDialog(), and WININET_ProxyPasswordDialog().

◆ WNetCachePassword()

DWORD WINAPI WNetCachePassword ( LPSTR  ,
WORD  ,
LPSTR  ,
WORD  ,
BYTE  ,
WORD   
)

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 WN_SUCCESS
Definition: winnetwk.h:111
#define REG_BINARY
Definition: nt_native.h:1496
static LPSTR MPR_GetValueName(LPCSTR pbResource, WORD cbResource, BYTE nType)
Definition: pwcache.c:53
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define WARN(fmt,...)
Definition: debug.h:111
#define WN_CANCEL
Definition: winnetwk.h:114
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
char * LPSTR
Definition: xmlstorage.h:182
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
LONG WINAPI RegCreateKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1177
#define GetProcessHeap()
Definition: compat.h:395
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WN_ACCESS_DENIED
Definition: winnetwk.h:122
#define WN_OUT_OF_MEMORY
Definition: winnetwk.h:125
static const char mpr_key[]
Definition: pwcache.c:33
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4812
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by InitFunctionPtrs(), and WININET_GetSetPassword().

◆ WNetGetCachedPassword()

DWORD WINAPI WNetGetCachedPassword ( LPSTR  ,
WORD  ,
LPSTR  ,
LPWORD  ,
BYTE   
)

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:4023
#define WN_SUCCESS
Definition: winnetwk.h:111
static LPSTR MPR_GetValueName(LPCSTR pbResource, WORD cbResource, BYTE nType)
Definition: pwcache.c:53
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define WARN(fmt,...)
Definition: debug.h:111
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define WN_CANCEL
Definition: winnetwk.h:114
char * LPSTR
Definition: xmlstorage.h:182
unsigned char * LPBYTE
Definition: typedefs.h:52
LONG WINAPI RegCreateKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1177
#define GetProcessHeap()
Definition: compat.h:395
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WN_ACCESS_DENIED
Definition: winnetwk.h:122
#define WN_OUT_OF_MEMORY
Definition: winnetwk.h:125
static const char mpr_key[]
Definition: pwcache.c:33
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by InitFunctionPtrs(), and WININET_GetSetPassword().