mirror of
https://git.intege.rs/xlib/x.git
synced 2025-12-05 20:35:01 +00:00
imagebase::as_slice
imagebase::as_slice_mut &imagebase::add &imageabse::sub
This commit is contained in:
@@ -235,6 +235,18 @@ impl ImageBase {
|
|||||||
self.as_ptr()..self.as_ptr() + self.nt_header().optional_header.size_of_image as usize
|
self.as_ptr()..self.as_ptr() + self.nt_header().optional_header.size_of_image as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub unsafe fn as_slice(&self) -> &[u8] {
|
||||||
|
let ptr = self.as_ptr() as *const u8;
|
||||||
|
let size = self.nt_header().optional_header.size_of_image as usize;
|
||||||
|
core::slice::from_raw_parts(ptr, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub unsafe fn as_slice_mut(&self) -> &mut [u8] {
|
||||||
|
let ptr = self.as_ptr() as *mut u8;
|
||||||
|
let size = self.nt_header().optional_header.size_of_image as usize;
|
||||||
|
core::slice::from_raw_parts_mut(ptr, size)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ImageNTHeaders64 {
|
impl ImageNTHeaders64 {
|
||||||
|
|||||||
Reference in New Issue
Block a user