#include <Date.au3>
#include <Array.au3>
CONST $tagCacheEntry = "dword Size;ptr Src;ptr Local;dword Type;dword UseCount;" & _
"dword HitRate;dword SizeLow;dword SizeHigh;dword Modify[2];" & _
"dword Expire[2];dword Access[2];dword Sync[2];ptr Header;dword HeaderSize;ptr Ext"
_DeleteUrlCacheEntry()
Func _FindFirstUrlCacheEntry()
Local $hFind, $tCache, $pCache
$hFind = DllCall("Wininet.dll", "hWnd", "FindFirstUrlCacheEntry", _
"str", "", "ptr", 0, "int*", 0)
$tCache = DllStructCreate("ubyte[" & $hFind[3] & "]")
$pCache = DllStructGetPtr($tCache)
$hFind = DllCall("Wininet.dll", "hWnd", "FindFirstUrlCacheEntry", _
"str", "", "ptr", $pCache, "int*", $hFind[3])
Return $hFind[0]
EndFunc ;==>_FindFirstUrlCacheEntry()
Func _FindNextUrlCacheEntry($hFind)
Local $iResult, $tCache, $pCache, $tBuffer, $pBuffer, $aResult[9]
$iResult = DllCall("Wininet.dll", "int", "FindNextUrlCacheEntry", _
"hWnd", $hFind, "ptr", 0, "int*", 0)
If $iResult[3] = 0 Then Return SetError(1, 0, $aResult)
$tBuffer = DllStructCreate("ubyte[" & $iResult[3] & "]")
$pBuffer = DllStructGetPtr($tBuffer)
$iResult = DllCall("Wininet.dll", "int", "FindNextUrlCacheEntry", _
"hWnd", $hFind, "ptr", $pBuffer, "int*", $iResult[3])
Local $tSrc, $tLocal, $tHeader, $iHeaderSize
$tCache = DllStructCreate($tagCacheEntry, $pBuffer)
$tSrc = DllStructCreate("char[256]", DllStructGetData($tCache, "Src"))
$tLocal = DllStructCreate("char[260]", DllStructGetData($tCache, "Local"))
$iHeaderSize = DllStructGetData($tCache, "HeaderSize")
$tHeader = DllStructCreate("char[" & $iHeaderSize & "]", DllStructGetData($tCache, "Header"))
$aResult[0] = DllStructGetData($tSrc, 1)
$aResult[1] = DllStructGetData($tLocal, 1)
$aResult[2] = DllStructGetData($tCache, "Type")
$aResult[3] = DllStructGetData($tCache, "SizeLow")
$aResult[4] = _FormatTime(DllStructGetPtr($tCache, "Modify"))
$aResult[5] = _FormatTime(DllStructGetPtr($tCache, "Expire"))
$aResult[6] = _FormatTime(DllStructGetPtr($tCache, "Access"))
$aResult[7] = _FormatTime(DllStructGetPtr($tCache, "Sync"))
$aResult[8] = DllStructGetData($tHeader, 1)
$tSrc = 0
$tCache = 0
$tLocal = 0
$tHeader = 0
Return SetError(Not $iResult[0], 0, $aResult)
EndFunc ;==>_FindNextUrlCacheEntry()
Func _FindCloseUrlCache($hFind)
Local $iResult
$iResult = DllCall("Wininet.dll", "int", "FindCloseUrlCache", "hWnd", $hFind)
Return $iResult[0] <> 0
EndFunc ;==>_FindCloseUrlCache()
Func _DeleteUrlCacheEntry($sUrlPattern = "")
Local $iResult, $hFind, $aUrl
$hFind = _FindFirstUrlCacheEntry()
While True
$aUrl = _FindNextUrlCacheEntry($hFind)
If @error Then ExitLoop
If $sUrlPattern = "" Or StringRegExp($aUrl[0], $sUrlPattern) Then
_Wininet_DeleteUrlCacheEntry($aUrl[0])
EndIf
WEnd
Return _FindCloseUrlCache($hFind)
EndFunc ;==>_DeleteUrlCacheEntry()
Func _Wininet_DeleteUrlCacheEntry($sUrl)
Local $iResult
$iResult = DllCall("Wininet.dll", "int", "DeleteUrlCacheEntry", "str", $sUrl)
Return $iResult[0] <> 0
EndFunc ;==>_Wininet_DeleteUrlCacheEntry()
Func _FormatTime($pTime)
Local $tSysTime
$tSysTime = _Date_Time_FileTimeToSystemTime($pTime)
Return _Date_Time_SystemTimeToDateTimeStr($tSysTime)
EndFunc ;==>_FormatTime()