ReactOS 0.4.15-dev-7918-g2a2556c
cmdline.c File Reference
#include <freeldr.h>
Include dependency graph for cmdline.c:

Go to the source code of this file.

Classes

struct  tagCMDLINEINFO
 

Typedefs

typedef struct tagCMDLINEINFO CMDLINEINFO
 
typedef struct tagCMDLINEINFOPCMDLINEINFO
 

Functions

VOID CmdLineParse (IN PCSTR CmdLine)
 
PCSTR CmdLineGetDebugString (VOID)
 
PCSTR CmdLineGetDefaultOS (VOID)
 
LONG CmdLineGetTimeOut (VOID)
 

Variables

CCHAR DebugString [256]
 
CCHAR DefaultOs [256]
 
CMDLINEINFO CmdLineInfo
 

Typedef Documentation

◆ CMDLINEINFO

◆ PCMDLINEINFO

Function Documentation

◆ CmdLineGetDebugString()

PCSTR CmdLineGetDebugString ( VOID  )

Definition at line 123 of file cmdline.c.

124{
126}
CMDLINEINFO CmdLineInfo
Definition: cmdline.c:24
PCSTR DebugString
Definition: cmdline.c:17

◆ CmdLineGetDefaultOS()

PCSTR CmdLineGetDefaultOS ( VOID  )

Definition at line 129 of file cmdline.c.

130{
131 return CmdLineInfo.DefaultOs;
132}
PCSTR DefaultOs
Definition: cmdline.c:18

Referenced by InitOperatingSystemList().

◆ CmdLineGetTimeOut()

LONG CmdLineGetTimeOut ( VOID  )

Definition at line 135 of file cmdline.c.

136{
137 return CmdLineInfo.TimeOut;
138}
LONG TimeOut
Definition: cmdline.c:19

Referenced by GetTimeOut().

◆ CmdLineParse()

VOID CmdLineParse ( IN PCSTR  CmdLine)

Definition at line 29 of file cmdline.c.

30{
31 PCHAR End, Setting;
33
34 /* Set defaults */
38
39 /*
40 * Get debug string, in the following format:
41 * "debug=option1=XXX;option2=YYY;..."
42 * and translate it into the format:
43 * "OPTION1=XXX OPTION2=YYY ..."
44 */
45 Setting = strstr(CmdLine, "debug=");
46 if (Setting)
47 {
48 /* Check if there are more command-line parameters following */
49 Setting += sizeof("debug=") - sizeof(ANSI_NULL);
50 End = strstr(Setting, " ");
51 Length = (End ? (End - Setting) : strlen(Setting));
52
53 /* Copy the debug string and upcase it */
56
57 /* Replace all separators ';' by spaces */
58 Setting = DebugString;
59 while (*Setting)
60 {
61 if (*Setting == ';') *Setting = ' ';
62 Setting++;
63 }
64
66 }
67
68 /* Get timeout */
69 Setting = strstr(CmdLine, "timeout=");
70 if (Setting)
71 {
72 CmdLineInfo.TimeOut = atoi(Setting +
73 sizeof("timeout=") - sizeof(ANSI_NULL));
74 }
75
76 /* Get default OS */
77 Setting = strstr(CmdLine, "defaultos=");
78 if (Setting)
79 {
80 /* Check if there are more command-line parameters following */
81 Setting += sizeof("defaultos=") - sizeof(ANSI_NULL);
82 End = strstr(Setting, " ");
83 Length = (End ? (End - Setting) : strlen(Setting));
84
85 /* Copy the default OS */
86 RtlStringCbCopyNA(DefaultOs, sizeof(DefaultOs), Setting, Length);
88 }
89
90 /* Get ramdisk base address */
91 Setting = strstr(CmdLine, "rdbase=");
92 if (Setting)
93 {
95 (PVOID)(ULONG_PTR)strtoull(Setting +
96 sizeof("rdbase=") - sizeof(ANSI_NULL),
97 NULL, 0);
98 }
99
100 /* Get ramdisk size */
101 Setting = strstr(CmdLine, "rdsize=");
102 if (Setting)
103 {
104 gInitRamDiskSize = strtoul(Setting +
105 sizeof("rdsize=") - sizeof(ANSI_NULL),
106 NULL, 0);
107 }
108
109 /* Get ramdisk offset */
110 Setting = strstr(CmdLine, "rdoffset=");
111 if (Setting)
112 {
113 Offset = strtoul(Setting +
114 sizeof("rdoffset=") - sizeof(ANSI_NULL),
115 NULL, 0);
116 }
117
118 /* Fix it up */
120}
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
PVOID gInitRamDiskBase
Definition: ramdisk.c:17
ULONG gInitRamDiskSize
Definition: ramdisk.c:18
CCHAR DebugString[256]
Definition: cmdline.c:22
CCHAR DefaultOs[256]
Definition: cmdline.c:23
#define NULL
Definition: types.h:112
static const WCHAR CmdLine[]
Definition: install.c:48
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define ANSI_NULL
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
NTSTRSAFEAPI RtlStringCbCopyNA(_Out_writes_bytes_(cbDest) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_reads_bytes_(cbToCopy) STRSAFE_LPCSTR pszSrc, _In_ size_t cbToCopy)
Definition: ntstrsafe.h:395
_CRTIMP char *__cdecl _strupr(_Inout_z_ char *_String)
#define strtoull
Definition: stabs.c:58
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:65
char * PCHAR
Definition: typedefs.h:51

Referenced by BootMain(), and EfiEntry().

Variable Documentation

◆ CmdLineInfo

CMDLINEINFO CmdLineInfo

◆ DebugString

◆ DefaultOs

CCHAR DefaultOs[256]

Definition at line 23 of file cmdline.c.

Referenced by CmdLineParse().