Advertisement
Jakowlew

Untitled

May 22nd, 2021
1,311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1. #include <ntddk.h>
  2. #include <wdf.h>
  3.  
  4. DRIVER_INITIALIZE DriverEntry;
  5. EVT_WDF_DRIVER_DEVICE_ADD KmdfHelloWorldEvtDeviceAdd;
  6.  
  7. NTSTATUS
  8. DriverEntry(
  9.     _In_ PDRIVER_OBJECT     DriverObject,
  10.     _In_ PUNICODE_STRING    RegistryPath
  11. )
  12. {
  13.     // NTSTATUS variable to record success or failure
  14.     NTSTATUS status = STATUS_SUCCESS;
  15.  
  16.     // Allocate the driver configuration object
  17.     WDF_DRIVER_CONFIG config;
  18.  
  19.     // Print "Hello World" for DriverEntry
  20.     KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "KmdfHelloWorld: DriverEntry\n"));
  21.  
  22.     // Initialize the driver configuration object to register the
  23.     // entry point for the EvtDeviceAdd callback, KmdfHelloWorldEvtDeviceAdd
  24.     WDF_DRIVER_CONFIG_INIT(&config,
  25.         KmdfHelloWorldEvtDeviceAdd
  26.     );
  27.  
  28.     // Finally, create the driver object
  29.     status = WdfDriverCreate(DriverObject,
  30.         RegistryPath,
  31.         WDF_NO_OBJECT_ATTRIBUTES,
  32.         &config,
  33.         WDF_NO_HANDLE
  34.     );
  35.     return status;
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement