mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 18:01:07 +00:00
[NTOS:OB]
- Create kernel handles if requested by the caller in ObDuplicateObject CORE-10207 svn path=/trunk/; revision=69571
This commit is contained in:
parent
44cc9aa006
commit
21b04efae8
|
@ -2150,6 +2150,8 @@ ObDuplicateObject(IN PEPROCESS SourceProcess,
|
||||||
PHANDLE_TABLE HandleTable;
|
PHANDLE_TABLE HandleTable;
|
||||||
OBJECT_HANDLE_INFORMATION HandleInformation;
|
OBJECT_HANDLE_INFORMATION HandleInformation;
|
||||||
ULONG AuditMask;
|
ULONG AuditMask;
|
||||||
|
BOOLEAN KernelHandle = FALSE;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
OBTRACE(OB_HANDLE_DEBUG,
|
OBTRACE(OB_HANDLE_DEBUG,
|
||||||
"%s - Duplicating handle: %p for %p into %p\n",
|
"%s - Duplicating handle: %p for %p into %p\n",
|
||||||
|
@ -2222,6 +2224,14 @@ ObDuplicateObject(IN PEPROCESS SourceProcess,
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create a kernel handle if asked, but only in the system process */
|
||||||
|
if (PreviousMode == KernelMode &&
|
||||||
|
HandleAttributes & OBJ_KERNEL_HANDLE &&
|
||||||
|
TargetProcess == PsInitialSystemProcess)
|
||||||
|
{
|
||||||
|
KernelHandle = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the target handle table */
|
/* Get the target handle table */
|
||||||
HandleTable = ObReferenceProcessHandleTable(TargetProcess);
|
HandleTable = ObReferenceProcessHandleTable(TargetProcess);
|
||||||
if (!HandleTable)
|
if (!HandleTable)
|
||||||
|
@ -2376,6 +2386,12 @@ ObDuplicateObject(IN PEPROCESS SourceProcess,
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mark it as a kernel handle if requested */
|
||||||
|
if (KernelHandle)
|
||||||
|
{
|
||||||
|
NewHandle = ObMarkHandleAsKernelHandle(NewHandle);
|
||||||
|
}
|
||||||
|
|
||||||
/* Return the handle */
|
/* Return the handle */
|
||||||
if (TargetHandle) *TargetHandle = NewHandle;
|
if (TargetHandle) *TargetHandle = NewHandle;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue