FILE: Enumerating and Displaying Wininet Cache

Last reviewed: January 19, 1998
Article ID: Q172607
The information in this article applies to:
  • Internet Client SDK, versions 4.0, 4.01
  • Microsoft ActiveX SDK, version 1.0
  • Internet Explorer (Programming), versions 4.0, 4.01

SUMMARY

The CACHEVW sample demonstrates how to enumerate and display Wininet cache entries. The following Wininet caching APIs are used in the sample:

  • FindFirstUrlEntry
  • FindNextUrlCacheEntry
  • FindCloseUrlCache
  • GetCacheEntryInfo
  • RetrieveUrlCacheEntryStream
  • ReadUrlCacheEntryStream
  • UnlockUrlCachEntryStream

The following self-extracting file is available for download from the Microsoft Software Library:

 ~ Cachevw.exe (size: 20392 bytes) 

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE     : How to Obtain Microsoft Support Files from Online Services

MORE INFORMATION

The CACHEVW sample contains three files: Cachevw.cpp, Cachevw.rc, and Makefile. If you have Win32 SDK or Visual C++ installed, you can run the nmake utility to compile the sample.

FindNextUrlCacheEntry in Internet Explorer 3.x version of Wininet.dll has a bug where an entry is skipped if the initial buffer supplied is too small. When the function gets to an entry that is larger than the buffer supplied, it returns the buffer size required and the error ERROR_INSUFFICIENT_BUFFER. On the next call to FindNextUrlCacheEntry, it goes to the next cache entry instead of the one that returned ERROR_INSUFFICIENT_BUFFER. To work around the bug, use an initial buffer of at least 2048 bytes in FindNextURLCacheEntry. This bug will be fixed in the Internet Explorer 4.0 Wininet.dll. If the application is designed to run only with the Internet Explorer 4.0 version of Wininet.dll, it's better to dynamically allocate the buffer. The application could use a much smaller initial buffer--512 bytes, for example--to enumerate the cache. This is usually sufficient for most of cache entries.

In the Internet Explorer 3.x version of Wininet, the size cache entry info structure is limited to 2,048 bytes, and Wininet.h for Internet Explorer 3.0x has the following define:

   define MAX_CACHE_ENTRY_INFO_SIZE 4096

In Internet Explorer 4.0 there will be no size limit to the cache entry info structure and the MAX_CACHE_ENTRY_INFO_SIZE flag will also be removed from the Internet Explorer 4.0 Wininet.h file. Therefore application developers may need to define MAX_CACHE_ENTRY_INFO value themselves when porting their Wininet application from Internet Explorer 3.x to Internet Explorer 4.0 and using the Internet Explorer 4.0 version Wininet.h.

Keywords          : AXSDKWinInet
Technology        : kbInetDev
Version           : WINDOWS:1.0,4.0,4.01
Platform          : WINDOWS
Issue type        : kbfile
Solution Type     : kbsample


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 19, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.