Distinguish between ini-files and inf/sif-files. Patch by Hartmut Birr.

svn path=/trunk/; revision=4083
This commit is contained in:
Eric Kohl 2003-01-30 17:37:13 +00:00
parent 155e4760a8
commit 14f750504e
4 changed files with 71 additions and 37 deletions

View file

@ -388,7 +388,8 @@ UpdateFreeLoaderIni(PWCHAR IniPath,
IniPath);
Status = IniCacheLoad(&IniCache,
&Name);
&Name,
FALSE);
if (!NT_SUCCESS(Status))
return(Status);
@ -1438,7 +1439,8 @@ UpdateBootIni(PWSTR BootIniPath,
BootIniPath);
Status = IniCacheLoad(&Cache,
&Name);
&Name,
FALSE);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
@ -1487,4 +1489,4 @@ CHECKPOINT1;
return(Status);
}
/* EOF */
/* EOF */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: inicache.c,v 1.3 2003/01/28 17:29:22 ekohl Exp $
/* $Id: inicache.c,v 1.4 2003/01/30 17:37:13 ekohl Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/inicache.c
@ -393,21 +393,42 @@ IniCacheGetKeyName(PCHAR Ptr,
*NamePtr = NULL;
*NameSize = 0;
/* skip whitespace */
while (*Ptr != 0 && isspace(*Ptr))
while(Ptr && *Ptr)
{
*NamePtr = NULL;
*NameSize = 0;
Size = 0;
/* skip whitespace and empty lines */
while (isspace(*Ptr) || *Ptr == '\n' || *Ptr == '\r')
{
Ptr++;
}
if (*Ptr == 0)
{
continue;
}
*NamePtr = Ptr;
*NamePtr = Ptr;
while (*Ptr != 0 && !isspace(*Ptr) && *Ptr != '=')
while (*Ptr != 0 && !isspace(*Ptr) && *Ptr != '=' && *Ptr != ';')
{
Size++;
Ptr++;
}
*NameSize = Size;
if (*Ptr == ';')
{
while (*Ptr != 0 && *Ptr != '\r' && *Ptr != '\n')
{
Ptr++;
}
}
else
{
*NameSize = Size;
break;
}
}
return(Ptr);
}
@ -416,7 +437,8 @@ IniCacheGetKeyName(PCHAR Ptr,
static PCHAR
IniCacheGetKeyValue(PCHAR Ptr,
PCHAR *DataPtr,
PULONG DataSize)
PULONG DataSize,
BOOL String)
{
ULONG Size = 0;
@ -442,12 +464,32 @@ IniCacheGetKeyValue(PCHAR Ptr,
Ptr++;
}
/* Get data */
*DataPtr = Ptr;
while (*Ptr != 0 && *Ptr != '\r')
if (*Ptr == '"' && String)
{
Ptr++;
Size++;
/* Get data */
*DataPtr = Ptr;
while (*Ptr != '"')
{
Ptr++;
Size++;
}
Ptr++;
while (*Ptr && *Ptr != '\r' && *Ptr != '\n')
{
Ptr++;
}
}
else
{
/* Get data */
*DataPtr = Ptr;
while (*Ptr != 0 && *Ptr != '\r' && *Ptr != ';')
{
Ptr++;
Size++;
}
}
/* Skip to next line */
@ -468,7 +510,8 @@ IniCacheGetKeyValue(PCHAR Ptr,
NTSTATUS
IniCacheLoad(PINICACHE *Cache,
PUNICODE_STRING FileName)
PUNICODE_STRING FileName,
BOOL String)
{
OBJECT_ATTRIBUTES ObjectAttributes;
FILE_STANDARD_INFORMATION FileInfo;
@ -615,6 +658,8 @@ IniCacheLoad(PINICACHE *Cache,
&SectionName,
&SectionNameSize);
DPRINT1("[%.*s]\n", SectionNameSize, SectionName);
Section = IniCacheAddSection(*Cache,
SectionName,
SectionNameSize);
@ -639,7 +684,10 @@ IniCacheLoad(PINICACHE *Cache,
Ptr = IniCacheGetKeyValue(Ptr,
&KeyValue,
&KeyValueSize);
&KeyValueSize,
String);
DPRINT1("'%.*s' = '%.*s'\n", KeyNameSize, KeyName, KeyValueSize, KeyValue);
Key = IniCacheAddKey(Section,
KeyName,

View file

@ -77,7 +77,8 @@ typedef enum
NTSTATUS
IniCacheLoad(PINICACHE *Cache,
PUNICODE_STRING FileName);
PUNICODE_STRING FileName,
BOOL String);
VOID
IniCacheDestroy(PINICACHE Cache);

View file

@ -404,7 +404,8 @@ StartPage(PINPUT_RECORD Ir)
IniCache = NULL;
Status = IniCacheLoad(&IniCache,
&FileName);
&FileName,
TRUE);
if (!NT_SUCCESS(Status))
{
PopupError("Setup failed to load the file TXTSETUP.SIF.\n",
@ -478,24 +479,6 @@ StartPage(PINPUT_RECORD Ir)
}
}
#if 0
PopupError("This is a test error.", "ENTER = Reboot computer");
SetStatusText(" ENTER = Continue");
while(TRUE)
{
ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(INTRO_PAGE);
}
}
return(START_PAGE);
#endif
return(INTRO_PAGE);
}