ReactOS  0.4.14-dev-77-gd9e7c48
event.c File Reference
#include <win32k.h>
Include dependency graph for event.c:

Go to the source code of this file.

Classes

struct  _EVENTPACK
 

Typedefs

typedef struct _EVENTPACK EVENTPACK
 
typedef struct _EVENTPACKPEVENTPACK
 

Functions

 DBG_DEFAULT_CHANNEL (UserEvent)
 
static DWORD FASTCALL GetMaskFromEvent (DWORD Event)
 
static VOID FASTCALL IntSetSrvEventMask (UINT EventMin, UINT EventMax)
 
static LRESULT FASTCALL IntCallLowLevelEvent (PEVENTHOOK pEH, DWORD event, HWND hwnd, LONG idObject, LONG idChild, LONG idThread)
 
BOOLEAN IntRemoveEvent (PVOID Object)
 
LRESULT APIENTRY co_EVENT_CallEvents (DWORD event, HWND hwnd, UINT_PTR idObject, LONG_PTR idChild)
 
VOID FASTCALL IntNotifyWinEvent (DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
 
VOID APIENTRY NtUserNotifyWinEvent (DWORD Event, HWND hWnd, LONG idObject, LONG idChild)
 
HWINEVENTHOOK APIENTRY NtUserSetWinEventHook (UINT eventMin, UINT eventMax, HMODULE hmodWinEventProc, PUNICODE_STRING puString, WINEVENTPROC lpfnWinEventProc, DWORD idProcess, DWORD idThread, UINT dwflags)
 
BOOL APIENTRY NtUserUnhookWinEvent (HWINEVENTHOOK hWinEventHook)
 

Variables

static PEVENTTABLE GlobalEvents = NULL
 

Typedef Documentation

◆ EVENTPACK

◆ PEVENTPACK

Function Documentation

◆ co_EVENT_CallEvents()

LRESULT APIENTRY co_EVENT_CallEvents ( DWORD  event,
HWND  hwnd,
UINT_PTR  idObject,
LONG_PTR  idChild 
)

Definition at line 151 of file event.c.

155 {
156  PEVENTHOOK pEH;
157  LRESULT Result;
158  PEVENTPACK pEP = (PEVENTPACK)idChild;
159 
160  pEH = pEP->pEH;
161  TRACE("Dispatch Event 0x%lx, idObject %uI hwnd %p\n", event, idObject, hwnd);
163  event,
164  hwnd,
165  pEP->idObject,
166  pEP->idChild,
167  pEP->idThread,
169  pEH->Proc,
170  pEH->ihmod,
171  pEH->offPfn);
172 
174  return Result;
175 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
INT_PTR ihmod
Definition: hook.h:26
#define TAG_HOOK
Definition: tags.h:5
#define EngGetTickCount32()
Definition: eng.h:43
LONG idObject
Definition: event.c:15
LRESULT APIENTRY co_IntCallEventProc(HWINEVENTHOOK hook, DWORD event, HWND hWnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime, WINEVENTPROC Proc, INT Mod, ULONG_PTR offPfn)
Definition: callback.c:824
_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
WINEVENTPROC Proc
Definition: hook.h:23
PEVENTHOOK pEH
Definition: event.c:14
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
LONG idThread
Definition: event.c:17
#define TRACE(s)
Definition: solgame.cpp:4
struct _cl_event * event
Definition: glext.h:7739
LONG idChild
Definition: event.c:16
struct _EVENTPACK * PEVENTPACK
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
ULONG_PTR offPfn
Definition: hook.h:25
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by handle_internal_events().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserEvent  )

◆ GetMaskFromEvent()

static DWORD FASTCALL GetMaskFromEvent ( DWORD  Event)
static

Definition at line 27 of file event.c.

