ReactOS  0.4.13-dev-247-g0f29b3f
event.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for event.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOLEAN INIT_FUNCTION NTAPI ExpInitializeEventImplementation (VOID)
 
NTSTATUS NTAPI NtClearEvent (IN HANDLE EventHandle)
 
NTSTATUS NTAPI NtCreateEvent (OUT PHANDLE EventHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN EVENT_TYPE EventType, IN BOOLEAN InitialState)
 
NTSTATUS NTAPI NtOpenEvent (OUT PHANDLE EventHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
 
NTSTATUS NTAPI NtPulseEvent (IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL)
 
NTSTATUS NTAPI NtQueryEvent (IN HANDLE EventHandle, IN EVENT_INFORMATION_CLASS EventInformationClass, OUT PVOID EventInformation, IN ULONG EventInformationLength, OUT PULONG ReturnLength OPTIONAL)
 
NTSTATUS NTAPI NtResetEvent (IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL)
 
NTSTATUS NTAPI NtSetEvent (IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL)
 
NTSTATUS NTAPI NtSetEventBoostPriority (IN HANDLE EventHandle)
 

Variables

POBJECT_TYPE ExEventObjectType = NULL
 
GENERIC_MAPPING ExpEventMapping
 
static const INFORMATION_CLASS_INFO ExEventInfoClass []
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file event.c.

Function Documentation

◆ ExpInitializeEventImplementation()

BOOLEAN INIT_FUNCTION NTAPI ExpInitializeEventImplementation ( VOID  )

Definition at line 43 of file event.c.

44 {
45  OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
48  DPRINT("Creating Event Object Type\n");
49 
50  /* Create the Event Object Type */
51  RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
52  RtlInitUnicodeString(&Name, L"Event");
53  ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
54  ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KEVENT);
55  ObjectTypeInitializer.GenericMapping = ExpEventMapping;
56  ObjectTypeInitializer.PoolType = NonPagedPool;
57  ObjectTypeInitializer.ValidAccessMask = EVENT_ALL_ACCESS;
58  ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
59  Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ExEventObjectType);
60  if (!NT_SUCCESS(Status)) return FALSE;
61  return TRUE;
62 }
NTSTATUS NTAPI ObCreateObjectType(IN PUNICODE_STRING TypeName, IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer, IN PVOID Reserved, OUT POBJECT_TYPE *ObjectType)
Definition: oblife.c:1048
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define OBJ_OPENLINK
Definition: winternl.h:230
POBJECT_TYPE ExEventObjectType
Definition: event.c:22
GENERIC_MAPPING ExpEventMapping
Definition: event.c:24
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
struct NameRec_ * Name
Definition: cdprocs.h:464
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _KEVENT KEVENT
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
GENERIC_MAPPING GenericMapping
Definition: obtypes.h:358
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
ULONG DefaultNonPagedPoolCharge
Definition: obtypes.h:365

Referenced by ExpInitSystemPhase1().

◆ NtClearEvent()

NTSTATUS NTAPI NtClearEvent ( IN HANDLE  EventHandle)

Definition at line 69 of file event.c.

70 {
71  PKEVENT Event;
73  PAGED_CODE();
74 
75  /* Reference the Object */
80  (PVOID*)&Event,
81  NULL);
82 
83  /* Check for Success */
84  if(NT_SUCCESS(Status))
85  {
86  /* Clear the Event and Dereference */
89  }
90 
91  /* Return Status */
92  return Status;
93 }
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:2982
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
POBJECT_TYPE ExEventObjectType
Definition: event.c:22
#define PAGED_CODE()
Definition: video.h:57
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:434
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define EVENT_MODIFY_STATE
Definition: winbase.h:163
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

◆ NtCreateEvent()

NTSTATUS NTAPI NtCreateEvent ( OUT PHANDLE  EventHandle,
IN ACCESS_MASK  DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes  OPTIONAL,
IN EVENT_TYPE  EventType,
IN BOOLEAN  InitialState 
)

Definition at line 100 of file event.c.

