#ntexapi.rs

11 messages · Page 1 of 1 (latest)

polar harbor
#

.

#

#[inline]
pub unsafe fn NtGetTickCount() -> ULONG {
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] {
((read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad)
* (*USER_SHARED_DATA).TickCountMultiplier as u64) >> 24) as u32
}
#[cfg(target_arch = "x86")] {
let mut tick_count: ULARGE_INTEGER = uninitialized();
loop {
tick_count.s_mut().HighPart = read_volatile(&(*USER_SHARED_DATA).u.TickCount.High1Time)
as u32;
tick_count.s_mut().LowPart = read_volatile(&(*USER_SHARED_DATA).u.TickCount.LowPart);
if tick_count.s().HighPart == read_volatile(&(*USER_SHARED_DATA).u.TickCount.High2Time)
as u32
{
break;
}
spin_loop_hint();
}
((UInt32x32To64(tick_count.s().LowPart, (*USER_SHARED_DATA).TickCountMultiplier) >> 24)
+ UInt32x32To64(
(tick_count.s().HighPart as u32) << 8,
(*USER_SHARED_DATA).TickCountMultiplier,
)) as u32
}
}

#

// &(*USER_SHARED_DATA).u.TickCountQuad)

valid reef
#

it's hard to tell what your error is referring to, because you haven't shared all of it

#

run cargo check, and share the full text from that, as a code block

#

but, in general, the right way to handle packed fields is to not take references to them

#

you can read the value or write the value but don't take a reference to the value

echo saddle
#

If you need a raw pointer to an unaligned field, you can use addr_of!(thing.field) (or addr_of_mut!`)

polar harbor
#

cargo check

#

i didnt write this code it must have come when i installed rust.