ReactOS  0.4.14-dev-583-g2a1ba2c
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 474 of file dialogs.c.

476 {
480 
481  TRACE("%p %p %d %08x %p\n", hWnd, hRequest, dwError, dwFlags, lppvData);
482 
484  return ERROR_INVALID_HANDLE;
485 
486  if(hRequest) {
487  req = (http_request_t*)get_handle_object(hRequest);
488  if(!req)
489  return ERROR_INVALID_HANDLE;
490  if(req->hdr.htype != WH_HHTTPREQ)
491  return ERROR_SUCCESS; /* Yes, that was tested */
492  }
493 
494  params.req = req;
495  params.hWnd = hWnd;
496  params.dwError = dwError;
497  params.dwFlags = dwFlags;
498  params.lppvData = lppvData;
499 
500  switch( dwError )
501  {
502  case ERROR_SUCCESS:
505  break;
506  if(!req)
507  return ERROR_INVALID_HANDLE;
508 
509  switch(req->status_code) {
513  break;
514  case HTTP_STATUS_DENIED:
517  break;
518  default:
519  WARN("unhandled status %u\n", req->status_code);
520  }
521  break;
522  }
530  break;
531  }
532  if(!req)
533  return ERROR_INVALID_HANDLE;
534 
535 
537  FIXME("%08x contains unsupported flags.\n", dwFlags);
538 
541  break;
544  FIXME("Need to display dialog for error %d\n", dwError);
545  res = ERROR_SUCCESS;
546  break;
547  default:
549  }
550 
551  if(req)
553  return res;
554 }
static INT_PTR WINAPI WININET_ProxyPasswordDialog(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialogs.c:214
#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:289
#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:76
#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:219
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:366
#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:184

Referenced by handle_http_error(), and test_InternetErrorDlg().

◆ InternetShowSecurityInfoByURLA()

BOOL WINAPI InternetShowSecurityInfoByURLA ( LPCSTR  url,
HWND  window 
)

Definition at line 559 of file dialogs.c.

560 {
561  FIXME("stub: %s %p\n", url, window);
562  return FALSE;
563 }
#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 568 of file dialogs.c.

569 {
570  FIXME("stub: %s %p\n", debugstr_w(url), window);
571  return FALSE;
572 }
#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 577 of file dialogs.c.

578 {
579  FIXME("stub: %p %d %s %p\n", cert, len, debugstr_a(szlistbox), listbox);
581 }
#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 586 of file dialogs.c.

587 {
589  cert, len);
590  DWORD ret;
591 
592  if (certContext)
593  {
595 
596  memset(&view, 0, sizeof(view));
597  view.hwndParent = parent;
598  view.pCertContext = certContext;
600  ret = ERROR_SUCCESS;
601  else
602  ret = GetLastError();
603  CertFreeCertificateContext(certContext);
604  }
605  else
606  ret = GetLastError();
607  return ret;
608 }
#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:2869
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:4395
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:3883
#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, ARRAY_SIZE( szUserPass ) - 1 );
139  lstrcatW(szUserPass, szColon);
140  u_len = strlenW( szUserPass );
141  GetWindowTextW( hPassItem, szUserPass+u_len, ARRAY_SIZE( szUserPass ) - u_len );
142 
143  r_len = (strlenW( szResource ) + 1)*sizeof(WCHAR);
144  u_len = (strlenW( szUserPass ) + 1)*sizeof(WCHAR);
145  r = WNetCachePassword( (CHAR*)szResource, r_len,
146  (CHAR*)szUserPass, u_len, dwMagic, 0 );
147 
148  return ( r == WN_SUCCESS );
149  }
150 
151  sz = sizeof szUserPass;
152  r_len = (strlenW( szResource ) + 1)*sizeof(WCHAR);
153  r = WNetGetCachedPassword( (CHAR*)szResource, r_len,
154  (CHAR*)szUserPass, &sz, dwMagic );
155  if( r != WN_SUCCESS )
156  return FALSE;
157 
158  p = strchrW( szUserPass, ':' );
159  if( p )
160  {
161  *p = 0;
162  SetWindowTextW( hUserItem, szUserPass );
163  SetWindowTextW( hPassItem, p+1 );
164  }
165 
166  return TRUE;
167 }
#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:121
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:414
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
#define ARRAY_SIZE(a)
Definition: main.h:24
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 366 of file dialogs.c.

