mirror of
https://github.com/momo5502/hypervisor.git
synced 2025-04-19 13:42:55 +00:00
More driver experiments
This commit is contained in:
parent
54c692d1d2
commit
6dad84b363
22
src/main.cpp
22
src/main.cpp
@ -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");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user