ntddk. h and wdf.h... libraries can tell me their usefulness in this code?

Asked

Viewed 30 times

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;
}

1 answer

0

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

<wdf.h> is the Windows Driver Frameworks, to new API of drivers from Microsoft. It provides other types of data, such as WDF_DRIVER_CONFIG and the WdfDriverCreate(), and is essentially the main API used in driver of his example.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.