mirror of
https://github.com/joaoviictorti/shadow-rs.git
synced 2026-01-16 22:14:36 +01:00
Small fix
This commit is contained in:
@@ -30,7 +30,7 @@ pub unsafe fn get_input_buffer<T>(stack: *mut _IO_STACK_LOCATION) -> Result<*mut
|
||||
}
|
||||
|
||||
// Allocate a kernel-mode buffer in non-paged memory
|
||||
let buffer = ExAllocatePool2(POOL_FLAG_NON_PAGED, size_of::<T>() as u64, 0x1234) as *mut T;
|
||||
let buffer = ExAllocatePool2(POOL_FLAG_NON_PAGED, size_of::<T>() as u64, 0x1234) as *mut T;
|
||||
if buffer.is_null() {
|
||||
return Err(ShadowError::NullPointer("buffer"));
|
||||
}
|
||||
@@ -79,6 +79,5 @@ pub unsafe fn get_output_buffer<T>(irp: *mut IRP, stack: *mut _IO_STACK_LOCATION
|
||||
}
|
||||
|
||||
let count = output_length as usize / size_of::<T>();
|
||||
|
||||
Ok((buffer as *mut T, count))
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ pub unsafe fn get_process_by_name(process_name: &str) -> Result<usize> {
|
||||
///
|
||||
/// * True if the address is within the kernel memory range, False otherwise.
|
||||
pub fn valid_kernel_memory(addr: u64) -> bool {
|
||||
(addr >> 48) == 0xFFFF
|
||||
unsafe { addr >= wdk_sys::MmSystemRangeStart as u64 }
|
||||
}
|
||||
|
||||
/// Validates if the given address is within the user memory range.
|
||||
@@ -347,7 +347,7 @@ pub fn valid_kernel_memory(addr: u64) -> bool {
|
||||
///
|
||||
/// * True if the address is within the user memory range, False otherwise.
|
||||
pub fn valid_user_memory(addr: u64) -> bool {
|
||||
(addr >> 48) == 0x0000
|
||||
unsafe { addr > 0 && addr <= wdk_sys::MmHighestUserAddress as u64 }
|
||||
}
|
||||
|
||||
/// Responsible for returning information on the modules loaded.
|
||||
|
||||
Reference in New Issue
Block a user