jasty Posted June 26, 2021 Share Posted June 26, 2021 One of my friends is running a script that is behaving bizarrely slow. Same thing works fine on many other computers and I suspect it's some kind of configuration error but I'm not sure what it could be. Are there any known compatibility settings or windows configuration things that causes AutoIt to run much slower than it should? -jasty Link to comment Share on other sites More sharing options...
Developers Jos Posted June 26, 2021 Developers Share Posted June 26, 2021 yes. ... but you have to show the script and/or tell us what is does before you can get any serious answer. MrKm 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
jasty Posted June 26, 2021 Author Share Posted June 26, 2021 (edited) It's a plugin I made that uses NomadMemory.au3 to read / write to the memory of another process and can create remote threads and wait for them to finish. This is the thread code. Must be some big delay in spinning up the remote thread? This is the injection code. Func InjectCode($OPcode, $processHandle) ;Allocate memory for the OpCode and retrieve address for this $functionAddress = DllCall('kernel32.dll', 'int', 'VirtualAllocEx', 'int', $processHandle, 'ptr', 0, 'int', 100, 'int', 0x1000, 'int', 0x40) ;Construct the OpCode for calling the function ;Put the OpCode into a struct for later memory writing $vBuffer = DllStructCreate('byte[' & StringLen($OPcode) / 2 & ']') For $loop = 1 To DllStructGetSize($vBuffer) DllStructSetData($vBuffer, 1, Dec(StringMid($OPcode, ($loop - 1) * 2 + 1, 2)), $loop) Next ;Write the OpCode to previously allocated memory DllCall('kernel32.dll', 'int', 'WriteProcessMemory', 'int', $processHandle, 'int', $functionAddress[0], 'int', DllStructGetPtr($vBuffer), 'int', DllStructGetSize($vBuffer), 'int', 0) ;Create a remote thread in order to run the OpCode $hRemoteThread = DllCall('kernel32.dll', 'int', 'CreateRemoteThread', 'int', $processHandle, 'int', 0, 'int', 0, 'int', $functionAddress[0], 'ptr', 0, 'int', 0, 'int', 0) ;Wait for the remote thread to finish DllCall('kernel32.dll', 'int', 'WaitForSingleObject', 'int', $hRemoteThread[0], 'int', 0xFFFFFFFF) ;Close the handle to the previously created remote thread DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $hRemoteThread[0]) ;Free the previously allocated memory DllCall('kernel32.dll', 'ptr', 'VirtualFreeEx', 'hwnd', $processHandle, 'int', $functionAddress[0], 'int', 0, 'int', 0x8000) EndFunc Edited June 26, 2021 by jasty Link to comment Share on other sites More sharing options...
Developers Jos Posted June 26, 2021 Developers Share Posted June 26, 2021 Great, but that does make it any clearer as info is far from compete. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
JockoDundee Posted June 27, 2021 Share Posted June 27, 2021 4 hours ago, jasty said: Must be some big delay in spinning up the remote thread? Do we get to know how big the delay is besides “bizarrely slow” ? If it’s more than an hour, then I’m interested Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
jasty Posted June 27, 2021 Author Share Posted June 27, 2021 Like 1 second as opposed to milliseconds. Link to comment Share on other sites More sharing options...
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