Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygencmdline.c
Go to the documentation of this file.
00001 /* 00002 * PROJECT: ReactOS Boot Loader 00003 * LICENSE: BSD - See COPYING.ARM in the top level directory 00004 * FILE: boot/freeldr/cmdline.c 00005 * PURPOSE: FreeLDR Command Line Parsing 00006 * PROGRAMMERS: ReactOS Portable Systems Group 00007 */ 00008 00009 /* INCLUDES *******************************************************************/ 00010 00011 #include <freeldr.h> 00012 00013 /* GLOBALS ********************************************************************/ 00014 00015 CCHAR DefaultOs[256]; 00016 CMDLINEINFO CmdLineInfo; 00017 00018 /* FUNCTIONS ******************************************************************/ 00019 00020 VOID 00021 CmdLineParse(IN PCHAR CmdLine) 00022 { 00023 PCHAR End, Setting; 00024 ULONG_PTR Length, Offset = 0; 00025 00026 // 00027 // Set defaults 00028 // 00029 CmdLineInfo.DefaultOperatingSystem = NULL; 00030 CmdLineInfo.TimeOut = -1; 00031 00032 // 00033 // Get timeout 00034 // 00035 Setting = strstr(CmdLine, "timeout="); 00036 if (Setting) CmdLineInfo.TimeOut = atoi(Setting + 00037 sizeof("timeout=") + 00038 sizeof(ANSI_NULL)); 00039 00040 // 00041 // Get default OS 00042 // 00043 Setting = strstr(CmdLine, "defaultos="); 00044 if (Setting) 00045 { 00046 // 00047 // Check if there's more command-line parameters following 00048 // 00049 Setting += sizeof("defaultos=") + sizeof(ANSI_NULL); 00050 End = strstr(Setting, " "); 00051 if (End) Length = End - Setting; else Length = sizeof(DefaultOs); 00052 00053 // 00054 // Copy the default OS 00055 // 00056 strncpy(DefaultOs, Setting, Length); 00057 CmdLineInfo.DefaultOperatingSystem = DefaultOs; 00058 } 00059 00060 // 00061 // Get ramdisk base address 00062 // 00063 Setting = strstr(CmdLine, "rdbase="); 00064 if (Setting) gRamDiskBase = (PVOID)(ULONG_PTR)strtoull(Setting + 00065 sizeof("rdbase=") - 00066 sizeof(ANSI_NULL), 00067 NULL, 00068 0); 00069 00070 // 00071 // Get ramdisk size 00072 // 00073 Setting = strstr(CmdLine, "rdsize="); 00074 if (Setting) gRamDiskSize = strtoul(Setting + 00075 sizeof("rdsize=") - 00076 sizeof(ANSI_NULL), 00077 NULL, 00078 0); 00079 00080 // 00081 // Get ramdisk offset 00082 // 00083 Setting = strstr(CmdLine, "rdoffset="); 00084 if (Setting) Offset = strtoul(Setting + 00085 sizeof("rdoffset=") - 00086 sizeof(ANSI_NULL), 00087 NULL, 00088 0); 00089 00090 // 00091 // Fix it up 00092 // 00093 gRamDiskBase = (PVOID)((ULONG_PTR)gRamDiskBase + Offset); 00094 } 00095 00096 PCCH 00097 CmdLineGetDefaultOS(VOID) 00098 { 00099 return CmdLineInfo.DefaultOperatingSystem; 00100 } 00101 00102 LONG 00103 CmdLineGetTimeOut(VOID) 00104 { 00105 return CmdLineInfo.TimeOut; 00106 } Generated on Sat May 26 2012 04:17:54 for ReactOS by
1.7.6.1
|