From 8bb1af84f465cbe5b802a7b0c98a712c3a1042d3 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Fri, 21 Sep 2012 14:54:15 +0200 Subject: [PATCH] wininet: Update used blocks count when block is allocated or freed. --- dlls/wininet/urlcache.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/wininet/urlcache.c b/dlls/wininet/urlcache.c index 8a221a8e81c..87789feeabd 100644 --- a/dlls/wininet/urlcache.c +++ b/dlls/wininet/urlcache.c @@ -781,6 +781,9 @@ static inline BYTE URLCache_Allocation_BlockIsFree(BYTE * AllocationTable, DWORD * * Marks the specified block as free * + * CAUTION + * this function is not updating used blocks count + * * RETURNS * nothing * @@ -796,6 +799,9 @@ static inline void URLCache_Allocation_BlockFree(BYTE * AllocationTable, DWORD d * * Marks the specified block as allocated * + * CAUTION + * this function is not updating used blocks count + * * RETURNS * nothing * @@ -840,6 +846,7 @@ static DWORD URLCache_FindFirstFreeEntry(URLCACHE_HEADER * pHeader, DWORD dwBloc for (index = 0; index < dwBlocksNeeded * BLOCKSIZE / sizeof(DWORD); index++) ((DWORD*)*ppEntry)[index] = 0xdeadbeef; (*ppEntry)->dwBlocksUsed = dwBlocksNeeded; + pHeader->dwBlocksInUse += dwBlocksNeeded; return ERROR_SUCCESS; } } @@ -867,6 +874,7 @@ static BOOL URLCache_DeleteEntry(LPURLCACHE_HEADER pHeader, CACHEFILE_ENTRY * pE for (dwBlock = dwStartBlock; dwBlock < dwStartBlock + pEntry->dwBlocksUsed; dwBlock++) URLCache_Allocation_BlockFree(pHeader->allocation_table, dwBlock); + pHeader->dwBlocksInUse -= pEntry->dwBlocksUsed; return TRUE; }