Jump to content

InetGet / InetRead / _INetGetSource - Caching issue


Recommended Posts

After some browsing through the AutoIt forums, I did not find a valid solution for my problem.

 

I'm using InetRead to retrieve update information from a webserver, the file is an .ini file that is being loaded into memory and then read. However, when I update the file on the webserver, the script accesses the previous file downloaded from cache instead of downloading it again. (Even though I'm setting the FORCERELOAD flag)

 

Quite a lot of people have had this issue in the past and the only working solution I've came across was to completely delete the IE cache with this code:

Run("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8")

However, this is not a viable solution since first of all: It is not stealth, this will open up a console window if there are a lot of cache files to remove. Secondly, deleting a users IE cache is beyond bad practice and could possibly mess up other things.

 

I have tried to delete all .ini cache files manually using this code:

;- This is pseudo-code that may be flawed and may not function. I don't have the original anymore so I tried to re-create it for demonstrational purposes

Local $Files = _FileListToArrayRec("C:\Users\" & @UserName & "\AppData\Local\Microsoft\Windows\INetCache\IE\","*",$FLTAR_FOLDERS,1,0,2)

For $I = 0 To uBound($Files) - 1 Step 1
    If FileExists($Files[$I] & "\update[1].ini") Then
        FileDelete($Files[$I] & "\update[1].ini")
    EndIf
Next

However, even though all the paths were correct and the script did find the cache files, they were never deleted. FileDelete won't delete these cache files and I have no idea why. Even running the script as admin didn't work. I also tried to use an elevated command prompt to try and delete these files with the script which also does not work.

 

 

The code I'm using to get the update info:

Local $UpdateGet = InetRead("LINK TO SITE",BitOr($INET_FORCERELOAD,$INET_FORCEBYPASS))
If @Error Then $UpdateGet = InetRead("LINK TO BACKUP SERVER",BitOr($INET_FORCERELOAD,$INET_FORCEBYPASS))
If @Error Then
    MsgBox($MB_OK,"Error","Could not connect to the Update Servers.")
    Exit ;- We don't want people to bypass activation
Else

    ;- Authentication + Updater code
EndIf

 

Any help is greatly appreciated.

 

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...