Pass failures up the chain

svn path=/trunk/; revision=4954
This commit is contained in:
Gé van Geldorp 2003-06-24 11:34:28 +00:00
parent 0ceda3461a
commit f974b5e263

View file

@ -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: handle.c,v 1.45 2003/05/28 18:09:10 chorns Exp $ /* $Id: handle.c,v 1.46 2003/06/24 11:34:28 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -626,6 +626,7 @@ ObReferenceObjectByHandle(HANDLE Handle,
KIRQL oldIrql; KIRQL oldIrql;
PVOID ObjectBody; PVOID ObjectBody;
ACCESS_MASK GrantedAccess; ACCESS_MASK GrantedAccess;
NTSTATUS Status;
ASSERT_IRQL(PASSIVE_LEVEL); ASSERT_IRQL(PASSIVE_LEVEL);
@ -642,13 +643,18 @@ ObReferenceObjectByHandle(HANDLE Handle,
{ {
DPRINT("Reference from %x\n", ((PULONG)&Handle)[-1]); DPRINT("Reference from %x\n", ((PULONG)&Handle)[-1]);
ObReferenceObjectByPointer(PsGetCurrentProcess(), Status = ObReferenceObjectByPointer(PsGetCurrentProcess(),
PROCESS_ALL_ACCESS, PROCESS_ALL_ACCESS,
PsProcessType, PsProcessType,
UserMode); UserMode);
if (! NT_SUCCESS(Status))
{
return Status;
}
*Object = PsGetCurrentProcess(); *Object = PsGetCurrentProcess();
DPRINT("Referencing current process %x\n", PsGetCurrentProcess()); DPRINT("Referencing current process %x\n", PsGetCurrentProcess());
return(STATUS_SUCCESS); return STATUS_SUCCESS;
} }
else if (Handle == NtCurrentProcess()) else if (Handle == NtCurrentProcess())
{ {
@ -658,13 +664,18 @@ ObReferenceObjectByHandle(HANDLE Handle,
if (Handle == NtCurrentThread() && if (Handle == NtCurrentThread() &&
(ObjectType == PsThreadType || ObjectType == NULL)) (ObjectType == PsThreadType || ObjectType == NULL))
{ {
ObReferenceObjectByPointer(PsGetCurrentThread(), Status = ObReferenceObjectByPointer(PsGetCurrentThread(),
THREAD_ALL_ACCESS, THREAD_ALL_ACCESS,
PsThreadType, PsThreadType,
UserMode); UserMode);
if (! NT_SUCCESS(Status))
{
return Status;
}
*Object = PsGetCurrentThread(); *Object = PsGetCurrentThread();
CHECKPOINT; CHECKPOINT;
return(STATUS_SUCCESS); return STATUS_SUCCESS;
} }
else if (Handle == NtCurrentThread()) else if (Handle == NtCurrentThread())
{ {