BiGetDriveLayoutBlock

INT64 __fastcall BiGetDriveLayoutBlock(WCHAR *DeviceName, DRIVE_LAYOUT_INFORMATION_EX **DriveLayout, INT64 a3){
  int DriveLayoutInformation; 
  DRIVE_LAYOUT_INFORMATION_EX *v7; 
  DWORD PartitionStyle; 
  PVOID P; 
  P = 0i64;
  *DriveLayout = 0i64;
  *(_OWORD *)a3 = 0i64;
  *(_OWORD *)(a3 + 16) = 0i64;
  *(_QWORD *)(a3 + 32) = 0i64;
  DriveLayoutInformation = BiGetDriveLayoutInformation(DeviceName, DriveLayout);
  if( DriveLayoutInformation < 0 )
  {
    DriveLayoutInformation = BiGetPhysicalDriveName(DeviceName, (WCHAR **)&P);
    if( DriveLayoutInformation < 0 )
      goto LABEL_15;
    DriveLayoutInformation = BiGetDriveLayoutInformation((WCHAR *)P, DriveLayout);
    ExFreePoolWithTag(P, 0x4B444342u);
    if( DriveLayoutInformation < 0 )
      goto LABEL_15;
  }
  *(_DWORD *)a3 = 0;
  v7 = *DriveLayout;
  PartitionStyle = (*DriveLayout)->PartitionStyle;
  if( PartitionStyle )
  {
    if( PartitionStyle == 1 )
    {
      *(_DWORD *)(a3 + 4) = 0;
      *(_OWORD *)(a3 + 8) = *(_OWORD *)&v7->Mbr.Signature;
    }
    else
    {
      DriveLayoutInformation = -1073741811;
    }
  }
  else
  {
    *(_DWORD *)(a3 + 4) = 1;
    *(_DWORD *)(a3 + 8) = v7->Mbr.Signature;
  }
  if( DriveLayoutInformation < 0 )
  {
LABEL_15:
    if( *DriveLayout )
    {
      ExFreePoolWithTag(*DriveLayout, 0x4B444342u);
      *DriveLayout = 0i64;
    }
  }
  return(unsigned int)DriveLayoutInformation;
}

Referenced by:

BiGetNtPartitionPath