--- trunk/reactos/ntoskrnl/ex/mutant.c 2005-03-28 16:51:23 UTC (rev 14366)
+++ trunk/reactos/ntoskrnl/ex/mutant.c 2005-03-28 17:25:19 UTC (rev 14367)
@@ -294,16 +294,19 @@
IN PLONG PreviousCount OPTIONAL)
{
PKMUTANT Mutant;
- KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
+ KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
+
+ PreviousMode = ExGetPreviousMode();
+
DPRINT("NtReleaseMutant(MutantHandle 0%x PreviousCount 0%x)\n",
MutantHandle,
PreviousCount);
/* Check Output Safety */
- if(PreviousMode == UserMode && PreviousCount) {
+ if(PreviousMode != KernelMode && PreviousCount) {
_SEH_TRY {
@@ -330,7 +333,7 @@
/* Check for Success and release if such */
if(NT_SUCCESS(Status)) {
- LONG Prev;
+ LONG Prev = 0;
/* release the mutant. doing so might raise an exception which we're
required to catch! */