mirror of
https://github.com/reactos/reactos.git
synced 2025-05-17 16:27:00 +00:00
[NTOSKRNL]: Implement NtSetInformationObject(ObjectSessionInformation).
[NTOSKRNL]: Implement NtQueryInformationProcess(ProcessLUIDDeviceMapsEnabled). svn path=/trunk/; revision=55603
This commit is contained in:
parent
95bb53eb1a
commit
a371650c63
3 changed files with 146 additions and 81 deletions
|
@ -137,6 +137,13 @@ PsReturnProcessNonPagedPoolQuota(
|
||||||
IN SIZE_T Amount
|
IN SIZE_T Amount
|
||||||
);
|
);
|
||||||
|
|
||||||
|
NTKERNELAPI
|
||||||
|
ULONG
|
||||||
|
NTAPI
|
||||||
|
PsGetCurrentProcessSessionId(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Process Impersonation Functions
|
// Process Impersonation Functions
|
||||||
//
|
//
|
||||||
|
|
|
@ -1645,15 +1645,15 @@ NtSetInformationObject(IN HANDLE ObjectHandle,
|
||||||
OBP_SET_HANDLE_ATTRIBUTES_CONTEXT Context;
|
OBP_SET_HANDLE_ATTRIBUTES_CONTEXT Context;
|
||||||
PVOID ObjectTable;
|
PVOID ObjectTable;
|
||||||
KAPC_STATE ApcState;
|
KAPC_STATE ApcState;
|
||||||
|
POBJECT_DIRECTORY Directory;
|
||||||
|
KPROCESSOR_MODE PreviousMode;
|
||||||
BOOLEAN AttachedToProcess = FALSE;
|
BOOLEAN AttachedToProcess = FALSE;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Validate the information class */
|
/* Validate the information class */
|
||||||
if (ObjectInformationClass != ObjectHandleFlagInformation)
|
switch (ObjectInformationClass)
|
||||||
{
|
{
|
||||||
/* Invalid class */
|
case ObjectHandleFlagInformation:
|
||||||
return STATUS_INVALID_INFO_CLASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Validate the length */
|
/* Validate the length */
|
||||||
if (Length != sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION))
|
if (Length != sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION))
|
||||||
|
@ -1730,6 +1730,43 @@ NtSetInformationObject(IN HANDLE ObjectHandle,
|
||||||
|
|
||||||
/* De-attach if we were attached, and return status */
|
/* De-attach if we were attached, and return status */
|
||||||
if (AttachedToProcess) KeUnstackDetachProcess(&ApcState);
|
if (AttachedToProcess) KeUnstackDetachProcess(&ApcState);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ObjectSessionInformation:
|
||||||
|
|
||||||
|
/* Only a system process can do this */
|
||||||
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
if (!SeSinglePrivilegeCheck(SeTcbPrivilege, PreviousMode))
|
||||||
|
{
|
||||||
|
/* Fail */
|
||||||
|
DPRINT1("Privilege not held\n");
|
||||||
|
Status = STATUS_PRIVILEGE_NOT_HELD;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Get the object directory */
|
||||||
|
Status = ObReferenceObjectByHandle(ObjectHandle,
|
||||||
|
0,
|
||||||
|
ObDirectoryType,
|
||||||
|
PreviousMode,
|
||||||
|
(PVOID*)&Directory,
|
||||||
|
NULL);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* FIXME: Missng locks */
|
||||||
|
/* Set its session ID */
|
||||||
|
Directory->SessionId = PsGetCurrentProcessSessionId();
|
||||||
|
ObDereferenceObject(Directory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
/* Unsupported class */
|
||||||
|
Status = STATUS_INVALID_INFO_CLASS;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -835,8 +835,29 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ProcessLUIDDeviceMapsEnabled:
|
case ProcessLUIDDeviceMapsEnabled:
|
||||||
DPRINT1("LUID Device Maps Not implemented: %lx\n", ProcessInformationClass);
|
/* Set the return length */
|
||||||
Status = STATUS_NOT_IMPLEMENTED;
|
Length = sizeof(ULONG);
|
||||||
|
if (ProcessInformationLength != Length)
|
||||||
|
{
|
||||||
|
Status = STATUS_INFO_LENGTH_MISMATCH;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Indicate success */
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
/* Protect write in SEH */
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
/* Return the count of handles */
|
||||||
|
*(PULONG)ProcessInformation = FALSE;
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
/* Get the exception code */
|
||||||
|
Status = _SEH2_GetExceptionCode();
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ProcessExecuteFlags:
|
case ProcessExecuteFlags:
|
||||||
|
|
Loading…
Reference in a new issue