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
106 L"\\Scsi\\Scsi Port %lu",
123 DPRINT1(
"RtlQueryRegistryValues() failed (Status %lx)\n",
Status);
237 if (*Int13Drives ==
NULL)
250#define ROOT_NAME L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter"
270 L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System",
276 DPRINT1(
"Unable to query the 'Configuration Data' key in '\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System', status=%lx\n",
Status);
296 L"%s\\%lu\\DiskController",
ROOT_NAME, AdapterCount);
307 L"%s\\%lu\\DiskController\\0",
ROOT_NAME, AdapterCount);
320 L"%s\\%lu\\DiskController\\0\\DiskPeripheral",
ROOT_NAME, AdapterCount);
337 if (BiosDiskEntry ==
NULL)
343 L"%s\\%lu\\DiskController\\0\\DiskPeripheral\\%lu",
ROOT_NAME, AdapterCount, DiskCount);
347 (
PVOID)BiosDiskEntry,
351 RtlFreeHeap(RtlGetProcessHeap(), 0, BiosDiskEntry);
355 BiosDiskEntry->DiskNumber = DiskCount;
356 BiosDiskEntry->Recognized =
FALSE;
358 if (DiskCount < Int13Drives[0].NumberDrives)
360 BiosDiskEntry->Int13DiskData = Int13Drives[DiskCount];
364 DPRINT1(
"Didn't find int13 drive datas for disk %u\n", DiskCount);
369 DPRINT(
"DiskNumber: %lu\n", BiosDiskEntry->DiskNumber);
370 DPRINT(
"Signature: %08lx\n", BiosDiskEntry->Signature);
371 DPRINT(
"Checksum: %08lx\n", BiosDiskEntry->Checksum);
372 DPRINT(
"BytesPerSector: %lu\n", BiosDiskEntry->DiskGeometry.BytesPerSector);
373 DPRINT(
"NumberOfCylinders: %lu\n", BiosDiskEntry->DiskGeometry.NumberOfCylinders);
374 DPRINT(
"NumberOfHeads: %lu\n", BiosDiskEntry->DiskGeometry.NumberOfHeads);
375 DPRINT(
"DriveSelect: %02x\n", BiosDiskEntry->Int13DiskData.DriveSelect);
376 DPRINT(
"MaxCylinders: %lu\n", BiosDiskEntry->Int13DiskData.MaxCylinders);
377 DPRINT(
"SectorsPerTrack: %d\n", BiosDiskEntry->Int13DiskData.SectorsPerTrack);
378 DPRINT(
"MaxHeads: %d\n", BiosDiskEntry->Int13DiskData.MaxHeads);
379 DPRINT(
"NumberDrives: %d\n", BiosDiskEntry->Int13DiskData.NumberDrives);
402 ULONG PartitionIndex,
416 if (PartEntry ==
NULL)
449 if (CheckFatFormat())
463 if (CheckExt2Format())
477 if (CheckNtfsFormat())
481 else if (CheckHpfsFormat())
518 DPRINT(
"ScanForUnpartitionedDiskSpace()\n");
522 DPRINT1(
"No primary partition!\n");
528 if (NewPartEntry ==
NULL)
552 LastSectorCount = 0
ULL;
553 LastUnusedSectorCount = 0
ULL;
563 LastUnusedSectorCount =
569 DPRINT(
"Unpartitioned disk space %I64u sectors\n", LastUnusedSectorCount);
574 if (NewPartEntry ==
NULL)
609 DPRINT1(
"Unpartitioned disk space: %I64u sectors\n", LastUnusedSectorCount);
614 if (NewPartEntry ==
NULL)
640 DPRINT1(
"No logical partition!\n");
646 if (NewPartEntry ==
NULL)
670 LastSectorCount = 0
ULL;
671 LastUnusedSectorCount = 0
ULL;
681 LastUnusedSectorCount =
687 DPRINT(
"Unpartitioned disk space %I64u sectors\n", LastUnusedSectorCount);
692 if (NewPartEntry ==
NULL)
729 DPRINT(
"Unpartitioned disk space: %I64u sectors\n", LastUnusedSectorCount);
734 if (NewPartEntry ==
NULL)
758 DPRINT(
"ScanForUnpartitionedDiskSpace() done\n");
782 ULONG LayoutBufferSize;
850 for (
i = 0;
i < 128;
i++)
854 Checksum = ~Checksum + 1;
863 if (DiskEntry ==
NULL)
892 BiosDiskEntry->
Checksum == Checksum &&
905 ListEntry = ListEntry->
Flink;
914 DPRINT1(
"WARNING: Setup could not find a matching BIOS disk entry. Disk %d is not be bootable by the BIOS!\n", DiskNumber);
948 DiskEntry->
Lun = ScsiAddress.
Lun;
962 DPRINT1(
"Failed to allocate the disk layout buffer!\n");
968 DPRINT1(
"Buffer size: %lu\n", LayoutBufferSize);
984 DPRINT1(
"NtDeviceIoControlFile() failed (Status: 0x%08lx)\n",
Status);
993 if (NewLayoutBuffer ==
NULL)
995 DPRINT1(
"Failed to reallocate the disk layout buffer!\n");
1004#ifdef DUMP_PARTITION_TABLE
1005 DumpPartitionTable(DiskEntry);
1027 DPRINT1(
"No valid partition table found! Use megabyte (%lu Sectors) alignment!\n", (1024 * 1024) / DiskEntry->
BytesPerSector);
1036 for (
i = 0;
i < 4;
i++)
1041 for (
i = 0;
i < 4;
i++)
1093 for (DiskNumber = 0; DiskNumber < Sdi.
NumberOfDisks; DiskNumber++)
1096 L"\\Device\\Harddisk%d\\Partition0",
1183 RtlFreeHeap(RtlGetProcessHeap(), 0, BiosDiskEntry);
1201 if (pExtents ==
NULL)
1226 if (pExtents ==
NULL)
1250 VolumeEntry->pExtents = pExtents;
1297 ULONG ulVolumeNumber,
1298 PWSTR pszVolumeName)
1308 DWORD CharCount = 0;
1316 DPRINT(
"AddVolumeToList(%S)\n", pszVolumeName);
1321 if (VolumeEntry ==
NULL)
1329 pszVolumeName[
Index] =
L'\0';
1333 pszVolumeName[
Index] =
L'\\';
1392 (3 + 1) *
sizeof(
WCHAR));
1416 ULONG ulVolumeNumber = 0;
1489 ULONG PartitionCount;
1494 DPRINT(
"WritePartitions() Disk: %lu\n", DiskEntry->DiskNumber);
1497 if (!DiskEntry->Dirty)
1501 L"\\Device\\Harddisk%lu\\Partition0",
1502 DiskEntry->DiskNumber);
1530 PartitionCount = DiskEntry->LayoutBuffer->PartitionCount;
1541 DiskEntry->LayoutBuffer,
1543 DiskEntry->LayoutBuffer,
1554 DiskEntry->LayoutBuffer->PartitionCount = PartitionCount;
1559 DPRINT1(
"IOCTL_DISK_SET_DRIVE_LAYOUT failed (Status 0x%08lx)\n",
Status);
1566 for (ListEntry = DiskEntry->PrimaryPartListHead.
Flink;
1567 ListEntry != &DiskEntry->PrimaryPartListHead;
1568 ListEntry = ListEntry->
Flink)
1581 for (ListEntry = DiskEntry->LogicalPartListHead.
Flink;
1582 ListEntry != &DiskEntry->LogicalPartListHead;
1583 ListEntry = ListEntry->
Flink)
1596 DiskEntry->Dirty =
FALSE;
1624 if ((
PartitionInfo->StartingOffset.QuadPart == PartEntry->StartSector.QuadPart * DiskEntry->BytesPerSector) &&
1625 (
PartitionInfo->PartitionLength.QuadPart == PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector))
1642 for (
Entry = DiskEntry->PrimaryPartListHead.Flink;
1643 Entry != &DiskEntry->PrimaryPartListHead;
1664 for (ListEntry = DiskEntry->LogicalPartListHead.
Flink;
1665 ListEntry != &DiskEntry->LogicalPartListHead;
1666 ListEntry = ListEntry->
Flink)
1683 ULONG NewPartitionCount;
1684 ULONG CurrentPartitionCount = 0;
1685 ULONG LayoutBufferSize;
1688 DPRINT1(
"ReAllocateLayoutBuffer()\n");
1692 if (DiskEntry->LayoutBuffer)
1693 CurrentPartitionCount = DiskEntry->LayoutBuffer->PartitionCount;
1695 DPRINT1(
"CurrentPartitionCount: %lu ; NewPartitionCount: %lu\n",
1696 CurrentPartitionCount, NewPartitionCount);
1698 if (CurrentPartitionCount == NewPartitionCount)
1705 DiskEntry->LayoutBuffer,
1707 if (NewLayoutBuffer ==
NULL)
1709 DPRINT1(
"Failed to allocate the new layout buffer (size: %lu)\n", LayoutBufferSize);
1716 if (NewPartitionCount > CurrentPartitionCount)
1718 for (
i = CurrentPartitionCount;
i < NewPartitionCount;
i++)
1724 DiskEntry->LayoutBuffer = NewLayoutBuffer;
1742 DPRINT1(
"UpdateDiskLayout()\n");
1747 DPRINT(
"ReAllocateLayoutBuffer() failed.\n");
1753 for (ListEntry = DiskEntry->PrimaryPartListHead.
Flink;
1754 ListEntry != &DiskEntry->PrimaryPartListHead;
1755 ListEntry = ListEntry->
Flink)
1774 DPRINT1(
"Updating primary partition entry %lu\n",
Index);
1797 for (ListEntry = DiskEntry->LogicalPartListHead.
Flink;
1798 ListEntry != &DiskEntry->LogicalPartListHead;
1799 ListEntry = ListEntry->
Flink)
1816 DPRINT1(
"Updating logical partition entry %lu\n",
Index);
1828 if (LinkInfo !=
NULL)
1832 HiddenSectors64.
QuadPart = PartEntry->
StartSector.
QuadPart - DiskEntry->SectorAlignment - DiskEntry->ExtendedPartition->StartSector.QuadPart;
1842 LinkInfo = &DiskEntry->LayoutBuffer->PartitionEntry[
Index + 1];
1858 DPRINT1(
"Wiping primary partition entry %lu\n",
Index);
1872 for (
Index = 4;
Index < DiskEntry->LayoutBuffer->PartitionCount;
Index++)
1896 DiskEntry->Dirty =
TRUE;
1908 if (PartEntry->LogicalPartition)
1913 if (PartEntry->ListEntry.Blink != ListHead)
1921 return PrevPartEntry;
1937 if (PartEntry->LogicalPartition)
1942 if (PartEntry->ListEntry.Flink != ListHead)
1950 return NextPartEntry;
1970 if (!PartEntry->IsPartitioned ||
1977 PartEntry->PartitionNumber == 0)
1987 L"\\Device\\Harddisk%lu\\Partition%lu",
1988 PartEntry->DiskEntry->DiskNumber,
1989 PartEntry->PartitionNumber);
2006 DPRINT1(
"ERROR: Cannot open volume %wZ for dismounting! (Status 0x%lx)\n", &
Name,
Status);
2023 DPRINT1(
"WARNING: Failed to lock volume! Operations may fail! (Status 0x%lx)\n", LockStatus);
2039 DPRINT1(
"Failed to unmount volume (Status 0x%lx)\n",
Status);
2055 DPRINT1(
"Failed to unlock volume (Status 0x%lx)\n", LockStatus);
2073 if ((PartEntry ==
NULL) ||
2074 (PartEntry->DiskEntry ==
NULL))
2106 if (VolumeEntry ==
NULL)
2114 if (VolumeEntry->pszLabel)
2115 RtlFreeHeap(RtlGetProcessHeap(), 0, VolumeEntry->pszLabel);
2117 if (VolumeEntry->pszFilesystem)
2118 RtlFreeHeap(RtlGetProcessHeap(), 0, VolumeEntry->pszFilesystem);
2120 if (VolumeEntry->pExtents)
2121 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)
VOID DestroyPartitionList(IN PPARTLIST List)
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)
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)
PPARTLIST CreatePartitionList(VOID)
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)
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