I’d like to name the PDOs that my bus driver creates. That is, instead of (say) using \Device\000000fb, I’d like \Device\MyDevice-0, MyDevice-1, and so on.
I took this code straight from the KMDF documentation:
DECLARE_CONST_UNICODE_STRING(MyDeviceName, L"\Device\MyDevice-0") ;
status = WdfDeviceInitAssignName(DeviceInit, &MyDeviceName);
if (!NT_SUCCESS(status)) return status;
If I attempt to create one child device, the code above itself succeeds. Further, the call to IoGetDeviceProperty() in my function driver on the new stack also succeeds, but the returned data size from IoGetDeviceProperty() is zero bytes. The output buffer doesn’t contain \Device\MyDevice-0.
If I skip calling WdfDeviceInitAssignName() in my bus driver, everything works normally. The call to IoGetDeviceProperty() in my function driver succeeds and I see \Device\000000fb or whatever. Am I missing something?