Modify

#4085 new Bug

__GUICtrl_IsWow64Process($hWnd) issue

Reported by: Nine Owned by:
Milestone: Component: AutoIt
Version: 3.3.18.0 Severity: None
Keywords: Cc:

Description

If the $hWnd does not exist (because the window has not appeared yet for example), the function returns @autoitpid which can result in faulty (buggy) return.

I would suggest to return an error instead. So changing :

If Not $iPID Then $iPID = @AutoItPID

to :

If Not $iPID Then Return SetError(1)

would make the function more robust.

Attachments (0)

Change History (4)

comment:1 by Jpm, on Mar 30, 2026 at 5:41:50 PM

This is an internal function perhaps not the best naming
If you prouve That the other internal function GUICtrl_TagOutProcess() is not doing the job
I will do something
Cheers

Version 0, edited on Mar 30, 2026 at 5:41:50 PM by Jpm (next)

comment:2 by Nine, on Mar 30, 2026 at 10:52:06 PM

You are right. I shouldn't use that internal function. On the other hand, what is the use of that line ? None ! So instead of returning a valid id, it is returning a false PID. I truly believe that any (internal / external) functions should be self-secure. But that may be just me.

Anyway, just run that script and you will see what I mean :

#AutoIt3Wrapper_UseX64=n

#include <WinAPI.au3>
#include <GuiTab.au3>

_WinAPI_IsWow64Process

Local $sDir = GetAutoItPath()

If ProcessExists("Au3Info_x64.exe") Then ProcessClose("Au3Info_x64.exe")
Run($sDir & "Au3Info_x64.exe")
Local $hWnd = WinGetHandle("AutoIt v3 Window Info")
Local $sTab = _GUICtrlTab_GetItemText(ControlGetHandle($hWnd, "", "SysTabControl321"), 0)
ConsoleWrite("@error = " & @error & "  Tab 0 = {" & $sTab & "}" & @CRLF)

Func GetAutoItPath()
  Local $sAutoIt = RegRead("HKLM\SOFTWARE\" & (@AutoItX64 ? "\Wow6432Node" : "") & "\AutoIt v3\AutoIt", "InstallDir")
  If @error Then Return SetError(1)
  Return $sAutoIt & "\"
EndFunc   ;==>GetAutoItPath

comment:3 by anonymous, on Mar 30, 2026 at 11:02:00 PM

ps. forgot to remove _WinAPI_IsWow64Process line.

comment:4 by Jpm, on Mar 31, 2026 at 8:23:29 AM

I don't know what you want to prouve but your script miss

a WinWaitActive("AutoIt v3 Window Info", "")

Cheers

Modify Ticket

Action
as new The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.