CmCreateInterfaceClass

NTSTATUS __stdcall CmCreateInterfaceClass(
        HPNPCTX *hPnpCtx,
        WCHAR *ClassGuid,
        WCHAR *DesiredAccess,
        INT64 ClassKey,
        VOID **Created,
        UINT8 *Flags,
        INT64 a7,
        INT64 a8,
        INT64 a9){
  int v10; 
  __int64(__fastcall *v13)(HPNPCTX *, WCHAR *, __int64); 
  int v14; 
  NTSTATUS InterfaceClassWorker; 
  NTSTATUS v16; 
  int v17; 
  int v18; 
  int v19; 
  UINT64 *v21; 
  UINT64 v22[12]; 

  v10 = (int)DesiredAccess;
  memset(v22, 0i64, 0x58u);
  v13 = (__int64(__fastcall *)(HPNPCTX *, WCHAR *, __int64))*((_QWORD *)hPnpCtx + 63);
  if( v10 || (LODWORD(v22[2]) = 1, ClassKey) )
    LODWORD(v22[2]) = v10;
  HIDWORD(v22[4]) = (_DWORD)Flags;
  if( v13 )
  {
    v21 = v22;
    v14 = v13(hPnpCtx, ClassGuid, 4i64);
    if( v14 == -1073741822 )
    {
      v13 = 0i64;
    }
    else
    {
      if( v14 == -1073741536 )
        goto LABEL_21;
      if( v14 )
      {
        v16 = -1073741595;
        goto LABEL_15;
      }
    }
  }
  LODWORD(v21) = HIDWORD(v22[4]);
  InterfaceClassWorker = CmCreateInterfaceClassWorker(
                           hPnpCtx,
                           ClassGuid,
                           LODWORD(v22[2]),
                           (VOID **)&v22[3],
                           (UINT8 *)&v22[4],
                           (UINT64)v21);
  v16 = InterfaceClassWorker;
  if( !v13 )
    goto LABEL_13;
  LODWORD(v22[0]) = InterfaceClassWorker;
  v17 = v13(hPnpCtx, ClassGuid, 4i64);
  v18 = v17;
  if( v17 == -1073741822 )
    goto LABEL_13;
  if( v17 == -1073741536 )
  {
LABEL_21:
    v16 = v22[0];
    goto LABEL_13;
  }
  v19 = v16;
  if( v18 )
    v19 = -1073741595;
  v16 = v19;
LABEL_13:
  if( v16 >= 0 && ClassKey )
  {
    *(_QWORD *)ClassKey = v22[3];
    goto LABEL_17;
  }
LABEL_15:
  if( v22[3] )
    ZwClose(v22[3]);
LABEL_17:
  if( v16 >= 0 && Created )
    *(_BYTE *)Created = v22[4];
  return v16;
}

Referenced by:

CmCreateDeviceInterfaceWorker
PiCMOpenClassKey
PnpDispatchInterfaceClass