CmCreateDeviceWorker

NTSTATUS __stdcall CmCreateDeviceWorker(
        HPNPCTX *hPnpCtx,
        WCHAR *DeviceInstanceId,
        UINT64 DesiredAccess,
        VOID **DeviceKey,
        UINT8 *Created,
        UINT64 Flags){
  int v9; 
  bool v10; 
  UINT64 v12; 
  __int64 v13[3]; 

  LODWORD(v13[0]) = 0;
  if( (_WORD)Flags )
    return -1073741811;
  LODWORD(v12) = DesiredAccess;
  v9 = CmOpenDeviceRegKey(
         hPnpCtx,
         DeviceInstanceId,
         CM_KEY_TYPE_DEVICE_INSTANCE,
         0i64,
         v12,
         1u,
         DeviceKey,
         (UINT64 *)v13);
  if( v9 >= 0 )
  {
    v10 = LODWORD(v13[0]) == 1;
    *Created = LODWORD(v13[0]) == 1;
    if( v10 )
      CmRaiseCreateEvent(hPnpCtx, DeviceInstanceId, CM_OBJECT_TYPE_DEVICE, *DeviceKey);
  }
  return v9;
}

Referenced by:

CmCreateDevice