ReactOS 0.4.15-dev-7704-gc07eb9f
inifile.h
Go to the documentation of this file.
1/*
2 * FreeLoader
3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#pragma once
21
22#define INI_FILE_COMMENT_CHAR ';'
23
24#define TAG_INI_FILE 'FinI'
25#define TAG_INI_SECTION 'SinI'
26#define TAG_INI_SECTION_ITEM 'IinI'
27#define TAG_INI_NAME 'NinI'
28#define TAG_INI_VALUE 'VinI'
29
30// This structure describes a single .ini file item
31// The item format in the .ini file is:
32// Name=Value
33typedef struct
34{
38
40
41// This structure describes a .ini file section
42// The section format in the .ini file is:
43// [Section Name]
44// This structure has a list of section items with
45// one INI_SECTION_ITEM for each line in the section
46typedef struct
47{
51 LIST_ENTRY SectionItemList; // Contains PINI_SECTION_ITEM structures
52
54
59
60BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize);
61ULONG IniGetNextLineSize(PCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset);
62ULONG IniGetNextLine(PCHAR IniFileData, ULONG IniFileSize, PCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset);
63BOOLEAN IniIsLineEmpty(PCHAR LineOfText, ULONG TextLength);
64BOOLEAN IniIsCommentLine(PCHAR LineOfText, ULONG TextLength);
65BOOLEAN IniIsSectionName(PCHAR LineOfText, ULONG TextLength);
66ULONG IniGetSectionNameSize(PCHAR SectionNameLine, ULONG LineLength);
67VOID IniExtractSectionName(PCHAR SectionName, PCHAR SectionNameLine, ULONG LineLength);
68BOOLEAN IniIsSetting(PCHAR LineOfText, ULONG TextLength);
69ULONG IniGetSettingNameSize(PCHAR SettingNameLine, ULONG LineLength);
70ULONG IniGetSettingValueSize(PCHAR SettingValueLine, ULONG LineLength);
71VOID IniExtractSettingName(PCHAR SettingName, PCHAR SettingNameLine, ULONG LineLength);
72VOID IniExtractSettingValue(PCHAR SettingValue, PCHAR SettingValueLine, ULONG LineLength);
73
75
76BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR* SectionId);
80BOOLEAN IniReadSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize);
82BOOLEAN IniAddSection(PCSTR SectionName, ULONG_PTR* SectionId);
83BOOLEAN IniAddSettingValueToSection(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue);
84BOOLEAN IniModifySettingValue(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue);
unsigned char BOOLEAN
Definition: bufpool.h:45
BOOLEAN IniAddSection(PCSTR SectionName, ULONG_PTR *SectionId)
Definition: inifile.c:179
ULONG IniGetSettingNameSize(PCHAR SettingNameLine, ULONG LineLength)
Definition: parse.c:416
VOID IniExtractSettingValue(PCHAR SettingValue, PCHAR SettingValueLine, ULONG LineLength)
Definition: parse.c:544
ULONG IniGetSectionSettingValueSize(ULONG_PTR SectionId, ULONG SettingIndex)
Definition: inifile.c:101
ULONG IniFileSectionCount
Definition: parse.c:27
BOOLEAN IniIsSetting(PCHAR LineOfText, ULONG TextLength)
Definition: parse.c:400
ULONG IniGetNumSectionItems(ULONG_PTR SectionId)
Definition: inifile.c:54
BOOLEAN IniAddSettingValueToSection(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue)
Definition: inifile.c:252
BOOLEAN IniFileInitialize(VOID)
Definition: ini_init.c:25
VOID IniExtractSettingName(PCHAR SettingName, PCHAR SettingNameLine, ULONG LineLength)
Definition: parse.c:507
ULONG IniGetSectionNameSize(PCHAR SectionNameLine, ULONG LineLength)
Definition: parse.c:319
BOOLEAN IniIsLineEmpty(PCHAR LineOfText, ULONG TextLength)
Definition: parse.c:244
ULONG IniGetNextLineSize(PCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset)
Definition: parse.c:185
BOOLEAN IniModifySettingValue(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue)
Definition: inifile.c:293
ULONG IniGetSectionSettingNameSize(ULONG_PTR SectionId, ULONG SettingIndex)
Definition: inifile.c:88
BOOLEAN IniReadSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize)
Definition: inifile.c:114
struct INI_SECTION * PINI_SECTION
ULONG IniFileSettingCount
Definition: parse.c:28
LIST_ENTRY IniFileSectionListHead
Definition: parse.c:25
ULONG IniGetSettingValueSize(PCHAR SettingValueLine, ULONG LineLength)
Definition: parse.c:454
BOOLEAN IniIsSectionName(PCHAR LineOfText, ULONG TextLength)
Definition: parse.c:293
BOOLEAN IniReadSettingByName(ULONG_PTR SectionId, PCSTR SettingName, PCHAR Buffer, ULONG BufferSize)
Definition: inifile.c:147
BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
Definition: parse.c:31
BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR *SectionId)
Definition: inifile.c:25
struct INI_SECTION_ITEM * PINI_SECTION_ITEM
VOID IniExtractSectionName(PCHAR SectionName, PCHAR SectionNameLine, ULONG LineLength)
Definition: parse.c:360
VOID IniCleanup(VOID)
Definition: inifile.c:235
ULONG IniGetNextLine(PCHAR IniFileData, ULONG IniFileSize, PCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset)
Definition: parse.c:210
BOOLEAN IniIsCommentLine(PCHAR LineOfText, ULONG TextLength)
Definition: parse.c:267
BOOLEAN IniFileSectionInitialized
Definition: parse.c:26
LIST_ENTRY ListEntry
Definition: inifile.h:35
PCHAR ItemName
Definition: inifile.h:36
PCHAR ItemValue
Definition: inifile.h:37
ULONG SectionItemCount
Definition: inifile.h:50
LIST_ENTRY ListEntry
Definition: inifile.h:48
LIST_ENTRY SectionItemList
Definition: inifile.h:51
PCHAR SectionName
Definition: inifile.h:49
Definition: typedefs.h:120
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
_In_ WDFUSBINTERFACE _In_ UCHAR SettingIndex
Definition: wdfusb.h:2303