mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed bug that caused a crash when creating an unnamed semaphore.
svn path=/trunk/; revision=1458
This commit is contained in:
parent
4dc42b4202
commit
d3f5f7862f
1 changed files with 5 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: wait.c,v 1.12 2000/07/01 17:07:02 ea Exp $
|
/* $Id: wait.c,v 1.13 2000/12/08 22:08:02 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
|
@ -57,25 +57,23 @@ CreateSemaphoreW(
|
||||||
NTSTATUS errCode;
|
NTSTATUS errCode;
|
||||||
UNICODE_STRING NameString;
|
UNICODE_STRING NameString;
|
||||||
HANDLE SemaphoreHandle;
|
HANDLE SemaphoreHandle;
|
||||||
|
if (lpName)
|
||||||
NameString.Length = lstrlenW(lpName)*sizeof(WCHAR);
|
NameString.Length = lstrlenW(lpName)*sizeof(WCHAR);
|
||||||
|
else
|
||||||
|
NameString.Length = 0;
|
||||||
NameString.Buffer = (WCHAR *)lpName;
|
NameString.Buffer = (WCHAR *)lpName;
|
||||||
NameString.MaximumLength = NameString.Length;
|
NameString.MaximumLength = NameString.Length;
|
||||||
|
|
||||||
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
|
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
|
||||||
ObjectAttributes.RootDirectory = NULL;
|
ObjectAttributes.RootDirectory = NULL;
|
||||||
ObjectAttributes.ObjectName = &NameString;
|
ObjectAttributes.ObjectName = &NameString;
|
||||||
ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE;
|
ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE;
|
||||||
ObjectAttributes.SecurityDescriptor = NULL;
|
ObjectAttributes.SecurityDescriptor = NULL;
|
||||||
ObjectAttributes.SecurityQualityOfService = NULL;
|
ObjectAttributes.SecurityQualityOfService = NULL;
|
||||||
|
|
||||||
if ( lpSemaphoreAttributes != NULL ) {
|
if ( lpSemaphoreAttributes != NULL ) {
|
||||||
ObjectAttributes.SecurityDescriptor = lpSemaphoreAttributes->lpSecurityDescriptor;
|
ObjectAttributes.SecurityDescriptor = lpSemaphoreAttributes->lpSecurityDescriptor;
|
||||||
if ( lpSemaphoreAttributes->bInheritHandle == TRUE )
|
if ( lpSemaphoreAttributes->bInheritHandle == TRUE )
|
||||||
ObjectAttributes.Attributes |= OBJ_INHERIT;
|
ObjectAttributes.Attributes |= OBJ_INHERIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
errCode = NtCreateSemaphore(
|
errCode = NtCreateSemaphore(
|
||||||
&SemaphoreHandle,
|
&SemaphoreHandle,
|
||||||
GENERIC_ALL,
|
GENERIC_ALL,
|
||||||
|
@ -88,7 +86,6 @@ CreateSemaphoreW(
|
||||||
SetLastErrorByStatus (errCode);
|
SetLastErrorByStatus (errCode);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SemaphoreHandle;
|
return SemaphoreHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue