ReactOS  0.4.13-dev-66-gc714b7f
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 enum _FORMATMACHINESTATE FORMATMACHINESTATE
 
typedef enum _FORMATMACHINESTATEPFORMATMACHINESTATE
 
typedef struct _PARTLIST_UI PARTLIST_UI
 
typedef struct _PARTLIST_UIPPARTLIST_UI
 

Enumerations

enum  _FORMATMACHINESTATE {
  Start, FormatSystemPartition, FormatInstallPartition, FormatOtherPartition,
  FormatDone
}
 

Functions

VOID GetPartTypeStringFromPartitionType (IN UCHAR partitionType, OUT PCHAR strPartType, IN ULONG cchPartType)
 
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 ScrollDownPartitionList (IN PPARTLIST_UI ListUi)
 
VOID ScrollUpPartitionList (IN PPARTLIST_UI ListUi)
 
VOID DrawPartitionList (IN PPARTLIST_UI ListUi)
 

Typedef Documentation

◆ FORMATMACHINESTATE

◆ PARTLIST_UI

◆ PFORMATMACHINESTATE

◆ PPARTLIST_UI

Enumeration Type Documentation

◆ _FORMATMACHINESTATE

Enumerator
Start 
FormatSystemPartition 
FormatInstallPartition 
FormatOtherPartition 
FormatDone 

Definition at line 31 of file partlist.h.

