BiGetDriveLayoutInformation

INT64 __stdcall BiGetDriveLayoutInformation(WCHAR *DriveName, DRIVE_LAYOUT_INFORMATION_EX **DriveLayout){
  WCHAR v2; 
  NTSTATUS DriveLayoutIoctl; 
  struct _UNICODE_STRING DestinationString; 
  struct _IO_STATUS_BLOCK IoStatusBlock; 
  struct _OBJECT_ATTRIBUTES ObjectAttributes; 
  UNICODE_STRING FileHandle; 
  *(&ObjectAttributes.Length + 1) = 0;
  *(&ObjectAttributes.Attributes + 1) = 0;
  *(_QWORD *)&FileHandle.Length = 0i64;
  DestinationString = 0i64;
  RtlInitUnicodeString(&DestinationString, DriveName, v2);
  ObjectAttributes.RootDirectory = 0i64;
  ObjectAttributes.ObjectName = &DestinationString;
  ObjectAttributes.Length = 48;
  ObjectAttributes.Attributes = 576;
  *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
  IoStatusBlock = 0i64;
  DriveLayoutIoctl = ZwOpenFile(&FileHandle, (PWCHAR)0x80100000i64);
  if( DriveLayoutIoctl >= 0 )
    DriveLayoutIoctl = BiIssueGetDriveLayoutIoctl(*(PVOID *)&FileHandle.Length, DriveLayout);
  if( *(_QWORD *)&FileHandle.Length )
    ZwClose(*(HANDLE *)&FileHandle.Length);
  return(unsigned int)DriveLayoutIoctl;
}

Referenced by:

BiCreatePartitionDevice
BiGetDriveLayoutBlock