mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
release the dispatcher lock in KeReleaseMutant before raising an exception and handle the exception in NtReleaseMutant
svn path=/trunk/; revision=14363
This commit is contained in:
parent
f3fc2ca494
commit
d295d5da57
2 changed files with 28 additions and 14 deletions
|
@ -332,23 +332,35 @@ NtReleaseMutant(IN HANDLE MutantHandle,
|
||||||
|
|
||||||
LONG Prev;
|
LONG Prev;
|
||||||
|
|
||||||
/* Save the Old State */
|
/* release the mutant. doing so might raise an exception which we're
|
||||||
DPRINT("Releasing Mutant\n");
|
required to catch! */
|
||||||
Prev = KeReleaseMutant(Mutant, MUTANT_INCREMENT, FALSE, FALSE);
|
_SEH_TRY {
|
||||||
|
|
||||||
|
Prev = KeReleaseMutant(Mutant, MUTANT_INCREMENT, FALSE, FALSE);
|
||||||
|
|
||||||
|
} _SEH_HANDLE {
|
||||||
|
|
||||||
|
Status = _SEH_GetExceptionCode();
|
||||||
|
|
||||||
|
} _SEH_END;
|
||||||
|
|
||||||
ObDereferenceObject(Mutant);
|
ObDereferenceObject(Mutant);
|
||||||
|
|
||||||
/* Return it */
|
if(NT_SUCCESS(Status)) {
|
||||||
if(PreviousCount) {
|
|
||||||
|
/* Return it */
|
||||||
_SEH_TRY {
|
if(PreviousCount) {
|
||||||
|
|
||||||
|
_SEH_TRY {
|
||||||
|
|
||||||
|
*PreviousCount = Prev;
|
||||||
|
|
||||||
|
} _SEH_HANDLE {
|
||||||
|
|
||||||
*PreviousCount = Prev;
|
Status = _SEH_GetExceptionCode();
|
||||||
|
|
||||||
} _SEH_HANDLE {
|
} _SEH_END;
|
||||||
|
}
|
||||||
Status = _SEH_GetExceptionCode();
|
|
||||||
|
|
||||||
} _SEH_END;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,8 @@ KeReleaseMutant(IN PKMUTANT Mutant,
|
||||||
/* Make sure that the Owner Thread is the current Thread */
|
/* Make sure that the Owner Thread is the current Thread */
|
||||||
if (Mutant->OwnerThread != CurrentThread) {
|
if (Mutant->OwnerThread != CurrentThread) {
|
||||||
|
|
||||||
|
KeReleaseDispatcherDatabaseLock(OldIrql);
|
||||||
|
|
||||||
DPRINT1("Trying to touch a Mutant that the caller doesn't own!\n");
|
DPRINT1("Trying to touch a Mutant that the caller doesn't own!\n");
|
||||||
ExRaiseStatus(STATUS_MUTANT_NOT_OWNED);
|
ExRaiseStatus(STATUS_MUTANT_NOT_OWNED);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue