From e31d342bc79055977b7a4d5aa442e64ed4b6493f Mon Sep 17 00:00:00 2001 From: David Welch Date: Sun, 29 Aug 1999 13:45:08 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/; revision=632 --- reactos/{makefile_rex => Makefile} | 3 + reactos/apps/tests/args/makefile | 2 + reactos/apps/tests/hello/makefile | 1 + reactos/apps/utils/shell/makefile | 2 + reactos/drivers/dd/beep/makefile | 2 + reactos/drivers/dd/blue/makefile | 3 + reactos/drivers/dd/ide/makefile | 3 + reactos/drivers/dd/keyboard/makefile | 4 + reactos/drivers/dd/null/makefile | 3 + reactos/drivers/dd/parallel/makefile | 3 + reactos/drivers/dd/serial/makefile | 3 + reactos/drivers/dd/vidport/makefile | 3 + reactos/drivers/fs/ext2/makefile | 4 + reactos/drivers/fs/minix/makefile_rex | 2 + reactos/drivers/fs/template/makefile | 4 + reactos/drivers/fs/vfat/makefile | 3 + reactos/iface/dll/makefile | 4 +- reactos/iface/native/makefile | 6 +- reactos/lib/advapi32/makefile | 5 +- reactos/lib/crtdll/ctype/MAKEFILE | 23 -- reactos/lib/crtdll/makefile | 4 +- reactos/lib/fmifs/makefile | 4 +- reactos/lib/gdi32/makefile | 4 +- reactos/lib/kernel32/makefile | 4 +- reactos/lib/makefile | 2 + reactos/lib/ntdll/makefile | 4 +- reactos/lib/user32/makefile_rex | 4 +- reactos/lib/version/makefile | 4 +- reactos/ntoskrnl/ldr/init.c | 525 ++++++++++++-------------- reactos/ntoskrnl/makefile_rex | 4 +- reactos/rules.mak | 6 +- reactos/services/lsass/makefile | 4 +- reactos/services/smss/makefile | 4 +- reactos/services/winlogon/makefile | 4 +- reactos/subsys/csrss/makefile | 4 +- reactos/subsys/psxss/makefile | 4 +- reactos/subsys/win32k/makefile | 2 + 37 files changed, 336 insertions(+), 334 deletions(-) rename reactos/{makefile_rex => Makefile} (99%) delete mode 100644 reactos/lib/crtdll/ctype/MAKEFILE diff --git a/reactos/makefile_rex b/reactos/Makefile similarity index 99% rename from reactos/makefile_rex rename to reactos/Makefile index f5ea49dde11..cece782da6c 100644 --- a/reactos/makefile_rex +++ b/reactos/Makefile @@ -200,6 +200,9 @@ $(SUBSYS:%=%_dist): %_dist: # Make an install floppy # +install: all + ./install.sh /mnt/hda1 + make_floppy_dirs: ifeq ($(DOSCLI),yes) mkdir $(FLOPPY_DIR)\dlls diff --git a/reactos/apps/tests/args/makefile b/reactos/apps/tests/args/makefile index e9e2296ee32..aec04882487 100644 --- a/reactos/apps/tests/args/makefile +++ b/reactos/apps/tests/args/makefile @@ -4,6 +4,8 @@ OBJECTS= args.o PROGS= args.exe +BASE_CFLAGS = -I../../include + all: $(PROGS) .phony: all diff --git a/reactos/apps/tests/hello/makefile b/reactos/apps/tests/hello/makefile index 8663eb75ab5..e4e6176dca1 100644 --- a/reactos/apps/tests/hello/makefile +++ b/reactos/apps/tests/hello/makefile @@ -5,6 +5,7 @@ OBJECTS = ../common/crt0.o hello.o PROGS = hello.exe LIBS = ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a CLEAN_FILES = hello.o hello.exe +BASE_CFLAGS = -I../../include all: hello.exe diff --git a/reactos/apps/utils/shell/makefile b/reactos/apps/utils/shell/makefile index 866f24eff6f..23e9e61abfe 100644 --- a/reactos/apps/utils/shell/makefile +++ b/reactos/apps/utils/shell/makefile @@ -6,6 +6,8 @@ PROGS= shell.exe LIBS= ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a CLEAN_FILES= shell.o shell.exe shell.sym +BASE_CFLAGS = -I../../include + all: shell.exe clean: $(CLEAN_FILES:%=%_clean) diff --git a/reactos/drivers/dd/beep/makefile b/reactos/drivers/dd/beep/makefile index 8069b83b73f..d077db64a16 100644 --- a/reactos/drivers/dd/beep/makefile +++ b/reactos/drivers/dd/beep/makefile @@ -3,6 +3,8 @@ # OBJECTS = beep.o ../../../ntoskrnl/ntoskrnl.a +BASE_CLAGS = -I../../../include + all: beep.sys .PHONY: all diff --git a/reactos/drivers/dd/blue/makefile b/reactos/drivers/dd/blue/makefile index 38613a10850..8cfa4b02851 100644 --- a/reactos/drivers/dd/blue/makefile +++ b/reactos/drivers/dd/blue/makefile @@ -3,6 +3,8 @@ # TARGET = blue +BASE_CFLAGS = -I../../../include + OBJECTS = blue.o ../../../ntoskrnl/ntoskrnl.a all: blue.sys @@ -49,3 +51,4 @@ blue.sys: $(OBJECTS) - $(RM) temp.exp +include ../../../rules.mak diff --git a/reactos/drivers/dd/ide/makefile b/reactos/drivers/dd/ide/makefile index 63d07a50a10..e10d8109084 100644 --- a/reactos/drivers/dd/ide/makefile +++ b/reactos/drivers/dd/ide/makefile @@ -4,6 +4,8 @@ TARGET=ide OBJECTS = ide.o ../../../ntoskrnl/ntoskrnl.a +BASE_CFLAGS = -I../../../include + all: ide.sys .phony: all @@ -47,3 +49,4 @@ ide.sys: $(OBJECTS) -specs=../../svc_specs -mdll -o ide.sys $(OBJECTS) -Wl,temp.exp - $(RM) temp.exp +include ../../../rules.mak diff --git a/reactos/drivers/dd/keyboard/makefile b/reactos/drivers/dd/keyboard/makefile index 1403001fb40..1f26b027329 100644 --- a/reactos/drivers/dd/keyboard/makefile +++ b/reactos/drivers/dd/keyboard/makefile @@ -4,6 +4,8 @@ TARGET=keyboard OBJECTS = keyboard.o ../../../ntoskrnl/ntoskrnl.a +BASE_CFLAGS = -I../../../include + all: keyboard.sys .phony: all @@ -46,3 +48,5 @@ keyboard.sys: $(OBJECTS) $(CC) --verbose -Wl,--image-base,0x10000 -Wl,-e,_DriverEntry@8 \ -specs=../../svc_specs -mdll -o keyboard.sys $(OBJECTS) -Wl,temp.exp - $(RM) temp.exp + +include ../../../rules.mak diff --git a/reactos/drivers/dd/null/makefile b/reactos/drivers/dd/null/makefile index f2f78b1cbd5..c0d8658385a 100644 --- a/reactos/drivers/dd/null/makefile +++ b/reactos/drivers/dd/null/makefile @@ -4,6 +4,8 @@ TARGET=null OBJECTS= null.o ../../../ntoskrnl/ntoskrnl.a +BASE_CFLAGS = -I../../../include + all: null.sys .phony: all @@ -48,3 +50,4 @@ null.sys: $(OBJECTS) - $(RM) temp.exp +include ../../../rules.mak diff --git a/reactos/drivers/dd/parallel/makefile b/reactos/drivers/dd/parallel/makefile index 218eae3891e..0bfbeb95ed8 100644 --- a/reactos/drivers/dd/parallel/makefile +++ b/reactos/drivers/dd/parallel/makefile @@ -4,6 +4,8 @@ TARGET=parallel OBJECTS= parallel.o ../../../ntoskrnl/ntoskrnl.a +BASE_CFLAGS = -I../../../include + all: parallel.sys .phony: all @@ -48,3 +50,4 @@ parallel.sys: $(OBJECTS) - $(RM) temp.exp +include ../../../rules.mak diff --git a/reactos/drivers/dd/serial/makefile b/reactos/drivers/dd/serial/makefile index 24276b650ad..6216e36c366 100644 --- a/reactos/drivers/dd/serial/makefile +++ b/reactos/drivers/dd/serial/makefile @@ -4,6 +4,8 @@ TARGET= serial OBJECTS= serial.o ../../../ntoskrnl/ntoskrnl.a +BASE_CFLAGS = -I../../../include + all: serial.sys .phony: all @@ -48,3 +50,4 @@ serial.sys: $(OBJECTS) - $(RM) temp.exp +include ../../../rules.mak diff --git a/reactos/drivers/dd/vidport/makefile b/reactos/drivers/dd/vidport/makefile index 14c9305dcab..91a1130698a 100644 --- a/reactos/drivers/dd/vidport/makefile +++ b/reactos/drivers/dd/vidport/makefile @@ -4,6 +4,8 @@ TARGET=vidport OBJECTS = vidport.o ../../../ntoskrnl/ntoskrnl.a +BASE_CFLAGS = -I../../../include + all: vidport.sys vidport.a .phony: all @@ -54,3 +56,4 @@ vidport.a: vidport.sys vidport.def --output-lib vidport.a +include ../../../rules.mak diff --git a/reactos/drivers/fs/ext2/makefile b/reactos/drivers/fs/ext2/makefile index 1d170445897..433751da21a 100644 --- a/reactos/drivers/fs/ext2/makefile +++ b/reactos/drivers/fs/ext2/makefile @@ -1,6 +1,9 @@ # # # + +BASE_CFLAGS = -I../../../include + OBJECTS = super.o blockdev.o inode.o file.o dir.o rw.o quota.o security.o \ attr.o ../../../ntoskrnl/ntoskrnl.a @@ -34,3 +37,4 @@ ext2fs.sys: $(OBJECTS) -specs=$(KM_SPECS) -mdll -o ext2fs.sys $(OBJECTS) -Wl,temp.exp $(RM) temp.exp +include ../../../rules.mak diff --git a/reactos/drivers/fs/minix/makefile_rex b/reactos/drivers/fs/minix/makefile_rex index 6c2b7c45ab5..262f54a01f4 100644 --- a/reactos/drivers/fs/minix/makefile_rex +++ b/reactos/drivers/fs/minix/makefile_rex @@ -1,3 +1,5 @@ +BASE_CFLAGS = -I../../../include + all: minix.sys OBJECTS = block.o rw.o inode.o dir.o mount.o blockdev.o \ diff --git a/reactos/drivers/fs/template/makefile b/reactos/drivers/fs/template/makefile index ecd899393b5..90094295e66 100644 --- a/reactos/drivers/fs/template/makefile +++ b/reactos/drivers/fs/template/makefile @@ -3,6 +3,8 @@ # OBJECTS = template.o +BASE_CFLAGS = -I../../../include + all: tfsd.o .phony: all @@ -15,3 +17,5 @@ clean: tfsd.o: template.o $(LD) -r template.o -o tfsd.o + +include ../../rules.mak diff --git a/reactos/drivers/fs/vfat/makefile b/reactos/drivers/fs/vfat/makefile index 1c288fbd5dd..90da3429865 100644 --- a/reactos/drivers/fs/vfat/makefile +++ b/reactos/drivers/fs/vfat/makefile @@ -4,6 +4,8 @@ TARGET=vfatfsd OBJECTS = blockdev.o dir.o dirwr.o iface.o ../../../ntoskrnl/ntoskrnl.a +BASE_CFLAGS = -I../../../include + all: vfatfsd.sys .phony: all @@ -55,3 +57,4 @@ vfatfsd.sys: $(OBJECTS) - $(RM) temp.exp +include ../../../rules.mak diff --git a/reactos/iface/dll/makefile b/reactos/iface/dll/makefile index 3f3db8e990f..fe3aaf18733 100644 --- a/reactos/iface/dll/makefile +++ b/reactos/iface/dll/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.1 1999/07/04 11:14:15 ea Exp $ +# $Id: makefile,v 1.2 1999/08/29 13:44:52 dwelch Exp $ # # ReactOS Operating System # @@ -7,6 +7,8 @@ # TARGET = defedf +BASE_CFLAGS = -I../../include + all: $(TARGET)$(EXE_POSTFIX) $(TARGET)$(EXE_POSTFIX): $(TARGET).c diff --git a/reactos/iface/native/makefile b/reactos/iface/native/makefile index 78e356b2736..500af64eec5 100644 --- a/reactos/iface/native/makefile +++ b/reactos/iface/native/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.8 1999/06/17 00:10:30 ea Exp $ +# $Id: makefile,v 1.9 1999/08/29 13:44:52 dwelch Exp $ # # ReactOS Operating System # @@ -15,10 +15,12 @@ KERNEL_SERVICE_TABLE = ../../include/ntdll/napi.h KERNEL_ZW_CALLS = ../../ntoskrnl/nt/zw.c NAPI_FILES = $(NTDLL_STUBS) $(KERNEL_SERVICE_TABLE) $(KERNEL_ZW_CALLS) +BASE_CFLAGS = -I../../include + all: $(TARGET)$(EXE_POSTFIX) $(NAPI_FILES) $(NAPI_FILES): $(SYSTEM_CALLS_DB) $(TARGET)$(EXE_POSTFIX) - $(TARGET)$(EXE_POSTFIX) \ + ./$(TARGET)$(EXE_POSTFIX) \ $(SYSTEM_CALLS_DB) \ $(NTDLL_STUBS) \ $(KERNEL_SERVICE_TABLE) \ diff --git a/reactos/lib/advapi32/makefile b/reactos/lib/advapi32/makefile index 04a4a34792a..68df2f41c87 100644 --- a/reactos/lib/advapi32/makefile +++ b/reactos/lib/advapi32/makefile @@ -1,7 +1,10 @@ -# $Id: makefile,v 1.6 1999/07/26 20:46:39 ea Exp $ +# $Id: makefile,v 1.7 1999/08/29 13:44:52 dwelch Exp $ # # Makefile for ReactOS advapi32.dll # + +BASE_CFLAGS = -I../../include + TARGET=advapi32 ifneq ($(HOST),mingw32-windows) ifneq ($(HOST),mingw32-linux) diff --git a/reactos/lib/crtdll/ctype/MAKEFILE b/reactos/lib/crtdll/ctype/MAKEFILE deleted file mode 100644 index 2fa6f26e0bb..00000000000 --- a/reactos/lib/crtdll/ctype/MAKEFILE +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details -TOP=../.. - -SRC += ct_flags.c -SRC += ct_lower.c -SRC += ct_upper.c -SRC += isalnum.c -SRC += isalpha.c -SRC += isascii.c -SRC += iscntrl.c -SRC += isdigit.c -SRC += isgraph.c -SRC += islower.c -SRC += isprint.c -SRC += ispunct.c -SRC += isspace.c -SRC += isupper.c -SRC += isxdigit.c -SRC += toascii.c -SRC += tolower.c -SRC += toupper.c - -include $(TOP)/../makefile.inc diff --git a/reactos/lib/crtdll/makefile b/reactos/lib/crtdll/makefile index c575d5e96e3..bd7a0fd5cbf 100644 --- a/reactos/lib/crtdll/makefile +++ b/reactos/lib/crtdll/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.32 1999/07/16 23:37:04 rex Exp $ +# $Id: makefile,v 1.33 1999/08/29 13:44:53 dwelch Exp $ # # ReactOS Operating System # @@ -13,6 +13,8 @@ else DLLTARGET=$(TARGET).dll endif +BASE_CFLAGS = -I../../include + all: $(DLLTARGET) diff --git a/reactos/lib/fmifs/makefile b/reactos/lib/fmifs/makefile index f5ca25f866d..3f9408e72b6 100644 --- a/reactos/lib/fmifs/makefile +++ b/reactos/lib/fmifs/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.6 1999/07/17 23:10:19 ea Exp $ +# $Id: makefile,v 1.7 1999/08/29 13:44:53 dwelch Exp $ # # Makefile for fmifs.dll # @@ -13,6 +13,8 @@ else DLLTARGET=$(TARGET).dll endif +BASE_CFLAGS = -I../../include + all: $(DLLTARGET) IFS_OBJECTS = chkdsk.o compress.o diskcopy.o extend.o \ diff --git a/reactos/lib/gdi32/makefile b/reactos/lib/gdi32/makefile index adc97e5d832..3771921184e 100644 --- a/reactos/lib/gdi32/makefile +++ b/reactos/lib/gdi32/makefile @@ -1,9 +1,11 @@ -# $Id: makefile,v 1.7 1999/07/17 23:10:19 ea Exp $ +# $Id: makefile,v 1.8 1999/08/29 13:44:54 dwelch Exp $ # # Makefile for ReactOS gdi32.dll # TARGET=gdi32 +BASE_CFLAGS = -I../../include + ifneq ($(HOST),mingw32-windows) ifneq ($(HOST),mingw32-linux) DLLTARGET=$(TARGET).a diff --git a/reactos/lib/kernel32/makefile b/reactos/lib/kernel32/makefile index 9ad6e5a31fc..772356fdf3d 100644 --- a/reactos/lib/kernel32/makefile +++ b/reactos/lib/kernel32/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.23 1999/07/17 23:10:20 ea Exp $ +# $Id: makefile,v 1.24 1999/08/29 13:44:56 dwelch Exp $ # # ReactOS Operating System # @@ -6,6 +6,8 @@ TARGET=kernel32 KERNEL32_BASE = 0x77f00000 +BASE_CFLAGS = -I../../include + CFLAGS = $(CFLAGS) -DKERNEL32_BASE=$(KERNEL32_BASE) ifneq ($(HOST),mingw32-windows) diff --git a/reactos/lib/makefile b/reactos/lib/makefile index 25d86e8cedc..6a32b6cf510 100644 --- a/reactos/lib/makefile +++ b/reactos/lib/makefile @@ -1,5 +1,7 @@ LIBRARIES = ntdll kernel32 +BASE_CFLAGS = -I../include + all: $(LIBRARIES) ntdll: dummy diff --git a/reactos/lib/ntdll/makefile b/reactos/lib/ntdll/makefile index 05f4e4435af..d70c9d1fcae 100644 --- a/reactos/lib/ntdll/makefile +++ b/reactos/lib/ntdll/makefile @@ -1,9 +1,11 @@ -# $Id: makefile,v 1.21 1999/07/29 21:14:02 ekohl Exp $ +# $Id: makefile,v 1.22 1999/08/29 13:44:57 dwelch Exp $ # # ReactOS Operating System # TARGET=ntdll +BASE_CFLAGS = -I../../include + IMAGE_BASE = 0x77f60000 ifneq ($(HOST),mingw32-windows) diff --git a/reactos/lib/user32/makefile_rex b/reactos/lib/user32/makefile_rex index 38ad5e22fe1..8ffebdc5fc8 100644 --- a/reactos/lib/user32/makefile_rex +++ b/reactos/lib/user32/makefile_rex @@ -1,9 +1,11 @@ -# $Id: makefile_rex,v 1.6 1999/07/17 23:10:25 ea Exp $ +# $Id: makefile_rex,v 1.7 1999/08/29 13:44:58 dwelch Exp $ # # ReactOS Operating System # # Makefile for user32.dll # +BASE_CFLAGS = -I../../include + include ../../rules.mak TARGET=user32 diff --git a/reactos/lib/version/makefile b/reactos/lib/version/makefile index 775e4041a61..742931cbb6a 100644 --- a/reactos/lib/version/makefile +++ b/reactos/lib/version/makefile @@ -1,9 +1,11 @@ -# $Id: makefile,v 1.1 1999/08/11 19:56:48 ea Exp $ +# $Id: makefile,v 1.2 1999/08/29 13:44:58 dwelch Exp $ # # Makefile for ReactOS version.dll # TARGET=version +BASE_CFLAGS = -I../../include + ifneq ($(HOST),mingw32-windows) ifneq ($(HOST),mingw32-linux) DLLTARGET=$(TARGET).a diff --git a/reactos/ntoskrnl/ldr/init.c b/reactos/ntoskrnl/ldr/init.c index b28dad4938c..6cd7e725afe 100644 --- a/reactos/ntoskrnl/ldr/init.c +++ b/reactos/ntoskrnl/ldr/init.c @@ -31,7 +31,7 @@ #include #include -#define NDEBUG +//#define NDEBUG #include #include "syspath.h" @@ -57,265 +57,221 @@ #define STACK_TOP (0xb0000000) -static -NTSTATUS -LdrCreatePeb(HANDLE ProcessHandle) +static NTSTATUS LdrCreatePeb(HANDLE ProcessHandle) { - NTSTATUS Status; - PVOID PebBase; - ULONG PebSize; - NT_PEB Peb; - ULONG BytesWritten; - - - PebBase = (PVOID)PEB_BASE; - PebSize = 0x1000; - Status = ZwAllocateVirtualMemory( - ProcessHandle, - & PebBase, - 0, - & PebSize, - MEM_COMMIT, - PAGE_READWRITE - ); - if (!NT_SUCCESS(Status)) - { - return(Status); - } + NTSTATUS Status; + PVOID PebBase; + ULONG PebSize; + NT_PEB Peb; + ULONG BytesWritten; - memset( - & Peb, - 0, - sizeof Peb - ); - Peb.StartupInfo = (PPROCESSINFOW) PEB_STARTUPINFO; + PebBase = (PVOID)PEB_BASE; + PebSize = 0x1000; + Status = ZwAllocateVirtualMemory(ProcessHandle, + &PebBase, + 0, + &PebSize, + MEM_COMMIT, + PAGE_READWRITE); + if (!NT_SUCCESS(Status)) + { + return(Status); + } + + + memset(&Peb, 0, sizeof Peb); + + Peb.StartupInfo = (PPROCESSINFOW) PEB_STARTUPINFO; - ZwWriteVirtualMemory( - ProcessHandle, - (PVOID) PEB_BASE, - & Peb, - sizeof Peb, - & BytesWritten - ); + ZwWriteVirtualMemory(ProcessHandle, + (PVOID)PEB_BASE, + &Peb, + sizeof(Peb), + &BytesWritten); - return(STATUS_SUCCESS); + return(STATUS_SUCCESS); } -NTSTATUS -LdrLoadImage ( - HANDLE ProcessHandle, - PUNICODE_STRING Filename - ) +NTSTATUS LdrLoadImage(HANDLE ProcessHandle, + PUNICODE_STRING Filename) { - CHAR BlockBuffer [1024]; - DWORD ImageBase; - DWORD LdrStartupAddr; - DWORD StackBase; - ULONG ImageSize; - ULONG StackSize; - NTSTATUS Status; - OBJECT_ATTRIBUTES FileObjectAttributes; - HANDLE FileHandle; - HANDLE SectionHandle; - HANDLE NTDllSectionHandle; - HANDLE ThreadHandle; - HANDLE DupNTDllSectionHandle; - CONTEXT Context; - UNICODE_STRING DllPathname; - PIMAGE_DOS_HEADER DosHeader; - PIMAGE_NT_HEADERS NTHeaders; - ULONG BytesWritten; - ULONG InitialViewSize; - ULONG i; - HANDLE DupSectionHandle; - - WCHAR TmpNameBuffer [MAX_PATH]; - - + CHAR BlockBuffer [1024]; + DWORD ImageBase; + DWORD LdrStartupAddr; + DWORD StackBase; + ULONG ImageSize; + ULONG StackSize; + NTSTATUS Status; + OBJECT_ATTRIBUTES FileObjectAttributes; + HANDLE FileHandle; + HANDLE SectionHandle; + HANDLE NTDllSectionHandle; + HANDLE ThreadHandle; + HANDLE DupNTDllSectionHandle; + CONTEXT Context; + UNICODE_STRING DllPathname; + PIMAGE_DOS_HEADER DosHeader; + PIMAGE_NT_HEADERS NTHeaders; + ULONG BytesWritten; + ULONG InitialViewSize; + ULONG i; + HANDLE DupSectionHandle; + + WCHAR TmpNameBuffer [MAX_PATH]; + + /* -- PART I -- */ - /* - * Locate and open NTDLL to determine ImageBase - * and LdrStartup - */ - GetSystemDirectory( - TmpNameBuffer, - sizeof TmpNameBuffer - ); - wcscat( - TmpNameBuffer, - L"\\ntdll.dll" - ); - RtlInitUnicodeString( - & DllPathname, - TmpNameBuffer - ); - InitializeObjectAttributes( - & FileObjectAttributes, - & DllPathname, - 0, - NULL, - NULL - ); - DPRINT("Opening NTDLL\n"); - Status = ZwOpenFile( - & FileHandle, - FILE_ALL_ACCESS, - & FileObjectAttributes, - NULL, - 0, - 0 - ); - if (!NT_SUCCESS(Status)) - { - DPRINT("NTDLL open failed "); - DbgPrintErrorMessage(Status); - - return Status; - } - Status = ZwReadFile( - FileHandle, - 0, - 0, - 0, - 0, - BlockBuffer, - sizeof BlockBuffer, - 0, - 0 - ); - if (!NT_SUCCESS(Status)) - { - DPRINT("NTDLL header read failed "); - DbgPrintErrorMessage(Status); - ZwClose(FileHandle); - - return Status; - } - /* - * FIXME: this will fail if the NT headers are - * more than 1024 bytes from start. - */ - DosHeader = (PIMAGE_DOS_HEADER) BlockBuffer; - NTHeaders = (PIMAGE_NT_HEADERS) (BlockBuffer + DosHeader->e_lfanew); - if ( - (DosHeader->e_magic != IMAGE_DOS_MAGIC) - || (DosHeader->e_lfanew == 0L) - || (*(PULONG) NTHeaders != IMAGE_PE_MAGIC) - ) - { - DPRINT("NTDLL format invalid\n"); - ZwClose(FileHandle); - - return STATUS_UNSUCCESSFUL; - } - ImageBase = NTHeaders->OptionalHeader.ImageBase; - ImageSize = NTHeaders->OptionalHeader.SizeOfImage; - /* - * FIXME: retrieve the offset of LdrStartup from NTDLL - */ - DPRINT("ImageBase %x\n",ImageBase); - LdrStartupAddr = - ImageBase - + NTHeaders->OptionalHeader.AddressOfEntryPoint; - /* - * Create a section for NTDLL - */ - Status = ZwCreateSection( - & NTDllSectionHandle, - SECTION_ALL_ACCESS, - NULL, - NULL, - PAGE_READWRITE, - MEM_COMMIT, - FileHandle - ); - if (!NT_SUCCESS(Status)) - { - DPRINT("NTDLL create section failed "); - DbgPrintErrorMessage(Status); - ZwClose(FileHandle); - - return Status; - } - /* - * Map the NTDLL into the process - */ - InitialViewSize = - DosHeader->e_lfanew - + sizeof (IMAGE_NT_HEADERS) - + ( sizeof (IMAGE_SECTION_HEADER) - * NTHeaders->FileHeader.NumberOfSections - ); - Status = ZwMapViewOfSection( - NTDllSectionHandle, - ProcessHandle, - (PVOID *) & ImageBase, - 0, - InitialViewSize, - NULL, - & InitialViewSize, - 0, - MEM_COMMIT, - PAGE_READWRITE - ); - if (!NT_SUCCESS(Status)) - { - DPRINT("NTDLL map view of secion failed "); - DbgPrintErrorMessage(Status); - - /* FIXME: destroy the section here */ - - ZwClose(FileHandle); - - return Status; - } - for ( i = 0; - (i < NTHeaders->FileHeader.NumberOfSections); - i++ - ) - { - PIMAGE_SECTION_HEADER Sections; - LARGE_INTEGER Offset; - ULONG Base; - - Sections = - (PIMAGE_SECTION_HEADER) SECHDROFFSET(BlockBuffer); - Base = - Sections[i].VirtualAddress - + ImageBase; - Offset.u.LowPart = - Sections[i].PointerToRawData; - Offset.u.HighPart = - 0; - Status = ZwMapViewOfSection( - NTDllSectionHandle, - ProcessHandle, - (PVOID *) & Base, - 0, - Sections[i].Misc.VirtualSize, - & Offset, - (PULONG) & Sections[i].Misc.VirtualSize, - 0, - MEM_COMMIT, - PAGE_READWRITE - ); - if (!NT_SUCCESS(Status)) - { - DPRINT("NTDLL map view of secion failed "); - DbgPrintErrorMessage(Status); - - /* FIXME: destroy the section here */ - - ZwClose(FileHandle); - return Status; - } - } + /* + * Locate and open NTDLL to determine ImageBase + * and LdrStartup + */ + GetSystemDirectory(TmpNameBuffer, sizeof TmpNameBuffer); + wcscat(TmpNameBuffer, L"\\ntdll.dll"); + RtlInitUnicodeString(&DllPathname, TmpNameBuffer); + InitializeObjectAttributes(&FileObjectAttributes, + &DllPathname, + 0, + NULL, + NULL); + DPRINT("Opening NTDLL\n"); + Status = ZwOpenFile(&FileHandle, + FILE_ALL_ACCESS, + &FileObjectAttributes, + NULL, + 0, + 0); + if (!NT_SUCCESS(Status)) + { + DbgPrint("NTDLL open failed "); + DbgPrintErrorMessage(Status); + return Status; + } + Status = ZwReadFile(FileHandle, + 0, + 0, + 0, + 0, + BlockBuffer, + sizeof BlockBuffer, + 0, + 0); + if (!NT_SUCCESS(Status)) + { + DPRINT("NTDLL header read failed "); + DbgPrintErrorMessage(Status); + ZwClose(FileHandle); + return Status; + } + + /* + * FIXME: this will fail if the NT headers are + * more than 1024 bytes from start. + */ + DosHeader = (PIMAGE_DOS_HEADER) BlockBuffer; + NTHeaders = (PIMAGE_NT_HEADERS) (BlockBuffer + DosHeader->e_lfanew); + if ((DosHeader->e_magic != IMAGE_DOS_MAGIC) + || (DosHeader->e_lfanew == 0L) + || (*(PULONG) NTHeaders != IMAGE_PE_MAGIC)) + { + DPRINT("NTDLL format invalid\n"); + ZwClose(FileHandle); + return STATUS_UNSUCCESSFUL; + } + ImageBase = NTHeaders->OptionalHeader.ImageBase; + ImageSize = NTHeaders->OptionalHeader.SizeOfImage; + /* + * FIXME: retrieve the offset of LdrStartup from NTDLL + */ + DPRINT("ImageBase %x\n",ImageBase); + LdrStartupAddr = ImageBase + NTHeaders->OptionalHeader.AddressOfEntryPoint; + /* + * Create a section for NTDLL + */ + Status = ZwCreateSection(&NTDllSectionHandle, + SECTION_ALL_ACCESS, + NULL, + NULL, + PAGE_READWRITE, + MEM_COMMIT, + FileHandle); + if (!NT_SUCCESS(Status)) + { + DPRINT("NTDLL create section failed "); + DbgPrintErrorMessage(Status); ZwClose(FileHandle); -/* -- PART II -- */ + return Status; + } + + /* + * Map the NTDLL into the process + */ + InitialViewSize = DosHeader->e_lfanew + + sizeof (IMAGE_NT_HEADERS) + + ( sizeof (IMAGE_SECTION_HEADER) + * NTHeaders->FileHeader.NumberOfSections + ); + Status = ZwMapViewOfSection(NTDllSectionHandle, + ProcessHandle, + (PVOID *) & ImageBase, + 0, + InitialViewSize, + NULL, + &InitialViewSize, + 0, + MEM_COMMIT, + PAGE_READWRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT("NTDLL map view of secion failed "); + DbgPrintErrorMessage(Status); + + /* FIXME: destroy the section here */ + + ZwClose(FileHandle); + + return Status; + } + + for (i = 0; + (i < NTHeaders->FileHeader.NumberOfSections); + i++) + { + PIMAGE_SECTION_HEADER Sections; + LARGE_INTEGER Offset; + ULONG Base; + + Sections = (PIMAGE_SECTION_HEADER) SECHDROFFSET(BlockBuffer); + Base = Sections[i].VirtualAddress + ImageBase; + Offset.u.LowPart = Sections[i].PointerToRawData; + Offset.u.HighPart = 0; + Status = ZwMapViewOfSection(NTDllSectionHandle, + ProcessHandle, + (PVOID *) & Base, + 0, + Sections[i].Misc.VirtualSize, + &Offset, + (PULONG) & Sections[i].Misc.VirtualSize, + 0, + MEM_COMMIT, + PAGE_READWRITE); + if (!NT_SUCCESS(Status)) + { + DPRINT("NTDLL map view of secion failed "); + DbgPrintErrorMessage(Status); + + /* FIXME: destroy the section here */ + + ZwClose(FileHandle); + return Status; + } + } + ZwClose(FileHandle); + + /* -- PART II -- */ /* * Open process image to determine ImageBase @@ -570,52 +526,41 @@ LdrLoadImage ( * FIXME: The location of the initial process should be configurable, * from command line or registry */ -NTSTATUS -LdrLoadInitialProcess (VOID) +NTSTATUS LdrLoadInitialProcess (VOID) { - NTSTATUS Status; - HANDLE ProcessHandle; - UNICODE_STRING ProcessName; - WCHAR TmpNameBuffer [MAX_PATH]; - - - Status = ZwCreateProcess( - & ProcessHandle, - PROCESS_ALL_ACCESS, - NULL, - SystemProcessHandle, - FALSE, - NULL, - NULL, - NULL - ); - if (!NT_SUCCESS(Status)) - { - DbgPrint("Could not create process\n"); - return Status; - } - /* - * Get the system directory's name (a DOS device - * alias name which is in \\??\\). - */ - GetSystemDirectory( - TmpNameBuffer, - sizeof TmpNameBuffer - ); - wcscat( - TmpNameBuffer, - L"\\shell.exe" /* FIXME: should be smss.exe */ - ); - RtlInitUnicodeString( - & ProcessName, - TmpNameBuffer - ); - Status = LdrLoadImage( - ProcessHandle, - & ProcessName - ); + NTSTATUS Status; + HANDLE ProcessHandle; + UNICODE_STRING ProcessName; + WCHAR TmpNameBuffer [MAX_PATH]; + + Status = ZwCreateProcess(&ProcessHandle, + PROCESS_ALL_ACCESS, + NULL, + SystemProcessHandle, + FALSE, + NULL, + NULL, + NULL); + if (!NT_SUCCESS(Status)) + { + DbgPrint("Could not create process\n"); return Status; + } + + /* + * Get the system directory's name (a DOS device + * alias name which is in \\??\\). + */ + GetSystemDirectory(TmpNameBuffer, sizeof TmpNameBuffer); + wcscat(TmpNameBuffer, L"\\shell.exe"); + RtlInitUnicodeString(&ProcessName, TmpNameBuffer); + Status = LdrLoadImage(ProcessHandle, &ProcessName); + if (!NT_SUCCESS(Status)) + { + DbgPrint("Failed to load %W\n",&ProcessName); + } + return Status; } /* EOF */ diff --git a/reactos/ntoskrnl/makefile_rex b/reactos/ntoskrnl/makefile_rex index 0f222698489..a9a5173542f 100644 --- a/reactos/ntoskrnl/makefile_rex +++ b/reactos/ntoskrnl/makefile_rex @@ -1,9 +1,11 @@ -# $Id: makefile_rex,v 1.30 1999/08/11 23:23:48 ekohl Exp $ +# $Id: makefile_rex,v 1.31 1999/08/29 13:44:58 dwelch Exp $ # # ReactOS Operating System # TARGET=ntoskrnl +BASE_CFLAGS = -I../include + all: objects $(TARGET).exe # diff --git a/reactos/rules.mak b/reactos/rules.mak index c5b9ecacef2..80714f01f1e 100644 --- a/reactos/rules.mak +++ b/reactos/rules.mak @@ -61,12 +61,10 @@ endif CC = $(PREFIX)gcc NATIVE_CC = gcc -CFLAGS = \ +CFLAGS = $(BASE_CFLAGS) \ -pipe \ -O2 \ - -I../../../include \ - -I../../include \ - -I../include \ + -Iinclude \ -fno-builtin $(LEAN_AND_MEAN_DEFINE) \ $(DEFINES) -Wall \ -Wstrict-prototypes $(DEBUGGING_CFLAGS) \ diff --git a/reactos/services/lsass/makefile b/reactos/services/lsass/makefile index 38de765eaab..1b9f9354ce4 100644 --- a/reactos/services/lsass/makefile +++ b/reactos/services/lsass/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.1 1999/07/17 23:10:29 ea Exp $ +# $Id: makefile,v 1.2 1999/08/29 13:45:05 dwelch Exp $ # # Local Security Authority Subsystem # @@ -6,6 +6,8 @@ # TARGET=lsass +BASE_CFLAGS = -I../../include + OBJECTS = $(TARGET).o init.o $(TARGET).coff LIBS = ../../lib/ntdll/ntdll.a diff --git a/reactos/services/smss/makefile b/reactos/services/smss/makefile index ef848592773..07289d3673a 100644 --- a/reactos/services/smss/makefile +++ b/reactos/services/smss/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.1 1999/05/30 20:40:18 ea Exp $ +# $Id: makefile,v 1.2 1999/08/29 13:45:06 dwelch Exp $ # # Session Manager # @@ -6,6 +6,8 @@ # TARGET=smss +BASE_CFLAGS = -I../../include + OBJECTS = $(TARGET).o init.o $(TARGET).coff LIBS = ../../lib/ntdll/ntdll.a diff --git a/reactos/services/winlogon/makefile b/reactos/services/winlogon/makefile index e82d3259e8d..5591f032341 100644 --- a/reactos/services/winlogon/makefile +++ b/reactos/services/winlogon/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.1 1999/06/18 22:40:47 ea Exp $ +# $Id: makefile,v 1.2 1999/08/29 13:45:06 dwelch Exp $ # # Logon/login Application # @@ -6,6 +6,8 @@ # TARGET=winlogon +BASE_CFLAGS = -I../../include + OBJECTS = $(TARGET).o init.o $(TARGET).coff LIBS = ../../lib/ntdll/ntdll.a diff --git a/reactos/subsys/csrss/makefile b/reactos/subsys/csrss/makefile index b2295590caa..add1bfebca8 100644 --- a/reactos/subsys/csrss/makefile +++ b/reactos/subsys/csrss/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.1 1999/06/08 22:50:59 ea Exp $ +# $Id: makefile,v 1.2 1999/08/29 13:45:07 dwelch Exp $ # # CSRSS: Client/server runtime subsystem # @@ -6,6 +6,8 @@ # TARGET=csrss +BASE_CFLAGS = -I../../include + OBJECTS_API = api/process.o OBJECTS_SBAPI = diff --git a/reactos/subsys/psxss/makefile b/reactos/subsys/psxss/makefile index 379b9f5379c..2f731b33dcf 100644 --- a/reactos/subsys/psxss/makefile +++ b/reactos/subsys/psxss/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.1 1999/07/17 23:10:31 ea Exp $ +# $Id: makefile,v 1.2 1999/08/29 13:45:07 dwelch Exp $ # # CSRSS: Client/server run-time subsystem # @@ -6,6 +6,8 @@ # TARGET=csrss +BASE_CFLAGS = -I../../include + OBJECTS = $(TARGET).o init.o $(TARGET).coff LIBS = ../../lib/ntdll/ntdll.a diff --git a/reactos/subsys/win32k/makefile b/reactos/subsys/win32k/makefile index ffd671808af..7d6d7ea793c 100644 --- a/reactos/subsys/win32k/makefile +++ b/reactos/subsys/win32k/makefile @@ -2,6 +2,8 @@ # WIN32K.SYS build spec # +BASE_CFLAGS = -I../../include + MAIN_OBJECTS = main/dllmain.o MISC_OBJECTS = misc/driver.o OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o \