ReactOS  0.4.13-dev-257-gfabbd7c
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 PCCH CmdLine)
 
PCCH CmdLineGetDebugString (VOID)
 
PCCH CmdLineGetDefaultOS (VOID)
 
LONG CmdLineGetTimeOut (VOID)
 

Variables

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

Typedef Documentation

◆ CMDLINEINFO

◆ PCMDLINEINFO

Function Documentation

◆ CmdLineGetDebugString()

PCCH CmdLineGetDebugString ( VOID  )

Definition at line 125 of file cmdline.c.

126 {
127  return CmdLineInfo.DebugString;
128 }
CMDLINEINFO CmdLineInfo
Definition: cmdline.c:24
PCCH DebugString
Definition: cmdline.c:17

◆ CmdLineGetDefaultOS()

PCCH CmdLineGetDefaultOS ( VOID  )

Definition at line 131 of file cmdline.c.

132 {
134 }
PCCH DefaultOperatingSystem
Definition: cmdline.c:18
CMDLINEINFO CmdLineInfo
Definition: cmdline.c:24

Referenced by GetDefaultOperatingSystem().

◆ CmdLineGetTimeOut()

LONG CmdLineGetTimeOut ( VOID  )

Definition at line 137 of file cmdline.c.

138 {
139  return CmdLineInfo.TimeOut;
140 }
CMDLINEINFO CmdLineInfo
Definition: cmdline.c:24
LONG TimeOut
Definition: cmdline.c:19

Referenced by GetTimeOut().

◆ CmdLineParse()

VOID CmdLineParse ( IN PCCH  CmdLine)

Definition at line 29 of file cmdline.c.

30 {
31  PCHAR End, Setting;
32  ULONG_PTR Length, Offset = 0;
33 
34  /* Set defaults */
37  CmdLineInfo.TimeOut = -1;
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  if (End)
52  Length = End - Setting;
53  else
54  Length = sizeof(DebugString);
55 
56  /* Copy the debug string and upcase it */
57  strncpy(DebugString, Setting, Length);
60 
61  /* Replace all separators ';' by spaces */
62  Setting = DebugString;
63  while (*Setting)
64  {
65  if (*Setting == ';') *Setting = ' ';
66  Setting++;
67  }
68 
70  }
71 
72  /* Get timeout */
73  Setting = strstr(CmdLine, "timeout=");
74  if (Setting) CmdLineInfo.TimeOut = atoi(Setting +
75  sizeof("timeout=") +
76  sizeof(ANSI_NULL));
77 
78  /* Get default OS */
79  Setting = strstr(CmdLine, "defaultos=");
80  if (Setting)
81  {
82  /* Check if there are more command-line parameters following */
83  Setting += sizeof("defaultos=") + sizeof(ANSI_NULL);
84  End = strstr(Setting, " ");
85  if (End)
86  Length = End - Setting;
87  else
88  Length = sizeof(DefaultOs);
89 
90  /* Copy the default OS */
91  strncpy(DefaultOs, Setting, Length);
92  DefaultOs[Length - 1] = ANSI_NULL;
94  }
95 
96  /* Get ramdisk base address */
97  Setting = strstr(CmdLine, "rdbase=");
98  if (Setting) gRamDiskBase = (PVOID)(ULONG_PTR)strtoull(Setting +
99  sizeof("rdbase=") -
100  sizeof(ANSI_NULL),
101  NULL,
102  0);
103 
104  /* Get ramdisk size */
105  Setting = strstr(CmdLine, "rdsize=");
106  if (Setting) gRamDiskSize = strtoul(Setting +
107  sizeof("rdsize=") -
108  sizeof(ANSI_NULL),
109  NULL,
110  0);
111 
112  /* Get ramdisk offset */
113  Setting = strstr(CmdLine, "rdoffset=");
114  if (Setting) Offset = strtoul(Setting +
115  sizeof("rdoffset=") -
116  sizeof(ANSI_NULL),
117  NULL,
118  0);
119 
120  /* Fix it up */
122 }
signed char * PCHAR
Definition: retypes.h:7
char CmdLine[0x100]
Definition: mach.c:35
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
uint32_t ULONG_PTR
Definition: typedefs.h:63
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define ANSI_NULL
smooth NULL
Definition: ftsmooth.c:416
PCCH DefaultOperatingSystem
Definition: cmdline.c:18
void * PVOID
Definition: retypes.h:9
CMDLINEINFO CmdLineInfo
Definition: cmdline.c:24
#define strtoull
Definition: stabs.c:72
LONG TimeOut
Definition: cmdline.c:19
ULONG gRamDiskSize
Definition: ramdisk.c:19
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
PCCH DebugString
Definition: cmdline.c:17
_CRTIMP char *__cdecl _strupr(_Inout_z_ char *_String)
CCHAR DefaultOs[256]
Definition: cmdline.c:23
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
PVOID gRamDiskBase
Definition: ramdisk.c:18
CCHAR DebugString[256]
Definition: cmdline.c:22

Referenced by BootMain().

Variable Documentation

◆ CmdLineInfo

CMDLINEINFO CmdLineInfo

◆ DebugString

◆ DefaultOs

CCHAR DefaultOs[256]

Definition at line 23 of file cmdline.c.

Referenced by CmdLineParse().