Skip to content

Commit 99db2ce

Browse files
committed
Stub FreeEnvironmentStringsW to just leak on NT 3.1
Yup, this function just doesn't exist on NT 3.1, so `env::vars`/`env::vars_os` will just leak the OS-allocated buffer.
1 parent e7dca8e commit 99db2ce

File tree

1 file changed

+11
-0
lines changed
  • library/std/src/sys/pal/windows

1 file changed

+11
-0
lines changed

library/std/src/sys/pal/windows/c.rs

+11
Original file line numberDiff line numberDiff line change
@@ -638,3 +638,14 @@ compat_fn_with_fallback! {
638638
unimplemented!()
639639
}
640640
}
641+
642+
#[cfg(target_vendor = "rust9x")]
643+
compat_fn_with_fallback! {
644+
pub static KERNEL32: &CStr = c"kernel32" => { load: false, unicows: false };
645+
// >= NT 3.5+, 95+
646+
// https://learn.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-freeenvironmentstringsw
647+
pub fn FreeEnvironmentStringsW(penv: PCWSTR) -> BOOL {
648+
// just leak it on NT 3.1
649+
TRUE
650+
}
651+
}

0 commit comments

Comments
 (0)