Iczer Posted October 29, 2013 Posted October 29, 2013 (edited) I'm trying to get info from function http://msdn.microsoft.com/en-us/library/aa384185%28VS.85%29.aspx BOOL GetUrlCacheEntryInfo( _In_ LPCTSTR lpszUrlName, _Out_ LPINTERNET_CACHE_ENTRY_INFO lpCacheEntryInfo, _Inout_ LPDWORD lpcbCacheEntryInfo ); And have some troubles with "_INTERNET_CACHE_ENTRY_INFO" structure http://msdn.microsoft.com/en-us/library/aa385134%28v=vs.85%29.aspx typedef struct _INTERNET_CACHE_ENTRY_INFO { DWORD dwStructSize; LPTSTR lpszSourceUrlName; LPTSTR lpszLocalFileName; DWORD CacheEntryType; DWORD dwUseCount; DWORD dwHitRate; DWORD dwSizeLow; DWORD dwSizeHigh; FILETIME LastModifiedTime; FILETIME ExpireTime; FILETIME LastAccessTime; FILETIME LastSyncTime; LPTSTR lpHeaderInfo; DWORD dwHeaderInfoSize; LPTSTR lpszFileExtension; union { DWORD dwReserved; DWORD dwExemptDelta; }; } INTERNET_CACHE_ENTRY_INFO, *LPINTERNET_CACHE_ENTRY_INFO; i make "union" as "DWORD union". Is it right if i do not need info from it? in "try1" case function return "1", and i get $rezult[3] = 0 but "lpszLocalFileName = 0", "lpcbCacheEntryInfo = 0" in "try2" case function return "0", and i get $rezult[3] = 794 but"lpszLocalFileName = 0" and "lpcbCacheEntryInfo = 0" What in my structure setup is not right ? expandcollapse popup#include <Array.au3> $tag_INTERNET_CACHE_ENTRY_INFO = "struct;DWORD dwStructSize; wstr lpszSourceUrlName; wstr lpszLocalFileName; DWORD CacheEntryType; DWORD dwUseCount; DWORD dwHitRate; DWORD dwSizeLow; DWORD dwSizeHigh; UINT64 LastModifiedTime; UINT64 ExpireTime; UINT64 LastAccessTime; UINT64 LastSyncTime; wstr lpHeaderInfo; DWORD dwHeaderInfoSize; wstr lpszFileExtension; DWORD union;endstruct" ;$tag_INTERNET_CACHE_ENTRY_INFO = "struct;DWORD dwStructSize; LPTSTR lpszSourceUrlName; LPTSTR lpszLocalFileName; DWORD CacheEntryType; DWORD dwUseCount; DWORD dwHitRate; DWORD dwSizeLow; DWORD dwSizeHigh; FILETIME LastModifiedTime; FILETIME ExpireTime; FILETIME LastAccessTime; FILETIME LastSyncTime; LPTSTR lpHeaderInfo; DWORD dwHeaderInfoSize; LPTSTR lpszFileExtension; DWORD union;endstruct" $struct_INTERNET_CACHE_ENTRY_INFO = DllStructCreate ( $tag_INTERNET_CACHE_ENTRY_INFO ) $ptr_INTERNET_CACHE_ENTRY_INFO = DllStructGetPtr ( $struct_INTERNET_CACHE_ENTRY_INFO ) $tag_lpcbCacheEntryInfo = "DWORD, lpcbCacheEntryInfo" $struct_lpcbCacheEntryInfo = DllStructCreate ( $tag_lpcbCacheEntryInfo ) ;DllStructSetData($struct_lpcbCacheEntryInfo,"lpcbCacheEntryInfo",0x0000ffff) $ptr_lpcbCacheEntryInfo = DllStructGetPtr ( $struct_lpcbCacheEntryInfo ) $lpszUrlName = "http://www.autoitscript.com/autoit3/files/graphics/autoit_10_wall_1024x768.jpg" ConsoleWrite("----------------------------------------------------------" &@crlf) ;---------------------------------------------------------------------------------------------- ;try 1 ;---------------------------------------------------------------------------------------------- $rezult = DllCall("Wininet.dll","BOOL","GetUrlCacheEntryInfoW","wstr",$lpszUrlName,"ptr",$ptr_INTERNET_CACHE_ENTRY_INFO,"ptr",$ptr_lpcbCacheEntryInfo) _ArrayDisplay($rezult) ConsoleWrite("$rezult = " & $rezult[0] &@crlf) $lpszLocalFileName = DllStructGetData($struct_INTERNET_CACHE_ENTRY_INFO,"lpszLocalFileName") ConsoleWrite("$lpszLocalFileName = " & $lpszLocalFileName &@crlf) $lpcbCacheEntryInfo = DllStructGetData($struct_lpcbCacheEntryInfo,"lpcbCacheEntryInfo") ConsoleWrite("$lpcbCacheEntryInfo = " & $lpcbCacheEntryInfo &@crlf) ConsoleWrite("----------------------------------------------------------" &@crlf) ;---------------------------------------------------------------------------------------------- ;try 2 ;---------------------------------------------------------------------------------------------- $rezult = DllCall("Wininet.dll","BOOL","GetUrlCacheEntryInfoW","wstr",$lpszUrlName,"struct*",$ptr_INTERNET_CACHE_ENTRY_INFO,"dword*",$ptr_lpcbCacheEntryInfo) _ArrayDisplay($rezult) ConsoleWrite("$rezult = " & $rezult[0] &@crlf) $lpszLocalFileName = DllStructGetData($struct_INTERNET_CACHE_ENTRY_INFO,"lpszLocalFileName") ConsoleWrite("$lpszLocalFileName = " & $lpszLocalFileName &@crlf) $lpcbCacheEntryInfo = DllStructGetData($struct_lpcbCacheEntryInfo,"lpcbCacheEntryInfo") ConsoleWrite("$lpcbCacheEntryInfo = " & $lpcbCacheEntryInfo &@crlf) ;---------------------------------------------------------------------------------------------- ConsoleWrite("----------------------------------------------------------" &@crlf) Edited October 29, 2013 by Iczer
funkey Posted October 29, 2013 Posted October 29, 2013 What in my structure setup is not right ?$tag_lpcbCacheEntryInfo = "DWORD, lpcbCacheEntryInfo" Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning.
Raik Posted October 29, 2013 Posted October 29, 2013 I think, thats, what you want: AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1)
Solution Danyfirex Posted October 30, 2013 Solution Posted October 30, 2013 I think It could be something like this: expandcollapse popupGlobal Const $hWinNet = DllOpen("wininet.dll") Global Const $tagINTERNET_CACHE_ENTRY_INFO = "dword StructSize; ptr SourceUrlName; ptr LocalFileName; dword CacheEntryType; dword UseCount; dword HitRate; dword Size[2]; dword LastModifiedTime[2]; dword ExpireTime[2]; dword LastAccessTime[2]; dword LastSyncTime[2]; ptr HeaderInfo; dword HeaderInfoSize; ptr FileExtension; dword ReservedExemptDelta" Local $sUrl= "http://www.autoitscript.com/autoit3/files/graphics/autoit_10_wall_1024x768.jpg" Local $sLocalFileName = GetUrlCacheEntryInfo($sUrl) msgbox(0,"",$sLocalFileName) DllClose($hWinNet) Func GetUrlCacheEntryInfo($Url) Local $tCacheEntryInfoSize = DllStructCreate("dword") DllCall($hWinNet, _ "int", "GetUrlCacheEntryInfoW", _ "wstr", $Url, _ "ptr", 0, _ "ptr", DllStructGetPtr($tCacheEntryInfoSize)) Local $tCacheEntryInfo = DllStructCreate( _ $tagINTERNET_CACHE_ENTRY_INFO & "; " & _ "byte[" & (DllStructGetData($tCacheEntryInfoSize, 1)+1) & "]") Local $avResult = DllCall($hWinNet, _ "int", "GetUrlCacheEntryInfoW", _ "wstr", $Url, _ "ptr", DllStructGetPtr($tCacheEntryInfo), _ "ptr", DllStructGetPtr($tCacheEntryInfoSize)) $lPointer = DllStructGetData($tCacheEntryInfo, "LocalFileName") local $tLocalFileName=DllStructCreate("wchar[500]",$lPointer) Return DllStructGetData($tLocalFileName,1) EndFunc Saludos Iczer 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Iczer Posted October 30, 2013 Author Posted October 30, 2013 I think It could be something like this: ... Thanks! Great example - it seems structures is still ahead for me
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now