InternetGetCookie

This function retrieves the cookie for the specified URL.

BOOL InternetGetCookie(
  LPCTSTR lpszUrl,
  LPCTSTR lpszCookieName, 
  LPSTR lpCookieData, 
  LPDWORD lpdwSize
);

Parameters

  • lpszUrl
    [in] Address of a string that contains the URL to get cookies for.
  • lpszCookieName
    [in] Address of a string that contains the name of the cookie to get for the specified URL. This has not been implemented in this release.
  • lpCookieData
    [out] Address of the buffer that receives the cookie data. This value can be NULL.
  • lpdwSize
    [in, out] When the function is called, the address of an unsigned long integer variable that specifies the size of the lpszCookieData buffer. On return, 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.

Return Values

Returns TRUE if successful, or FALSE otherwise.

Remarks

This function does not require a call to InternetOpen. To retrieve cookies, it checks for both session cookies and persistent cookies. Session cookies, which do not have an expiration date, are stored in memory and are available only to the process in which they were created. Persistent cookies, which have an expiration date, are stored in the location specified in the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders registry key. The default location is Windows\Profiles\Guest\Cookies. Because the rules for creating cookie files are internal to WinInet functions and are subject to change, your application should always call InternetGetCookie, rather than attempt to access cookie files directly.

Requirements

OS Versions: Windows CE 2.12 and later.
Header: Wininet.h.
Link Library: Wininet.lib.

See Also

InternetOpen | InternetSetCookie | WinInet Functions

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.