mirror of
https://github.com/reactos/reactos.git
synced 2025-08-01 19:22:58 +00:00
[NTOSKRNL]
Do not use _SEH2_YIELD in NtSetInformationProcess, NtQueryInformationThread and NtSetInformationThread while a thread or process is still being referenced. svn path=/trunk/; revision=47425
This commit is contained in:
parent
c916ce9d20
commit
c5cc4a4bd7
1 changed files with 46 additions and 24 deletions
|
@ -925,11 +925,13 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
/* Get the exception code */
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
/* Get the LPC Port */
|
||||
Status = ObReferenceObjectByHandle(PortHandle,
|
||||
0,
|
||||
|
@ -969,11 +971,13 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
/* Get the exception code */
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
/* Assign the actual token */
|
||||
Status = PspSetPrimaryToken(Process, TokenHandle, NULL);
|
||||
break;
|
||||
|
@ -1021,11 +1025,13 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
/* Get the exception code */
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
/* Setting the session id requires the SeTcbPrivilege */
|
||||
if (!SeSinglePrivilegeCheck(SeTcbPrivilege, PreviousMode))
|
||||
{
|
||||
|
@ -1089,10 +1095,12 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
|||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
/* Check for invalid PriorityClass value */
|
||||
if (PriorityClass.PriorityClass > PROCESS_PRIORITY_CLASS_ABOVE_NORMAL)
|
||||
{
|
||||
|
@ -1288,7 +1296,7 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
|
|||
Access = THREAD_SET_THREAD_TOKEN;
|
||||
}
|
||||
|
||||
/* Reference the process */
|
||||
/* Reference the thread */
|
||||
Status = ObReferenceObjectByHandle(ThreadHandle,
|
||||
Access,
|
||||
PsThreadType,
|
||||
|
@ -1318,11 +1326,13 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
/* Get the exception code */
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
/* Validate it */
|
||||
if ((Priority > HIGH_PRIORITY) ||
|
||||
(Priority <= LOW_PRIORITY))
|
||||
|
@ -1353,11 +1363,13 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
/* Get the exception code */
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
/* Validate it */
|
||||
if ((Priority > THREAD_BASE_PRIORITY_MAX) ||
|
||||
(Priority < THREAD_BASE_PRIORITY_MIN))
|
||||
|
@ -1398,8 +1410,8 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
/* Get the exception code */
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
|
@ -1465,11 +1477,13 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
/* Get the exception code */
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
/* Assign the actual token */
|
||||
Status = PsAssignImpersonationToken(Thread, TokenHandle);
|
||||
break;
|
||||
|
@ -1491,11 +1505,13 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
/* Get the exception code */
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
/* Set the address */
|
||||
Thread->Win32StartAddress = Address;
|
||||
break;
|
||||
|
@ -1517,11 +1533,13 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
/* Get the exception code */
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
/* Validate it */
|
||||
if (IdealProcessor > MAXIMUM_PROCESSORS)
|
||||
{
|
||||
|
@ -1564,11 +1582,13 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
/* Get the exception code */
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
/* Call the kernel */
|
||||
KeSetDisableBoostThread(&Thread->Tcb, (BOOLEAN)DisableBoost);
|
||||
break;
|
||||
|
@ -1590,11 +1610,13 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
/* Get the exception code */
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
/* This is only valid for the current thread */
|
||||
if (Thread != PsGetCurrentThread())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue