mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:35:47 +00:00
get rid of the "global" system process handle since handles are only vaild in the context of the process that they belong to
svn path=/trunk/; revision=11944
This commit is contained in:
parent
61a1526935
commit
9221b12484
3 changed files with 46 additions and 20 deletions
|
@ -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 @@ struct _EJOB;
|
|||
#define KeGetCurrentProcessorNumber() (KeGetCurrentKPCR()->ProcessorNumber)
|
||||
#endif
|
||||
|
||||
extern HANDLE SystemProcessHandle;
|
||||
|
||||
extern LCID PsDefaultThreadLocaleId;
|
||||
extern LCID PsDefaultSystemLocaleId;
|
||||
|
||||
|
|
|
@ -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 @@ LdrLoadInitialProcess(PHANDLE ProcessHandle,
|
|||
ULONG ResultLength;
|
||||
PVOID ImageBaseAddress;
|
||||
ULONG InitialStack[5];
|
||||
HANDLE SystemProcessHandle;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Get the absolute path to smss.exe. */
|
||||
|
@ -404,6 +405,17 @@ LdrLoadInitialProcess(PHANDLE ProcessHandle,
|
|||
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 @@ LdrLoadInitialProcess(PHANDLE ProcessHandle,
|
|||
NULL,
|
||||
NULL);
|
||||
NtClose(SectionHandle);
|
||||
NtClose(SystemProcessHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("NtCreateProcess() failed (Status %lx)\n", Status);
|
||||
|
|
|
@ -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 @@ PsInitProcessManagment(VOID)
|
|||
strcpy(PsInitialSystemProcess->ImageFileName, "SYSTEM");
|
||||
|
||||
SepCreateSystemProcessToken(PsInitialSystemProcess);
|
||||
|
||||
ObCreateHandle(PsInitialSystemProcess,
|
||||
PsInitialSystemProcess,
|
||||
PROCESS_ALL_ACCESS,
|
||||
FALSE,
|
||||
&SystemProcessHandle);
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
|
@ -583,14 +577,35 @@ PsCreateSystemProcess(PHANDLE ProcessHandle,
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue