Libraries ntddk.h and wdf.h ... can you tell me its utility in this code?

0
#include <ntddk.h>
#include <wdf.h>
DRIVER_INITIALIZE DriverEntry;
EVT_WDF_DRIVER_DEVICE_ADD KmdfHelloWorldEvtDeviceAdd;

NTSTATUS DriverEntry(_In_ PDRIVER_OBJECT  DriverObject, _In_ PUNICODE_STRING RegistryPath)
{
    NTSTATUS status;
    WDF_DRIVER_CONFIG config;

    KdPrintEx(( DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "KmdfHelloWorld: DriverEntry\n" ));
    WDF_DRIVER_CONFIG_INIT(&config, KmdfHelloWorldEvtDeviceAdd);
    status = WdfDriverCreate(DriverObject, RegistryPath, WDF_NO_OBJECT_ATTRIBUTES, &config, WDF_NO_HANDLE);
    return status;
}

NTSTATUS KmdfHelloWorldEvtDeviceAdd(_In_ WDFDRIVER Driver, _Inout_ PWDFDEVICE_INIT DeviceInit)
{
    NTSTATUS status;
    WDFDEVICE hDevice;
    UNREFERENCED_PARAMETER(Driver);

    KdPrintEx(( DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "KmdfHelloWorld: KmdfHelloWorldEvtDeviceAdd\n" ));
    status = WdfDeviceCreate(&DeviceInit, WDF_NO_OBJECT_ATTRIBUTES, &hDevice);
    return status;
}
    
asked by anonymous 04.02.2017 / 03:59

1 answer

0

<ntddk.h> is the NT Driver Development Kit header, the Windows (NT) driver development kit. It defines various types of data needed to write drivers in a Windows NT4 environment or higher (% with%, for example). The MSDN , however, recommends that you include the NTSTATUS library instead - it is assumed that, at least, in cases where <wdm.h> is not used, below.

<wdf.h> is the Windows Driver Frameworks , the Microsoft's new drivers API. It provides other data types, such as <wdf.h> and WDF_DRIVER_CONFIG , and is essentially the main API used in the driver of your example.

    
07.02.2017 / 01:08