17#define InsertAscendingList(ListHead, NewEntry, Type, ListEntryField, SortField)\
21 current = (ListHead)->Flink;\
22 while (current != (ListHead))\
24 if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField >=\
25 (NewEntry)->SortField)\
29 current = current->Flink;\
32 InsertTailList(current, &((NewEntry)->ListEntryField));\
36#define PARTITION_LINUX 0x83
38#define PARTITION_TBL_SIZE 4
40#define MBR_MAGIC 0xAA55
108 L"\\Scsi\\Scsi Port %lu",
125 DPRINT1(
"RtlQueryRegistryValues() failed (Status %lx)\n",
Status);
239 if (*Int13Drives ==
NULL)
252#define ROOT_NAME L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter"
272 L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System",
278 DPRINT1(
"Unable to query the 'Configuration Data' key in '\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System', status=%lx\n",
Status);
298 L"%s\\%lu\\DiskController",
ROOT_NAME, AdapterCount);
309 L"%s\\%lu\\DiskController\\0",
ROOT_NAME, AdapterCount);
322 L"%s\\%lu\\DiskController\\0\\DiskPeripheral",
ROOT_NAME, AdapterCount);
339 if (BiosDiskEntry ==
NULL)
345 L"%s\\%lu\\DiskController\\0\\DiskPeripheral\\%lu",
ROOT_NAME, AdapterCount, DiskCount);
349 (
PVOID)BiosDiskEntry,
353 RtlFreeHeap(RtlGetProcessHeap(), 0, BiosDiskEntry);
357 BiosDiskEntry->DiskNumber = DiskCount;
358 BiosDiskEntry->Recognized =
FALSE;
360 if (DiskCount < Int13Drives[0].NumberDrives)
362 BiosDiskEntry->Int13DiskData = Int13Drives[DiskCount];
366 DPRINT1(
"Didn't find int13 drive datas for disk %u\n", DiskCount);
371 DPRINT(
"DiskNumber: %lu\n", BiosDiskEntry->DiskNumber);
372 DPRINT(
"Signature: %08lx\n", BiosDiskEntry->Signature);
373 DPRINT(
"Checksum: %08lx\n", BiosDiskEntry->Checksum);
374 DPRINT(
"BytesPerSector: %lu\n", BiosDiskEntry->DiskGeometry.BytesPerSector);
375 DPRINT(
"NumberOfCylinders: %lu\n", BiosDiskEntry->DiskGeometry.NumberOfCylinders);
376 DPRINT(
"NumberOfHeads: %lu\n", BiosDiskEntry->DiskGeometry.NumberOfHeads);
377 DPRINT(
"DriveSelect: %02x\n", BiosDiskEntry->Int13DiskData.DriveSelect);
378 DPRINT(
"MaxCylinders: %lu\n", BiosDiskEntry->Int13DiskData.MaxCylinders);
379 DPRINT(
"SectorsPerTrack: %d\n", BiosDiskEntry->Int13DiskData.SectorsPerTrack);
380 DPRINT(
"MaxHeads: %d\n", BiosDiskEntry->Int13DiskData.MaxHeads);
381 DPRINT(
"NumberDrives: %d\n", BiosDiskEntry->Int13DiskData.NumberDrives);
404 ULONG PartitionIndex,
418 if (PartEntry ==
NULL)
451 if (CheckFatFormat())
465 if (CheckExt2Format())
479 if (CheckNtfsFormat())
483 else if (CheckHpfsFormat())
520 DPRINT(
"ScanForUnpartitionedDiskSpace()\n");
524 DPRINT1(
"No primary partition!\n");
530 if (NewPartEntry ==
NULL)
554 LastSectorCount = 0
ULL;
555 LastUnusedSectorCount = 0
ULL;
565 LastUnusedSectorCount =
571 DPRINT(
"Unpartitioned disk space %I64u sectors\n", LastUnusedSectorCount);
576 if (NewPartEntry ==
NULL)
611 DPRINT1(
"Unpartitioned disk space: %I64u sectors\n", LastUnusedSectorCount);
616 if (NewPartEntry ==
NULL)
642 DPRINT1(
"No logical partition!\n");
648 if (NewPartEntry ==
NULL)
672 LastSectorCount = 0
ULL;
673 LastUnusedSectorCount = 0
ULL;
683 LastUnusedSectorCount =
689 DPRINT(
"Unpartitioned disk space %I64u sectors\n", LastUnusedSectorCount);
694 if (NewPartEntry ==
NULL)
731 DPRINT(
"Unpartitioned disk space: %I64u sectors\n", LastUnusedSectorCount);
736 if (NewPartEntry ==
NULL)
760 DPRINT(
"ScanForUnpartitionedDiskSpace() done\n");
784 ULONG LayoutBufferSize;
852 for (
i = 0;
i < 128;
i++)
856 Checksum = ~Checksum + 1;
865 if (DiskEntry ==
NULL)
894 BiosDiskEntry->
Checksum == Checksum &&
907 ListEntry = ListEntry->
Flink;
916 DPRINT1(
"WARNING: Setup could not find a matching BIOS disk entry. Disk %d is not be bootable by the BIOS!\n", DiskNumber);
950 DiskEntry->
Lun = ScsiAddress.
Lun;
964 DPRINT1(
"Failed to allocate the disk layout buffer!\n");
970 DPRINT1(
"Buffer size: %lu\n", LayoutBufferSize);
986 DPRINT1(
"NtDeviceIoControlFile() failed (Status: 0x%08lx)\n",
Status);
995 if (NewLayoutBuffer ==
NULL)
997 DPRINT1(
"Failed to reallocate the disk layout buffer!\n");
1006#ifdef DUMP_PARTITION_TABLE
1007 DumpPartitionTable(DiskEntry);
1029 DPRINT1(
"No valid partition table found! Use megabyte (%lu Sectors) alignment!\n", (1024 * 1024) / DiskEntry->
BytesPerSector);
1038 for (
i = 0;
i < 4;
i++)
1043 for (
i = 0;
i < 4;
i++)
1095 for (DiskNumber = 0; DiskNumber < Sdi.
NumberOfDisks; DiskNumber++)
1098 L"\\Device\\Harddisk%d\\Partition0",
1185 RtlFreeHeap(RtlGetProcessHeap(), 0, BiosDiskEntry);
1203 if (pExtents ==
NULL)
1228 if (pExtents ==
NULL)
1252 VolumeEntry->pExtents = pExtents;
1299 ULONG ulVolumeNumber,
1300 PWSTR pszVolumeName)
1310 DWORD CharCount = 0;
1318 DPRINT(
"AddVolumeToList(%S)\n", pszVolumeName);
1323 if (VolumeEntry ==
NULL)
1331 pszVolumeName[
Index] =
L'\0';
1335 pszVolumeName[
Index] =
L'\\';
1394 (3 + 1) *
sizeof(
WCHAR));
1418 ULONG ulVolumeNumber = 0;
1491 ULONG PartitionCount;
1496 DPRINT(
"WritePartitions() Disk: %lu\n", DiskEntry->DiskNumber);
1499 if (!DiskEntry->Dirty)
1503 L"\\Device\\Harddisk%lu\\Partition0",
1504 DiskEntry->DiskNumber);
1532 PartitionCount = DiskEntry->LayoutBuffer->PartitionCount;
1543 DiskEntry->LayoutBuffer,
1545 DiskEntry->LayoutBuffer,
1556 DiskEntry->LayoutBuffer->PartitionCount = PartitionCount;
1561 DPRINT1(
"IOCTL_DISK_SET_DRIVE_LAYOUT failed (Status 0x%08lx)\n",
Status);
1568 for (ListEntry = DiskEntry->PrimaryPartListHead.
Flink;
1569 ListEntry != &DiskEntry->PrimaryPartListHead;
1570 ListEntry = ListEntry->
Flink)
1583 for (ListEntry = DiskEntry->LogicalPartListHead.
Flink;
1584 ListEntry != &DiskEntry->LogicalPartListHead;
1585 ListEntry = ListEntry->
Flink)
1598 DiskEntry->Dirty =
FALSE;
1626 if ((
PartitionInfo->StartingOffset.QuadPart == PartEntry->StartSector.QuadPart * DiskEntry->BytesPerSector) &&
1627 (
PartitionInfo->PartitionLength.QuadPart == PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector))
1644 for (
Entry = DiskEntry->PrimaryPartListHead.Flink;
1645 Entry != &DiskEntry->PrimaryPartListHead;
1666 for (ListEntry = DiskEntry->LogicalPartListHead.
Flink;
1667 ListEntry != &DiskEntry->LogicalPartListHead;
1668 ListEntry = ListEntry->
Flink)
1685 ULONG NewPartitionCount;
1686 ULONG CurrentPartitionCount = 0;
1687 ULONG LayoutBufferSize;
1690 DPRINT1(
"ReAllocateLayoutBuffer()\n");
1694 if (DiskEntry->LayoutBuffer)
1695 CurrentPartitionCount = DiskEntry->LayoutBuffer->PartitionCount;
1697 DPRINT1(
"CurrentPartitionCount: %lu ; NewPartitionCount: %lu\n",
1698 CurrentPartitionCount, NewPartitionCount);
1700 if (CurrentPartitionCount == NewPartitionCount)
1707 DiskEntry->LayoutBuffer,
1709 if (NewLayoutBuffer ==
NULL)
1711 DPRINT1(
"Failed to allocate the new layout buffer (size: %lu)\n", LayoutBufferSize);
1718 if (NewPartitionCount > CurrentPartitionCount)
1720 for (
i = CurrentPartitionCount;
i < NewPartitionCount;
i++)
1726 DiskEntry->LayoutBuffer = NewLayoutBuffer;
1744 DPRINT1(
"UpdateDiskLayout()\n");
1749 DPRINT(
"ReAllocateLayoutBuffer() failed.\n");
1755 for (ListEntry = DiskEntry->PrimaryPartListHead.
Flink;
1756 ListEntry != &DiskEntry->PrimaryPartListHead;
1757 ListEntry = ListEntry->
Flink)
1776 DPRINT1(
"Updating primary partition entry %lu\n",
Index);
1799 for (ListEntry = DiskEntry->LogicalPartListHead.
Flink;
1800 ListEntry != &DiskEntry->LogicalPartListHead;
1801 ListEntry = ListEntry->
Flink)
1818 DPRINT1(
"Updating logical partition entry %lu\n",
Index);
1830 if (LinkInfo !=
NULL)
1834 HiddenSectors64.
QuadPart = PartEntry->
StartSector.
QuadPart - DiskEntry->SectorAlignment - DiskEntry->ExtendedPartition->StartSector.QuadPart;
1844 LinkInfo = &DiskEntry->LayoutBuffer->PartitionEntry[
Index + 1];
1860 DPRINT1(
"Wiping primary partition entry %lu\n",
Index);
1874 for (
Index = 4;
Index < DiskEntry->LayoutBuffer->PartitionCount;
Index++)
1898 DiskEntry->Dirty =
TRUE;
1910 if (PartEntry->LogicalPartition)
1915 if (PartEntry->ListEntry.Blink != ListHead)
1923 return PrevPartEntry;
1939 if (PartEntry->LogicalPartition)
1944 if (PartEntry->ListEntry.Flink != ListHead)
1952 return NextPartEntry;
1972 if (!PartEntry->IsPartitioned ||
1979 PartEntry->PartitionNumber == 0)
1989 L"\\Device\\Harddisk%lu\\Partition%lu",
1990 PartEntry->DiskEntry->DiskNumber,
1991 PartEntry->PartitionNumber);
2008 DPRINT1(
"ERROR: Cannot open volume %wZ for dismounting! (Status 0x%lx)\n", &
Name,
Status);
2025 DPRINT1(
"WARNING: Failed to lock volume! Operations may fail! (Status 0x%lx)\n", LockStatus);
2041 DPRINT1(
"Failed to unmount volume (Status 0x%lx)\n",
Status);
2057 DPRINT1(
"Failed to unlock volume (Status 0x%lx)\n", LockStatus);
2075 if ((PartEntry ==
NULL) ||
2076 (PartEntry->DiskEntry ==
NULL))
2108 if (VolumeEntry ==
NULL)
2116 if (VolumeEntry->pszLabel)
2117 RtlFreeHeap(RtlGetProcessHeap(), 0, VolumeEntry->pszLabel);
2119 if (VolumeEntry->pszFilesystem)
2120 RtlFreeHeap(RtlGetProcessHeap(), 0, VolumeEntry->pszFilesystem);
2122 if (VolumeEntry->pExtents)
2123 RtlFreeHeap(RtlGetProcessHeap(), 0, VolumeEntry->pExtents);
#define FILE_DIRECTORY_FILE
#define PARTITION_ENTRY_UNUSED
#define PARTITION_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
#define IOCTL_DISK_GET_DRIVE_GEOMETRY
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
#define NT_SUCCESS(StatCode)
#define INVALID_HANDLE_VALUE
static DWORD DWORD * dwLength
DWORD WINAPI QueryDosDeviceW(LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax)
BOOL WINAPI FindNextVolumeW(IN HANDLE handle, IN LPWSTR volume, IN DWORD len)
BOOL WINAPI GetVolumeInformationW(IN LPCWSTR lpRootPathName, IN LPWSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPWSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
HANDLE WINAPI FindFirstVolumeW(IN LPWSTR volume, IN DWORD len)
BOOL WINAPI FindVolumeClose(IN HANDLE hFindVolume)
BOOL WINAPI GetVolumePathNamesForVolumeNameW(IN LPCWSTR lpszVolumeName, IN LPWSTR lpszVolumePathNames, IN DWORD cchBufferLength, OUT PDWORD lpcchReturnLength)
static const WCHAR Signature[]
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define RemoveHeadList(ListHead)
#define InitializeListHead(ListHead)
@ SystemDeviceInformation
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
_Must_inspect_result_ _Out_ PHANDLE VolumeHandle
#define FILE_SYNCHRONOUS_IO_NONALERT
@ FileFsDeviceInformation
#define FILE_OPEN_FOR_BACKUP_INTENT
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
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#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 _BIOSDISKENTRY * PBIOSDISKENTRY
struct _BIOSDISKENTRY BIOSDISKENTRY
#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)
_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)
#define FSCTL_LOCK_VOLUME
#define FILE_READ_ATTRIBUTES
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RTL_REGISTRY_ABSOLUTE
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 FILE_REMOVABLE_MEDIA
#define REG_FULL_RESOURCE_DESCRIPTOR
#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
struct _VOLUME_DISK_EXTENTS VOLUME_DISK_EXTENTS
struct _DISK_EXTENT DISK_EXTENT
#define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
#define FILE_DEVICE_DISK_FILE_SYSTEM
#define FILE_DEVICE_CD_ROM
#define FILE_DEVICE_CD_ROM_FILE_SYSTEM
#define IOCTL_SCSI_GET_ADDRESS
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static VOID AddPartitionToDisk(IN ULONG DiskNumber, IN PDISKENTRY DiskEntry, IN ULONG PartitionIndex, IN BOOLEAN LogicalPartition)
static VOID GetDriverName(IN PDISKENTRY DiskEntry)
static VOID UpdateDiskLayout(IN PDISKENTRY DiskEntry)
VOID NTAPI DestroyPartitionList(IN PPARTLIST List)
static BOOLEAN IsSamePrimaryLayoutEntry(_In_ PPARTITION_INFORMATION PartitionInfo, _In_ PPARTENTRY PartEntry)
ULONGLONG AlignDown(IN ULONGLONG Value, IN ULONG Alignment)
static NTSTATUS NTAPI DiskConfigurationDataQueryRoutine(PWSTR ValueName, ULONG ValueType, PVOID ValueData, ULONG ValueLength, PVOID Context, PVOID EntryContext)
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)
PPARTLIST NTAPI CreatePartitionList(VOID)
static VOID EnumerateBiosDiskEntries(IN PPARTLIST PartList)
static BOOLEAN IsEmptyLayoutEntry(_In_ PPARTITION_INFORMATION PartitionInfo)
static BOOLEAN ReAllocateLayoutBuffer(IN PDISKENTRY DiskEntry)
#define GetLogicalPartitionCount(DiskEntry)
#define GetPrimaryPartitionCount(DiskEntry)
static NTSTATUS NTAPI DiskIdentifierQueryRoutine(PWSTR ValueName, ULONG ValueType, PVOID ValueData, ULONG ValueLength, PVOID Context, PVOID EntryContext)
NTSTATUS WritePartitions(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)
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
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
LIST_ENTRY PrimaryPartListHead
PDRIVE_LAYOUT_INFORMATION LayoutBuffer
LARGE_INTEGER StartingOffset
LARGE_INTEGER ExtentLength
struct _LIST_ENTRY * Flink
ULARGE_INTEGER SectorCount
struct _DISKENTRY * DiskEntry
ULONG OnDiskPartitionNumber
ULARGE_INTEGER StartSector
PARTITION Partition[PARTITION_TBL_SIZE]
unsigned char PartitionType
unsigned char EndingSector
unsigned char StartingHead
unsigned int StartingBlock
unsigned char EndingCylinder
unsigned char StartingSector
unsigned char StartingCylinder
PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine
PVOLUME_DISK_EXTENTS pExtents
WCHAR VolumeName[MAX_PATH]
LIST_ENTRY ListEntry
Entry in VolumesList.
WCHAR DeviceName[MAX_PATH]
ULONG NumberOfDiskExtents
VOID RemoveVolume(_In_ PVOLENTRY VolumeEntry)
LIST_ENTRY VolumeListHead
static VOID GetVolumeType(_In_ HANDLE VolumeHandle, _In_ PVOLENTRY VolumeEntry)
struct _PARTITION * PPARTITION
LIST_ENTRY BiosDiskListHead
PPARTENTRY GetPrevUnpartitionedEntry(_In_ PPARTENTRY PartEntry)
VOID DestroyVolumeList(VOID)
struct _PARTITION_SECTOR * PPARTITION_SECTOR
#define PARTITION_TBL_SIZE
static VOID AddVolumeToList(ULONG ulVolumeNumber, PWSTR pszVolumeName)
NTSTATUS CreateVolumeList(VOID)
struct _PARTITION_SECTOR PARTITION_SECTOR
PPARTENTRY CurrentPartition
PVOLENTRY GetVolumeFromPartition(_In_ PPARTENTRY PartEntry)
PPARTENTRY GetNextUnpartitionedEntry(_In_ PPARTENTRY PartEntry)
static VOID GetVolumeExtents(_In_ HANDLE VolumeHandle, _In_ PVOLENTRY VolumeEntry)
struct _PARTITION PARTITION
#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.
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
_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
DWORD WINAPI GetLastError(void)
_Reserved_ PVOID Reserved
#define ERROR_UNRECOGNIZED_VOLUME
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