aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile20
-rw-r--r--README.md11
-rw-r--r--driver.cpp22
3 files changed, 53 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c83210b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,20 @@
+ifndef DPP_ROOT
+$(error DPP_ROOT is undefined)
+endif
+
+include $(DPP_ROOT)/Makefile.inc
+
+DRIVER_NAME = driver
+DRIVER_OBJECTS = $(DRIVER_NAME).o
+DRIVER_TARGET = $(DRIVER_NAME).sys
+
+all: $(DRIVER_TARGET)
+
+clean:
+ rm -f $(DRIVER_OBJECTS) $(DRIVER_TARGET)
+
+%.o: %.cpp
+ $(call BUILD_CPP_OBJECT,$<,$@)
+
+$(DRIVER_TARGET): $(DRIVER_OBJECTS)
+ $(call LINK_CPP_KERNEL_TARGET,$(DRIVER_OBJECTS),$@)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..8bc4580
--- /dev/null
+++ b/README.md
@@ -0,0 +1,11 @@
+# Mingw64 C++ Driver Example
+
+An example ready to use together with [mingw-w64-dpp](https://github.com/utoni/mingw-w64-dpp).
+
+You can lookup the documentation there.
+
+For TLDR folks:
+
+```shell
+make DPP_ROOT="[path-to-mingw-w64-ddk-template-dir]" all
+```
diff --git a/driver.cpp b/driver.cpp
new file mode 100644
index 0000000..69c82ff
--- /dev/null
+++ b/driver.cpp
@@ -0,0 +1,22 @@
+#include <ntddk.h>
+
+extern "C" {
+DRIVER_INITIALIZE DriverEntry;
+DRIVER_UNLOAD DriverUnload;
+
+NTSTATUS DriverEntry(_In_ struct _DRIVER_OBJECT *DriverObject,
+ _In_ PUNICODE_STRING RegistryPath) {
+ UNREFERENCED_PARAMETER(DriverObject);
+ UNREFERENCED_PARAMETER(RegistryPath);
+
+ DbgPrint("%s\n", "Hello ring0!");
+
+ return STATUS_SUCCESS;
+}
+
+VOID DriverUnload(_In_ struct _DRIVER_OBJECT *DriverObject) {
+ UNREFERENCED_PARAMETER(DriverObject);
+
+ DbgPrint("%s\n", "Bye ring0!");
+}
+}