105 {
107  PKEVENT Event;
108  HANDLE hEvent;
110  PAGED_CODE();
111  DPRINT("NtCreateEvent(0x%p, 0x%x, 0x%p)\n",
113 
114  /* Check if we were called from user-mode */
115  if (PreviousMode != KernelMode)
116  {
117  /* Enter SEH Block */
118  _SEH2_TRY
119  {
120  /* Check handle pointer */
122  }
124  {
125  /* Return the exception code */
127  }
128  _SEH2_END;
129  }
130 
131  /* Create the Object */
135  PreviousMode,
136  NULL,
137  sizeof(KEVENT),
138  0,
139  0,
140  (PVOID*)&Event);
141 
142  /* Check for Success */
143  if (NT_SUCCESS(Status))
144  {
145  /* Initialize the Event */
147  EventType,
148  InitialState);
149 
150  /* Insert it */
152  NULL,
154  0,
155  NULL,
156  &hEvent);
157 
158  /* Check for success */
159  if (NT_SUCCESS(Status))
160  {
161  /* Enter SEH for return */
162  _SEH2_TRY
163  {
164  /* Return the handle to the caller */
165  *EventHandle = hEvent;
166  }
168  {
169  /* Get the exception code */
171  }
172  _SEH2_END;
173  }
174  }
175 
176  /* Return Status */
177  return Status;
178 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:2982
POBJECT_TYPE ExEventObjectType
Definition: event.c:22
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
static HANDLE hEvent
Definition: comm.c:54
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:434
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
NTSTATUS NTAPI ObCreateObject(IN KPROCESSOR_MODE ProbeMode OPTIONAL, IN POBJECT_TYPE Type, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext OPTIONAL, IN ULONG ObjectSize, IN ULONG PagedPoolCharge OPTIONAL, IN ULONG NonPagedPoolCharge OPTIONAL, OUT PVOID *Object)
Definition: oblife.c:952
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ EVENT_TYPE _In_ BOOLEAN InitialState
Definition: exfuncs.h:165
#define ProbeForWriteHandle(Ptr)
Definition: probe.h:43
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
NTSTATUS NTAPI ObInsertObject(IN PVOID Object, IN PACCESS_STATE AccessState OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG ObjectPointerBias, OUT PVOID *NewObject OPTIONAL, OUT PHANDLE Handle)
Definition: obhandle.c:2932
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ EVENT_TYPE EventType
Definition: exfuncs.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

Referenced by _At_(), AfdBind(), AfdConnect(), AfdGetInformation(), AfdSend(), AfdSendTo(), AfdSetInformation(), BaseSrvCreatePairWaitHandles(), ConDrvInitInputBuffer(), ConDrvPause(), ConSrvInitConsole(), CreateContext(), CSR_SERVER_DLL_INIT(), CsrApiPortInitialize(), GetSocketInformation(), GuiInit(), GuiInitFrontEnd(), InitializeUserModePnpManager(), LsaConnectUntrusted(), main(), ReadBlock(), RtlCreateTimerQueue(), RtlDeleteTimer(), RtlDeregisterWaitEx(), RtlRegisterWait(), SetSocketInformation(), SmpInit(), SmpLoadSubSystem(), SockCreateOrReferenceAsyncThread(), StartAuthenticationPort(), Test_recv(), UnhandledExceptionFilter(), WSPAccept(), WSPBind(), WSPCloseSocket(), WSPConnect(), WSPEnumNetworkEvents(), WSPEventSelect(), WSPGetPeerName(), WSPGetSockName(), WSPListen(), WSPRecv(), WSPRecvFrom(), WSPSelect(), WSPSend(), WSPSendTo(), and WSPShutdown().

◆ NtOpenEvent()

NTSTATUS NTAPI NtOpenEvent ( OUT PHANDLE  EventHandle,
IN ACCESS_MASK  DesiredAccess,
IN POBJECT_ATTRIBUTES  ObjectAttributes 
)

Definition at line 185 of file event.c.

188 {
189  HANDLE hEvent;
192  PAGED_CODE();
193  DPRINT("NtOpenEvent(0x%p, 0x%x, 0x%p)\n",
195 
196  /* Check if we were called from user-mode */
197  if (PreviousMode != KernelMode)
198  {
199  /* Enter SEH Block */
200  _SEH2_TRY
201  {
202  /* Check handle pointer */
204  }
206  {
207  /* Return the exception code */
209  }
210  _SEH2_END;
211  }
212 
213  /* Open the Object */
216  PreviousMode,
217  NULL,
219  NULL,
220  &hEvent);
221 
222  /* Check for success */
223  if (NT_SUCCESS(Status))
224  {
225  /* Enter SEH for return */
226  _SEH2_TRY
227  {
228  /* Return the handle to the caller */
229  *EventHandle = hEvent;
230  }
232  {
233  /* Get the exception code */
235  }
236  _SEH2_END;
237  }
238 
239  /* Return status */
240  return Status;
241 }
NTSTATUS NTAPI ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, IN PACCESS_STATE PassedAccessState, IN ACCESS_MASK DesiredAccess, IN OUT PVOID ParseContext, OUT PHANDLE Handle)
Definition: obhandle.c:2529
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:2982
POBJECT_TYPE ExEventObjectType
Definition: event.c:22
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
static HANDLE hEvent
Definition: comm.c:54
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ProbeForWriteHandle(Ptr)
Definition: probe.h:43
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

Referenced by CreateMemoryResourceNotification(), LsaConnectUntrusted(), LsapRmInitializeServer(), NtOpenObject(), and StartAuthenticationPort().

◆ NtPulseEvent()

NTSTATUS NTAPI NtPulseEvent ( IN HANDLE  EventHandle,
OUT PLONG PreviousState  OPTIONAL 
)

Definition at line 248 of file event.c.

250 {
251  PKEVENT Event;
254  PAGED_CODE();
255  DPRINT("NtPulseEvent(EventHandle 0%p PreviousState 0%p)\n",
257 
258  /* Check if we were called from user-mode */
260  {
261  /* Entry SEH Block */
262  _SEH2_TRY
263  {
264  /* Make sure the state pointer is valid */
266  }
268  {
269  /* Return the exception code */
271  }
272  _SEH2_END;
273  }
274 
275  /* Open the Object */
279  PreviousMode,
280  (PVOID*)&Event,
281  NULL);
282 
283  /* Check for success */
284  if(NT_SUCCESS(Status))
285  {
286  /* Pulse the Event */
289 
290  /* Check if caller wants the old state back */
291  if(PreviousState)
292  {
293  /* Entry SEH Block for return */
294  _SEH2_TRY
295  {
296  /* Return previous state */
297  *PreviousState = Prev;
298  }
300  {
301  /* Get the exception code */
303  }
304  _SEH2_END;
305  }
306  }
307 
308  /* Return Status */
309  return Status;
310 }
#define ProbeForWriteLong(Ptr)
Definition: probe.h:37
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:2982
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
POBJECT_TYPE ExEventObjectType
Definition: event.c:22
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
long LONG
Definition: pedump.c:60
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:434
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
LONG NTAPI KePulseEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:68
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
Status
Definition: gdiplustypes.h:24
_In_ PLARGE_INTEGER _In_opt_ PTIMER_APC_ROUTINE _In_opt_ PVOID _In_ BOOLEAN _In_opt_ LONG _Out_opt_ PBOOLEAN PreviousState
Definition: zwfuncs.h:428
_SEH2_END
Definition: create.c:4424
#define EVENT_INCREMENT
Definition: iotypes.h:564
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
#define EVENT_MODIFY_STATE
Definition: winbase.h:163
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

Referenced by PulseEvent().

◆ NtQueryEvent()

NTSTATUS NTAPI NtQueryEvent ( IN HANDLE  EventHandle,
IN EVENT_INFORMATION_CLASS  EventInformationClass,
OUT PVOID  EventInformation,
IN ULONG  EventInformationLength,
OUT PULONG ReturnLength  OPTIONAL 
)

Definition at line 317 of file event.c.

