upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/process_cmdline_test.cpp
diff options
context:
space:
mode:
authordracbat <dracbat@users.noreply.github.com>2026-11-22 14:08:55 +0000
committerdracbat <dracbat@users.noreply.github.com>2026-11-22 14:08:55 +0000
commit7f67a9aef06277802227ea2d1807f1b55471e387 (patch)
tree65e74675ba6e9e4b06de441a2edf6659a8827ee7 /runtime/test/process_cmdline_test.cpp
parent6684d836ff16aba0d8d570e6fe4ccd9ae04e02a1 (diff)
process_cmdline_test: report a missing WinMain shim instead of calling it
Without the shim, find() returns null and the WinMain check called it, ending the test with an access violation instead of a failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/process_cmdline_test.cpp')
-rw-r--r--runtime/test/process_cmdline_test.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/runtime/test/process_cmdline_test.cpp b/runtime/test/process_cmdline_test.cpp
index 5ab85e359..8f35a8ef7 100644
--- a/runtime/test/process_cmdline_test.cpp
+++ b/runtime/test/process_cmdline_test.cpp
@@ -93,9 +93,11 @@ void check_winmain(const std::wstring& program, const std::vector<std::wstring>&
93 using Wide = wchar_t*(__cdecl*)(); 93 using Wide = wchar_t*(__cdecl*)();
94 using Narrow = char*(__cdecl*)(); 94 using Narrow = char*(__cdecl*)();
95 for (const char* dll : {"api-ms-win-crt-runtime-l1-1-0.dll", "ucrtbase.dll"}) { 95 for (const char* dll : {"api-ms-win-crt-runtime-l1-1-0.dll", "ucrtbase.dll"}) {
96 const wchar_t* wide = 96 const auto wide_fn = reinterpret_cast<Wide>(rt::shims::find(dll, "_get_wide_winmain_command_line"));
97 reinterpret_cast<Wide>(rt::shims::find(dll, "_get_wide_winmain_command_line"))(); 97 const auto narrow_fn = reinterpret_cast<Narrow>(rt::shims::find(dll, "_get_narrow_winmain_command_line"));
98 const char* line = reinterpret_cast<Narrow>(rt::shims::find(dll, "_get_narrow_winmain_command_line"))(); 98 if (!wide_fn || !narrow_fn) continue; // check_import_names has reported the missing shim
99 const wchar_t* wide = wide_fn();
100 const char* line = narrow_fn();
99 char expected[256] = {}; 101 char expected[256] = {};
100 WideCharToMultiByte(CP_ACP, 0, want, -1, expected, sizeof(expected), nullptr, nullptr); 102 WideCharToMultiByte(CP_ACP, 0, want, -1, expected, sizeof(expected), nullptr, nullptr);
101 if (!wide || std::wcscmp(wide, want) != 0) { 103 if (!wide || std::wcscmp(wide, want) != 0) {