From ac1b72946c226eb3cd4f3f0b8f13a8330142ebe8 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Wed, 7 Apr 2021 00:22:58 +0200 Subject: initial commit Signed-off-by: Toni Uhlig --- ddk-template-cplusplus.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 ddk-template-cplusplus.cpp (limited to 'ddk-template-cplusplus.cpp') diff --git a/ddk-template-cplusplus.cpp b/ddk-template-cplusplus.cpp new file mode 100644 index 0000000..3ab6257 --- /dev/null +++ b/ddk-template-cplusplus.cpp @@ -0,0 +1,50 @@ +#include + +#include + +class TestSmth +{ +public: + TestSmth() {} + void doSmth(void) + { + DbgPrint("%s\n", "Hello Class!"); + } +}; + +static void test_cplusplus(void) +{ + TestSmth t; + t.doSmth(); +} + +extern "C" +{ + +DRIVER_INITIALIZE DriverEntry; +DRIVER_UNLOAD DriverUnload; + +NTSTATUS DriverEntry( + _In_ struct _DRIVER_OBJECT *DriverObject, + _In_ PUNICODE_STRING RegistryPath +) +{ + DbgPrint("%s\n", "Hello ring0!"); + + /* support for service stopping */ + DriverObject->DriverUnload = DriverUnload; + + test_cplusplus(); + + return STATUS_SUCCESS; +} + +VOID +DriverUnload( + _In_ struct _DRIVER_OBJECT *DriverObject +) +{ + DbgPrint("%s\n", "Bye ring0!"); +} + +} -- cgit v1.2.3