minor fixes

svn path=/trunk/; revision=11412
This commit is contained in:
Thomas Bluemel 2004-10-24 12:26:27 +00:00
parent 0dd86887a1
commit 565f4d669b
3 changed files with 32 additions and 24 deletions

View file

@ -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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -31,17 +31,24 @@ CreateMutexA(LPSECURITY_ATTRIBUTES lpMutexAttributes,
ANSI_STRING Name; ANSI_STRING Name;
HANDLE Handle; HANDLE Handle;
RtlInitAnsiString(&Name, if (lpName != NULL)
(LPSTR)lpName); {
RtlAnsiStringToUnicodeString(&NameU, RtlInitAnsiString(&Name,
&Name, (LPSTR)lpName);
TRUE);
RtlAnsiStringToUnicodeString(&NameU,
&Name,
TRUE);
}
Handle = CreateMutexW(lpMutexAttributes, Handle = CreateMutexW(lpMutexAttributes,
bInitialOwner, bInitialOwner,
NameU.Buffer); (lpName ? NameU.Buffer : NULL));
RtlFreeUnicodeString(&NameU); if (lpName != NULL)
{
RtlFreeUnicodeString(&NameU);
}
return Handle; return Handle;
} }

View file

@ -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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -32,18 +32,24 @@ CreateSemaphoreA(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
ANSI_STRING Name; ANSI_STRING Name;
HANDLE Handle; HANDLE Handle;
RtlInitAnsiString(&Name, if (lpName != NULL)
(LPSTR)lpName); {
RtlAnsiStringToUnicodeString(&NameU, RtlInitAnsiString(&Name,
&Name, (LPSTR)lpName);
TRUE); RtlAnsiStringToUnicodeString(&NameU,
&Name,
TRUE);
}
Handle = CreateSemaphoreW(lpSemaphoreAttributes, Handle = CreateSemaphoreW(lpSemaphoreAttributes,
lInitialCount, lInitialCount,
lMaximumCount, lMaximumCount,
NameU.Buffer); (lpName ? NameU.Buffer : NULL));
RtlFreeUnicodeString (&NameU); if (lpName != NULL)
{
RtlFreeUnicodeString (&NameU);
}
return Handle; return Handle;
} }

View file

@ -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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -29,17 +29,12 @@ CreateWaitableTimerW(LPSECURITY_ATTRIBUTES lpTimerAttributes,
HANDLE TimerHandle; HANDLE TimerHandle;
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING UnicodeName; UNICODE_STRING UnicodeName;
ULONG TimerType;
if (bManualReset)
TimerType = NotificationTimer;
else
TimerType = SynchronizationTimer;
if (lpTimerName) if (lpTimerName)
{ {
RtlInitUnicodeString(&UnicodeName, lpTimerName); RtlInitUnicodeString(&UnicodeName, lpTimerName);
} }
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
(lpTimerName ? &UnicodeName : NULL), (lpTimerName ? &UnicodeName : NULL),
0, 0,
@ -58,7 +53,7 @@ CreateWaitableTimerW(LPSECURITY_ATTRIBUTES lpTimerAttributes,
Status = NtCreateTimer(&TimerHandle, Status = NtCreateTimer(&TimerHandle,
TIMER_ALL_ACCESS, TIMER_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
TimerType); (bManualReset ? NotificationTimer : SynchronizationTimer));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastErrorByStatus(Status); SetLastErrorByStatus(Status);