ReactOS 0.4.15-dev-7670-g69b08be
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}
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
#define ASSERT(a)
Definition: mode.c:44

◆ 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 ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NO_ERROR
Definition: dderror.h:5
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define NonPagedPool
Definition: env_spec_w32.h:307
struct _ENG_EVENT * PEVENT
Definition: ntddvdeo.h:618
@ NotificationEvent
@ SynchronizationEvent
#define INITIAL_EVENT_STATE_MASK
Definition: video.h:111
LONG VP_STATUS
Definition: video.h:153
#define EVENT_TYPE_MASK
Definition: video.h:107
#define DPRINT
Definition: sndvol32.h:71
#define TAG_VIDEO_PORT
Definition: videoprt.h:38
_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:409

◆ 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
@ ENG_EVENT_USERMAPPED
Definition: engevent.h:8
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109

◆ 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}
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{
97 return KeSetEvent(Event->pKEvent, IO_NO_INCREMENT, FALSE);
98}
#define FALSE
Definition: types.h:117
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ 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,
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}
LONG NTSTATUS
Definition: precomp.h:26
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
Status
Definition: gdiplustypes.h:25
#define KernelMode
Definition: asm.h:34
#define STATUS_TIMEOUT
Definition: ntstatus.h:81
static ULONG Timeout
Definition: ping.c:61
@ Executive
Definition: ketypes.h:415