CmCreateInstallerClass

__int64 __fastcall CmCreateInstallerClass(__int64 a1, const WCHAR *a2, int a3, HANDLE *a4, _BYTE *a5, int a6){
  __int64(__fastcall *v10)(__int64, const WCHAR *, __int64, __int64, int, _DWORD *); 
  int v11; 
  int v12; 
  int v13; 
  int v14; 
  int v15; 
  int v16; 
  _DWORD result[4]; 
  unsigned int v19; 
  HANDLE Handle; 
  bool v21; 
  int v22; 
  memset((INT64)result, 0i64);
  v10 = *(__int64(__fastcall **)(__int64, const WCHAR *, __int64, __int64, int, _DWORD *))(a1 + 504);
  if( a3 || (v19 = 1, a4) )
    v19 = a3;
  v22 = a6;
  if( v10 )
  {
    v11 = v10(a1, a2, 2i64, 2i64, 1, result);
    if( v11 == -1073741822 )
    {
      v10 = 0i64;
    }
    else
    {
      if( v11 == -1073741536 )
        goto LABEL_17;
      if( v11 )
      {
        v13 = -1073741595;
        goto LABEL_20;
      }
    }
  }
  v12 = CmCreateInstallerClassWorker(a1, a2, v19, (__int64 *)&Handle, &v21, v22);
  v13 = v12;
  if( !v10 )
    goto LABEL_13;
  result[0] = v12;
  v14 = v10(a1, a2, 2i64, 2i64, 2, result);
  v15 = v14;
  if( v14 == -1073741822 )
    goto LABEL_13;
  if( v14 == -1073741536 )
  {
LABEL_17:
    v13 = result[0];
    goto LABEL_13;
  }
  v16 = v13;
  if( v15 )
    v16 = -1073741595;
  v13 = v16;
LABEL_13:
  if( v13 >= 0 && a4 )
  {
    *a4 = Handle;
    goto LABEL_22;
  }
LABEL_20:
  if( Handle )
    ZwClose(Handle);
LABEL_22:
  if( v13 >= 0 && a5 )
    *a5 = v21;
  return(unsigned int)v13;
}

Referenced by:

PiCMOpenClassKey
PnpDispatchInstallerClass