368 {
370  HWND hitem;
371  WCHAR buf[1024];
372 
373  if( uMsg == WM_INITDIALOG )
374  {
375  TRACE("WM_INITDIALOG (%08lx)\n", lParam);
376 
377  /* save the parameter list */
380 
381  switch( params->dwError )
382  {
385  break;
388  break;
391  break;
393  /* FIXME: We should fetch information about the
394  * certificate here and show all the relevant errors.
395  */
397  break;
398  default:
399  FIXME( "No message for error %d\n", params->dwError );
400  buf[0] = '\0';
401  }
402 
403  hitem = GetDlgItem( hdlg, IDC_CERT_ERROR );
404  SetWindowTextW( hitem, buf );
405 
406  return TRUE;
407  }
408 
409  params = (struct WININET_ErrorDlgParams*)
411 
412  switch( uMsg )
413  {
414  case WM_COMMAND:
415  if( wParam == IDOK )
416  {
418  {
419  http_request_t *req = params->req;
420  DWORD flags, size = sizeof(flags);
421 
423  switch( params->dwError )
424  {
427  break;
430  break;
433  break;
436  break;
446  break;
447  }
448  /* FIXME: Use helper function */
453  }
454 
455  EndDialog( hdlg, ERROR_SUCCESS );
456  return TRUE;
457  }
458  if( wParam == IDCANCEL )
459  {
460  TRACE("Pressed cancel.\n");
461 
462  EndDialog( hdlg, ERROR_CANCELLED );
463  return TRUE;
464  }
465  break;
466  }
467 
468  return FALSE;
469 }
#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:4804
#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:76
#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:475
#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:476
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2574
#define _SECURITY_FLAG_CERT_INVALID_CA
Definition: internet.h:474
#define SECURITY_FLAG_SECURE
Definition: winhttp.h:285
#define SetWindowLongPtrW
Definition: winuser.h:5321
#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:473

Referenced by InternetErrorDlg().

◆ WININET_PasswordDialog()

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

Definition at line 289 of file dialogs.c.

291 {
292  HWND hitem;
294  WCHAR szRealm[0x80];
295 
296  if( uMsg == WM_INITDIALOG )
297  {
298  TRACE("WM_INITDIALOG (%08lx)\n", lParam);
299 
300  /* save the parameter list */
303 
304  /* extract the Realm from the response and show it */
305  if( WININET_GetAuthRealm( params->req->hdr.hInternet,
306  szRealm, ARRAY_SIZE( szRealm ), FALSE ) )
307  {
308  hitem = GetDlgItem( hdlg, IDC_REALM );
309  SetWindowTextW( hitem, szRealm );
310  }
311 
312  hitem = GetDlgItem( hdlg, IDC_SERVER );
313  SetWindowTextW( hitem, params->req->session->hostName );
314 
315  WININET_GetSetPassword( hdlg, params->req->session->hostName, szRealm, FALSE );
316 
317  return TRUE;
318  }
319 
320  params = (struct WININET_ErrorDlgParams*)
322 
323  switch( uMsg )
324  {
325  case WM_COMMAND:
326  if( wParam == IDOK )
327  {
328  WCHAR username[0x20], password[0x20];
329 
330  username[0] = 0;
331  hitem = GetDlgItem( hdlg, IDC_USERNAME );
332  if( hitem )
334 
335  password[0] = 0;
336  hitem = GetDlgItem( hdlg, IDC_PASSWORD );
337  if( hitem )
339 
340  hitem = GetDlgItem( hdlg, IDC_SAVEPASSWORD );
341  if( hitem &&
342  SendMessageW( hitem, BM_GETSTATE, 0, 0 ) &&
343  WININET_GetAuthRealm( params->req->hdr.hInternet,
344  szRealm, ARRAY_SIZE( szRealm ), FALSE ))
345  {
346  WININET_GetSetPassword( hdlg, params->req->session->hostName, szRealm, TRUE );
347  }
349 
351  return TRUE;
352  }
353  if( wParam == IDCANCEL )
354  {
355  EndDialog( hdlg, 0 );
356  return TRUE;
357  }
358  break;
359  }
360  return FALSE;
361 }
#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
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define GetWindowLongPtrW
Definition: winuser.h:4804
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:172
#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
#define ARRAY_SIZE(a)
Definition: main.h:24
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SetWindowLongPtrW
Definition: winuser.h:5321
#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 214 of file dialogs.c.

