Fixed GetExtendedMemorySize(). My i486-DX4/75 didn't like the old routine.
[reactos.git] / freeldr / freeldr / arcname.c
1 /*
2 * FreeLoader - arcname.c
3 *
4 * Copyright (C) 2001 Brian Palmer <brianp@sginet.com>
5 * Copyright (C) 2001 Eric Kohl
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #include "freeldr.h"
23 #include "arcname.h"
24 #include "stdlib.h"
25
26
27 BOOL DissectArcPath(char *ArcPath, char *BootPath, PULONG BootDrive, PULONG BootPartition)
28 {
29 char *p;
30
31 if (_strnicmp(ArcPath, "multi(0)disk(0)", 15) != 0)
32 return FALSE;
33
34 p = ArcPath + 15;
35 if (_strnicmp(p, "fdisk(", 6) == 0)
36 {
37 /*
38 * floppy disk path:
39 * multi(0)disk(0)fdisk(x)\path
40 */
41 p = p + 6;
42 *BootDrive = atoi(p);
43 p = strchr(p, ')');
44 if (p == NULL)
45 return FALSE;
46 p++;
47 *BootPartition = 0;
48 }
49 else if (_strnicmp(p, "rdisk(", 6) == 0)
50 {
51 /*
52 * hard disk path:
53 * multi(0)disk(0)rdisk(x)partition(y)\path
54 */
55 p = p + 6;
56 *BootDrive = atoi(p) + 0x80;
57 p = strchr(p, ')');
58 if ((p == NULL) || (_strnicmp(p, ")partition(", 11) != 0))
59 return FALSE;
60 p = p + 11;
61 *BootPartition = atoi(p);
62 p = strchr(p, ')');
63 if ((p == NULL) || (*BootPartition == 0))
64 return FALSE;
65 p++;
66 }
67 else
68 {
69 return FALSE;
70 }
71
72 strcpy(BootPath, p);
73
74 return TRUE;
75 }