summaryrefslogtreecommitdiff
path: root/crates/windows-kernel-rs/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-01-03 12:58:55 -0800
committerFuwn <[email protected]>2022-01-03 12:58:55 -0800
commitc1109b4a5694d7a9b8b93c11140ce968bf074816 (patch)
treefe8ef37bc60d37dbcb5e41a1b29c5d4dcc39f100 /crates/windows-kernel-rs/src
parentfix(windows-kernal-build): fix unnecessary lazy evaluation (diff)
downloaddriver-c1109b4a5694d7a9b8b93c11140ce968bf074816.tar.xz
driver-c1109b4a5694d7a9b8b93c11140ce968bf074816.zip
fix(window-kernel-rs): mark unsafe functions
Diffstat (limited to 'crates/windows-kernel-rs/src')
-rw-r--r--crates/windows-kernel-rs/src/device.rs6
-rw-r--r--crates/windows-kernel-rs/src/lib.rs1
-rw-r--r--crates/windows-kernel-rs/src/process.rs2
-rw-r--r--crates/windows-kernel-rs/src/request.rs2
-rw-r--r--crates/windows-kernel-rs/src/user_ptr.rs6
5 files changed, 17 insertions, 0 deletions
diff --git a/crates/windows-kernel-rs/src/device.rs b/crates/windows-kernel-rs/src/device.rs
index 88ae85b..4dabfba 100644
--- a/crates/windows-kernel-rs/src/device.rs
+++ b/crates/windows-kernel-rs/src/device.rs
@@ -257,14 +257,20 @@ unsafe impl Send for Device {}
unsafe impl Sync for Device {}
impl Device {
+ /// # Safety
+ /// `unsafe`
pub unsafe fn from_raw(raw: *mut DEVICE_OBJECT) -> Self {
Self {
raw,
}
}
+ /// # Safety
+ /// `unsafe`
pub unsafe fn as_raw(&self) -> *const DEVICE_OBJECT { self.raw as *const _ }
+ /// # Safety
+ /// `unsafe`
pub unsafe fn as_raw_mut(&self) -> *mut DEVICE_OBJECT { self.raw }
pub fn into_raw(mut self) -> *mut DEVICE_OBJECT {
diff --git a/crates/windows-kernel-rs/src/lib.rs b/crates/windows-kernel-rs/src/lib.rs
index a0ddf9a..f952ce6 100644
--- a/crates/windows-kernel-rs/src/lib.rs
+++ b/crates/windows-kernel-rs/src/lib.rs
@@ -1,5 +1,6 @@
#![no_std]
#![feature(alloc_error_handler)]
+#![allow(clippy::too_many_arguments)]
extern crate alloc;
diff --git a/crates/windows-kernel-rs/src/process.rs b/crates/windows-kernel-rs/src/process.rs
index e0133c0..1ee6c79 100644
--- a/crates/windows-kernel-rs/src/process.rs
+++ b/crates/windows-kernel-rs/src/process.rs
@@ -70,6 +70,8 @@ pub struct ProcessAttachment {
}
impl ProcessAttachment {
+ /// # Safety
+ /// `unsafe`
pub unsafe fn attach(process: PEPROCESS) -> Self {
let mut state: KAPC_STATE = core::mem::zeroed();
diff --git a/crates/windows-kernel-rs/src/request.rs b/crates/windows-kernel-rs/src/request.rs
index 43a6a83..7717071 100644
--- a/crates/windows-kernel-rs/src/request.rs
+++ b/crates/windows-kernel-rs/src/request.rs
@@ -51,6 +51,8 @@ pub struct IoRequest {
}
impl IoRequest {
+ /// # Safety
+ /// `unsafe`
pub unsafe fn from_raw(irp: *mut IRP) -> Self {
Self {
irp,
diff --git a/crates/windows-kernel-rs/src/user_ptr.rs b/crates/windows-kernel-rs/src/user_ptr.rs
index 54dcb58..223cee6 100644
--- a/crates/windows-kernel-rs/src/user_ptr.rs
+++ b/crates/windows-kernel-rs/src/user_ptr.rs
@@ -16,6 +16,8 @@ pub enum UserPtr {
}
impl UserPtr {
+ /// # Safety
+ /// `unsafe`
pub unsafe fn new_buffered(ptr: *mut cty::c_void, read_size: usize, write_size: usize) -> Self {
Self::Buffered {
ptr,
@@ -24,6 +26,8 @@ impl UserPtr {
}
}
+ /// # Safety
+ /// `unsafe`
pub unsafe fn new_direct(
read_ptr: *const cty::c_void,
write_ptr: *mut cty::c_void,
@@ -38,6 +42,8 @@ impl UserPtr {
}
}
+ /// # Safety
+ /// `unsafe`
pub unsafe fn new_neither() -> Self { Self::Neither }
pub fn read_size(&self) -> usize {