#include <ddk/ntddk.h>
static VOID STDCALL
my_unload( IN PDRIVER_OBJECT DriverObject ) {
}
NTSTATUS STDCALL
DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath ) {
   DbgPrint("DriverEntry called\r\n");
 
    DriverObject->DriverUnload = my_unload;
 
    return STATUS_SUCCESS;
}
gcc -o drvtest.obj -O3 -c drvtest.c
ld Drv.obj --subsystem=native --image-base=0x10000 --file-alignment=0x20 --section-alignment=0x20 --entry=_DriverEntry -nostartfiles --nostdlib -L d:\MinGW\lib -shared -l ntoskrnl -o Drv.sys
原文:https://www.cnblogs.com/csnd/p/11535427.html