diff options
| author | pravic <[email protected]> | 2016-04-12 16:41:56 +0300 |
|---|---|---|
| committer | pravic <[email protected]> | 2016-04-12 16:41:56 +0300 |
| commit | 56c8fa0af0c451febf43a94a6993f81ad364f9c8 (patch) | |
| tree | 2cfc94f7606079e2f507bed6740b841fe4990c07 /examples/02.unload/driver.rs | |
| parent | Windows Kernel-Mode library (diff) | |
| download | winapi-kmd-rs-56c8fa0af0c451febf43a94a6993f81ad364f9c8.tar.xz winapi-kmd-rs-56c8fa0af0c451febf43a94a6993f81ad364f9c8.zip | |
add driver examples
Diffstat (limited to 'examples/02.unload/driver.rs')
| -rw-r--r-- | examples/02.unload/driver.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/02.unload/driver.rs b/examples/02.unload/driver.rs new file mode 100644 index 0000000..6336045 --- /dev/null +++ b/examples/02.unload/driver.rs @@ -0,0 +1,22 @@ +#![crate_type = "dylib"] +#![no_std] +#![allow(bad_style)] + +#[macro_use] extern crate km; + +use core::mem; +use km::*; + +#[no_mangle] +pub extern "system" fn DriverEntry(driver: &mut km::DRIVER_OBJECT, _path: *const km::string::UnicodeString) -> Status { + + KdPrint!("[rs] hello, rust!\n"); + KdPrint!("[rs] we are DriverObject at 0x%p, sizeof %d\n", driver as *mut km::DRIVER_OBJECT , mem::size_of::<km::DRIVER_OBJECT>()); + + driver.DriverUnload = Some(DriverUnload); + return Status::success; +} + +extern "system" fn DriverUnload(_obj: &mut km::DRIVER_OBJECT) { + KdPrint!("[rs] unload.\n"); +} |