Contents Index Topic Contents | ||
Previous Topic: ReadUrlCacheEntryStream Next Topic: RetrieveUrlCacheEntryStream |
RetrieveUrlCacheEntryFile
BOOL RetrieveUrlCacheEntryFile( IN LPCSTR lpszUrlName, OUT LPINTERNET_CACHE_ENTRY_INFO lpCacheEntryInfo, IN OUT LPDWORD lpdwCacheEntryInfoBufferSize, IN DWORD dwReserved );Retrieves a cache entry from the cache in the form of a file.
- Returns TRUE if successful, or FALSE otherwise. To get extended error information, call GetLastError. Possible error values include:
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 the lpCacheEntryInfo buffer as specified by lpdwCacheEntryInfoBufferSize is not sufficient to contain all the information. The value returned in lpdwCacheEntryInfoBufferSize indicates the buffer size necessary to get all the information.
- lpszUrlName
- Source name of the cache entry. This must be a unique name. The name string should not contain any escape characters.
- lpCacheEntryInfo
- Address of a cache entry information buffer. If the buffer is not sufficient to accommodate all the information associated with the URL, one or more of the embedded pointers will be NULL.
- lpdwCacheEntryInfoBufferSize
- Address of a variable that specifies the size of the lpCacheEntryInfo buffer. When the function returns, the variable contains the size of the actual buffer used or required. The caller should check the return value in this parameter. If the return size is less than or equal to the size passed in, all the relevant data has been returned.
- dwReserved
- Reserved; must be zero.
RetrieveUrlCacheEntryFile 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://example.com/example.htm#sample, was passed, the function would return ERROR_FILE_NOT_FOUND even if http://example.com/example.htm is in the cache.
If an extension was provided while calling CommitUrlCacheEntry, the file will have the specified extension. If the entry is not available in the cache, this function returns ERROR_FILE_NOT_FOUND; otherwise, it returns the name of the local file. The caller is given only read permission to the local file, so the caller should not attempt to write or delete the file.
The file is locked for the caller when it is retrieved; the caller should unlock the file after it has been used up. The cache manager automatically unlocks the locked files after a certain interval. While the file is locked, the cache manager will not remove the file from the cache. It is important to note that this function may be efficient or expensive, depending on the internal implementation of the cache. For instance, if the URL data is stored in a packed file that contains data for other URLs, the cache will make a copy of the data to a file in a temporary directory maintained by the cache. The cache will eventually delete the copy. It is recommended that this function be used only in situations where a file name is needed to launch an application. RetrieveUrlCacheEntryStream and associated stream functions should be used in most cases.
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.