3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
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.
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 BOOL
IniFileInitialize(VOID
)
30 PFILE Freeldr_Ini
; // File handle for freeldr.ini
31 PCHAR FreeLoaderIniFileData
;
32 ULONG FreeLoaderIniFileSize
;
36 Freeldr_Ini
= IniOpenIniFile();
38 if (Freeldr_Ini
== NULL
)
40 printf("Error opening freeldr.ini or file not found.\n");
41 printf("You need to re-install FreeLoader.\n");
45 // Get the file size & allocate enough memory for it
46 FreeLoaderIniFileSize
= FsGetFileSize(Freeldr_Ini
);
47 FreeLoaderIniFileData
= MmAllocateMemory(FreeLoaderIniFileSize
);
49 // If we are out of memory then return FALSE
50 if (FreeLoaderIniFileData
== NULL
)
52 printf("Out of memory while loading freeldr.ini.\n");
53 FsCloseFile(Freeldr_Ini
);
57 // Read freeldr.ini off the disk
58 if (!FsReadFile(Freeldr_Ini
, FreeLoaderIniFileSize
, NULL
, FreeLoaderIniFileData
))
60 FsCloseFile(Freeldr_Ini
);
61 MmFreeMemory(FreeLoaderIniFileData
);
65 FsCloseFile(Freeldr_Ini
);
67 // Parse the .ini file data
68 Success
= IniParseFile(FreeLoaderIniFileData
, FreeLoaderIniFileSize
);
70 MmFreeMemory(FreeLoaderIniFileData
);
75 PFILE
IniOpenIniFile()
77 PFILE IniFileHandle
; // File handle for freeldr.ini
79 // Try to open freeldr.ini
80 IniFileHandle
= FsOpenFile("freeldr.ini");