216 {
217  HWND hitem;
219  WCHAR szRealm[0x80];
220 
221  if( uMsg == WM_INITDIALOG )
222  {
223  TRACE("WM_INITDIALOG (%08lx)\n", lParam);
224 
225  /* save the parameter list */
228 
229  /* extract the Realm from the proxy response and show it */
230  if( WININET_GetAuthRealm( params->req->hdr.hInternet,
231  szRealm, ARRAY_SIZE( szRealm ), TRUE ) )
232  {
233  hitem = GetDlgItem( hdlg, IDC_REALM );
234  SetWindowTextW( hitem, szRealm );
235  }
236 
237  hitem = GetDlgItem( hdlg, IDC_PROXY );
238  SetWindowTextW( hitem, params->req->session->appInfo->proxy );
239 
240  WININET_GetSetPassword( hdlg, params->req->session->appInfo->proxy, szRealm, FALSE );
241 
242  return TRUE;
243  }
244 
245  params = (struct WININET_ErrorDlgParams*)
247 
248  switch( uMsg )
249  {
250  case WM_COMMAND:
251  if( wParam == IDOK )
252  {
253  WCHAR username[0x20], password[0x20];
254 
255  username[0] = 0;
256  hitem = GetDlgItem( hdlg, IDC_USERNAME );
257  if( hitem )
259 
260  password[0] = 0;
261  hitem = GetDlgItem( hdlg, IDC_PASSWORD );
262  if( hitem )
264 
265  hitem = GetDlgItem( hdlg, IDC_SAVEPASSWORD );
266  if( hitem &&
267  SendMessageW( hitem, BM_GETSTATE, 0, 0 ) &&
268  WININET_GetAuthRealm( params->req->hdr.hInternet,
269  szRealm, ARRAY_SIZE( szRealm ), TRUE) )
270  WININET_GetSetPassword( hdlg, params->req->session->appInfo->proxy, szRealm, TRUE );
272 
274  return TRUE;
275  }
276  if( wParam == IDCANCEL )
277  {
278  EndDialog( hdlg, 0 );
279  return TRUE;
280  }
281  break;
282  }
283  return FALSE;
284 }
#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
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define GetWindowLongPtrW
Definition: winuser.h:4804
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:172
#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
#define ARRAY_SIZE(a)
Definition: main.h:24
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SetWindowLongPtrW
Definition: winuser.h:5321
#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 172 of file dialogs.c.

174 {
175  http_session_t *session = request->session;
176  LPWSTR p, q;
177 
179  if( !p )
180  return FALSE;
181 
183  if( !q )
184  {
185  heap_free(p);
186  return FALSE;
187  }
188 
189  if (proxy)
190  {
191  appinfo_t *hIC = session->appInfo;
192 
193  heap_free(hIC->proxyUsername);
194  hIC->proxyUsername = p;
195 
196  heap_free(hIC->proxyPassword);
197  hIC->proxyPassword = q;
198  }
199  else
200  {
201  heap_free(session->userName);
202  session->userName = p;
203 
204  heap_free(session->password);
205  session->password = q;
206  }
207 
208  return TRUE;
209 }
int proxy
Definition: main.c:67
#define TRUE
Definition: types.h:120
LPWSTR proxyUsername
Definition: internet.h:296
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
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
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:403
#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:402

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:403
#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:402

Referenced by InitFunctionPtrs(), and WININET_GetSetPassword().