[][src]Struct win_kernel_driver::WinKernelDriver

pub struct WinKernelDriver { /* fields omitted */ }

A handle to a windows kernel driver.

The driver is installed as a service. Once installed io handles can be opened / closed with the driver.

Example

let driver_bin = include_bytes!("../winRing0.sys");
let driver = DriverBuilder::new()
             .set_device_description("winRing0 driver")
             .set_device_id("WinRing0_1_2_0")
             .set_device_type(40000)
             .set_driver_bin(driver_bin.to_vec())
             .build().unwrap();
 
driver.install().unwrap();
driver.open().unwrap();
 
// Read MSR_TEMPERATURE_TARGET on intel CPUs
let ioctl = io_control_code(40000, 0x800, Method::BUFFERED, Access::ANY);
let out = device.io(ioctl, 0x1a2).unwrap();
let edx = ((out >> 32) & 0xFFFFFFFF) as u32;
let eax = (out & 0xFFFFFFFF) as u32;
 
let temp_target = (eax >> 16) & 0xff;
 
println!("MSR_TEMPERATURE_TARGET: {}", temp_target);
 
driver.close().unwrap();
driver.uninstall().unwrap();

Methods

impl WinKernelDriver[src]

pub fn install(&self) -> Result<(), String>[src]

Install the driver service

pub fn uninstall(&self) -> Result<(), String>[src]

Uninstall the driver service

pub fn open(&mut self) -> Result<(), String>[src]

Open the driver service. Once opened the [WinKernelDriver::io()] function can be called.

pub fn opened(&self) -> bool[src]

Check to see if there is an open handle to the driver

pub fn close(&mut self) -> Result<(), String>[src]

Close the open handle to the driver

pub fn io(&self, ioctl_code: u32, in_buffer: u32) -> Result<u64, String>[src]

Perform an IO command on the driver.

To know which IO commands are available, you must check with the driver you are trying to work with. IO control codes should be made with the [io_control_code] function.

Auto Trait Implementations

impl RefUnwindSafe for WinKernelDriver

impl !Send for WinKernelDriver

impl !Sync for WinKernelDriver

impl Unpin for WinKernelDriver

impl UnwindSafe for WinKernelDriver

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.