Retrieves the cookie for the specified URL.
BOOLAPI InternetGetCookieA( LPCSTR lpszUrl, LPCSTR lpszCookieName, LPSTR lpszCookieData, LPDWORD lpdwSize );
A pointer to a null-terminated string that specifies the URL for which cookies are to be retrieved.
A pointer to a buffer that receives the cookie data. This parameter can be NULL.
A pointer to a variable that specifies the size of the lpszCookieData parameter buffer, in TCHARs. If the function succeeds, the buffer receives the amount of data copied to the lpszCookieData buffer. If lpszCookieData is NULL, this parameter receives a value that specifies the size of the buffer necessary to copy all the cookie data, expressed as a byte count.
If the function succeeds, the function returns TRUE.
If the function fails, it returns FALSE. To get extended error data, call GetLastError.
The following error values apply to InternetGetCookie.
||There is no cookie for the specified URL and all its parents.|
||The value passed in lpdwSize is insufficient to copy all the cookie data. The value returned in lpdwSize is the size of the buffer necessary to get all the data.|
One or more of the parameters is invalid.
The lpszUrl parameter is NULL.
InternetGetCookie does not require a call to InternetOpen. InternetGetCookie checks in the windows\cookies directory for persistent cookies that have an expiration date set sometime in the future. InternetGetCookie also searches memory for any session cookies, that is, cookies that do not have an expiration date that were created in the same process by InternetSetCookie, because these cookies are not written to any files. Rules for creating cookie files are internal to the system and can change in the future.
As noted in <a href="https://msdn.microsoft.com/c3574592-572f-4fde-adfa-aed3e862f13f">HTTP Cookies</a>, <b>InternetGetCookie</b> does not return cookies that the server marked as non-scriptable with the "HttpOnly" attribute in the Set-Cookie header.
Like all other aspects of the WinINet API, this function cannot be safely called from within DllMain or the constructors and destructors of global objects.
|Windows version||Windows 2000 Professional [desktop apps only] Windows 2000 Server [desktop apps only]|