CmCreateDevicePanel

__int64 __fastcall CmCreateDevicePanel(__int64 a1, const wchar_t *a2, __int64 a3, HANDLE *a4, _BYTE *a5){
  __int64(__fastcall *v8)(__int64, const wchar_t *, __int64); 
  int v9; 
  int v10; 
  int v11; 
  int v12; 
  int v13; 
  int v14; 
  INT64 result[2]; 
  unsigned int v17; 
  HANDLE Handle; 
  bool v19; 
  int v20; 
  memset((INT64)result, 0i64);
  v8 = *(__int64(__fastcall **)(__int64, const wchar_t *, __int64))(a1 + 504);
  v20 = 0;
  v17 = 4;
  if( v8 )
  {
    v9 = v8(a1, a2, 6i64);
    if( v9 == -1073741822 )
    {
      v8 = 0i64;
    }
    else
    {
      if( v9 == -1073741536 )
        goto LABEL_14;
      if( v9 )
      {
        v11 = -1073741595;
        goto LABEL_17;
      }
    }
  }
  v10 = CmCreateDevicePanelWorker(a1, a2, v17, (__int64 *)&Handle, &v19, v20);
  v11 = v10;
  if( !v8 )
    goto LABEL_10;
  LODWORD(result[0]) = v10;
  v12 = v8(a1, a2, 6i64);
  v13 = v12;
  if( v12 == -1073741822 )
    goto LABEL_10;
  if( v12 == -1073741536 )
  {
LABEL_14:
    v11 = result[0];
    goto LABEL_10;
  }
  v14 = v11;
  if( v13 )
    v14 = -1073741595;
  v11 = v14;
LABEL_10:
  if( v11 >= 0 && a4 )
  {
    *a4 = Handle;
    goto LABEL_19;
  }
LABEL_17:
  if( Handle )
    ZwClose(Handle);
LABEL_19:
  if( v11 >= 0 && a5 )
    *a5 = v19;
  return(unsigned int)v11;
}

Referenced by:

CmAddPanelDeviceWorker
CmUpdateDevicePanel