Greetings all,
We have a PCIe device which exposes some useful information in config space in the event that the firmware bombs. The Management Requires that I provide a utility to read this information. This I am able to do - I get the pdo name from SetupDi, pass it to a newly-created non-pnp driver, which calls IoGetDeviceObjectPointer, and sends IRP_MJ_PNP/IRP_MN_READ_CONFIG to the device to read config space. Simples.
However there are states where the firmware is badly enough broken that the in-box function driver (stornvme) is not able to start. In that case, IoGetDeviceObjectPointer fails with STATUS_NO_SUCH_DEVICE. This leads to a few questions:-
-
Can I get that pointer via other means? My best lead so far has been ObReferenceObjectByName - but I’d rather not use undocumented functions if there is a better way.
-
I’ve tried ObReferenceObjectByName(), but it returns STATUS_OBJECT_TYPE_MISMATCH (I tried *IoFileObjectType and *IoDeviceObjectType without success) - any ideas what might work?
-
It IS possible to read the device’s config space when in this state - DeviceManager shows enough to prove that it can. I guess I don’t know yet what will happen if I send IRP_MN_READ_CONFIG when the function driver isn’t started, I’m thinking it should be OK but does anyone have evidence to the contrary?
-
Is there just a better way to do this?