function CacheSizeEx(s, sCount: TStrings): Int64;
const
MAXINFOSIZE = 4
shl 10;
var
hCache: THandle;
dwSize: Cardinal;
i64: Int64;
pInfo: PInternetCacheEntryInfo;
cet:
String;
index: Integer;
begin
Result := 0;
GetMem(pInfo, MAXINFOSIZE);
pInfo.dwStructSize := MAXINFOSIZE;
dwSize := MAXINFOSIZE;
hCache := FindFirstUrlCacheEntry(
nil, pInfo^, dwSize);
if hCache <> 0
then
begin
s.Clear;
repeat
cet := IntToHex(pInfo.CacheEntryType, 8);
index := sCount.IndexOfName(cet);
if index < 0
then sCount.Values[cet] := '
1'
else sCount.ValueFromIndex[
index] := IntToStr(Succ(StrToInt(sCount.ValueFromIndex[
index])));
s.Add(StrPas(pInfo.lpszSourceUrlName));
Int64Rec(i64).Hi := pInfo.dwSizeHigh;
Int64Rec(i64).Lo := pInfo.dwSizeLow;
Result := Result + i64;
dwSize := MAXINFOSIZE;
until not FindNextUrlCacheEntry(hCache, pInfo^, dwSize);
FindCloseUrlCache(hCache);
end;
FreeMem(pInfo, MAXINFOSIZE);
if hCache = 0
then
raise Exception.Create(SysErrorMessage(GetLastError));
end;