28 {
29  DWORD Ret = 0;
30 
31  if ( Event > EVENT_OBJECT_STATECHANGE )
32  {
33  if ( Event == EVENT_OBJECT_LOCATIONCHANGE ) return SRV_EVENT_LOCATIONCHANGE;
34  if ( Event == EVENT_OBJECT_NAMECHANGE ) return SRV_EVENT_NAMECHANGE;
35  if ( Event == EVENT_OBJECT_VALUECHANGE ) return SRV_EVENT_VALUECHANGE;
36  return SRV_EVENT_CREATE;
37  }
38 
39  if ( Event == EVENT_OBJECT_STATECHANGE ) return SRV_EVENT_STATECHANGE;
40 
41  Ret = SRV_EVENT_RUNNING;
42 
43  if ( Event < EVENT_SYSTEM_MENUSTART ) return SRV_EVENT_CREATE;
44 
45  if ( Event <= EVENT_SYSTEM_MENUPOPUPEND )
46  {
47  Ret = SRV_EVENT_MENU;
48  }
49  else
50  {
51  if ( Event <= EVENT_CONSOLE_CARET-1 ) return SRV_EVENT_CREATE;
52  if ( Event <= EVENT_CONSOLE_END_APPLICATION ) return SRV_EVENT_END_APPLICATION;
53  if ( Event != EVENT_OBJECT_FOCUS ) return SRV_EVENT_CREATE;
54  }
55  return Ret;
56 }
#define SRV_EVENT_STATECHANGE
Definition: ntuser.h:1039
#define SRV_EVENT_CREATE
Definition: ntuser.h:1041
#define SRV_EVENT_NAMECHANGE
Definition: ntuser.h:1037
#define SRV_EVENT_MENU
Definition: ntuser.h:1034
#define SRV_EVENT_END_APPLICATION
Definition: ntuser.h:1035
#define SRV_EVENT_RUNNING
Definition: ntuser.h:1036
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SRV_EVENT_LOCATIONCHANGE
Definition: ntuser.h:1040
#define SRV_EVENT_VALUECHANGE
Definition: ntuser.h:1038

Referenced by IntSetSrvEventMask(), and NtUserNotifyWinEvent().

◆ IntCallLowLevelEvent()

static LRESULT FASTCALL IntCallLowLevelEvent ( PEVENTHOOK  pEH,
DWORD  event,
HWND  hwnd,
LONG  idObject,
LONG  idChild,
LONG  idThread 
)
static

Definition at line 98 of file event.c.

