3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS system libraries
5 * FILE: lib/kernel32/synch/event.c
6 * PURPOSE: Local string functions
7 * PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
12 /* INCLUDES *****************************************************************/
17 #include <kernel32/kernel32.h>
19 /* FUNCTIONS ****************************************************************/
25 CreateEventA(LPSECURITY_ATTRIBUTES lpEventAttributes,
27 WINBOOL bInitialState,
30 UNICODE_STRING EventNameU;
31 ANSI_STRING EventName;
34 RtlInitUnicodeString (&EventNameU, NULL);
38 RtlInitAnsiString(&EventName,
40 RtlAnsiStringToUnicodeString(&EventNameU,
45 EventHandle = CreateEventW(lpEventAttributes,
52 RtlFreeUnicodeString(&EventNameU);
63 CreateEventW(LPSECURITY_ATTRIBUTES lpEventAttributes,
65 WINBOOL bInitialState,
70 UNICODE_STRING EventNameString;
71 OBJECT_ATTRIBUTES ObjectAttributes;
73 ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
74 ObjectAttributes.RootDirectory = hBaseDir;
75 ObjectAttributes.ObjectName = NULL;
76 ObjectAttributes.Attributes = 0;
77 ObjectAttributes.SecurityDescriptor = NULL;
78 ObjectAttributes.SecurityQualityOfService = NULL;
82 RtlInitUnicodeString(&EventNameString, (LPWSTR)lpName);
83 ObjectAttributes.ObjectName = &EventNameString;
86 Status = NtCreateEvent(&hEvent,
87 STANDARD_RIGHTS_ALL|EVENT_READ_ACCESS|EVENT_WRITE_ACCESS,
92 if (!NT_SUCCESS(Status))
94 SetLastErrorByStatus(Status);
106 OpenEventA(DWORD dwDesiredAccess,
107 WINBOOL bInheritHandle,
110 UNICODE_STRING EventNameU;
111 ANSI_STRING EventName;
114 RtlInitUnicodeString(&EventNameU,
119 RtlInitAnsiString(&EventName,
121 RtlAnsiStringToUnicodeString(&EventNameU,
126 EventHandle = OpenEventW(dwDesiredAccess,
132 RtlFreeUnicodeString(&EventNameU);
143 OpenEventW(DWORD dwDesiredAccess,
144 WINBOOL bInheritHandle,
147 OBJECT_ATTRIBUTES ObjectAttributes;
148 UNICODE_STRING EventNameString;
150 HANDLE hEvent = NULL;
154 SetLastError(ERROR_INVALID_PARAMETER);
158 RtlInitUnicodeString(&EventNameString, (LPWSTR)lpName);
160 ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
161 ObjectAttributes.RootDirectory = hBaseDir;
162 ObjectAttributes.ObjectName = &EventNameString;
163 ObjectAttributes.Attributes = 0;
164 ObjectAttributes.SecurityDescriptor = NULL;
165 ObjectAttributes.SecurityQualityOfService = NULL;
166 if (bInheritHandle == TRUE)
168 ObjectAttributes.Attributes |= OBJ_INHERIT;
171 Status = NtOpenEvent(&hEvent,
174 if (!NT_SUCCESS(Status))
176 SetLastErrorByStatus(Status);
188 PulseEvent(HANDLE hEvent)
193 Status = NtPulseEvent(hEvent,
195 if (!NT_SUCCESS(Status))
197 SetLastErrorByStatus (Status);
209 ResetEvent(HANDLE hEvent)
214 Status = NtResetEvent(hEvent,
216 if (!NT_SUCCESS(Status))
218 SetLastErrorByStatus(Status);
230 SetEvent(HANDLE hEvent)
235 Status = NtSetEvent(hEvent,
237 if (!NT_SUCCESS(Status))
239 SetLastErrorByStatus(Status);