32 {
33  Start,
37  FormatDone,
38  // CheckSystemPartition,
39  // CheckInstallPartition,
40  // CheckOtherPartition,
41  // CheckDone
enum _FORMATMACHINESTATE FORMATMACHINESTATE
Definition: partlist.h:33
enum _FORMATMACHINESTATE * PFORMATMACHINESTATE

Function Documentation

◆ DrawPartitionList()

VOID DrawPartitionList ( IN PPARTLIST_UI  ListUi)

Definition at line 427 of file partlist.c.

429 {
430  PPARTLIST List = ListUi->List;
431  PLIST_ENTRY Entry, Entry2;
432  PDISKENTRY DiskEntry;
433  PPARTENTRY PartEntry = NULL;
434  COORD coPos;
435  ULONG Written;
436  USHORT Width;
437  USHORT Height;
438  SHORT i;
439  SHORT CurrentDiskLine;
440  SHORT CurrentPartLine;
441  SHORT LastLine;
442  BOOLEAN CurrentPartLineFound = FALSE;
443  BOOLEAN CurrentDiskLineFound = FALSE;
444 
445  Width = ListUi->Right - ListUi->Left - 1;
446  Height = ListUi->Bottom - ListUi->Top - 2;
447 
448  /* Calculate the line of the current disk and partition */
449  CurrentDiskLine = 0;
450  CurrentPartLine = 0;
451  LastLine = 0;
452 
453  for (Entry = List->DiskListHead.Flink;
454  Entry != &List->DiskListHead;
455  Entry = Entry->Flink)
456  {
457  DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
458 
459  LastLine += 2;
460  if (CurrentPartLineFound == FALSE)
461  {
462  CurrentPartLine += 2;
463  }
464 
465  for (Entry2 = DiskEntry->PrimaryPartListHead.Flink;
466  Entry2 != &DiskEntry->PrimaryPartListHead;
467  Entry2 = Entry2->Flink)
468  {
469  PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
470  if (PartEntry == ListUi->CurrentPartition)
471  {
472  CurrentPartLineFound = TRUE;
473  }
474 
475  if (CurrentPartLineFound == FALSE)
476  {
477  CurrentPartLine++;
478  }
479 
480  LastLine++;
481  }
482 
483  if (CurrentPartLineFound == FALSE)
484  {
485  for (Entry2 = DiskEntry->LogicalPartListHead.Flink;
486  Entry2 != &DiskEntry->LogicalPartListHead;
487  Entry2 = Entry2->Flink)
488  {
489  PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
490  if (PartEntry == ListUi->CurrentPartition)
491  {
492  CurrentPartLineFound = TRUE;
493  }
494 
495  if (CurrentPartLineFound == FALSE)
496  {
497  CurrentPartLine++;
498  }
499 
500  LastLine++;
501  }
502  }
503 
504  if (DiskEntry == ListUi->CurrentDisk)
505  {
506  CurrentDiskLineFound = TRUE;
507  }
508 
509  if (Entry->Flink != &List->DiskListHead)
510  {
511  if (CurrentDiskLineFound == FALSE)
512  {
513  CurrentPartLine++;
514  CurrentDiskLine = CurrentPartLine;
515  }
516 
517  LastLine++;
518  }
519  else
520  {
521  LastLine--;
522  }
523  }
524 
525  /* If it possible, make the disk name visible */
526  if (CurrentPartLine < ListUi->Offset)
527  {
528  ListUi->Offset = CurrentPartLine;
529  }
530  else if (CurrentPartLine - ListUi->Offset > Height)
531  {
532  ListUi->Offset = CurrentPartLine - Height;
533  }
534 
535  if (CurrentDiskLine < ListUi->Offset && CurrentPartLine - CurrentDiskLine < Height)
536  {
537  ListUi->Offset = CurrentDiskLine;
538  }
539 
540  /* Draw upper left corner */
541  coPos.X = ListUi->Left;
542  coPos.Y = ListUi->Top;
544  0xDA, // '+',
545  1,
546  coPos,
547  &Written);
548 
549  /* Draw upper edge */
550  coPos.X = ListUi->Left + 1;
551  coPos.Y = ListUi->Top;
552  if (ListUi->Offset == 0)
553  {
555  0xC4, // '-',
556  Width,
557  coPos,
558  &Written);
559  }
560  else
561  {
563  0xC4, // '-',
564  Width - 4,
565  coPos,
566  &Written);
567  coPos.X = ListUi->Right - 5;
569  "(\x18)", // "(up)"
570  3,
571  coPos,
572  &Written);
573  coPos.X = ListUi->Right - 2;
575  0xC4, // '-',
576  2,
577  coPos,
578  &Written);
579  }
580 
581  /* Draw upper right corner */
582  coPos.X = ListUi->Right;
583  coPos.Y = ListUi->Top;
585  0xBF, // '+',
586  1,
587  coPos,
588  &Written);
589 
590  /* Draw left and right edge */
591  for (i = ListUi->Top + 1; i < ListUi->Bottom; i++)
592  {
593  coPos.X = ListUi->Left;
594  coPos.Y = i;
596  0xB3, // '|',
597  1,
598  coPos,
599  &Written);
600 
601  coPos.X = ListUi->Right;
603  0xB3, //'|',
604  1,
605  coPos,
606  &Written);
607  }
608 
609  /* Draw lower left corner */
610  coPos.X = ListUi->Left;
611  coPos.Y = ListUi->Bottom;
613  0xC0, // '+',
614  1,
615  coPos,
616  &Written);
617 
618  /* Draw lower edge */
619  coPos.X = ListUi->Left + 1;
620  coPos.Y = ListUi->Bottom;
621  if (LastLine - ListUi->Offset <= Height)
622  {
624  0xC4, // '-',
625  Width,
626  coPos,
627  &Written);
628  }
629  else
630  {
632  0xC4, // '-',
633  Width - 4,
634  coPos,
635  &Written);
636  coPos.X = ListUi->Right - 5;
638  "(\x19)", // "(down)"
639  3,
640  coPos,
641  &Written);
642  coPos.X = ListUi->Right - 2;
644  0xC4, // '-',
645  2,
646  coPos,
647  &Written);
648  }
649 
650  /* Draw lower right corner */
651  coPos.X = ListUi->Right;
652  coPos.Y = ListUi->Bottom;
654  0xD9, // '+',
655  1,
656  coPos,
657  &Written);
658 
659  /* Print list entries */
660  ListUi->Line = -ListUi->Offset;
661 
662  for (Entry = List->DiskListHead.Flink;
663  Entry != &List->DiskListHead;
664  Entry = Entry->Flink)
665  {
666  DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
667 
668  /* Print disk entry */
669  PrintDiskData(ListUi, DiskEntry);
670  }
671 }
LIST_ENTRY PrimaryPartListHead
Definition: partlist.h:125
#define TRUE
Definition: types.h:120
struct _Entry Entry
Definition: kefuncs.h:640
BOOL WINAPI FillConsoleOutputCharacterA(IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:509
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
HANDLE StdOutput
Definition: consup.c:37
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:356
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)
Definition: Messaging.c:560
ULONG X
Definition: bl.h:1340
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
LIST_ENTRY List
Definition: psmgr.c:57
Definition: typedefs.h:117
static VOID PrintDiskData(IN PPARTLIST_UI ListUi, IN PDISKENTRY DiskEntry)
Definition: partlist.c:299
Definition: bl.h:1338
static LPHIST_ENTRY Bottom
Definition: history.c:54
unsigned short USHORT
Definition: pedump.c:61
LIST_ENTRY LogicalPartListHead
Definition: partlist.h:126
unsigned int ULONG
Definition: retypes.h:1
ULONG Y
Definition: bl.h:1341
base of all file and directory entries
Definition: entries.h:82

Referenced by ScrollDownPartitionList(), and ScrollUpPartitionList().

◆ GetPartTypeStringFromPartitionType()

VOID GetPartTypeStringFromPartitionType ( IN UCHAR  partitionType,
OUT PCHAR  strPartType,
IN ULONG  cchPartType 
)

Definition at line 237 of file drivepage.c.