104 {
105  PEVENTPACK pEP;
106  MSG Msg;
107 
109  if (!pEP) return 0;
110 
111  pEP->pEH = pEH;
112  pEP->idObject = idObject;
113  pEP->idChild = idChild;
114  pEP->idThread = idThread;
115 
116  Msg.message = event;
117  Msg.hwnd = hwnd;
118  Msg.wParam = 0;
119  Msg.lParam = POSTEVENT_NWE;
120  Msg.time = 0;
121 
123  return 0;
124 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TAG_HOOK
Definition: tags.h:5
THROBJHEAD head
Definition: hook.h:17
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
LONG idObject
Definition: event.c:15
struct @1576 Msg[]
PEVENTHOOK pEH
Definition: event.c:14
LONG idThread
Definition: event.c:17
#define QS_EVENT
Definition: undocuser.h:95
VOID FASTCALL MsqPostMessage(PTHREADINFO pti, MSG *Msg, BOOLEAN HardwareMessage, DWORD MessageBits, DWORD dwQEvent, LONG_PTR ExtraInfo)
Definition: msgqueue.c:1338
#define POSTEVENT_NWE
Definition: msgqueue.h:125
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
struct _THREADINFO * pti
Definition: ntuser.h:183
struct _cl_event * event
Definition: glext.h:7739
LONG idChild
Definition: event.c:16
__int3264 LONG_PTR
Definition: mstsclib_h.h:276

Referenced by IntNotifyWinEvent().

◆ IntNotifyWinEvent()

VOID FASTCALL IntNotifyWinEvent ( DWORD  Event,
PWND  pWnd,
LONG  idObject,
LONG  idChild,
DWORD  flags 
)

Definition at line 179 of file event.c.

185 {
186  PEVENTHOOK pEH;
187  PLIST_ENTRY ListEntry;
188  PTHREADINFO pti, ptiCurrent;
190 
191  TRACE("IntNotifyWinEvent GlobalEvents = %p pWnd %p\n", GlobalEvents, pWnd);
192 
193  if (!GlobalEvents || !GlobalEvents->Counts) return;
194 
195  if (pWnd && pWnd->state & WNDS_DESTROYED) return;
196 
197  ptiCurrent = PsGetCurrentThreadWin32Thread();
198 
199  if (pWnd && flags & WEF_SETBYWNDPTI)
200  pti = pWnd->head.pti;
201  else
202  pti = ptiCurrent;
203 
204  ListEntry = GlobalEvents->Events.Flink;
205  ASSERT(ListEntry != &GlobalEvents->Events);
206  while (ListEntry != &GlobalEvents->Events)
207  {
208  pEH = CONTAINING_RECORD(ListEntry, EVENTHOOK, Chain);
209  ListEntry = ListEntry->Flink;
210 
211  // Must be inside the event window.
212  if ( Event >= pEH->eventMin && Event <= pEH->eventMax )
213  {
214  // if all process || all thread || other thread same process
215  // if ^skip own thread && ((Pid && CPid == Pid && ^skip own process) || all process)
216  if (!( (pEH->idProcess && pEH->idProcess != PtrToUint(pti->pEThread->Cid.UniqueProcess)) ||
217  (pEH->Flags & WINEVENT_SKIPOWNPROCESS && pEH->head.pti->ppi == pti->ppi) ||
218  (pEH->idThread && pEH->idThread != PtrToUint(pti->pEThread->Cid.UniqueThread)) ||
219  (pEH->Flags & WINEVENT_SKIPOWNTHREAD && pEH->head.pti == pti) ||
220  pEH->head.pti->rpdesk != ptiCurrent->rpdesk ) ) // Same as hooks.
221  {
222  UserRefObjectCo(pEH, &Ref);
223  if (pEH->Flags & WINEVENT_INCONTEXT)
224  {
225  TRACE("In Event 0x%x, idObject %d hwnd %p\n", Event, idObject, pWnd ? UserHMGetHandle(pWnd) : NULL);
227  Event,
228  pWnd ? UserHMGetHandle(pWnd) : NULL,
229  idObject,
230  idChild,
233  pEH->Proc,
234  pEH->ihmod,
235  pEH->offPfn);
236  }
237  else
238  {
239  TRACE("Out Event 0x%x, idObject %d hwnd %p\n", Event, idObject, pWnd ? UserHMGetHandle(pWnd) : NULL);
241  Event,
242  pWnd ? UserHMGetHandle(pWnd) : NULL,
243  idObject,
244  idChild,
246  }
247  UserDerefObjectCo(pEH);
248  }
249  }
250  }
251 }
#define PtrToUint(p)
Definition: basetsd.h:85
UINT Counts
Definition: hook.h:32
INT_PTR ihmod
Definition: hook.h:26
#define WINEVENT_SKIPOWNPROCESS
Definition: winable.h:34
LIST_ENTRY Events
Definition: hook.h:31
#define EngGetTickCount32()
Definition: eng.h:43
THROBJHEAD head
Definition: hook.h:17
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
struct _DESKTOP * rpdesk
Definition: win32.h:91
PPROCESSINFO ppi
Definition: win32.h:87
static LRESULT FASTCALL IntCallLowLevelEvent(PEVENTHOOK pEH, DWORD event, HWND hwnd, LONG idObject, LONG idChild, LONG idThread)
Definition: event.c:98
ULONG Flags
Definition: hook.h:24
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
THRDESKHEAD head
Definition: ntuser.h:659
LRESULT APIENTRY co_IntCallEventProc(HWINEVENTHOOK hook, DWORD event, HWND hWnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime, WINEVENTPROC Proc, INT Mod, ULONG_PTR offPfn)
Definition: callback.c:824
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
WINEVENTPROC Proc
Definition: hook.h:23
#define WEF_SETBYWNDPTI
Definition: ntuser.h:213
UINT eventMin
Definition: hook.h:19
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define TRACE(s)
Definition: solgame.cpp:4
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1176
GLbitfield flags
Definition: glext.h:7161
HANDLE UniqueThread
Definition: compat.h:475
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define WINEVENT_INCONTEXT
Definition: winable.h:35
struct _THREADINFO * pti
Definition: ntuser.h:183
Definition: typedefs.h:117
DWORD idThread
Definition: hook.h:22
static PEVENTTABLE GlobalEvents
Definition: event.c:20
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define WINEVENT_SKIPOWNTHREAD
Definition: winable.h:33
DWORD state
Definition: ntuser.h:665
ULONG_PTR offPfn
Definition: hook.h:25
#define WNDS_DESTROYED
Definition: ntuser.h:604
DWORD idProcess
Definition: hook.h:21

