WINHTTP_CREDS structure (winhttp.h)

The WINHTTP_CREDS structure contains user credential information used for server and proxy authentication.

Note  This structure has been deprecated. Instead, the use of the WINHTTP_CREDS_EX structure is recommended.
 

Syntax

typedef struct tagWINHTTP_CREDS {
  LPSTR lpszUserName;
  LPSTR lpszPassword;
  LPSTR lpszRealm;
  DWORD dwAuthScheme;
  LPSTR lpszHostName;
  DWORD dwPort;
} WINHTTP_CREDS, *PWINHTTP_CREDS;

Members

lpszUserName

Pointer to a buffer that contains username.

lpszPassword

Pointer to a buffer that contains password.

lpszRealm

Pointer to a buffer that contains realm.

dwAuthScheme

A flag that contains the authentication scheme, as one of the following values.

Value Meaning
WINHTTP_AUTH_SCHEME_BASIC
Use basic authentication.
WINHTTP_AUTH_SCHEME_NTLM
Use NTLM authentication.
INHTTP_AUTH_SCHEME_DIGEST
Use digest authentication.
WINHTTP_AUTH_SCHEME_NEGOTIATE
Select between NTLM and Kerberos authentication.

lpszHostName

Pointer to a buffer that contains hostname.

dwPort

The server connection port.

Remarks

This structure is used with options WINHTTP_OPTION_GLOBAL_SERVER_CREDS and WINHTTP_OPTION_GLOBAL_PROXY_CREDS option flags. These options require the registry key HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings!ShareCredsWithWinHttp. This registry key is not present by default.

When it is set, WinINet will send credentials down to WinHTTP. Whenever WinHttp gets an authentication challenge and if there are no credentials set on the current handle, it will use the credentials provided by WinINet. In order to share server credentials in addition to proxy credentials, users needs to set the WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS option flag.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Header winhttp.h

See also

WINHTTP_CREDS_EX