I want to write a UMDF2
windows driver, I don't know where to see the output from OutputDebugString
.
This is my code, similar to KMDF Hello World
.
#include <Windows.h>
#include <wdf.h>
NTSTATUS UmdfHelloWorldEvtDeviceAdd(_In_ WDFDRIVER Driver, _Inout_ PWDFDEVICE_INIT DeviceInit)
{
UNREFERENCED_PARAMETER(Driver);
NTSTATUS status;
WDFDEVICE hDevice;
OutputDebugString((LPCWSTR)"UmdfHelloWorld: EvtDeviceAdd\n");
status = WdfDeviceCreate(&DeviceInit, WDF_NO_OBJECT_ATTRIBUTES, &hDevice);
return status;
}
NTSTATUS DriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath)
{
NTSTATUS status = STATUS_SUCCESS;
WDF_DRIVER_CONFIG config;
OutputDebugString((LPCWSTR)"UmdfHelloWorld: DriverEntry\n");
WDF_DRIVER_CONFIG_INIT(&config, UmdfHelloWorldEvtDeviceAdd);
status = WdfDriverCreate(DriverObject, RegistryPath, WDF_NO_OBJECT_ATTRIBUTES, &config, WDF_NO_HANDLE);
return status;
}
Running the KMDF Hello World driver is giving me output successfully on windbg
kernel-mode debugging.
However, the UMDF Hello World driver shows no output.
This is how I'm (un)installing drivers:
devcon.exe install UmdfHelloWorld.inf Root\UmdfHelloWorld
devcon.exe remove Root\UmdfHelloWorld
Also, I want to use user-mode debugging, but I don't know how to do that for UMDF drivers.