[NTOS]: Revert 47425 and apply a better fix.
svn path=/trunk/; revision=47426
PreviousMode,
(PVOID*)&Process,
NULL);
PreviousMode,
(PVOID*)&Process,
NULL);
- if (!NT_SUCCESS(Status))
- break;
+ if (!NT_SUCCESS(Status)) break;
/* Enter SEH for writing back data */
_SEH2_TRY
/* Enter SEH for writing back data */
_SEH2_TRY
PROCESS_SESSION_INFORMATION SessionInfo = {0};
PROCESS_PRIORITY_CLASS PriorityClass = {0};
PVOID ExceptionPort;
PROCESS_SESSION_INFORMATION SessionInfo = {0};
PROCESS_PRIORITY_CLASS PriorityClass = {0};
PVOID ExceptionPort;
PAGED_CODE();
/* Verify Information Class validity */
PAGED_CODE();
/* Verify Information Class validity */
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
- if (!NT_SUCCESS(Status)) break;
-
/* Get the LPC Port */
Status = ObReferenceObjectByHandle(PortHandle,
0,
/* Get the LPC Port */
Status = ObReferenceObjectByHandle(PortHandle,
0,
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
- if (!NT_SUCCESS(Status)) break;
-
/* Assign the actual token */
Status = PspSetPrimaryToken(Process, TokenHandle, NULL);
break;
/* Assign the actual token */
Status = PspSetPrimaryToken(Process, TokenHandle, NULL);
break;
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
- if (!NT_SUCCESS(Status)) break;
-
/* Setting the session id requires the SeTcbPrivilege */
if (!SeSinglePrivilegeCheck(SeTcbPrivilege, PreviousMode))
{
/* Setting the session id requires the SeTcbPrivilege */
if (!SeSinglePrivilegeCheck(SeTcbPrivilege, PreviousMode))
{
{
/* Return the exception code */
Status = _SEH2_GetExceptionCode();
{
/* Return the exception code */
Status = _SEH2_GetExceptionCode();
- if (!NT_SUCCESS(Status)) break;
-
/* Check for invalid PriorityClass value */
if (PriorityClass.PriorityClass > PROCESS_PRIORITY_CLASS_ABOVE_NORMAL)
{
/* Check for invalid PriorityClass value */
if (PriorityClass.PriorityClass > PROCESS_PRIORITY_CLASS_ABOVE_NORMAL)
{
- /* Setting 'break on termination' requires the SeDebugPrivilege */
- if (!SeSinglePrivilegeCheck(SeDebugPrivilege, PreviousMode))
- {
- Status = STATUS_PRIVILEGE_NOT_HELD;
- break;
- }
-
/* Enter SEH for direct buffer read */
_SEH2_TRY
{
/* Enter SEH for direct buffer read */
_SEH2_TRY
{
- Process->BreakOnTermination = *(PULONG)ProcessInformation;
+ Break = *(PULONG)ProcessInformation;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Get exception code */
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Get exception code */
Status = _SEH2_GetExceptionCode();
Status = _SEH2_GetExceptionCode();
+
+ /* Setting 'break on termination' requires the SeDebugPrivilege */
+ if (!SeSinglePrivilegeCheck(SeDebugPrivilege, PreviousMode))
+ {
+ Status = STATUS_PRIVILEGE_NOT_HELD;
+ break;
+ }
+
+ /* Set or clear the flag */
+ if (Break)
+ {
+ PspSetProcessFlag(Process, PSF_BREAK_ON_TERMINATION_BIT);
+ }
+ else
+ {
+ PspClearProcessFlag(Process, PSF_BREAK_ON_TERMINATION_BIT);
+ }
+
break;
/* We currently don't implement any of these */
break;
/* We currently don't implement any of these */
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
- if (!NT_SUCCESS(Status)) break;
-
/* Validate it */
if ((Priority > HIGH_PRIORITY) ||
(Priority <= LOW_PRIORITY))
/* Validate it */
if ((Priority > HIGH_PRIORITY) ||
(Priority <= LOW_PRIORITY))
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
- if (!NT_SUCCESS(Status)) break;
-
/* Validate it */
if ((Priority > THREAD_BASE_PRIORITY_MAX) ||
(Priority < THREAD_BASE_PRIORITY_MIN))
/* Validate it */
if ((Priority > THREAD_BASE_PRIORITY_MAX) ||
(Priority < THREAD_BASE_PRIORITY_MIN))
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
- if (!NT_SUCCESS(Status)) break;
-
/* Assign the actual token */
Status = PsAssignImpersonationToken(Thread, TokenHandle);
break;
/* Assign the actual token */
Status = PsAssignImpersonationToken(Thread, TokenHandle);
break;
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
- if (!NT_SUCCESS(Status)) break;
-
/* Set the address */
Thread->Win32StartAddress = Address;
break;
/* Set the address */
Thread->Win32StartAddress = Address;
break;
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
- if (!NT_SUCCESS(Status)) break;
-
/* Validate it */
if (IdealProcessor > MAXIMUM_PROCESSORS)
{
/* Validate it */
if (IdealProcessor > MAXIMUM_PROCESSORS)
{
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
- if (!NT_SUCCESS(Status)) break;
-
/* Call the kernel */
KeSetDisableBoostThread(&Thread->Tcb, (BOOLEAN)DisableBoost);
break;
/* Call the kernel */
KeSetDisableBoostThread(&Thread->Tcb, (BOOLEAN)DisableBoost);
break;
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
{
/* Get the exception code */
Status = _SEH2_GetExceptionCode();
- if (!NT_SUCCESS(Status)) break;
-
/* This is only valid for the current thread */
if (Thread != PsGetCurrentThread())
{
/* This is only valid for the current thread */
if (Thread != PsGetCurrentThread())
{