/* Charge the quota */
ObjectHeader->QuotaBlockCharged = (PVOID)1;
+ DPRINT("FIXME: Should charge: %lx %lx\n", PagedPoolCharge, NonPagedPoolCharge);
#if 0
PsChargeSharedPoolQuota(PsGetCurrentProcess(),
PagedPoolCharge,
/* Return to caller */
OBTRACE(OB_HANDLE_DEBUG,
- "%s - Closed handle: %lx for %p. HC PC %lx %lx\n",
+ "%s - Closed handle: %lx for %p.\n",
__FUNCTION__,
Handle,
- Body,
- ObjectHeader->HandleCount,
- ObjectHeader->PointerCount);
+ Body);
return STATUS_SUCCESS;
}
if (!ObCheckObjectAccess(Object,
AccessState,
TRUE,
- AccessMode,
+ ProbeMode,
&Status))
{
/* Access was denied, so fail */
OBTRACE(OB_HANDLE_DEBUG,
"%s - Closing handle: %lx\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
{
/* 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,