ReactOS  0.4.15-dev-494-g1d8c567
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
33 typedef 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
46 typedef struct
47 {
51  LIST_ENTRY SectionItemList; // Contains PINI_SECTION_ITEM structures
52 
54 
59 
60 BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize);
61 ULONG IniGetNextLineSize(PCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset);
62 ULONG IniGetNextLine(PCHAR IniFileData, ULONG IniFileSize, PCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset);
63 BOOLEAN IniIsLineEmpty(PCHAR LineOfText, ULONG TextLength);
64 BOOLEAN IniIsCommentLine(PCHAR LineOfText, ULONG TextLength);
65 BOOLEAN IniIsSectionName(PCHAR LineOfText, ULONG TextLength);
66 ULONG IniGetSectionNameSize(PCHAR SectionNameLine, ULONG LineLength);
67 VOID IniExtractSectionName(PCHAR SectionName, PCHAR SectionNameLine, ULONG LineLength);
68 BOOLEAN IniIsSetting(PCHAR LineOfText, ULONG TextLength);
69 ULONG IniGetSettingNameSize(PCHAR SettingNameLine, ULONG LineLength);
70 ULONG IniGetSettingValueSize(PCHAR SettingValueLine, ULONG LineLength);
71 VOID IniExtractSettingName(PCHAR SettingName, PCHAR SettingNameLine, ULONG LineLength);
72 VOID IniExtractSettingValue(PCHAR SettingValue, PCHAR SettingValueLine, ULONG LineLength);
73 
75 
76 BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR* SectionId);
78 ULONG IniGetSectionSettingNameSize(ULONG_PTR SectionId, ULONG SettingIndex);
79 ULONG IniGetSectionSettingValueSize(ULONG_PTR SectionId, ULONG SettingIndex);
80 BOOLEAN IniReadSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize);
82 BOOLEAN IniAddSection(PCSTR SectionName, ULONG_PTR* SectionId);
83 BOOLEAN IniAddSettingValueToSection(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue);
84 BOOLEAN IniModifySettingValue(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue);
signed char * PCHAR
Definition: retypes.h:7
ULONG IniFileSettingCount
Definition: parse.c:28
BOOLEAN IniIsSetting(PCHAR LineOfText, ULONG TextLength)
Definition: parse.c:400
PCHAR ItemValue
Definition: inifile.h:37
BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
Definition: parse.c:31
struct INI_SECTION_ITEM * PINI_SECTION_ITEM
VOID IniExtractSectionName(PCHAR SectionName, PCHAR SectionNameLine, ULONG LineLength)
Definition: parse.c:360
LIST_ENTRY ListEntry
Definition: inifile.h:48
LIST_ENTRY ListEntry
Definition: inifile.h:35
ULONG IniGetSectionNameSize(PCHAR SectionNameLine, ULONG LineLength)
Definition: parse.c:319
uint32_t ULONG_PTR
Definition: typedefs.h:64
BOOLEAN IniIsCommentLine(PCHAR LineOfText, ULONG TextLength)
Definition: parse.c:267
BOOLEAN IniFileSectionInitialized
Definition: parse.c:26
BOOLEAN IniModifySettingValue(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue)
Definition: inifile.c:293
PCHAR ItemName
Definition: inifile.h:36
unsigned char BOOLEAN
BOOLEAN IniIsSectionName(PCHAR LineOfText, ULONG TextLength)
Definition: parse.c:293
Definition: bufpool.h:45
ULONG IniGetSettingNameSize(PCHAR SettingNameLine, ULONG LineLength)
Definition: parse.c:416
VOID IniExtractSettingValue(PCHAR SettingValue, PCHAR SettingValueLine, ULONG LineLength)
Definition: parse.c:544
BOOLEAN IniReadSettingByName(ULONG_PTR SectionId, PCSTR SettingName, PCHAR Buffer, ULONG BufferSize)
Definition: inifile.c:147
ULONG IniGetSettingValueSize(PCHAR SettingValueLine, ULONG LineLength)
Definition: parse.c:454
BOOLEAN IniAddSettingValueToSection(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue)
Definition: inifile.c:252
ULONG SectionItemCount
Definition: inifile.h:50
BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR *SectionId)
Definition: inifile.c:25
LIST_ENTRY IniFileSectionListHead
Definition: parse.c:25
ULONG IniFileSectionCount
Definition: parse.c:27
#define BufferSize
Definition: classpnp.h:419
ULONG IniGetSectionSettingValueSize(ULONG_PTR SectionId, ULONG SettingIndex)
Definition: inifile.c:101
LIST_ENTRY SectionItemList
Definition: inifile.h:51
VOID IniCleanup(VOID)
Definition: inifile.c:235
ULONG IniGetNextLine(PCHAR IniFileData, ULONG IniFileSize, PCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset)
Definition: parse.c:210
Definition: typedefs.h:118
BOOLEAN IniIsLineEmpty(PCHAR LineOfText, ULONG TextLength)
Definition: parse.c:244
struct INI_SECTION * PINI_SECTION
PCHAR SectionName
Definition: inifile.h:49
BOOLEAN IniFileInitialize(VOID)
Definition: ini_init.c:25
unsigned int ULONG
Definition: retypes.h:1
ULONG IniGetSectionSettingNameSize(ULONG_PTR SectionId, ULONG SettingIndex)
Definition: inifile.c:88
ULONG IniGetNumSectionItems(ULONG_PTR SectionId)
Definition: inifile.c:54
const char * PCSTR
Definition: typedefs.h:52
BOOLEAN IniReadSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize)
Definition: inifile.c:114
BOOLEAN IniAddSection(PCSTR SectionName, ULONG_PTR *SectionId)
Definition: inifile.c:179
VOID IniExtractSettingName(PCHAR SettingName, PCHAR SettingNameLine, ULONG LineLength)
Definition: parse.c:507
ULONG IniGetNextLineSize(PCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset)
Definition: parse.c:185