49{
56 PCHAR TitleStart, TitleEnd;
60 CHAR SettingName[260];
61 CHAR SettingValue[260];
64
65
66 *OperatingSystemCount = 0;
67
68
70 {
71 UiMessageBox(
"Operating Systems section not found in freeldr.ini");
73 }
74
75
79
80
82 if (!Items)
84
85
87
88
90 {
92 SettingName, sizeof(SettingName),
93 SettingValue, sizeof(SettingValue));
94 if (!*SettingName)
95 {
96 ERR(
"Invalid OS entry %lu, skipping.\n",
i);
97 continue;
98 }
99
100
101 TitleStart = SettingValue;
102
103 while (*TitleStart == ' ' || *TitleStart == '\t' || *TitleStart == '"')
104 ++TitleStart;
105 TitleEnd = TitleStart;
106
107 while (*TitleEnd !=
ANSI_NULL && *TitleEnd !=
'"')
108 ++TitleEnd;
109
110
111 if (*TitleEnd)
113
114
115 if (*TitleEnd)
116 {
117
118 while (*TitleEnd == ' ' || *TitleEnd == '\t' || *TitleEnd == '"')
119 ++TitleEnd;
120 }
121 OsLoadOptions = (*TitleEnd ? TitleEnd :
NULL);
122
123
124
125
126
127
128
129
130 if (DefaultOSName &&
_stricmp(DefaultOSName, SettingName) == 0)
131 {
133 DefaultOSName =
NULL;
134 }
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159 SectionId = 0;
161 if (HadSection)
162 {
163
165 }
166 else
167 {
168
170 }
171
172
173 HadNoBootType = (*BootType ==
ANSI_NULL);
174 if (HadNoBootType)
175 {
176#ifdef _M_IX86
179 {
181 strcpy(BootType,
"BootSector");
182 }
183 else
184#endif
185 {
186 strcpy(BootType,
"Windows");
187 }
188 }
189
190
191 if (!HadSection)
192 {
194
195
197
198
200 if (
_stricmp(BootType,
"BootSector") == 0)
201 {
203 "BootSectorFile%u%u%u%u%u%u",
206 }
207 else if (
_stricmp(BootType,
"Windows") == 0)
208 {
210 "Windows%u%u%u%u%u%u",
213 }
214 else
215 {
217 }
218
219
221 {
222 ERR(
"Could not convert legacy OS entry %lu, skipping.\n",
i);
223 continue;
224 }
225
226
227 if (
_stricmp(BootType,
"BootSector") == 0)
228 {
230 {
231 ERR(
"Could not convert legacy OS entry %lu, skipping.\n",
i);
232 continue;
233 }
234 }
235 else if (
_stricmp(BootType,
"Windows") == 0)
236 {
238 {
239 ERR(
"Could not convert legacy OS entry %lu, skipping.\n",
i);
240 continue;
241 }
242 }
243 else
244 {
246 }
247
248
250 {
251 ERR(
"Could not convert legacy OS entry %lu, skipping.\n",
i);
252 continue;
253 }
254 }
255
256
258 {
259 ERR(
"Could not fixup the BootType entry for OS '%s', ignoring.\n", SettingName);
260 }
261
262
263
264
265
266 if (HadSection && OsLoadOptions && *OsLoadOptions)
267 {
268
271 TRACE(
"No 'Options' value found for OS '%s', ignoring.\n", SettingName);
272
273
276
277
279 ERR(
"Could not modify the options for OS '%s', ignoring.\n", SettingName);
280 }
281
282
285
286
287 }
288
289
290 *OperatingSystemCount =
Count;
291 *DefaultOperatingSystem = DefaultOS;
292 return Items;
293}
TIMEINFO * ArcGetTime(VOID)
ARC_STATUS ArcOpen(CHAR *Path, OPENMODE OpenMode, ULONG *FileId)
ARC_STATUS ArcClose(_In_ ULONG FileId)
PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
PBOOTMGRINFO GetBootMgrInfo(VOID)
VOID UiMessageBox(_In_ PCSTR Format,...)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
PINI_SECTION IniAddSection(_In_ PINICACHE Cache, _In_ PCWSTR Name)
ULONG IniGetNumSectionItems(ULONG_PTR SectionId)
BOOLEAN IniAddSettingValueToSection(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue)
BOOLEAN IniModifySettingValue(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue)
BOOLEAN IniReadSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize)
BOOLEAN IniReadSettingByName(ULONG_PTR SectionId, PCSTR SettingName, PCHAR Buffer, ULONG BufferSize)
BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR *SectionId)
NTSTRSAFEAPI RtlStringCbCatA(_Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
static PCSTR CopyString(PCSTR Source)