34#ifdef DUMP_PARTITION_TABLE
44 DbgPrint(
"Index Start Length Hidden Nr Type Boot RW\n");
45 DbgPrint(
"----- ------------ ------------ ---------- -- ---- ---- --\n");
50 DbgPrint(
" %3lu %12I64u %12I64u %10lu %2lu %2x %c %c\n",
115 L"\\Scsi\\Scsi Port %hu",
132 DPRINT1(
"RtlQueryRegistryValues() failed (Status %lx)\n",
Status);
151 Entry1 != &
List->DiskListHead;
152 Entry1 = Entry1->
Flink)
158 Entry2 = Entry2->
Flink)
184 Entry1 != &
List->DiskListHead;
185 Entry1 = Entry1->
Flink)
191 Entry2 = Entry2->
Flink)
323 if (*Int13Drives ==
NULL)
349#define ROOT_NAME L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter"
357 L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System",
363 DPRINT1(
"Unable to query the 'Configuration Data' key in '\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System', status=%lx\n",
Status);
367 for (AdapterCount = 0; ; ++AdapterCount)
383 L"%s\\%lu\\DiskController",
395 L"%s\\%lu\\DiskController\\%lu",
409 L"%s\\%lu\\DiskController\\%lu\\DiskPeripheral",
423 for (DiskCount = 0; ; ++DiskCount)
426 if (BiosDiskEntry ==
NULL)
433 L"%s\\%lu\\DiskController\\%lu\\DiskPeripheral\\%lu",
438 (
PVOID)BiosDiskEntry,
447 BiosDiskEntry->AdapterNumber = 0;
449 BiosDiskEntry->DiskNumber = DiskCount;
450 BiosDiskEntry->DiskEntry =
NULL;
452 if (DiskCount < Int13Drives[0].NumberDrives)
454 BiosDiskEntry->Int13DiskData = Int13Drives[DiskCount];
458 DPRINT1(
"Didn't find Int13 drive data for disk %u\n", DiskCount);
461 InsertTailList(&PartList->BiosDiskListHead, &BiosDiskEntry->ListEntry);
464 DPRINT(
"AdapterNumber: %lu\n", BiosDiskEntry->AdapterNumber);
465 DPRINT(
"ControllerNumber: %lu\n", BiosDiskEntry->ControllerNumber);
466 DPRINT(
"DiskNumber: %lu\n", BiosDiskEntry->DiskNumber);
467 DPRINT(
"Signature: %08lx\n", BiosDiskEntry->Signature);
468 DPRINT(
"Checksum: %08lx\n", BiosDiskEntry->Checksum);
469 DPRINT(
"BytesPerSector: %lu\n", BiosDiskEntry->DiskGeometry.BytesPerSector);
470 DPRINT(
"NumberOfCylinders: %lu\n", BiosDiskEntry->DiskGeometry.NumberOfCylinders);
471 DPRINT(
"NumberOfHeads: %lu\n", BiosDiskEntry->DiskGeometry.NumberOfHeads);
472 DPRINT(
"DriveSelect: %02x\n", BiosDiskEntry->Int13DiskData.DriveSelect);
473 DPRINT(
"MaxCylinders: %lu\n", BiosDiskEntry->Int13DiskData.MaxCylinders);
474 DPRINT(
"SectorsPerTrack: %d\n", BiosDiskEntry->Int13DiskData.SectorsPerTrack);
475 DPRINT(
"MaxHeads: %d\n", BiosDiskEntry->Int13DiskData.MaxHeads);
476 DPRINT(
"NumberDrives: %d\n", BiosDiskEntry->Int13DiskData.NumberDrives);
508 if (DiskEntry->LayoutBuffer ==
NULL)
512 if (DiskEntry->LayoutBuffer->PartitionCount != 1)
526 if (DiskEntry->LayoutBuffer->Signature != 1)
528 DPRINT1(
"Super-Floppy disk %lu signature %08x != 1!\n",
529 DiskEntry->DiskNumber, DiskEntry->LayoutBuffer->Signature);
542 DPRINT1(
"Super-Floppy disk %lu does not return default settings!\n"
543 " PartitionNumber = %lu, expected 0\n"
544 " RecognizedPartition = %s, expected TRUE\n"
545 " PartitionType = 0x%02x, expected 0x04 (PARTITION_FAT_16)\n"
546 " BootIndicator = %s, expected FALSE\n",
547 DiskEntry->DiskNumber,
555 PartitionLengthEstimate = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
556 if (
PartitionInfo->PartitionLength.QuadPart != PartitionLengthEstimate)
558 DPRINT1(
"PartitionLength = %I64u is different from PartitionLengthEstimate = %I64u\n",
559 PartitionInfo->PartitionLength.QuadPart, PartitionLengthEstimate);
585 List = &DiskEntry->LogicalPartListHead;
587 List = &DiskEntry->PrimaryPartListHead;
614 min( PartEntry->StartSector.QuadPart + PartEntry->SectorCount.QuadPart - 1,
617 DPRINT1(
"Disk region overlap problem, stopping there!\n"
618 "Partition to be inserted:\n"
619 " StartSector = %I64u ; EndSector = %I64u\n"
620 "Existing disk region:\n"
621 " StartSector = %I64u ; EndSector = %I64u\n",
622 PartEntry->StartSector.QuadPart,
623 PartEntry->StartSector.QuadPart + PartEntry->SectorCount.QuadPart - 1,
652 if (NewPartEntry ==
NULL)
685 DPRINT1(
"Current partition sector count: %I64u\n", PartEntry->SectorCount.QuadPart);
692 ASSERT(!PartEntry->IsPartitioned);
694 if ((AutoCreate !=
FALSE) ||
696 PartEntry->StartSector.QuadPart == PartEntry->SectorCount.QuadPart))
698 PartEntry->AutoCreate = AutoCreate;
709 SectorCount2 = PartEntry->StartSector.QuadPart + PartEntry->SectorCount.QuadPart - StartSector;
715 PartEntry->LogicalPartition);
716 if (NewPartEntry ==
NULL)
718 DPRINT1(
"Failed to create a new empty region for disk space!\n");
723 PartEntry->SectorCount.QuadPart = StartSector - PartEntry->StartSector.QuadPart;
727 PartEntry->New =
TRUE;
728 PartEntry->IsPartitioned =
TRUE;
732 PartEntry->StartSector.QuadPart,
733 PartEntry->SectorCount.QuadPart);
737 PartEntry->FileSystem[0] =
L'\0';
739 PartEntry->BootIndicator =
FALSE;
741 DPRINT1(
"First Sector : %I64u\n", PartEntry->StartSector.QuadPart);
742 DPRINT1(
"Last Sector : %I64u\n", PartEntry->StartSector.QuadPart + PartEntry->SectorCount.QuadPart - 1);
743 DPRINT1(
"Total Sectors: %I64u\n", PartEntry->SectorCount.QuadPart);
768 PartitionInfo = &DiskEntry->LayoutBuffer->PartitionEntry[PartitionIndex];
779 if (PartEntry ==
NULL)
808 DiskEntry->ExtendedPartition = PartEntry;
817 L"\\Device\\Harddisk%lu\\Partition%lu",
818 DiskEntry->DiskNumber,
828 PartitionHandle =
NULL;
849 DPRINT1(
"InferFileSystem() failed, Status 0x%08lx\n",
Status);
887 PartitionHandle =
NULL;
923 DPRINT1(
"NtQueryVolumeInformationFile() failed, Status 0x%08lx\n",
Status);
954 DPRINT(
"ScanForUnpartitionedDiskSpace()\n");
958 DPRINT1(
"No primary partition!\n");
962 if (DiskEntry->SectorAlignment < 2048)
963 StartSector = 2048ULL;
965 StartSector = (
ULONGLONG)DiskEntry->SectorAlignment;
966 SectorCount =
AlignDown(DiskEntry->SectorCount.QuadPart, DiskEntry->SectorAlignment) - StartSector;
969 &DiskEntry->PrimaryPartListHead,
973 if (NewPartEntry ==
NULL)
974 DPRINT1(
"Failed to create a new empty region for full disk space!\n");
980 if (DiskEntry->SectorAlignment < 2048)
981 LastStartSector = 2048ULL;
983 LastStartSector = (
ULONGLONG)DiskEntry->SectorAlignment;
984 LastSectorCount = 0
ULL;
985 LastUnusedSectorCount = 0
ULL;
987 for (
Entry = DiskEntry->PrimaryPartListHead.Flink;
988 Entry != &DiskEntry->PrimaryPartListHead;
996 LastUnusedSectorCount =
1000 LastUnusedSectorCount >= (
ULONGLONG)DiskEntry->SectorAlignment)
1002 DPRINT(
"Unpartitioned disk space %I64u sectors\n", LastUnusedSectorCount);
1004 StartSector = LastStartSector + LastSectorCount;
1005 SectorCount =
AlignDown(StartSector + LastUnusedSectorCount, DiskEntry->SectorAlignment) - StartSector;
1013 if (NewPartEntry ==
NULL)
1015 DPRINT1(
"Failed to create a new empty region for disk space!\n");
1026 if ((LastStartSector + LastSectorCount) < DiskEntry->SectorCount.QuadPart)
1028 LastUnusedSectorCount =
AlignDown(DiskEntry->SectorCount.QuadPart - (LastStartSector + LastSectorCount), DiskEntry->SectorAlignment);
1030 if (LastUnusedSectorCount >= (
ULONGLONG)DiskEntry->SectorAlignment)
1032 DPRINT(
"Unpartitioned disk space: %I64u sectors\n", LastUnusedSectorCount);
1034 StartSector = LastStartSector + LastSectorCount;
1035 SectorCount =
AlignDown(StartSector + LastUnusedSectorCount, DiskEntry->SectorAlignment) - StartSector;
1039 &DiskEntry->PrimaryPartListHead,
1043 if (NewPartEntry ==
NULL)
1045 DPRINT1(
"Failed to create a new empty region for trailing disk space!\n");
1051 if (DiskEntry->ExtendedPartition !=
NULL)
1055 DPRINT1(
"No logical partition!\n");
1059 StartSector = DiskEntry->ExtendedPartition->StartSector.QuadPart + (
ULONGLONG)DiskEntry->SectorAlignment;
1060 SectorCount = DiskEntry->ExtendedPartition->SectorCount.QuadPart - (
ULONGLONG)DiskEntry->SectorAlignment;
1063 &DiskEntry->LogicalPartListHead,
1067 if (NewPartEntry ==
NULL)
1069 DPRINT1(
"Failed to create a new empty region for full extended partition space!\n");
1077 LastStartSector = DiskEntry->ExtendedPartition->StartSector.QuadPart + (
ULONGLONG)DiskEntry->SectorAlignment;
1078 LastSectorCount = 0
ULL;
1079 LastUnusedSectorCount = 0
ULL;
1081 for (
Entry = DiskEntry->LogicalPartListHead.Flink;
1082 Entry != &DiskEntry->LogicalPartListHead;
1090 LastUnusedSectorCount =
1094 LastUnusedSectorCount >= (
ULONGLONG)DiskEntry->SectorAlignment)
1096 DPRINT(
"Unpartitioned disk space %I64u sectors\n", LastUnusedSectorCount);
1098 StartSector = LastStartSector + LastSectorCount;
1099 SectorCount =
AlignDown(StartSector + LastUnusedSectorCount, DiskEntry->SectorAlignment) - StartSector;
1107 if (NewPartEntry ==
NULL)
1109 DPRINT1(
"Failed to create a new empty region for extended partition space!\n");
1120 if ((LastStartSector + LastSectorCount) < DiskEntry->ExtendedPartition->StartSector.QuadPart + DiskEntry->ExtendedPartition->SectorCount.QuadPart)
1122 LastUnusedSectorCount =
AlignDown(DiskEntry->ExtendedPartition->StartSector.QuadPart +
1123 DiskEntry->ExtendedPartition->SectorCount.QuadPart - (LastStartSector + LastSectorCount),
1124 DiskEntry->SectorAlignment);
1126 if (LastUnusedSectorCount >= (
ULONGLONG)DiskEntry->SectorAlignment)
1128 DPRINT(
"Unpartitioned disk space: %I64u sectors\n", LastUnusedSectorCount);
1130 StartSector = LastStartSector + LastSectorCount;
1131 SectorCount =
AlignDown(StartSector + LastUnusedSectorCount, DiskEntry->SectorAlignment) - StartSector;
1135 &DiskEntry->LogicalPartListHead,
1139 if (NewPartEntry ==
NULL)
1141 DPRINT1(
"Failed to create a new empty region for extended partition space!\n");
1148 DPRINT(
"ScanForUnpartitionedDiskSpace() done\n");
1165 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
1181 if (DiskEntry->LayoutBuffer->Signature == 0)
1192 Entry2 != &
List->DiskListHead;
1193 Entry2 = Entry2->
Flink)
1199 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
1203 if (DiskEntry != DiskEntry2 &&
1208 if (Entry2 == &
List->DiskListHead)
1230 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
1251 ULONG HwAdapterNumber = 0;
1252 ULONG HwControllerNumber = 0;
1253 ULONG RemovableDiskCount = 0;
1261 for (ListEntry =
List->BiosDiskListHead.
Flink;
1262 ListEntry != &
List->BiosDiskListHead;
1263 ListEntry = ListEntry->
Flink)
1277 RemovableDiskCount = 0;
1288 ++RemovableDiskCount;
1299 DPRINT1(
"BIOS disk %lu is not recognized by NTOS!\n", BiosDiskEntry->
DiskNumber);
1325 ULONG LayoutBufferSize;
1338 sizeof(DiskGeometry));
1362 sizeof(ScsiAddress));
1398 for (
i = 0;
i < 128;
i++)
1402 Checksum = ~Checksum + 1;
1413 if (DiskEntry ==
NULL)
1416 DPRINT1(
"Failed to allocate a new disk entry.\n");
1430 sizeof(FileFsDevice),
1434 DPRINT1(
"Couldn't detect device type for disk %lu of identifier '%S'...\n", DiskNumber,
Identifier);
1470 DiskEntry->
DiskStyle = PARTITION_STYLE_RAW;
1490 for (ListEntry =
List->BiosDiskListHead.
Flink;
1491 ListEntry != &
List->BiosDiskListHead;
1492 ListEntry = ListEntry->
Flink)
1502 BiosDiskEntry->
Checksum == Checksum &&
1529 DPRINT1(
"Disk %lu of identifier '%S' has already been found?!\n", DiskNumber,
Identifier);
1536 DPRINT1(
"WARNING: Setup could not find a matching BIOS disk entry. Disk %lu may not be bootable by the BIOS!\n", DiskNumber);
1598 DPRINT1(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
1610 DPRINT1(
"Failed to allocate the disk layout buffer!\n");
1617 DPRINT1(
"Buffer size: %lu\n", LayoutBufferSize);
1633 DPRINT1(
"NtDeviceIoControlFile() failed (Status: 0x%08lx)\n",
Status);
1642 if (NewLayoutBuffer ==
NULL)
1644 DPRINT1(
"Failed to reallocate the disk layout buffer!\n");
1653#ifdef DUMP_PARTITION_TABLE
1654 DumpPartitionTable(DiskEntry);
1658 DPRINT1(
"Disk %lu is a super-floppy\n", DiskNumber);
1679 DPRINT1(
"No valid partition table found! Use megabyte (%lu Sectors) alignment!\n", (1024 * 1024) / DiskEntry->
BytesPerSector);
1687 for (
i = 0;
i < 4;
i++)
1695 for (
i = 0;
i < 4;
i++)
1732 if (
List->SystemPartition)
1733 return List->SystemPartition->DiskEntry;
1756 DPRINT1(
"System disk -- GPT-partitioned disk detected, not currently supported by SETUP!\n");
1777 if (PartEntry->IsPartitioned &&
1779 PartEntry->BootIndicator)
1809 DPRINT1(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
1814 for (ListEntry = DiskEntry->PrimaryPartListHead.
Flink;
1815 ListEntry != &DiskEntry->PrimaryPartListHead;
1816 ListEntry = ListEntry->
Flink)
1826 ActivePartition = PartEntry;
1828 DPRINT1(
"Found active system partition %lu in disk %lu, drive letter %C\n",
1836 if (DiskEntry->NewDisk && ActivePartition !=
NULL)
1839 DPRINT1(
"NewDisk TRUE but already existing active partition?\n");
1843 return ActivePartition;
1885 DPRINT1(
"NtQuerySystemInformation() failed, Status 0x%08lx",
Status);
1890 for (DiskNumber = 0; DiskNumber < Sdi.
NumberOfDisks; DiskNumber++)
1893 L"\\Device\\Harddisk%lu\\Partition0",
2057 DiskEntry->
Bus == Bus &&
2058 DiskEntry->
Id ==
Id)
2106 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2111 for (
Entry = DiskEntry->PrimaryPartListHead.Flink;
2112 Entry != &DiskEntry->PrimaryPartListHead;
2125 for (
Entry = DiskEntry->LogicalPartListHead.Flink;
2126 Entry != &DiskEntry->LogicalPartListHead;
2163 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2174 *pDiskEntry = DiskEntry;
2175 if (pPartEntry) *pPartEntry = PartEntry;
2220 if (CurrentPart !=
NULL)
2224 if (CurrentPart->LogicalPartition)
2228 PartListEntry = CurrentPart->ListEntry.
Flink;
2249 if (CurrentPart->IsPartitioned &&
2263 PartListEntry = CurrentPart->ListEntry.
Flink;
2275 :
List->DiskListHead.Flink);
2276 DiskListEntry != &
List->DiskListHead;
2277 DiskListEntry = DiskListEntry->
Flink)
2283 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2312 if (CurrentPart !=
NULL)
2316 if (CurrentPart->LogicalPartition)
2320 PartListEntry = CurrentPart->ListEntry.
Blink;
2337 PartListEntry = CurrentPart->ListEntry.
Blink;
2342 if (CurrentPart->IsPartitioned &&
2356 :
List->DiskListHead.Blink);
2357 DiskListEntry != &
List->DiskListHead;
2358 DiskListEntry = DiskListEntry->
Blink)
2364 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2373 if (CurrentPart->IsPartitioned &&
2416 if (
PartitionInfo->StartingOffset.QuadPart == PartEntry->StartSector.QuadPart * DiskEntry->BytesPerSector &&
2417 PartitionInfo->PartitionLength.QuadPart == PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector)
2437 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2441 for (
Entry = DiskEntry->PrimaryPartListHead.Flink;
2442 Entry != &DiskEntry->PrimaryPartListHead;
2464 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2468 for (ListEntry = DiskEntry->LogicalPartListHead.
Flink;
2469 ListEntry != &DiskEntry->LogicalPartListHead;
2470 ListEntry = ListEntry->
Flink)
2486 ULONG NewPartitionCount;
2487 ULONG CurrentPartitionCount = 0;
2488 ULONG LayoutBufferSize;
2491 DPRINT1(
"ReAllocateLayoutBuffer()\n");
2495 if (DiskEntry->LayoutBuffer)
2496 CurrentPartitionCount = DiskEntry->LayoutBuffer->PartitionCount;
2498 DPRINT1(
"CurrentPartitionCount: %lu ; NewPartitionCount: %lu\n",
2499 CurrentPartitionCount, NewPartitionCount);
2501 if (CurrentPartitionCount == NewPartitionCount)
2508 DiskEntry->LayoutBuffer,
2510 if (NewLayoutBuffer ==
NULL)
2512 DPRINT1(
"Failed to allocate the new layout buffer (size: %lu)\n", LayoutBufferSize);
2519 if (NewPartitionCount > CurrentPartitionCount)
2521 for (
i = CurrentPartitionCount;
i < NewPartitionCount;
i++)
2527 DiskEntry->LayoutBuffer = NewLayoutBuffer;
2545 DPRINT1(
"UpdateDiskLayout()\n");
2549 DPRINT1(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2556 DPRINT(
"ReAllocateLayoutBuffer() failed.\n");
2562 for (ListEntry = DiskEntry->PrimaryPartListHead.
Flink;
2563 ListEntry != &DiskEntry->PrimaryPartListHead;
2564 ListEntry = ListEntry->
Flink)
2583 DPRINT1(
"Updating primary partition entry %lu\n",
Index);
2606 for (ListEntry = DiskEntry->LogicalPartListHead.
Flink;
2607 ListEntry != &DiskEntry->LogicalPartListHead;
2608 ListEntry = ListEntry->
Flink)
2625 DPRINT1(
"Updating logical partition entry %lu\n",
Index);
2637 if (LinkInfo !=
NULL)
2641 HiddenSectors64.
QuadPart = PartEntry->
StartSector.
QuadPart - DiskEntry->SectorAlignment - DiskEntry->ExtendedPartition->StartSector.QuadPart;
2651 LinkInfo = &DiskEntry->LayoutBuffer->PartitionEntry[
Index + 1];
2667 DPRINT1(
"Wiping primary partition entry %lu\n",
Index);
2681 for (
Index = 4;
Index < DiskEntry->LayoutBuffer->PartitionCount;
Index++)
2708 DiskEntry->Dirty =
TRUE;
2710#ifdef DUMP_PARTITION_TABLE
2711 DumpPartitionTable(DiskEntry);
2726 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2730 if (PartEntry->LogicalPartition)
2735 if (PartEntry->ListEntry.Blink != ListHead)
2743 return PrevPartEntry;
2761 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2765 if (PartEntry->LogicalPartition)
2770 if (PartEntry->ListEntry.Flink != ListHead)
2778 return NextPartEntry;
2797 PartEntry->DiskEntry ==
NULL || PartEntry->IsPartitioned)
2805 DPRINT1(
"PrimaryPartitionCreationChecks() failed with error %lu\n",
Error);
2830 DPRINT1(
"AddLogicalDiskSpace()\n");
2834 StartSector = DiskEntry->ExtendedPartition->StartSector.QuadPart + (
ULONGLONG)DiskEntry->SectorAlignment;
2835 SectorCount = DiskEntry->ExtendedPartition->SectorCount.QuadPart - (
ULONGLONG)DiskEntry->SectorAlignment;
2838 &DiskEntry->LogicalPartListHead,
2842 if (NewPartEntry ==
NULL)
2844 DPRINT1(
"Failed to create a new empty region for extended partition space!\n");
2860 PartEntry->DiskEntry ==
NULL || PartEntry->IsPartitioned)
2868 DPRINT1(
"ExtendedPartitionCreationChecks() failed with error %lu\n",
Error);
2878 if (PartEntry->StartSector.QuadPart < 1450560)
2890 PartEntry->New =
FALSE;
2893 PartEntry->DiskEntry->ExtendedPartition = PartEntry;
2915 PartEntry->DiskEntry ==
NULL || PartEntry->IsPartitioned)
2923 DPRINT1(
"LogicalPartitionCreationChecks() failed with error %lu\n",
Error);
2952 if (!PartEntry->IsPartitioned ||
2958 !*PartEntry->FileSystem ||
2959 PartEntry->PartitionNumber == 0)
2969 L"\\Device\\Harddisk%lu\\Partition%lu",
2970 PartEntry->DiskEntry->DiskNumber,
2971 PartEntry->PartitionNumber);
2988 DPRINT1(
"ERROR: Cannot open volume %wZ for dismounting! (Status 0x%lx)\n", &
Name,
Status);
3005 DPRINT1(
"WARNING: Failed to lock volume! Operations may fail! (Status 0x%lx)\n", LockStatus);
3021 DPRINT1(
"Failed to unmount volume (Status 0x%lx)\n",
Status);
3037 DPRINT1(
"Failed to unlock volume (Status 0x%lx)\n", LockStatus);
3059 PartEntry->DiskEntry ==
NULL || PartEntry->IsPartitioned ==
FALSE)
3067 if (
List->SystemPartition == PartEntry)
3073 DiskEntry = PartEntry->DiskEntry;
3105 if (PrevPartEntry !=
NULL && NextPartEntry !=
NULL)
3120 *FreeRegion = PrevPartEntry;
3122 else if (PrevPartEntry !=
NULL && NextPartEntry ==
NULL)
3135 *FreeRegion = PrevPartEntry;
3137 else if (PrevPartEntry ==
NULL && NextPartEntry !=
NULL)
3151 *FreeRegion = NextPartEntry;
3157 PartEntry->OnDiskPartitionNumber = 0;
3158 PartEntry->PartitionNumber = 0;
3160 PartEntry->BootIndicator =
FALSE;
3163 PartEntry->FileSystem[0] =
L'\0';
3164 PartEntry->DriveLetter = 0;
3165 RtlZeroMemory(PartEntry->VolumeLabel,
sizeof(PartEntry->VolumeLabel));
3169 *FreeRegion = PartEntry;
3191 DPRINT1(
"System partition %lu in disk %lu is an extended partition container?!\n",
3192 PartEntry->PartitionNumber, PartEntry->DiskEntry->DiskNumber);
3220 ASSERT(*PartEntry->FileSystem);
3223 if (
wcsicmp(PartEntry->FileSystem,
L"FAT") == 0 ||
3224 wcsicmp(PartEntry->FileSystem,
L"FAT32") == 0 ||
3226 wcsicmp(PartEntry->FileSystem,
L"BTRFS") == 0)
3233 DPRINT1(
"Recognized file system '%S' that doesn't have write support yet!\n",
3234 PartEntry->FileSystem);
3240 ASSERT(!*PartEntry->FileSystem);
3242 DPRINT1(
"System partition %lu in disk %lu with no or unknown FS?!\n",
3243 PartEntry->PartitionNumber, PartEntry->DiskEntry->DiskNumber);
3251 DPRINT1(
"Recognized file system '%S' that doesn't have write support yet!\n",
3252 PartEntry->FileSystem);
3277 goto NoSystemPartition;
3281 if (!AlternativeDisk && AlternativePart)
3282 AlternativeDisk = AlternativePart->DiskEntry;
3285 if (AlternativePart)
3286 ASSERT(AlternativeDisk && (AlternativePart->DiskEntry == AlternativeDisk));
3289 if (AlternativeDisk)
3293 CandidatePartition =
NULL;
3308 DPRINT1(
"System disk -- GPT-partitioned disk detected, not currently supported by SETUP!\n");
3309 goto UseAlternativeDisk;
3313 ActivePartition =
List->SystemPartition;
3316 CandidatePartition = ActivePartition;
3318 DPRINT1(
"Use the current system partition %lu in disk %lu, drive letter %C\n",
3320 CandidatePartition->
DiskEntry->DiskNumber,
3324 return CandidatePartition;
3328 if (DiskEntry != AlternativeDisk)
3337 ListEntry = ListEntry->
Flink)
3343 if (PartEntry == ActivePartition)
3355 CandidatePartition = PartEntry;
3356 goto UseAlternativePartition;
3367 CandidatePartition = PartEntry;
3368 goto UseAlternativePartition;
3387 ListEntry = ListEntry->
Flink)
3393 if (PartEntry == ActivePartition)
3402 CandidatePartition = PartEntry;
3403 goto UseAlternativePartition;
3415 if (!AlternativeDisk || (!ForceSelect && (DiskEntry != AlternativeDisk)))
3416 goto NoSystemPartition;
3420 DPRINT1(
"Alternative disk -- GPT-partitioned disk detected, not currently supported by SETUP!\n");
3421 goto NoSystemPartition;
3424 if (DiskEntry != AlternativeDisk)
3427 DiskEntry = AlternativeDisk;
3433 CandidatePartition = ActivePartition;
3434 goto UseAlternativePartition;
3453 CandidatePartition = PartEntry;
3467 DPRINT1(
"Use new first active system partition %lu in disk %lu, drive letter %C\n",
3469 CandidatePartition->
DiskEntry->DiskNumber,
3473 return CandidatePartition;
3477 DPRINT1(
"NewDisk TRUE but first partition is used?\n");
3486 ListEntry = ListEntry->
Flink)
3507 DPRINT1(
"Use first active system partition %lu in disk %lu, drive letter %C\n",
3509 CandidatePartition->
DiskEntry->DiskNumber,
3513 return CandidatePartition;
3521 if (AlternativePart)
3523 DPRINT1(
"No valid or supported system partition has been found, use the alternative partition!\n");
3524 CandidatePartition = AlternativePart;
3525 goto UseAlternativePartition;
3530 DPRINT1(
"No valid or supported system partition has been found on this system!\n");
3534UseAlternativePartition:
3543 ASSERT(CandidatePartition);
3545 DPRINT1(
"Use alternative active system partition %lu in disk %lu, drive letter %C\n",
3547 CandidatePartition->
DiskEntry->DiskNumber,
3551 return CandidatePartition;
3573 if ((PartEntry ==
List->SystemPartition) ||
3579 ASSERT(PartEntry->DiskEntry);
3582 ASSERT(PartEntry->DiskEntry->PartList ==
List);
3590 if (!(OldActivePart &&
IsPartitionActive(OldActivePart) && (OldActivePart->DiskEntry == PartEntry->DiskEntry)))
3599 OldActivePart->BootIndicator =
FALSE;
3600 OldActivePart->DiskEntry->LayoutBuffer->PartitionEntry[OldActivePart->PartitionIndex].BootIndicator =
FALSE;
3601 OldActivePart->DiskEntry->LayoutBuffer->PartitionEntry[OldActivePart->PartitionIndex].RewritePartition =
TRUE;
3602 OldActivePart->DiskEntry->Dirty =
TRUE;
3607 List->SystemPartition = PartEntry;
3610 PartEntry->BootIndicator =
TRUE;
3611 PartEntry->DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].BootIndicator =
TRUE;
3612 PartEntry->DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].RewritePartition =
TRUE;
3613 PartEntry->DiskEntry->Dirty =
TRUE;
3629 ULONG PartitionCount;
3634 DPRINT(
"WritePartitions() Disk: %lu\n", DiskEntry->DiskNumber);
3637 if (!DiskEntry->Dirty)
3641 L"\\Device\\Harddisk%lu\\Partition0",
3642 DiskEntry->DiskNumber);
3663#ifdef DUMP_PARTITION_TABLE
3664 DumpPartitionTable(DiskEntry);
3674 PartitionCount = DiskEntry->LayoutBuffer->PartitionCount;
3685 DiskEntry->LayoutBuffer,
3687 DiskEntry->LayoutBuffer,
3698 DiskEntry->LayoutBuffer->PartitionCount = PartitionCount;
3703 DPRINT1(
"IOCTL_DISK_SET_DRIVE_LAYOUT failed (Status 0x%08lx)\n",
Status);
3707#ifdef DUMP_PARTITION_TABLE
3708 DumpPartitionTable(DiskEntry);
3714 for (ListEntry = DiskEntry->PrimaryPartListHead.
Flink;
3715 ListEntry != &DiskEntry->PrimaryPartListHead;
3716 ListEntry = ListEntry->
Flink)
3729 for (ListEntry = DiskEntry->LogicalPartListHead.
Flink;
3730 ListEntry != &DiskEntry->LogicalPartListHead;
3731 ListEntry = ListEntry->
Flink)
3757 DiskEntry->Dirty =
FALSE;
3781 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
3790 DPRINT1(
"WritePartitionsToDisk() failed to update disk %lu, Status 0x%08lx\n",
3809 WCHAR ValueNameBuffer[16];
3814 L"\\DosDevices\\%c:",
Letter);
3873 Entry1 != &
List->DiskListHead;
3874 Entry1 = Entry1->
Flink)
3882 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
3888 Entry2 = Entry2->
Flink)
3911 Entry2 = Entry2->
Flink)
3961 DPRINT1(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
3966 if (PartEntry->IsPartitioned)
3988 DPRINT1(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
3993 if (PartEntry->IsPartitioned)
4019 DPRINT1(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
4024 if (PartEntry->IsPartitioned)
4045 Entry1 != &
List->DiskListHead;
4046 Entry1 = Entry1->
Flink)
4054 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
4060 Entry2 = Entry2->
Flink)
4066 if (pDiskEntry) *pDiskEntry = DiskEntry;
4067 *pPartEntry = PartEntry;
4074 Entry2 = Entry2->
Flink)
4080 if (pDiskEntry) *pDiskEntry = DiskEntry;
4081 *pPartEntry = PartEntry;
4087 if (pDiskEntry) *pDiskEntry =
NULL;
4104 Entry1 != &
List->DiskListHead;
4105 Entry1 = Entry1->
Flink)
4113 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
4119 Entry2 = Entry2->
Flink)
4125 if (pDiskEntry) *pDiskEntry = DiskEntry;
4126 *pPartEntry = PartEntry;
4133 Entry2 = Entry2->
Flink)
4139 if (pDiskEntry) *pDiskEntry = DiskEntry;
4140 *pPartEntry = PartEntry;
4146 if (pDiskEntry) *pDiskEntry =
NULL;
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
#define PARTITION_ENTRY_UNUSED
#define PARTITION_EXTENDED
#define PARTITION_XINT13_EXTENDED
#define PARTITION_FAT32_XINT13
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
_In_ PFCB _In_ LONGLONG FileOffset
_In_ PFCB _In_ LONGLONG StartingOffset
#define IOCTL_DISK_GET_DRIVE_GEOMETRY
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
static const WCHAR Signature[]
BOOLEAN RtlTimeToTimeFields(IN PLARGE_INTEGER Time, IN PTIME_FIELDS TimeFields)
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define RemoveHeadList(ListHead)
#define InitializeListHead(ListHead)
enum _ERROR_NUMBER ERROR_NUMBER
@ ERROR_ONLY_ONE_EXTENDED
@ ERROR_PARTITION_TABLE_FULL
@ SystemDeviceInformation
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
#define FILE_SYNCHRONOUS_IO_NONALERT
@ FileFsDeviceInformation
@ FileFsVolumeInformation
NTSTATUS InferFileSystem(IN PCWSTR PartitionPath OPTIONAL, IN HANDLE PartitionHandle OPTIONAL, IN OUT PWSTR FileSystemName, IN SIZE_T FileSystemNameSize)
UCHAR FileSystemToMBRPartitionType(IN PCWSTR FileSystem, IN ULONGLONG StartSector, IN ULONGLONG SectorCount)
union Alignment_ Alignment
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
_In_ GUID _In_ PVOID ValueData
struct _CM_FULL_RESOURCE_DESCRIPTOR * PCM_FULL_RESOURCE_DESCRIPTOR
#define CmResourceTypeDeviceSpecific
#define OBJ_CASE_INSENSITIVE
NTSYSAPI PVOID WINAPI RtlReAllocateHeap(HANDLE, ULONG, PVOID, SIZE_T)
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
struct _PARTLIST * PPARTLIST
struct _BIOSDISKENTRY * PBIOSDISKENTRY
#define EFI_PMBR_OSTYPE_EFI
#define InsertAscendingList(ListHead, NewEntry, Type, ListEntryField, SortField)
#define memcpy(s1, s2, n)
static OUT PIO_STATUS_BLOCK IoStatusBlock
#define InitializeObjectAttributes(p, n, a, r, s)
static PTIME_FIELDS TimeFields
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
_In_ PCWSTR _Inout_ _At_ QueryTable EntryContext
_In_ PCWSTR _Inout_ _At_ QueryTable _Pre_unknown_ PRTL_QUERY_REGISTRY_TABLE QueryTable
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
#define FSCTL_LOCK_VOLUME
#define FILE_READ_ATTRIBUTES
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RTL_REGISTRY_ABSOLUTE
#define REG_OPTION_NON_VOLATILE
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
#define RTL_REGISTRY_DEVICEMAP
#define RTL_QUERY_REGISTRY_DIRECT
#define FSCTL_UNLOCK_VOLUME
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define FSCTL_DISMOUNT_VOLUME
NTSYSAPI NTSTATUS NTAPI NtFsControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
#define REG_FULL_RESOURCE_DESCRIPTOR
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
#define IOCTL_DISK_SET_DRIVE_LAYOUT
#define IsContainerPartition(PartitionType)
#define IsRecognizedPartition(PartitionType)
#define IOCTL_DISK_GET_DRIVE_LAYOUT
struct _PARTITION_INFORMATION PARTITION_INFORMATION
struct _DRIVE_LAYOUT_INFORMATION DRIVE_LAYOUT_INFORMATION
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
NTSTRSAFEAPI RtlStringCbCopyNW(_Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc, _In_ size_t cbToCopy)
struct _FILE_FS_VOLUME_INFORMATION * PFILE_FS_VOLUME_INFORMATION
struct _FILE_FS_VOLUME_INFORMATION FILE_FS_VOLUME_INFORMATION
#define IOCTL_SCSI_GET_ADDRESS
static BOOLEAN InitializePartitionEntry(IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount, IN BOOLEAN AutoCreate)
VOID DestroyPartitionList(IN PPARTLIST List)
static VOID AddPartitionToDisk(IN ULONG DiskNumber, IN PDISKENTRY DiskEntry, IN ULONG PartitionIndex, IN BOOLEAN LogicalPartition)
ERROR_NUMBER PrimaryPartitionCreationChecks(IN PPARTENTRY PartEntry)
PPARTENTRY SelectPartition(IN PPARTLIST List, IN ULONG DiskNumber, IN ULONG PartitionNumber)
static VOID GetDriverName(IN PDISKENTRY DiskEntry)
struct _REG_DISK_MOUNT_INFO * PREG_DISK_MOUNT_INFO
BOOLEAN SetMountedDeviceValues(IN PPARTLIST List)
static PDISKENTRY GetSystemDisk(IN PPARTLIST List)
BOOLEAN GetDiskOrPartition(IN PPARTLIST List, IN ULONG DiskNumber, IN ULONG PartitionNumber OPTIONAL, OUT PDISKENTRY *pDiskEntry, OUT PPARTENTRY *pPartEntry OPTIONAL)
ULONGLONG AlignUp(IN ULONGLONG Value, IN ULONG Alignment)
static ULONG GetPrimaryPartitionCount(IN PDISKENTRY DiskEntry)
static VOID UpdateDiskLayout(IN PDISKENTRY DiskEntry)
BOOLEAN WritePartitionsToDisk(IN PPARTLIST List)
PPARTENTRY GetPartition(IN PDISKENTRY DiskEntry, IN ULONG PartitionNumber)
PDISKENTRY GetDiskByNumber(IN PPARTLIST List, IN ULONG DiskNumber)
ULONGLONG RoundingDivide(IN ULONGLONG Dividend, IN ULONGLONG Divisor)
VOID SetMBRPartitionType(IN PPARTENTRY PartEntry, IN UCHAR PartitionType)
static VOID AssignDriveLetters(IN PPARTLIST List)
ERROR_NUMBER LogicalPartitionCreationChecks(IN PPARTENTRY PartEntry)
PPARTENTRY GetPrevPartition(IN PPARTLIST List, IN PPARTENTRY CurrentPart OPTIONAL)
ULONGLONG AlignDown(IN ULONGLONG Value, IN ULONG Alignment)
BOOLEAN GetNextUncheckedPartition(IN PPARTLIST List, OUT PDISKENTRY *pDiskEntry OPTIONAL, OUT PPARTENTRY *pPartEntry)
BOOLEAN DeletePartition(IN PPARTLIST List, IN PPARTENTRY PartEntry, OUT PPARTENTRY *FreeRegion OPTIONAL)
BOOLEAN IsSuperFloppy(IN PDISKENTRY DiskEntry)
static VOID AddLogicalDiskSpace(IN PDISKENTRY DiskEntry)
static PPARTENTRY GetPrevUnpartitionedEntry(IN PPARTENTRY PartEntry)
static VOID SetDiskSignature(IN PPARTLIST List, IN PDISKENTRY DiskEntry)
BOOLEAN CreateLogicalPartition(IN PPARTLIST List, IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount, IN BOOLEAN AutoCreate)
static PPARTENTRY GetNextUnpartitionedEntry(IN PPARTENTRY PartEntry)
static ULONG GetLogicalPartitionCount(IN PDISKENTRY DiskEntry)
static NTSTATUS NTAPI DiskConfigurationDataQueryRoutine(PWSTR ValueName, ULONG ValueType, PVOID ValueData, ULONG ValueLength, PVOID Context, PVOID EntryContext)
PPARTLIST CreatePartitionList(VOID)
ERROR_NUMBER ExtendedPartitionCreationChecks(IN PPARTENTRY PartEntry)
BOOLEAN CreateExtendedPartition(IN PPARTLIST List, IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount)
PPARTENTRY GetNextPartition(IN PPARTLIST List, IN PPARTENTRY CurrentPart OPTIONAL)
static VOID AddDiskToList(IN HANDLE FileHandle, IN ULONG DiskNumber, IN PPARTLIST List)
static VOID ScanForUnpartitionedDiskSpace(IN PDISKENTRY DiskEntry)
static NTSTATUS NTAPI SystemConfigurationDataQueryRoutine(PWSTR ValueName, ULONG ValueType, PVOID ValueData, ULONG ValueLength, PVOID Context, PVOID EntryContext)
BOOLEAN IsPartitionActive(IN PPARTENTRY PartEntry)
PDISKENTRY GetDiskByBiosNumber(IN PPARTLIST List, IN ULONG HwDiskNumber)
static VOID UpdateDiskSignatures(IN PPARTLIST List)
BOOLEAN SetActivePartition(IN PPARTLIST List, IN PPARTENTRY PartEntry, IN PPARTENTRY OldActivePart OPTIONAL)
static VOID EnumerateBiosDiskEntries(IN PPARTLIST PartList)
static PPARTENTRY CreateInsertBlankRegion(IN PDISKENTRY DiskEntry, IN OUT PLIST_ENTRY ListHead, IN ULONGLONG StartSector, IN ULONGLONG SectorCount, IN BOOLEAN LogicalSpace)
FORCEINLINE BOOLEAN IsEmptyLayoutEntry(IN PPARTITION_INFORMATION PartitionInfo)
static PPARTENTRY GetActiveDiskPartition(IN PDISKENTRY DiskEntry)
BOOLEAN GetNextUnformattedPartition(IN PPARTLIST List, OUT PDISKENTRY *pDiskEntry OPTIONAL, OUT PPARTENTRY *pPartEntry)
struct _REG_DISK_MOUNT_INFO REG_DISK_MOUNT_INFO
FORCEINLINE BOOLEAN IsSamePrimaryLayoutEntry(IN PPARTITION_INFORMATION PartitionInfo, IN PDISKENTRY DiskEntry, IN PPARTENTRY PartEntry)
BOOLEAN CreatePrimaryPartition(IN PPARTLIST List, IN OUT PPARTENTRY PartEntry, IN ULONGLONG SectorCount, IN BOOLEAN AutoCreate)
static BOOLEAN InsertDiskRegion(IN PDISKENTRY DiskEntry, IN PPARTENTRY PartEntry, IN BOOLEAN LogicalPartition)
BOOLEAN SetMountedDeviceValue(IN WCHAR Letter, IN ULONG Signature, IN LARGE_INTEGER StartingOffset)
static VOID UpdateHwDiskNumbers(IN PPARTLIST List)
static BOOLEAN ReAllocateLayoutBuffer(IN PDISKENTRY DiskEntry)
PPARTENTRY FindSupportedSystemPartition(IN PPARTLIST List, IN BOOLEAN ForceSelect, IN PDISKENTRY AlternativeDisk OPTIONAL, IN PPARTENTRY AlternativePart OPTIONAL)
static BOOLEAN IsSupportedActivePartition(IN PPARTENTRY PartEntry)
PDISKENTRY GetDiskBySignature(IN PPARTLIST List, IN ULONG Signature)
NTSTATUS DismountVolume(IN PPARTENTRY PartEntry)
static NTSTATUS NTAPI DiskIdentifierQueryRoutine(PWSTR ValueName, ULONG ValueType, PVOID ValueData, ULONG ValueLength, PVOID Context, PVOID EntryContext)
NTSTATUS WritePartitions(IN PDISKENTRY DiskEntry)
PDISKENTRY GetDiskBySCSI(IN PPARTLIST List, IN USHORT Port, IN USHORT Bus, IN USHORT Id)
NTSTATUS NTAPI NtQueryVolumeInformationFile(HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock, PVOID FsInformation, ULONG Length, FS_INFORMATION_CLASS FsInformationClass)
#define STATUS_BUFFER_TOO_SMALL
NTSTATUS NTAPI NtReadFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key)
PULONG MinorVersion OPTIONAL
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
base of all file and directory entries
CM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry
CM_PARTIAL_RESOURCE_LIST PartialResourceList
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@382::@391 DeviceSpecificData
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@382 u
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
ULARGE_INTEGER SectorCount
UNICODE_STRING DriverName
PPARTENTRY ExtendedPartition
LIST_ENTRY LogicalPartListHead
struct _PARTLIST * PartList
PARTITION_STYLE DiskStyle
LIST_ENTRY PrimaryPartListHead
PDRIVE_LAYOUT_INFORMATION LayoutBuffer