Referenced by co_IntDestroyCaret(), co_IntHideCaret(), co_IntProcessMouseMessage(), co_IntSetActiveWindow(), co_IntSetCaretPos(), co_IntSetParent(), co_UserCreateWindowEx(), co_UserDestroyWindow(), co_UserSetCapture(), co_UserShowCaret(), co_WinPosSetWindowPos(), co_WinPosShowWindow(), DefWndDoSizeMove(), DIALOG_CreateIndirect(), IntDefWindowProc(), IntEnableWindow(), IntSendFocusMessages(), IntSetScrollInfo(), MENU_ExitTracking(), MENU_InitTracking(), MENU_ShowPopup(), MENU_TrackMenu(), NtUserCallHwndParam(), NtUserCreateCaret(), NtUserNotifyWinEvent(), and RealDefWindowProcA().

◆ IntRemoveEvent()

BOOLEAN IntRemoveEvent ( PVOID  Object)

Definition at line 127 of file event.c.

128 {
129  PEVENTHOOK pEH = Object;
130  if (pEH)
131  {
132  TRACE("IntRemoveEvent pEH %p\n", pEH);
134  RemoveEntryList(&pEH->Chain);
135  GlobalEvents->Counts--;
139  return TRUE;
140  }
141  return FALSE;
142 }
UINT Counts
Definition: hook.h:32
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:683
#define TRUE
Definition: types.h:120
PSERVERINFO gpsi
Definition: main.c:27
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define TRACE(s)
Definition: solgame.cpp:4
static IUnknown Object
Definition: main.c:512
#define KeEnterCriticalRegion()
Definition: ke_x.h:83
static PEVENTTABLE GlobalEvents
Definition: event.c:20
DWORD dwInstalledEventHooks
Definition: ntuser.h:1024
#define KeLeaveCriticalRegion()
Definition: ke_x.h:114
LIST_ENTRY Chain
Definition: hook.h:18

Referenced by NtUserUnhookWinEvent().

◆ IntSetSrvEventMask()

static VOID FASTCALL IntSetSrvEventMask ( UINT  EventMin,
UINT  EventMax 
)
static

Definition at line 61 of file event.c.

62 {
63  UINT event;
64  TRACE("SetSrvEventMask 1\n");
65  for ( event = EventMin; event <= EventMax; event++)
66  {
67  if ((event >= EVENT_SYSTEM_SOUND && event <= EVENT_SYSTEM_MINIMIZEEND) ||
68  (event >= EVENT_CONSOLE_CARET && event <= EVENT_CONSOLE_END_APPLICATION) ||
69  (event >= EVENT_OBJECT_CREATE && event <= EVENT_OBJECT_ACCELERATORCHANGE))
70  {
72  }
73  if (event > EVENT_SYSTEM_MINIMIZEEND && event < EVENT_CONSOLE_CARET)
74  {
75  event = EVENT_CONSOLE_CARET-1;
77  }
78  if (event > EVENT_CONSOLE_END_APPLICATION && event < EVENT_OBJECT_CREATE )
79  {
80  event = EVENT_OBJECT_CREATE-1;
82  }
83  if (event > EVENT_OBJECT_ACCELERATORCHANGE && event < EVENT_MAX)
84  {
85  event = EVENT_MAX-1;
87  break;
88  }
89  }
91  gpsi->dwInstalledEventHooks |= SRV_EVENT_RUNNING; // Set something.
92  TRACE("SetSrvEventMask 2 : %x\n", gpsi->dwInstalledEventHooks);
93 }
static DWORD FASTCALL GetMaskFromEvent(DWORD Event)
Definition: event.c:27
PSERVERINFO gpsi
Definition: main.c:27
#define TRACE(s)
Definition: solgame.cpp:4
#define SRV_EVENT_RUNNING
Definition: ntuser.h:1036
struct _cl_event * event
Definition: glext.h:7739
DWORD dwInstalledEventHooks
Definition: ntuser.h:1024
unsigned int UINT
Definition: ndis.h:50

