Fix bug which causes a crash in RtlpCheckFileNameExtension() if the file doesn't have an extension.

svn path=/trunk/; revision=4468
This commit is contained in:
Eric Kohl 2003-04-01 16:35:22 +00:00
parent 1d1253f734
commit 1fb9958a68

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: main.c,v 1.149 2003/03/22 22:32:17 ekohl Exp $ /* $Id: main.c,v 1.150 2003/04/01 16:35:22 ekohl Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c * FILE: ntoskrnl/ke/main.c
@ -88,13 +88,14 @@ RtlpCheckFileNameExtension(PCHAR FileName,
PCHAR Ext; PCHAR Ext;
Ext = strrchr(FileName, '.'); Ext = strrchr(FileName, '.');
if ((Extension == NULL) || (*Extension == 0))
{
if (Ext == NULL) if (Ext == NULL)
{
if ((Extension == NULL) || (*Extension == 0))
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
} }
if (*Extension != '.') if (*Extension != '.')
Ext++; Ext++;
@ -479,12 +480,14 @@ ExpInitializeExecutive(VOID)
} }
} }
/* Pass 2: import system registry chunk */ /* Pass 2: import system hive registry chunk */
SetupBoot = TRUE; SetupBoot = TRUE;
for (i = 1; i < KeLoaderBlock.ModsCount; i++) for (i = 1; i < KeLoaderBlock.ModsCount; i++)
{ {
start = KeLoaderModules[i].ModStart; start = KeLoaderModules[i].ModStart;
length = KeLoaderModules[i].ModEnd - start; length = KeLoaderModules[i].ModEnd - start;
DPRINT("Module: '%s'\n", (PCHAR)KeLoaderModules[i].String);
name = strrchr((PCHAR)KeLoaderModules[i].String, '\\'); name = strrchr((PCHAR)KeLoaderModules[i].String, '\\');
if (name == NULL) if (name == NULL)
{ {
@ -498,13 +501,13 @@ ExpInitializeExecutive(VOID)
if (!_stricmp (name, "system") || if (!_stricmp (name, "system") ||
!_stricmp (name, "system.hiv")) !_stricmp (name, "system.hiv"))
{ {
CPRINT("Process 'system' registry chunk at %08lx\n", start); CPRINT("Process system hive registry chunk at %08lx\n", start);
SetupBoot = FALSE; SetupBoot = FALSE;
CmImportSystemHive((PCHAR)start, length); CmImportSystemHive((PCHAR)start, length);
} }
} }
/* Pass 3: import hardware registry chunk */ /* Pass 3: import hardware hive registry chunk */
for (i = 1; i < KeLoaderBlock.ModsCount; i++) for (i = 1; i < KeLoaderBlock.ModsCount; i++)
{ {
start = KeLoaderModules[i].ModStart; start = KeLoaderModules[i].ModStart;
@ -513,7 +516,7 @@ ExpInitializeExecutive(VOID)
if (!_stricmp (name, "hardware") || if (!_stricmp (name, "hardware") ||
!_stricmp (name, "hardware.hiv")) !_stricmp (name, "hardware.hiv"))
{ {
CPRINT("Process 'hardware' registry chunk at %08lx\n", start); CPRINT("Process hardware hive registry chunk at %08lx\n", start);
CmImportHardwareHive((PCHAR)start, length); CmImportHardwareHive((PCHAR)start, length);
} }
} }