322 {
323  PKEVENT Event;
326  PEVENT_BASIC_INFORMATION BasicInfo =
327  (PEVENT_BASIC_INFORMATION)EventInformation;
328  PAGED_CODE();
329  DPRINT("NtQueryEvent(0x%p, 0x%x)\n", EventHandle, EventInformationClass);
330 
331  /* Check buffers and class validity */
332  Status = DefaultQueryInfoBufferCheck(EventInformationClass,
334  sizeof(ExEventInfoClass) /
335  sizeof(ExEventInfoClass[0]),
336  EventInformation,
337  EventInformationLength,
338  ReturnLength,
339  NULL,
340  PreviousMode);
341  if(!NT_SUCCESS(Status))
342  {
343  /* Invalid buffers */
344  DPRINT("NtQuerySemaphore() failed, Status: 0x%x\n", Status);
345  return Status;
346  }
347 
348  /* Get the Object */
352  PreviousMode,
353  (PVOID*)&Event,
354  NULL);
355 
356  /* Check for success */
357  if(NT_SUCCESS(Status))
358  {
359  /* Entry SEH Block */
360  _SEH2_TRY
361  {
362  /* Return Event Type and State */
363  BasicInfo->EventType = Event->Header.Type;
364  BasicInfo->EventState = KeReadStateEvent(Event);
365 
366  /* Return length */
368  }
370  {
371  /* Get the exception code */
373  }
374  _SEH2_END;
375 
376  /* Dereference the Object */
378  }
379 
380  /* Return status */
381  return Status;
382 }
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
static const INFORMATION_CLASS_INFO ExEventInfoClass[]
Definition: event.c:32
LONG NTSTATUS
Definition: precomp.h:26
#define EVENT_QUERY_STATE
Definition: security.c:53
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:2982
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
POBJECT_TYPE ExEventObjectType
Definition: event.c:22
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:434
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _EVENT_BASIC_INFORMATION EVENT_BASIC_INFORMATION
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
static __inline NTSTATUS DefaultQueryInfoBufferCheck(ULONG Class, const INFORMATION_CLASS_INFO *ClassList, ULONG ClassListEntries, PVOID Buffer, ULONG BufferLength, PULONG ReturnLength, PULONG_PTR ReturnLengthPtr, KPROCESSOR_MODE PreviousMode)
Definition: probe.h:59
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
struct _EVENT_BASIC_INFORMATION * PEVENT_BASIC_INFORMATION
LONG NTAPI KeReadStateEvent(IN PKEVENT Event)
Definition: eventobj.c:120
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
EVENT_TYPE EventType
Definition: extypes.h:731
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

Referenced by BaseCheckForVDM(), and QueryMemoryResourceNotification().

◆ NtResetEvent()

NTSTATUS NTAPI NtResetEvent ( IN HANDLE  EventHandle,
OUT PLONG PreviousState  OPTIONAL 
)

Definition at line 389 of file event.c.

391 {
392  PKEVENT Event;
395  PAGED_CODE();
396  DPRINT("NtResetEvent(EventHandle 0%p PreviousState 0%p)\n",
398 
399  /* Check if we were called from user-mode */
400  if ((PreviousState) && (PreviousMode != KernelMode))
401  {
402  /* Entry SEH Block */
403  _SEH2_TRY
404  {
405  /* Make sure the state pointer is valid */
407  }
409  {
410  /* Return the exception code */
412  }
413  _SEH2_END;
414  }
415 
416  /* Open the Object */
420  PreviousMode,
421  (PVOID*)&Event,
422  NULL);
423 
424  /* Check for success */
425  if(NT_SUCCESS(Status))
426  {
427  /* Reset the Event */
428  LONG Prev = KeResetEvent(Event);
430 
431  /* Check if caller wants the old state back */
432  if(PreviousState)
433  {
434  /* Entry SEH Block for return */
435  _SEH2_TRY
436  {
437  /* Return previous state */
438  *PreviousState = Prev;
439  }
441  {
442  /* Get the exception code */
444  }
445  _SEH2_END;
446  }
447  }
448 
449  /* Return Status */
450  return Status;
451 }
#define ProbeForWriteLong(Ptr)
Definition: probe.h:37
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:2982
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
POBJECT_TYPE ExEventObjectType
Definition: event.c:22
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
long LONG
Definition: pedump.c:60
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:434
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
Status
Definition: gdiplustypes.h:24
_In_ PLARGE_INTEGER _In_opt_ PTIMER_APC_ROUTINE _In_opt_ PVOID _In_ BOOLEAN _In_opt_ LONG _Out_opt_ PBOOLEAN PreviousState
Definition: zwfuncs.h:428
_SEH2_END
Definition: create.c:4424
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
LONG NTAPI KeResetEvent(IN PKEVENT Event)
Definition: eventobj.c:133
#define EVENT_MODIFY_STATE
Definition: winbase.h:163
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

Referenced by CSR_API(), DeviceInstallThread(), and ResetEvent().

◆ NtSetEvent()

NTSTATUS NTAPI NtSetEvent ( IN HANDLE  EventHandle,
OUT PLONG PreviousState  OPTIONAL 
)

Definition at line 458 of file event.c.

