diff --git a/reactos/lib/kernel32/synch/mutex.c b/reactos/lib/kernel32/synch/mutex.c index e4590103fff..876b01b88bf 100644 --- a/reactos/lib/kernel32/synch/mutex.c +++ b/reactos/lib/kernel32/synch/mutex.c @@ -1,4 +1,4 @@ -/* $Id: mutex.c,v 1.9 2004/10/24 12:16:54 weiden Exp $ +/* $Id: mutex.c,v 1.10 2004/10/24 12:26:26 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -31,17 +31,24 @@ CreateMutexA(LPSECURITY_ATTRIBUTES lpMutexAttributes, ANSI_STRING Name; HANDLE Handle; - RtlInitAnsiString(&Name, - (LPSTR)lpName); - RtlAnsiStringToUnicodeString(&NameU, - &Name, - TRUE); + if (lpName != NULL) + { + RtlInitAnsiString(&Name, + (LPSTR)lpName); + + RtlAnsiStringToUnicodeString(&NameU, + &Name, + TRUE); + } Handle = CreateMutexW(lpMutexAttributes, bInitialOwner, - NameU.Buffer); + (lpName ? NameU.Buffer : NULL)); - RtlFreeUnicodeString(&NameU); + if (lpName != NULL) + { + RtlFreeUnicodeString(&NameU); + } return Handle; } diff --git a/reactos/lib/kernel32/synch/sem.c b/reactos/lib/kernel32/synch/sem.c index bac888ddb3a..5f78cbdd22d 100644 --- a/reactos/lib/kernel32/synch/sem.c +++ b/reactos/lib/kernel32/synch/sem.c @@ -1,4 +1,4 @@ -/* $Id: sem.c,v 1.9 2004/10/24 12:16:54 weiden Exp $ +/* $Id: sem.c,v 1.10 2004/10/24 12:26:27 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -32,18 +32,24 @@ CreateSemaphoreA(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, ANSI_STRING Name; HANDLE Handle; - RtlInitAnsiString(&Name, - (LPSTR)lpName); - RtlAnsiStringToUnicodeString(&NameU, - &Name, - TRUE); + if (lpName != NULL) + { + RtlInitAnsiString(&Name, + (LPSTR)lpName); + RtlAnsiStringToUnicodeString(&NameU, + &Name, + TRUE); + } Handle = CreateSemaphoreW(lpSemaphoreAttributes, lInitialCount, lMaximumCount, - NameU.Buffer); + (lpName ? NameU.Buffer : NULL)); - RtlFreeUnicodeString (&NameU); + if (lpName != NULL) + { + RtlFreeUnicodeString (&NameU); + } return Handle; } diff --git a/reactos/lib/kernel32/synch/timer.c b/reactos/lib/kernel32/synch/timer.c index 99da6b0867b..82707998fe2 100644 --- a/reactos/lib/kernel32/synch/timer.c +++ b/reactos/lib/kernel32/synch/timer.c @@ -1,4 +1,4 @@ -/* $Id: timer.c,v 1.17 2004/10/24 12:16:54 weiden Exp $ +/* $Id: timer.c,v 1.18 2004/10/24 12:26:27 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -29,17 +29,12 @@ CreateWaitableTimerW(LPSECURITY_ATTRIBUTES lpTimerAttributes, HANDLE TimerHandle; OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING UnicodeName; - ULONG TimerType; - - if (bManualReset) - TimerType = NotificationTimer; - else - TimerType = SynchronizationTimer; if (lpTimerName) { RtlInitUnicodeString(&UnicodeName, lpTimerName); } + InitializeObjectAttributes(&ObjectAttributes, (lpTimerName ? &UnicodeName : NULL), 0, @@ -58,7 +53,7 @@ CreateWaitableTimerW(LPSECURITY_ATTRIBUTES lpTimerAttributes, Status = NtCreateTimer(&TimerHandle, TIMER_ALL_ACCESS, &ObjectAttributes, - TimerType); + (bManualReset ? NotificationTimer : SynchronizationTimer)); if (!NT_SUCCESS(Status)) { SetLastErrorByStatus(Status);