CmCreateDeviceContainer

NTSTATUS __stdcall CmCreateDeviceContainer(
        HPNPCTX *hPnpCtx,
        const WCHAR *DeviceContainerId,
        INT64 DesiredAccess,
        VOID **DeviceContainerKey,
        UINT8 *Created,
        INT64 Flags){
  __int64(__fastcall *v9)(HPNPCTX *, const WCHAR *, __int64); 
  int v10; 
  NTSTATUS DeviceContainerWorker; 
  NTSTATUS v12; 
  int v13; 
  int v14; 
  int v15; 
  UINT64 *v17; 
  UINT64 v18[12]; 

  memset(v18, 0i64, 0x58u);
  v9 = (__int64(__fastcall *)(HPNPCTX *, const WCHAR *, __int64))*((_QWORD *)hPnpCtx + 63);
  HIDWORD(v18[4]) = 0;
  LODWORD(v18[2]) = 4;
  if( v9 )
  {
    v17 = v18;
    v10 = v9(hPnpCtx, DeviceContainerId, 5i64);
    if( v10 == -1073741822 )
    {
      v9 = 0i64;
    }
    else
    {
      if( v10 == -1073741536 )
        goto LABEL_18;
      if( v10 )
      {
        v12 = -1073741595;
        goto LABEL_21;
      }
    }
  }
  LODWORD(v17) = HIDWORD(v18[4]);
  DeviceContainerWorker = CmCreateDeviceContainerWorker(
                            hPnpCtx,
                            (WCHAR *)DeviceContainerId,
                            LODWORD(v18[2]),
                            (VOID **)&v18[3],
                            (UINT8 *)&v18[4],
                            (UINT64)v17);
  v12 = DeviceContainerWorker;
  if( !v9 )
    goto LABEL_11;
  LODWORD(v18[0]) = DeviceContainerWorker;
  v13 = v9(hPnpCtx, DeviceContainerId, 5i64);
  v14 = v13;
  if( v13 == -1073741822 )
    goto LABEL_11;
  if( v13 == -1073741536 )
  {
LABEL_18:
    v12 = v18[0];
    goto LABEL_11;
  }
  v15 = v12;
  if( v14 )
    v15 = -1073741595;
  v12 = v15;
LABEL_11:
  if( v12 >= 0 && DeviceContainerKey )
  {
    *DeviceContainerKey = (VOID *)v18[3];
    goto LABEL_14;
  }
LABEL_21:
  if( v18[3] )
    ZwClose(v18[3]);
LABEL_14:
  if( v12 >= 0 && Created )
    *Created = v18[4];
  return v12;
}

Referenced by:

CmAddDeviceToContainerWorker