diff --git a/library/std/src/sys/pal/windows/c.rs b/library/std/src/sys/pal/windows/c.rs index 950af18b730df..1933042fe79c3 100644 --- a/library/std/src/sys/pal/windows/c.rs +++ b/library/std/src/sys/pal/windows/c.rs @@ -649,3 +649,19 @@ compat_fn_with_fallback! { TRUE } } + +#[cfg(target_vendor = "rust9x")] +compat_fn_with_fallback! { + pub static KERNEL32: &CStr = c"kernel32" => { load: false, unicows: false }; + // >= Vista / Server 2008 + // https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-comparestringordinal + pub fn CompareStringOrdinal( + lpstring1: PCWSTR, + cchcount1: i32, + lpstring2: PCWSTR, + cchcount2: i32, + bignorecase: BOOL, + ) -> COMPARESTRING_RESULT { + unimplemented!() + } +} diff --git a/library/std/src/sys/pal/windows/process.rs b/library/std/src/sys/pal/windows/process.rs index 5e420f56c2648..3202a3c6c2c08 100644 --- a/library/std/src/sys/pal/windows/process.rs +++ b/library/std/src/sys/pal/windows/process.rs @@ -69,6 +69,13 @@ impl EnvKey { // [4] https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-comparestringordinal impl Ord for EnvKey { fn cmp(&self, other: &Self) -> cmp::Ordering { + #[cfg(target_vendor = "rust9x")] + { + if c::CompareStringOrdinal::available().is_none() { + return self.os_string.cmp(&other.os_string); + } + } + unsafe { let result = c::CompareStringOrdinal( self.utf16.as_ptr(), @@ -120,6 +127,15 @@ impl PartialEq for EnvKey { // they are compared using a caseless string mapping. impl From for EnvKey { fn from(k: OsString) -> Self { + #[cfg(target_vendor = "rust9x")] + { + if c::CompareStringOrdinal::available().is_none() { + let mut k = k; + k.make_ascii_uppercase(); + return EnvKey { utf16: Vec::new(), os_string: k }; + } + } + EnvKey { utf16: k.encode_wide().collect(), os_string: k } } }