1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
// MY DRIVER
// =========
#include <ntddk.h>
#include <windef.h>
void Example_Create () { }
void myUnload (PDRIVER_OBJECT pDriverObject)
{
DbgPrint ("%s","My Driver - Unload\n") ;
}
NTSTATUS DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
NTSTATUS NtStatus = STATUS_SUCCESS ;
PDEVICE_OBJECT pDeviceObject = NULL ;
UNICODE_STRING usDriverName, usDosDeviceName ;
DbgPrint ("DriverEntry Called \r\n") ;
RtlInitUnicodeString (&usDriverName, L"\\test4") ;
RtlInitUnicodeString (&usDosDeviceName, L"\\DosDevices\\Example") ;
NtStatus = IoCreateDevice (DriverObject, 0,
&usDriverName,
FILE_DEVICE_UNKNOWN,
FILE_DEVICE_SECURE_OPEN,
FALSE, &pDeviceObject) ;
DriverObject -> MajorFunction[IRP_MJ_CREATE] = Example_Create ;
// cette ligne CI-DESSUS "refuse", sans elle, c'est ok ! !
// ... alors que la ligne CI-DESSOUS ne pose aucun soucis ... étonnant !!!
DriverObject -> DriverUnload = myUnload ;
DbgPrint ("%s","My Driver - Load\n") ;
return STATUS_SUCCESS ;
} |
Partager