Opening driver's own device STATUS_NO_SUCH_DEVICE

Hello,

Is there any limitation to opening a driver’s own device via IoGetDeviceObjectPointer? I create a device in DriverEntry (DO_DEVICE_INITIALIZING is unset before IoGetDeviceObjectPointer is called), and try to open it from a system thread (while DriverEntry is still in progress, but the device is set up already, DriverEntry waits for the system thread to exit), but am getting STATUS_NO_SUCH_DEVICE (not STATUS_OBJECT_NAME_NOT_FOUND like when the device doesn’t exist at all).
Any idea what could be up?

Regards, Dejan.

Offhand I don’t know why IoGetDeviceObjectPointer is failing, but you already have a deviceobject pointer, you got it when you created the device. Why would you need another one?

For testing purposes.

I hate it when I spend hours, get nothing, ask online, figure 5 minutes
later…

I did the attach when Unload is already called!

Dejan.