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

View file

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

View file

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

View file

@ -404,7 +404,8 @@ StartPage(PINPUT_RECORD Ir)
IniCache = NULL; IniCache = NULL;
Status = IniCacheLoad(&IniCache, Status = IniCacheLoad(&IniCache,
&FileName); &FileName,
TRUE);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
PopupError("Setup failed to load the file TXTSETUP.SIF.\n", 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); return(INTRO_PAGE);
} }