3 modified files
reactos/ntoskrnl/include/internal
diff -u -r1.76 -r1.77
--- ps.h 27 Nov 2004 19:41:55 -0000 1.76
+++ ps.h 5 Dec 2004 15:42:41 -0000 1.77
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: ps.h,v 1.76 2004/11/27 19:41:55 hbirr Exp $
+/* $Id: ps.h,v 1.77 2004/12/05 15:42:41 weiden Exp $
*
* FILE: ntoskrnl/ke/kthread.c
* PURPOSE: Process manager definitions
@@ -48,8 +48,6 @@
#define KeGetCurrentProcessorNumber() (KeGetCurrentKPCR()->ProcessorNumber)
#endif
-extern HANDLE SystemProcessHandle;
-
extern LCID PsDefaultThreadLocaleId;
extern LCID PsDefaultSystemLocaleId;
reactos/ntoskrnl/ldr
diff -u -r1.49 -r1.50
--- init.c 21 Nov 2004 21:09:42 -0000 1.49
+++ init.c 5 Dec 2004 15:42:42 -0000 1.50
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: init.c,v 1.49 2004/11/21 21:09:42 weiden Exp $
+/* $Id: init.c,v 1.50 2004/12/05 15:42:42 weiden Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ldr/init.c
@@ -375,6 +375,7 @@
ULONG ResultLength;
PVOID ImageBaseAddress;
ULONG InitialStack[5];
+ HANDLE SystemProcessHandle;
NTSTATUS Status;
/* Get the absolute path to smss.exe. */
@@ -404,6 +405,17 @@
return(Status);
}
+ Status = ObCreateHandle(PsGetCurrentProcess(),
+ PsInitialSystemProcess,
+ PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION,
+ FALSE,
+ &SystemProcessHandle);
+ if(!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to create a handle for the system process!\n");
+ return Status;
+ }
+
DPRINT("Creating process\n");
Status = NtCreateProcess(ProcessHandle,
PROCESS_ALL_ACCESS,
@@ -414,6 +426,7 @@
NULL,
NULL);
NtClose(SectionHandle);
+ NtClose(SystemProcessHandle);
if (!NT_SUCCESS(Status))
{
DPRINT("NtCreateProcess() failed (Status %lx)\n", Status);
reactos/ntoskrnl/ps
diff -u -r1.157 -r1.158
--- process.c 24 Nov 2004 18:13:18 -0000 1.157
+++ process.c 5 Dec 2004 15:42:42 -0000 1.158
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.157 2004/11/24 18:13:18 navaraf Exp $
+/* $Id: process.c,v 1.158 2004/12/05 15:42:42 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -18,7 +18,7 @@
/* GLOBALS ******************************************************************/
PEPROCESS EXPORTED PsInitialSystemProcess = NULL;
-HANDLE SystemProcessHandle = NULL;
+PEPROCESS PsIdleProcess = NULL;
POBJECT_TYPE EXPORTED PsProcessType = NULL;
@@ -345,12 +345,6 @@
strcpy(PsInitialSystemProcess->ImageFileName, "SYSTEM");
SepCreateSystemProcessToken(PsInitialSystemProcess);
-
- ObCreateHandle(PsInitialSystemProcess,
- PsInitialSystemProcess,
- PROCESS_ALL_ACCESS,
- FALSE,
- &SystemProcessHandle);
}
VOID STDCALL
@@ -583,14 +577,35 @@
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes)
{
- return NtCreateProcess(ProcessHandle,
- DesiredAccess,
- ObjectAttributes,
- SystemProcessHandle,
- FALSE,
- NULL,
- NULL,
- NULL);
+ HANDLE SystemProcessHandle;
+ NTSTATUS Status;
+
+ /* FIXME - what about security? should there be any privilege checks or something
+ security related? */
+
+ Status = ObCreateHandle(PsGetCurrentProcess(),
+ PsInitialSystemProcess,
+ PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION,
+ FALSE,
+ &SystemProcessHandle);
+ if(!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to create a handle for the system process!\n");
+ return Status;
+ }
+
+ Status = NtCreateProcess(ProcessHandle,
+ DesiredAccess,
+ ObjectAttributes,
+ SystemProcessHandle,
+ FALSE,
+ NULL,
+ NULL,
+ NULL);
+
+ NtClose(SystemProcessHandle);
+
+ return Status;
}
NTSTATUS STDCALL
CVSspam 0.2.8