File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
library/std/src/sys/windows Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -721,4 +721,5 @@ extern "system" {
721
721
722
722
pub fn GetTickCount ( ) -> DWORD ;
723
723
pub fn GetCurrentThreadId ( ) -> DWORD ;
724
+ pub fn GetVersion ( ) -> DWORD ;
724
725
}
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ use crate::ptr::NonNull;
24
24
use crate :: sync:: atomic:: Ordering ;
25
25
use crate :: sys:: c;
26
26
27
+ pub ( crate ) mod version;
28
+
27
29
// This uses a static initializer to preload some imported functions.
28
30
// The CRT (C runtime) executes static initializers before `main`
29
31
// is called (for binaries) and before `DllMain` is called (for DLLs).
@@ -65,6 +67,8 @@ unsafe extern "C" fn init() {
65
67
66
68
// Attempt to preload the synch functions.
67
69
load_synch_functions ( ) ;
70
+ // Determine if running on 9x or NT
71
+ version:: init ( ) ;
68
72
}
69
73
70
74
/// Helper macro for creating CStrs from literals and symbol names.
Original file line number Diff line number Diff line change
1
+ use crate :: sys:: c;
2
+
3
+ static mut IS_NT : bool = true ;
4
+
5
+ pub ( super ) unsafe extern "C" fn init ( ) {
6
+ // according to old MSDN info, the high-order bit is set only on 95/98/ME.
7
+ IS_NT = c:: GetVersion ( ) < 0x8000_0000 ;
8
+ }
9
+
10
+ /// Returns true if we are running on a Windows NT-based system. Only use this for APIs where the
11
+ /// same API differs in behavior or capability on 9x/ME compared to NT.
12
+ #[ inline( always) ]
13
+ pub ( crate ) fn is_windows_nt ( ) -> bool {
14
+ unsafe { IS_NT }
15
+ }
You can’t perform that action at this time.
0 commit comments