2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/kernel32/synch/event.c
5 * PURPOSE: Local string functions
6 * PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
11 #include <ddk/ntddk.h>
24 errCode
= NtSetEvent(hEvent
,&Count
);
25 if ( !NT_SUCCESS(errCode
) ) {
26 SetLastError(RtlNtStatusToDosError(errCode
));
40 errCode
= NtResetEvent(hEvent
, &Count
);
41 if ( !NT_SUCCESS(errCode
) ) {
42 SetLastError(RtlNtStatusToDosError(errCode
));
53 LPSECURITY_ATTRIBUTES lpEventAttributes
,
55 WINBOOL bInitialState
,
61 UNICODE_STRING EventNameString
;
62 OBJECT_ATTRIBUTES ObjectAttributes
;
63 ObjectAttributes
.Attributes
= 0;
64 if ( lpEventAttributes
!= NULL
) {
65 ObjectAttributes
.SecurityDescriptor
= lpEventAttributes
->lpSecurityDescriptor
;
66 if ( lpEventAttributes
->bInheritHandle
== TRUE
)
67 ObjectAttributes
.Attributes
|= OBJ_INHERIT
;
73 EventNameString
.Buffer
= (WCHAR
*)lpName
;
74 EventNameString
.Length
= lstrlenW(lpName
)*sizeof(WCHAR
);
75 EventNameString
.MaximumLength
= EventNameString
.Length
;
76 ObjectAttributes
.ObjectName
= &EventNameString
;
79 ObjectAttributes
.ObjectName
= NULL
;
83 errCode
= NtCreateEvent(&hEvent
,STANDARD_RIGHTS_ALL
|EVENT_READ_ACCESS
|EVENT_WRITE_ACCESS
,&ObjectAttributes
,bManualReset
,bInitialState
);
84 if(!NT_SUCCESS(errCode
)) {
85 SetLastError(RtlNtStatusToDosError(errCode
));
97 DWORD dwDesiredAccess
,
98 WINBOOL bInheritHandle
,
102 OBJECT_ATTRIBUTES ObjectAttributes
;
103 UNICODE_STRING EventNameString
;
105 HANDLE hEvent
= NULL
;
108 SetLastError(ERROR_INVALID_PARAMETER
);
112 ObjectAttributes
.Attributes
= 0;
113 ObjectAttributes
.SecurityDescriptor
= NULL
;
114 EventNameString
.Buffer
= (WCHAR
*)lpName
;
115 EventNameString
.Length
= lstrlenW(lpName
)*sizeof(WCHAR
);
116 EventNameString
.MaximumLength
= EventNameString
.Length
;
117 ObjectAttributes
.ObjectName
= &EventNameString
;
119 if (bInheritHandle
== TRUE
)
120 ObjectAttributes
.Attributes
|= OBJ_INHERIT
;
123 errCode
= NtOpenEvent(hEvent
,dwDesiredAccess
,&ObjectAttributes
);
124 if ( !NT_SUCCESS(errCode
) ) {
125 SetLastError(RtlNtStatusToDosError(errCode
));
136 LPSECURITY_ATTRIBUTES lpEventAttributes
,
137 WINBOOL bManualReset
,
138 WINBOOL bInitialState
,
143 WCHAR EventNameW
[MAX_PATH
];
145 while ((*lpName
)!=0 && i
< MAX_PATH
)
147 EventNameW
[i
] = *lpName
;
153 return CreateEventW(lpEventAttributes
,bManualReset
,bInitialState
,EventNameW
);
160 DWORD dwDesiredAccess
,
161 WINBOOL bInheritHandle
,
166 WCHAR EventNameW
[MAX_PATH
];
171 while ((*lpName
)!=0 && i
< MAX_PATH
)
173 EventNameW
[i
] = *lpName
;
180 return OpenEventW(dwDesiredAccess
,bInheritHandle
,EventNameW
);
191 errCode
= NtPulseEvent(hEvent
,&Count
);
192 if ( !NT_SUCCESS(errCode
) ) {
193 SetLastError(RtlNtStatusToDosError(errCode
));