wininet: Don't delete locked entry in DeleteUrlCacheEntry.
This commit is contained in:
parent
06c1f255f8
commit
d1ecb6d9ba
|
@ -571,9 +571,7 @@ static void test_urlcacheA(void)
|
|||
if (pDeleteUrlCacheEntryA)
|
||||
{
|
||||
ret = pDeleteUrlCacheEntryA(TEST_URL);
|
||||
todo_wine
|
||||
ok(!ret, "Expected failure\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_SHARING_VIOLATION,
|
||||
"Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
|
||||
check_file_exists(filenameA);
|
||||
|
@ -582,9 +580,7 @@ static void test_urlcacheA(void)
|
|||
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
|
||||
memset(lpCacheEntryInfo, 0, cbCacheEntryInfo);
|
||||
ret = GetUrlCacheEntryInfo(TEST_URL, lpCacheEntryInfo, &cbCacheEntryInfo);
|
||||
todo_wine
|
||||
ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
|
||||
todo_wine
|
||||
ok(lpCacheEntryInfo->CacheEntryType & DELETED_CACHE_ENTRY,
|
||||
"CacheEntryType hasn't DELETED_CACHE_ENTRY set, (flags %08x)\n",
|
||||
lpCacheEntryInfo->CacheEntryType);
|
||||
|
@ -594,7 +590,6 @@ static void test_urlcacheA(void)
|
|||
{
|
||||
check_file_exists(filenameA);
|
||||
ret = pUnlockUrlCacheEntryFileA(TEST_URL, 0);
|
||||
todo_wine
|
||||
ok(ret, "UnlockUrlCacheEntryFileA failed: %d\n", GetLastError());
|
||||
/* By unlocking the already-deleted cache entry, the file associated
|
||||
* with it is deleted..
|
||||
|
|
|
@ -2139,7 +2139,17 @@ static BOOL DeleteUrlCacheEntryInternal(LPURLCACHE_HEADER pHeader,
|
|||
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry;
|
||||
if ((pHashEntry->dwHashKey & ((1<<HASHTABLE_FLAG_BITS)-1)) == HASHTABLE_LOCK)
|
||||
{
|
||||
/* FIXME: implement timeout object unlocking */
|
||||
TRACE("Trying to delete locked entry\n");
|
||||
pUrlEntry->CacheEntryType |= DELETED_CACHE_ENTRY;
|
||||
SetLastError(ERROR_SHARING_VIOLATION);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (pUrlEntry->CacheDir < pHeader->DirectoryCount)
|
||||
{
|
||||
if (pHeader->directory_data[pUrlEntry->CacheDir].dwNumFiles)
|
||||
|
@ -2234,7 +2244,11 @@ BOOL WINAPI UnlockUrlCacheEntryFileA(
|
|||
}
|
||||
pUrlEntry->dwUseCount--;
|
||||
if (!pUrlEntry->dwUseCount)
|
||||
{
|
||||
URLCache_HashEntrySetFlags(pHashEntry, HASHTABLE_URL);
|
||||
if (pUrlEntry->CacheEntryType & DELETED_CACHE_ENTRY)
|
||||
DeleteUrlCacheEntryInternal(pHeader, pHashEntry);
|
||||
}
|
||||
|
||||
URLCacheContainer_UnlockIndex(pContainer, pHeader);
|
||||
|
||||
|
|
Loading…
Reference in New Issue