Page 1 of 2
Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 10 Apr 2020, 21:05
by kyuuuri
Hello, 2 of my users have a problem with my script. I narrowed it down to "AhkThread". I gave them a simple script:
Code: Select all
#persistent
test := ahkThread("#persistent`nmsgbox test")
Compiled with /MD, version 1.1.32.0, no password used, no changes to source code, using .bin.
I also shared them my vcruntime140.dll
Nothing happens, the script is active with around 9% CPU usage like if it was stuck.
Both users have:
Edition: Windows 10 Home
Version: 1903
OS Build: 18362.720
That's the only "common" thing both users had.
I checked their updates, both fully updated except for the version change 1909.
I checked if they have VS c++ redist, both have the exact same version I have in mine, from 2005 to 2015-2019.
Is there any missing dependency there? I also tried manually adding the includes from ahk's folder, works on my pc, but doesn't work on theirs.
My laptop has Windows 10 Home, version 1909 and it works without any problems.
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 10 Apr 2020, 21:40
by kyuuuri
1 of my users updated to:
Edition: Windows 10 Home
Version: 1909
OS Build: 18363.752
and still has the same problem.
I checked these:
- VS Redist 2015.
- Fully updated windows
- vcruntime140.dll
Am I missing something I should check?
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 10 Apr 2020, 21:58
by kyuuuri
Tested the following script:
Code: Select all
#persistent
test := ahkThread("#persistent`nmsgbox test")
msgbox % A_AhkVersion
Compiled with:
- v1.1.32.0 AutoHotkeySC.bin \win32w
- v1.1.32.0 AutoHotkeySC.bin \win32w_MT
- v1.1.32.0 AutoHotkeySC.bin \win64w
- v1.1.32.0 AutoHotkeySC.bin \win64w_MT
Results:
- The script is opened, using administrator or by simply double clicking it.
- No msgbox is shown, as soon as it reaches the line "ahkThread" it gets stuck.
- On x64 the process is still shown on Task Manager with around 10% CPU usage but nothing happens. On x32 the process crashes.
Systems used:
Edition: Windows 10 Home
Version: 1903
OS Build: 18362.720
Edition: Windows 10 Home
Version: 1909
OS Build: 18363.752
Both with all updates installed and VS c++ redist 2015 installed.
Tried both with my vcruntime140.dll and without it, same results
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 11 Apr 2020, 04:59
by HotKeyIt
It seems to be waiting for thread to start, can you test using LoadLibrary dll and DllCall(...\ahktextdll?
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 11 Apr 2020, 20:06
by kyuuuri
HotKeyIt wrote: ↑11 Apr 2020, 04:59
It seems to be waiting for thread to start, can you test using LoadLibrary dll and DllCall(...\ahktextdll?
Hello, I tried with this code
Code: Select all
#persistent
test := ahkThread()
dllpath:=A_AhkDir "\AutoHotkey.dll"
DllCall(dllpath "\ahktextdll", "Str","MsgBox test!", "Str","","CDecl")
msgbox % A_AhkVersion
Sent them following files (All on the same folder as the .exe)
Compiled script with name "test.exe"
x64w_MD "AutoHotkey.dll"
"vcruntime140.dll"
Nothing happened, no msgbox was shown.
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 12 Apr 2020, 03:54
by HotKeyIt
Try this script:
Code: Select all
#persistent
dllpath:=A_AhkDir "\AutoHotkey.dll"
DllCall("LoadLibrary","Str",dllpath)
DllCall(dllpath "\ahktextdll", "Str","MsgBox test!", "Str","","CDecl")
msgbox % A_AhkVersion
Also, is this problem only when compiled? Try without compiling, simply send non-compiled AutoHotkey.exe including same files + AutoHotkey.ahk with above script.
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 12 Apr 2020, 19:38
by kyuuuri
HotKeyIt wrote: ↑12 Apr 2020, 03:54
Try this script:
Code: Select all
#persistent
dllpath:=A_AhkDir "\AutoHotkey.dll"
DllCall("LoadLibrary","Str",dllpath)
DllCall(dllpath "\ahktextdll", "Str","MsgBox test!", "Str","","CDecl")
msgbox % A_AhkVersion
Also, is this problem only when compiled? Try without compiling, simply send non-compiled AutoHotkey.exe including same files + AutoHotkey.ahk with above script.
I followed your exact instructions.
The compiled .exe only shows the
msgbox % A_AhkVersion, so the
ahkThread or
ahktextdll doesn't work.
The non compiled version (shared my AutoHotkey.exe located on ahk's folder) works perfectly.
Seems like there is a problem when trying to load the dll from within the exe?
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 13 Apr 2020, 03:42
by HotKeyIt
What do you see here when compiled:
Code: Select all
#persistent
dllpath:=A_AhkDir "\AutoHotkey.dll"
MsgBox % DllCall("LoadLibrary","Str",dllpath)
MsgBox % DllCall(dllpath "\ahktextdll", "Str","MsgBox test!", "Str","","CDecl")
msgbox % A_AhkVersion
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 13 Apr 2020, 20:25
by kyuuuri
HotKeyIt wrote: ↑13 Apr 2020, 03:42
What do you see here when compiled:
Code: Select all
#persistent
dllpath:=A_AhkDir "\AutoHotkey.dll"
MsgBox % DllCall("LoadLibrary","Str",dllpath)
MsgBox % DllCall(dllpath "\ahktextdll", "Str","MsgBox test!", "Str","","CDecl")
msgbox % A_AhkVersion
MsgBox % DllCall("LoadLibrary","Str",dllpath): 0
MsgBox % DllCall(dllpath "\ahktextdll", "Str","MsgBox test!", "Str","","CDecl"): a blank msgbox
msgbox % A_AhkVersion: 1.1.32.00
The msgbox inside
ahktextdll is never shown.
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 13 Apr 2020, 20:55
by guest3456
kyuuuri wrote: ↑13 Apr 2020, 20:25
MsgBox % DllCall("LoadLibrary","Str",dllpath): 0
you sure you have the AutoHotkey.dll file in the right directory?
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 13 Apr 2020, 22:46
by kyuuuri
guest3456 wrote: ↑13 Apr 2020, 20:55
kyuuuri wrote: ↑13 Apr 2020, 20:25
MsgBox % DllCall("LoadLibrary","Str",dllpath): 0
you sure you have the AutoHotkey.dll file in the right directory?
Yes, 100% sure. I even asked the user to send me an screenshot
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 14 Apr 2020, 02:48
by HotKeyIt
Probably mixture of 32 and 64-bit, the dll seems to be 64-bit but does not equal the current release size. The largest dll in release is x64w = 1216 KB.
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 14 Apr 2020, 03:19
by kyuuuri
HotKeyIt wrote: ↑14 Apr 2020, 02:48
Probably mixture of 32 and 64-bit, the dll seems to be 64-bit but does not equal the current release size. The largest dll in release is x64w = 1216 KB.
If that's the case then there is something wrong with source compilación or on the pack script because I took that DLL from x64w folder and I compiled with the .bin that was on the same folder.
Also it works on all the other users (more than 90)
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 20 Apr 2020, 07:06
by kyuuuri
HotKeyIt wrote: ↑14 Apr 2020, 02:48
Probably mixture of 32 and 64-bit, the dll seems to be 64-bit but does not equal the current release size. The largest dll in release is x64w = 1216 KB.
Hello, could you find anything about this? I double checked and it's x64 bit .dll, I compiled it myself and also tried the one from
https://github.com/HotKeyIt/ahkdll-v1-release, but none worked.
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 27 Apr 2020, 18:29
by kyuuuri
Tried more things, but still it will freeze the script when launching a new thread
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 27 Apr 2020, 18:52
by kyuuuri
New user with the same problem.
Windows 10 Home
Version: 1903
Build: 18362.778
I asked him to send me a list of his updates:
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 27 Apr 2020, 18:55
by kyuuuri
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 27 Apr 2020, 19:20
by kyuuuri
@HotKeyIt Seems like I found out how to reproduce the problem.
1. Download ahkdll-v1-release-master from:
https://github.com/HotKeyIt/ahkdll-v1-release and extract on desktop
2. Create a folder called "New Folder" on Desktop.
3. Inside the folder create an script called "test.ahk"
4. Inside this script paste:
Code: Select all
#persistent
dllpath:=A_AhkDir "\AutoHotkey.dll"
MsgBox % DllCall("LoadLibrary","Str",dllpath)
MsgBox % DllCall(dllpath "\ahktextdll", "Str","MsgBox test!", "Str","","CDecl")
msgbox % A_AhkVersion
5. Open ahk2exe.ahk from the folder you just downloaded and compile test.ahk to test.exe without checking any checkbox.
6. Copy the .dll from the version you just used to "New Folder".
7. Open test.exe
Using .bin:
- Win32: Same problem
- Win32_MT: Same problem
- Win64: Works
- Win64_MT: Works
Using .exe (idk if this should be done but only for testing purposes):
- Win32: Works BUT you get ACCESS_VIOLATION, if you press "No" to keep it running you will get all the correct msgboxes. So it works but with ACCESS_VIOLATION after the first msgbox.
- Win32_MT: Works BUT you get ACCESS_VIOLATION, if you press "No" to keep it running you will get all the correct msgboxes. So it works but with ACCESS_VIOLATION after the first msgbox.
- Win64: Works
- Win64_MT: Works
If you use the x32 .dll with x64 .exe you get the same problem my users get.
If you use the x64 .dll with x32 .exe you get the same problem my users get.
But I'm sure this is not my problem because around 90% of my users can run it without any problems. The other 10% has this problem, they all downloaded from the same link.
@edit: I forgot to say, these are only tests I made on my computer. On the user computer the tests I made had no positive results. Really need help with this.
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 28 Apr 2020, 07:02
by kyuuuri
Could narrow the issue down to this line:
Code: Select all
obj:={(""):lib:=MemoryLoadLibrary(dll=""?&ahkdll:dll="FC2328B39C194A4788051A3B01B1E7D5"?&ahkmini:dll),base:base}
The last msgbox executed is "msgbox B", seems that there is a problem with MemoryLoadLibrary.
From:
Code: Select all
ahkthread_free(obj:=""){
static objects
if !objects
objects:=[]
if (obj="")
objects:=[]
else if !IsObject(obj)
return objects
else If objects.HasKey(obj)
objects.Remove(obj)
}
ahkthread_release(o){
o.ahkterminate(o.timeout?o.timeout:0),MemoryFreeLibrary(o[""])
}
ahkthread(s:="",p:="",IsFile:=0,dll:=""){
static ahkdll,ahkmini,base,functions
msgbox A
if !base
base:={__Delete:"ahkthread_release"},UnZipRawMemory(LockResource(LoadResource(0,hRes:=DllCall("FindResource","PTR",0,"Str","F903E44B8A904483A1732BA84EA6191F","PTR",10,"PTR"))),SizeofResource(0,hRes),ahkdll)
,UnZipRawMemory(LockResource(LoadResource(0,hRes:=DllCall("FindResource","PTR",0,"Str","FC2328B39C194A4788051A3B01B1E7D5","PTR",10,"PTR"))),SizeofResource(0,hRes),ahkmini)
,functions:={_ahkFunction:"s==stttttttttt",_ahkPostFunction:"i==stttttttttt",ahkFunction:"s==sssssssssss",ahkPostFunction:"i==sssssssssss",ahkdll:"ut==sss",ahktextdll:"ut==sss",ahkReady:"",ahkReload:"i==i",ahkTerminate:"i==i",addFile:"ut==sucuc",addScript:"ut==si",ahkExec:"ui==s",ahkassign:"ui==ss",ahkExecuteLine:"ut==utuiui",ahkFindFunc:"ut==s",ahkFindLabel:"ut==s",ahkgetvar:"s==sui",ahkLabel:"ui==sui",ahkPause:"i==s",ahkIsUnicode:""}
msgbox B
obj:={(""):lib:=MemoryLoadLibrary(dll=""?&ahkdll:dll="FC2328B39C194A4788051A3B01B1E7D5"?&ahkmini:dll),base:base}
msgbox C
for k,v in functions
obj[k]:=DynaCall(MemoryGetProcAddress(lib,A_Index>2?k:SubStr(k,2)),v)
msgbox D
If !(s+0!="" || s=0)
obj.hThread:=obj[IsFile?"ahkdll":"ahktextdll"](s,"",p)
msgbox E
ahkthread_free(true)[obj]:=1 ; keep dll loadded even if returned object is freed
msgbox F
return obj
}
Re: Ahk_h freezes when trying to launch a new Thread on w10 Home 1903
Posted: 28 Apr 2020, 18:04
by HotKeyIt
I have tested on my computer and even on a fresh Win 10 Home VM without installing anything and it works fine.
Please note that in the script above one parameter was missing: MsgBox % DllCall(dllpath "\ahktextdll", "Str","MsgBox test!", "Str","","Str","","CDecl")