Jacek Caban wrote: > + /* FIXME: Better check, when we have to create the cache file */ > + if(bSuccess && (lpwhr->hdr.dwFlags & INTERNET_FLAG_NEED_FILE)) { > + WCHAR url[INTERNET_MAX_URL_LENGTH]; > + WCHAR cacheFileName[MAX_PATH+1]; > + BOOL b; > + > + b = HTTP_GetRequestURL(lpwhr, url); > + if(!b) { > + WARN("Could not get URL\n"); > + goto lend; > + } > + > + b = CreateUrlCacheEntryW(url, lpwhr->dwContentLength > 0 ? > lpwhr->dwContentLength : 0, NULL, cacheFileName, 0); > + if(b) { > + lpwhr->lpszCacheFile = WININET_strdupW(cacheFileName); > + lpwhr->hCacheFile = CreateFileW(lpwhr->lpszCacheFile, > GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, > + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); > + if(lpwhr->hCacheFile == INVALID_HANDLE_VALUE) { > + WARN("Could not create file: %u\n", GetLastError()); > + lpwhr->hCacheFile = NULL; > + } > + }else { > + WARN("Could not create cache entry: %08x\n", GetLastError()); > + } > + } > >
It may be beyond the scope of your patch, but you're creating the cache file without committing the entry elsewhere so that it can be found at a later time. According to MSDN, this should be done in HTTP_FinishedReading. -- Rob Shearman