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)
179 Entry1 != &
List->DiskListHead;
180 Entry1 = Entry1->
Flink)
186 Entry2 = Entry2->
Flink)
313 if (*Int13Drives ==
NULL)
339#define ROOT_NAME L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter"
347 L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System",
353 DPRINT1(
"Unable to query the 'Configuration Data' key in '\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System', status=%lx\n",
Status);
357 for (AdapterCount = 0; ; ++AdapterCount)
373 L"%s\\%lu\\DiskController",
385 L"%s\\%lu\\DiskController\\%lu",
399 L"%s\\%lu\\DiskController\\%lu\\DiskPeripheral",
413 for (DiskCount = 0; ; ++DiskCount)
416 if (BiosDiskEntry ==
NULL)
423 L"%s\\%lu\\DiskController\\%lu\\DiskPeripheral\\%lu",
428 (
PVOID)BiosDiskEntry,
437 BiosDiskEntry->AdapterNumber = 0;
439 BiosDiskEntry->DiskNumber = DiskCount;
440 BiosDiskEntry->DiskEntry =
NULL;
442 if (DiskCount < Int13Drives[0].NumberDrives)
444 BiosDiskEntry->Int13DiskData = Int13Drives[DiskCount];
448 DPRINT1(
"Didn't find Int13 drive data for disk %u\n", DiskCount);
451 InsertTailList(&PartList->BiosDiskListHead, &BiosDiskEntry->ListEntry);
454 DPRINT(
"AdapterNumber: %lu\n", BiosDiskEntry->AdapterNumber);
455 DPRINT(
"ControllerNumber: %lu\n", BiosDiskEntry->ControllerNumber);
456 DPRINT(
"DiskNumber: %lu\n", BiosDiskEntry->DiskNumber);
457 DPRINT(
"Signature: %08lx\n", BiosDiskEntry->Signature);
458 DPRINT(
"Checksum: %08lx\n", BiosDiskEntry->Checksum);
459 DPRINT(
"BytesPerSector: %lu\n", BiosDiskEntry->DiskGeometry.BytesPerSector);
460 DPRINT(
"NumberOfCylinders: %lu\n", BiosDiskEntry->DiskGeometry.NumberOfCylinders);
461 DPRINT(
"NumberOfHeads: %lu\n", BiosDiskEntry->DiskGeometry.NumberOfHeads);
462 DPRINT(
"DriveSelect: %02x\n", BiosDiskEntry->Int13DiskData.DriveSelect);
463 DPRINT(
"MaxCylinders: %lu\n", BiosDiskEntry->Int13DiskData.MaxCylinders);
464 DPRINT(
"SectorsPerTrack: %d\n", BiosDiskEntry->Int13DiskData.SectorsPerTrack);
465 DPRINT(
"MaxHeads: %d\n", BiosDiskEntry->Int13DiskData.MaxHeads);
466 DPRINT(
"NumberDrives: %d\n", BiosDiskEntry->Int13DiskData.NumberDrives);
492 _In_ const DISK_PARTITION_INFO* DiskInfo,
512 if (DiskInfo->Mbr.Signature != 1)
514 DPRINT1(
"Super-Floppy signature %08x != 1\n", DiskInfo->Mbr.Signature);
522 DPRINT1(
"Super-Floppy does not return default settings:\n"
523 " RecognizedPartition = %s, expected TRUE\n"
524 " PartitionType = 0x%02x, expected 0x04 (PARTITION_FAT_16)\n"
525 " BootIndicator = %s, expected FALSE\n",
532 if (DiskSize && (
PartitionInfo->PartitionLength.QuadPart != *DiskSize))
534 DPRINT1(
"PartitionLength = %I64u is different from DiskSize = %I64u\n",
546 DISK_PARTITION_INFO DiskInfo;
549 if (Layout->PartitionCount != 1)
555 DiskInfo.Mbr.Signature = Layout->Signature;
556 DiskInfo.Mbr.CheckSum = 0;
564 _In_ const DRIVE_LAYOUT_INFORMATION_EX* LayoutEx,
567 DISK_PARTITION_INFO DiskInfo;
574 if (LayoutEx->PartitionCount != 1)
580 DiskInfo.Mbr.Signature = LayoutEx->Mbr.Signature;
581 DiskInfo.Mbr.CheckSum = 0;
584 PartitionInfoEx = LayoutEx->PartitionEntry;
606 if (!DiskEntry->LayoutBuffer)
637 List = &DiskEntry->LogicalPartListHead;
639 List = &DiskEntry->PrimaryPartListHead;
666 min( PartEntry->StartSector.QuadPart + PartEntry->SectorCount.QuadPart - 1,
669 DPRINT1(
"Disk region overlap problem, stopping there!\n"
670 "Partition to be inserted:\n"
671 " StartSector = %I64u ; EndSector = %I64u\n"
672 "Existing disk region:\n"
673 " StartSector = %I64u ; EndSector = %I64u\n",
674 PartEntry->StartSector.QuadPart,
675 PartEntry->StartSector.QuadPart + PartEntry->SectorCount.QuadPart - 1,
733 if (PartEntry->Volume)
747 DPRINT(
"AddLogicalDiskSpace()\n");
751 StartSector = DiskEntry->ExtendedPartition->StartSector.QuadPart + (
ULONGLONG)DiskEntry->SectorAlignment;
752 SectorCount = DiskEntry->ExtendedPartition->SectorCount.QuadPart - (
ULONGLONG)DiskEntry->SectorAlignment;
755 &DiskEntry->LogicalPartListHead,
760 DPRINT1(
"Failed to create a new empty region for full extended partition space!\n");
779 DPRINT1(
"Current entry sector count: %I64u\n", PartEntry->SectorCount.QuadPart);
782 ASSERT(!PartEntry->IsPartitioned);
783 ASSERT(PartEntry->SectorCount.QuadPart);
784 ASSERT(!PartEntry->Volume);
788 ASSERT(!isContainer || !PartEntry->LogicalPartition);
803 DPRINT1(
"Partition size %I64u too small\n", SizeBytes);
815 PartEntry->StartSector.QuadPart == PartEntry->SectorCount.QuadPart))
829 SectorCount2 = PartEntry->StartSector.QuadPart + PartEntry->SectorCount.QuadPart - StartSector;
835 PartEntry->LogicalPartition);
838 DPRINT1(
"Failed to create a new empty region for disk space!\n");
843 PartEntry->SectorCount.QuadPart = StartSector - PartEntry->StartSector.QuadPart;
847 PartEntry->New =
TRUE;
848 PartEntry->IsPartitioned =
TRUE;
850 PartEntry->BootIndicator =
FALSE;
864 if ((PartEntry->StartSector.QuadPart + PartEntry->SectorCount.QuadPart - 1)
880 PartEntry->StartSector.QuadPart,
881 PartEntry->SectorCount.QuadPart);
891 DPRINT1(
"First Sector : %I64u\n", PartEntry->StartSector.QuadPart);
892 DPRINT1(
"Last Sector : %I64u\n", PartEntry->StartSector.QuadPart + PartEntry->SectorCount.QuadPart - 1);
893 DPRINT1(
"Total Sectors: %I64u\n", PartEntry->SectorCount.QuadPart);
908 ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
913 L"\\Device\\Harddisk%lu\\Partition%lu",
914 PartEntry->DiskEntry->DiskNumber,
915 PartEntry->PartitionNumber);
928 if (*
Volume->Info.DeviceName)
933 PartEntry =
Volume->PartEntry;
976 ASSERT(PartEntry->DiskEntry->PartList ==
List);
977 Volume->PartEntry = PartEntry;
994 PartitionInfo = &DiskEntry->LayoutBuffer->PartitionEntry[PartitionIndex];
1029 DiskEntry->ExtendedPartition = PartEntry;
1044 DPRINT1(
"Couldn't allocate a volume for device '%S'\n",
1056 DPRINT1(
"Failed to mount volume '%S', Status 0x%08lx\n",
1085 DPRINT1(
"Disk %lu Partition %lu is not recognized (Type 0x%02x)\n",
1107 DPRINT(
"ScanForUnpartitionedDiskSpace()\n");
1111 DPRINT1(
"No primary partition!\n");
1115 if (DiskEntry->SectorAlignment < 2048)
1116 StartSector = 2048ULL;
1118 StartSector = (
ULONGLONG)DiskEntry->SectorAlignment;
1119 SectorCount =
AlignDown(DiskEntry->SectorCount.QuadPart, DiskEntry->SectorAlignment) - StartSector;
1122 &DiskEntry->PrimaryPartListHead,
1127 DPRINT1(
"Failed to create a new empty region for full disk space!\n");
1133 if (DiskEntry->SectorAlignment < 2048)
1134 LastStartSector = 2048ULL;
1136 LastStartSector = (
ULONGLONG)DiskEntry->SectorAlignment;
1137 LastSectorCount = 0
ULL;
1138 LastUnusedSectorCount = 0
ULL;
1140 for (
Entry = DiskEntry->PrimaryPartListHead.Flink;
1141 Entry != &DiskEntry->PrimaryPartListHead;
1149 LastUnusedSectorCount =
1153 LastUnusedSectorCount >= (
ULONGLONG)DiskEntry->SectorAlignment)
1155 DPRINT(
"Unpartitioned disk space %I64u sectors\n", LastUnusedSectorCount);
1157 StartSector = LastStartSector + LastSectorCount;
1158 SectorCount =
AlignDown(StartSector + LastUnusedSectorCount, DiskEntry->SectorAlignment) - StartSector;
1168 DPRINT1(
"Failed to create a new empty region for disk space!\n");
1179 if ((LastStartSector + LastSectorCount) < DiskEntry->SectorCount.QuadPart)
1181 LastUnusedSectorCount =
AlignDown(DiskEntry->SectorCount.QuadPart - (LastStartSector + LastSectorCount), DiskEntry->SectorAlignment);
1183 if (LastUnusedSectorCount >= (
ULONGLONG)DiskEntry->SectorAlignment)
1185 DPRINT(
"Unpartitioned disk space: %I64u sectors\n", LastUnusedSectorCount);
1187 StartSector = LastStartSector + LastSectorCount;
1188 SectorCount =
AlignDown(StartSector + LastUnusedSectorCount, DiskEntry->SectorAlignment) - StartSector;
1192 &DiskEntry->PrimaryPartListHead,
1198 DPRINT1(
"Failed to create a new empty region for trailing disk space!\n");
1204 if (DiskEntry->ExtendedPartition !=
NULL)
1208 DPRINT1(
"No logical partition!\n");
1216 LastStartSector = DiskEntry->ExtendedPartition->StartSector.QuadPart + (
ULONGLONG)DiskEntry->SectorAlignment;
1217 LastSectorCount = 0
ULL;
1218 LastUnusedSectorCount = 0
ULL;
1220 for (
Entry = DiskEntry->LogicalPartListHead.Flink;
1221 Entry != &DiskEntry->LogicalPartListHead;
1229 LastUnusedSectorCount =
1233 LastUnusedSectorCount >= (
ULONGLONG)DiskEntry->SectorAlignment)
1235 DPRINT(
"Unpartitioned disk space %I64u sectors\n", LastUnusedSectorCount);
1237 StartSector = LastStartSector + LastSectorCount;
1238 SectorCount =
AlignDown(StartSector + LastUnusedSectorCount, DiskEntry->SectorAlignment) - StartSector;
1248 DPRINT1(
"Failed to create a new empty region for extended partition space!\n");
1259 if ((LastStartSector + LastSectorCount) < DiskEntry->ExtendedPartition->StartSector.QuadPart + DiskEntry->ExtendedPartition->SectorCount.QuadPart)
1261 LastUnusedSectorCount =
AlignDown(DiskEntry->ExtendedPartition->StartSector.QuadPart +
1262 DiskEntry->ExtendedPartition->SectorCount.QuadPart - (LastStartSector + LastSectorCount),
1263 DiskEntry->SectorAlignment);
1265 if (LastUnusedSectorCount >= (
ULONGLONG)DiskEntry->SectorAlignment)
1267 DPRINT(
"Unpartitioned disk space: %I64u sectors\n", LastUnusedSectorCount);
1269 StartSector = LastStartSector + LastSectorCount;
1270 SectorCount =
AlignDown(StartSector + LastUnusedSectorCount, DiskEntry->SectorAlignment) - StartSector;
1274 &DiskEntry->LogicalPartListHead,
1280 DPRINT1(
"Failed to create a new empty region for extended partition space!\n");
1287 DPRINT(
"ScanForUnpartitionedDiskSpace() done\n");
1304 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
1320 if (DiskEntry->LayoutBuffer->Signature == 0)
1331 Entry2 != &
List->DiskListHead;
1332 Entry2 = Entry2->
Flink)
1338 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
1342 if (DiskEntry != DiskEntry2 &&
1347 if (Entry2 == &
List->DiskListHead)
1369 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
1390 ULONG HwAdapterNumber = 0;
1391 ULONG HwControllerNumber = 0;
1392 ULONG RemovableDiskCount = 0;
1400 for (ListEntry =
List->BiosDiskListHead.
Flink;
1401 ListEntry != &
List->BiosDiskListHead;
1402 ListEntry = ListEntry->
Flink)
1416 RemovableDiskCount = 0;
1427 ++RemovableDiskCount;
1438 DPRINT1(
"BIOS disk %lu is not recognized by NTOS!\n", BiosDiskEntry->
DiskNumber);
1464 ULONG LayoutBufferSize;
1477 sizeof(DiskGeometry));
1501 sizeof(ScsiAddress));
1537 for (
i = 0;
i < 128;
i++)
1541 Checksum = ~Checksum + 1;
1552 if (DiskEntry ==
NULL)
1555 DPRINT1(
"Failed to allocate a new disk entry.\n");
1569 sizeof(FileFsDevice),
1573 DPRINT1(
"Couldn't detect device type for disk %lu of identifier '%S'...\n", DiskNumber,
Identifier);
1609 DiskEntry->
DiskStyle = PARTITION_STYLE_RAW;
1629 for (ListEntry =
List->BiosDiskListHead.
Flink;
1630 ListEntry != &
List->BiosDiskListHead;
1631 ListEntry = ListEntry->
Flink)
1641 BiosDiskEntry->
Checksum == Checksum &&
1668 DPRINT1(
"Disk %lu of identifier '%S' has already been found?!\n", DiskNumber,
Identifier);
1675 DPRINT1(
"WARNING: Setup could not find a matching BIOS disk entry. Disk %lu may not be bootable by the BIOS!\n", DiskNumber);
1737 DPRINT1(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
1749 DPRINT1(
"Failed to allocate the disk layout buffer!\n");
1756 DPRINT1(
"Buffer size: %lu\n", LayoutBufferSize);
1772 DPRINT1(
"NtDeviceIoControlFile() failed (Status: 0x%08lx)\n",
Status);
1781 if (NewLayoutBuffer ==
NULL)
1783 DPRINT1(
"Failed to reallocate the disk layout buffer!\n");
1792#ifdef DUMP_PARTITION_TABLE
1793 DumpPartitionTable(DiskEntry);
1797 DPRINT1(
"Disk %lu is a super-floppy\n", DiskNumber);
1818 DPRINT1(
"No valid partition table found! Use megabyte (%lu Sectors) alignment!\n", (1024 * 1024) / DiskEntry->
BytesPerSector);
1826 for (
i = 0;
i < 4;
i++)
1834 for (
i = 0;
i < 4;
i++)
1871 if (
List->SystemPartition)
1872 return List->SystemPartition->DiskEntry;
1895 DPRINT1(
"System disk -- GPT-partitioned disk detected, not currently supported by SETUP!\n");
1916 if (PartEntry->IsPartitioned &&
1918 PartEntry->BootIndicator)
1948 DPRINT1(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
1953 for (ListEntry = DiskEntry->PrimaryPartListHead.
Flink;
1954 ListEntry != &DiskEntry->PrimaryPartListHead;
1955 ListEntry = ListEntry->
Flink)
1966 ActivePartition = PartEntry;
1968 DPRINT1(
"Found active system partition %lu in disk %lu, drive letter %C\n",
1976 if (DiskEntry->NewDisk && ActivePartition !=
NULL)
1979 DPRINT1(
"NewDisk TRUE but already existing active partition?\n");
1983 return ActivePartition;
2027 DPRINT1(
"NtQuerySystemInformation() failed, Status 0x%08lx\n",
Status);
2032 for (DiskNumber = 0; DiskNumber < Sdi.
NumberOfDisks; DiskNumber++)
2035 L"\\Device\\Harddisk%lu\\Partition0",
2191 DiskEntry->
Bus == Bus &&
2192 DiskEntry->
Id ==
Id)
2239 for (
Entry = DiskEntry->PrimaryPartListHead.Flink;
2240 Entry != &DiskEntry->PrimaryPartListHead;
2253 for (
Entry = DiskEntry->LogicalPartListHead.Flink;
2254 Entry != &DiskEntry->LogicalPartListHead;
2307 if (CurrentPart !=
NULL)
2311 if (CurrentPart->LogicalPartition)
2315 PartListEntry = CurrentPart->ListEntry.
Flink;
2336 if (CurrentPart->IsPartitioned &&
2350 PartListEntry = CurrentPart->ListEntry.
Flink;
2362 :
List->DiskListHead.Flink);
2363 DiskListEntry != &
List->DiskListHead;
2364 DiskListEntry = DiskListEntry->
Flink)
2370 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2400 if (CurrentPart !=
NULL)
2404 if (CurrentPart->LogicalPartition)
2408 PartListEntry = CurrentPart->ListEntry.
Blink;
2425 PartListEntry = CurrentPart->ListEntry.
Blink;
2430 if (CurrentPart->IsPartitioned &&
2444 :
List->DiskListHead.Blink);
2445 DiskListEntry != &
List->DiskListHead;
2446 DiskListEntry = DiskListEntry->
Blink)
2452 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2461 if (CurrentPart->IsPartitioned &&
2515 for (
Entry = PartListHead->Flink;
2516 Entry != PartListHead;
2527#define GetPrimaryPartitionCount(DiskEntry) \
2528 GetPartitionCount(&(DiskEntry)->PrimaryPartListHead)
2530#define GetLogicalPartitionCount(DiskEntry) \
2531 (((DiskEntry)->DiskStyle == PARTITION_STYLE_MBR) \
2532 ? GetPartitionCount(&(DiskEntry)->LogicalPartListHead) : 0)
2541 ULONG NewPartitionCount;
2542 ULONG CurrentPartitionCount = 0;
2543 ULONG LayoutBufferSize;
2546 DPRINT1(
"ReAllocateLayoutBuffer()\n");
2550 if (DiskEntry->LayoutBuffer)
2551 CurrentPartitionCount = DiskEntry->LayoutBuffer->PartitionCount;
2553 DPRINT1(
"CurrentPartitionCount: %lu ; NewPartitionCount: %lu\n",
2554 CurrentPartitionCount, NewPartitionCount);
2556 if (CurrentPartitionCount == NewPartitionCount)
2563 DiskEntry->LayoutBuffer,
2565 if (NewLayoutBuffer ==
NULL)
2567 DPRINT1(
"Failed to allocate the new layout buffer (size: %lu)\n", LayoutBufferSize);
2574 if (NewPartitionCount > CurrentPartitionCount)
2576 for (
i = CurrentPartitionCount;
i < NewPartitionCount;
i++)
2582 DiskEntry->LayoutBuffer = NewLayoutBuffer;
2600 DPRINT1(
"UpdateDiskLayout()\n");
2604 DPRINT1(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2611 DPRINT(
"ReAllocateLayoutBuffer() failed.\n");
2617 for (ListEntry = DiskEntry->PrimaryPartListHead.
Flink;
2618 ListEntry != &DiskEntry->PrimaryPartListHead;
2619 ListEntry = ListEntry->
Flink)
2638 DPRINT1(
"Updating primary partition entry %lu\n",
Index);
2662 for (ListEntry = DiskEntry->LogicalPartListHead.
Flink;
2663 ListEntry != &DiskEntry->LogicalPartListHead;
2664 ListEntry = ListEntry->
Flink)
2681 DPRINT1(
"Updating logical partition entry %lu\n",
Index);
2697 HiddenSectors64.
QuadPart = PartEntry->
StartSector.
QuadPart - DiskEntry->SectorAlignment - DiskEntry->ExtendedPartition->StartSector.QuadPart;
2712 LinkInfo = &DiskEntry->LayoutBuffer->PartitionEntry[
Index + 1];
2728 DPRINT1(
"Wiping primary partition entry %lu\n",
Index);
2742 for (
Index = 4;
Index < DiskEntry->LayoutBuffer->PartitionCount;
Index++)
2769 DiskEntry->Dirty =
TRUE;
2771#ifdef DUMP_PARTITION_TABLE
2772 DumpPartitionTable(DiskEntry);
2800 PartEntry->LogicalPartition)
2810 AdjEntry = PartEntry->ListEntry.
Flink;
2812 AdjEntry = PartEntry->ListEntry.
Blink;
2814 if (AdjEntry != ListHead)
2817 if (!PartEntry->IsPartitioned)
2837 ASSERT(!PartEntry->IsPartitioned);
2842 if (PartEntry->LogicalPartition)
2853 if (!PartEntry->LogicalPartition || isContainer)
2889 if (PartEntry->IsPartitioned)
2899 DPRINT1(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2919 PCSTR mainType =
"Primary";
2922 mainType =
"Extended";
2923 else if (PartEntry && PartEntry->LogicalPartition)
2924 mainType =
"Logical";
2926 DPRINT1(
"CreatePartition(%s, %I64u bytes)\n", mainType, SizeBytes);
2928 if (!
List || !PartEntry ||
2929 !PartEntry->DiskEntry || PartEntry->IsPartitioned)
2937 DPRINT1(
"PartitionCreateChecks(%s) failed with error %lu\n", mainType,
Error);
2945 DiskEntry = PartEntry->DiskEntry;
2948 ASSERT(!PartEntry->Volume);
2956 ASSERT(PartEntry->Volume);
2972 ASSERT(PartEntry->DiskEntry->PartList ==
List);
2975 if (!PartEntry->IsPartitioned ||
2981 PartEntry->PartitionNumber == 0)
2991 PartEntry->Volume =
NULL;
3012 if (!
List || !PartEntry ||
3013 !PartEntry->DiskEntry || !PartEntry->IsPartitioned)
3018 ASSERT(PartEntry->DiskEntry->PartList ==
List);
3022 if (
List->SystemPartition == PartEntry)
3028 DiskEntry = PartEntry->DiskEntry;
3058 if (PrevPartEntry !=
NULL && NextPartEntry !=
NULL)
3073 *FreeRegion = PrevPartEntry;
3075 else if (PrevPartEntry !=
NULL && NextPartEntry ==
NULL)
3088 *FreeRegion = PrevPartEntry;
3090 else if (PrevPartEntry ==
NULL && NextPartEntry !=
NULL)
3104 *FreeRegion = NextPartEntry;
3110 PartEntry->IsPartitioned =
FALSE;
3112 PartEntry->OnDiskPartitionNumber = 0;
3113 PartEntry->PartitionNumber = 0;
3115 PartEntry->BootIndicator =
FALSE;
3118 if (PartEntry->Volume)
3123 PartEntry->Volume =
NULL;
3127 *FreeRegion = PartEntry;
3151 DPRINT1(
"System partition %lu in disk %lu is an extended partition container?!\n",
3152 PartEntry->PartitionNumber, PartEntry->DiskEntry->DiskNumber);
3156 Volume = PartEntry->Volume;
3199 DPRINT1(
"Recognized file system '%S' that doesn't have write support yet!\n",
3200 Volume->Info.FileSystem);
3208 DPRINT1(
"System partition %lu in disk %lu with no or unknown FS?!\n",
3209 PartEntry->PartitionNumber, PartEntry->DiskEntry->DiskNumber);
3217 DPRINT1(
"Recognized file system '%S' that doesn't have write support yet!\n",
3218 Volume->Info.FileSystem);
3243 goto NoSystemPartition;
3247 if (!AlternativeDisk && AlternativePart)
3248 AlternativeDisk = AlternativePart->DiskEntry;
3251 if (AlternativePart)
3252 ASSERT(AlternativeDisk && (AlternativePart->DiskEntry == AlternativeDisk));
3255 if (AlternativeDisk)
3259 CandidatePartition =
NULL;
3274 goto UseAlternativeDisk;
3279 DPRINT1(
"System disk -- GPT-partitioned disk detected, not currently supported by SETUP!\n");
3280 goto UseAlternativeDisk;
3284 ActivePartition =
List->SystemPartition;
3287 CandidatePartition = ActivePartition;
3289 DPRINT1(
"Use the current system partition %lu in disk %lu, drive letter %C\n",
3291 CandidatePartition->
DiskEntry->DiskNumber,
3295 return CandidatePartition;
3299 if (DiskEntry != AlternativeDisk)
3308 ListEntry = ListEntry->
Flink)
3314 if (PartEntry == ActivePartition)
3326 CandidatePartition = PartEntry;
3327 goto UseAlternativePartition;
3338 CandidatePartition = PartEntry;
3339 goto UseAlternativePartition;
3358 ListEntry = ListEntry->
Flink)
3364 if (PartEntry == ActivePartition)
3373 CandidatePartition = PartEntry;
3374 goto UseAlternativePartition;
3386 if (!AlternativeDisk || (!ForceSelect && (DiskEntry != AlternativeDisk)))
3387 goto NoSystemPartition;
3391 DPRINT1(
"Alternative disk -- GPT-partitioned disk detected, not currently supported by SETUP!\n");
3392 goto NoSystemPartition;
3395 if (DiskEntry != AlternativeDisk)
3398 DiskEntry = AlternativeDisk;
3404 CandidatePartition = ActivePartition;
3405 goto UseAlternativePartition;
3424 CandidatePartition = PartEntry;
3438 DPRINT1(
"Use new first active system partition %lu in disk %lu, drive letter %C\n",
3440 CandidatePartition->
DiskEntry->DiskNumber,
3444 return CandidatePartition;
3448 DPRINT1(
"NewDisk TRUE but first partition is used?\n");
3457 ListEntry = ListEntry->
Flink)
3478 DPRINT1(
"Use first active system partition %lu in disk %lu, drive letter %C\n",
3480 CandidatePartition->
DiskEntry->DiskNumber,
3484 return CandidatePartition;
3492 if (AlternativePart)
3494 DPRINT1(
"No valid or supported system partition has been found, use the alternative partition!\n");
3495 CandidatePartition = AlternativePart;
3496 goto UseAlternativePartition;
3501 DPRINT1(
"No valid or supported system partition has been found on this system!\n");
3505UseAlternativePartition:
3514 ASSERT(CandidatePartition);
3516 DPRINT1(
"Use alternative active system partition %lu in disk %lu, drive letter %C\n",
3518 CandidatePartition->
DiskEntry->DiskNumber,
3522 return CandidatePartition;
3544 if ((PartEntry ==
List->SystemPartition) ||
3550 ASSERT(PartEntry->DiskEntry);
3553 ASSERT(PartEntry->DiskEntry->PartList ==
List);
3561 if (!(OldActivePart &&
IsPartitionActive(OldActivePart) && (OldActivePart->DiskEntry == PartEntry->DiskEntry)))
3570 OldActivePart->BootIndicator =
FALSE;
3571 OldActivePart->DiskEntry->LayoutBuffer->PartitionEntry[OldActivePart->PartitionIndex].BootIndicator =
FALSE;
3572 OldActivePart->DiskEntry->LayoutBuffer->PartitionEntry[OldActivePart->PartitionIndex].RewritePartition =
TRUE;
3573 OldActivePart->DiskEntry->Dirty =
TRUE;
3578 List->SystemPartition = PartEntry;
3581 PartEntry->BootIndicator =
TRUE;
3582 PartEntry->DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].BootIndicator =
TRUE;
3583 PartEntry->DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].RewritePartition =
TRUE;
3584 PartEntry->DiskEntry->Dirty =
TRUE;
3600 ULONG PartitionCount;
3605 DPRINT(
"WritePartitions() Disk: %lu\n", DiskEntry->DiskNumber);
3608 if (!DiskEntry->Dirty)
3612 L"\\Device\\Harddisk%lu\\Partition0",
3613 DiskEntry->DiskNumber);
3634#ifdef DUMP_PARTITION_TABLE
3635 DumpPartitionTable(DiskEntry);
3645 PartitionCount = DiskEntry->LayoutBuffer->PartitionCount;
3658 DiskEntry->LayoutBuffer,
3660 DiskEntry->LayoutBuffer,
3671 DiskEntry->LayoutBuffer->PartitionCount = PartitionCount;
3676 DPRINT1(
"IOCTL_DISK_SET_DRIVE_LAYOUT failed (Status 0x%08lx)\n",
Status);
3680#ifdef DUMP_PARTITION_TABLE
3681 DumpPartitionTable(DiskEntry);
3687 for (ListEntry = DiskEntry->PrimaryPartListHead.
Flink;
3688 ListEntry != &DiskEntry->PrimaryPartListHead;
3689 ListEntry = ListEntry->
Flink)
3714 for (ListEntry = DiskEntry->LogicalPartListHead.
Flink;
3715 ListEntry != &DiskEntry->LogicalPartListHead;
3716 ListEntry = ListEntry->
Flink)
3747 DiskEntry->Dirty =
FALSE;
3773 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
3782 DPRINT1(
"WritePartitionsToDisk() failed to update disk %lu, Status 0x%08lx\n",
3828 L"\\DosDevices\\%c:",
Letter);
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
#define PARTITION_ENTRY_UNUSED
#define PARTITION_EXTENDED
#define PARTITION_XINT13_EXTENDED
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
#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
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)
#define IsOEMPartition(PartitionType)
struct _PARTLIST * PPARTLIST
struct _BIOSDISKENTRY * PBIOSDISKENTRY
#define GetDiskSizeInBytes(DiskEntry)
#define EFI_PMBR_OSTYPE_EFI
#define GetPartEntryOffsetInBytes(PartEntry)
#define GetPartEntrySizeInBytes(PartEntry)
#define InsertAscendingList(ListHead, NewEntry, Type, ListEntryField, SortField)
#define memcpy(s1, s2, n)
#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 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
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#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 RTL_SIZEOF_THROUGH_FIELD(type, field)
#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)
NTSTRSAFEAPI RtlStringCchCopyW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
#define IOCTL_SCSI_GET_ADDRESS
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
BOOLEAN SetMountedDeviceValues(_In_ PPARTLIST List)
static VOID AddPartitionToDisk(IN ULONG DiskNumber, IN PDISKENTRY DiskEntry, IN ULONG PartitionIndex, IN BOOLEAN LogicalPartition)
BOOLEAN IsDiskSuperFloppy2(_In_ const DISK_PARTITION_INFO *DiskInfo, _In_opt_ const ULONGLONG *DiskSize, _In_ const PARTITION_INFORMATION *PartitionInfo)
static ERROR_NUMBER MBRPartitionCreateChecks(_In_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
ERROR_NUMBER NTAPI PartitionCreateChecks(_In_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
static BOOLEAN SetMountedDeviceValue(_In_ PVOLENTRY Volume)
Assign a "\DosDevices\#:" mount point drive letter to a disk partition or volume, specified by a give...
static VOID GetDriverName(IN PDISKENTRY DiskEntry)
struct _REG_DISK_MOUNT_INFO * PREG_DISK_MOUNT_INFO
static PDISKENTRY GetSystemDisk(IN PPARTLIST List)
ULONGLONG AlignUp(IN ULONGLONG Value, IN ULONG Alignment)
static VOID UpdateDiskLayout(IN PDISKENTRY DiskEntry)
static VOID DestroyRegion(_Inout_ PPARTENTRY PartEntry)
BOOLEAN WritePartitionsToDisk(IN PPARTLIST List)
ULONGLONG RoundingDivide(IN ULONGLONG Dividend, IN ULONGLONG Divisor)
VOID SetMBRPartitionType(IN PPARTENTRY PartEntry, IN UCHAR PartitionType)
VOID NTAPI DestroyPartitionList(IN PPARTLIST List)
BOOLEAN IsSuperFloppy(_In_ PDISKENTRY DiskEntry)
static VOID AssignDriveLetters(IN PPARTLIST List)
static ULONG GetPartitionCount(_In_ PLIST_ENTRY PartListHead)
Counts the number of partitioned disk regions in a given partition list.
static VOID InitPartitionDeviceName(_Inout_ PPARTENTRY PartEntry)
static BOOLEAN IsSamePrimaryLayoutEntry(_In_ PPARTITION_INFORMATION PartitionInfo, _In_ PPARTENTRY PartEntry)
ULONGLONG AlignDown(IN ULONGLONG Value, IN ULONG Alignment)
PPARTENTRY NTAPI GetAdjUnpartitionedEntry(_In_ PPARTENTRY PartEntry, _In_ BOOLEAN Direction)
Retrieves, if any, the unpartitioned disk region that is adjacent (next or previous) to the specified...
static VOID SetDiskSignature(IN PPARTLIST List, IN PDISKENTRY DiskEntry)
PDISKENTRY GetDiskByBiosNumber(_In_ PPARTLIST List, _In_ ULONG HwDiskNumber)
BOOLEAN NTAPI CreatePartition(_In_ PPARTLIST List, _Inout_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
PDISKENTRY GetDiskBySCSI(_In_ PPARTLIST List, _In_ USHORT Port, _In_ USHORT Bus, _In_ USHORT Id)
BOOLEAN NTAPI DeletePartition(_In_ PPARTLIST List, _In_ PPARTENTRY PartEntry, _Out_opt_ PPARTENTRY *FreeRegion)
PDISKENTRY GetDiskBySignature(_In_ PPARTLIST List, _In_ ULONG Signature)
static NTSTATUS NTAPI DiskConfigurationDataQueryRoutine(PWSTR ValueName, ULONG ValueType, PVOID ValueData, ULONG ValueLength, PVOID Context, PVOID EntryContext)
PPARTENTRY GetPartition(_In_ PDISKENTRY DiskEntry, _In_ ULONG PartitionNumber)
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)
PPARTLIST NTAPI CreatePartitionList(VOID)
static NTSTATUS DismountPartition(_In_ PPARTLIST List, _In_ PPARTENTRY PartEntry)
static VOID UpdateDiskSignatures(IN PPARTLIST List)
BOOLEAN SetActivePartition(IN PPARTLIST List, IN PPARTENTRY PartEntry, IN PPARTENTRY OldActivePart OPTIONAL)
static VOID EnumerateBiosDiskEntries(IN PPARTLIST PartList)
PPARTENTRY NTAPI GetPrevPartition(IN PPARTLIST List, IN PPARTENTRY CurrentPart OPTIONAL)
static PPARTENTRY CreateInsertBlankRegion(IN PDISKENTRY DiskEntry, IN OUT PLIST_ENTRY ListHead, IN ULONGLONG StartSector, IN ULONGLONG SectorCount, IN BOOLEAN LogicalSpace)
static PPARTENTRY GetActiveDiskPartition(IN PDISKENTRY DiskEntry)
struct _REG_DISK_MOUNT_INFO REG_DISK_MOUNT_INFO
static PVOLENTRY InitVolume(_In_ PPARTLIST List, _In_opt_ PPARTENTRY PartEntry)
static VOID InitVolumeDeviceName(_Inout_ PVOLENTRY Volume)
BOOLEAN IsDiskSuperFloppyEx(_In_ const DRIVE_LAYOUT_INFORMATION_EX *LayoutEx, _In_opt_ const ULONGLONG *DiskSize)
PPARTENTRY SelectPartition(_In_ PPARTLIST List, _In_ ULONG DiskNumber, _In_ ULONG PartitionNumber)
PPARTENTRY NTAPI GetNextPartition(IN PPARTLIST List, IN PPARTENTRY CurrentPart OPTIONAL)
static BOOLEAN InsertDiskRegion(IN PDISKENTRY DiskEntry, IN PPARTENTRY PartEntry, IN BOOLEAN LogicalPartition)
static BOOLEAN IsEmptyLayoutEntry(_In_ PPARTITION_INFORMATION PartitionInfo)
PDISKENTRY GetDiskByNumber(_In_ PPARTLIST List, _In_ ULONG DiskNumber)
static VOID UpdateHwDiskNumbers(IN PPARTLIST List)
static BOOLEAN ReAllocateLayoutBuffer(IN PDISKENTRY DiskEntry)
#define GetLogicalPartitionCount(DiskEntry)
PPARTENTRY FindSupportedSystemPartition(IN PPARTLIST List, IN BOOLEAN ForceSelect, IN PDISKENTRY AlternativeDisk OPTIONAL, IN PPARTENTRY AlternativePart OPTIONAL)
static BOOLEAN IsSupportedActivePartition(IN PPARTENTRY PartEntry)
static BOOLEAN InitializePartitionEntry(_Inout_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
#define GetPrimaryPartitionCount(DiskEntry)
static NTSTATUS NTAPI DiskIdentifierQueryRoutine(PWSTR ValueName, ULONG ValueType, PVOID ValueData, ULONG ValueLength, PVOID Context, PVOID EntryContext)
NTSTATUS WritePartitions(IN PDISKENTRY DiskEntry)
BOOLEAN IsDiskSuperFloppy(_In_ const DRIVE_LAYOUT_INFORMATION *Layout, _In_opt_ const ULONGLONG *DiskSize)
static VOID AddLogicalDiskSpace(_In_ PDISKENTRY DiskEntry)
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
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@393 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@393::@402 DeviceSpecificData
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
struct _LIST_ENTRY * Blink
struct _LIST_ENTRY * Flink
ULARGE_INTEGER SectorCount
WCHAR DeviceName[MAX_PATH]
NT device name: "\Device\HarddiskM\PartitionN".
struct _DISKENTRY * DiskEntry
ULONG OnDiskPartitionNumber
ULARGE_INTEGER StartSector
PARTITION Partition[PARTITION_TBL_SIZE]
unsigned char PartitionType
PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine
#define RTL_CONSTANT_STRING(s)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_UNSUCCESSFUL
NTSTATUS DismountVolume(_Inout_ PVOLINFO Volume, _In_ BOOLEAN Force)
Attempts to dismount the designated volume.
NTSTATUS MountVolume(_Inout_ PVOLINFO Volume, _In_opt_ UCHAR MbrPartitionType)
#define IsUnknown(VolInfo)
#define IsUnformatted(VolInfo)
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
WDF_EXTERN_C_START typedef _In_ WDFDEVICE _In_ WDFCONTEXT _In_ WDF_DMA_DIRECTION Direction
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG _Out_opt_ PULONG _Out_opt_ PULONG ValueType
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG ValueLength
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_Must_inspect_result_ _In_ WDFCMRESLIST List
#define HKEY_LOCAL_MACHINE
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
struct _CM_DISK_GEOMETRY_DEVICE_DATA * PCM_DISK_GEOMETRY_DEVICE_DATA
_In_ ULONG _In_ struct _SET_PARTITION_INFORMATION_EX * PartitionInfo
_In_ ULONG _In_ ULONG PartitionNumber
_In_ LARGE_INTEGER Divisor