460 {
461  PKEVENT Event;
464  PAGED_CODE();
465  DPRINT("NtSetEvent(EventHandle 0%p PreviousState 0%p)\n",
467 
468  /* Check if we were called from user-mode */
469  if ((PreviousState) && (PreviousMode != KernelMode))
470  {
471  /* Entry SEH Block */
472  _SEH2_TRY
473  {
474  /* Make sure the state pointer is valid */
476  }
478  {
479  /* Return the exception code */
481  }
482  _SEH2_END;
483  }
484 
485  /* Open the Object */
489  PreviousMode,
490  (PVOID*)&Event,
491  NULL);
492  if (NT_SUCCESS(Status))
493  {
494  /* Set the Event */
497 
498  /* Check if caller wants the old state back */
499  if (PreviousState)
500  {
501  /* Entry SEH Block for return */
502  _SEH2_TRY
503  {
504  /* Return previous state */
505  *PreviousState = Prev;
506  }
508  {
510  }
511  _SEH2_END;
512  }
513  }
514 
515  /* Return Status */
516  return Status;
517 }
#define ProbeForWriteLong(Ptr)
Definition: probe.h:37
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:2982
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
POBJECT_TYPE ExEventObjectType
Definition: event.c:22
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
long LONG
Definition: pedump.c:60
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:434
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
Status
Definition: gdiplustypes.h:24
_In_ PLARGE_INTEGER _In_opt_ PTIMER_APC_ROUTINE _In_opt_ PVOID _In_ BOOLEAN _In_opt_ LONG _Out_opt_ PBOOLEAN PreviousState
Definition: zwfuncs.h:428
_SEH2_END
Definition: create.c:4424
#define EVENT_INCREMENT
Definition: iotypes.h:564
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
#define EVENT_MODIFY_STATE
Definition: winbase.h:163
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

Referenced by AddInputEvents(), BaseSrvCleanupVDMResources(), ConDrvUnpause(), ConSrvInitConsole(), CSR_API(), CsrApiRequestThread(), DeviceInstallThread(), GuiConsoleInputThread(), LsapRmInitializeServer(), OnNcCreate(), PnpEventThread(), queue_add_timer(), queue_remove_timer(), RtlDeleteTimerQueueEx(), RtlDeregisterWaitEx(), RtlpUnWaitCriticalSection(), SetEvent(), SmpHandleConnectionRequest(), SmpInit(), SmpLoadSubSystem(), StartAuthenticationPort(), and Wait_thread_proc().

◆ NtSetEventBoostPriority()

NTSTATUS NTAPI NtSetEventBoostPriority ( IN HANDLE  EventHandle)

Definition at line 524 of file event.c.

525 {
526  PKEVENT Event;
528  PAGED_CODE();
529 
530  /* Open the Object */
535  (PVOID*)&Event,
536  NULL);
537  if (NT_SUCCESS(Status))
538  {
539  /* Set the Event */
542  }
543 
544  /* Return Status */
545  return Status;
546 }
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:2982
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
POBJECT_TYPE ExEventObjectType
Definition: event.c:22
#define PAGED_CODE()
Definition: video.h:57
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:434
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define EVENT_MODIFY_STATE
Definition: winbase.h:163
VOID NTAPI KeSetEventBoostPriority(IN PKEVENT Event, IN PKTHREAD *WaitingThread OPTIONAL)
Definition: eventobj.c:229
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

Variable Documentation

◆ ExEventInfoClass

const INFORMATION_CLASS_INFO ExEventInfoClass[]
static
Initial value:
=
{
ICI_SQ_SAME( sizeof(EVENT_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY),
}
unsigned int ULONG
Definition: retypes.h:1

Definition at line 32 of file event.c.

Referenced by NtQueryEvent().

◆ ExEventObjectType

◆ ExpEventMapping

GENERIC_MAPPING ExpEventMapping
Initial value:
=
{
}
#define STANDARD_RIGHTS_WRITE
Definition: nt_native.h:66
#define EVENT_QUERY_STATE
Definition: security.c:53
#define STANDARD_RIGHTS_EXECUTE
Definition: nt_native.h:67
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
#define STANDARD_RIGHTS_READ
Definition: nt_native.h:65
#define SYNCHRONIZE
Definition: nt_native.h:61
#define EVENT_MODIFY_STATE
Definition: winbase.h:163

Definition at line 24 of file event.c.

Referenced by ExpInitializeEventImplementation().