Windows: with --windows-gui, startup errors are not shown and the exit status becomes 0xc0000001 #1127
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Zurisen on 2026-10-07T13:16:22Z.
On main (
501f1fe0), an executable relinked with--windows --windows-guithat fails at startup shows nothing and exits with0xc0000001. The same failure in a console-subsystem executable prints the error and exits with the matching status. Not specific to one title.Measured
Windows 11 (10.0.26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release build. The fixtures are the
missing-symbolandmissing-dependencycases oftest_windows_import_modules.py, launched through ShellExecute (Start-Process) as Explorer does, without redirected handles:FAIL: unresolved ELF import absent from a.prx...0xc00001390xc0000001Failed to load module: ...\libs\missing.prx...0xc00001350xc0000001With stderr redirected (
subprocess.run(..., capture_output=True)), the GUI executables write the same text as the console ones and exit with0xc0000139and0xc0000135.Mechanism
GetStdHandle(STD_ERROR_HANDLE)returnsNULL.writeStringin the entry stub (WindowsEntryStubBuilder.cpp) passes theGetStdHandleresult torequireDiagnosticSuccess, which raises0xc0000001onNULL. The diagnostic is not written and the status of the original failure is replaced.Reportin CrashReport.cpp writes to the same handle and ignores the result, and an uncaughtstd::runtime_erroris printed by the libstdc++ terminate handler to stderr. In a GUI-subsystem process launched from Explorer both are lost. Read from the code; not reproduced, as it needs a fixture that loads the system libraries.Reproduce
From the repository root after building with
-DBUILD_TESTING=ON:Prints
c0000001; no window or message appears. Double-clickinggui.exegives the same.Question
Where should fatal diagnostics go when there is no stderr? Options:
MessageBoxA, user32) with the diagnostic text, written by the entry stub and byReport/the terminate handler when the standard error handle isNULL.1 and 2 need the text to be collected before the process ends; 3 alone still shows nothing. Which one is wanted? I can implement it with a test that launches the GUI fixture without handles and checks the status (and the file, for 2).