HEAP CORRUPTION DETECTED: after normal block... CRT detected that the application wrote to memory after end of heap buffer.
AutoHotkey64.exe!free_dbg_nolock(void * const block, const int block_use) Line 952 C++
AutoHotkey64.exe!_free_dbg(void * block, int block_use) Line 1030 C++
AutoHotkey64.exe!free(void * block) Line 32 C++
AutoHotkey64.exe!WindowSearch::~WindowSearch() Line 163 C++
AutoHotkey64.exe!WinGroup::IsMember(HWND__ * aWnd, ScriptThreadSettings & aSettings) Line 325 C++
AutoHotkey64.exe!WindowSearch::IsMatch(bool aInvert) Line 1613 C++
AutoHotkey64.exe!WinActive(global_struct & aSettings, const wchar_t * aTitle, const wchar_t * aText, const wchar_t * aExcludeTitle, const wchar_t * aExcludeText, bool aUpdateLastUsed) Line 467 C++
AutoHotkey64.exe!WinWait::__l28::<lambda>(void * pp) Line 269 C++
AutoHotkey64.exe!bool <lambda>(void *)::<lambda_invoker_cdecl>(void * pp) Line 276 C++
AutoHotkey64.exe!Wait(int aTimeout, void * aParam, bool(*)(void *) aWaitCompleted) Line 33 C++
AutoHotkey64.exe!WinWait(ExprTokenType * aWinTitle, optl<wchar_t const *> aWinText, optl<double> aTimeout, optl<wchar_t const *> aExcludeTitle, optl<wchar_t const *> aExcludeText, unsigned int & aRetVal, BuiltInFunctionID aCondition) Line 280 C++
AutoHotkey64.exe!WinWaitActive(ExprTokenType * aWinTitle, optl<wchar_t const *> aWinText, optl<double> aTimeout, optl<wchar_t const *> aExcludeTitle, optl<wchar_t const *> aExcludeText, unsigned int & aRetVal) Line 306 C++
I have reduced my script to the following much shorter one to try and isolate the error. It seems that if the GroupAdd WinTitle is too complex or contains too many spaces this may trigger the exit because if I exclude some of these lines it seems to run OK.
Since the source code seems to have been recently changed in windows.h, WinGroup.cpp & Window.cpp I wonder if this may have somehow caused the change? or maybe I have to simplify my code somewhat. The code is used to facilitate "Snap to default button" for dialogs which don't natively support this feature of windows.
Code: Select all
#Requires AutoHotkey v2.0-a
#Warn VarUnset ;, OutputDebug
#Warn LocalSameAsGlobal ;, OutputDebug
#Warn Unreachable ;, OutputDebug
Persistent( True )
ListLines( True )
CoordMode "ToolTip", "Screen"
ToolTip "AutoHotkey v" A_AHKVersion, A_ScreenWidth - 250, SysGet(4)
GroupAdd "gWinWaitA", "Help ahk_class #32770",, "HTML" ; No topics found Dialog default snaps to Static control ID=0xFFFF, OK Button ID=2
GroupAdd "gWinWaitA", "Microsoft Office Publisher ahk_class #32770"
GroupAdd "gWinWaitA", "Microsoft Visual Basic ahk_class #32770"
GroupAdd "gWinWaitA", "Microsoft Word ahk_class NUIDialog"
GroupAdd "gWinWaitA", "References - ahk_class #32770" ; VB6 References Dialog
GroupAdd "gWinWaitA", "Access Denied ahk_class #32770" ; UAC prompt
GroupAdd "gWinWaitA", "Customise Toolbar ahk_class #32770" ; Customize (en-US)
GroupAdd "gWinWaitA", "Extract Compressed (Zipped) Folders ahk_class NativeHWNDHost"
GroupAdd "gWinWaitA", "Select User or Group ahk_class #32770" ; Security Dialog
GroupAdd "gWinWaitA", "Shortcut ahk_class #32770" ; Create Shortcut Save to Desktop
GroupAdd "gWinWaitA", "Properties ahk_class #32770 ahk_exe explorer.exe"
GroupAdd "gWinWaitA", "Properties ahk_class #32770 ahk_exe locate32.exe"
GroupAdd "gWinWaitA", "Properties ahk_class #32770 ahk_exe xplorer2_UWP.exe"
GroupAdd "gWinWaitA", "Properties ahk_class #32770 ahk_exe xplorer2_64.exe"
GroupAdd "gWinWaitA", "Remove Device ahk_class #32770" ; Devices and Printers Dialog
GroupAdd "gWinWaitA", "Windows Security ahk_class #32770" ; info when changing file ownership
GroupAdd "gWinWaitA", "Replace or Skip Files ahk_class OperationStatusWindow" ; File copy warning
GroupAdd "gWinWaitA", "Process Monitor Highlighting ahk_class #32770" ; Process Monitor Dialog
GroupAdd "gWinWaitA", "Please Confirm ahk_class #32770"
GroupAdd "gWinWaitA", "VideoPad Free Version ahk_class #32770"
GroupAdd "gWinWaitA", "VideoPad Video Editor ahk_class #32770"
SetTimer f_WinWaitA, -500, -1
f_WinWaitA() { ; used 1x
hWnd := WinWaitActive("ahk_group gWinWaitA",, 10, " ·") ; sets LastFound Window, " ·"   · OR + excludes some windows already detected
if !hWnd
Goto l_reset
MsgBox "gWinWait window found"
l_reset:
SetTimer f_WinWaitA, -500, -1 ; Restart thread after small wait for next instance of a Dialog
}