H2W 383 Error

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
arcticir
Posts: 564
Joined: 17 Nov 2013, 11:32

H2W 383 Error

26 Mar 2019, 01:27

Error tip:Unable to create new stack protection page

Sorry, I can't provide the detailed code.
When I cancel all DLL threads, the error disappears.
AutoHotke.exe - 系统错误
---------------------------
无法创建新的堆栈防护页面
HotKeyIt
Posts: 1850
Joined: 29 Sep 2013, 18:35
Contact:

Re: H2W 383 Error

26 Mar 2019, 16:28

Looks like the stack is full, how many threads are running and what could they be doing that stack gets full?
arcticir
Posts: 564
Joined: 17 Nov 2013, 11:32

Re: H2W 383 Error

26 Mar 2019, 17:52

I don't think the problem lies in the " stack". I Once created hundreds of DLL threads and kept them normal. Now, I only use 18 threads.

When I tested these threads one by one, it showed a new error:
The wrong place is Similar this:

Code: Select all

f:=ahkdll()
t:=f.add
t["MsgBox",0] ;<===There is a mistake here.
However, I guarantee that these codes are correct.
HotKeyIt
Posts: 1850
Joined: 29 Sep 2013, 18:35
Contact:

Re: H2W 383 Error

26 Mar 2019, 19:57

Can't reproduce, this works fine:

Code: Select all

f:=AhkThread()
t:=f.addScript
t["MsgBox",0]
arcticir
Posts: 564
Joined: 17 Nov 2013, 11:32

Re: H2W 383 Error

26 Mar 2019, 20:39

I attached that code, not that it has a problem. I have stated that I guarantee that it is normal, because I have been using it in the old version. ;)

Code: Select all

f:=ahkdll()
f.new("#Persistent")
t:=f.add
MsgBox t["MsgBox",1]
ahkdll(){
	static dll:=fileread(a_ahkdir "\AutoHotkey.dll","RAW")
	return CriticalObject({"":r:=MemoryLoadLibrary(&dll)
		,"func":DynaCall(MemoryGetProcAddress(r,"ahkFunction"),"s==sssssssssss")
		,"post":DynaCall(MemoryGetProcAddress(r,"ahkPostFunction"),"i==sssssssssss")
		,"new":DynaCall(MemoryGetProcAddress(r,"ahktextdll"),"ut==sss")
		,"add":DynaCall(MemoryGetProcAddress(r,"addScript"),"ut==si")
		,"exec":DynaCall(MemoryGetProcAddress(r,"ahkExec"),"ut==sui")
		,"get":DynaCall(MemoryGetProcAddress(r,"ahkgetvar"),"s==sui")
		,"set":DynaCall(MemoryGetProcAddress(r,"ahkassign"),"ui==ss")
		,"sub":DynaCall(MemoryGetProcAddress(r,"ahkLabel"),"ui==sui")
		,"pause":DynaCall(MemoryGetProcAddress(r,"ahkPause"),"i==s")
		,"exit":DynaCall(MemoryGetProcAddress(r,"ahkTerminate"),"i==i")
		,"ready":DynaCall(MemoryGetProcAddress(r,"ahkReady"),"")
		,"reload":DynaCall(MemoryGetProcAddress(r,"ahkReload"),"i==i")})
}
HotKeyIt
Posts: 1850
Joined: 29 Sep 2013, 18:35
Contact:

Re: H2W 383 Error

27 Mar 2019, 15:08

Still no problem here! What OS and which version do you have?
arcticir
Posts: 564
Joined: 17 Nov 2013, 11:32

Re: H2W 383 Error

27 Mar 2019, 16:50

The version I am using is:
h2-32 2.0-a100-H007
os: win 10 64

I'm afraid it's hard for me to find out the real reason. My script is very bloated and has many threads. A large number of CriticalObject objects are used between threads.
arcticir
Posts: 564
Joined: 17 Nov 2013, 11:32

Re: H2W 383 Error

28 Mar 2019, 04:13

What I am reporting is exactly the mistake in the latest version (github-383).
The version I am using -2.0-a100-H007 is the normal version. :shock:
HotKeyIt
Posts: 1850
Joined: 29 Sep 2013, 18:35
Contact:

Re: H2W 383 Error

28 Mar 2019, 16:48

So does the code above cause an error in latest version for you?
It seems to work fine for me, also debugger does not report any problem? (same os and ahk)
arcticir
Posts: 564
Joined: 17 Nov 2013, 11:32

Re: H2W 383 Error

28 Mar 2019, 18:36

No, in the new version, the example is also normal. However, when the code is used in more complex scenarios, it will prompt for errors.
For example, your AHK error prompt is: " MsgBox 1+2"
And you are obviously 100% sure your code is correct.

I don't know how to use the debugger, and debugging DLL threads seems very complicated, you know.
HotKeyIt
Posts: 1850
Joined: 29 Sep 2013, 18:35
Contact:

Re: H2W 383 Error

28 Mar 2019, 20:04

You have to create debug dll and debug exe in Visual Studio, then every time you load ahkdll you have to copy to new dll and load it, then you will see where error is happening
For example (use correct path for dll):

Code: Select all

ahkdll(){
	ver:=A_TickCount,init:=FileCopy(a_ahkdir "\AutoHotkey.dll",a_ahkdir "\AutoHotkey" ver ".dll"),dll:=fileread(a_ahkdir "\AutoHotkey" ver ".dll","RAW")
	return CriticalObject({"":r:=MemoryLoadLibrary(&dll)
		,"func":DynaCall(MemoryGetProcAddress(r,"ahkFunction"),"s==sssssssssss")
		,"post":DynaCall(MemoryGetProcAddress(r,"ahkPostFunction"),"i==sssssssssss")
		,"new":DynaCall(MemoryGetProcAddress(r,"ahktextdll"),"ut==sss")
		,"add":DynaCall(MemoryGetProcAddress(r,"addScript"),"ut==si")
		,"exec":DynaCall(MemoryGetProcAddress(r,"ahkExec"),"ut==sui")
		,"get":DynaCall(MemoryGetProcAddress(r,"ahkgetvar"),"s==sui")
		,"set":DynaCall(MemoryGetProcAddress(r,"ahkassign"),"ui==ss")
		,"sub":DynaCall(MemoryGetProcAddress(r,"ahkLabel"),"ui==sui")
		,"pause":DynaCall(MemoryGetProcAddress(r,"ahkPause"),"i==s")
		,"exit":DynaCall(MemoryGetProcAddress(r,"ahkTerminate"),"i==i")
		,"ready":DynaCall(MemoryGetProcAddress(r,"ahkReady"),"")
		,"reload":DynaCall(MemoryGetProcAddress(r,"ahkReload"),"i==i")})
}

Return to “AutoHotkey_H”

Who is online

Users browsing this forum: No registered users and 6 guests