SC_GPT::VerifyPartitionTable

__int64 __fastcall SC_GPT::VerifyPartitionTable(SC_GPT *this, char a2){
  __int64 v2; 
  __int16 *v3; 
  unsigned int v5; 
  __int64 v6; 
  bool v7; 
  unsigned int v8; 
  __int64 v9; 
  unsigned int v10; 
  VOID **v11; 
  struct _GPT_ENTRY *v12; 
  VOID **v13; 
  unsigned int v14; 
  __int64 v15; 
  __int64 v16; 
  void **v17; 
  __int128 *v18; 
  __int64 v19; 
  int v20; 
  int v21; 
  _BOOL4 v22; 
  int v23; 
  unsigned int v24; 
  __int64 v25; 
  __int64 v26; 
  __int64 v27; 
  __int64 v28; 
  void *v29; 
  void **v30; 
  __int64 v31; 
  __int128 v33; 
  __int128 v34; 
  __int128 v35; 
  __int16 v36; 
  char v37; 

  v37 = a2;
  v2 = *(_QWORD *)this;
  v3 = &v36;
  v36 = 0;
  v5 = 0;
  v6 = 0i64;
  v7 = (*(_BYTE *)(v2 + 192) & 1) != 0;
  v35 = 0i64;
  v8 = 2 - v7;
  v34 = 0i64;
  v33 = 0i64;
  do
  {
    v9 = *(_QWORD *)(*(_QWORD *)this + 256i64);
    *(_QWORD *)((char *)&v33 + v6) = v9;
    if( (int)SC_GPT::ReadHeader(this, v5, (struct GPT_HEADER *)v9) >= 0 )
    {
      v10 = -*(_DWORD *)(*(_QWORD *)this + 228i64) & (*(_DWORD *)(v9 + 80) * *(_DWORD *)(v9 + 84)
                                                    + *(_DWORD *)(*(_QWORD *)this + 228i64)
                                                    - 1);
      v11 = SC_ENV::Allocate(v10 + (1 << *(_DWORD *)(*(_QWORD *)this + 232i64)));
      *(_QWORD *)((char *)&v35 + v6) = v11;
      v12 = (struct _GPT_ENTRY *)v11;
      if( !v11 )
      {
        v14 = -1073741670;
        goto LABEL_34;
      }
      if( v5 )
      {
        v13 = v11;
        v12 = (struct _GPT_ENTRY *)((char *)v11 + (1 << *(_DWORD *)(*(_QWORD *)this + 232i64)));
      }
      else
      {
        v13 = (VOID **)((char *)v11 + v10);
      }
      *(_QWORD *)((char *)&v33 + v6) = v13;
      *(_QWORD *)((char *)&v34 + v6) = v12;
      memmove(v13, *(const VOID **)(*(_QWORD *)this + 256i64), 1 << *(_DWORD *)(*(_QWORD *)this + 232i64));
      if( (int)SC_GPT::ReadEntries(this, (struct GPT_HEADER *)v13, v12) >= 0 )
        *(_BYTE *)v3 = 1;
    }
    ++v5;
    v6 += 8i64;
    v3 = (__int16 *)((char *)v3 + 1);
  }
  while( v5 < v8 );
  v14 = 0;
  if( !v36 )
  {
LABEL_11:
    v14 = -1073741774;
    goto LABEL_34;
  }
  v15 = *(_QWORD *)this;
  if( (*(_DWORD *)(*(_QWORD *)this + 192i64) & 1) == 0 )
  {
    if( !(_BYTE)v36
      || !HIBYTE(v36)
      || __PAIR128__(*(_QWORD *)(*((_QWORD *)&v33 + 1) + 24i64), *(_QWORD *)(*((_QWORD *)&v33 + 1) + 32i64)) != *(_OWORD *)(v33 + 24)
      || *(_OWORD *)(*((_QWORD *)&v33 + 1) + 40i64) != *(_OWORD *)(v33 + 40)
      || *(_QWORD *)(*((_QWORD *)&v33 + 1) + 80i64) != *(_QWORD *)(v33 + 80)
      || *(_DWORD *)(*((_QWORD *)&v33 + 1) + 88i64) != *(_DWORD *)(v33 + 88) )
    {
      goto LABEL_23;
    }
    v16 = *(_QWORD *)(*((_QWORD *)&v33 + 1) + 56i64) - *(_QWORD *)(v33 + 56);
    if( !v16 )
      v16 = *(_QWORD *)(*((_QWORD *)&v33 + 1) + 64i64) - *(_QWORD *)(v33 + 64);
    if( v16 )
    {
LABEL_23:
      if( !v37 )
        goto LABEL_11;
      if( (_BYTE)v36 )
      {
        v17 = (void **)&v34;
        v18 = &v33;
      }
      else
      {
        v17 = (void **)&v34 + 1;
        v18 = (__int128 *)((char *)&v33 + 8);
      }
      v19 = *(_QWORD *)v18;
      v20 = *(_DWORD *)(v15 + 228);
      v21 = *(_DWORD *)(v15 + 232);
      v22 = (_BYTE)v36 != 0;
      v23 = *(_DWORD *)(v19 + 80) * *(_DWORD *)(v19 + 84);
      *(_DWORD *)(v19 + 16) = 0;
      v24 = (-v20 & (unsigned int)(v23 + v20 - 1)) >> v21;
      v25 = *(_QWORD *)(v19 + 24);
      *(_QWORD *)(v19 + 24) = *(_QWORD *)(v19 + 32);
      *(_QWORD *)(v19 + 32) = v25;
      v26 = *(_QWORD *)(v19 + 24);
      if( v22 )
        v27 = v26 - v24;
      else
        v27 = v26 + 1;
      *(_QWORD *)(v19 + 72) = v27;
      *(_DWORD *)(v19 + 16) = RtlComputeCrc32(0i64, (UINT8 *)v19, *(unsigned int *)(v19 + 12));
      if( v22 )
      {
        v29 = *v17;
        v28 = *(_QWORD *)(v19 + 72);
      }
      else
      {
        v28 = *(_QWORD *)(v19 + 24);
        v29 = (void *)v19;
      }
      v14 = SC_DISK::WriteSectors(*(SC_DISK **)this, v24 + 1, v28, v29);
    }
  }
LABEL_34:
  v30 = (void **)&v35;
  v31 = 2i64;
  do
  {
    if( *v30 )
      SC_ENV::Free(*v30);
    ++v30;
    --v31;
  }
  while( v31 );
  return v14;
}

Referenced by:

No references.