80 #define PARTITION_ENTRY_SIZE 128 82 #define EFI_HEADER_SIGNATURE 0x5452415020494645ULL 84 #define EFI_HEADER_REVISION_1 0x00010000 86 #define EFI_PMBR_OSTYPE_EFI 0xEE 88 #define EFI_GUID_STRING_SIZE 0x27 90 #define IS_VALID_DISK_INFO(Disk) \ 92 (Disk->DeviceObject) && \ 93 (Disk->SectorSize) && \ 177 Count = *PartitionCount;
192 *PartitionCount =
Count;
217 if (!DiskInformation)
252 if (!DiskInformation->
Buffer)
259 *DiskBuffer = DiskInformation;
294 DriveLayout->
Signature = LayoutEx->Mbr.Signature;
297 for (
i = 0;
i < LayoutEx->PartitionCount;
i++)
325 Entry->PartitionType = Partition->Gpt.PartitionType;
326 Entry->UniquePartition = Partition->Gpt.PartitionId;
328 Entry->EndingLBA = (Partition->StartingOffset.QuadPart + Partition->PartitionLength.QuadPart - 1) /
SectorSize;
329 Entry->Attributes = Partition->Gpt.Attributes;
336 IN PCREATE_DISK_MBR DiskInfo)
365 MasterBootRecord->
Signature = DiskInfo->Signature;
383 IN PCREATE_DISK_GPT DiskInfo)
388 ULONG MaxPartitionCount, SectorsForPartitions;
412 MaxPartitionCount = DiskInfo->MaxPartitionCount;
418 FirstUsableLBA = SectorsForPartitions + 2;
420 LastUsableLBA = Disk->
SectorCount - SectorsForPartitions - 1;
533 "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
558 DPRINT(
"FSTUB: DRIVE_LAYOUT_INFORMATION_EX: %p\n", DriveLayout);
559 switch (DriveLayout->PartitionStyle)
562 if (DriveLayout->PartitionCount % 4 != 0)
564 DPRINT(
"Warning: Partition count isn't a 4-factor: %lu!\n", DriveLayout->PartitionCount);
567 DPRINT(
"Signature: %8.8x\n", DriveLayout->Mbr.Signature);
568 for (
i = 0;
i < DriveLayout->PartitionCount;
i++)
577 DPRINT(
"StartingUsableOffset: %I64x\n", DriveLayout->Gpt.StartingUsableOffset.QuadPart);
578 DPRINT(
"UsableLength: %I64x\n", DriveLayout->Gpt.UsableLength.QuadPart);
579 DPRINT(
"MaxPartitionCount: %lu\n", DriveLayout->Gpt.MaxPartitionCount);
580 for (
i = 0;
i < DriveLayout->PartitionCount;
i++)
587 DPRINT(
"Unsupported partition style: %lu\n", DriveLayout->PartitionStyle);
640 DPRINT(
"FSTUB: SET_PARTITION_INFORMATION_EX: %p\n", PartitionEntry);
642 switch (PartitionEntry->PartitionStyle)
645 DPRINT(
" PartitionType: %02x\n", PartitionEntry->Mbr.PartitionType);
653 DPRINT(
" Attributes: %I64x\n", PartitionEntry->Gpt.Attributes);
654 DPRINT(
" Name: %ws\n", PartitionEntry->Gpt.Name);
690 *PartitionStyle = PARTITION_STYLE_RAW;
715 if (DiskBuffer->Buffer)
790 *Geometry = *DiskGeometry;
827 ULONG i, HeaderCRC32, PreviousCRC32, SectoredPartitionEntriesSize, LonelyPartitions;
838 StartingSector = Disk->SectorCount - 1
ULL;
843 StartingSector = 1
ULL;
852 DPRINT(
"EFI::Failed reading header!\n");
867 DPRINT(
"EFI::Wrong signature/version/header size!\n");
881 DPRINT(
"EFI::Not matching header checksum!\n");
888 if (EFIHeader->
MyLBA != StartingSector)
890 DPRINT(
"EFI::Not matching starting sector!\n");
900 DPRINT(
"EFI::Lacking resources!\n");
907 for (
i = 0, PreviousCRC32 = 0;
i < SectoredPartitionEntriesSize;
i++)
916 DPRINT(
"EFI::Failed reading sector for partition entry!\n");
920 PreviousCRC32 =
RtlComputeCrc32(PreviousCRC32, Sector, Disk->SectorSize);
926 if (LonelyPartitions != 0)
936 DPRINT(
"EFI::Failed reading sector for partition entry!\n");
941 for (
i = 0;
i < LonelyPartitions;
i++)
954 *HeaderBuffer = EFIHeader;
959 DPRINT(
"EFI::Not matching partition table checksum!\n");
969 OUT PDRIVE_LAYOUT_INFORMATION_EX* DriveLayout)
972 ULONG NumberOfEntries;
977 ULONGLONG SectorsForPartitions, PartitionEntryLBA;
981 PDRIVE_LAYOUT_INFORMATION_EX DriveLayoutEx =
NULL;
982 ULONG i, PartitionCount, PartitionIndex, PartitionsPerSector;
1005 FIELD_OFFSET(DRIVE_LAYOUT_INFORMATION_EX, PartitionEntry) +
1014 if (!ReadBackupTable)
1028 EfiHeader->
LastUsableLBA = Disk->SectorCount - SectorsForPartitions - 1;
1030 UpdatedPartitionTable =
TRUE;
1037 DriveLayoutEx->Gpt.StartingUsableOffset.QuadPart = EfiHeader->
FirstUsableLBA * Disk->SectorSize;
1040 DriveLayoutEx->Gpt.DiskId = EfiHeader->
DiskGUID;
1050 for (
i = 0, PartitionCount = 0, PartitionIndex = PartitionsPerSector;
1051 i < NumberOfEntries;
1055 if (PartitionIndex == PartitionsPerSector)
1059 PartitionEntryLBA + (
i / PartitionsPerSector),
1083 DriveLayoutEx->PartitionEntry[PartitionCount].StartingOffset.QuadPart = PartitionEntry.
StartingLBA * Disk->SectorSize;
1084 DriveLayoutEx->PartitionEntry[PartitionCount].PartitionLength.QuadPart = (PartitionEntry.
EndingLBA -
1088 DriveLayoutEx->PartitionEntry[PartitionCount].PartitionNumber = PartitionCount + 1;
1089 DriveLayoutEx->PartitionEntry[PartitionCount].RewritePartition =
FALSE;
1091 DriveLayoutEx->PartitionEntry[PartitionCount].Gpt.PartitionType = PartitionEntry.
PartitionType;
1092 DriveLayoutEx->PartitionEntry[PartitionCount].Gpt.PartitionId = PartitionEntry.
UniquePartition;
1093 DriveLayoutEx->PartitionEntry[PartitionCount].Gpt.Attributes = PartitionEntry.
Attributes;
1094 RtlCopyMemory(DriveLayoutEx->PartitionEntry[PartitionCount].Gpt.Name,
1095 PartitionEntry.
Name,
sizeof(PartitionEntry.
Name));
1100 DriveLayoutEx->PartitionCount = PartitionCount;
1104 if (UpdatedPartitionTable)
1112 *DriveLayout = DriveLayoutEx;
1121 OUT PDRIVE_LAYOUT_INFORMATION_EX* ReturnedDriveLayout)
1126 PDRIVE_LAYOUT_INFORMATION_EX DriveLayoutEx =
NULL;
1131 ASSERT(ReturnedDriveLayout);
1134 *ReturnedDriveLayout =
NULL;
1148 FIELD_OFFSET(DRIVE_LAYOUT_INFORMATION_EX, PartitionEntry) +
1161 DriveLayoutEx->Mbr.Signature = DriveLayout->
Signature;
1178 *ReturnedDriveLayout = DriveLayoutEx;
1245 PDRIVE_LAYOUT_INFORMATION_EX Layout =
NULL;
1295 ULONGLONG ReadPosition, WritePosition, SectorsForPartitions, PartitionIndex;
1308 PrimaryValid =
TRUE;
1322 if (PrimaryValid && BackupValid)
1331 if ((!PrimaryValid && !BackupValid) || !
FixErrors)
1343 WritePosition = Disk->SectorCount - SectorsForPartitions;
1345 ReadPosition = 2
ULL;
1347 DPRINT(
"EFI::Will repair backup table from primary\n");
1352 WriteBackup =
FALSE;
1354 WritePosition = 2
ULL;
1356 ReadPosition = Disk->SectorCount - SectorsForPartitions;
1358 DPRINT(
"EFI::Will repair primary table from backup\n");
1361 PartitionIndex = 0
ULL;
1364 if (SectorsForPartitions <= 0)
1367 SectorsForPartitions,
1379 for (; PartitionIndex < SectorsForPartitions; ++PartitionIndex)
1384 ReadPosition + PartitionIndex,
1394 WritePosition + PartitionIndex,
1404 SectorsForPartitions,
1472 IN ULONG PartitionsSizeSector,
1473 IN ULONG PartitionEntryNumber,
1492 if (!WriteBackupTable)
1494 FirstEntryLBA = 2
ULL;
1498 FirstEntryLBA = Disk->SectorCount - PartitionsSizeSector - 1;
1512 if (
Offset == Disk->SectorSize || ForceWrite)
1529 if (PartitionEntryCRC32)
1540 IN ULONG PartitionsSizeSector,
1570 if (!WriteBackupTable)
1577 EFIHeader->
MyLBA = Disk->SectorCount - 1
ULL;
1589 if (!WriteBackupTable)
1605 DPRINT(
"FSTUB: About to write the following header for %s table\n", (WriteBackupTable ?
"backup" :
"primary"));
1606 DPRINT(
" Signature: %I64x\n", EFIHeader->Signature);
1607 DPRINT(
" Revision: %x\n", EFIHeader->Revision);
1608 DPRINT(
" HeaderSize: %x\n", EFIHeader->HeaderSize);
1609 DPRINT(
" HeaderCRC32: %x\n", EFIHeader->HeaderCRC32);
1610 DPRINT(
" MyLBA: %I64x\n", EFIHeader->MyLBA);
1611 DPRINT(
" AlternateLBA: %I64x\n", EFIHeader->AlternateLBA);
1612 DPRINT(
" FirstUsableLBA: %I64x\n", EFIHeader->FirstUsableLBA);
1613 DPRINT(
" LastUsableLBA: %I64x\n", EFIHeader->LastUsableLBA);
1614 DPRINT(
" PartitionEntryLBA: %I64x\n", EFIHeader->PartitionEntryLBA);
1615 DPRINT(
" NumberOfEntries: %x\n", EFIHeader->NumberOfEntries);
1616 DPRINT(
" SizeOfPartitionEntry: %x\n", EFIHeader->SizeOfPartitionEntry);
1617 DPRINT(
" PartitionEntryCRC32: %x\n", EFIHeader->PartitionEntryCRC32);
1639 ULONG i, WrittenPartitions, SectoredPartitionEntriesSize, PartitionEntryCRC32;
1644 ASSERT(MaxPartitionCount >= 128);
1645 ASSERT(PartitionCount <= MaxPartitionCount);
1647 PartitionEntryCRC32 = 0;
1651 for (
i = 0, WrittenPartitions = 0;
i < PartitionCount;
i++)
1654 if (PartitionEntries[
i].Gpt.PartitionType.Data1 == 0 &&
1655 PartitionEntries[
i].Gpt.PartitionType.Data2 == 0 &&
1656 PartitionEntries[
i].Gpt.PartitionType.Data3 == 0 &&
1657 ((
PULONGLONG)PartitionEntries[
i].Gpt.PartitionType.Data4)[0] == 0)
1666 SectoredPartitionEntriesSize,
1671 &PartitionEntryCRC32);
1676 WrittenPartitions++;
1682 for (
i = WrittenPartitions;
i < MaxPartitionCount;
i++)
1685 SectoredPartitionEntriesSize,
1690 &PartitionEntryCRC32);
1699 SectoredPartitionEntriesSize,
1704 PartitionEntryCRC32,
1711 IN PDRIVE_LAYOUT_INFORMATION_EX LayoutEx)
1731 Disk->DiskGeometry.Geometry.SectorsPerTrack,
1732 Disk->DiskGeometry.Geometry.TracksPerCylinder,
1802 IN PCREATE_DISK Disk)
1811 PartitionStyle = ((Disk) ? Disk->PartitionStyle : PARTITION_STYLE_RAW);
1813 switch (PartitionStyle)
1819 case PARTITION_STYLE_RAW:
1844 BOOLEAN SingleDisk, IsBootDiskInfoEx;
1848 PDRIVE_LAYOUT_INFORMATION_EX DriveLayout =
NULL;
1850 ANSI_STRING ArcBootString, ArcSystemString, DeviceStringA, ArcNameStringA;
1890 for (DiskNumber = 0; DiskNumber < DiskCount; DiskNumber++)
1893 sprintf(
Buffer,
"\\Device\\Harddisk%lu\\Partition0", DiskNumber);
1919 sizeof(DiskGeometry),
1963 NextEntry = NextEntry->
Flink)
1974 if (((SingleDisk && DiskCount == 1) ||
2008 BootDiskInformation->BootDeviceSignature =
Signature;
2027 &PartitionInformation,
2028 sizeof(PartitionInformation),
2057 if (IsBootDiskInfoEx)
2079 BootDiskInformation->SystemDeviceSignature =
Signature;
2098 &PartitionInformation,
2099 sizeof(PartitionInformation),
2128 if (IsBootDiskInfoEx)
2178 if (BytesPerSector < 512)
2180 BytesPerSector = 512;
2274 IN PDRIVE_LAYOUT_INFORMATION_EX* DriveLayout)
2302 switch (PartitionStyle)
2305 case PARTITION_STYLE_RAW:
2320 DPRINT(
"Unknown partition type\n");
2380 switch (PartitionStyle)
2435 switch (PartitionStyle)
2461 IN PDRIVE_LAYOUT_INFORMATION_EX DriveLayout)
2465 ULONG NumberOfEntries;
2468 ULONGLONG SectorsForPartitions, FirstUsableLBA, LastUsableLBA;
2486 switch (DriveLayout->PartitionStyle)
2517 FirstUsableLBA = SectorsForPartitions + 2;
2519 LastUsableLBA = Disk->
SectorCount - SectorsForPartitions - 1;
2527 DriveLayout->PartitionCount,
2528 DriveLayout->PartitionEntry);
2538 DriveLayout->PartitionCount,
2539 DriveLayout->PartitionEntry);
2550 DPRINT(
"Unsupported partition style: %lu\n", DriveLayout->PartitionStyle);
NTSTATUS NTAPI IoGetBootDiskInformation(IN OUT PBOOTDISK_INFORMATION BootDiskInformation, IN ULONG Size)
NTSTATUS NTAPI FstubVerifyPartitionTableEFI(IN PDISK_INFORMATION Disk, IN BOOLEAN FixErrors)
#define IOCTL_DISK_GET_DRIVE_GEOMETRY_EX
NTSTATUS NTAPI FstubReadSector(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONGLONG StartingSector OPTIONAL, OUT PVOID Buffer)
return STATUS_NOT_SUPPORTED
USHORT MasterBootRecordMagic
NTSTATUS NTAPI FstubSetPartitionInformationEFI(IN PDISK_INFORMATION Disk, IN ULONG PartitionNumber, IN SET_PARTITION_INFORMATION_GPT *PartitionInfo)
struct _DISK_INFORMATION DISK_INFORMATION
#define STATUS_INSUFFICIENT_RESOURCES
NTSTATUS NTAPI FstubWriteBootSectorEFI(IN PDISK_INFORMATION Disk)
ULONG PartitionSectorCount
_In_ PFCB _In_ LONGLONG StartingOffset
NTSTATUS NTAPI FstubWriteSector(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONGLONG StartingSector OPTIONAL, IN PVOID Buffer)
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
IN BOOLEAN OUT PSTR Buffer
NTSTATUS NTAPI IoReadDiskSignature(IN PDEVICE_OBJECT DeviceObject, IN ULONG BytesPerSector, OUT PDISK_SIGNATURE Signature)
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
VOID NTAPI FstubDbgPrintSetPartitionEx(IN PSET_PARTITION_INFORMATION_EX PartitionEntry, IN ULONG PartitionNumber)
#define STATUS_INVALID_PARAMETER
VOID NTAPI FstubFreeDiskInformation(IN PDISK_INFORMATION DiskBuffer)
ULONG PartitionSectorCount
NTSTATUS FASTCALL IoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN BOOLEAN ReturnRecognizedPartitions, OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer)
PDRIVE_LAYOUT_INFORMATION NTAPI FstubConvertExtendedToLayout(IN PDRIVE_LAYOUT_INFORMATION_EX LayoutEx)
NTSTATUS NTAPI FstubCreateDiskMBR(IN PDEVICE_OBJECT DeviceObject, IN PCREATE_DISK_MBR DiskInfo)
#define PARTITION_TABLE_OFFSET
NTSTATUS NTAPI FstubReadHeaderEFI(IN PDISK_INFORMATION Disk, IN BOOLEAN ReadBackupTable, PEFI_PARTITION_HEADER *HeaderBuffer)
NTSTATUS NTAPI FstubReadPartitionTableEFI(IN PDISK_INFORMATION Disk, IN BOOLEAN ReadBackupTable, OUT PDRIVE_LAYOUT_INFORMATION_EX *DriveLayout)
NTSTATUS NTAPI IoCreateDisk(IN PDEVICE_OBJECT DeviceObject, IN PCREATE_DISK Disk)
IN PVOID IN PVOID IN USHORT IN USHORT Size
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
NTSTATUS NTAPI FstubCreateDiskEFI(IN PDEVICE_OBJECT DeviceObject, IN PCREATE_DISK_GPT DiskInfo)
#define EFI_GUID_STRING_SIZE
_In_ ULONG _In_ ULONG PartitionNumber
ULONG SectorCountBeforePartition
NTSYSAPI BOOLEAN NTAPI RtlEqualString(PSTRING String1, PSTRING String2, BOOLEAN CaseInSensitive)
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
NTSTATUS NTAPI IoSetPartitionInformationEx(IN PDEVICE_OBJECT DeviceObject, IN ULONG PartitionNumber, IN PSET_PARTITION_INFORMATION_EX PartitionInfo)
struct _PARTITION_TABLE_ENTRY * PPARTITION_TABLE_ENTRY
NTSTATUS NTAPI FstubReadPartitionTableMBR(IN PDISK_INFORMATION Disk, IN BOOLEAN ReturnRecognizedPartitions, OUT PDRIVE_LAYOUT_INFORMATION_EX *ReturnedDriveLayout)
VOID NTAPI FstubDbgPrintDriveLayoutEx(IN PDRIVE_LAYOUT_INFORMATION_EX DriveLayout)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
NTSTATUS NTAPI FstubDetectPartitionStyle(IN PDISK_INFORMATION Disk, IN PARTITION_STYLE *PartitionStyle)
#define sprintf(buf, format,...)
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
UCHAR MasterBootRecordCodeAndData[0x1b8]
struct _PARTITION_TABLE_ENTRY PARTITION_TABLE_ENTRY
struct _EFI_PARTITION_ENTRY EFI_PARTITION_ENTRY
#define EFI_HEADER_REVISION_1
_In_ PVOID _In_ ULONG Event
struct _BOOTDISK_INFORMATION_EX BOOTDISK_INFORMATION_EX
#define SL_OVERRIDE_VERIFY_VOLUME
#define IS_VALID_DISK_INFO(Disk)
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
ULONG SectorCountBeforePartition
VOID NTAPI FstubAdjustPartitionCount(IN ULONG SectorSize, IN OUT PULONG PartitionCount)
struct _MASTER_BOOT_RECORD MASTER_BOOT_RECORD
struct _LIST_ENTRY * Flink
NTSTATUS NTAPI FstubWritePartitionTableEFI(IN PDISK_INFORMATION Disk, IN GUID DiskGUID, IN ULONG MaxPartitionCount, IN ULONGLONG FirstUsableLBA, IN ULONGLONG LastUsableLBA, IN BOOLEAN WriteBackupTable, IN ULONG PartitionCount, IN PPARTITION_INFORMATION_EX PartitionEntries OPTIONAL)
#define BOOT_RECORD_SIGNATURE
NTSTATUS NTAPI FstubAllocateDiskInformation(IN PDEVICE_OBJECT DeviceObject, OUT PDISK_INFORMATION *DiskBuffer, IN PDISK_GEOMETRY_EX DiskGeometry OPTIONAL)
#define NT_SUCCESS(StatCode)
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
NTSTATUS NTAPI FstubCreateDiskRaw(IN PDEVICE_OBJECT DeviceObject)
#define ObDereferenceObject
struct _PARTITION_DESCRIPTOR * PPARTITION_DESCRIPTOR
PARC_DISK_INFORMATION ArcDiskInformation
_In_ ULONG _In_ struct _SET_PARTITION_INFORMATION_EX * PartitionInfo
UCHAR CheckSum(LPSTR p, ULONG Len)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
struct _EFI_PARTITION_ENTRY * PEFI_PARTITION_ENTRY
#define EFI_HEADER_SIGNATURE
PARTITION_TABLE_ENTRY PartitionTable[4]
NTSTATUS NTAPI IoReadPartitionTableEx(IN PDEVICE_OBJECT DeviceObject, IN PDRIVE_LAYOUT_INFORMATION_EX *DriveLayout)
#define FILE_READ_ATTRIBUTES
#define STATUS_UNSUCCESSFUL
NTSTATUS NTAPI FstubGetDiskGeometry(IN PDEVICE_OBJECT DeviceObject, OUT PDISK_GEOMETRY_EX Geometry)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define PARTITION_ENTRY_SIZE
NTSTATUS NTAPI IoVerifyPartitionTable(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN FixErrors)
NTSTATUS NTAPI FstubWriteEntryEFI(IN PDISK_INFORMATION Disk, IN ULONG PartitionsSizeSector, IN ULONG PartitionEntryNumber, IN PEFI_PARTITION_ENTRY PartitionEntry, IN BOOLEAN WriteBackupTable, IN BOOLEAN ForceWrite, OUT PULONG PartitionEntryCRC32 OPTIONAL)
_In_ ULONG _In_ BOOLEAN ReturnRecognizedPartitions
enum _PARTITION_STYLE PARTITION_STYLE
#define BOOT_SIGNATURE_OFFSET
VOID NTAPI FstubDbgPrintPartitionEx(IN PPARTITION_INFORMATION_EX PartitionEntry, IN ULONG PartitionNumber)
static const WCHAR Cleanup[]
NTSTATUS NTAPI IoWritePartitionTableEx(IN PDEVICE_OBJECT DeviceObject, IN PDRIVE_LAYOUT_INFORMATION_EX DriveLayout)
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
PLOADER_PARAMETER_BLOCK IopLoaderBlock
_In_ ULONG _In_ ULONG Offset
VOID NTAPI FstubCopyEntryEFI(OUT PEFI_PARTITION_ENTRY Entry, IN PPARTITION_INFORMATION_EX Partition, ULONG SectorSize)
PCHAR NTAPI FstubDbgGuidToString(IN PGUID Guid, OUT PCHAR String)
BOOLEAN NTAPI IopVerifyDiskSignature(IN PDRIVE_LAYOUT_INFORMATION_EX DriveLayout, IN PARC_DISK_SIGNATURE ArcDiskSignature, OUT PULONG Signature)
#define KeInitializeEvent(pEvt, foo, foo2)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
#define FIELD_OFFSET(t, f)
static OUT PIO_STATUS_BLOCK IoStatusBlock
struct _EFI_PARTITION_HEADER * PEFI_PARTITION_HEADER
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
struct _MASTER_BOOT_RECORD * PMASTER_BOOT_RECORD
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
NTSTATUS FASTCALL IoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG PartitionNumber, IN ULONG PartitionType)
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
#define STATUS_DISK_CORRUPT_ERROR
NTSTATUS NTAPI FstubWritePartitionTableMBR(IN PDISK_INFORMATION Disk, IN PDRIVE_LAYOUT_INFORMATION_EX LayoutEx)
#define NUM_PARTITION_TABLE_ENTRIES
#define EFI_PMBR_OSTYPE_EFI
#define RtlZeroMemory(Destination, Length)
#define RtlCopyMemory(Destination, Source, Length)
NTSTATUS NTAPI FstubWriteHeaderEFI(IN PDISK_INFORMATION Disk, IN ULONG PartitionsSizeSector, IN GUID DiskGUID, IN ULONG NumberOfEntries, IN ULONGLONG FirstUsableLBA, IN ULONGLONG LastUsableLBA, IN ULONG PartitionEntryCRC32, IN BOOLEAN WriteBackupTable)
struct _BOOTDISK_INFORMATION_EX * PBOOTDISK_INFORMATION_EX
struct _EFI_PARTITION_HEADER EFI_PARTITION_HEADER
NTSTATUS FASTCALL IoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG SectorsPerTrack, IN ULONG NumberOfHeads, IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer)
static const WCHAR Signature[]
#define ExFreePoolWithTag(_P, _T)
#define DISK_SIGNATURE_OFFSET
base of all file and directory entries
#define IOCTL_DISK_GET_DRIVE_GEOMETRY
#define IOCTL_DISK_GET_PARTITION_INFO_EX
struct _DISK_INFORMATION * PDISK_INFORMATION
#define STATUS_DEVICE_NOT_READY
PULONG MinorVersion OPTIONAL