Small fix

This commit is contained in:
joaoviictorti
2025-02-25 23:52:38 -03:00
parent 5ad4255d2b
commit d3061e6f84
2 changed files with 3 additions and 4 deletions

View File

@@ -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))
}

View File

@@ -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.