ReactOS  0.4.14-dev-614-gbfd8a84
fslist.c File Reference
#include "usetup.h"
#include <debug.h>
Include dependency graph for fslist.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static VOID AddProvider (IN OUT PFILE_SYSTEM_LIST List, IN PCWSTR FileSystem)
 
static VOID InitializeFileSystemList (IN PFILE_SYSTEM_LIST List, IN BOOLEAN ForceFormat)
 
PFILE_SYSTEM_LIST CreateFileSystemList (IN SHORT Left, IN SHORT Top, IN BOOLEAN ForceFormat, IN PCWSTR SelectFileSystem)
 
VOID DestroyFileSystemList (IN PFILE_SYSTEM_LIST List)
 
VOID DrawFileSystemList (IN PFILE_SYSTEM_LIST List)
 
VOID ScrollDownFileSystemList (IN PFILE_SYSTEM_LIST List)
 
VOID ScrollUpFileSystemList (IN PFILE_SYSTEM_LIST List)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 29 of file fslist.c.

Function Documentation

◆ AddProvider()

static VOID AddProvider ( IN OUT PFILE_SYSTEM_LIST  List,
IN PCWSTR  FileSystem 
)
static

Definition at line 35 of file fslist.c.

38 {
39  PFILE_SYSTEM_ITEM Item;
40 
41  Item = (PFILE_SYSTEM_ITEM)RtlAllocateHeap(ProcessHeap, 0, sizeof(*Item));
42  if (!Item)
43  return;
44 
45  Item->FileSystem = FileSystem;
46  Item->QuickFormat = TRUE;
47  InsertTailList(&List->ListHead, &Item->ListEntry);
48 
49  if (!FileSystem)
50  return;
51 
52  Item = (PFILE_SYSTEM_ITEM)RtlAllocateHeap(ProcessHeap, 0, sizeof(*Item));
53  if (!Item)
54  return;
55 
56  Item->FileSystem = FileSystem;
57  Item->QuickFormat = FALSE;
58  InsertTailList(&List->ListHead, &Item->ListEntry);
59 }
#define TRUE
Definition: types.h:120
PWCHAR FileSystem
Definition: format.c:72
PCWSTR FileSystem
Definition: fslist.h:34
#define InsertTailList(ListHead, Entry)
LIST_ENTRY ListEntry
Definition: fslist.h:33
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
LIST_ENTRY List
Definition: psmgr.c:57
BOOLEAN QuickFormat
Definition: fslist.h:35
HANDLE ProcessHeap
Definition: servman.c:15
struct _FILE_SYSTEM_ITEM * PFILE_SYSTEM_ITEM

Referenced by InitializeFileSystemList().

◆ CreateFileSystemList()

PFILE_SYSTEM_LIST CreateFileSystemList ( IN SHORT  Left,
IN SHORT  Top,
IN BOOLEAN  ForceFormat,
IN PCWSTR  SelectFileSystem 
)

Definition at line 82 of file fslist.c.

87 {
89  PFILE_SYSTEM_ITEM Item;
90  PLIST_ENTRY ListEntry;
91 
93  if (List == NULL)
94  return NULL;
95 
96  List->Left = Left;
97  List->Top = Top;
98  List->Selected = NULL;
99  InitializeListHead(&List->ListHead);
100 
101  InitializeFileSystemList(List, ForceFormat);
102 
103  /* Search for SelectFileSystem in list */
104  ListEntry = List->ListHead.Flink;
105  while (ListEntry != &List->ListHead)
106  {
107  Item = CONTAINING_RECORD(ListEntry, FILE_SYSTEM_ITEM, ListEntry);
108  if (Item->FileSystem && wcsicmp(SelectFileSystem, Item->FileSystem) == 0)
109  {
110  List->Selected = Item;
111  break;
112  }
113  ListEntry = ListEntry->Flink;
114  }
115  if (!List->Selected)
116  List->Selected = CONTAINING_RECORD(List->ListHead.Flink, FILE_SYSTEM_ITEM, ListEntry);
117 
118  return List;
119 }
static VOID InitializeFileSystemList(IN PFILE_SYSTEM_LIST List, IN BOOLEAN ForceFormat)
Definition: fslist.c:62
PCWSTR FileSystem
Definition: fslist.h:34
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
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
LIST_ENTRY List
Definition: psmgr.c:57
Definition: typedefs.h:117
#define wcsicmp
Definition: string.h:1152
HANDLE ProcessHeap
Definition: servman.c:15
struct _FILE_SYSTEM_LIST * PFILE_SYSTEM_LIST
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
static LPHIST_ENTRY Top
Definition: history.c:53

Referenced by SelectFileSystemPage().

◆ DestroyFileSystemList()

VOID DestroyFileSystemList ( IN PFILE_SYSTEM_LIST  List)

Definition at line 122 of file fslist.c.

124 {
125  PLIST_ENTRY ListEntry;
126  PFILE_SYSTEM_ITEM Item;
127 
128  ListEntry = List->ListHead.Flink;
129  while (!IsListEmpty(&List->ListHead))
130  {
131  ListEntry = RemoveHeadList(&List->ListHead);
132  Item = CONTAINING_RECORD(ListEntry, FILE_SYSTEM_ITEM, ListEntry);
133  RtlFreeHeap(ProcessHeap, 0, Item);
134  }
135 
137 }
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
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
Definition: typedefs.h:117
HANDLE ProcessHeap
Definition: servman.c:15

Referenced by ResetFileSystemList().

◆ DrawFileSystemList()

VOID DrawFileSystemList ( IN PFILE_SYSTEM_LIST  List)

