Use SystemRoot link instead of LdrGetSystemDirectory()

svn path=/trunk/; revision=1205
This commit is contained in:
Eric Kohl 2000-06-18 17:40:35 +00:00
parent 5b2343f9f1
commit 88cf03e85b
5 changed files with 13 additions and 117 deletions

View file

@ -12,7 +12,8 @@
* RJJ 10/12/98 Rolled in David's code to load COFF drivers
* JM 14/12/98 Built initial PE user module loader
* RJJ 06/03/99 Moved user PE loader into NTDLL
* EA 19990717 GetSystemDirectory()
* EA 19990717 LdrGetSystemDirectory()
* EK 20000618 Using SystemRoot link instead of LdrGetSystemDirectory()
*/
/* INCLUDES *****************************************************************/
@ -32,8 +33,6 @@
#define NDEBUG
#include <internal/debug.h>
#include "syspath.h"
/* GLOBALS *******************************************************************/
#define STACK_TOP (0xb0000000)
@ -49,7 +48,6 @@ NTSTATUS LdrLoadInitialProcess (VOID)
NTSTATUS Status;
HANDLE ProcessHandle;
UNICODE_STRING ProcessName;
WCHAR TmpNameBuffer[MAX_PATH];
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE FileHandle;
HANDLE SectionHandle;
@ -63,26 +61,25 @@ NTSTATUS LdrLoadInitialProcess (VOID)
HANDLE ThreadHandle;
/*
* Get the system directory's name (a DOS device
* alias name which is in \\??\\).
* Get the absolute path to smss.exe using the
* SystemRoot link.
*/
LdrGetSystemDirectory(TmpNameBuffer, sizeof TmpNameBuffer);
wcscat(TmpNameBuffer, L"\\smss.exe");
RtlInitUnicodeString(&ProcessName, TmpNameBuffer);
RtlInitUnicodeString(&ProcessName,
L"\\SystemRoot\\system32\\smss.exe");
/*
* Open process image to determine ImageBase
* and StackBase/Size.
*/
InitializeObjectAttributes(&ObjectAttributes,
&ProcessName,
&ProcessName,
0,
NULL,
NULL);
DPRINT("Opening image file %S\n", ObjectAttributes.ObjectName->Buffer);
Status = ZwOpenFile(&FileHandle,
FILE_ALL_ACCESS,
&ObjectAttributes,
&ObjectAttributes,
NULL,
0,
0);

View file

@ -25,8 +25,6 @@
#define NDEBUG
#include <internal/debug.h>
#include "syspath.h"
/* GLOBALS *******************************************************************/
static PVOID SystemDllEntryPoint = NULL;
@ -56,7 +54,7 @@ NTSTATUS LdrpMapSystemDll(HANDLE ProcessHandle,
*
* RETURNS: Status
*/
{
{
CHAR BlockBuffer [1024];
DWORD ImageBase;
ULONG ImageSize;
@ -69,15 +67,13 @@ NTSTATUS LdrpMapSystemDll(HANDLE ProcessHandle,
PIMAGE_NT_HEADERS NTHeaders;
ULONG InitialViewSize;
ULONG i;
WCHAR TmpNameBuffer [MAX_PATH];
/*
* Locate and open NTDLL to determine ImageBase
* and LdrStartup
*/
LdrGetSystemDirectory(TmpNameBuffer, sizeof TmpNameBuffer);
wcscat(TmpNameBuffer, L"\\ntdll.dll");
RtlInitUnicodeString(&DllPathname, TmpNameBuffer);
RtlInitUnicodeString(&DllPathname,
L"\\SystemRoot\\system32\\ntdll.dll");
InitializeObjectAttributes(&FileObjectAttributes,
&DllPathname,
0,
@ -125,7 +121,7 @@ NTSTATUS LdrpMapSystemDll(HANDLE ProcessHandle,
ZwClose(FileHandle);
return(STATUS_UNSUCCESSFUL);
}
ImageBase = NTHeaders->OptionalHeader.ImageBase;
ImageBase = NTHeaders->OptionalHeader.ImageBase;
ImageSize = NTHeaders->OptionalHeader.SizeOfImage;
/*

View file

@ -1,89 +0,0 @@
/* $Id: syspath.c,v 1.3 1999/10/20 23:09:26 rex Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ldr/syspath.c
* PURPOSE: Get system path
* PROGRAMMERS: EA
* UPDATE HISTORY:
* EA 19990717 GetSystemDirectory()
*/
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <wchar.h>
#include <string.h>
/**********************************************************************
* NAME
* GetSystemDirectory
*
* DESCRIPTION
* Get the ReactOS system directory from the registry.
* (since registry does not work yet, fill the buffer
* with a literal which will remain as the default).
*
* RETURN VALUE
* NULL on error; otherwise SystemDirectoryName.
*
* REVISIONS
* 19990717 (EA)
*/
LPWSTR
LdrGetSystemDirectory (
LPWSTR SystemDirectoryName,
DWORD Size
)
{
LPWSTR DosDev = L"\\??\\";
LPWSTR SDName = L"C:\\reactos\\system32";
if ( (NULL == SystemDirectoryName)
|| (
(
(wcslen(DosDev)
+ wcslen(SDName)
+ 1
)
* sizeof (WCHAR)
)
> Size
)
)
{
DbgPrint("LdrGetSystemDirectory() failed\n");
return NULL;
}
/*
* Prefix with the dos devices aliases
* directory, since the system directory
* is always given as a dos name by users
* (in the registry/by the boot loader?).
*/
wcscpy(
SystemDirectoryName,
L"\\??\\"
);
if (FALSE)
{
/*
* FIXME: get the system directory
* from the registry.
*/
}
else
{
/* Default value */
wcscat(
SystemDirectoryName,
SDName
);
}
return SystemDirectoryName;
}
/* EOF */

View file

@ -1,6 +0,0 @@
LPWSTR
LdrGetSystemDirectory (
LPWSTR SystemDirectoryName,
DWORD Size
);

View file

@ -1,4 +1,4 @@
# $Id: makefile_rex,v 1.72 2000/06/09 20:02:37 ekohl Exp $
# $Id: makefile_rex,v 1.73 2000/06/18 17:39:07 ekohl Exp $
#
# ReactOS Operating System
#
@ -126,7 +126,6 @@ OBJECTS_IO = \
io/create.o \
io/device.o \
io/dir.o \
io/dpc.o \
io/drvlck.o \
io/errlog.o \
io/error.o \
@ -227,7 +226,6 @@ OBJECTS_LDR = \
ldr/init.o \
ldr/loader.o \
ldr/rtl.o \
ldr/syspath.o \
ldr/sysdll.o \
ldr/userldr.o