InternetGetCookieEx function
The InternetGetCookieEx function retrieves data stored in cookies associated with a specified URL. Unlike InternetGetCookie, InternetGetCookieEx can be used to restrict data retrieved to a single cookie name or, by policy, associated with untrusted sites or third-party cookies.
Syntax
BOOL InternetGetCookieEx( _In_ LPCTSTR lpszURL, _In_ LPCTSTR lpszCookieName, _Inout_opt_ LPTSTR lpszCookieData, _Inout_ LPDWORD lpdwSize, _In_ DWORD dwFlags, _In_ LPVOID lpReserved );
Parameters
- lpszURL [in]
-
A pointer to a null-terminated string that contains the URL with which the cookie to retrieve is associated. This parameter cannot be NULL or InternetGetCookieEx fails and returns an ERROR_INVALID_PARAMETER error.
- lpszCookieName [in]
-
A pointer to a null-terminated string that contains the name of the cookie to retrieve. This name is case-sensitive.
- lpszCookieData [in, out, optional]
-
A pointer to a buffer to receive the cookie data.
- lpdwSize [in, out]
-
A pointer to a DWORD variable.
On entry, the variable must contain the size, in TCHARs, of the buffer pointed to by the pchCookieData parameter.
On exit, if the function is successful, this variable contains the number of TCHARs of cookie data copied into the buffer. If NULL was passed as the lpszCookieData parameter, or if the function fails with an error of ERROR_INSUFFICIENT_BUFFER, the variable contains the size, in BYTEs, of buffer required to receive the cookie data.
This parameter cannot be NULL or InternetGetCookieEx fails and returns an ERROR_INVALID_PARAMETER error.
- dwFlags [in]
-
A flag that controls how the function retrieves cookie data. This parameter can be one of the following values.
- lpReserved [in]
-
Reserved for future use. Set to NULL.
Return value
If the function succeeds, the function returns TRUE.
If the function fails, it returns FALSE. To get a specific error value, call GetLastError.
If NULL is passed to lpszCookieData, the call will succeed and the function will not set ERROR_INSUFFICIENT_BUFFER.
The following error codes may be set by this function.
| Return code | Description |
|---|---|
|
Returned if cookie data retrieved is larger than the buffer size pointed to by the pcchCookieData parameter or if that parameter is NULL. |
|
Returned if either the pchURL or the pcchCookieData parameter is NULL. |
|
Returned if no cookied data as specified could be retrieved. |
Remarks
Requirements
|
Minimum supported client |
Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2003 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names |
InternetGetCookieExW (Unicode) and InternetGetCookieExA (ANSI) |
See also
- HTTP Cookies
- Managing Cookies
- WinINet Functions
- InternetGetCookie
- InternetSetCookie
- InternetSetCookieEx