From 60f48d27f3d0a87020e6b196d7d4a99f1eebd6ed Mon Sep 17 00:00:00 2001 From: pravic Date: Thu, 28 Apr 2016 23:29:31 +0300 Subject: km updates for Winsock network drivers WIP --- src/device_object.rs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/device_object.rs') diff --git a/src/device_object.rs b/src/device_object.rs index f4cbf39..b475f8f 100644 --- a/src/device_object.rs +++ b/src/device_object.rs @@ -2,7 +2,7 @@ use ::{NTSTATUS, UNICODE_STRING}; use ::driver_object::DRIVER_OBJECT; -use ::irp::{IRP, PIRP}; +use ::irp::{IRP}; use ::dpc::KDPC; use ::event::KEVENT; use ::object::*; @@ -41,6 +41,15 @@ pub enum DEVICE_FLAGS { DO_XIP = 0x00020000 } +/// `IoCompletion` routine result. +#[repr(u32)] +pub enum IO_COMPLETION_ROUTINE_RESULT { + // STATUS_SUCCESS + ContinueCompletion = 0, + // STATUS_MORE_PROCESSING_REQUIRED + StopCompletion = 0xC0000016, +} + /// The `DEVICE_OBJECT` structure is used by the operating system to represent a device object. #[repr(C)] pub struct DEVICE_OBJECT @@ -72,6 +81,13 @@ pub struct DEVICE_OBJECT pub Reserved: *const u8, } +impl DEVICE_OBJECT { + /// Return a reference to driver-defined data structure. + pub fn extension(&mut self) -> &mut T { + unsafe { &mut *(self.DeviceExtension as *mut T) } + } +} + /// Device object extension structure. #[repr(C)] pub struct DEVOBJ_EXTENSION @@ -92,8 +108,8 @@ pub struct DEVOBJ_EXTENSION pub type PDEVICE_OBJECT = *mut DEVICE_OBJECT; -pub type PDRIVER_CANCEL = Option; +pub type PDRIVER_CANCEL = Option; pub type PDRIVER_DISPATCH = Option NTSTATUS>; -pub type PIO_COMPLETION_ROUTINE = Option NTSTATUS>; +pub type PIO_COMPLETION_ROUTINE = Option IO_COMPLETION_ROUTINE_RESULT>; -- cgit v1.2.3