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/01.minimal | |
| 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/01.minimal')
| -rw-r--r-- | examples/01.minimal/Cargo.toml | 28 | ||||
| -rw-r--r-- | examples/01.minimal/build.rs | 0 | ||||
| -rw-r--r-- | examples/01.minimal/driver.rs | 16 | ||||
| -rw-r--r-- | examples/01.minimal/exports.def | 3 |
4 files changed, 47 insertions, 0 deletions
diff --git a/examples/01.minimal/Cargo.toml b/examples/01.minimal/Cargo.toml new file mode 100644 index 0000000..f1478aa --- /dev/null +++ b/examples/01.minimal/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "rust.drv.examples.minimal" +description = "Minimal Windows kerneld driver sample." +version = "0.1.0" +authors = ["pravic <[email protected]>"] +readme = "../README.md" + +build = "build.rs" +links = "ntoskrnl" + +[lib] +path = "driver.rs" +name = "minimal" +crate-type = ["dylib"] + +test = false +bench = false + +[profile.release] +opt-level = 3 +debug = true +rpath = false +lto = true +debug-assertions = false + +[dependencies] +winapi-km = { path = "../../../km", version="*" } +core = { path = "../../../libcore", version = "*" } diff --git a/examples/01.minimal/build.rs b/examples/01.minimal/build.rs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/examples/01.minimal/build.rs diff --git a/examples/01.minimal/driver.rs b/examples/01.minimal/driver.rs new file mode 100644 index 0000000..d446ff0 --- /dev/null +++ b/examples/01.minimal/driver.rs @@ -0,0 +1,16 @@ +#![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(_obj: *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", _obj, mem::size_of::<km::DRIVER_OBJECT>()); + return Status::unsuccessful; // return error to unload driver now +} diff --git a/examples/01.minimal/exports.def b/examples/01.minimal/exports.def new file mode 100644 index 0000000..15c494d --- /dev/null +++ b/examples/01.minimal/exports.def @@ -0,0 +1,3 @@ +EXPORTS + DriverEntry + |