Referenced by NtUserSetWinEventHook().

◆ NtUserNotifyWinEvent()

VOID APIENTRY NtUserNotifyWinEvent ( DWORD  Event,
HWND  hWnd,
LONG  idObject,
LONG  idChild 
)

Definition at line 255 of file event.c.

260 {
261  PWND Window = NULL;
264 
265  /* Validate input */
266  if (hWnd && (hWnd != INVALID_HANDLE_VALUE))
267  {
269  if (!Window)
270  {
271  UserLeave();
272  return;
273  }
274  }
275 
277  {
278  if (Window) UserRefObjectCo(Window, &Ref);
279  IntNotifyWinEvent( Event, Window, idObject, idChild, WEF_SETBYWNDPTI);
281  }
282  UserLeave();
283 }
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:179
HWND hWnd
Definition: settings.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
static DWORD FASTCALL GetMaskFromEvent(DWORD Event)
Definition: event.c:27
PSERVERINFO gpsi
Definition: main.c:27
Definition: window.c:29
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
#define WEF_SETBYWNDPTI
Definition: ntuser.h:213
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
Definition: ntuser.h:657
DWORD dwInstalledEventHooks
Definition: ntuser.h:1024
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255

Referenced by NotifyWinEvent().

◆ NtUserSetWinEventHook()

HWINEVENTHOOK APIENTRY NtUserSetWinEventHook ( UINT  eventMin,
UINT  eventMax,
HMODULE  hmodWinEventProc,
PUNICODE_STRING  puString,
WINEVENTPROC  lpfnWinEventProc,
DWORD  idProcess,
DWORD  idThread,
UINT  dwflags 
)

Definition at line 287 of file event.c.

296 {
297  PEVENTHOOK pEH;
298  HWINEVENTHOOK Ret = NULL;
300  HANDLE Handle;
301  PTHREADINFO pti;
302 
303  TRACE("NtUserSetWinEventHook hmod %p, pfn %p\n", hmodWinEventProc, lpfnWinEventProc);
304 
306 
307  if ( !GlobalEvents )
308  {
310  if (GlobalEvents == NULL)
311  {
313  goto SetEventExit;
314  }
315  GlobalEvents->Counts = 0;
317  }
318 
319  if (eventMin > eventMax)
320  {
322  goto SetEventExit;
323  }
324 
325  if (!lpfnWinEventProc)
326  {
328  goto SetEventExit;
329  }
330 
332  {
333  if (!hmodWinEventProc)
334  {
335  ERR("Hook needs a module\n");
337  goto SetEventExit;
338  }
339  if (puString == NULL)
340  {
341  ERR("Dll not found\n");
343  goto SetEventExit;
344  }
345  }
346  else
347  {
348  TRACE("Out of Context\n");
349  hmodWinEventProc = 0;
350  }
351 
352  if (idThread)
353  {
356  if (!NT_SUCCESS(Status))
357  {
359  goto SetEventExit;
360  }
363  }
364  else
365  {
367  }
368  // Creator, pti is set here.
370  if (pEH)
371  {
373  GlobalEvents->Counts++;
374 
375  UserHMGetHandle(pEH) = Handle;
376  pEH->eventMin = eventMin;
377  pEH->eventMax = eventMax;
378  pEH->idProcess = idProcess; // These are cmp'ed
379  pEH->idThread = idThread; // "
380  pEH->Flags = dwflags;
381  /*
382  If WINEVENT_INCONTEXT, set offset from hmod and proc. Save ihmod from
383  the atom index table where the hmod data is saved to be recalled later
384  if fSync set by WINEVENT_INCONTEXT.
385  If WINEVENT_OUTOFCONTEXT just use proc..
386  Do this instead....
387  */
388  if (hmodWinEventProc != NULL)
389  {
390  pEH->offPfn = (ULONG_PTR)((char *)lpfnWinEventProc - (char *)hmodWinEventProc);
391  pEH->ihmod = (INT_PTR)hmodWinEventProc;
392  pEH->Proc = lpfnWinEventProc;
393  }
394  else
395  {
396  pEH->Proc = lpfnWinEventProc;
397  pEH->offPfn = 0;
398  pEH->ihmod = (INT_PTR)hmodWinEventProc;
399  }
400 
402 
403  Ret = Handle;
404  IntSetSrvEventMask( eventMin, eventMax);
405  }
406 
407 SetEventExit:
408  UserLeave();
409  return Ret;
410 }
PVOID NTAPI PsGetThreadWin32Thread(IN PETHREAD Thread)
Definition: thread.c:795
UINT Counts
Definition: hook.h:32
INT_PTR ihmod
Definition: hook.h:26
#define TAG_HOOK
Definition: tags.h:5
LIST_ENTRY Events
Definition: hook.h:31
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
Definition: thread.c:643
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_INVALID_THREAD_ID
Definition: winerror.h:925
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:610
#define ERROR_DLL_NOT_FOUND
Definition: winerror.h:679
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
int32_t INT_PTR
Definition: typedefs.h:62
#define InsertTailList(ListHead, Entry)
static HWINEVENTHOOK(WINAPI *pSetWinEventHook)(DWORD
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:535
static VOID FASTCALL IntSetSrvEventMask(UINT EventMin, UINT EventMax)
Definition: event.c:61
ULONG Flags
Definition: hook.h:24
smooth NULL
Definition: ftsmooth.c:416
WINEVENTPROC Proc
Definition: hook.h:23
UINT eventMin
Definition: hook.h:19
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
_In_ HANDLE Handle
Definition: extypes.h:390
#define ERROR_INVALID_FILTER_PROC
Definition: winerror.h:908
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define WINEVENT_INCONTEXT
Definition: winable.h:35
static _In_ DWORD dwflags
Definition: dispmode.c:64
DWORD idThread
Definition: hook.h:22
uint32_t DWORD_PTR
Definition: typedefs.h:63
Status
Definition: gdiplustypes.h:24
static PEVENTTABLE GlobalEvents
Definition: event.c:20
#define ERR(fmt,...)
Definition: debug.h:109
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
UINT eventMax
Definition: hook.h:20
LIST_ENTRY Chain
Definition: hook.h:18
#define ERROR_HOOK_NEEDS_HMOD
Definition: winerror.h:909
#define ULONG_PTR
Definition: config.h:101
ULONG_PTR offPfn
Definition: hook.h:25
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
DWORD idProcess
Definition: hook.h:21
#define ERROR_INVALID_HOOK_FILTER
Definition: winerror.h:907

Referenced by SetWinEventHook().

◆ NtUserUnhookWinEvent()

BOOL APIENTRY NtUserUnhookWinEvent ( HWINEVENTHOOK  hWinEventHook)

Definition at line 414 of file event.c.

416 {
417  PEVENTHOOK pEH;
418  BOOL Ret = FALSE;
419 
421 
422  pEH = (PEVENTHOOK)UserGetObject(gHandleTable, hWinEventHook, TYPE_WINEVENTHOOK);
423  if (pEH)
424  {
425  Ret = IntRemoveEvent(pEH);
426  }
427 
428  UserLeave();
429  return Ret;
430 }
unsigned int BOOL
Definition: ntddk_ex.h:94
struct tagEVENTHOOK * PEVENTHOOK
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
BOOLEAN IntRemoveEvent(PVOID Object)
Definition: event.c:127
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:462
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13

Variable Documentation

◆ GlobalEvents

PEVENTTABLE GlobalEvents = NULL
static

Definition at line 20 of file event.c.

Referenced by IntNotifyWinEvent(), IntRemoveEvent(), and NtUserSetWinEventHook().