File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
library/std/src/sys/pal/windows Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -648,3 +648,19 @@ compat_fn_with_fallback! {
648648 TRUE
649649 }
650650}
651+
652+ #[ cfg( target_vendor = "rust9x" ) ]
653+ compat_fn_with_fallback ! {
654+ pub static KERNEL32 : & CStr = c"kernel32" => { load: false , unicows: false } ;
655+ // >= Vista / Server 2008
656+ // https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-comparestringordinal
657+ pub fn CompareStringOrdinal (
658+ lpstring1: PCWSTR ,
659+ cchcount1: i32 ,
660+ lpstring2: PCWSTR ,
661+ cchcount2: i32 ,
662+ bignorecase: BOOL ,
663+ ) -> COMPARESTRING_RESULT {
664+ rtabort!( "unimplemented" )
665+ }
666+ }
Original file line number Diff line number Diff line change @@ -69,6 +69,13 @@ impl EnvKey {
6969// [4] https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-comparestringordinal
7070impl Ord for EnvKey {
7171 fn cmp ( & self , other : & Self ) -> cmp:: Ordering {
72+ #[ cfg( target_vendor = "rust9x" ) ]
73+ {
74+ if c:: CompareStringOrdinal :: available ( ) . is_none ( ) {
75+ return self . os_string . cmp ( & other. os_string ) ;
76+ }
77+ }
78+
7279 unsafe {
7380 let result = c:: CompareStringOrdinal (
7481 self . utf16 . as_ptr ( ) ,
@@ -120,6 +127,15 @@ impl PartialEq<str> for EnvKey {
120127// they are compared using a caseless string mapping.
121128impl From < OsString > for EnvKey {
122129 fn from ( k : OsString ) -> Self {
130+ #[ cfg( target_vendor = "rust9x" ) ]
131+ {
132+ if c:: CompareStringOrdinal :: available ( ) . is_none ( ) {
133+ let mut k = k;
134+ k. make_ascii_uppercase ( ) ;
135+ return EnvKey { utf16 : Vec :: new ( ) , os_string : k } ;
136+ }
137+ }
138+
123139 EnvKey { utf16 : k. encode_wide ( ) . collect ( ) , os_string : k }
124140 }
125141}
You can’t perform that action at this time.
0 commit comments