More driver experiments

This commit is contained in:
momo5502 2022-03-13 20:34:47 +01:00
parent 54c692d1d2
commit 6dad84b363

View File

@ -2,27 +2,29 @@
#include "logging.h"
#include "nt_ext.h"
_Function_class_(DRIVER_UNLOAD)
void unload(PDRIVER_OBJECT /*DriverObject*/)
{
DbgLog("Bye World\n");
}
_Function_class_(KDEFERRED_ROUTINE)
void NTAPI test_function(struct _KDPC* /*Dpc*/,
PVOID /*DeferredContext*/,
PVOID param,
const PVOID arg1,
const PVOID arg2)
{
const auto core_id = KeGetCurrentProcessorNumberEx(nullptr);
DbgLog("Hello from CPU %ul\n", core_id);
DbgLog("%s from CPU %u\n", static_cast<const char*>(param), core_id);
KeSignalCallDpcSynchronize(arg2);
KeSignalCallDpcDone(arg1);
}
_Function_class_(DRIVER_UNLOAD)
void unload(PDRIVER_OBJECT /*DriverObject*/)
{
DbgLog("Leaving World\n");
KeGenericCallDpc(test_function, "Bye");
DbgLog("Bye World\n");
}
extern "C" {
NTSTATUS DriverEntry(const PDRIVER_OBJECT DriverObject, PUNICODE_STRING /*RegistryPath*/)
@ -31,7 +33,7 @@ NTSTATUS DriverEntry(const PDRIVER_OBJECT DriverObject, PUNICODE_STRING /*Regist
DbgLog("Hello World\n");
KeGenericCallDpc(test_function, nullptr);
KeGenericCallDpc(test_function, "Hello");
DbgLog("Nice World\n");