ReactOS 0.4.15-dev-8422-g6219a1a
arcname.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

BOOLEAN DissectArcPath (IN PCSTR ArcPath, OUT PCSTR *Path OPTIONAL, OUT PUCHAR DriveNumber, OUT PULONG PartitionNumber)
 
BOOLEAN DissectArcPath2 (IN PCSTR ArcPath, OUT PULONG x, OUT PULONG y, OUT PULONG z, OUT PULONG Partition, OUT PULONG PathSyntax)
 
VOID ConstructArcPath (PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition)
 

Function Documentation

◆ ConstructArcPath()

VOID ConstructArcPath ( PCHAR  ArcPath,
PCHAR  SystemFolder,
UCHAR  Disk,
ULONG  Partition 
)

Definition at line 175 of file arcname.c.

176{
177 char tmp[50];
178
179 strcpy(ArcPath, "multi(0)disk(0)");
180
181 if (Disk < 0x80)
182 {
183 /*
184 * Floppy disk path:
185 * multi(0)disk(0)fdisk(x)\path
186 */
187 sprintf(tmp, "fdisk(%d)", (int) Disk);
188 strcat(ArcPath, tmp);
189 }
190 else
191 {
192 /*
193 * Hard disk path:
194 * multi(0)disk(0)rdisk(x)partition(y)\path
195 */
196 sprintf(tmp, "rdisk(%d)partition(%d)", (int) (Disk - 0x80), (int) Partition);
197 strcat(ArcPath, tmp);
198 }
199
200 if (SystemFolder[0] == '\\' || SystemFolder[0] == '/')
201 {
202 strcat(ArcPath, SystemFolder);
203 }
204 else
205 {
206 strcat(ArcPath, "\\");
207 strcat(ArcPath, SystemFolder);
208 }
209}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define sprintf(buf, format,...)
Definition: sprintf.c:55

Referenced by EditCustomBootReactOS().

◆ DissectArcPath()

BOOLEAN DissectArcPath ( IN PCSTR  ArcPath,
OUT PCSTR *Path  OPTIONAL,
OUT PUCHAR  DriveNumber,
OUT PULONG  PartitionNumber 
)

Definition at line 25 of file arcname.c.

30{
31 PCCH p;
32
33 /* Detect ramdisk path */
34 if (_strnicmp(ArcPath, "ramdisk(0)", 10) == 0)
35 {
36 /* Magic value for ramdisks */
37 *DriveNumber = 0x49;
38 *PartitionNumber = 1;
39
40 /* Get the path (optional) */
41 if (Path)
42 *Path = ArcPath + 10;
43
44 return TRUE;
45 }
46
47 /* NOTE: We are currently limited when handling multi()disk() paths!! */
48 if (_strnicmp(ArcPath, "multi(0)disk(0)", 15) != 0)
49 return FALSE;
50
51 p = ArcPath + 15;
52 if (_strnicmp(p, "fdisk(", 6) == 0)
53 {
54 /*
55 * Floppy disk path:
56 * multi(0)disk(0)fdisk(x)\path
57 */
58 p = p + 6;
59 *DriveNumber = atoi(p);
60 p = strchr(p, ')');
61 if (p == NULL)
62 return FALSE;
63 ++p;
64 *PartitionNumber = 0;
65 }
66 else if (_strnicmp(p, "cdrom(", 6) == 0)
67 {
68 /*
69 * Cdrom path:
70 * multi(0)disk(0)cdrom(x)\path
71 */
72 p = p + 6;
73 *DriveNumber = atoi(p) + 0x80;
74 p = strchr(p, ')');
75 if (p == NULL)
76 return FALSE;
77 ++p;
78 *PartitionNumber = 0xff;
79 }
80 else if (_strnicmp(p, "rdisk(", 6) == 0)
81 {
82 /*
83 * Hard disk path:
84 * multi(0)disk(0)rdisk(x)[partition(y)][\path]
85 */
86 p = p + 6;
87 *DriveNumber = atoi(p) + 0x80;
88 p = strchr(p, ')');
89 if (p == NULL)
90 return FALSE;
91 ++p;
92 /* The partition is optional */
93 if (_strnicmp(p, "partition(", 10) == 0)
94 {
95 p = p + 10;
97 p = strchr(p, ')');
98 if (p == NULL)
99 return FALSE;
100 ++p;
101 }
102 else
103 {
104 *PartitionNumber = 0;
105 }
106 }
107 else
108 {
109 return FALSE;
110 }
111
112 /* Get the path (optional) */
113 if (Path)
114 *Path = p;
115
116 return TRUE;
117}
PRTL_UNICODE_STRING_BUFFER Path
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
GLfloat GLfloat p
Definition: glext.h:8902
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
CONST CHAR * PCCH
Definition: ntbasedef.h:392
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2061

Referenced by DiskOpen(), and UefiDiskOpen().

◆ DissectArcPath2()

BOOLEAN DissectArcPath2 ( IN PCSTR  ArcPath,
OUT PULONG  x,
OUT PULONG  y,
OUT PULONG  z,
OUT PULONG  Partition,
OUT PULONG  PathSyntax 
)

Definition at line 121 of file arcname.c.

128{
129 /* Detect ramdisk() */
130 if (_strnicmp(ArcPath, "ramdisk(0)", 10) == 0)
131 {
132 *x = *y = *z = 0;
133 *Partition = 1;
134 *PathSyntax = 2;
135 return TRUE;
136 }
137 /* Detect scsi()disk()rdisk()partition() */
138 else if (sscanf(ArcPath, "scsi(%lu)disk(%lu)rdisk(%lu)partition(%lu)", x, y, z, Partition) == 4)
139 {
140 *PathSyntax = 0;
141 return TRUE;
142 }
143 /* Detect scsi()cdrom()fdisk() */
144 else if (sscanf(ArcPath, "scsi(%lu)cdrom(%lu)fdisk(%lu)", x, y, z) == 3)
145 {
146 *Partition = 0;
147 *PathSyntax = 0;
148 return TRUE;
149 }
150 /* Detect multi()disk()rdisk()partition() */
151 else if (sscanf(ArcPath, "multi(%lu)disk(%lu)rdisk(%lu)partition(%lu)", x, y, z, Partition) == 4)
152 {
153 *PathSyntax = 1;
154 return TRUE;
155 }
156 /* Detect multi()disk()cdrom() */
157 else if (sscanf(ArcPath, "multi(%lu)disk(%lu)cdrom(%lu)", x, y, z) == 3)
158 {
159 *Partition = 1;
160 *PathSyntax = 1;
161 return TRUE;
162 }
163 /* Detect multi()disk()fdisk() */
164 else if (sscanf(ArcPath, "multi(%lu)disk(%lu)fdisk(%lu)", x, y, z) == 3)
165 {
166 *Partition = 1;
167 *PathSyntax = 1;
168 return TRUE;
169 }
170
171 /* Unknown syntax */
172 return FALSE;
173}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble z
Definition: glext.h:5874
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)

Referenced by DiskOpen().