1 BOOL CleanUrlCache(LPSTR lpUrl)
2 {
3 LPINTERNET_CACHE_ENTRY_INFO lpICEI = NULL;
4 DWORD dwSize = 0;
5 HANDLE hFind = FindFirstUrlCacheEntry(NULL, NULL, &dwSize);
6 if (hFind == NULL && GetLastError() != ERROR_INSUFFICIENT_BUFFER)
7 return FALSE;
8
9 lpICEI = (LPINTERNET_CACHE_ENTRY_INFO)new char[dwSize];
10 hFind = FindFirstUrlCacheEntry(NULL, lpICEI, &dwSize);
11 if (hFind == NULL)
12 {
13 delete lpICEI;
14 return FALSE;
15 }
16
17 do
18 {
19 if (StrStrI(lpICEI->lpszSourceUrlName, lpUrl))
20 {
21 int bRet = DeleteUrlCacheEntry(lpICEI->lpszSourceUrlName);
22 }
23 delete lpICEI;
24 lpICEI = NULL;
25 dwSize = 0;
26
27 if (!FindNextUrlCacheEntry(hFind, NULL, &dwSize) && GetLastError() != ERROR_INSUFFICIENT_BUFFER)
28 break;
29 lpICEI = (LPINTERNET_CACHE_ENTRY_INFO)new char[dwSize];
30 } while (FindNextUrlCacheEntry(hFind, lpICEI, &dwSize));
31
32 if (lpICEI != NULL)
33 delete lpICEI;
34 return TRUE;
35 }