DllCall("UpdateResource" ... but faster?

Get help with using AutoHotkey and its commands and hotkeys
newbieforever
Posts: 229
Joined: 24 Aug 2016, 03:34

DllCall("UpdateResource" ... but faster?

23 May 2018, 01:49

In my script I am using DllCall("UpdateResource" ... to replace a resource in an executable. This is doing fine, but it is not very fast, probably because the changes are written to disk in several steps.

Is there a way to make this faster? Or--a strange question: Is it possible to update a resource in a runnig executable?

EDIT: Later tests and discussion showed that the slowness is caused by Windows Defender, since two weeks or so!!! And WD is slowing down other AHK-associated operations too. New topic: https://autohotkey.com/boards/viewtopic.php?f=5&t=49615
Last edited by newbieforever on 26 May 2018, 03:24, edited 3 times in total.
just me
Posts: 5457
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 03:12

Why do you need it to be faster?
newbieforever
Posts: 229
Joined: 24 Aug 2016, 03:34

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 03:30

Hi, just me! Because I have to use the new exe as soon as possible.
I tested now the time consumption of the updating-process steps. The only time consuming step is DllCall("EndUpdateResource" ...
just me
Posts: 5457
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 04:08

Looking at your recent questions related to AutoHotkeySC.bin, are you trying to replace the embedded script in an Ahk.exe?
newbieforever
Posts: 229
Joined: 24 Aug 2016, 03:34

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 04:22

Yes, just me, I am doing this already.
just me
Posts: 5457
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 04:32

May I ask why you think to need that?
newbieforever
Posts: 229
Joined: 24 Aug 2016, 03:34

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 04:38

Just me, I test ahk scripts from a CompiledScript.exe.
just me
Posts: 5457
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 04:49

Well, but why does 'testing scripts' require to be 'faster'? How long does it take to update the script resource?
newbieforever
Posts: 229
Joined: 24 Aug 2016, 03:34

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 05:01

AutoHotkey.exe runs a script in a second or less, updating resource takes e.g. 15 seconds.
just me
Posts: 5457
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 05:08

That's rather much time. I'll try to make some tests.

So long!
User avatar
Flipeador
Posts: 1001
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 07:43

15 seconds? that is exaggerated/ridiculous. Can you show us your Script?. I've been playing changing many resources, images, icons, ... (I'm doing my own compiler) all at once, it has not taken more than a few milliseconds (on a HDD).
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library
just me
Posts: 5457
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 08:44

After some testing I confirm Flipeador's observations. The replacement of a ~4K AHK script needs only milliseconds here (on a SSD).

The compiler is calling UpdateResource() to add the script to the exe, too. Does it need several seconds to compile a script on your system?
newbieforever
Posts: 229
Joined: 24 Aug 2016, 03:34

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 09:04

That's interesting!


Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by newbieforever on 25 May 2018, 09:17, edited 1 time in total.
newbieforever
Posts: 229
Joined: 24 Aug 2016, 03:34

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 09:14

Maybe I should mention: UpdateRes() is writting a tmp file on disk during processing.
newbieforever
Posts: 229
Joined: 24 Aug 2016, 03:34

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 11:17

just me & Flipeador, thank you very much for your help, I see now there must be something wrong with my system. I have to find out what.
User avatar
Flipeador
Posts: 1001
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 11:42

Maybe it's the antivirus... have you tried disabling it and running the script as Admin?...
Your Script seems fine... no idea... Does the compiler also take seconds?
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library
newbieforever
Posts: 229
Joined: 24 Aug 2016, 03:34

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 18:04

Yes, it is a Windows Defender problem!!!
And yes, the compiler takes seconds too!
Deactivating WD enables compiling and updating of resources in ms.
WD reports a Trojan:Win32/Fuery.B!cl during compiling (indicating tmp files in Temp dir).

This is an enormous shock to me ... Will the use of AHK scripts become unreliable?

But why there are no other user reporting this problem?

I am using Windows 10 Home 10.0.16299.
User avatar
Flipeador
Posts: 1001
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 18:31

Maybe I should mention: UpdateRes() is writting a tmp file on disk during processing.

I never really noticed this. I just confirmed it using FolderChangesView. Has created an RCX4676.tmp file in the same directory as the Script.

Yes, it is a Windows Defender problem!!!

Does it detect AutoHotkey.exe?.

WD reports a Trojan:Win32/Fuery.B!cl during compiling (indicating tmp files in Temp dir).

So... the compilation ends successfully or not?. Have you tried updating WD?.
I don't use any antivirus so I can't test it. (edit* I have MBAM Premium -i installed it not long ago- but it does not detect anything).
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library
newbieforever
Posts: 229
Joined: 24 Aug 2016, 03:34

Re: DllCall("UpdateResource" ... but faster?

25 May 2018, 22:30

No other virus is detected. Compilation ends successfully. WD is updated.

EDIT: New topic: https://autohotkey.com/boards/viewtopic.php?f=5&t=49615

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 93 guests