67 #if 0 // TODO: GPT support! 72 if (IsEqualPartitionType(PartEntry->PartitionType,
87 if ((
cchBuffer > 0) && (*strBuffer ==
'\0'))
91 PartEntry->PartitionType);
102 if (DiskSize >= 10 *
GB)
126 if (PartSize >= 10 *
GB)
133 if (PartSize >= 10 *
MB)
159 PartSize = PartEntry->SectorCount.QuadPart * PartEntry->DiskEntry->BytesPerSector;
162 if (PartEntry->IsPartitioned ==
FALSE)
168 PartEntry->LogicalPartition ?
" " :
"",
207 (PartEntry->DriveLetter == 0) ?
'-' : (
CHAR)PartEntry->DriveLetter,
208 (PartEntry->DriveLetter == 0) ?
'-' :
':',
209 PartEntry->BootIndicator ?
'*' :
' ',
210 PartEntry->LogicalPartition ?
" " :
"",
211 PartEntry->PartitionNumber);
218 if (!PartEntry->New && *PartEntry->FileSystem &&
219 _wcsicmp(PartEntry->FileSystem,
L"RAW") != 0)
221 size_t cchLabelSize = 0;
222 if (*PartEntry->VolumeLabel)
227 PartEntry->VolumeLabel);
239 25 -
min(cchLabelSize, 25),
240 PartEntry->FileSystem);
244 CHAR PartTypeString[32];
278 if (*PartEntry->FileSystem)
281 "%*s%6I64u %s (%6I64u %s %s)",
310 DiskSize = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
316 if (DiskEntry->DriverName.Length > 0)
322 DiskEntry->DiskNumber,
326 &DiskEntry->DriverName,
337 DiskEntry->DiskNumber,
366 ListUi->Right = Right;
377 ListUi->CurrentDisk =
NULL;
378 ListUi->CurrentPartition =
NULL;
385 if (!
IsListEmpty(&ListUi->CurrentDisk->PrimaryPartListHead))
387 ListUi->CurrentPartition =
CONTAINING_RECORD(ListUi->CurrentDisk->PrimaryPartListHead.Flink,
399 ASSERT(CurrentEntry->DiskEntry->PartList ==
List);
401 ListUi->CurrentPartition = CurrentEntry;
402 ListUi->CurrentDisk = CurrentEntry->DiskEntry;
416 Width = ListUi->Right - ListUi->Left - 1;
417 Height = ListUi->Bottom - ListUi->Top - 2;
419 coPos.
X = ListUi->Left + 1;
420 coPos.
Y = ListUi->Top + 1 + ListUi->Line;
422 if (ListUi->Line >= 0 && ListUi->Line <=
Height)
452 CHAR LineBuffer[100];
456 Width = ListUi->Right - ListUi->Left - 1;
457 Height = ListUi->Bottom - ListUi->Top - 2;
459 coPos.
X = ListUi->Left + 1;
460 coPos.
Y = ListUi->Top + 1 + ListUi->Line;
462 Attribute = (ListUi->CurrentDisk == DiskEntry &&
463 ListUi->CurrentPartition == PartEntry) ?
467 if (ListUi->Line >= 0 && ListUi->Line <=
Height)
477 if (ListUi->Line >= 0 && ListUi->Line <=
Height)
487 if (ListUi->Line >= 0 && ListUi->Line <=
Height)
505 PPARTENTRY PrimaryPartEntry, LogicalPartEntry;
511 CHAR LineBuffer[100];
515 Width = ListUi->Right - ListUi->Left - 1;
516 Height = ListUi->Bottom - ListUi->Top - 2;
518 coPos.
X = ListUi->Left + 1;
519 coPos.
Y = ListUi->Top + 1 + ListUi->Line;
521 if (ListUi->Line >= 0 && ListUi->Line <=
Height)
537 if (ListUi->Line >= 0 && ListUi->Line <=
Height)
552 for (PrimaryEntry = DiskEntry->PrimaryPartListHead.
Flink;
553 PrimaryEntry != &DiskEntry->PrimaryPartListHead;
554 PrimaryEntry = PrimaryEntry->
Flink)
564 for (LogicalEntry = DiskEntry->LogicalPartListHead.
Flink;
565 LogicalEntry != &DiskEntry->LogicalPartListHead;
566 LogicalEntry = LogicalEntry->
Flink)
594 SHORT CurrentDiskLine;
595 SHORT CurrentPartLine;
600 Width = ListUi->Right - ListUi->Left - 1;
601 Height = ListUi->Bottom - ListUi->Top - 2;
615 if (CurrentPartLineFound ==
FALSE)
617 CurrentPartLine += 2;
622 Entry2 = Entry2->
Flink)
625 if (PartEntry == ListUi->CurrentPartition)
627 CurrentPartLineFound =
TRUE;
630 if (CurrentPartLineFound ==
FALSE)
638 if (CurrentPartLineFound ==
FALSE)
642 Entry2 = Entry2->
Flink)
645 if (PartEntry == ListUi->CurrentPartition)
647 CurrentPartLineFound =
TRUE;
650 if (CurrentPartLineFound ==
FALSE)
659 if (DiskEntry == ListUi->CurrentDisk)
661 CurrentDiskLineFound =
TRUE;
666 if (CurrentDiskLineFound ==
FALSE)
669 CurrentDiskLine = CurrentPartLine;
681 if (CurrentPartLine < ListUi->
Offset)
683 ListUi->Offset = CurrentPartLine;
685 else if (CurrentPartLine - ListUi->Offset >
Height)
687 ListUi->Offset = CurrentPartLine -
Height;
690 if (CurrentDiskLine < ListUi->
Offset && CurrentPartLine - CurrentDiskLine <
Height)
692 ListUi->Offset = CurrentDiskLine;
696 coPos.
X = ListUi->Left;
697 coPos.
Y = ListUi->Top;
705 coPos.
X = ListUi->Left + 1;
706 coPos.
Y = ListUi->Top;
707 if (ListUi->Offset == 0)
722 coPos.
X = ListUi->Right - 5;
728 coPos.
X = ListUi->Right - 2;
737 coPos.
X = ListUi->Right;
738 coPos.
Y = ListUi->Top;
746 for (
i = ListUi->Top + 1; i < ListUi->
Bottom;
i++)
748 coPos.
X = ListUi->Left;
756 coPos.
X = ListUi->Right;
765 coPos.
X = ListUi->Left;
766 coPos.
Y = ListUi->Bottom;
774 coPos.
X = ListUi->Left + 1;
775 coPos.
Y = ListUi->Bottom;
776 if (LastLine - ListUi->Offset <=
Height)
791 coPos.
X = ListUi->Right - 5;
797 coPos.
X = ListUi->Right - 2;
806 coPos.
X = ListUi->Right;
807 coPos.
Y = ListUi->Bottom;
815 ListUi->Line = -ListUi->Offset;
835 ListUi->CurrentPartition = NextPart;
836 ListUi->CurrentDisk = NextPart->
DiskEntry;
848 ListUi->CurrentPartition = PrevPart;
849 ListUi->CurrentDisk = PrevPart->
DiskEntry;
LIST_ENTRY PrimaryPartListHead
#define STRING_UNFORMATTED
static VOID PrintEmptyLine(IN PPARTLIST_UI ListUi)
IN BOOLEAN OUT PSTR IN SIZE_T cchBufferSize
#define STRING_FORMATUNKNOWN
BOOL WINAPI FillConsoleOutputAttribute(IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten)
ACPI_SIZE strlen(const char *String)
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
IN PVOID IN PVOID IN USHORT IN USHORT Size
#define IsContainerPartition(PartitionType)
_In_ HFONT _Out_ PUINT Height
static const WCHAR Description[]
VOID DiskDescription(IN PDISKENTRY DiskEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
#define STRING_EXTENDED_PARTITION
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
BOOL WINAPI FillConsoleOutputCharacterA(IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
#define PARTITION_ENTRY_UNUSED
static VOID PrintPartitionData(IN PPARTLIST_UI ListUi, IN PDISKENTRY DiskEntry, IN PPARTENTRY PartEntry)
const GPT_PARTITION_TYPE GptPartitionTypes[NUM_GPT_PARTITION_TYPES]
NTSTRSAFEVAPI RtlStringCchPrintfA(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
VOID PrettifySize1(IN OUT PULONGLONG Size, OUT PCSTR *Unit)
PCSTR MUIGetString(ULONG Number)
BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
VOID ScrollDownPartitionList(IN PPARTLIST_UI ListUi)
PPARTENTRY GetNextPartition(IN PPARTLIST List, IN PPARTENTRY CurrentPart OPTIONAL)
struct _LIST_ENTRY * Flink
struct _DISKENTRY * DiskEntry
VOID GetPartitionTypeString(IN PPARTENTRY PartEntry, OUT PSTR strBuffer, IN ULONG cchBuffer)
#define STRING_FORMATUNUSED
VOID PrettifySize2(IN OUT PULONGLONG Size, OUT PCSTR *Unit)
const MBR_PARTITION_TYPE MbrPartitionTypes[NUM_MBR_PARTITION_TYPES]
_Must_inspect_result_ _In_ WDFCMRESLIST List
PPARTENTRY GetPrevPartition(IN PPARTLIST List, IN PPARTENTRY CurrentPart OPTIONAL)
static VOID PrintDiskData(IN PPARTLIST_UI ListUi, IN PDISKENTRY DiskEntry)
_In_ ULONG _In_ ULONG Offset
VOID PartitionDescription(IN PPARTENTRY PartEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
ULONGLONG RoundingDivide(IN ULONGLONG Dividend, IN ULONGLONG Divisor)
static LPHIST_ENTRY Bottom
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
LIST_ENTRY LogicalPartListHead
VOID InitPartitionListUi(IN OUT PPARTLIST_UI ListUi, IN PPARTLIST List, IN PPARTENTRY CurrentEntry OPTIONAL, IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom)
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
VOID DrawPartitionList(IN PPARTLIST_UI ListUi)
NTSTRSAFEAPI RtlStringCchCopyA(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCSTR pszSrc)
VOID ScrollUpPartitionList(IN PPARTLIST_UI ListUi)
base of all file and directory entries
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
NTSTRSAFEVAPI RtlStringCchPrintfExA(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cchDest, _Outptr_opt_result_buffer_(*pcchRemaining) NTSTRSAFE_PSTR *ppszDestEnd, _Out_opt_ size_t *pcchRemaining, _In_ STRSAFE_DWORD dwFlags, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
PULONG MinorVersion OPTIONAL