IvtCreateDevice

INT64 __fastcall IvtCreateDevice(INT64 a1, INT64 a2, CHAR a3, UINT64 *a4){
  INT64 v6; 
  UINT64 v7; 
  CHAR *NextInternalDeviceScope; 
  CHAR *v9; 
  int Memory; 
  int v12; 
  INT64 v13; 
  INT64 v14; 
  _DWORD **v15; 
  INT64 *v16; 
  UINT64 v17; 
  INT64 v18; 
  v18 = 0i64;
  v6 = a1;
  if( *(_DWORD *)a2 != 1 || *(_DWORD *)(a1 + 212) != *(unsigned __int16 *)(a2 + 8) )
    return(unsigned int)-1073741275;
  if( (a3 & 1) == 0 || !*(_BYTE *)(a1 + 228) )
  {
    v7 = 0i64;
    while( 1 )
    {
      NextInternalDeviceScope = (CHAR *)IvtpGetNextInternalDeviceScope(a1, v7);
      v9 = NextInternalDeviceScope;
      if( !NextInternalDeviceScope )
        return(unsigned int)-1073741275;
      if( HalpIvtCheckIdPathMatch(a2, NextInternalDeviceScope) )
        break;
      v7 = (UINT64)v9;
      a1 = v6;
    }
  }
  v12 = ExtEnvAllocateMemory(a1, 0x28ui64, &v18);
  v14 = v18;
  Memory = v12;
  if( v12 < 0
    || (v15 = (_DWORD **)(v18 + 32),
        v16 = (INT64 *)(v18 + 32),
        *(_OWORD *)v18 = 0i64,
        *(_OWORD *)(v14 + 16) = 0i64,
        *(_QWORD *)(v14 + 32) = 0i64,
        Memory = ExtEnvAllocateMemory(v13, 4ui64, v16),
        Memory < 0) )
  {
    if( v14 )
    {
      v17 = *(_QWORD *)(v14 + 32);
      if( v17 )
        ExtEnvFreeMemory(v13, v17);
      ExtEnvFreeMemory(v13, v14);
    }
  }
  else
  {
    Memory = 0;
    **v15 = 0;
    **v15 = *(unsigned __int16 *)(a2 + 12);
    *a4 = v14;
  }
  return(unsigned int)Memory;
}

Referenced by:

No references.