https://bugs.winehq.org/show_bug.cgi?id=57660
Bug ID: 57660 Summary: PEB->ProcessParameters.ImagePathName also includes CommandLine string Product: Wine Version: 10.0-rc5 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll Assignee: wine-bugs@winehq.org Reporter: gritty.rain1970@geemili.xyz Distribution: ---
Created attachment 77828 --> https://bugs.winehq.org/attachment.cgi?id=77828 trace ImagePathName to show bug
PEB->ProcessParameters.ImagePathName somehow gets PEB->ProcessParameters.CommandLine appended to it. C programs that use null terminated strings can still use PEB->ProcessParameters.ImagePathName.Buffer without a problem, however the Zig programming language (which generally use a pointer + a length) will run into problems.
I added two `TRACE` messages that show the problem quite clearly:
``` 0024:trace:environ:build_initial_params params->ImagePathName L"Z:\home\geemili\code\zig\build\example-dump-stacktrace\main.exe\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000"... 0024:trace:environ:build_initial_params params->ImagePathName L"Z:\home\geemili\code\zig\build\example-dump-stacktrace\main.exe\0000"Z:\home\geemili\code\zig\build\example-dump-stacktrace\main.e" ```
The above output taken from the output of running `WINEDEBUG=+environ ./loader/wine64 ~/code/zig/build/example-dump-stacktrace/main.exe`.
Though I realized while I was writing this that the length of ImagePathName is too long even before the CommandLine string is copied over the zeroes.
Discovered while trying to figure out why Zig couldn't print StackTraces under wine.
- Related issue: https://github.com/ziglang/zig/issues/17535
https://bugs.winehq.org/show_bug.cgi?id=57660
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID
--- Comment #1 from Alexandre Julliard julliard@winehq.org --- UNICODE_STRING.Length is counting bytes, not characters. You need to divide by sizeof(WCHAR).
https://bugs.winehq.org/show_bug.cgi?id=57660
--- Comment #2 from gritty.rain1970@geemili.xyz --- Ah geez, that'll teach me to file late night bug reports. Sorry about that.
https://bugs.winehq.org/show_bug.cgi?id=57660
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #3 from Austin English austinenglish@gmail.com --- Closing.