ReactOS  0.4.15-dev-1207-g698a8e6
event.c File Reference
#include "videoprt.h"
#include "../../gdi/eng/engevent.h"
#include <debug.h>
Include dependency graph for event.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VP_STATUS NTAPI VideoPortCreateEvent (_In_ PVOID HwDeviceExtension, _In_ ULONG EventFlag, _In_ PVOID Unused, _Out_ PEVENT *pEvent)
 
VP_STATUS NTAPI VideoPortDeleteEvent (_In_ PVOID HwDeviceExtension, _In_ PEVENT Event)
 
LONG NTAPI VideoPortSetEvent (_In_ PVOID HwDeviceExtension, _In_ PEVENT Event)
 
VOID NTAPI VideoPortClearEvent (_In_ PVOID HwDeviceExtension, _In_ PEVENT Event)
 
LONG NTAPI VideoPortReadStateEvent (_In_ PVOID HwDeviceExtension, _In_ PEVENT Event)
 
VP_STATUS NTAPI VideoPortWaitForSingleObject (_In_ PVOID HwDeviceExtension, _In_ PVOID Event, _In_opt_ PLARGE_INTEGER Timeout)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file event.c.

Function Documentation

◆ VideoPortClearEvent()

VOID NTAPI VideoPortClearEvent ( _In_ PVOID  HwDeviceExtension,
_In_ PEVENT  Event 
)

Definition at line 105 of file event.c.

108 {
109  ASSERT(Event);
110  KeClearEvent(Event->pKEvent);
111 }
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22

◆ VideoPortCreateEvent()

VP_STATUS NTAPI VideoPortCreateEvent ( _In_ PVOID  HwDeviceExtension,
_In_ ULONG  EventFlag,
_In_ PVOID  Unused,
_Out_ PEVENT pEvent 
)

Definition at line 24 of file event.c.

29 {
31  PVIDEO_PORT_EVENT EngEvent;
32 
33  /* Allocate memory for the event structure */
35  sizeof(VIDEO_PORT_EVENT) + sizeof(KEVENT),
37  if (EngEvent)
38  {
39  /* Zero flags */
40  EngEvent->fFlags = 0;
41 
42  /* Set KEVENT pointer */
43  EngEvent->pKEvent = EngEvent + 1;
44 
45  /* Initialize the kernel event */
46  KeInitializeEvent(EngEvent->pKEvent,
47  (EventFlag & EVENT_TYPE_MASK) ?
49  EventFlag & INITIAL_EVENT_STATE_MASK);
50 
51  /* Pass pointer to our structure to the caller */
52  *pEvent = (PEVENT)EngEvent;
53  DPRINT("VideoPortCreateEvent() created %p\n", EngEvent);
54  }
55  else
56  {
57  /* Out of memory */
58  DPRINT("VideoPortCreateEvent() failed\n");
60  }
61 
62  /* Return result */
63  return Result;
64 }
#define TAG_VIDEO_PORT
Definition: videoprt.h:38
#define INITIAL_EVENT_STATE_MASK
Definition: video.h:111
struct _ENG_EVENT * PEVENT
Definition: ntddvdeo.h:548
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NO_ERROR
Definition: dderror.h:5
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
void DPRINT(...)
Definition: polytest.cpp:61
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define EVENT_TYPE_MASK
Definition: video.h:107
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
LONG VP_STATUS
Definition: video.h:153

◆ VideoPortDeleteEvent()

VP_STATUS NTAPI VideoPortDeleteEvent ( _In_ PVOID  HwDeviceExtension,
_In_ PEVENT  Event 
)

Definition at line 71 of file event.c.

74 {
75  /* Handle error cases */
76  if (!Event) return ERROR_INVALID_PARAMETER;
78  if (!Event->pKEvent) return ERROR_INVALID_PARAMETER;
79 
80  /* Free storage */
82 
83  /* Indicate success */
84  return NO_ERROR;
85 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TAG_VIDEO_PORT
Definition: videoprt.h:38
#define NO_ERROR
Definition: dderror.h:5
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

◆ VideoPortReadStateEvent()

LONG NTAPI VideoPortReadStateEvent ( _In_ PVOID  HwDeviceExtension,
_In_ PEVENT  Event 
)

Definition at line 118 of file event.c.

121 {
122  ASSERT(Event);
123  return KeReadStateEvent(Event->pKEvent);
124 }
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
LONG NTAPI KeReadStateEvent(IN PKEVENT Event)
Definition: eventobj.c:120

◆ VideoPortSetEvent()

LONG NTAPI VideoPortSetEvent ( _In_ PVOID  HwDeviceExtension,
_In_ PEVENT  Event 
)

Definition at line 92 of file event.c.

95 {
96  ASSERT(Event);
97  return KeSetEvent(Event->pKEvent, IO_NO_INCREMENT, FALSE);
98 }
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
#define FALSE
Definition: types.h:117
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define IO_NO_INCREMENT
Definition: iotypes.h:581

◆ VideoPortWaitForSingleObject()

VP_STATUS NTAPI VideoPortWaitForSingleObject ( _In_ PVOID  HwDeviceExtension,
_In_ PVOID  Event,
_In_opt_ PLARGE_INTEGER  Timeout 
)

Definition at line 131 of file event.c.

135 {
136  PVIDEO_PORT_EVENT EngEvent = Event;
138 
139  /* Handle error cases */
140  if (!EngEvent) return ERROR_INVALID_PARAMETER;
141  if (!EngEvent->pKEvent) return ERROR_INVALID_PARAMETER;
142  if (EngEvent->fFlags & ENG_EVENT_USERMAPPED) return ERROR_INVALID_PARAMETER;
143 
144  /* Do the actual wait */
145  Status = KeWaitForSingleObject(EngEvent->pKEvent,
146  Executive,
147  KernelMode,
148  FALSE,
149  Timeout);
150  if (Status == STATUS_TIMEOUT)
151  {
152  /* Convert to wait timeout, otherwise NT_SUCCESS would return NO_ERROR */
153  return WAIT_TIMEOUT;
154  }
155  else if (NT_SUCCESS(Status))
156  {
157  /* All other success codes are Win32 success */
158  return NO_ERROR;
159  }
160 
161  /* Otherwise, return default Win32 failure */
163 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
LONG NTSTATUS
Definition: precomp.h:26
#define NO_ERROR
Definition: dderror.h:5
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
#define FALSE
Definition: types.h:117
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:450
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define WAIT_TIMEOUT
Definition: dderror.h:14
Status
Definition: gdiplustypes.h:24
static ULONG Timeout
Definition: ping.c:61