PnpDeviceObjectToDeviceInstance

NTSTATUS __fastcall PnpDeviceObjectToDeviceInstance(__int64 a1, VOID **a2, int a3){
  __int64 v4; 
  WCHAR *v5; 
  UINT64 DesiredAccess; 

  v4 = *(_QWORD *)(*(_QWORD *)(a1 + 312) + 40i64);
  if( !v4 )
    return -1073741808;
  v5 = *(WCHAR **)(v4 + 48);
  if( !v5 )
    return -1073741808;
  LODWORD(DesiredAccess) = a3;
  return CmOpenDeviceRegKey(*(&stru_140CF2E80 + 607), v5, CM_KEY_TYPE_DEVICE_INSTANCE, 0i64, DesiredAccess, 0, a2, 0i64);
}

Referenced by:

IoReportDetectedDevice
PiCreateDriverSwDevices
PiGetDeviceRegistryProperty
PiQueryRemovableDeviceOverride
PipProcessStartPhase3
PnpSaveDeviceCapabilities