ReactOS 0.4.15-dev-8428-g6910fa6
partlist.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _PARTLIST_UI
 

Typedefs

typedef struct _PARTLIST_UI PARTLIST_UI
 
typedef struct _PARTLIST_UIPPARTLIST_UI
 

Functions

VOID GetPartitionTypeString (IN PPARTENTRY PartEntry, OUT PSTR strBuffer, IN ULONG cchBuffer)
 
VOID PartitionDescription (IN PPARTENTRY PartEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
 
VOID DiskDescription (IN PDISKENTRY DiskEntry, OUT PSTR strBuffer, IN SIZE_T cchBuffer)
 
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)
 
VOID DrawPartitionList (IN PPARTLIST_UI ListUi)
 
VOID ScrollUpDownPartitionList (_In_ PPARTLIST_UI ListUi, _In_ BOOLEAN Direction)
 

Typedef Documentation

◆ PARTLIST_UI

◆ PPARTLIST_UI

Function Documentation

◆ DiskDescription()

VOID DiskDescription ( IN PDISKENTRY  DiskEntry,
OUT PSTR  strBuffer,
IN SIZE_T  cchBuffer 
)

Definition at line 301 of file partlist.c.

305{
306 ULONGLONG DiskSize;
307 PCSTR Unit;
308
309 /* Get the disk size */
310 DiskSize = GetDiskSizeInBytes(DiskEntry);
311 PrettifySize1(&DiskSize, &Unit);
312
313 //
314 // FIXME: We *MUST* use TXTSETUP.SIF strings from section "DiskDriverMap" !!
315 //
316 if (DiskEntry->DriverName.Length > 0)
317 {
320 DiskSize,
321 Unit,
322 DiskEntry->DiskNumber,
323 DiskEntry->Port,
324 DiskEntry->Bus,
325 DiskEntry->Id,
326 &DiskEntry->DriverName,
327 DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? "MBR" :
328 DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? "GPT" :
329 "RAW");
330 }
331 else
332 {
335 DiskSize,
336 Unit,
337 DiskEntry->DiskNumber,
338 DiskEntry->Port,
339 DiskEntry->Bus,
340 DiskEntry->Id,
341 DiskEntry->DiskStyle == PARTITION_STYLE_MBR ? "MBR" :
342 DiskEntry->DiskStyle == PARTITION_STYLE_GPT ? "GPT" :
343 "RAW");
344 }
345}
static DWORD cchBuffer
Definition: fusion.c:85
Unit
Definition: gdiplusenums.h:26
#define GetDiskSizeInBytes(DiskEntry)
Definition: partlist.h:233
@ PARTITION_STYLE_GPT
Definition: imports.h:202
@ PARTITION_STYLE_MBR
Definition: imports.h:201
NTSTRSAFEVAPI RtlStringCchPrintfA(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1085
VOID PrettifySize1(IN OUT PULONGLONG Size, OUT PCSTR *Unit)
Definition: partlist.c:96
const char * PCSTR
Definition: typedefs.h:52
uint64_t ULONGLONG
Definition: typedefs.h:67
PCSTR MUIGetString(ULONG Number)
Definition: mui.c:251
#define STRING_HDDINFO2
Definition: mui.h:177
#define STRING_HDDINFO1
Definition: mui.h:176

Referenced by ChangeSystemPartitionPage(), CheckFileSystemPage(), CreatePartitionPage(), DeletePartitionPage(), FormatPartitionPage(), PrintDiskData(), and SelectFileSystemPage().

◆ DrawPartitionList()

VOID DrawPartitionList ( IN PPARTLIST_UI  ListUi)

Definition at line 582 of file partlist.c.

584{
585 PPARTLIST List = ListUi->List;
586 PLIST_ENTRY Entry, Entry2;
587 PDISKENTRY DiskEntry;
588 PPARTENTRY PartEntry = NULL;
589 COORD coPos;
590 ULONG Written;
593 SHORT i;
594 SHORT CurrentDiskLine;
595 SHORT CurrentPartLine;
596 SHORT LastLine;
597 BOOLEAN CurrentPartLineFound = FALSE;
598 BOOLEAN CurrentDiskLineFound = FALSE;
599
600 Width = ListUi->Right - ListUi->Left - 1;
601 Height = ListUi->Bottom - ListUi->Top - 2;
602
603 /* Calculate the line of the current disk and partition */
604 CurrentDiskLine = 0;
605 CurrentPartLine = 0;
606 LastLine = 0;
607
608 for (Entry = List->DiskListHead.Flink;
609 Entry != &List->DiskListHead;
610 Entry = Entry->Flink)
611 {
612 DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
613
614 LastLine += 2;
615 if (CurrentPartLineFound == FALSE)
616 {
617 CurrentPartLine += 2;
618 }
619
620 for (Entry2 = DiskEntry->PrimaryPartListHead.Flink;
621 Entry2 != &DiskEntry->PrimaryPartListHead;
622 Entry2 = Entry2->Flink)
623 {
624 PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
625 if (PartEntry == ListUi->CurrentPartition)
626 {
627 CurrentPartLineFound = TRUE;
628 }
629
630 if (CurrentPartLineFound == FALSE)
631 {
632 CurrentPartLine++;
633 }
634
635 LastLine++;
636 }
637
638 if (CurrentPartLineFound == FALSE)
639 {
640 for (Entry2 = DiskEntry->LogicalPartListHead.Flink;
641 Entry2 != &DiskEntry->LogicalPartListHead;
642 Entry2 = Entry2->Flink)
643 {
644 PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
645 if (PartEntry == ListUi->CurrentPartition)
646 {
647 CurrentPartLineFound = TRUE;
648 }
649
650 if (CurrentPartLineFound == FALSE)
651 {
652 CurrentPartLine++;
653 }
654
655 LastLine++;
656 }
657 }
658
659 if (DiskEntry == ListUi->CurrentDisk)
660 {
661 CurrentDiskLineFound = TRUE;
662 }
663
664 if (Entry->Flink != &List->DiskListHead)
665 {
666 if (CurrentDiskLineFound == FALSE)
667 {
668 CurrentPartLine++;
669 CurrentDiskLine = CurrentPartLine;
670 }
671
672 LastLine++;
673 }
674 else
675 {
676 LastLine--;
677 }
678 }
679
680 /* If it possible, make the disk name visible */
681 if (CurrentPartLine < ListUi->Offset)
682 {
683 ListUi->Offset = CurrentPartLine;
684 }
685 else if (CurrentPartLine - ListUi->Offset > Height)
686 {
687 ListUi->Offset = CurrentPartLine - Height;
688 }
689
690 if (CurrentDiskLine < ListUi->Offset && CurrentPartLine - CurrentDiskLine < Height)
691 {
692 ListUi->Offset = CurrentDiskLine;
693 }
694
695 /* Draw upper left corner */
696 coPos.X = ListUi->Left;
697 coPos.Y = ListUi->Top;
699 CharUpperLeftCorner, // '+',
700 1,
701 coPos,
702 &Written);
703
704 /* Draw upper edge */
705 coPos.X = ListUi->Left + 1;
706 coPos.Y = ListUi->Top;
707 if (ListUi->Offset == 0)
708 {
710 CharHorizontalLine, // '-',
711 Width,
712 coPos,
713 &Written);
714 }
715 else
716 {
718 CharHorizontalLine, // '-',
719 Width - 4,
720 coPos,
721 &Written);
722 {
723 CHAR szBuff[] = "(.)"; // "(up)"
724 szBuff[1] = CharUpArrow;
725 coPos.X = ListUi->Right - 5;
727 szBuff,
728 3,
729 coPos,
730 &Written);
731 }
732 coPos.X = ListUi->Right - 2;
734 CharHorizontalLine, // '-',
735 2,
736 coPos,
737 &Written);
738 }
739
740 /* Draw upper right corner */
741 coPos.X = ListUi->Right;
742 coPos.Y = ListUi->Top;
744 CharUpperRightCorner, // '+',
745 1,
746 coPos,
747 &Written);
748
749 /* Draw left and right edge */
750 for (i = ListUi->Top + 1; i < ListUi->Bottom; i++)
751 {
752 coPos.X = ListUi->Left;
753 coPos.Y = i;
755 CharVerticalLine, // '|',
756 1,
757 coPos,
758 &Written);
759
760 coPos.X = ListUi->Right;
762 CharVerticalLine, //'|',
763 1,
764 coPos,
765 &Written);
766 }
767
768 /* Draw lower left corner */
769 coPos.X = ListUi->Left;
770 coPos.Y = ListUi->Bottom;
772 CharLowerLeftCorner, // '+',
773 1,
774 coPos,
775 &Written);
776
777 /* Draw lower edge */
778 coPos.X = ListUi->Left + 1;
779 coPos.Y = ListUi->Bottom;
780 if (LastLine - ListUi->Offset <= Height)
781 {
783 CharHorizontalLine, // '-',
784 Width,
785 coPos,
786 &Written);
787 }
788 else
789 {
791 CharHorizontalLine, // '-',
792 Width - 4,
793 coPos,
794 &Written);
795 {
796 CHAR szBuff[] = "(.)"; // "(down)"
797 szBuff[1] = CharDownArrow;
798 coPos.X = ListUi->Right - 5;
800 szBuff,
801 3,
802 coPos,
803 &Written);
804 }
805 coPos.X = ListUi->Right - 2;
807 CharHorizontalLine, // '-',
808 2,
809 coPos,
810 &Written);
811 }
812
813 /* Draw lower right corner */
814 coPos.X = ListUi->Right;
815 coPos.Y = ListUi->Bottom;
817 CharLowerRightCorner, // '+',
818 1,
819 coPos,
820 &Written);
821
822 /* Print list entries */
823 ListUi->Line = -ListUi->Offset;
824
825 for (Entry = List->DiskListHead.Flink;
826 Entry != &List->DiskListHead;
827 Entry = Entry->Flink)
828 {
829 DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
830
831 /* Print disk entry */
832 PrintDiskData(ListUi, DiskEntry);
833 }
834}
unsigned char BOOLEAN
BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:407
BOOL WINAPI FillConsoleOutputCharacterA(IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:560
static LPHIST_ENTRY Bottom
Definition: history.c:54
HANDLE StdOutput
Definition: consup.c:37
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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
Definition: glfuncs.h:248
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
short SHORT
Definition: pedump.c:59
unsigned short USHORT
Definition: pedump.c:61
static VOID PrintDiskData(IN PPARTLIST_UI ListUi, IN PDISKENTRY DiskEntry)
Definition: partlist.c:501
base of all file and directory entries
Definition: entries.h:83
Definition: bl.h:1338
ULONG Y
Definition: bl.h:1340
ULONG X
Definition: bl.h:1339
LIST_ENTRY LogicalPartListHead
Definition: partlist.h:129
LIST_ENTRY PrimaryPartListHead
Definition: partlist.h:128
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
CHAR CharHorizontalLine
Definition: mui.c:39
CHAR CharUpperRightCorner
Definition: mui.c:42
CHAR CharDownArrow
Definition: mui.c:38
CHAR CharLowerRightCorner
Definition: mui.c:44
CHAR CharUpperLeftCorner
Definition: mui.c:41
CHAR CharVerticalLine
Definition: mui.c:40
CHAR CharLowerLeftCorner
Definition: mui.c:43
CHAR CharUpArrow
Definition: mui.c:37
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
char CHAR
Definition: xmlstorage.h:175

Referenced by ScrollUpDownPartitionList().

◆ GetPartitionTypeString()

VOID GetPartitionTypeString ( IN PPARTENTRY  PartEntry,
OUT PSTR  strBuffer,
IN ULONG  cchBuffer 
)

Definition at line 237 of file drivepage.c.

241{
242 if (PartEntry->PartitionType == PARTITION_ENTRY_UNUSED)
243 {
244 StringCchCopyA(strBuffer, cchBuffer,
245 "Unused" /* MUIGetString(STRING_FORMATUNUSED) */);
246 }
247 else if (IsContainerPartition(PartEntry->PartitionType))
248 {
249 StringCchCopyA(strBuffer, cchBuffer,
250 "Extended Partition" /* MUIGetString(STRING_EXTENDED_PARTITION) */);
251 }
252 else
253 {
254 UINT i;
255
256 /* Do the table lookup */
257 if (PartEntry->DiskEntry->DiskStyle == PARTITION_STYLE_MBR)
258 {
259 for (i = 0; i < ARRAYSIZE(MbrPartitionTypes); ++i)
260 {
261 if (PartEntry->PartitionType == MbrPartitionTypes[i].Type)
262 {
263 StringCchCopyA(strBuffer, cchBuffer,
265 return;
266 }
267 }
268 }
269#if 0 // TODO: GPT support!
270 else if (PartEntry->DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
271 {
272 for (i = 0; i < ARRAYSIZE(GptPartitionTypes); ++i)
273 {
274 if (IsEqualPartitionType(PartEntry->PartitionType,
276 {
277 StringCchCopyA(strBuffer, cchBuffer,
279 return;
280 }
281 }
282 }
283#endif
284
285 /* We are here because the partition type is unknown */
286 if (cchBuffer > 0) *strBuffer = '\0';
287 }
288
289 if ((cchBuffer > 0) && (*strBuffer == '\0'))
290 {
291 StringCchPrintfA(strBuffer, cchBuffer,
292 // MUIGetString(STRING_PARTTYPE),
293 "Type 0x%02x",
294 PartEntry->PartitionType);
295 }
296}
const GPT_PARTITION_TYPE GptPartitionTypes[NUM_GPT_PARTITION_TYPES]
Definition: partinfo.c:271
const MBR_PARTITION_TYPE MbrPartitionTypes[NUM_MBR_PARTITION_TYPES]
Definition: partinfo.c:46
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:86
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
static const WCHAR Description[]
Definition: oid.c:1266
unsigned int UINT
Definition: ndis.h:50
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:321
STRSAFEAPI StringCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:145
STRSAFEAPI StringCchPrintfA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszFormat,...)
Definition: strsafe.h:520

Referenced by PartitionDescription(), and PrintPartitionData().

◆ InitPartitionListUi()

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 
)

Definition at line 351 of file partlist.c.

359{
360 ListUi->List = List;
361 // ListUi->FirstShown = NULL;
362 // ListUi->LastShown = NULL;
363
364 ListUi->Left = Left;
365 ListUi->Top = Top;
366 ListUi->Right = Right;
367 ListUi->Bottom = Bottom;
368
369 ListUi->Line = 0;
370 ListUi->Offset = 0;
371
372 // ListUi->Redraw = TRUE;
373
374 /* Search for first usable disk and partition */
375 if (!CurrentEntry)
376 {
377 ListUi->CurrentDisk = NULL;
378 ListUi->CurrentPartition = NULL;
379
380 if (!IsListEmpty(&List->DiskListHead))
381 {
382 ListUi->CurrentDisk = CONTAINING_RECORD(List->DiskListHead.Flink,
383 DISKENTRY, ListEntry);
384
385 if (!IsListEmpty(&ListUi->CurrentDisk->PrimaryPartListHead))
386 {
387 ListUi->CurrentPartition = CONTAINING_RECORD(ListUi->CurrentDisk->PrimaryPartListHead.Flink,
388 PARTENTRY, ListEntry);
389 }
390 }
391 }
392 else
393 {
394 /*
395 * The CurrentEntry must belong to the associated partition list,
396 * and the latter must therefore not be empty.
397 */
398 ASSERT(!IsListEmpty(&List->DiskListHead));
399 ASSERT(CurrentEntry->DiskEntry->PartList == List);
400
401 ListUi->CurrentPartition = CurrentEntry;
402 ListUi->CurrentDisk = CurrentEntry->DiskEntry;
403 }
404}
static LPHIST_ENTRY Top
Definition: history.c:53
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define ASSERT(a)
Definition: mode.c:44

Referenced by SelectPartitionPage().

◆ PartitionDescription()

VOID PartitionDescription ( IN PPARTENTRY  PartEntry,
OUT PSTR  strBuffer,
IN SIZE_T  cchBuffer 
)

Definition at line 148 of file partlist.c.

152{
153 PSTR pBuffer = strBuffer;
154 size_t cchBufferSize = cchBuffer;
155 ULONGLONG PartSize;
156 PCSTR Unit;
157
158 /* Get the partition size */
159 PartSize = GetPartEntrySizeInBytes(PartEntry);
160 PrettifySize2(&PartSize, &Unit);
161
162 if (PartEntry->IsPartitioned == FALSE)
163 {
164 /* Unpartitioned space: Just display the description and size */
165 RtlStringCchPrintfExA(pBuffer, cchBufferSize,
166 &pBuffer, &cchBufferSize, 0,
167 " %s%-.30s",
168 PartEntry->LogicalPartition ? " " : "", // Optional indentation
170
171 RtlStringCchPrintfA(pBuffer, cchBufferSize,
172 "%*s%6I64u %s",
173 38 - min(strlen(strBuffer), 38), "", // Indentation
174 PartSize,
175 Unit);
176 return;
177 }
178
179//
180// NOTE: This could be done with the next case.
181//
182 if ((PartEntry->DiskEntry->DiskStyle == PARTITION_STYLE_MBR) &&
183 IsContainerPartition(PartEntry->PartitionType))
184 {
185 /* Extended partition container: Just display the partition's type and size */
186 RtlStringCchPrintfExA(pBuffer, cchBufferSize,
187 &pBuffer, &cchBufferSize, 0,
188 " %-.30s",
190
191 RtlStringCchPrintfA(pBuffer, cchBufferSize,
192 "%*s%6I64u %s",
193 38 - min(strlen(strBuffer), 38), "", // Indentation
194 PartSize,
195 Unit);
196 return;
197 }
198
199 /*
200 * Not an extended partition container.
201 */
202
203 /* Drive letter and partition number */
204 RtlStringCchPrintfExA(pBuffer, cchBufferSize,
205 &pBuffer, &cchBufferSize, 0,
206 "%c%c %c %s(%lu) ",
207 (PartEntry->DriveLetter == 0) ? '-' : (CHAR)PartEntry->DriveLetter,
208 (PartEntry->DriveLetter == 0) ? '-' : ':',
209 PartEntry->BootIndicator ? '*' : ' ',
210 PartEntry->LogicalPartition ? " " : "", // Optional indentation
211 PartEntry->PartitionNumber);
212
213 /*
214 * If the volume's file system is recognized, display the volume label
215 * (if any) and the file system name. Otherwise, display the partition
216 * type if it's not a new partition.
217 */
218 if (!PartEntry->New && *PartEntry->FileSystem &&
219 _wcsicmp(PartEntry->FileSystem, L"RAW") != 0)
220 {
221 size_t cchLabelSize = 0;
222 if (*PartEntry->VolumeLabel)
223 {
224 RtlStringCchPrintfExA(pBuffer, cchBufferSize,
225 &pBuffer, &cchLabelSize, 0,
226 "\"%-.11S\" ",
227 PartEntry->VolumeLabel);
228 cchLabelSize = cchBufferSize - cchLabelSize; // Actual length of the label part.
229 cchBufferSize -= cchLabelSize; // And reset cchBufferSize to what it should be.
230 }
231
232 // TODO: Group this part together with the similar one
233 // from below once the strings are in the same encoding...
234 RtlStringCchPrintfExA(pBuffer, cchBufferSize,
235 &pBuffer, &cchBufferSize, 0,
236 "[%-.*S]",
237 /* The minimum length can be at most 11 since
238 * cchLabelSize can be at most == 11 + 3 == 14 */
239 25 - min(cchLabelSize, 25),
240 PartEntry->FileSystem);
241 }
242 else
243 {
244 CHAR PartTypeString[32];
245 PCSTR PartType = PartTypeString;
246
247 if (PartEntry->New)
248 {
249 /* Use this description if the partition is new (and thus, not formatted) */
251 }
252 else
253 {
254 /* If the partition is not new but its file system is not recognized
255 * (or is not formatted), use the partition type description. */
256 GetPartitionTypeString(PartEntry,
257 PartTypeString,
258 ARRAYSIZE(PartTypeString));
259 PartType = PartTypeString;
260 }
261 if (!PartType || !*PartType)
262 {
264 }
265
266 // TODO: Group this part together with the similar one
267 // from above once the strings are in the same encoding...
268 RtlStringCchPrintfExA(pBuffer, cchBufferSize,
269 &pBuffer, &cchBufferSize, 0,
270 "[%-.*s]",
271 25,
272 PartType);
273 }
274
275 /* Show the remaining free space only if a FS is mounted */
276 // FIXME: We don't support that yet!
277#if 0
278 if (*PartEntry->FileSystem)
279 {
280 RtlStringCchPrintfA(pBuffer, cchBufferSize,
281 "%*s%6I64u %s (%6I64u %s %s)",
282 38 - min(strlen(strBuffer), 38), "", // Indentation
283 PartSize,
284 Unit,
285 PartFreeSize,
286 Unit,
287 "free");
288 }
289 else
290#endif
291 {
292 RtlStringCchPrintfA(pBuffer, cchBufferSize,
293 "%*s%6I64u %s",
294 38 - min(strlen(strBuffer), 38), "", // Indentation
295 PartSize,
296 Unit);
297 }
298}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
PartType
#define GetPartEntrySizeInBytes(PartEntry)
Definition: partlist.h:230
#define min(a, b)
Definition: monoChain.cc:55
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,...)
Definition: ntstrsafe.h:1218
#define L(x)
Definition: ntvdm.h:50
PVOID pBuffer
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
VOID GetPartitionTypeString(IN PPARTENTRY PartEntry, OUT PSTR strBuffer, IN ULONG cchBuffer)
Definition: partlist.c:35
VOID PrettifySize2(IN OUT PULONGLONG Size, OUT PCSTR *Unit)
Definition: partlist.c:119
char * PSTR
Definition: typedefs.h:51
#define STRING_UNPSPACE
Definition: mui.h:178
#define STRING_FORMATUNKNOWN
Definition: mui.h:183
#define STRING_UNFORMATTED
Definition: mui.h:180
#define STRING_EXTENDED_PARTITION
Definition: mui.h:181

Referenced by ChangeSystemPartitionPage(), CheckFileSystemPage(), DeletePartitionPage(), FormatPartitionPage(), PrintPartitionData(), and SelectFileSystemPage().

◆ ScrollUpDownPartitionList()

VOID ScrollUpDownPartitionList ( _In_ PPARTLIST_UI  ListUi,
_In_ BOOLEAN  Direction 
)
Parameters
[in]DirectionTRUE or FALSE to scroll to the next (down) or previous (up) entry, respectively.

Definition at line 841 of file partlist.c.

844{
845 PPARTENTRY PartEntry =
847 : GetPrevPartition)(ListUi->List, ListUi->CurrentPartition);
848 if (PartEntry)
849 {
850 ListUi->CurrentPartition = PartEntry;
851 ListUi->CurrentDisk = PartEntry->DiskEntry;
852 DrawPartitionList(ListUi);
853 }
854}
PPARTENTRY GetPrevPartition(IN PPARTLIST List, IN PPARTENTRY CurrentPart OPTIONAL)
Definition: partlist.c:2321
PPARTENTRY GetNextPartition(IN PPARTLIST List, IN PPARTENTRY CurrentPart OPTIONAL)
Definition: partlist.c:2229
VOID DrawPartitionList(IN PPARTLIST_UI ListUi)
Definition: partlist.c:582
struct _DISKENTRY * DiskEntry
Definition: partlist.h:46
WDF_EXTERN_C_START typedef _In_ WDFDEVICE _In_ WDFCONTEXT _In_ WDF_DMA_DIRECTION Direction

Referenced by SelectPartitionPage().