urlmon: Implement URLDownloadToCacheFileW.

This commit is contained in:
James Hawkins 2006-07-11 13:27:59 -07:00 committed by Alexandre Julliard
parent 54afeb02de
commit e2bf4ff164
1 changed files with 40 additions and 3 deletions

View File

@ -1611,9 +1611,46 @@ HRESULT WINAPI URLDownloadToCacheFileA(LPUNKNOWN lpUnkCaller, LPCSTR szURL, LPST
HRESULT WINAPI URLDownloadToCacheFileW(LPUNKNOWN lpUnkCaller, LPCWSTR szURL, LPWSTR szFileName, HRESULT WINAPI URLDownloadToCacheFileW(LPUNKNOWN lpUnkCaller, LPCWSTR szURL, LPWSTR szFileName,
DWORD dwBufLength, DWORD dwReserved, LPBINDSTATUSCALLBACK pBSC) DWORD dwBufLength, DWORD dwReserved, LPBINDSTATUSCALLBACK pBSC)
{ {
FIXME("(%p %s %p %ld %ld %p)\n", lpUnkCaller, debugstr_w(szURL), szFileName, WCHAR cache_path[MAX_PATH + 1];
dwBufLength, dwReserved, pBSC); FILETIME expire, modified;
return E_NOTIMPL; HRESULT hr;
LPWSTR ext;
static const WCHAR header[] = {
'H','T','T','P','/','1','.','0',' ','2','0','0',' ',
'O','K','\\','r','\\','n','\\','r','\\','n',0
};
TRACE("(%p, %s, %p, %ld, %ld, %p)\n", lpUnkCaller, debugstr_w(szURL),
szFileName, dwBufLength, dwReserved, pBSC);
if (!szURL || !szFileName)
return E_INVALIDARG;
ext = PathFindExtensionW(szURL);
if (!CreateUrlCacheEntryW(szURL, 0, ext, cache_path, 0))
return E_FAIL;
hr = URLDownloadToFileW(lpUnkCaller, szURL, cache_path, 0, pBSC);
if (FAILED(hr))
return hr;
expire.dwHighDateTime = 0;
expire.dwLowDateTime = 0;
modified.dwHighDateTime = 0;
modified.dwLowDateTime = 0;
if (!CommitUrlCacheEntryW(szURL, cache_path, expire, modified, NORMAL_CACHE_ENTRY,
(LPWSTR)header, sizeof(header), NULL, NULL))
return E_FAIL;
if (lstrlenW(cache_path) > dwBufLength)
return E_OUTOFMEMORY;
lstrcpyW(szFileName, cache_path);
return S_OK;
} }
/*********************************************************************** /***********************************************************************