summary refs log tree commit diff
path: root/library/std/src/sys/windows/c.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-16 08:48:36 +0000
committerbors <bors@rust-lang.org>2022-07-16 08:48:36 +0000
commite092d0b6b43f2de967af0887873151bb1c0b18d3 (patch)
tree3c0903d6cb6800cbf43017141fc38b669a360386 /library/std/src/sys/windows/c.rs
parenta8314ef7d0ec7b75c336af2c9857bfaf43002bfc (diff)
parent647922f9d8a6f1fa639ab206e60a76d43cc9d3dd (diff)
downloadrust-1.62.1.tar.gz
rust-1.62.1.zip
Auto merge of #99299 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum 1.62.1
[stable] 1.62.1 release

This bundles:

*  Windows: Fallback for overlapped I/O #98950
*  don't succeed evaluate_obligation query if new opaque types were registered #98614
*  Mitigate MMIO stale data vulnerability #98126
*  Return a FxIndexSet in is_late_bound query. #99219

Also bumps the version number to 1.62.1 and includes a short release notes section for the release.

r? `@Mark-Simulacrum`
Diffstat (limited to 'library/std/src/sys/windows/c.rs')
-rw-r--r--library/std/src/sys/windows/c.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/library/std/src/sys/windows/c.rs b/library/std/src/sys/windows/c.rs
index 5f14edaf067..b92aa420177 100644
--- a/library/std/src/sys/windows/c.rs
+++ b/library/std/src/sys/windows/c.rs
@@ -325,7 +325,9 @@ union IO_STATUS_BLOCK_union {
 }
 impl Default for IO_STATUS_BLOCK_union {
     fn default() -> Self {
-        Self { Pointer: ptr::null_mut() }
+        let mut this = Self { Pointer: ptr::null_mut() };
+        this.Status = STATUS_PENDING;
+        this
     }
 }
 #[repr(C)]
@@ -334,6 +336,16 @@ pub struct IO_STATUS_BLOCK {
     u: IO_STATUS_BLOCK_union,
     pub Information: usize,
 }
+impl IO_STATUS_BLOCK {
+    pub fn status(&self) -> NTSTATUS {
+        // SAFETY: If `self.u.Status` was set then this is obviously safe.
+        // If `self.u.Pointer` was set then this is the equivalent to converting
+        // the pointer to an integer, which is also safe.
+        // Currently the only safe way to construct `IO_STATUS_BLOCK` outside of
+        // this module is to call the `default` method, which sets the `Status`.
+        unsafe { self.u.Status }
+    }
+}
 
 pub type LPOVERLAPPED_COMPLETION_ROUTINE = unsafe extern "system" fn(
     dwErrorCode: DWORD,