URLDownloadToFile() writes objects in the cache when run as a service

允我心安 提交于 2019-12-14 02:49:21

问题


I have a piece of software that downloads images into a working directory and then processes them to create a video; afterwards, those files are removed by an independent script.

The problem is that it also writes files into the following directory (the software runs as a system service):

C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5

To make things worse, there doesn't seem to be a limit to how many files are kept there; this causes server issues due to the hard disc shortage.

In an attempt to prevent files from being cached we have tried the following:

  1. Use Pragma: and Cache-Control: headers on the server to prevent caching on the client;

  2. Use DeleteUrlCacheEntry() to remove the cache entry after download has completed; returns ERROR_FILE_NOT_FOUND;

  3. Use IBindStatusCallback::GetBindInfo() and set the passed grfBINDF to BINDF_NOWRITECACHE|BINDF_PRAGMA_NO_CACHE|BINDF_GETNEWESTVERSION.

Unfortunately, the aforementioned approaches don't prevent cache files from still being written into the internet cache.

Is there something I've missed?

来源:https://stackoverflow.com/questions/27518724/urldownloadtofile-writes-objects-in-the-cache-when-run-as-a-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!