Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
922 B

  1. #include <windows.h>
  2. #include <wininet.h>
  3. void main()
  4. {
  5. // Assume existing file C:\temp\foo.bar to be
  6. // committed to cache associated with
  7. // http://www.foo.bar/
  8. LPSTR szFile = "c:\\temp\\foo.bar";
  9. LPSTR szUrl = "http://www.foo.bar/";
  10. CHAR szCacheFile[MAX_PATH];
  11. // Expiry and Last-Modified times of 0.
  12. LONGLONG llZero = 0;
  13. FILETIME ftExpire = *((FILETIME*) & llZero);
  14. FILETIME ftLastMod = *((FILETIME*) & llZero);
  15. // Create cache file.
  16. CreateUrlCacheEntry(szUrl, 0, NULL, szCacheFile, 0);
  17. // Copy existing file to cache file.
  18. CopyFile(szFile, szCacheFile, FALSE);
  19. CommitUrlCacheEntry(szUrl,
  20. szCacheFile,
  21. ftExpire,
  22. ftLastMod,
  23. 0,
  24. NULL,
  25. 0,
  26. NULL,
  27. 0);
  28. }