Definition at line 140 of file fslist.c.

142 {
143  PLIST_ENTRY ListEntry;
144  PFILE_SYSTEM_ITEM Item;
145  COORD coPos;
146  DWORD Written;
147  ULONG Index = 0;
148  CHAR Buffer[128];
149 
150  ListEntry = List->ListHead.Flink;
151  while (ListEntry != &List->ListHead)
152  {
153  Item = CONTAINING_RECORD(ListEntry, FILE_SYSTEM_ITEM, ListEntry);
154 
155  coPos.X = List->Left;
156  coPos.Y = List->Top + (SHORT)Index;
159  sizeof(Buffer),
160  coPos,
161  &Written);
163  ' ',
164  sizeof(Buffer),
165  coPos,
166  &Written);
167 
168  if (Item->FileSystem)
169  {
170  snprintf(Buffer, sizeof(Buffer),
173  Item->FileSystem);
174  }
175  else
176  {
178  }
179 
180  if (ListEntry == &List->Selected->ListEntry)
181  {
183  List->Top + (SHORT)Index,
184  Buffer);
185  }
186  else
187  {
188  CONSOLE_SetTextXY(List->Left,
189  List->Top + (SHORT)Index,
190  Buffer);
191  }
192  Index++;
193  ListEntry = ListEntry->Flink;
194  }
195 }
#define STRING_KEEPFORMAT
Definition: mui.h:114
VOID CONSOLE_SetTextXY(IN SHORT x, IN SHORT y, IN LPCSTR Text)
Definition: consup.c:305
BOOL WINAPI FillConsoleOutputAttribute(IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten)
Definition: console.c:496
char CHAR
Definition: xmlstorage.h:175
PCWSTR FileSystem
Definition: fslist.h:34
#define snprintf
Definition: wintirpc.h:48
#define FOREGROUND_WHITE
Definition: consup.h:29
BOOL WINAPI FillConsoleOutputCharacterA(IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
Definition: console.c:531
short SHORT
Definition: pedump.c:59
HANDLE StdOutput
Definition: consup.c:37
Definition: bufpool.h:45
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
#define STRING_FORMATDISK1
Definition: mui.h:112
ULONG X
Definition: bl.h:1340
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
LIST_ENTRY List
Definition: psmgr.c:57
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID CONSOLE_SetInvertedTextXY(IN SHORT x, IN SHORT y, IN LPCSTR Text)
Definition: consup.c:538
LPSTR MUIGetString(ULONG Number)
Definition: mui.c:230
Definition: typedefs.h:117
Definition: bl.h:1338
BOOLEAN QuickFormat
Definition: fslist.h:35
#define STRING_FORMATDISK2
Definition: mui.h:113
#define BACKGROUND_BLUE
Definition: blue.h:65
unsigned int ULONG
Definition: retypes.h:1
ULONG Y
Definition: bl.h:1341

Referenced by ScrollDownFileSystemList(), ScrollUpFileSystemList(), and SelectFileSystemPage().

◆ InitializeFileSystemList()

static VOID InitializeFileSystemList ( IN PFILE_SYSTEM_LIST  List,
IN BOOLEAN  ForceFormat 
)
static

Definition at line 62 of file fslist.c.

65 {
66  ULONG Index = 0;
67  PCWSTR FileSystemName;
68 
69  while (GetRegisteredFileSystems(Index++, &FileSystemName))
70  {
71  AddProvider(List, FileSystemName);
72  }
73 
74  if (!ForceFormat)
75  {
76  /* Add the 'Keep existing filesystem' dummy provider */
78  }
79 }
const uint16_t * PCWSTR
Definition: typedefs.h:55
static VOID AddProvider(IN OUT PFILE_SYSTEM_LIST List, IN PCWSTR FileSystem)
Definition: fslist.c:35
smooth NULL
Definition: ftsmooth.c:416
LIST_ENTRY List
Definition: psmgr.c:57
static const UCHAR Index[8]
Definition: usbohci.c:18
BOOLEAN GetRegisteredFileSystems(IN ULONG Index, OUT PCWSTR *FileSystemName)
Definition: fsutil.c:67
unsigned int ULONG
Definition: retypes.h:1

Referenced by CreateFileSystemList().

◆ ScrollDownFileSystemList()

VOID ScrollDownFileSystemList ( IN PFILE_SYSTEM_LIST  List)

Definition at line 198 of file fslist.c.

200 {
201  if (List->Selected->ListEntry.Flink != &List->ListHead)
202  {
203  List->Selected = CONTAINING_RECORD(List->Selected->ListEntry.Flink, FILE_SYSTEM_ITEM, ListEntry);
205  }
206 }
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
VOID DrawFileSystemList(IN PFILE_SYSTEM_LIST List)
Definition: fslist.c:140

Referenced by SelectFileSystemPage().

◆ ScrollUpFileSystemList()

VOID ScrollUpFileSystemList ( IN PFILE_SYSTEM_LIST  List)

Definition at line 209 of file fslist.c.

211 {
212  if (List->Selected->ListEntry.Blink != &List->ListHead)
213  {
214  List->Selected = CONTAINING_RECORD(List->Selected->ListEntry.Blink, FILE_SYSTEM_ITEM, ListEntry);
216  }
217 }
struct _LIST_ENTRY * Blink
Definition: typedefs.h:120
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
LIST_ENTRY List
Definition: psmgr.c:57
VOID DrawFileSystemList(IN PFILE_SYSTEM_LIST List)
Definition: fslist.c:140

Referenced by SelectFileSystemPage().