wininet: Delete file when cache entry is deleted.
This commit is contained in:
parent
7967f8beec
commit
359ed33824
|
@ -481,7 +481,6 @@ static void test_urlcacheA(void)
|
|||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = DeleteFile(filenameA);
|
||||
todo_wine
|
||||
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, "local file should no longer exist\n");
|
||||
|
||||
/* Creating two entries with the same URL */
|
||||
|
@ -537,7 +536,6 @@ static void test_urlcacheA(void)
|
|||
{
|
||||
ret = pDeleteUrlCacheEntryA(TEST_URL);
|
||||
ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
|
||||
todo_wine
|
||||
check_file_not_exists(filenameA);
|
||||
todo_wine
|
||||
check_file_not_exists(filenameA1);
|
||||
|
@ -595,7 +593,6 @@ static void test_urlcacheA(void)
|
|||
/* By unlocking the already-deleted cache entry, the file associated
|
||||
* with it is deleted..
|
||||
*/
|
||||
todo_wine
|
||||
check_file_not_exists(filenameA);
|
||||
/* (just in case, delete file) */
|
||||
DeleteFileA(filenameA);
|
||||
|
@ -692,7 +689,6 @@ static void test_urlcacheA(void)
|
|||
ret = pDeleteUrlCacheEntryA(TEST_URL);
|
||||
ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
|
||||
/* When explicitly deleting the cache entry, the file is also deleted */
|
||||
todo_wine
|
||||
check_file_not_exists(filenameA);
|
||||
}
|
||||
/* Test once again, setting the exempt delta via SetUrlCacheEntryInfo */
|
||||
|
@ -760,7 +756,6 @@ static void test_urlcacheA(void)
|
|||
{
|
||||
ret = pDeleteUrlCacheEntryA(TEST_URL);
|
||||
ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
|
||||
todo_wine
|
||||
check_file_not_exists(filenameA);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2175,11 +2175,13 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW(
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL DeleteUrlCacheEntryInternal(LPURLCACHE_HEADER pHeader,
|
||||
struct _HASH_ENTRY *pHashEntry)
|
||||
static BOOL DeleteUrlCacheEntryInternal(const URLCACHECONTAINER * pContainer,
|
||||
LPURLCACHE_HEADER pHeader, struct _HASH_ENTRY *pHashEntry)
|
||||
{
|
||||
CACHEFILE_ENTRY * pEntry;
|
||||
URL_CACHEFILE_ENTRY * pUrlEntry;
|
||||
WCHAR path[MAX_PATH];
|
||||
LONG path_size = sizeof(path);
|
||||
|
||||
pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry);
|
||||
if (pEntry->dwSignature != URL_SIGNATURE)
|
||||
|
@ -2220,8 +2222,13 @@ static BOOL DeleteUrlCacheEntryInternal(LPURLCACHE_HEADER pHeader,
|
|||
pHeader->CacheUsage.QuadPart = 0;
|
||||
}
|
||||
|
||||
URLCache_DeleteEntry(pHeader, pEntry);
|
||||
if (pUrlEntry->dwOffsetLocalName && URLCache_LocalFileNameToPathW(pContainer, pHeader,
|
||||
(LPCSTR)pUrlEntry+pUrlEntry->dwOffsetLocalName, pUrlEntry->CacheDir, path, &path_size))
|
||||
{
|
||||
DeleteFileW(path);
|
||||
}
|
||||
|
||||
URLCache_DeleteEntry(pHeader, pEntry);
|
||||
URLCache_DeleteEntryFromHash(pHashEntry);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -2297,7 +2304,7 @@ BOOL WINAPI UnlockUrlCacheEntryFileA(
|
|||
{
|
||||
URLCache_HashEntrySetFlags(pHashEntry, HASHTABLE_URL);
|
||||
if (pUrlEntry->CacheEntryType & PENDING_DELETE_CACHE_ENTRY)
|
||||
DeleteUrlCacheEntryInternal(pHeader, pHashEntry);
|
||||
DeleteUrlCacheEntryInternal(pContainer, pHeader, pHashEntry);
|
||||
}
|
||||
|
||||
URLCacheContainer_UnlockIndex(pContainer, pHeader);
|
||||
|
@ -3241,7 +3248,7 @@ BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
ret = DeleteUrlCacheEntryInternal(pHeader, pHashEntry);
|
||||
ret = DeleteUrlCacheEntryInternal(pContainer, pHeader, pHashEntry);
|
||||
|
||||
URLCacheContainer_UnlockIndex(pContainer, pHeader);
|
||||
|
||||
|
@ -3301,7 +3308,7 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
ret = DeleteUrlCacheEntryInternal(pHeader, pHashEntry);
|
||||
ret = DeleteUrlCacheEntryInternal(pContainer, pHeader, pHashEntry);
|
||||
|
||||
URLCacheContainer_UnlockIndex(pContainer, pHeader);
|
||||
heap_free(urlA);
|
||||
|
|
Loading…
Reference in New Issue