From 024738024e5063a68bd1e0f1e6dc6f99d22ea18d Mon Sep 17 00:00:00 2001 From: David Welch Date: Mon, 26 Aug 2002 13:06:03 +0000 Subject: [PATCH] 2002-08-26 David Welch * lib/gdi32/misc/dllmain.c (GdiDllInitialize): Don't initialize win32k.sys for each process. * subsys/csrss/init.c (CsrServerInitialization): Initialize win32k.sys as well. 2002-08-26 David Welch * ntoskrnl/ps/process.c (NtCreateProcess): Reference the parent process's handle using ExGetPreviousMode. 2002-08-26 David Welch * lib/user32/misc/dllmain.c (Init): Initialize gdi32 as well. 2002-08-26 David Welch * iface/addsys/genw32k.c (main, process): Generate a set of stubs for csrss as well. svn path=/trunk/; revision=3396 --- reactos/ChangeLog | 26 +++++++++++++++++++++ reactos/iface/addsys/genw32k.c | 39 +++++++++++++++++++++++++++---- reactos/iface/addsys/makefile | 13 ++++------- reactos/lib/gdi32/main/dllmain.c | 8 +++---- reactos/lib/user32/misc/dllmain.c | 13 ++++------- reactos/ntoskrnl/ps/process.c | 4 ++-- reactos/subsys/csrss/.cvsignore | 1 + reactos/subsys/csrss/init.c | 4 +++- reactos/subsys/csrss/makefile | 5 ++-- 9 files changed, 81 insertions(+), 32 deletions(-) diff --git a/reactos/ChangeLog b/reactos/ChangeLog index 018a458fdb0..baef9f38422 100644 --- a/reactos/ChangeLog +++ b/reactos/ChangeLog @@ -1,3 +1,29 @@ +2002-08-26 David Welch + + * lib/gdi32/misc/dllmain.c (GdiDllInitialize): Don't initialize + win32k.sys for each process. + * subsys/csrss/init.c (CsrServerInitialization): Initialize + win32k.sys as well. + +2002-08-26 David Welch + + * ntoskrnl/ps/process.c (NtCreateProcess): Reference the + parent process's handle using ExGetPreviousMode. + +2002-08-26 David Welch + + * lib/user32/misc/dllmain.c (Init): Initialize gdi32 as well. + +2002-08-26 David Welch + + * iface/addsys/genw32k.c (main, process): Generate a set of + stubs for csrss as well. + +2002-08-26 David Welch + + * lib/kernel32/process/create.c (CreateProcessW): Initialize + all the members of the new process's PPB. + 2002-08-17 David Welch * ntoskrnl/mm/rmap.c (MmWritePagePhysicalAddress): Ensure the diff --git a/reactos/iface/addsys/genw32k.c b/reactos/iface/addsys/genw32k.c index a82ca0b18ba..adbb8a0ab1f 100644 --- a/reactos/iface/addsys/genw32k.c +++ b/reactos/iface/addsys/genw32k.c @@ -1,4 +1,4 @@ -/* $Id: genw32k.c,v 1.2 2002/07/04 19:56:33 dwelch Exp $ +/* $Id: genw32k.c,v 1.3 2002/08/26 13:06:02 dwelch Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS version of ntdll @@ -172,7 +172,8 @@ int process( FILE * in, FILE * out1, - FILE * out2 + FILE * out2, + FILE * out3 ) { char line [INPUT_BUFFER_SIZE]; @@ -194,6 +195,13 @@ process( */ fprintf(out2,"// Machine generated, don't edit\n"); fprintf(out2,"\n\n"); + + /* + * CSRSS stubs file header + */ + fprintf(out3,"// Machine generated, don't edit\n"); + fprintf(out3,"\n\n"); + /* * Scan the database. DB is a text file; each line * is a record, which contains data for one system @@ -274,6 +282,21 @@ process( fprintf(out2,"\t\"int\t$0x2E\\n\\t\"\n"); fprintf(out2,"\t\"ret\t$%d\\n\\t\");\n\n",stacksize); + /* + * Write the CSRSS stub for the current system call + */ +#ifdef PARAMETERIZED_LIBS + fprintf(out3,"__asm__(\"\\n\\t.global _%s@%d\\n\\t\"\n",name,stacksize); + fprintf(out3,"\"_%s@%d:\\n\\t\"\n",name,stacksize); +#else + fprintf(out3,"__asm__(\"\\n\\t.global _%s\\n\\t\"\n",name); + fprintf(out3,"\"_%s:\\n\\t\"\n",name); +#endif + fprintf(out3,"\t\"mov\t$%d,%%eax\\n\\t\"\n",sys_call_idx | INDEX); + fprintf(out3,"\t\"lea\t4(%%esp),%%edx\\n\\t\"\n"); + fprintf(out3,"\t\"int\t$0x2E\\n\\t\"\n"); + fprintf(out3,"\t\"ret\t$%d\\n\\t\");\n\n",stacksize); + /* Next system call index */ sys_call_idx++; } @@ -299,9 +322,10 @@ int main(int argc, char* argv[]) FILE * out1; /* SERVICE_TABLE */ FILE * out2; /* GDI32 stubs */ FILE * out3; /* USER32 stubs */ + FILE * out4; /* CSRSS stubs */ int ret; - if (argc != 5) + if (argc != 6) { usage(argv[0]); return(1); @@ -335,7 +359,14 @@ int main(int argc, char* argv[]) return(1); } - ret = process(in,out2,out3); + out4 = fopen(argv[5],"wb"); + if (out4 == NULL) + { + perror("Failed to open output file (CSRSS stubs)"); + return(1); + } + + ret = process(in,out2,out3,out4); rewind(in); ret = makeSystemServiceTable(in, out1); diff --git a/reactos/iface/addsys/makefile b/reactos/iface/addsys/makefile index 5600a045599..9c28f85e1f6 100644 --- a/reactos/iface/addsys/makefile +++ b/reactos/iface/addsys/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.10 2001/07/15 21:18:54 rex Exp $ +# $Id: makefile,v 1.11 2002/08/26 13:06:02 dwelch Exp $ # # ReactOS Operating System # @@ -17,6 +17,7 @@ SVC_MASK=0x1000 SVC_SERVICE_TABLE=../../subsys/win32k/main/svctab.c SVC_GDI_STUBS=../../lib/gdi32/misc/win32k.c SVC_USER_STUBS=../../lib/user32/misc/win32k.c +SVC_CSRSS_STUBS=../../subsys/csrss/win32k.c SVC_FILES = $(SVC_GDI_STUBS) $(SVC_USER_STUBS) $(SVC_SERVICE_TABLE) @@ -33,19 +34,13 @@ $(TARGETNAME)$(EXE_POSTFIX): $(TARGETNAME).c -O2 \ $(TARGETNAME).c -#$(SVC_FILES): $(SVC_DB) $(TARGETNAME)$(EXE_POSTFIX) -# ./$(TARGETNAME)$(EXE_POSTFIX) \ -# $(SVC_DB) \ -# $(SVC_MASK) \ -# $(SVC_CLIENT_STUBS) \ -# $(SVC_SERVICE_TABLE) - $(SVC_FILES): $(SVC_DB) $(TARGETNAME)$(EXE_POSTFIX) ./$(TARGETNAME)$(EXE_POSTFIX) \ $(SVC_DB) \ $(SVC_SERVICE_TABLE) \ $(SVC_GDI_STUBS) \ - $(SVC_USER_STUBS) + $(SVC_USER_STUBS) \ + $(SVC_CSRSS_STUBS) clean: diff --git a/reactos/lib/gdi32/main/dllmain.c b/reactos/lib/gdi32/main/dllmain.c index 9e730d8c5e8..ba9d70b771a 100644 --- a/reactos/lib/gdi32/main/dllmain.c +++ b/reactos/lib/gdi32/main/dllmain.c @@ -1,9 +1,9 @@ /* * dllmain.c * - * $Revision: 1.3 $ - * $Author: ekohl $ - * $Date: 2000/02/22 20:55:36 $ + * $Revision: 1.4 $ + * $Author: dwelch $ + * $Date: 2002/08/26 13:06:03 $ * */ @@ -37,8 +37,6 @@ GdiDllInitialize ( switch (dwReason) { case DLL_PROCESS_ATTACH: - if (W32kInitialize () == FALSE) - return FALSE; GdiProcessSetup (); break; diff --git a/reactos/lib/user32/misc/dllmain.c b/reactos/lib/user32/misc/dllmain.c index 20445774c19..cce1e766278 100644 --- a/reactos/lib/user32/misc/dllmain.c +++ b/reactos/lib/user32/misc/dllmain.c @@ -62,12 +62,9 @@ Init(VOID) NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDGETMINMAXINFO] = (PVOID)User32SendGETMINMAXINFOMessageForKernel; - //ProcessWindowStation = CreateWindowStationW(L"WinStaName",0,GENERIC_ALL,NULL); - //Desktop = CreateDesktopA(NULL,NULL,NULL,0,0,NULL); + GdiDllInitialize(NULL, DLL_PROCESS_ATTACH, NULL); - //GdiDllInitialize(NULL, DLL_PROCESS_ATTACH, NULL); - - return Status; + return(Status); } DWORD @@ -75,11 +72,9 @@ Cleanup(VOID) { DWORD Status; - //CloseWindowStation(ProcessWindowStation); + GdiDllInitialize(NULL, DLL_PROCESS_DETACH, NULL); - //GdiDllInitialize(NULL, DLL_PROCESS_DETACH, NULL); - - return Status; + return(Status); } INT STDCALL diff --git a/reactos/ntoskrnl/ps/process.c b/reactos/ntoskrnl/ps/process.c index 2a9da2c8d8d..b102d441ceb 100644 --- a/reactos/ntoskrnl/ps/process.c +++ b/reactos/ntoskrnl/ps/process.c @@ -1,4 +1,4 @@ -/* $Id: process.c,v 1.89 2002/08/20 20:37:14 hyperion Exp $ +/* $Id: process.c,v 1.90 2002/08/26 13:06:03 dwelch Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -452,7 +452,7 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, Status = ObReferenceObjectByHandle(ParentProcessHandle, PROCESS_CREATE_PROCESS, PsProcessType, - UserMode, + ExGetPreviousMode(), (PVOID*)&ParentProcess, NULL); if (!NT_SUCCESS(Status)) diff --git a/reactos/subsys/csrss/.cvsignore b/reactos/subsys/csrss/.cvsignore index 4f52860e846..47fb56274c8 100644 --- a/reactos/subsys/csrss/.cvsignore +++ b/reactos/subsys/csrss/.cvsignore @@ -4,3 +4,4 @@ csrss.nostrip.exe *.d *.o *.sym +win32k.c diff --git a/reactos/subsys/csrss/init.c b/reactos/subsys/csrss/init.c index edd1524fd84..e2e22416257 100644 --- a/reactos/subsys/csrss/init.c +++ b/reactos/subsys/csrss/init.c @@ -1,4 +1,4 @@ -/* $Id: init.c,v 1.14 2002/08/20 20:37:17 hyperion Exp $ +/* $Id: init.c,v 1.15 2002/08/26 13:06:03 dwelch Exp $ * * reactos/subsys/csrss/init.c * @@ -203,6 +203,8 @@ CsrServerInitialization ( InitializeVideoAddressSpace(); + W32kInitialize(); + return TRUE; } diff --git a/reactos/subsys/csrss/makefile b/reactos/subsys/csrss/makefile index 7806960379c..8e85dcf8dec 100644 --- a/reactos/subsys/csrss/makefile +++ b/reactos/subsys/csrss/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.15 2001/08/21 20:13:16 chorns Exp $ +# $Id: makefile,v 1.16 2002/08/26 13:06:03 dwelch Exp $ PATH_TO_TOP = ../.. @@ -22,7 +22,8 @@ OBJECTS_MISC = \ $(TARGET_NAME).o \ init.o \ print.o \ - video.o + video.o \ + win32k.o TARGET_OBJECTS = \ $(OBJECTS_API) \