mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 07:52:57 +00:00
Patch to fix NtCreateSempahore, in the case where the initial lookup
succeeds. We previously left the function without initializing hSemaphore. Patch suggested by me and executed by hpoussin. svn path=/trunk/; revision=13483
This commit is contained in:
parent
231989d7ac
commit
73f1d215e0
1 changed files with 22 additions and 13 deletions
|
@ -128,6 +128,7 @@ NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
|
||||||
KeInitializeSemaphore(Semaphore,
|
KeInitializeSemaphore(Semaphore,
|
||||||
InitialCount,
|
InitialCount,
|
||||||
MaximumCount);
|
MaximumCount);
|
||||||
|
}
|
||||||
|
|
||||||
Status = ObInsertObject ((PVOID)Semaphore,
|
Status = ObInsertObject ((PVOID)Semaphore,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -136,12 +137,11 @@ NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
|
||||||
NULL,
|
NULL,
|
||||||
&hSemaphore);
|
&hSemaphore);
|
||||||
|
|
||||||
ObDereferenceObject(Semaphore);
|
|
||||||
|
|
||||||
if(NT_SUCCESS(Status))
|
if(NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
_SEH_TRY
|
_SEH_TRY
|
||||||
{
|
{
|
||||||
|
ObDereferenceObject(Semaphore);
|
||||||
*SemaphoreHandle = hSemaphore;
|
*SemaphoreHandle = hSemaphore;
|
||||||
}
|
}
|
||||||
_SEH_HANDLE
|
_SEH_HANDLE
|
||||||
|
@ -149,7 +149,16 @@ NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
|
||||||
Status = _SEH_GetExceptionCode();
|
Status = _SEH_GetExceptionCode();
|
||||||
}
|
}
|
||||||
_SEH_END;
|
_SEH_END;
|
||||||
|
} else {
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
|
*SemaphoreHandle = INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
Status = _SEH_GetExceptionCode();
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue