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 ****************************************************************/
22 CreateEventA(LPSECURITY_ATTRIBUTES lpEventAttributes,
24 WINBOOL bInitialState,
27 UNICODE_STRING EventNameU;
28 ANSI_STRING EventName;
31 RtlInitUnicodeString (&EventNameU, NULL);
35 RtlInitAnsiString(&EventName,
37 RtlAnsiStringToUnicodeString(&EventNameU,
42 EventHandle = CreateEventW(lpEventAttributes,
49 RtlFreeUnicodeString(&EventNameU);
57 CreateEventW(LPSECURITY_ATTRIBUTES lpEventAttributes,
59 WINBOOL bInitialState,
64 UNICODE_STRING EventNameString;
65 POBJECT_ATTRIBUTES PtrObjectAttributes;
66 OBJECT_ATTRIBUTES ObjectAttributes;
68 ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
69 ObjectAttributes.RootDirectory = hBaseDir;
70 ObjectAttributes.ObjectName = NULL;
71 ObjectAttributes.Attributes = 0;
72 ObjectAttributes.SecurityDescriptor = NULL;
73 ObjectAttributes.SecurityQualityOfService = NULL;
77 RtlInitUnicodeString(&EventNameString, (LPWSTR)lpName);
78 ObjectAttributes.ObjectName = &EventNameString;
81 Status = NtCreateEvent(&hEvent,
82 STANDARD_RIGHTS_ALL|EVENT_READ_ACCESS|EVENT_WRITE_ACCESS,
87 if (!NT_SUCCESS(Status))
89 SetLastErrorByStatus(Status);
98 OpenEventA(DWORD dwDesiredAccess,
99 WINBOOL bInheritHandle,
102 UNICODE_STRING EventNameU;
103 ANSI_STRING EventName;
106 RtlInitUnicodeString(&EventNameU,
111 RtlInitAnsiString(&EventName,
113 RtlAnsiStringToUnicodeString(&EventNameU,
118 EventHandle = OpenEventW(dwDesiredAccess,
124 RtlFreeUnicodeString(&EventNameU);
132 OpenEventW(DWORD dwDesiredAccess,
133 WINBOOL bInheritHandle,
136 OBJECT_ATTRIBUTES ObjectAttributes;
137 UNICODE_STRING EventNameString;
139 HANDLE hEvent = NULL;
143 SetLastError(ERROR_INVALID_PARAMETER);
147 RtlInitUnicodeString(&EventNameString, (LPWSTR)lpName);
149 ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
150 ObjectAttributes.RootDirectory = hBaseDir;
151 ObjectAttributes.ObjectName = &EventNameString;
152 ObjectAttributes.Attributes = 0;
153 ObjectAttributes.SecurityDescriptor = NULL;
154 ObjectAttributes.SecurityQualityOfService = NULL;
155 if (bInheritHandle == TRUE)
157 ObjectAttributes.Attributes |= OBJ_INHERIT;
160 Status = NtOpenEvent(&hEvent,
163 if (!NT_SUCCESS(Status))
165 SetLastErrorByStatus(Status);
174 PulseEvent(HANDLE hEvent)
179 Status = NtPulseEvent(hEvent,
181 if (!NT_SUCCESS(Status))
183 SetLastErrorByStatus (Status);
192 ResetEvent(HANDLE hEvent)
197 Status = NtResetEvent(hEvent,
199 if (!NT_SUCCESS(Status))
201 SetLastErrorByStatus(Status);
210 SetEvent(HANDLE hEvent)
215 Status = NtSetEvent(hEvent,
217 if (!NT_SUCCESS(Status))
219 SetLastErrorByStatus(Status);