Skip to content

Commit

Permalink
fix(lib): use absolute path to core::mem in `InitializeObjectAttrib…
Browse files Browse the repository at this point in the history
…utes` macro
  • Loading branch information
oberrich authored Aug 7, 2024
1 parent 7137b31 commit e1d2d6f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ pub mod ext {

#[macro_export]
macro_rules! InitializeObjectAttributes {
($p:expr, $n:expr, $a:expr, $r:expr, $s:expr) => {{
let _o = $p;
_o.Length = mem::size_of::<ffi::OBJECT_ATTRIBUTES>() as u32;
_o.RootDirectory = $r;
_o.ObjectName = $n;
_o.Attributes = $a;
_o.SecurityDescriptor = $s;
_o.SecurityQualityOfService = ptr::null_mut();
}};
($p:expr, $n:expr, $a:expr, $r:expr, $s:expr) => {
let attrs = $p;
attrs.Length =
unsafe { u32::try_from(core::mem::size_of::<ffi::OBJECT_ATTRIBUTES>()).unwrap_unchecked() };
attrs.RootDirectory = $r;
attrs.ObjectName = $n;
attrs.Attributes = $a;
attrs.SecurityDescriptor = $s;
attrs.SecurityQualityOfService = core::ptr::null_mut();
};
}

#[inline]
Expand Down

0 comments on commit e1d2d6f

Please sign in to comment.