Skip to content

Commit c69bdd3

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 5bd4988 commit c69bdd3

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,3 +625,14 @@ compat_fn_with_fallback! {
625625
unimplemented!()
626626
}
627627
}
628+
629+
#[cfg(target_vendor = "rust9x")]
630+
compat_fn_with_fallback! {
631+
pub static KERNEL32: &CStr = c"kernel32" => { load: false, unicows: false };
632+
// >= NT 3.5+, 95+
633+
// https://learn.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-freeenvironmentstringsw
634+
pub fn FreeEnvironmentStringsW(penv: PCWSTR) -> BOOL {
635+
// just leak it on NT 3.1
636+
TRUE
637+
}
638+
}

0 commit comments

Comments
 (0)