mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
- PsLookup* functions fixed to increment the reference count of the object they are about to return. The GDB KD stub is directly affected by this patch, but it hasn't been fixed yet
- PsGetCurrentProcess and PsGetCurrentThread are now macros calling IoGetCurrentProcess and KeGetCurrentThread, for binary compatibility with Windows svn path=/trunk/; revision=4521
This commit is contained in:
parent
71c3c7c1cc
commit
5c6df46d27
7 changed files with 20 additions and 27 deletions
|
@ -185,7 +185,7 @@ ExFreePool (
|
|||
* );
|
||||
*/
|
||||
#define ExGetCurrentResourceThread() \
|
||||
((ERESOURCE_THREAD)PsGetCurrentThread())
|
||||
((ERESOURCE_THREAD)KeGetCurrentThread())
|
||||
|
||||
ULONG
|
||||
STDCALL
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: extypes.h,v 1.13 2003/03/19 23:14:11 gdalsnes Exp $ */
|
||||
/* $Id: extypes.h,v 1.14 2003/04/10 23:14:46 hyperion Exp $ */
|
||||
|
||||
#ifndef __INCLUDE_DDK_EXTYPES_H
|
||||
#define __INCLUDE_DDK_EXTYPES_H
|
||||
|
@ -18,7 +18,7 @@ extern POBJECT_TYPE IMPORTED ExIoCompletionType;
|
|||
typedef ULONG INTERLOCKED_RESULT;
|
||||
typedef ULONG WORK_QUEUE_TYPE;
|
||||
|
||||
typedef ULONG ERESOURCE_THREAD, *PERESOURCE_THREAD;
|
||||
typedef ULONG_PTR ERESOURCE_THREAD, *PERESOURCE_THREAD;
|
||||
|
||||
typedef struct _OWNER_ENTRY
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: psfuncs.h,v 1.22 2002/09/08 10:47:45 chorns Exp $
|
||||
/* $Id: psfuncs.h,v 1.23 2003/04/10 23:14:46 hyperion Exp $
|
||||
*/
|
||||
#ifndef _INCLUDE_DDK_PSFUNCS_H
|
||||
#define _INCLUDE_DDK_PSFUNCS_H
|
||||
|
@ -48,8 +48,9 @@ VOID STDCALL PsEstablishWin32Callouts(PVOID Param1,
|
|||
ULONG W32ThreadSize,
|
||||
ULONG W32ProcessSize);
|
||||
|
||||
struct _ETHREAD* STDCALL PsGetCurrentThread(VOID);
|
||||
struct _EPROCESS* STDCALL PsGetCurrentProcess(VOID);
|
||||
#define PsGetCurrentProcess() IoGetCurrentProcess()
|
||||
#define PsGetCurrentThread() ((struct _ETHREAD*) (KeGetCurrentThread()))
|
||||
|
||||
PACCESS_TOKEN STDCALL PsReferenceImpersonationToken(struct _ETHREAD* Thread,
|
||||
PULONG Unknown1,
|
||||
PULONG Unknown2,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.def,v 1.149 2003/04/06 10:45:16 chorns Exp $
|
||||
; $Id: ntoskrnl.def,v 1.150 2003/04/10 23:14:46 hyperion Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -636,10 +636,8 @@ PsCreateWin32Process@4
|
|||
PsGetWin32Thread@0
|
||||
PsGetWin32Process@0
|
||||
PsEstablishWin32Callouts@24
|
||||
PsGetCurrentProcess@0
|
||||
PsGetCurrentProcessId@0
|
||||
PsGetCurrentThreadId@0
|
||||
PsGetCurrentThread@0
|
||||
PsGetProcessExitTime@0
|
||||
PsGetVersion@16
|
||||
PsImpersonateClient@20
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.edf,v 1.135 2003/04/06 10:45:16 chorns Exp $
|
||||
; $Id: ntoskrnl.edf,v 1.136 2003/04/10 23:14:47 hyperion Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -635,10 +635,8 @@ PsCreateWin32Process=PsCreateWin32Process@4
|
|||
PsGetWin32Thread=PsGetWin32Thread@0
|
||||
PsGetWin32Process=PsGetWin32Process@0
|
||||
PsEstablishWin32Callouts=PsEstablishWin32Callouts@24
|
||||
PsGetCurrentProcess=PsGetCurrentProcess@0
|
||||
PsGetCurrentProcessId=PsGetCurrentProcessId@0
|
||||
PsGetCurrentThreadId=PsGetCurrentThreadId@0
|
||||
PsGetCurrentThread=PsGetCurrentThread@0
|
||||
PsGetProcessExitTime=PsGetProcessExitTime@0
|
||||
PsGetVersion=PsGetVersion@16
|
||||
PsImpersonateClient=PsImpersonateClient@20
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: process.c,v 1.95 2003/01/19 01:46:32 hbirr Exp $
|
||||
/* $Id: process.c,v 1.96 2003/04/10 23:14:47 hyperion Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -368,7 +368,7 @@ PsGetCurrentProcessId(VOID)
|
|||
* FUNCTION: Returns a pointer to the current process
|
||||
*/
|
||||
PEPROCESS STDCALL
|
||||
PsGetCurrentProcess(VOID)
|
||||
IoGetCurrentProcess(VOID)
|
||||
{
|
||||
if (PsGetCurrentThread() == NULL ||
|
||||
PsGetCurrentThread()->ThreadsProcess == NULL)
|
||||
|
@ -381,12 +381,6 @@ PsGetCurrentProcess(VOID)
|
|||
}
|
||||
}
|
||||
|
||||
PEPROCESS STDCALL
|
||||
IoGetCurrentProcess(VOID)
|
||||
{
|
||||
return(PsGetCurrentProcess());
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
PsCreateSystemProcess(PHANDLE ProcessHandle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
|
@ -1220,6 +1214,7 @@ PsLookupProcessByProcessId(IN PVOID ProcessId,
|
|||
if (current->UniqueProcessId == (ULONG)ProcessId)
|
||||
{
|
||||
*Process = current;
|
||||
ObReferenceObject(current);
|
||||
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: thread.c,v 1.107 2003/03/19 23:08:46 gdalsnes Exp $
|
||||
/* $Id: thread.c,v 1.108 2003/04/10 23:14:47 hyperion Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -66,12 +66,6 @@ PKTHREAD STDCALL KeGetCurrentThread(VOID)
|
|||
return(KeGetCurrentKPCR()->CurrentThread);
|
||||
}
|
||||
|
||||
PETHREAD STDCALL PsGetCurrentThread(VOID)
|
||||
{
|
||||
PKTHREAD CurrentThread = KeGetCurrentKPCR()->CurrentThread;
|
||||
return(CONTAINING_RECORD(CurrentThread, ETHREAD, Tcb));
|
||||
}
|
||||
|
||||
HANDLE STDCALL PsGetCurrentThreadId(VOID)
|
||||
{
|
||||
return(PsGetCurrentThread()->Cid.UniqueThread);
|
||||
|
@ -603,8 +597,14 @@ PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
|
|||
current->Cid.UniqueProcess == Cid->UniqueProcess)
|
||||
{
|
||||
if (Process != NULL)
|
||||
{
|
||||
*Process = current->ThreadsProcess;
|
||||
ObReferenceObject(current->ThreadsProcess);
|
||||
}
|
||||
|
||||
*Thread = current;
|
||||
ObReferenceObject(current);
|
||||
|
||||
KeReleaseSpinLock(&PiThreadListLock, oldIrql);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
@ -637,6 +637,7 @@ PsLookupThreadByThreadId(IN PVOID ThreadId,
|
|||
if (current->Cid.UniqueThread == (HANDLE)ThreadId)
|
||||
{
|
||||
*Thread = current;
|
||||
ObReferenceObject(current);
|
||||
KeReleaseSpinLock(&PiThreadListLock, oldIrql);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue