I get an device instance path like
L"\\\\?\\USB#VID_0403&PID_6001#6&2cc2d230&0&2#{219d0508-57a8-4ff5-97a1-bd86587c6c7e}"
from IWDFRemoteInterfaceInitialize::RetrieveSymbolicLink.
But for CM_Get_Parent I need the DEVINST/DWORD of the device which drives me crazy.
I've tried for example
instancePath = L"\\\\?\\USB#VID_0403&PID_6001#6&2cc2d230&0&2#{219d0508-57a8-4ff5-97a1-bd86587c6c7e}";
HDEVINFO hinfo = SetupDiGetClassDevs(NULL, instancePath, NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES);
and some other SetupDi... voodoo with no success. Any help is highly appreciated because -as mentioned- I haven't been able to get around this madness for hours now and though there are dozens of examples for the other way round (devid->instance path) I haven't found any for instance path->DEVINST.
As you said, there's not a direct way.
However, you should be able to get a Device Instance ID from your Device Path / Device Interface ID by means of some string editing, following the below steps:
\\\\?\\
part, until theUSB
.{...}
part#
with\
Starting from
you should now have
which should be a valid Device Instance ID. If it's not, try removing the last "\" too.
Then, you can feed this to CM_Locate_DevNode() and get the wanted DEVINST.