From d1559158615aed8e4e6048023dce89d9fe1e28c4 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Fri, 19 Oct 2007 10:22:15 -0700 Subject: [PATCH] wininet: Implement IsUrlCacheEntryExpiredW. --- dlls/wininet/urlcache.c | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/dlls/wininet/urlcache.c b/dlls/wininet/urlcache.c index a3c23efca39..4d0ceabbdb0 100644 --- a/dlls/wininet/urlcache.c +++ b/dlls/wininet/urlcache.c @@ -2933,6 +2933,43 @@ BOOL WINAPI IsUrlCacheEntryExpiredA( LPCSTR url, DWORD dwFlags, FILETIME* pftLas */ BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLastModified ) { - FIXME("(%s, %08x, %p) stub\n", debugstr_w(url), dwFlags, pftLastModified); - return FALSE; + LPURLCACHE_HEADER pHeader; + CACHEFILE_ENTRY * pEntry; + URL_CACHEFILE_ENTRY * pUrlEntry; + URLCACHECONTAINER * pContainer; + + TRACE("(%s, %08x, %p)\n", debugstr_w(url), dwFlags, pftLastModified); + + if (!URLCacheContainers_FindContainerW(url, &pContainer)) + return FALSE; + + if (!URLCacheContainer_OpenIndex(pContainer)) + return FALSE; + + if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) + return FALSE; + + if (!URLCache_FindEntryInHashW(pHeader, url, &pEntry)) + { + URLCacheContainer_UnlockIndex(pContainer, pHeader); + TRACE("entry %s not found!\n", debugstr_w(url)); + SetLastError(ERROR_FILE_NOT_FOUND); + return FALSE; + } + + if (pEntry->dwSignature != URL_SIGNATURE) + { + URLCacheContainer_UnlockIndex(pContainer, pHeader); + FIXME("Trying to retrieve entry of unknown format %s\n", debugstr_an((LPSTR)&pEntry->dwSignature, sizeof(DWORD))); + SetLastError(ERROR_FILE_NOT_FOUND); + return FALSE; + } + + pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry; + + DosDateTimeToFileTime(pUrlEntry->wExpiredDate, pUrlEntry->wExpiredTime, pftLastModified); + + URLCacheContainer_UnlockIndex(pContainer, pHeader); + + return TRUE; }