This routine initializes an ACCESS_STATE structure. This consists
of:
- zeroing the entire structure
- mapping generic access types in the passed DesiredAccess
and putting it into the structure
- "capturing" the Subject Context, which must be held for the
duration of the access attempt (at least until auditing is performed).
- Allocating an Operation ID, which is an LUID that will be used
to associate different parts of the access attempt in the audit
log.
Arguments:
AccessState - a pointer to the structure to be initialized.
AuxData - Supplies a buffer big enough for an AuxData structure
so we don't have to allocate one.
DesiredAccess - Access mask containing the desired access
GenericMapping - Optionally supplies a pointer to a generic mapping
that may be used to map any generic access requests that may
have been passed in the DesiredAccess parameter.
Note that if this parameter is not supplied, it must be filled
in at some later point. The IO system does this in IopParseDevice.
Return Value:
Error if the attempt to allocate an LUID fails.
Note that this error may be safely ignored if it is known that all
security checks will be performed with PreviousMode == KernelMode.
Know what you're doing if you choose to ignore this.
--*/
NTSTATUS
ObpCreateHandle (
IN OB_OPEN_REASON OpenReason,
IN PVOID Object,
IN POBJECT_TYPE ExpectedObjectType OPTIONAL,
IN PACCESS_STATE AccessState,
IN ULONG ObjectPointerBias OPTIONAL,
IN ULONG Attributes,
IN POBP_LOOKUP_CONTEXT LookupContext,
IN KPROCESSOR_MODE AccessMode,
OUT PVOID *ReferencedNewObject OPTIONAL,
OUT PHANDLE Handle
)
/*++
Routine Description:
This function creates a new handle to an existing object
Arguments:
OpenReason - The reason why we are doing this work
Object - A pointer to the body of the new object
ExpectedObjectType - Optionally Supplies the object type that
the caller is expecting
AccessState - Supplies the access state for the handle requested
by the caller
ObjectPointerBias - Optionally supplies a count of addition
increments we do to the pointer count for the object
Attributes - Desired attributes for the handle
DirectoryLocked - Indicates if the root directory mutex is already held
AccessMode - Supplies the mode of the requestor.
ReferencedNewObject - Optionally receives a pointer to the body
of the new object