Body = &ObjectHeader->Body;
GrantedAccess = HandleEntry->GrantedAccess;
OBTRACE(OB_HANDLE_DEBUG,
- "%s - Closing handle: %lx for %p. HC PC %lx %lx\n",
+ "%s - Closing handle: %p for %p. HC PC %lx %lx\n",
__FUNCTION__,
Handle,
Body,
/* Return to caller */
OBTRACE(OB_HANDLE_DEBUG,
- "%s - Closed handle: %lx for %p. HC PC %lx %lx\n",
+ "%s - Closed handle: %p for %p.\n",
__FUNCTION__,
Handle,
- Body,
- ObjectHeader->HandleCount,
- ObjectHeader->PointerCount);
+ Body);
return STATUS_SUCCESS;
}
/* Trace and return */
OBTRACE(OB_HANDLE_DEBUG,
- "%s - Returning Handle: %lx HC PC %lx %lx\n",
+ "%s - Returning Handle: %p HC PC %lx %lx\n",
__FUNCTION__,
Handle,
ObjectHeader->HandleCount,
/* Trace and return */
OBTRACE(OB_HANDLE_DEBUG,
- "%s - Returning Handle: %lx HC PC %lx %lx\n",
+ "%s - Returning Handle: %p HC PC %lx %lx\n",
__FUNCTION__,
Handle,
ObjectHeader->HandleCount,
PEPROCESS Process = PsGetCurrentProcess();
PAGED_CODE();
OBTRACE(OB_HANDLE_DEBUG,
- "%s - Closing handle: %lx\n", __FUNCTION__, Handle);
+ "%s - Closing handle: %p\n", __FUNCTION__, Handle);
+
+ if (AccessMode == KernelMode && Handle == (HANDLE)-1)
+ return STATUS_INVALID_HANDLE;
/* Check if we're dealing with a kernel handle */
if (ObIsKernelHandle(Handle, AccessMode))
/* Detach and return success */
if (AttachedToProcess) KeUnstackDetachProcess(&ApcState);
- Status = STATUS_SUCCESS;
}
else
{
/* Return status */
OBTRACE(OB_HANDLE_DEBUG,
- "%s - Closed handle: %lx S: %lx\n",
+ "%s - Closed handle: %p S: %lx\n",
__FUNCTION__, Handle, Status);
return Status;
}
ULONG AuditMask;
PAGED_CODE();
OBTRACE(OB_HANDLE_DEBUG,
- "%s - Duplicating handle: %lx for %p into %p\n",
+ "%s - Duplicating handle: %p for %p into %p\n",
__FUNCTION__,
SourceHandle,
SourceProcess,
/* Return status */
OBTRACE(OB_HANDLE_DEBUG,
- "%s - Duplicated handle: %lx for %p into %p. Source: %p HC PC %lx %lx\n",
+ "%s - Duplicated handle: %p for %p into %p. Source: %p HC PC %lx %lx\n",
__FUNCTION__,
NewHandle,
SourceProcess,
/* Capture all the info */
Status = ObpCaptureObjectCreateInformation(ObjectAttributes,
+ AccessMode,
AccessMode,
TRUE,
&TempBuffer->ObjectCreateInfo,
PassedAccessState->SecurityDescriptor =
TempBuffer->ObjectCreateInfo.SecurityDescriptor;
}
+
+ /* Validate the access mask */
+ Status = ObpValidateAccessMask(PassedAccessState);
+ if (!NT_SUCCESS(Status))
+ {
+ /* Cleanup after lookup */
+ ObpReleaseLookupContext(&TempBuffer->LookupContext);
+ goto Cleanup;
+ }
/* Now do the lookup */
Status = ObpLookupObjectName(TempBuffer->ObjectCreateInfo.RootDirectory,
if (!(ObjectHeader->Flags & OB_FLAG_CREATE_INFO))
{
/* Display warning and break into debugger */
- DPRINT1("OB: Attempting to insert existing object %08x\n", Object);
+ DPRINT1("OB: Attempting to insert existing object %p\n", Object);
DbgBreakPoint();
/* Allow debugger to continue */
return RealStatus;
}
+/*++
+* @name ObSetHandleAttributes
+* @implemented NT5.1
+*
+* The ObSetHandleAttributes routine <FILLMEIN>
+*
+* @param Handle
+* <FILLMEIN>.
+*
+* @param HandleFlags
+* <FILLMEIN>.
+*
+* @param PreviousMode
+* <FILLMEIN>.
+*
+* @return <FILLMEIN>.
+*
+* @remarks None.
+*
+*--*/
+NTSTATUS
+NTAPI
+ObSetHandleAttributes(IN HANDLE Handle,
+ IN POBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleFlags,
+ IN KPROCESSOR_MODE PreviousMode)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
/*++
* @name ObCloseHandle
* @implemented NT5.1
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
NTSTATUS Status;
OBTRACE(OB_HANDLE_DEBUG,
- "%s - Duplicating handle: %lx for %lx into %lx.\n",
+ "%s - Duplicating handle: %p for %p into %p.\n",
__FUNCTION__,
SourceHandle,
SourceProcessHandle,
PreviousMode,
(PVOID*)&SourceProcess,
NULL);
- if (!NT_SUCCESS(Status)) return(Status);
+ if (!NT_SUCCESS(Status)) return Status;
/* Check if got a target handle */
if (TargetProcessHandle)
/* Dereference the processes */
OBTRACE(OB_HANDLE_DEBUG,
- "%s - Duplicated handle: %lx into %lx S %lx\n",
+ "%s - Duplicated handle: %p into %p S %lx\n",
__FUNCTION__,
hTarget,
TargetProcessHandle,