241 {
242  /* Determine partition type */
243 
244  if (IsContainerPartition(partitionType))
245  {
246  StringCchCopyA(strPartType, cchPartType, "Extended Partition" /* MUIGetString(STRING_EXTENDED_PARTITION) */);
247  }
248  else if (partitionType == PARTITION_ENTRY_UNUSED)
249  {
250  StringCchCopyA(strPartType, cchPartType, "Unused" /* MUIGetString(STRING_FORMATUNUSED) */);
251  }
252  else
253  {
254  UINT i;
255 
256  /* Do the table lookup */
257  for (i = 0; i < ARRAYSIZE(PartitionTypes); i++)
258  {
259  if (partitionType == PartitionTypes[i].Type)
260  {
261  StringCchCopyA(strPartType, cchPartType, PartitionTypes[i].Description);
262  return;
263  }
264  }
265 
266  /* We are here because the partition type is unknown */
267  StringCchCopyA(strPartType, cchPartType, "Unknown" /* MUIGetString(STRING_FORMATUNKNOWN) */);
268  }
269 }
Type
Definition: Type.h:6
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define IsContainerPartition(PartitionType)
Definition: ntdddisk.h:245
static const WCHAR Description[]
Definition: oid.c:1266
#define PARTITION_ENTRY_UNUSED
Definition: disk.h:86
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
PARTITION_TYPE PartitionTypes[NUM_PARTITION_TYPE_ENTRIES]
Definition: partlist.c:62
STRSAFEAPI StringCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:145
unsigned int UINT
Definition: ndis.h:50

Referenced by DeletePartitionPage(), PrintPartitionData(), and SelectFileSystemPage().

◆ 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 73 of file partlist.c.

81 {
82  ListUi->List = List;
83  // ListUi->FirstShown = NULL;
84  // ListUi->LastShown = NULL;
85 
86  ListUi->Left = Left;
87  ListUi->Top = Top;
88  ListUi->Right = Right;
89  ListUi->Bottom = Bottom;
90 
91  ListUi->Line = 0;
92  ListUi->Offset = 0;
93 
94  // ListUi->Redraw = TRUE;
95 
96  /* Search for first usable disk and partition */
97  if (!CurrentEntry)
98  {
99  ListUi->CurrentDisk = NULL;
100  ListUi->CurrentPartition = NULL;
101 
102  if (!IsListEmpty(&List->DiskListHead))
103  {
104  ListUi->CurrentDisk = CONTAINING_RECORD(List->DiskListHead.Flink,
105  DISKENTRY, ListEntry);
106 
107  if (!IsListEmpty(&ListUi->CurrentDisk->PrimaryPartListHead))
108  {
109  ListUi->CurrentPartition = CONTAINING_RECORD(ListUi->CurrentDisk->PrimaryPartListHead.Flink,
110  PARTENTRY, ListEntry);
111  }
112  }
113  }
114  else
115  {
116  /*
117  * The CurrentEntry must belong to the associated partition list,
118  * and the latter must therefore not be empty.
119  */
120  ASSERT(!IsListEmpty(&List->DiskListHead));
121  ASSERT(CurrentEntry->DiskEntry->PartList == List);
122 
123  ListUi->CurrentPartition = CurrentEntry;
124  ListUi->CurrentDisk = CurrentEntry->DiskEntry;
125  }
126 }
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
smooth NULL
Definition: ftsmooth.c:416
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)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
LIST_ENTRY List
Definition: psmgr.c:57
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static LPHIST_ENTRY Bottom
Definition: history.c:54
static LPHIST_ENTRY Top
Definition: history.c:53

Referenced by SelectPartitionPage().

◆ ScrollDownPartitionList()

VOID ScrollDownPartitionList ( IN PPARTLIST_UI  ListUi)

Definition at line 674 of file partlist.c.

676 {
677  PPARTENTRY NextPart = GetNextPartition(ListUi->List, ListUi->CurrentPartition);
678  if (NextPart)
679  {
680  ListUi->CurrentPartition = NextPart;
681  ListUi->CurrentDisk = NextPart->DiskEntry;
682  DrawPartitionList(ListUi);
683  }
684 }
PPARTENTRY GetNextPartition(IN PPARTLIST List, IN PPARTENTRY CurrentPart OPTIONAL)
Definition: partlist.c:2193
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
VOID DrawPartitionList(IN PPARTLIST_UI ListUi)
Definition: partlist.c:427

Referenced by SelectPartitionPage().

◆ ScrollUpPartitionList()

VOID ScrollUpPartitionList ( IN PPARTLIST_UI  ListUi)

Definition at line 687 of file partlist.c.

689 {
690  PPARTENTRY PrevPart = GetPrevPartition(ListUi->List, ListUi->CurrentPartition);
691  if (PrevPart)
692  {
693  ListUi->CurrentPartition = PrevPart;
694  ListUi->CurrentDisk = PrevPart->DiskEntry;
695  DrawPartitionList(ListUi);
696  }
697 }
struct _DISKENTRY * DiskEntry
Definition: partlist.h:39
PPARTENTRY GetPrevPartition(IN PPARTLIST List, IN PPARTENTRY CurrentPart OPTIONAL)
Definition: partlist.c:2285
VOID DrawPartitionList(IN PPARTLIST_UI ListUi)
Definition: partlist.c:427

Referenced by SelectPartitionPage().