ReactOS 0.4.16-dev-197-g92996da
select.c File Reference
#include "diskpart.h"
#include <debug.h>
Include dependency graph for select.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOL SelectDisk (INT argc, PWSTR *argv)
 
BOOL SelectPartition (INT argc, PWSTR *argv)
 
BOOL SelectVolume (INT argc, PWSTR *argv)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file select.c.

Function Documentation

◆ SelectDisk()

BOOL SelectDisk ( INT  argc,
PWSTR argv 
)

Definition at line 17 of file select.c.

20{
22 PDISKENTRY DiskEntry;
23 ULONG ulValue;
24
25 DPRINT("Select Disk()\n");
26
27 if (argc > 3)
28 {
30 return TRUE;
31 }
32
33 if (argc == 2)
34 {
35 if (CurrentDisk == NULL)
37 else
39 return TRUE;
40 }
41
42 if (!IsDecString(argv[2]))
43 {
45 return TRUE;
46 }
47
48 ulValue = wcstoul(argv[2], NULL, 10);
49 if ((ulValue == 0) && (errno == ERANGE))
50 {
52 return TRUE;
53 }
54
56
58 while (Entry != &DiskListHead)
59 {
60 DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
61
62 if (DiskEntry->DiskNumber == ulValue)
63 {
64 CurrentDisk = DiskEntry;
67 return TRUE;
68 }
69
70 Entry = Entry->Flink;
71 }
72
74 return TRUE;
75}
static int argc
Definition: ServiceArgs.c:12
#define ERANGE
Definition: acclib.h:92
#define StdOut
Definition: fc.c:14
void ConResPrintf(FILE *fp, UINT nID,...)
Definition: fc.c:33
#define StdErr
Definition: fc.c:15
void ConResPuts(FILE *fp, UINT nID)
Definition: fc.c:27
#define IDS_SELECT_DISK_INVALID
Definition: resource.h:87
#define IDS_ERROR_INVALID_ARGS
Definition: resource.h:187
#define IDS_SELECT_DISK
Definition: resource.h:86
#define IDS_SELECT_NO_DISK
Definition: resource.h:85
PDISKENTRY CurrentDisk
Definition: partlist.c:74
LIST_ENTRY DiskListHead
Definition: partlist.c:70
BOOL IsDecString(_In_ PWSTR pszDecString)
Definition: misc.c:14
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define argv
Definition: mplay32.c:18
#define errno
Definition: errno.h:18
#define DPRINT
Definition: sndvol32.h:73
base of all file and directory entries
Definition: entries.h:83
ULONG DiskNumber
Definition: partlist.h:129
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
static PPARTENTRY CurrentPartition
Definition: usetup.c:78

◆ SelectPartition()

BOOL SelectPartition ( INT  argc,
PWSTR argv 
)

Definition at line 79 of file select.c.

82{
84 PPARTENTRY PartEntry;
85 ULONG ulValue;
86 ULONG PartNumber = 1;
87
88 DPRINT("Select Partition()\n");
89
90 if (argc > 3)
91 {
93 return TRUE;
94 }
95
96 if (CurrentDisk == NULL)
97 {
99 return TRUE;
100 }
101
102 if (argc == 2)
103 {
104 if (CurrentPartition == NULL)
106 else
108 return TRUE;
109 }
110
111 if (!IsDecString(argv[2]))
112 {
114 return TRUE;
115 }
116
117 ulValue = wcstoul(argv[2], NULL, 10);
118 if ((ulValue == 0) && (errno == ERANGE))
119 {
121 return TRUE;
122 }
123
126 {
127 PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
128
129 if (PartEntry->PartitionType != 0)
130 {
131 if (PartNumber == ulValue)
132 {
133 CurrentPartition = PartEntry;
135 return TRUE;
136 }
137
138 PartNumber++;
139 }
140
141 Entry = Entry->Flink;
142 }
143
146 {
147 PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
148
149 if (PartEntry->PartitionType != 0)
150 {
151 if (PartNumber == ulValue)
152 {
153 CurrentPartition = PartEntry;
155 return TRUE;
156 }
157
158 PartNumber++;
159 }
160 Entry = Entry->Flink;
161 }
162
164 return TRUE;
165}
#define IDS_SELECT_NO_PARTITION
Definition: resource.h:88
#define IDS_SELECT_PARTITION_NO_DISK
Definition: resource.h:90
#define IDS_SELECT_PARTITION_INVALID
Definition: resource.h:91
#define IDS_SELECT_PARTITION
Definition: resource.h:89
LIST_ENTRY LogicalPartListHead
Definition: partlist.h:150
LIST_ENTRY PrimaryPartListHead
Definition: partlist.h:149
UCHAR PartitionType
Definition: partlist.h:73

◆ SelectVolume()

BOOL SelectVolume ( INT  argc,
PWSTR argv 
)

Definition at line 169 of file select.c.

172{
174 PVOLENTRY VolumeEntry;
175 ULONG ulValue;
176
177 DPRINT("SelectVolume()\n");
178
179 if (argc > 3)
180 {
182 return TRUE;
183 }
184
185 if (argc == 2)
186 {
187 if (CurrentDisk == NULL)
189 else
191 return TRUE;
192 }
193
194 if (!IsDecString(argv[2]))
195 {
197 return TRUE;
198 }
199
200 ulValue = wcstoul(argv[2], NULL, 10);
201 if ((ulValue == 0) && (errno == ERANGE))
202 {
204 return TRUE;
205 }
206
208
210 while (Entry != &VolumeListHead)
211 {
212 VolumeEntry = CONTAINING_RECORD(Entry, VOLENTRY, ListEntry);
213
214 if (VolumeEntry->VolumeNumber == ulValue)
215 {
216 CurrentVolume = VolumeEntry;
218 return TRUE;
219 }
220
221 Entry = Entry->Flink;
222 }
223
225 return TRUE;
226}
#define IDS_SELECT_NO_VOLUME
Definition: resource.h:92
#define IDS_SELECT_VOLUME
Definition: resource.h:93
#define IDS_SELECT_VOLUME_INVALID
Definition: resource.h:94
LIST_ENTRY VolumeListHead
Definition: partlist.c:72
PVOLENTRY CurrentVolume
Definition: partlist.c:76
ULONG VolumeNumber
Definition: diskpart.h:193