34 ULONG CurrentLineNumber;
36 ULONG IniFileLineSize;
41 TRACE(
"IniParseFile() IniFileSize: %d\n", IniFileSize);
58 CurrentLineNumber = 0;
60 while (CurrentOffset < IniFileSize)
75 CurrentOffset =
IniGetNextLine(IniFileData, IniFileSize, IniFileLine, IniFileLineSize, CurrentOffset);
100 if (!CurrentSection->SectionName)
123 if (CurrentSection ==
NULL)
125 ERR(
"Error: freeldr.ini:%lu: Setting '%s' found outside of a [section].\n", CurrentLineNumber, IniFileLine);
167 CurrentSection->SectionItemCount++;
180 TRACE(
"IniParseFile() done.\n");
187 ULONG LineCharCount = 0;
191 for (; (CurrentOffset < IniFileSize); CurrentOffset++)
197 if (IniFileData[CurrentOffset] ==
'\n')
207 return LineCharCount;
216 for (Idx=0; (CurrentOffset < IniFileSize); CurrentOffset++)
222 Buffer[Idx++] = IniFileData[CurrentOffset];
226 if (IniFileData[CurrentOffset] ==
'\n')
237 while(Idx && (
Buffer[--Idx] ==
'\n' ||
Buffer[Idx] ==
'\r'))
241 return CurrentOffset;
249 for (Idx=0; Idx<TextLength; Idx++)
251 if ((LineOfText[Idx] ==
' ') ||
252 (LineOfText[Idx] ==
'\t') ||
253 (LineOfText[Idx] ==
'\n') ||
254 (LineOfText[Idx] ==
'\r'))
273 for (Idx=0; Idx<TextLength; Idx++)
275 if ((LineOfText[Idx] ==
' ') ||
276 (LineOfText[Idx] ==
'\t'))
299 for (Idx=0; Idx<TextLength; Idx++)
301 if ((LineOfText[Idx] ==
' ') ||
302 (LineOfText[Idx] ==
'\t'))
306 else if (LineOfText[Idx] ==
'[')
325 for (Idx=0; Idx<LineLength; Idx++)
327 if ((SectionNameLine[Idx] ==
' ') ||
328 (SectionNameLine[Idx] ==
'\t'))
342 for (NameSize=0; Idx<LineLength; Idx++)
344 if ((SectionNameLine[Idx] ==
']') ||
345 (SectionNameLine[Idx] ==
'\0'))
366 for (Idx=0; Idx<LineLength; Idx++)
368 if ((SectionNameLine[Idx] ==
' ') ||
369 (SectionNameLine[Idx] ==
'\t'))
383 for (DestIdx=0; Idx<LineLength; Idx++)
385 if ((SectionNameLine[Idx] ==
']') ||
386 (SectionNameLine[Idx] ==
'\0'))
392 SectionName[DestIdx] = SectionNameLine[Idx];
397 SectionName[DestIdx] =
'\0';
405 for (Idx=0; Idx<TextLength; Idx++)
407 if (LineOfText[Idx] ==
'=')
422 for (Idx=0; Idx<LineLength; Idx++)
424 if ((SettingNameLine[Idx] ==
' ') ||
425 (SettingNameLine[Idx] ==
'\t'))
436 for (NameSize=0; Idx<LineLength; Idx++)
438 if ((SettingNameLine[Idx] ==
'=') ||
439 (SettingNameLine[Idx] ==
'\0'))
460 for (Idx=0; Idx<LineLength; Idx++)
462 if ((SettingValueLine[Idx] ==
' ') ||
463 (SettingValueLine[Idx] ==
'\t'))
474 for (; Idx<LineLength; Idx++)
476 if (SettingValueLine[Idx] ==
'=')
483 if (SettingValueLine[Idx] ==
'\0')
490 for (ValueSize=0; Idx<LineLength; Idx++)
492 if (SettingValueLine[Idx] ==
'\0')
513 for (Idx=0; Idx<LineLength; Idx++)
515 if ((SettingNameLine[Idx] ==
' ') ||
516 (SettingNameLine[Idx] ==
'\t'))
527 for (DestIdx=0; Idx<LineLength; Idx++)
529 if ((SettingNameLine[Idx] ==
'=') ||
530 (SettingNameLine[Idx] ==
'\0'))
536 SettingName[DestIdx] = SettingNameLine[Idx];
541 SettingName[DestIdx] =
'\0';
550 for (Idx=0; Idx<LineLength; Idx++)
552 if ((SettingValueLine[Idx] ==
' ') ||
553 (SettingValueLine[Idx] ==
'\t'))
564 for (; Idx<LineLength; Idx++)
566 if (SettingValueLine[Idx] ==
'=')
573 if (SettingValueLine[Idx] ==
'\0')
575 SettingValue[0] =
'\0';
581 for (DestIdx=0; Idx<LineLength; Idx++)
583 if (SettingValueLine[Idx] ==
'\0')
589 SettingValue[DestIdx] = SettingValueLine[Idx];
594 SettingValue[DestIdx] =
'\0';
ACPI_SIZE strlen(const char *String)
#define DBG_DEFAULT_CHANNEL(ch)
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
ULONG IniGetSettingNameSize(PCHAR SettingNameLine, ULONG LineLength)
VOID IniExtractSettingValue(PCHAR SettingValue, PCHAR SettingValueLine, ULONG LineLength)
ULONG IniFileSectionCount
BOOLEAN IniIsSetting(PCHAR LineOfText, ULONG TextLength)
VOID IniExtractSettingName(PCHAR SettingName, PCHAR SettingNameLine, ULONG LineLength)
ULONG IniGetSectionNameSize(PCHAR SectionNameLine, ULONG LineLength)
BOOLEAN IniIsLineEmpty(PCHAR LineOfText, ULONG TextLength)
ULONG IniGetNextLineSize(PCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset)
ULONG IniFileSettingCount
LIST_ENTRY IniFileSectionListHead
ULONG IniGetSettingValueSize(PCHAR SettingValueLine, ULONG LineLength)
BOOLEAN IniIsSectionName(PCHAR LineOfText, ULONG TextLength)
BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
VOID IniExtractSectionName(PCHAR SectionName, PCHAR SectionNameLine, ULONG LineLength)
ULONG IniGetNextLine(PCHAR IniFileData, ULONG IniFileSize, PCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset)
BOOLEAN IniIsCommentLine(PCHAR LineOfText, ULONG TextLength)
BOOLEAN IniFileSectionInitialized
#define InsertTailList(ListHead, Entry)
#define InitializeListHead(ListHead)
#define TAG_INI_SECTION_ITEM
#define INI_FILE_COMMENT_CHAR
#define RtlZeroMemory(Destination, Length)
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize