ReactOS  0.4.15-dev-1392-g3014417
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 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 NTAPI ExpInitializeEventImplementation ( VOID  )

Definition at line 39 of file event.c.

40 {
41  OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
44  DPRINT("Creating Event Object Type\n");
45 
46  /* Create the Event Object Type */
47  RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
48  RtlInitUnicodeString(&Name, L"Event");
49  ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
50  ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KEVENT);
51  ObjectTypeInitializer.GenericMapping = ExpEventMapping;
52  ObjectTypeInitializer.PoolType = NonPagedPool;
53  ObjectTypeInitializer.ValidAccessMask = EVENT_ALL_ACCESS;
54  ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
55  Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ExEventObjectType);
56  if (!NT_SUCCESS(Status)) return FALSE;
57  return TRUE;
58 }
#define OBJ_OPENLINK
Definition: winternl.h:230
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
POBJECT_TYPE ExEventObjectType
Definition: event.c:18
#define FALSE
Definition: types.h:117
GENERIC_MAPPING ExpEventMapping
Definition: event.c:20
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
struct NameRec_ * Name
Definition: cdprocs.h:459
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _KEVENT KEVENT
static const WCHAR L[]
Definition: oid.c:1250
GENERIC_MAPPING GenericMapping
Definition: obtypes.h:358
#define NULL
Definition: types.h:112
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
ULONG DefaultNonPagedPoolCharge
Definition: obtypes.h:365

Referenced by ExpInitSystemPhase1().

◆ NtClearEvent()

NTSTATUS NTAPI NtClearEvent ( IN HANDLE  EventHandle)

Definition at line 65 of file event.c.

66 {
67  PKEVENT Event;
69  PAGED_CODE();
70 
71  /* Reference the Object */
76  (PVOID*)&Event,
77  NULL);
78 
79  /* Check for Success */
80  if(NT_SUCCESS(Status))
81  {
82  /* Clear the Event and Dereference */
85  }
86 
87  /* Return Status */
88  return Status;
89 }
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
POBJECT_TYPE ExEventObjectType
Definition: event.c:18
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:450
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ObDereferenceObject
Definition: obfuncs.h:203
#define NULL
Definition: types.h:112
#define EVENT_MODIFY_STATE
Definition: winbase.h:163
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
#define PAGED_CODE()
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

Referenced by ConDrvFlushConsoleInputBuffer(), ConDrvGetConsoleInput(), and ConSrvTermReadStream().

◆ 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 96 of file event.c.

101 {
103  PKEVENT Event;
104  HANDLE hEvent;
106  PAGED_CODE();
107  DPRINT("NtCreateEvent(0x%p, 0x%x, 0x%p)\n",
109 
110  /* Check if we were called from user-mode */
111  if (PreviousMode != KernelMode)
112  {
113  /* Enter SEH Block */
114  _SEH2_TRY
115  {
116  /* Check handle pointer */
118  }
120  {
121  /* Return the exception code */
123  }
124  _SEH2_END;
125  }
126 
127  /* Create the Object */
131  PreviousMode,
132  NULL,
133  sizeof(KEVENT),
134  0,
135  0,
136  (PVOID*)&Event);
137 
138  /* Check for Success */
139  if (NT_SUCCESS(Status))
140  {
141  /* Initialize the Event */
143  EventType,
144  InitialState);
145 
146  /* Insert it */
148  NULL,
150  0,
151  NULL,
152  &hEvent);
153 
154  /* Check for success */
155  if (NT_SUCCESS(Status))
156  {
157  /* Enter SEH for return */
158  _SEH2_TRY
159  {
160  /* Return the handle to the caller */
161  *EventHandle = hEvent;
162  }
164  {
165  /* Get the exception code */
167  }
168  _SEH2_END;
169  }
170  }
171 
172  /* Return Status */
173  return Status;
174 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2654
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
POBJECT_TYPE ExEventObjectType
Definition: event.c:18
_SEH2_TRY
Definition: create.c:4226
static HANDLE hEvent
Definition: comm.c:54
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:450
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
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
Status
Definition: gdiplustypes.h:24
_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
_SEH2_END
Definition: create.c:4400
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
#define NULL
Definition: types.h:112
_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
#define PAGED_CODE()
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

Referenced by _At_(), AfdBind(), AfdConnect(), AfdGetInformation(), AfdSend(), AfdSendTo(), AfdSetInformation(), BaseSrvCreatePairWaitHandles(), ConDrvInitInputBuffer(), 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 181 of file event.c.

184 {
185  HANDLE hEvent;
188  PAGED_CODE();
189  DPRINT("NtOpenEvent(0x%p, 0x%x, 0x%p)\n",
191 
192  /* Check if we were called from user-mode */
193  if (PreviousMode != KernelMode)
194  {
195  /* Enter SEH Block */
196  _SEH2_TRY
197  {
198  /* Check handle pointer */
200  }
202  {
203  /* Return the exception code */
205  }
206  _SEH2_END;
207  }
208 
209  /* Open the Object */
212  PreviousMode,
213  NULL,
215  NULL,
216  &hEvent);
217 
218  /* Check for success */
219  if (NT_SUCCESS(Status))
220  {
221  /* Enter SEH for return */
222  _SEH2_TRY
223  {
224  /* Return the handle to the caller */
225  *EventHandle = hEvent;
226  }
228  {
229  /* Get the exception code */
231  }
232  _SEH2_END;
233  }
234 
235  /* Return status */
236  return Status;
237 }
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
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2654
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
POBJECT_TYPE ExEventObjectType
Definition: event.c:18
_SEH2_TRY
Definition: create.c:4226
static HANDLE hEvent
Definition: comm.c:54
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
_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
_SEH2_END
Definition: create.c:4400
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
#define NULL
Definition: types.h:112
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define PAGED_CODE()
_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 244 of file event.c.

246 {
247  PKEVENT Event;
250  PAGED_CODE();
251  DPRINT("NtPulseEvent(EventHandle 0%p PreviousState 0%p)\n",
253 
254  /* Check if we were called from user-mode */
256  {
257  /* Entry SEH Block */
258  _SEH2_TRY
259  {
260  /* Make sure the state pointer is valid */
262  }
264  {
265  /* Return the exception code */
267  }
268  _SEH2_END;
269  }
270 
271  /* Open the Object */
275  PreviousMode,
276  (PVOID*)&Event,
277  NULL);
278 
279  /* Check for success */
280  if(NT_SUCCESS(Status))
281  {
282  /* Pulse the Event */
285 
286  /* Check if caller wants the old state back */
287  if(PreviousState)
288  {
289  /* Entry SEH Block for return */
290  _SEH2_TRY
291  {
292  /* Return previous state */
293  *PreviousState = Prev;
294  }
296  {
297  /* Get the exception code */
299  }
300  _SEH2_END;
301  }
302  }
303 
304  /* Return Status */
305  return Status;
306 }
#define ProbeForWriteLong(Ptr)
Definition: probe.h:37
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
POBJECT_TYPE ExEventObjectType
Definition: event.c:18
_SEH2_TRY
Definition: create.c:4226
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
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:450
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
void DPRINT(...)
Definition: polytest.cpp:61
LONG NTAPI KePulseEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:68
Status
Definition: gdiplustypes.h:24
_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 ObDereferenceObject
Definition: obfuncs.h:203
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
_SEH2_END
Definition: create.c:4400
#define EVENT_INCREMENT
Definition: iotypes.h:580
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
#define NULL
Definition: types.h:112
#define EVENT_MODIFY_STATE
Definition: winbase.h:163
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
_In_ WDF_POWER_DEVICE_STATE PreviousState
Definition: wdfdevice.h:829
#define PAGED_CODE()
_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 313 of file event.c.

318 {
319  PKEVENT Event;
322  PEVENT_BASIC_INFORMATION BasicInfo =
323  (PEVENT_BASIC_INFORMATION)EventInformation;
324  PAGED_CODE();
325  DPRINT("NtQueryEvent(0x%p, 0x%x)\n", EventHandle, EventInformationClass);
326 
327  /* Check buffers and class validity */
328  Status = DefaultQueryInfoBufferCheck(EventInformationClass,
330  sizeof(ExEventInfoClass) /
331  sizeof(ExEventInfoClass[0]),
332  EventInformation,
333  EventInformationLength,
334  ReturnLength,
335  NULL,
336  PreviousMode);
337  if(!NT_SUCCESS(Status))
338  {
339  /* Invalid buffers */
340  DPRINT("NtQuerySemaphore() failed, Status: 0x%x\n", Status);
341  return Status;
342  }
343 
344  /* Get the Object */
348  PreviousMode,
349  (PVOID*)&Event,
350  NULL);
351 
352  /* Check for success */
353  if(NT_SUCCESS(Status))
354  {
355  /* Entry SEH Block */
356  _SEH2_TRY
357  {
358  /* Return Event Type and State */
359  BasicInfo->EventType = Event->Header.Type;
360  BasicInfo->EventState = KeReadStateEvent(Event);
361 
362  /* Return length */
364  }
366  {
367  /* Get the exception code */
369  }
370  _SEH2_END;
371 
372  /* Dereference the Object */
374  }
375 
376  /* Return status */
377  return Status;
378 }
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
static const INFORMATION_CLASS_INFO ExEventInfoClass[]
Definition: event.c:28
LONG NTSTATUS
Definition: precomp.h:26
#define EVENT_QUERY_STATE
Definition: security.c:53
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
POBJECT_TYPE ExEventObjectType
Definition: event.c:18
_SEH2_TRY
Definition: create.c:4226
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:450
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _EVENT_BASIC_INFORMATION EVENT_BASIC_INFORMATION
#define ObDereferenceObject
Definition: obfuncs.h:203
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
_SEH2_END
Definition: create.c:4400
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
struct _EVENT_BASIC_INFORMATION * PEVENT_BASIC_INFORMATION
#define NULL
Definition: types.h:112
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
#define PAGED_CODE()
_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 385 of file event.c.

