Cookie Functions

Cookies are a means by which, under HTTP protocol, a server or a script can maintain state information on the client workstation. WinInet has implemented a persistent cookie database for this purpose. Cookie functions are provided for users of WinInet in order to set cookies into, and access them from, the cookie database. The caller of these functions should be familiar with cookies as outlined in ftp://ds.internic.net/internet-drafts/draft-ietf-http-state-mgmt-01.txt. Please note that the implementation of these functions is evolving; be cautious when using them.

InternetGetCookie

BOOL InternetGetCookie(
    IN  LPCSTR lpszUrlName,
    IN  LPCSTR lpszCookieName,
    OUT LPSTR lpszCookieData,
    IN OUT LPDWORD  lpdwSize
);

Returns cookies for the specified URL and all it's parent URLs.

lpszUrlName
Address of a string that contains the URL to get cookies for.
lpszCookieName
Address of the name of the cookie to get for the specified URL. This has not been implemented in this release.
lpszCookieData
Address of the buffer that receives the cookie data. This value can be NULL.
lpdwSize
Address of a variable that specifies the size of the lpszCookieData buffer. If the function succeeds, the buffer receives the amount of data copied to the lpszCookieData buffer. If lpCookieData is NULL, this parameter receives a value that specifies the size of buffer necessary to copy all the cookie data.

InternetSetCookie

BOOL InternetSetCookie(
    IN LPCSTR lpszUrlName,
    IN LPCSTR lpszCookieName,
    IN LPCSTR lpszCookieData
);

Sets a cookie on the specified URL.

lpszUrlname
Address of a null-terminated string that specifies the URL for which the cookie should be set.
lpszCookieName
Address of a string that contains the name to associate with the cookie. If this parameter is NULL, no name is associated with the cookie. This parameter is not implemented in this release and should be set to NULL.
lpszCookieData
Address of the actual data to associate with the URL.

© 1996 Microsoft Corporation