2 * PROJECT: ReactOS Boot Loader
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: boot/freeldr/cmdline.c
5 * PURPOSE: FreeLDR Command Line Parsing
6 * PROGRAMMERS: ReactOS Portable Systems Group
9 /* INCLUDES *******************************************************************/
13 /* GLOBALS ********************************************************************/
16 CMDLINEINFO CmdLineInfo
;
18 /* FUNCTIONS ******************************************************************/
21 CmdLineParse(IN PCHAR CmdLine
)
24 ULONG Length
, Offset
= 0;
29 CmdLineInfo
.DefaultOperatingSystem
= NULL
;
30 CmdLineInfo
.TimeOut
= -1;
35 Setting
= strstr(CmdLine
, "timeout=");
36 if (Setting
) CmdLineInfo
.TimeOut
= atoi(Setting
+
43 Setting
= strstr(CmdLine
, "defaultos=");
47 // Check if there's more command-line parameters following
49 Setting
+= sizeof("defaultos=") + sizeof(ANSI_NULL
);
50 End
= strstr(Setting
, " ");
51 if (End
) Length
= End
- Setting
; else Length
= sizeof(DefaultOs
);
54 // Copy the default OS
56 strncpy(DefaultOs
, Setting
, Length
);
57 CmdLineInfo
.DefaultOperatingSystem
= DefaultOs
;
61 // Get ramdisk base address
63 Setting
= strstr(CmdLine
, "rdbase=");
64 if (Setting
) gRamDiskBase
= (PVOID
)(ULONG_PTR
)strtoull(Setting
+
73 Setting
= strstr(CmdLine
, "rdsize=");
74 if (Setting
) gRamDiskSize
= strtoul(Setting
+
83 Setting
= strstr(CmdLine
, "rdoffset=");
84 if (Setting
) Offset
= strtoul(Setting
+
93 gRamDiskBase
= (PVOID
)((ULONG_PTR
)gRamDiskBase
+ Offset
);
97 CmdLineGetDefaultOS(VOID
)
99 return CmdLineInfo
.DefaultOperatingSystem
;
103 CmdLineGetTimeOut(VOID
)
105 return CmdLineInfo
.TimeOut
;