mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 14:53:40 +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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* FILE: ntoskrnl/ke/kthread.c
|
||||||
* PURPOSE: Process manager definitions
|
* PURPOSE: Process manager definitions
|
||||||
|
@ -48,8 +48,6 @@ struct _EJOB;
|
||||||
#define KeGetCurrentProcessorNumber() (KeGetCurrentKPCR()->ProcessorNumber)
|
#define KeGetCurrentProcessorNumber() (KeGetCurrentKPCR()->ProcessorNumber)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern HANDLE SystemProcessHandle;
|
|
||||||
|
|
||||||
extern LCID PsDefaultThreadLocaleId;
|
extern LCID PsDefaultThreadLocaleId;
|
||||||
extern LCID PsDefaultSystemLocaleId;
|
extern LCID PsDefaultSystemLocaleId;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ldr/init.c
|
* FILE: ntoskrnl/ldr/init.c
|
||||||
|
@ -375,6 +375,7 @@ LdrLoadInitialProcess(PHANDLE ProcessHandle,
|
||||||
ULONG ResultLength;
|
ULONG ResultLength;
|
||||||
PVOID ImageBaseAddress;
|
PVOID ImageBaseAddress;
|
||||||
ULONG InitialStack[5];
|
ULONG InitialStack[5];
|
||||||
|
HANDLE SystemProcessHandle;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
/* Get the absolute path to smss.exe. */
|
/* Get the absolute path to smss.exe. */
|
||||||
|
@ -404,6 +405,17 @@ LdrLoadInitialProcess(PHANDLE ProcessHandle,
|
||||||
return(Status);
|
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");
|
DPRINT("Creating process\n");
|
||||||
Status = NtCreateProcess(ProcessHandle,
|
Status = NtCreateProcess(ProcessHandle,
|
||||||
PROCESS_ALL_ACCESS,
|
PROCESS_ALL_ACCESS,
|
||||||
|
@ -414,6 +426,7 @@ LdrLoadInitialProcess(PHANDLE ProcessHandle,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
NtClose(SectionHandle);
|
NtClose(SectionHandle);
|
||||||
|
NtClose(SystemProcessHandle);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtCreateProcess() failed (Status %lx)\n", 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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
/* GLOBALS ******************************************************************/
|
/* GLOBALS ******************************************************************/
|
||||||
|
|
||||||
PEPROCESS EXPORTED PsInitialSystemProcess = NULL;
|
PEPROCESS EXPORTED PsInitialSystemProcess = NULL;
|
||||||
HANDLE SystemProcessHandle = NULL;
|
PEPROCESS PsIdleProcess = NULL;
|
||||||
|
|
||||||
POBJECT_TYPE EXPORTED PsProcessType = NULL;
|
POBJECT_TYPE EXPORTED PsProcessType = NULL;
|
||||||
|
|
||||||
|
@ -345,12 +345,6 @@ PsInitProcessManagment(VOID)
|
||||||
strcpy(PsInitialSystemProcess->ImageFileName, "SYSTEM");
|
strcpy(PsInitialSystemProcess->ImageFileName, "SYSTEM");
|
||||||
|
|
||||||
SepCreateSystemProcessToken(PsInitialSystemProcess);
|
SepCreateSystemProcessToken(PsInitialSystemProcess);
|
||||||
|
|
||||||
ObCreateHandle(PsInitialSystemProcess,
|
|
||||||
PsInitialSystemProcess,
|
|
||||||
PROCESS_ALL_ACCESS,
|
|
||||||
FALSE,
|
|
||||||
&SystemProcessHandle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
|
@ -583,14 +577,35 @@ PsCreateSystemProcess(PHANDLE ProcessHandle,
|
||||||
ACCESS_MASK DesiredAccess,
|
ACCESS_MASK DesiredAccess,
|
||||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||||
{
|
{
|
||||||
return NtCreateProcess(ProcessHandle,
|
HANDLE SystemProcessHandle;
|
||||||
DesiredAccess,
|
NTSTATUS Status;
|
||||||
ObjectAttributes,
|
|
||||||
SystemProcessHandle,
|
/* FIXME - what about security? should there be any privilege checks or something
|
||||||
FALSE,
|
security related? */
|
||||||
NULL,
|
|
||||||
NULL,
|
Status = ObCreateHandle(PsGetCurrentProcess(),
|
||||||
NULL);
|
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
|
NTSTATUS STDCALL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue