Skip to content

Read a 32-bit process's command line from a 64-bit host - #798

Merged
SimonCropp merged 1 commit into
mainfrom
fix-wow64-command-line
Aug 22, 2026
Merged

Read a 32-bit process's command line from a 64-bit host#798
SimonCropp merged 1 commit into
mainfrom
fix-wow64-command-line

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

NtQueryInformationProcess with ProcessBasicInformation answers a 64-bit caller
with the 64-bit PEB, even when the target runs under WOW64. GetCommandLine then
handed that address to ReadCommandLine32, which reads it with 32-bit offsets and
gets nothing usable.

So no 32-bit diff tool ever had a command line - and that is most of them, since
%ProgramFiles(x86)% is where the resolver goes looking. The consequences are the
two things a command line is for: such a tool was never seen as already running,
so AutoRefresh opened a second window instead of reusing the first and every
relaunch spent another MaxInstance slot, and Kill never matched it, so it was
never closed.

Ask for the 32-bit PEB by name, through ProcessWow64Information. Also return
null rather than a misread when a 32-bit host looks at a 64-bit target, which is
the same confusion the other way round and equally unreadable.

The test starts SysWOW64\cmd.exe, shaped like a diff tool invocation so FindAll
keeps it, and looks for its command line. It fails without the fix.

NtQueryInformationProcess with ProcessBasicInformation answers a 64-bit caller
with the 64-bit PEB, even when the target runs under WOW64. GetCommandLine then
handed that address to ReadCommandLine32, which reads it with 32-bit offsets and
gets nothing usable.

So no 32-bit diff tool ever had a command line - and that is most of them, since
%ProgramFiles(x86)% is where the resolver goes looking. The consequences are the
two things a command line is for: such a tool was never seen as already running,
so AutoRefresh opened a second window instead of reusing the first and every
relaunch spent another MaxInstance slot, and Kill never matched it, so it was
never closed.

Ask for the 32-bit PEB by name, through ProcessWow64Information. Also return
null rather than a misread when a 32-bit host looks at a 64-bit target, which is
the same confusion the other way round and equally unreadable.

The test starts SysWOW64\cmd.exe, shaped like a diff tool invocation so FindAll
keeps it, and looks for its command line. It fails without the fix.
@SimonCropp SimonCropp added this to the 20.0.0 milestone Aug 22, 2026
@SimonCropp
SimonCropp merged commit 8218eeb into main Aug 22, 2026
10 checks passed
@SimonCropp
SimonCropp deleted the fix-wow64-command-line branch August 22, 2026 02:38
This was referenced Aug 26, 2026
This was referenced Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant