Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

Provides the most efficient and implementation-independent way to access the cache data.

Syntax

HANDLE RetrieveUrlCacheEntryStream(
  LPCTSTR 
lpszUrlName
  LPINTERNET_CACHE_ENTRY_INFO 
lpCacheEntryInfo,
  LPDWORD 
lpdwCacheEntryInfoBufferSize,
  BOOL 
fRandomRead,
  DWORD 
dwReserved
);

Parameters

lpszUrlName

[in] Pointer to a null-terminated string that contains the source name of the cache entry. This must be a unique name. The name string should not contain any escape characters.

lpCacheEntryInfo

[out] Pointer to an INTERNET_CACHE_ENTRY_INFO structure that receives information about the cache entry.

lpdwCacheEntryInfoBufferSize

[in, out] Pointer to a variable that specifies the size, in bytes, of the lpCacheEntryInfobuffer. When the function returns, the variable receives the number of bytes copied to the buffer or the required size, in bytes, of the buffer. Note that this buffer size must accommodate both the INTERNET_CACHE_ENTRY_INFOstructure and the associated strings that are stored immediately following it.

fRandomRead

[in] Whether the stream is open for random access. Set the flag to TRUE to open the stream for random access.

dwReserved

[in] Reserved. Must be zero.

Return Value

If the function succeeds, the function returns a valid handle for use in the ReadUrlCacheEntryStream and UnlockUrlCacheEntryStream functions.

If the function fails, it returns NULL. To get extended error information, call GetLastError.

Possible error values include the following.

Return code Description

ERROR_FILE_NOT_FOUND

The cache entry specified by the source name is not found in the cache storage.

ERROR_INSUFFICIENT_BUFFER

The size of lpCacheEntryInfoas specified by lpdwCacheEntryInfoBufferSizeis not sufficient to contain all the information. The value returned in lpdwCacheEntryInfoBufferSizeindicates the buffer size necessary to contain all the information

Remarks

This function does not do any URL parsing, so a URL containing an anchor (#) will not be found in the cache, even if the resource is cached. For example, if the URL http://adatum.com/example.htm#sample is passed, the function returns ERROR_FILE_NOT_FOUND even if http://adatum.com/example.htm is in the cache.

Cache clients that do not need URL data in the form of a file should use this function to access the data for a particular URL.

Requirements

Header wininet.h
Library wininet.lib
Windows Embedded CE Windows CE 2.12 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also