(ObjectAttributes->Attributes & ~OBJ_VALID_ATTRIBUTES))
{
/* Invalid combination, fail */
- Status = STATUS_INVALID_PARAMETER;
- _SEH2_LEAVE;
+ _SEH2_YIELD(return STATUS_INVALID_PARAMETER);
}
/* Set some Create Info */
TRUE,
&ObjectCreateInfo->
SecurityDescriptor);
- if(!NT_SUCCESS(Status))
+ if (!NT_SUCCESS(Status))
{
/* Capture failed, quit */
ObjectCreateInfo->SecurityDescriptor = NULL;
- _SEH2_LEAVE;
+ _SEH2_YIELD(return Status);
}
/* Save the probe mode and security descriptor size */
}
_SEH2_EXCEPT(ExSystemExceptionFilter())
{
- /* Get the exception */
- Status = _SEH2_GetExceptionCode();
+ /* Cleanup and return the exception code */
+ ObpReleaseObjectCreateInformation(ObjectCreateInfo);
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
- if (NT_SUCCESS(Status))
+ /* Now check if the Object Attributes had an Object Name */
+ if (LocalObjectName)
{
- /* Now check if the Object Attributes had an Object Name */
- if (LocalObjectName)
- {
- Status = ObpCaptureObjectName(ObjectName,
- LocalObjectName,
- AccessMode,
- AllocateFromLookaside);
- }
- else
- {
- /* Clear the string */
- RtlInitEmptyUnicodeString(ObjectName, NULL, 0);
+ Status = ObpCaptureObjectName(ObjectName,
+ LocalObjectName,
+ AccessMode,
+ AllocateFromLookaside);
+ }
+ else
+ {
+ /* Clear the string */
+ RtlInitEmptyUnicodeString(ObjectName, NULL, 0);
- /* He can't have specified a Root Directory */
- if (ObjectCreateInfo->RootDirectory)
- {
- Status = STATUS_OBJECT_NAME_INVALID;
- }
+ /* He can't have specified a Root Directory */
+ if (ObjectCreateInfo->RootDirectory)
+ {
+ Status = STATUS_OBJECT_NAME_INVALID;
}
}
/* Cleanup if we failed */
if (!NT_SUCCESS(Status))
{
- ObpReleaseObjectCreateInformation(ObjectCreateInfo);
+ ObpReleaseObjectCreateInformation(ObjectCreateInfo);
}
/* Return status to caller */
POBJECT_BASIC_INFORMATION BasicInfo;
ULONG InfoLength;
PVOID Object = NULL;
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
PAGED_CODE();
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- /* Get the exception code */
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
- /* Fail if we raised an exception */
- if (!NT_SUCCESS(Status)) return Status;
}
/*
IN PVOID ObjectInformation,
IN ULONG Length)
{
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
OBP_SET_HANDLE_ATTRIBUTES_CONTEXT Context;
PVOID ObjectTable;
KAPC_STATE ApcState;
return STATUS_INFO_LENGTH_MISMATCH;
}
- /* Save the previous mode and actual information */
+ /* Save the previous mode */
Context.PreviousMode = ExGetPreviousMode();
+ /* Check if we were called from user mode */
if (Context.PreviousMode != KernelMode)
{
+ /* Enter SEH */
_SEH2_TRY
{
+ /* Probe and capture the attribute buffer */
ProbeForRead(ObjectInformation,
sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION),
sizeof(BOOLEAN));
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
- if (!NT_SUCCESS(Status)) return Status;
}
else
+ {
+ /* Just copy the buffer directly */
Context.Information = *(POBJECT_HANDLE_ATTRIBUTE_INFORMATION)
ObjectInformation;
+ }
/* Check if this is a kernel handle */
if (ObIsKernelHandle(ObjectHandle, Context.PreviousMode))
/* Some failure */
Status = STATUS_ACCESS_DENIED;
}
+ else
+ {
+ /* We are done */
+ Status = STATUS_SUCCESS;
+ }
/* De-attach if we were attached, and return status */
if (AttachedToProcess) KeUnstackDetachProcess(&ApcState);