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;
2026 DPRINT1(
"NtQuerySystemInformation() failed, Status 0x%08lx\n",
Status);
2031 for (DiskNumber = 0; DiskNumber < Sdi.
NumberOfDisks; DiskNumber++)
2034 L"\\Device\\Harddisk%lu\\Partition0",
2189 DiskEntry->
Bus == Bus &&
2190 DiskEntry->
Id ==
Id)
2237 for (
Entry = DiskEntry->PrimaryPartListHead.Flink;
2238 Entry != &DiskEntry->PrimaryPartListHead;
2251 for (
Entry = DiskEntry->LogicalPartListHead.Flink;
2252 Entry != &DiskEntry->LogicalPartListHead;
2304 if (CurrentPart !=
NULL)
2308 if (CurrentPart->LogicalPartition)
2312 PartListEntry = CurrentPart->ListEntry.
Flink;
2333 if (CurrentPart->IsPartitioned &&
2347 PartListEntry = CurrentPart->ListEntry.
Flink;
2359 :
List->DiskListHead.Flink);
2360 DiskListEntry != &
List->DiskListHead;
2361 DiskListEntry = DiskListEntry->
Flink)
2367 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2396 if (CurrentPart !=
NULL)
2400 if (CurrentPart->LogicalPartition)
2404 PartListEntry = CurrentPart->ListEntry.
Blink;
2421 PartListEntry = CurrentPart->ListEntry.
Blink;
2426 if (CurrentPart->IsPartitioned &&
2440 :
List->DiskListHead.Blink);
2441 DiskListEntry != &
List->DiskListHead;
2442 DiskListEntry = DiskListEntry->
Blink)
2448 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2457 if (CurrentPart->IsPartitioned &&
2511 for (
Entry = PartListHead->Flink;
2512 Entry != PartListHead;
2523#define GetPrimaryPartitionCount(DiskEntry) \
2524 GetPartitionCount(&(DiskEntry)->PrimaryPartListHead)
2526#define GetLogicalPartitionCount(DiskEntry) \
2527 (((DiskEntry)->DiskStyle == PARTITION_STYLE_MBR) \
2528 ? GetPartitionCount(&(DiskEntry)->LogicalPartListHead) : 0)
2537 ULONG NewPartitionCount;
2538 ULONG CurrentPartitionCount = 0;
2539 ULONG LayoutBufferSize;
2542 DPRINT1(
"ReAllocateLayoutBuffer()\n");
2546 if (DiskEntry->LayoutBuffer)
2547 CurrentPartitionCount = DiskEntry->LayoutBuffer->PartitionCount;
2549 DPRINT1(
"CurrentPartitionCount: %lu ; NewPartitionCount: %lu\n",
2550 CurrentPartitionCount, NewPartitionCount);
2552 if (CurrentPartitionCount == NewPartitionCount)
2559 DiskEntry->LayoutBuffer,
2561 if (NewLayoutBuffer ==
NULL)
2563 DPRINT1(
"Failed to allocate the new layout buffer (size: %lu)\n", LayoutBufferSize);
2570 if (NewPartitionCount > CurrentPartitionCount)
2572 for (
i = CurrentPartitionCount;
i < NewPartitionCount;
i++)
2578 DiskEntry->LayoutBuffer = NewLayoutBuffer;
2596 DPRINT1(
"UpdateDiskLayout()\n");
2600 DPRINT1(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2607 DPRINT(
"ReAllocateLayoutBuffer() failed.\n");
2613 for (ListEntry = DiskEntry->PrimaryPartListHead.
Flink;
2614 ListEntry != &DiskEntry->PrimaryPartListHead;
2615 ListEntry = ListEntry->
Flink)
2634 DPRINT1(
"Updating primary partition entry %lu\n",
Index);
2658 for (ListEntry = DiskEntry->LogicalPartListHead.
Flink;
2659 ListEntry != &DiskEntry->LogicalPartListHead;
2660 ListEntry = ListEntry->
Flink)
2677 DPRINT1(
"Updating logical partition entry %lu\n",
Index);
2693 HiddenSectors64.
QuadPart = PartEntry->
StartSector.
QuadPart - DiskEntry->SectorAlignment - DiskEntry->ExtendedPartition->StartSector.QuadPart;
2708 LinkInfo = &DiskEntry->LayoutBuffer->PartitionEntry[
Index + 1];
2724 DPRINT1(
"Wiping primary partition entry %lu\n",
Index);
2738 for (
Index = 4;
Index < DiskEntry->LayoutBuffer->PartitionCount;
Index++)
2765 DiskEntry->Dirty =
TRUE;
2767#ifdef DUMP_PARTITION_TABLE
2768 DumpPartitionTable(DiskEntry);
2795 PartEntry->LogicalPartition)
2805 AdjEntry = PartEntry->ListEntry.
Flink;
2807 AdjEntry = PartEntry->ListEntry.
Blink;
2809 if (AdjEntry != ListHead)
2812 if (!PartEntry->IsPartitioned)
2829 DPRINT1(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2834 if (PartEntry->IsPartitioned)
2840 if (!PartEntry->LogicalPartition)
2874 DPRINT1(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
2879 if (PartEntry->IsPartitioned)
2883 if (PartEntry->LogicalPartition)
2914 PCSTR mainType =
"Primary";
2917 mainType =
"Extended";
2918 else if (PartEntry && PartEntry->LogicalPartition)
2919 mainType =
"Logical";
2921 DPRINT1(
"CreatePartition(%s, %I64u bytes)\n", mainType, SizeBytes);
2923 if (!
List || !PartEntry ||
2924 !PartEntry->DiskEntry || PartEntry->IsPartitioned)
2935 DPRINT1(
"PartitionCreationChecks(%s) failed with error %lu\n", mainType,
Error);
2943 DiskEntry = PartEntry->DiskEntry;
2946 ASSERT(!PartEntry->Volume);
2954 ASSERT(PartEntry->Volume);
2970 ASSERT(PartEntry->DiskEntry->PartList ==
List);
2973 if (!PartEntry->IsPartitioned ||
2979 PartEntry->PartitionNumber == 0)
2989 PartEntry->Volume =
NULL;
3009 if (!
List || !PartEntry ||
3010 !PartEntry->DiskEntry || !PartEntry->IsPartitioned)
3015 ASSERT(PartEntry->DiskEntry->PartList ==
List);
3019 if (
List->SystemPartition == PartEntry)
3025 DiskEntry = PartEntry->DiskEntry;
3055 if (PrevPartEntry !=
NULL && NextPartEntry !=
NULL)
3070 *FreeRegion = PrevPartEntry;
3072 else if (PrevPartEntry !=
NULL && NextPartEntry ==
NULL)
3085 *FreeRegion = PrevPartEntry;
3087 else if (PrevPartEntry ==
NULL && NextPartEntry !=
NULL)
3101 *FreeRegion = NextPartEntry;
3107 PartEntry->IsPartitioned =
FALSE;
3109 PartEntry->OnDiskPartitionNumber = 0;
3110 PartEntry->PartitionNumber = 0;
3112 PartEntry->BootIndicator =
FALSE;
3115 if (PartEntry->Volume)
3120 PartEntry->Volume =
NULL;
3124 *FreeRegion = PartEntry;
3148 DPRINT1(
"System partition %lu in disk %lu is an extended partition container?!\n",
3149 PartEntry->PartitionNumber, PartEntry->DiskEntry->DiskNumber);
3153 Volume = PartEntry->Volume;
3196 DPRINT1(
"Recognized file system '%S' that doesn't have write support yet!\n",
3197 Volume->Info.FileSystem);
3205 DPRINT1(
"System partition %lu in disk %lu with no or unknown FS?!\n",
3206 PartEntry->PartitionNumber, PartEntry->DiskEntry->DiskNumber);
3214 DPRINT1(
"Recognized file system '%S' that doesn't have write support yet!\n",
3215 Volume->Info.FileSystem);
3240 goto NoSystemPartition;
3244 if (!AlternativeDisk && AlternativePart)
3245 AlternativeDisk = AlternativePart->DiskEntry;
3248 if (AlternativePart)
3249 ASSERT(AlternativeDisk && (AlternativePart->DiskEntry == AlternativeDisk));
3252 if (AlternativeDisk)
3256 CandidatePartition =
NULL;
3271 goto UseAlternativeDisk;
3276 DPRINT1(
"System disk -- GPT-partitioned disk detected, not currently supported by SETUP!\n");
3277 goto UseAlternativeDisk;
3281 ActivePartition =
List->SystemPartition;
3284 CandidatePartition = ActivePartition;
3286 DPRINT1(
"Use the current system partition %lu in disk %lu, drive letter %C\n",
3288 CandidatePartition->
DiskEntry->DiskNumber,
3292 return CandidatePartition;
3296 if (DiskEntry != AlternativeDisk)
3305 ListEntry = ListEntry->
Flink)
3311 if (PartEntry == ActivePartition)
3323 CandidatePartition = PartEntry;
3324 goto UseAlternativePartition;
3335 CandidatePartition = PartEntry;
3336 goto UseAlternativePartition;
3355 ListEntry = ListEntry->
Flink)
3361 if (PartEntry == ActivePartition)
3370 CandidatePartition = PartEntry;
3371 goto UseAlternativePartition;
3383 if (!AlternativeDisk || (!ForceSelect && (DiskEntry != AlternativeDisk)))
3384 goto NoSystemPartition;
3388 DPRINT1(
"Alternative disk -- GPT-partitioned disk detected, not currently supported by SETUP!\n");
3389 goto NoSystemPartition;
3392 if (DiskEntry != AlternativeDisk)
3395 DiskEntry = AlternativeDisk;
3401 CandidatePartition = ActivePartition;
3402 goto UseAlternativePartition;
3421 CandidatePartition = PartEntry;
3435 DPRINT1(
"Use new first active system partition %lu in disk %lu, drive letter %C\n",
3437 CandidatePartition->
DiskEntry->DiskNumber,
3441 return CandidatePartition;
3445 DPRINT1(
"NewDisk TRUE but first partition is used?\n");
3454 ListEntry = ListEntry->
Flink)
3475 DPRINT1(
"Use first active system partition %lu in disk %lu, drive letter %C\n",
3477 CandidatePartition->
DiskEntry->DiskNumber,
3481 return CandidatePartition;
3489 if (AlternativePart)
3491 DPRINT1(
"No valid or supported system partition has been found, use the alternative partition!\n");
3492 CandidatePartition = AlternativePart;
3493 goto UseAlternativePartition;
3498 DPRINT1(
"No valid or supported system partition has been found on this system!\n");
3502UseAlternativePartition:
3511 ASSERT(CandidatePartition);
3513 DPRINT1(
"Use alternative active system partition %lu in disk %lu, drive letter %C\n",
3515 CandidatePartition->
DiskEntry->DiskNumber,
3519 return CandidatePartition;
3541 if ((PartEntry ==
List->SystemPartition) ||
3547 ASSERT(PartEntry->DiskEntry);
3550 ASSERT(PartEntry->DiskEntry->PartList ==
List);
3558 if (!(OldActivePart &&
IsPartitionActive(OldActivePart) && (OldActivePart->DiskEntry == PartEntry->DiskEntry)))
3567 OldActivePart->BootIndicator =
FALSE;
3568 OldActivePart->DiskEntry->LayoutBuffer->PartitionEntry[OldActivePart->PartitionIndex].BootIndicator =
FALSE;
3569 OldActivePart->DiskEntry->LayoutBuffer->PartitionEntry[OldActivePart->PartitionIndex].RewritePartition =
TRUE;
3570 OldActivePart->DiskEntry->Dirty =
TRUE;
3575 List->SystemPartition = PartEntry;
3578 PartEntry->BootIndicator =
TRUE;
3579 PartEntry->DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].BootIndicator =
TRUE;
3580 PartEntry->DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].RewritePartition =
TRUE;
3581 PartEntry->DiskEntry->Dirty =
TRUE;
3597 ULONG PartitionCount;
3602 DPRINT(
"WritePartitions() Disk: %lu\n", DiskEntry->DiskNumber);
3605 if (!DiskEntry->Dirty)
3609 L"\\Device\\Harddisk%lu\\Partition0",
3610 DiskEntry->DiskNumber);
3631#ifdef DUMP_PARTITION_TABLE
3632 DumpPartitionTable(DiskEntry);
3642 PartitionCount = DiskEntry->LayoutBuffer->PartitionCount;
3655 DiskEntry->LayoutBuffer,
3657 DiskEntry->LayoutBuffer,
3668 DiskEntry->LayoutBuffer->PartitionCount = PartitionCount;
3673 DPRINT1(
"IOCTL_DISK_SET_DRIVE_LAYOUT failed (Status 0x%08lx)\n",
Status);
3677#ifdef DUMP_PARTITION_TABLE
3678 DumpPartitionTable(DiskEntry);
3684 for (ListEntry = DiskEntry->PrimaryPartListHead.
Flink;
3685 ListEntry != &DiskEntry->PrimaryPartListHead;
3686 ListEntry = ListEntry->
Flink)
3711 for (ListEntry = DiskEntry->LogicalPartListHead.
Flink;
3712 ListEntry != &DiskEntry->LogicalPartListHead;
3713 ListEntry = ListEntry->
Flink)
3744 DiskEntry->Dirty =
FALSE;
3770 DPRINT(
"GPT-partitioned disk detected, not currently supported by SETUP!\n");
3779 DPRINT1(
"WritePartitionsToDisk() failed to update disk %lu, Status 0x%08lx\n",
3825 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)
ERROR_NUMBER ExtendedPartitionCreationChecks(_In_ PPARTENTRY PartEntry)
BOOLEAN SetMountedDeviceValues(_In_ PPARTLIST List)
VOID DestroyPartitionList(IN PPARTLIST List)
static VOID AddPartitionToDisk(IN ULONG DiskNumber, IN PDISKENTRY DiskEntry, IN ULONG PartitionIndex, IN BOOLEAN LogicalPartition)
ERROR_NUMBER PartitionCreationChecks(_In_ PPARTENTRY PartEntry)
BOOLEAN IsDiskSuperFloppy2(_In_ const DISK_PARTITION_INFO *DiskInfo, _In_opt_ const ULONGLONG *DiskSize, _In_ const PARTITION_INFORMATION *PartitionInfo)
PPARTENTRY GetAdjUnpartitionedEntry(_In_ PPARTENTRY PartEntry, _In_ BOOLEAN Direction)
Retrieves, if any, the unpartitioned disk region that is adjacent (next or previous) to the specified...
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)
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.
BOOLEAN CreatePartition(_In_ PPARTLIST List, _Inout_ PPARTENTRY PartEntry, _In_opt_ ULONGLONG SizeBytes, _In_opt_ ULONG_PTR PartitionInfo)
static VOID InitPartitionDeviceName(_Inout_ PPARTENTRY PartEntry)
static BOOLEAN IsSamePrimaryLayoutEntry(_In_ PPARTITION_INFORMATION PartitionInfo, _In_ PPARTENTRY PartEntry)
PPARTENTRY GetPrevPartition(IN PPARTLIST List, IN PPARTENTRY CurrentPart OPTIONAL)
ULONGLONG AlignDown(IN ULONGLONG Value, IN ULONG Alignment)
static VOID SetDiskSignature(IN PPARTLIST List, IN PDISKENTRY DiskEntry)
BOOLEAN DeletePartition(_In_ PPARTLIST List, _In_ PPARTENTRY PartEntry, _Out_opt_ PPARTENTRY *FreeRegion)
PDISKENTRY GetDiskByBiosNumber(_In_ PPARTLIST List, _In_ ULONG HwDiskNumber)
PDISKENTRY GetDiskBySCSI(_In_ PPARTLIST List, _In_ USHORT Port, _In_ USHORT Bus, _In_ USHORT Id)
PDISKENTRY GetDiskBySignature(_In_ PPARTLIST List, _In_ ULONG Signature)
static NTSTATUS NTAPI DiskConfigurationDataQueryRoutine(PWSTR ValueName, ULONG ValueType, PVOID ValueData, ULONG ValueLength, PVOID Context, PVOID EntryContext)
PPARTLIST CreatePartitionList(VOID)
PPARTENTRY GetPartition(_In_ PDISKENTRY DiskEntry, _In_ ULONG PartitionNumber)
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)
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)
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)
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
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@391::@400 DeviceSpecificData
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@391 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
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