summaryrefslogtreecommitdiff
path: root/crates/windows-kernel-rs/examples/safe_framework
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-01-04 13:48:00 -0800
committerFuwn <[email protected]>2022-01-04 13:48:00 -0800
commitc33b9e296ab9563f2b180a8fa63155665055261e (patch)
tree086cf2702939fd25769fea83e117d7058af2e75a /crates/windows-kernel-rs/examples/safe_framework
parentfix(makefile.toml): tidy up (diff)
downloaddriver-c33b9e296ab9563f2b180a8fa63155665055261e.tar.xz
driver-c33b9e296ab9563f2b180a8fa63155665055261e.zip
feat(examples): lots of new examples
Thanks, StephanvanSchaik.
Diffstat (limited to 'crates/windows-kernel-rs/examples/safe_framework')
-rw-r--r--crates/windows-kernel-rs/examples/safe_framework/Cargo.toml17
-rw-r--r--crates/windows-kernel-rs/examples/safe_framework/src/lib.rs27
2 files changed, 44 insertions, 0 deletions
diff --git a/crates/windows-kernel-rs/examples/safe_framework/Cargo.toml b/crates/windows-kernel-rs/examples/safe_framework/Cargo.toml
new file mode 100644
index 0000000..df9e4df
--- /dev/null
+++ b/crates/windows-kernel-rs/examples/safe_framework/Cargo.toml
@@ -0,0 +1,17 @@
+[package]
+name = "safe_framework"
+version = "0.1.0"
+authors = ["Fuwn <[email protected]>"]
+edition = "2021"
+publish = false
+build = "../build.rs"
+
+[lib]
+crate-type = ["cdylib"]
+
+[build-dependencies]
+windows-kernel-build = { path = "../../../windows-kernel-build" }
+
+[dependencies]
+windows-kernel-rs = { path = "../../../windows-kernel-rs" }
+windows-kernel-sys = { path = "../../../windows-kernel-sys" }
diff --git a/crates/windows-kernel-rs/examples/safe_framework/src/lib.rs b/crates/windows-kernel-rs/examples/safe_framework/src/lib.rs
new file mode 100644
index 0000000..33292e4
--- /dev/null
+++ b/crates/windows-kernel-rs/examples/safe_framework/src/lib.rs
@@ -0,0 +1,27 @@
+#![no_std]
+#![feature(lang_items, const_extern_fn)]
+#![deny(
+ warnings,
+ nonstandard_style,
+ unused,
+ future_incompatible,
+ rust_2018_idioms
+)]
+#![deny(clippy::all, clippy::nursery, clippy::pedantic)]
+
+use windows_kernel_rs::{kernel_module, println, Driver, Error, KernelModule};
+
+struct Module;
+impl KernelModule for Module {
+ fn init(_: Driver, _: &str) -> Result<Self, Error> {
+ println!("Hello, world!");
+
+ Ok(Module)
+ }
+
+ fn cleanup(&mut self, _: Driver) {
+ println!("Bye bye!");
+ }
+}
+
+kernel_module!(Module);