upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/shims/process.cpp
diff options
context:
space:
mode:
authorpwu2775-dev <267844174+pwu2775-dev@users.noreply.github.com>2026-11-23 00:10:18 +0800
committerpwu2775-dev <267844174+pwu2775-dev@users.noreply.github.com>2026-11-23 00:10:18 +0800
commit21ea2bb1d01f9d0ac648a0694740eea9c1aad7d0 (patch)
treef202ce9d4d20ff460a0b5751cb4cd56c84084c3b /runtime/shims/process.cpp
parent2e6b237729049f121b5441ac45526c2c3a8663d1 (diff)
runtime: RT-136 review follow-up: check the test's setup, say what the returned table is valid for
process_cmdline_test now checks the return values of _putenv_s/_wputenv_s and says when _wenviron already exists at startup, so the first-call check cannot pass silently without exercising the lazy wide-table creation. process.cpp notes that the returned table is the CRT's own and valid until the next _putenv, as with the msvcrt.dll original.
Diffstat (limited to 'runtime/shims/process.cpp')
-rw-r--r--runtime/shims/process.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/runtime/shims/process.cpp b/runtime/shims/process.cpp
index 6673d4bb1..9da50e4e9 100644
--- a/runtime/shims/process.cpp
+++ b/runtime/shims/process.cpp
@@ -133,6 +133,9 @@ wchar_t* __cdecl game_get_wide_winmain_command_line() { return after_program_nam
133// none until then), and _putenv/_wputenv reallocate both, so a pointer taken in set_command_line would be null or 133// none until then), and _putenv/_wputenv reallocate both, so a pointer taken in set_command_line would be null or
134// dangling by the time a wide-character startup calls __wgetmainargs. A lookup of a name no one sets makes the CRT 134// dangling by the time a wide-character startup calls __wgetmainargs. A lookup of a name no one sets makes the CRT
135// create the table if it does not exist yet (from the other table or the OS block) without changing it. 135// create the table if it does not exist yet (from the other table or the OS block) without changing it.
136// Like the msvcrt.dll original, the returned table is the CRT's own and is only valid until the next _putenv: a CRT
137// startup reads it once, before the game has other threads, and a host that edits its environment concurrently with
138// a game's startup is not covered.
136char** current_environment() { 139char** current_environment() {
137 if (!_environ) { 140 if (!_environ) {
138 size_t size = 0; 141 size_t size = 0;