forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add static check indicating NT vs 9x/ME
This will be used/needed for some APIs that exist on both platforms but with different behavior/capabilities.
- Loading branch information
Showing
4 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use crate::sys::c; | ||
|
||
static mut IS_NT: bool = true; | ||
|
||
pub fn init_windows_version_check() { | ||
// according to old MSDN info, the high-order bit is set only on 95/98/ME. | ||
unsafe { IS_NT = c::GetVersion() < 0x8000_0000 }; | ||
} | ||
|
||
/// Returns true if we are running on a Windows NT-based system. Only use this for APIs where the | ||
/// same API differs in behavior or capability on 9x/ME compared to NT. | ||
#[inline(always)] | ||
pub fn is_windows_nt() -> bool { | ||
unsafe { IS_NT } | ||
} |