diff options
| author | totonii <totonicontato@gmail.com> | 2026-11-22 15:34:07 -0300 |
|---|---|---|
| committer | totonii <totonicontato@gmail.com> | 2026-11-22 15:34:07 -0300 |
| commit | 8d9a50759aecdca281d5ff438b30d385e619c77c (patch) | |
| tree | 8de3f090500e4ca8cc50a532a92b5d0efd10d509 /runtime/test/process_cmdline_test.cpp | |
| parent | ec8ec4c9a46c6623f1a9c125afd3566da97f1e0c (diff) | |
fix(process): close g_done race, guard CreateEventW, and preserve ExitThread code in run_entry
Diffstat (limited to 'runtime/test/process_cmdline_test.cpp')
| -rw-r--r-- | runtime/test/process_cmdline_test.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/test/process_cmdline_test.cpp b/runtime/test/process_cmdline_test.cpp index 01f1b38a5..79aeed11b 100644 --- a/runtime/test/process_cmdline_test.cpp +++ b/runtime/test/process_cmdline_test.cpp | |||
| @@ -193,6 +193,17 @@ int main() { | |||
| 193 | // A byte above 0x7f in the narrow program name is part of the name, not the end of it. | 193 | // A byte above 0x7f in the narrow program name is part of the name, not the end of it. |
| 194 | check_winmain(L"caf\u00e9.exe", {L"-x"}, L"-x", "a non-ASCII program name"); | 194 | check_winmain(L"caf\u00e9.exe", {L"-x"}, L"-x", "a non-ASCII program name"); |
| 195 | 195 | ||
| 196 | // If the entry thread exits via ExitThread() without going through end_run(), run_entry() must preserve its exit | ||
| 197 | // code (and claim g_exited before closing g_done). | ||
| 198 | { | ||
| 199 | auto exit_thread_entry = +[](void*) -> DWORD { ExitThread(42); }; | ||
| 200 | const int code = rt::process::run_entry(reinterpret_cast<void*>(exit_thread_entry), 0); | ||
| 201 | if (code != 42) { | ||
| 202 | std::fprintf(stderr, "FAIL run_entry with ExitThread(42) returned %d, want 42\n", code); | ||
| 203 | ++failures; | ||
| 204 | } | ||
| 205 | } | ||
| 206 | |||
| 196 | if (failures) return 1; | 207 | if (failures) return 1; |
| 197 | std::printf("process_cmdline: GetCommandLineW parses back to __wargv, non-ASCII arguments intact (code page %u); " | 208 | std::printf("process_cmdline: GetCommandLineW parses back to __wargv, non-ASCII arguments intact (code page %u); " |
| 198 | "the WinMain line and the kernelbase/API-set names are the game's\n", | 209 | "the WinMain line and the kernelbase/API-set names are the game's\n", |