387 {
388  PKEVENT Event;
391  PAGED_CODE();
392  DPRINT("NtResetEvent(EventHandle 0%p PreviousState 0%p)\n",
394 
395  /* Check if we were called from user-mode */
396  if ((PreviousState) && (PreviousMode != KernelMode))
397  {
398  /* Entry SEH Block */
399  _SEH2_TRY
400  {
401  /* Make sure the state pointer is valid */
403  }
405  {
406  /* Return the exception code */
408  }
409  _SEH2_END;
410  }
411 
412  /* Open the Object */
416  PreviousMode,
417  (PVOID*)&Event,
418  NULL);
419 
420  /* Check for success */
421  if(NT_SUCCESS(Status))
422  {
423  /* Reset the Event */
424  LONG Prev = KeResetEvent(Event);
426 
427  /* Check if caller wants the old state back */
428  if(PreviousState)
429  {
430  /* Entry SEH Block for return */
431  _SEH2_TRY
432  {
433  /* Return previous state */
434  *PreviousState = Prev;
435  }
437  {
438  /* Get the exception code */
440  }
441  _SEH2_END;
442  }
443  }
444 
445  /* Return Status */
446  return Status;
447 }
#define ProbeForWriteLong(Ptr)
Definition: probe.h:37
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
POBJECT_TYPE ExEventObjectType
Definition: event.c:18
_SEH2_TRY
Definition: create.c:4226
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:450
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
_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 ObDereferenceObject
Definition: obfuncs.h:203
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
_SEH2_END
Definition: create.c:4400
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
#define NULL
Definition: types.h:112
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
_In_ WDF_POWER_DEVICE_STATE PreviousState
Definition: wdfdevice.h:829
#define PAGED_CODE()
_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 454 of file event.c.

456 {
457  PKEVENT Event;
460  PAGED_CODE();
461  DPRINT("NtSetEvent(EventHandle 0%p PreviousState 0%p)\n",
463 
464  /* Check if we were called from user-mode */
465  if ((PreviousState) && (PreviousMode != KernelMode))
466  {
467  /* Entry SEH Block */
468  _SEH2_TRY
469  {
470  /* Make sure the state pointer is valid */
472  }
474  {
475  /* Return the exception code */
477  }
478  _SEH2_END;
479  }
480 
481  /* Open the Object */
485  PreviousMode,
486  (PVOID*)&Event,
487  NULL);
488  if (NT_SUCCESS(Status))
489  {
490  /* Set the Event */
493 
494  /* Check if caller wants the old state back */
495  if (PreviousState)
496  {
497  /* Entry SEH Block for return */
498  _SEH2_TRY
499  {
500  /* Return previous state */
501  *PreviousState = Prev;
502  }
504  {
506  }
507  _SEH2_END;
508  }
509  }
510 
511  /* Return Status */
512  return Status;
513 }
#define ProbeForWriteLong(Ptr)
Definition: probe.h:37
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
POBJECT_TYPE ExEventObjectType
Definition: event.c:18
_SEH2_TRY
Definition: create.c:4226
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
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:450
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
_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 ObDereferenceObject
Definition: obfuncs.h:203
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
_SEH2_END
Definition: create.c:4400
#define EVENT_INCREMENT
Definition: iotypes.h:580
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
#define NULL
Definition: types.h:112
#define EVENT_MODIFY_STATE
Definition: winbase.h:163
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
_In_ WDF_POWER_DEVICE_STATE PreviousState
Definition: wdfdevice.h:829
#define PAGED_CODE()
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

Referenced by AddInputEvents(), BaseSrvCleanupVDMResources(), 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 520 of file event.c.

521 {
522  PKEVENT Event;
524  PAGED_CODE();
525 
526  /* Open the Object */
531  (PVOID*)&Event,
532  NULL);
533  if (NT_SUCCESS(Status))
534  {
535  /* Set the Event */
538  }
539 
540  /* Return Status */
541  return Status;
542 }
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
POBJECT_TYPE ExEventObjectType
Definition: event.c:18
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:450
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ObDereferenceObject
Definition: obfuncs.h:203
#define NULL
Definition: types.h:112
#define EVENT_MODIFY_STATE
Definition: winbase.h:163
VOID NTAPI KeSetEventBoostPriority(IN PKEVENT Event, IN PKTHREAD *WaitingThread OPTIONAL)
Definition: eventobj.c:229
#define PAGED_CODE()
_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 28 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 20 of file event.c.

Referenced by ExpInitializeEventImplementation().