ReactOS  0.4.14-dev-1280-ga5a725a
callback.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Win32k subsystem
4  * PURPOSE: Callback to usermode support
5  * FILE: win32ss/user/ntuser/callback.c
6  * PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
7  * Thomas Weidenmueller (w3seek@users.sourceforge.net)
8  * NOTES: Please use the Callback Memory Management functions for
9  * callbacks to make sure, the memory is freed on thread
10  * termination!
11  */
12 
13 #include <win32k.h>
14 DBG_DEFAULT_CHANNEL(UserCallback);
15 
16 
17 /* CALLBACK MEMORY MANAGEMENT ************************************************/
18 
19 typedef struct _INT_CALLBACK_HEADER
20 {
21  /* List entry in the THREADINFO structure */
23 }
25 
28 {
30  PTHREADINFO W32Thread;
31 
34  {
35  return NULL;
36  }
37 
38  W32Thread = PsGetCurrentThreadWin32Thread();
39  ASSERT(W32Thread);
40 
41  /* Insert the callback memory into the thread's callback list */
42 
43  InsertTailList(&W32Thread->W32CallbackListHead, &Mem->ListEntry);
44 
45  return (Mem + 1);
46 }
47 
50 {
52  PTHREADINFO W32Thread;
53 
54  W32Thread = PsGetCurrentThreadWin32Thread();
55  ASSERT(W32Thread);
56 
57  if (W32Thread->TIF_flags & TIF_INCLEANUP)
58  {
59  ERR("CbFM Thread is already in cleanup\n");
60  return;
61  }
62 
63  ASSERT(Data);
64 
65  Mem = ((PINT_CALLBACK_HEADER)Data - 1);
66 
67  /* Remove the memory block from the thread's callback list */
69 
70  /* Free memory */
72 }
73 
76 {
77  PLIST_ENTRY CurrentEntry;
79 
80  while (!IsListEmpty(&W32Thread->W32CallbackListHead))
81  {
82  CurrentEntry = RemoveHeadList(&W32Thread->W32CallbackListHead);
83  Mem = CONTAINING_RECORD(CurrentEntry, INT_CALLBACK_HEADER,
84  ListEntry);
85 
86  /* Free memory */
88  }
89 }
90 
91 //
92 // Pass the Current Window handle and pointer to the Client Callback.
93 // This will help user space programs speed up read access with the window object.
94 //
95 static VOID
96 IntSetTebWndCallback (HWND * hWnd, PWND * pWnd, PVOID * pActCtx)
97 {
98  HWND hWndS = *hWnd;
101 
102  *hWnd = ClientInfo->CallbackWnd.hWnd;
103  *pWnd = ClientInfo->CallbackWnd.pWnd;
104  *pActCtx = ClientInfo->CallbackWnd.pActCtx;
105 
106  if (Window)
107  {
108  ClientInfo->CallbackWnd.hWnd = hWndS;
109  ClientInfo->CallbackWnd.pWnd = DesktopHeapAddressToUser(Window);
110  ClientInfo->CallbackWnd.pActCtx = Window->pActCtx;
111  }
112  else
113  {
114  ClientInfo->CallbackWnd.hWnd = hWndS;
115  ClientInfo->CallbackWnd.pWnd = Window;
116  ClientInfo->CallbackWnd.pActCtx = 0;
117  }
118 }
119 
120 static VOID
122 {
124 
125  ClientInfo->CallbackWnd.hWnd = hWnd;
126  ClientInfo->CallbackWnd.pWnd = pWnd;
127  ClientInfo->CallbackWnd.pActCtx = pActCtx;
128 }
129 
130 /* FUNCTIONS *****************************************************************/
131 
132 /* Calls ClientLoadLibrary in user32 */
133 BOOL
134 NTAPI
136  PUNICODE_STRING pstrInitFunc,
137  BOOL Unload,
138  BOOL ApiHook)
139 {
140  PVOID ResultPointer;
142  ULONG ArgumentLength;
145  BOOL bResult;
146  ULONG_PTR pLibNameBuffer = 0, pInitFuncBuffer = 0;
147 
148  /* Do not allow the desktop thread to do callback to user mode */
150 
151  TRACE("co_IntClientLoadLibrary: %S, %S, %d, %d\n", pstrLibName->Buffer, pstrLibName->Buffer, Unload, ApiHook);
152 
153  /* Calculate the size of the argument */
154  ArgumentLength = sizeof(CLIENT_LOAD_LIBRARY_ARGUMENTS);
155  if(pstrLibName)
156  {
157  pLibNameBuffer = ArgumentLength;
158  ArgumentLength += pstrLibName->Length + sizeof(WCHAR);
159  }
160  if(pstrInitFunc)
161  {
162  pInitFuncBuffer = ArgumentLength;
163  ArgumentLength += pstrInitFunc->Length + sizeof(WCHAR);
164  }
165 
166  /* Allocate the argument */
167  pArguments = IntCbAllocateMemory(ArgumentLength);
168  if(pArguments == NULL)
169  {
170  return FALSE;
171  }
172 
173  /* Fill the argument */
174  pArguments->Unload = Unload;
175  pArguments->ApiHook = ApiHook;
176  if(pstrLibName)
177  {
178  /* Copy the string to the callback memory */
179  pLibNameBuffer += (ULONG_PTR)pArguments;
180  pArguments->strLibraryName.Buffer = (PWCHAR)pLibNameBuffer;
181  pArguments->strLibraryName.MaximumLength = pstrLibName->Length + sizeof(WCHAR);
182  RtlCopyUnicodeString(&pArguments->strLibraryName, pstrLibName);
183 
184  /* Fix argument pointer to be relative to the argument */
185  pLibNameBuffer -= (ULONG_PTR)pArguments;
186  pArguments->strLibraryName.Buffer = (PWCHAR)(pLibNameBuffer);
187  }
188  else
189  {
190  RtlZeroMemory(&pArguments->strLibraryName, sizeof(UNICODE_STRING));
191  }
192 
193  if(pstrInitFunc)
194  {
195  /* Copy the strings to the callback memory */
196  pInitFuncBuffer += (ULONG_PTR)pArguments;
197  pArguments->strInitFuncName.Buffer = (PWCHAR)pInitFuncBuffer;
198  pArguments->strInitFuncName.MaximumLength = pstrInitFunc->Length + sizeof(WCHAR);
199  RtlCopyUnicodeString(&pArguments->strInitFuncName, pstrInitFunc);
200 
201  /* Fix argument pointers to be relative to the argument */
202  pInitFuncBuffer -= (ULONG_PTR)pArguments;
203  pArguments->strInitFuncName.Buffer = (PWCHAR)(pInitFuncBuffer);
204  }
205  else
206  {
207  RtlZeroMemory(&pArguments->strInitFuncName, sizeof(UNICODE_STRING));
208  }
209 
210  /* Do the callback */
211  UserLeaveCo();
212 
214  pArguments,
215  ArgumentLength,
216  &ResultPointer,
217  &ResultLength);
218 
219  UserEnterCo();
220 
221  /* Free the argument */
222  IntCbFreeMemory(pArguments);
223 
224  if(!NT_SUCCESS(Status))
225  {
226  return FALSE;
227  }
228 
229  _SEH2_TRY
230  {
231  /* Probe and copy the usermode result data */
232  ProbeForRead(ResultPointer, sizeof(HMODULE), 1);
233  bResult = *(BOOL*)ResultPointer;
234  }
236  {
237  bResult = FALSE;
238  }
239  _SEH2_END;
240 
241  return bResult;
242 }
243 
246  HWND hWnd,
247  UINT Msg,
248  ULONG_PTR CompletionCallbackContext,
249  LRESULT Result)
250 {
252  PVOID ResultPointer, pActCtx;
253  PWND pWnd;
256 
257  /* Do not allow the desktop thread to do callback to user mode */
259 
260  Arguments.Callback = CompletionCallback;
261  Arguments.Wnd = hWnd;
262  Arguments.Msg = Msg;
263  Arguments.Context = CompletionCallbackContext;
264  Arguments.Result = Result;
265 
266  IntSetTebWndCallback (&hWnd, &pWnd, &pActCtx);
267 
268  UserLeaveCo();
269 
271  &Arguments,
273  &ResultPointer,
274  &ResultLength);
275 
276  UserEnterCo();
277 
278  IntRestoreTebWndCallback (hWnd, pWnd, pActCtx);
279 
280  if (!NT_SUCCESS(Status))
281  {
282  ERR("KeUserModeCallback failed with %lx\n", Status);
283  return;
284  }
285  return;
286 }
287 
290  BOOLEAN IsAnsiProc,
291  HWND Wnd,
292  UINT Message,
293  WPARAM wParam,
294  LPARAM lParam,
295  INT lParamBufferSize)
296 {
297  WINDOWPROC_CALLBACK_ARGUMENTS StackArguments;
300  PVOID ResultPointer, pActCtx;
301  PWND pWnd;
303  ULONG ArgumentLength;
304  LRESULT Result;
305 
306  TRACE("co_IntCallWindowProc(Proc %p, IsAnsiProc: %s, Wnd %p, Message %u, wParam %Iu, lParam %Id, lParamBufferSize %d)\n",
307  Proc, IsAnsiProc ? "TRUE" : "FALSE", Wnd, Message, wParam, lParam, lParamBufferSize);
308 
309  /* Do not allow the desktop thread to do callback to user mode */
311 
312  if (lParamBufferSize != -1)
313  {
314  ArgumentLength = sizeof(WINDOWPROC_CALLBACK_ARGUMENTS) + lParamBufferSize;
315  Arguments = IntCbAllocateMemory(ArgumentLength);
316  if (NULL == Arguments)
317  {
318  ERR("Unable to allocate buffer for window proc callback\n");
319  return -1;
320  }
321  RtlMoveMemory((PVOID) ((char *) Arguments + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)),
322  (PVOID) lParam, lParamBufferSize);
323  }
324  else
325  {
326  Arguments = &StackArguments;
327  ArgumentLength = sizeof(WINDOWPROC_CALLBACK_ARGUMENTS);
328  }
329  Arguments->Proc = Proc;
330  Arguments->IsAnsiProc = IsAnsiProc;
331  Arguments->Wnd = Wnd;
332  Arguments->Msg = Message;
333  Arguments->wParam = wParam;
334  Arguments->lParam = lParam;
335  Arguments->lParamBufferSize = lParamBufferSize;
336  ResultPointer = NULL;
337  ResultLength = ArgumentLength;
338 
339  IntSetTebWndCallback (&Wnd, &pWnd, &pActCtx);
340 
341  UserLeaveCo();
342 
344  Arguments,
345  ArgumentLength,
346  &ResultPointer,
347  &ResultLength);
348  if (!NT_SUCCESS(Status))
349  {
350  ERR("Error Callback to User space Status %lx Message %d\n",Status,Message);
351  UserEnterCo();
352  return 0;
353  }
354 
355  _SEH2_TRY
356  {
357  /* Simulate old behaviour: copy into our local buffer */
358  RtlMoveMemory(Arguments, ResultPointer, ArgumentLength);
359  }
361  {
362  ERR("Failed to copy result from user mode, Message %u lParam size %d!\n", Message, lParamBufferSize);
364  }
365  _SEH2_END;
366 
367  UserEnterCo();
368 
369  IntRestoreTebWndCallback (Wnd, pWnd, pActCtx);
370 
371  if (!NT_SUCCESS(Status))
372  {
373  ERR("Call to user mode failed! 0x%08lx\n",Status);
374  if (lParamBufferSize != -1)
375  {
376  IntCbFreeMemory(Arguments);
377  }
378  return -1;
379  }
380  Result = Arguments->Result;
381 
382  if (lParamBufferSize != -1)
383  {
385  // Is this message being processed from inside kernel space?
386  BOOL InSendMessage = (pti->pcti->CTI_flags & CTI_INSENDMESSAGE);
387 
388  TRACE("Copy lParam Message %u lParam %d!\n", Message, lParam);
389  switch (Message)
390  {
391  default:
392  TRACE("Don't copy lParam, Message %u Size %d lParam %d!\n", Message, lParamBufferSize, lParam);
393  break;
394  // Write back to user/kernel space. Also see g_MsgMemory.
395  case WM_CREATE:
396  case WM_GETMINMAXINFO:
397  case WM_GETTEXT:
398  case WM_NCCALCSIZE:
399  case WM_NCCREATE:
400  case WM_STYLECHANGING:
402  case WM_SIZING:
403  case WM_MOVING:
404  case WM_MEASUREITEM:
405  case WM_NEXTMENU:
406  TRACE("Copy lParam, Message %u Size %d lParam %d!\n", Message, lParamBufferSize, lParam);
407  if (InSendMessage)
408  // Copy into kernel space.
410  (PVOID) ((char *) Arguments + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)),
411  lParamBufferSize);
412  else
413  {
414  _SEH2_TRY
415  { // Copy into user space.
417  (PVOID) ((char *) Arguments + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)),
418  lParamBufferSize);
419  }
421  {
422  ERR("Failed to copy lParam to user space, Message %u!\n", Message);
423  }
424  _SEH2_END;
425  }
426  break;
427  }
428  IntCbFreeMemory(Arguments);
429  }
430 
431  return Result;
432 }
433 
436 {
437  LRESULT Result = 0;
439  PVOID ResultPointer;
441 
442  /* Do not allow the desktop thread to do callback to user mode */
444 
445  ResultPointer = NULL;
446  ResultLength = sizeof(LRESULT);
447 
448  UserLeaveCo();
449 
451  &ResultPointer,
452  0,
453  &ResultPointer,
454  &ResultLength);
455  if (NT_SUCCESS(Status))
456  {
457  /* Simulate old behaviour: copy into our local buffer */
458  _SEH2_TRY
459  {
460  ProbeForRead(ResultPointer, sizeof(LRESULT), 1);
461  Result = *(LRESULT*)ResultPointer;
462  }
464  {
465  Result = 0;
466  }
467  _SEH2_END;
468  }
469 
470  UserEnterCo();
471 
472  return (HMENU)Result;
473 }
474 
475 extern HCURSOR gDesktopCursor;
476 
479 {
481  PVOID ResultPointer;
483  BOOL DefaultCursor = TRUE;
484 
485  /* Do not allow the desktop thread to do callback to user mode */
487 
488  ResultPointer = NULL;
489  ResultLength = sizeof(HCURSOR);
490 
491  UserLeaveCo();
492 
494  &DefaultCursor,
495  sizeof(BOOL),
496  &ResultPointer,
497  &ResultLength);
498 
499  UserEnterCo();
500 
501  if (!NT_SUCCESS(Status))
502  {
503  return FALSE;
504  }
505 
506  /* HACK: The desktop class doen't have a proper cursor yet, so set it here */
507  gDesktopCursor = *((HCURSOR*)ResultPointer);
508 
509  return TRUE;
510 }
511 
512 static INT iTheId = -2; // Set it out of range.
513 
516  INT Code,
517  WPARAM wParam,
518  LPARAM lParam,
519  HOOKPROC Proc,
520  INT Mod,
521  ULONG_PTR offPfn,
522  BOOLEAN Ansi,
524 {
525  ULONG ArgumentLength;
526  PVOID Argument = NULL;
527  LRESULT Result = 0;
529  PVOID ResultPointer;
532  CBT_CREATEWNDW *CbtCreateWnd = NULL;
533  PCHAR Extra;
534  PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS CbtCreatewndExtra = NULL;
535  PTHREADINFO pti;
536  PWND pWnd;
537  PMSG pMsg = NULL;
538  BOOL Hit = FALSE;
539  UINT lParamSize = 0;
540  CWPSTRUCT* pCWP = NULL;
541  CWPRETSTRUCT* pCWPR = NULL;
542 
543  ASSERT(Proc);
544  /* Do not allow the desktop thread to do callback to user mode */
546 
548  if (pti->TIF_flags & TIF_INCLEANUP)
549  {
550  ERR("Thread is in cleanup and trying to call hook %d\n", Code);
551  return 0;
552  }
553 
554  ArgumentLength = sizeof(HOOKPROC_CALLBACK_ARGUMENTS);
555 
556  switch(HookId)
557  {
558  case WH_CBT:
559  TRACE("WH_CBT: Code %d\n", Code);
560  switch(Code)
561  {
562  case HCBT_CREATEWND:
563  pWnd = UserGetWindowObject((HWND) wParam);
564  if (!pWnd)
565  {
566  ERR("WH_CBT HCBT_CREATEWND wParam bad hWnd!\n");
567  goto Fault_Exit;
568  }
569  TRACE("HCBT_CREATEWND AnsiCreator %s, AnsiHook %s\n", pWnd->state & WNDS_ANSICREATOR ? "True" : "False", Ansi ? "True" : "False");
570  // Due to KsStudio.exe, just pass the callers original pointers
571  // except class which point to kernel space if not an atom.
572  // Found by, Olaf Siejka
573  CbtCreateWnd = (CBT_CREATEWNDW *) lParam;
574  ArgumentLength += sizeof(HOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS);
575  break;
576 
577  case HCBT_MOVESIZE:
578  ArgumentLength += sizeof(RECTL);
579  break;
580  case HCBT_ACTIVATE:
581  ArgumentLength += sizeof(CBTACTIVATESTRUCT);
582  break;
583  case HCBT_CLICKSKIPPED:
584  ArgumentLength += sizeof(MOUSEHOOKSTRUCT);
585  break;
586 /* ATM pass on */
587  case HCBT_KEYSKIPPED:
588  case HCBT_MINMAX:
589  case HCBT_SETFOCUS:
590  case HCBT_SYSCOMMAND:
591 /* These types pass through. */
592  case HCBT_DESTROYWND:
593  case HCBT_QS:
594  break;
595  default:
596  ERR("Trying to call unsupported CBT hook %d\n", Code);
597  goto Fault_Exit;
598  }
599  break;
600  case WH_KEYBOARD_LL:
601  ArgumentLength += sizeof(KBDLLHOOKSTRUCT);
602  break;
603  case WH_MOUSE_LL:
604  ArgumentLength += sizeof(MSLLHOOKSTRUCT);
605  break;
606  case WH_MOUSE:
607  ArgumentLength += sizeof(MOUSEHOOKSTRUCT);
608  break;
609  case WH_CALLWNDPROC:
610  {
611  pCWP = (CWPSTRUCT*) lParam;
612  ArgumentLength = sizeof(CWP_Struct);
613  lParamSize = lParamMemorySize(pCWP->message, pCWP->wParam, pCWP->lParam);
614  ArgumentLength += lParamSize;
615  break;
616  }
617  case WH_CALLWNDPROCRET:
618  {
619  pCWPR = (CWPRETSTRUCT*) lParam;
620  ArgumentLength = sizeof(CWPR_Struct);
621  lParamSize = lParamMemorySize(pCWPR->message, pCWPR->wParam, pCWPR->lParam);
622  ArgumentLength += lParamSize;
623  break;
624  }
625  case WH_MSGFILTER:
626  case WH_SYSMSGFILTER:
627  case WH_GETMESSAGE:
628  ArgumentLength += sizeof(MSG);
629  break;
630  case WH_FOREGROUNDIDLE:
631  case WH_KEYBOARD:
632  case WH_SHELL:
633  break;
634  default:
635  ERR("Trying to call unsupported window hook %d\n", HookId);
636  goto Fault_Exit;
637  }
638 
639  Argument = IntCbAllocateMemory(ArgumentLength);
640  if (NULL == Argument)
641  {
642  ERR("HookProc callback failed: out of memory\n");
643  goto Fault_Exit;
644  }
645  Common = (PHOOKPROC_CALLBACK_ARGUMENTS) Argument;
646  Common->HookId = HookId;
647  Common->Code = Code;
648  Common->wParam = wParam;
649  Common->lParam = lParam;
650  Common->Proc = Proc;
651  Common->Mod = Mod;
652  Common->offPfn = offPfn;
653  Common->Ansi = Ansi;
654  Common->lParamSize = lParamSize;
655  RtlZeroMemory(&Common->ModuleName, sizeof(Common->ModuleName));
656  if (ModuleName->Buffer && ModuleName->Length)
657  {
658  RtlCopyMemory(&Common->ModuleName, ModuleName->Buffer, ModuleName->Length);
659  // If ModuleName->Buffer NULL while in destroy,
660  // this will make User32:Hook.c complain about not loading the library module.
661  // Fix symptom for CORE-10549.
662  }
663  Extra = (PCHAR) Common + sizeof(HOOKPROC_CALLBACK_ARGUMENTS);
664 
665  switch(HookId)
666  {
667  case WH_CBT:
668  switch(Code)
669  { // Need to remember this is not the first time through! Call Next Hook?
670  case HCBT_CREATEWND:
671  CbtCreatewndExtra = (PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS) Extra;
672  RtlCopyMemory( &CbtCreatewndExtra->Cs, CbtCreateWnd->lpcs, sizeof(CREATESTRUCTW) );
673  CbtCreatewndExtra->WndInsertAfter = CbtCreateWnd->hwndInsertAfter;
674  CbtCreatewndExtra->Cs.lpszClass = CbtCreateWnd->lpcs->lpszClass;
675  CbtCreatewndExtra->Cs.lpszName = CbtCreateWnd->lpcs->lpszName;
676  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
677  break;
678  case HCBT_CLICKSKIPPED:
679  RtlCopyMemory(Extra, (PVOID) lParam, sizeof(MOUSEHOOKSTRUCT));
680  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
681  break;
682  case HCBT_MOVESIZE:
683  RtlCopyMemory(Extra, (PVOID) lParam, sizeof(RECTL));
684  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
685  break;
686  case HCBT_ACTIVATE:
687  RtlCopyMemory(Extra, (PVOID) lParam, sizeof(CBTACTIVATESTRUCT));
688  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
689  break;
690  }
691  break;
692  case WH_KEYBOARD_LL:
693  RtlCopyMemory(Extra, (PVOID) lParam, sizeof(KBDLLHOOKSTRUCT));
694  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
695  break;
696  case WH_MOUSE_LL:
697  RtlCopyMemory(Extra, (PVOID) lParam, sizeof(MSLLHOOKSTRUCT));
698  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
699  break;
700  case WH_MOUSE:
701  RtlCopyMemory(Extra, (PVOID) lParam, sizeof(MOUSEHOOKSTRUCT));
702  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
703  break;
704  case WH_CALLWNDPROC:
705  {
706  PCWP_Struct pcwps = (PCWP_Struct)Common;
707  RtlCopyMemory( &pcwps->cwps, pCWP, sizeof(CWPSTRUCT));
708  /* For CALLWNDPROC and CALLWNDPROCRET, we must be wary of the fact that
709  * lParam could be a pointer to a buffer. This buffer must be exported
710  * to user space too */
711  if ( lParamSize )
712  {
713  RtlCopyMemory( &pcwps->Extra, (PVOID)pCWP->lParam, lParamSize );
714  }
715  }
716  break;
717  case WH_CALLWNDPROCRET:
718  {
719  PCWPR_Struct pcwprs = (PCWPR_Struct)Common;
720  RtlCopyMemory( &pcwprs->cwprs, pCWPR, sizeof(CWPRETSTRUCT));
721  if ( lParamSize )
722  {
723  RtlCopyMemory( &pcwprs->Extra, (PVOID)pCWPR->lParam, lParamSize );
724  }
725  }
726  break;
727  case WH_MSGFILTER:
728  case WH_SYSMSGFILTER:
729  case WH_GETMESSAGE:
730  pMsg = (PMSG)lParam;
731  RtlCopyMemory(Extra, (PVOID) pMsg, sizeof(MSG));
732  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
733  break;
734  case WH_FOREGROUNDIDLE:
735  case WH_KEYBOARD:
736  case WH_SHELL:
737  break;
738  }
739 
740  ResultPointer = NULL;
741  ResultLength = ArgumentLength;
742 
743  UserLeaveCo();
744 
746  Argument,
747  ArgumentLength,
748  &ResultPointer,
749  &ResultLength);
750 
751  UserEnterCo();
752 
753  if (!NT_SUCCESS(Status))
754  {
755  if ( iTheId != HookId ) // Hook ID can change.
756  {
757  ERR("Failure to make Callback %d! Status 0x%x\n",HookId,Status);
758  iTheId = HookId;
759  }
760  goto Fault_Exit;
761  }
762 
763  if (ResultPointer)
764  {
765  _SEH2_TRY
766  {
767  /* Simulate old behaviour: copy into our local buffer */
768  RtlMoveMemory(Argument, ResultPointer, ArgumentLength);
769  Result = Common->Result;
770  }
772  {
773  Result = 0;
774  Hit = TRUE;
775  }
776  _SEH2_END;
777  }
778  else
779  {
780  ERR("ERROR: Hook %d Code %d ResultPointer 0x%p ResultLength %u\n",HookId,Code,ResultPointer,ResultLength);
781  }
782 
783  /* Support write backs... SEH is in UserCallNextHookEx. */
784  switch (HookId)
785  {
786  case WH_CBT:
787  {
788  switch (Code)
789  {
790  case HCBT_CREATEWND:
791  if (CbtCreatewndExtra)
792  {/*
793  The parameters could have been changed, include the coordinates
794  and dimensions of the window. We copy it back.
795  */
796  CbtCreateWnd->hwndInsertAfter = CbtCreatewndExtra->WndInsertAfter;
797  CbtCreateWnd->lpcs->x = CbtCreatewndExtra->Cs.x;
798  CbtCreateWnd->lpcs->y = CbtCreatewndExtra->Cs.y;
799  CbtCreateWnd->lpcs->cx = CbtCreatewndExtra->Cs.cx;
800  CbtCreateWnd->lpcs->cy = CbtCreatewndExtra->Cs.cy;
801  }
802  break;
803  case HCBT_MOVESIZE:
804  if (Extra && lParam)
805  {
806  RtlCopyMemory((PVOID) lParam, Extra, sizeof(RECTL));
807  }
808  break;
809  }
810  }
811  // "The GetMsgProc hook procedure can examine or modify the message."
812  case WH_GETMESSAGE:
813  if (pMsg)
814  {
815  RtlCopyMemory((PVOID) pMsg, Extra, sizeof(MSG));
816  }
817  break;
818  }
819 
820 Fault_Exit:
821  if (Hit)
822  {
823  ERR("Exception CallHookProc HookId %d Code %d\n",HookId,Code);
824  }
825  if (Argument) IntCbFreeMemory(Argument);
826 
827  return Result;
828 }
829 
830 //
831 // Events are notifications w/o results.
832 //
833 LRESULT
834 APIENTRY
836  DWORD event,
837  HWND hWnd,
838  LONG idObject,
839  LONG idChild,
840  DWORD dwEventThread,
841  DWORD dwmsEventTime,
842  WINEVENTPROC Proc,
843  INT Mod,
844  ULONG_PTR offPfn)
845 {
846  LRESULT Result = 0;
849  ULONG ArgumentLength, ResultLength;
850  PVOID Argument, ResultPointer;
851 
852  ArgumentLength = sizeof(EVENTPROC_CALLBACK_ARGUMENTS);
853 
854  Argument = IntCbAllocateMemory(ArgumentLength);
855  if (NULL == Argument)
856  {
857  ERR("EventProc callback failed: out of memory\n");
858  return 0;
859  }
860  Common = (PEVENTPROC_CALLBACK_ARGUMENTS) Argument;
861  Common->hook = hook;
862  Common->event = event;
863  Common->hwnd = hWnd;
864  Common->idObject = idObject;
865  Common->idChild = idChild;
866  Common->dwEventThread = dwEventThread;
867  Common->dwmsEventTime = dwmsEventTime;
868  Common->Proc = Proc;
869  Common->Mod = Mod;
870  Common->offPfn = offPfn;
871 
872  ResultPointer = NULL;
873  ResultLength = sizeof(LRESULT);
874 
875  UserLeaveCo();
876 
878  Argument,
879  ArgumentLength,
880  &ResultPointer,
881  &ResultLength);
882 
883  UserEnterCo();
884 
885  IntCbFreeMemory(Argument);
886 
887  if (!NT_SUCCESS(Status))
888  {
889  return 0;
890  }
891 
892  return Result;
893 }
894 
895 //
896 // Callback Load Menu and results.
897 //
898 HMENU
899 APIENTRY
901  PUNICODE_STRING pMenuName )
902 {
903  LRESULT Result = 0;
906  ULONG ArgumentLength, ResultLength;
907  PVOID Argument, ResultPointer;
908 
909  ArgumentLength = sizeof(LOADMENU_CALLBACK_ARGUMENTS);
910 
911  ArgumentLength += pMenuName->Length + sizeof(WCHAR);
912 
913  Argument = IntCbAllocateMemory(ArgumentLength);
914  if (NULL == Argument)
915  {
916  ERR("LoadMenu callback failed: out of memory\n");
917  return 0;
918  }
919  Common = (PLOADMENU_CALLBACK_ARGUMENTS) Argument;
920 
921  // Help Intersource check and MenuName is now 4 bytes + so zero it.
922  RtlZeroMemory(Common, ArgumentLength);
923 
924  Common->hModule = hModule;
925  if (pMenuName->Length)
926  RtlCopyMemory(&Common->MenuName, pMenuName->Buffer, pMenuName->Length);
927  else
928  Common->InterSource = pMenuName->Buffer;
929 
930  ResultPointer = NULL;
931  ResultLength = sizeof(LRESULT);
932 
933  UserLeaveCo();
934 
936  Argument,
937  ArgumentLength,
938  &ResultPointer,
939  &ResultLength);
940 
941  UserEnterCo();
942 
943  if (NT_SUCCESS(Status))
944  {
945  Result = *(LRESULT*)ResultPointer;
946  }
947  else
948  {
949  Result = 0;
950  }
951 
952  IntCbFreeMemory(Argument);
953 
954  return (HMENU)Result;
955 }
956 
957 NTSTATUS
958 APIENTRY
960 {
962  ULONG ArgumentLength, ResultLength;
963  PVOID Argument, ResultPointer;
964 
965  /* Do not allow the desktop thread to do callback to user mode */
967 
968  ArgumentLength = ResultLength = 0;
969  Argument = ResultPointer = NULL;
970 
971  UserLeaveCo();
972 
974  Argument,
975  ArgumentLength,
976  &ResultPointer,
977  &ResultLength);
978 
979  UserEnterCo();
980 
981  return Status;
982 }
983 
985 co_IntCopyImage(HANDLE hnd, UINT type, INT desiredx, INT desiredy, UINT flags)
986 {
987  HANDLE Handle;
989  ULONG ArgumentLength, ResultLength;
990  PVOID Argument, ResultPointer;
992 
993  ArgumentLength = ResultLength = 0;
994  Argument = ResultPointer = NULL;
995 
996  ArgumentLength = sizeof(COPYIMAGE_CALLBACK_ARGUMENTS);
997 
998  Argument = IntCbAllocateMemory(ArgumentLength);
999  if (NULL == Argument)
1000  {
1001  ERR("CopyImage callback failed: out of memory\n");
1002  return 0;
1003  }
1004  Common = (PCOPYIMAGE_CALLBACK_ARGUMENTS) Argument;
1005 
1006  Common->hImage = hnd;
1007  Common->uType = type;
1008  Common->cxDesired = desiredx;
1009  Common->cyDesired = desiredy;
1010  Common->fuFlags = flags;
1011 
1012  UserLeaveCo();
1013 
1015  Argument,
1016  ArgumentLength,
1017  &ResultPointer,
1018  &ResultLength);
1019 
1020 
1021  UserEnterCo();
1022 
1023  if (NT_SUCCESS(Status))
1024  {
1025  Handle = *(HANDLE*)ResultPointer;
1026  }
1027  else
1028  {
1029  ERR("CopyImage callback failed!\n");
1030  Handle = NULL;
1031  }
1032 
1033  IntCbFreeMemory(Argument);
1034 
1035  return Handle;
1036 }
1037 
1038 BOOL
1039 APIENTRY
1041 {
1042  NTSTATUS Status;
1043  ULONG ArgumentLength, ResultLength;
1044  PVOID Argument, ResultPointer;
1045  PGET_CHARSET_INFO Common;
1046 
1047  ArgumentLength = sizeof(GET_CHARSET_INFO);
1048 
1049  Argument = IntCbAllocateMemory(ArgumentLength);
1050  if (NULL == Argument)
1051  {
1052  ERR("GetCharsetInfo callback failed: out of memory\n");
1053  return 0;
1054  }
1055  Common = (PGET_CHARSET_INFO) Argument;
1056 
1057  Common->Locale = Locale;
1058 
1059  ResultPointer = NULL;
1060  ResultLength = ArgumentLength;
1061 
1062  UserLeaveCo();
1063 
1065  Argument,
1066  ArgumentLength,
1067  &ResultPointer,
1068  &ResultLength);
1069 
1070  if (NT_SUCCESS(Status))
1071  {
1072  _SEH2_TRY
1073  {
1074  /* Need to copy into our local buffer */
1075  RtlMoveMemory(Argument, ResultPointer, ArgumentLength);
1076  }
1078  {
1079  ERR("Failed to copy result from user mode!\n");
1081  }
1082  _SEH2_END;
1083  }
1084 
1085  UserEnterCo();
1086 
1087  RtlCopyMemory(pCs, &Common->Cs, sizeof(CHARSETINFO));
1088 
1089  IntCbFreeMemory(Argument);
1090 
1091  if (!NT_SUCCESS(Status))
1092  {
1093  ERR("GetCharsetInfo Failed!!\n");
1094  return FALSE;
1095  }
1096 
1097  return TRUE;
1098 }
1099 
1100 BOOL FASTCALL
1102 {
1103  NTSTATUS Status;
1104  ULONG ArgumentLength, ResultLength;
1105  PVOID Argument, ResultPointer;
1107 
1108  ResultPointer = NULL;
1109  ResultLength = ArgumentLength = sizeof(SETWNDICONS_CALLBACK_ARGUMENTS);
1110 
1111  Argument = IntCbAllocateMemory(ArgumentLength);
1112  if (NULL == Argument)
1113  {
1114  ERR("Set Window Icons callback failed: out of memory\n");
1115  return FALSE;
1116  }
1117  Common = (PSETWNDICONS_CALLBACK_ARGUMENTS) Argument;
1118 
1119  UserLeaveCo();
1120 
1122  Argument,
1123  ArgumentLength,
1124  &ResultPointer,
1125  &ResultLength);
1126 
1127 
1128  UserEnterCo();
1129 
1130  if (!NT_SUCCESS(Status))
1131  {
1132  ERR("Set Window Icons callback failed!\n");
1133  IntCbFreeMemory(Argument);
1134  return FALSE;
1135  }
1136 
1137  RtlMoveMemory(Common, ResultPointer, ArgumentLength);
1138  gpsi->hIconSmWindows = Common->hIconSmWindows;
1139  gpsi->hIconWindows = Common->hIconWindows;
1140 
1146  IntLoadSystenIcons(gpsi->hIconWindows, OIC_WINLOGO);
1147  IntLoadSystenIcons(gpsi->hIconSmWindows, OIC_WINLOGO+1);
1148 
1149  ERR("hIconSmWindows %p hIconWindows %p \n",gpsi->hIconSmWindows,gpsi->hIconWindows);
1150 
1151  IntCbFreeMemory(Argument);
1152 
1153  return TRUE;
1154 }
1155 
1156 VOID FASTCALL
1158 {
1160  PVOID ResultPointer;
1161  NTSTATUS Status;
1162  UserLeaveCo();
1163 
1165  0,
1166  0,
1167  &ResultPointer,
1168  &ResultLength);
1169 
1170 
1171  UserEnterCo();
1172 
1173  if (!NT_SUCCESS(Status))
1174  {
1175  ERR("Delivering User APC callback failed!\n");
1176  }
1177 }
1178 
1179 VOID FASTCALL
1181 {
1182  NTSTATUS Status;
1183  ULONG ArgumentLength, ResultLength;
1184  PVOID Argument, ResultPointer;
1186 
1187  ResultPointer = NULL;
1188  ResultLength = ArgumentLength = sizeof(SETOBM_CALLBACK_ARGUMENTS);
1189 
1190  Argument = IntCbAllocateMemory(ArgumentLength);
1191  if (NULL == Argument)
1192  {
1193  ERR("Set Window Icons callback failed: out of memory\n");
1194  return;
1195  }
1196  Common = (PSETOBM_CALLBACK_ARGUMENTS) Argument;
1197 
1198  UserLeaveCo();
1199 
1201  Argument,
1202  ArgumentLength,
1203  &ResultPointer,
1204  &ResultLength);
1205 
1206 
1207  UserEnterCo();
1208 
1209  if (!NT_SUCCESS(Status))
1210  {
1211  ERR("Set Window Icons callback failed!\n");
1212  IntCbFreeMemory(Argument);
1213  return;
1214  }
1215 
1216  RtlMoveMemory(Common, ResultPointer, ArgumentLength);
1217  RtlCopyMemory(gpsi->oembmi, Common->oembmi, sizeof(gpsi->oembmi));
1218 
1219  IntCbFreeMemory(Argument);
1220 }
1221 
1222 //
1223 // Called from Kernel GDI sides, no UserLeave/EnterCo required.
1224 //
1225 LRESULT
1226 APIENTRY
1227 co_UserCBClientPrinterThunk( PVOID pkt, INT InSize, PVOID pvOutData, INT OutSize )
1228 {
1229  NTSTATUS Status;
1230  PVOID ResultPointer;
1231 
1233  pkt,
1234  InSize,
1235  &ResultPointer,
1236  (PULONG)&OutSize );
1237 
1238 
1239  if (!NT_SUCCESS(Status))
1240  {
1241  ERR("User UMPD callback failed!\n");
1242  return 1;
1243  }
1244 
1245  if (OutSize) RtlMoveMemory( pvOutData, ResultPointer, OutSize );
1246 
1247  return 0;
1248 }
1249 
1250 /* EOF */
#define WH_MOUSE
Definition: winuser.h:37
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
signed char * PCHAR
Definition: retypes.h:7
NTSTATUS NTAPI KeUserModeCallback(IN ULONG RoutineIndex, IN PVOID Argument, IN ULONG ArgumentLength, OUT PVOID *Result, OUT PULONG ResultLength)
Definition: stubs.c:100
#define HCBT_CLICKSKIPPED
Definition: winuser.h:61
#define HCBT_SYSCOMMAND
Definition: winuser.h:63
struct _EVENTPROC_CALLBACK_ARGUMENTS * PEVENTPROC_CALLBACK_ARGUMENTS
WPARAM wParam
Definition: winuser.h:2994
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define WH_GETMESSAGE
Definition: winuser.h:33
#define HCBT_CREATEWND
Definition: winuser.h:58
struct _COPYIMAGE_CALLBACK_ARGUMENTS * PCOPYIMAGE_CALLBACK_ARGUMENTS
struct _INT_CALLBACK_HEADER INT_CALLBACK_HEADER
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define USER32_CALLBACK_LOADSYSMENUTEMPLATE
Definition: callback.h:6
VOID FASTCALL IntCbFreeMemory(PVOID Data)
Definition: callback.c:49
VOID NTAPI Unload(PDRIVER_OBJECT DriverObject)
Definition: csqtest.c:160
BOOL APIENTRY co_IntGetCharsetInfo(LCID Locale, PCHARSETINFO pCs)
Definition: callback.c:1040
#define WM_NCCALCSIZE
Definition: winuser.h:1667
LPCREATESTRUCTW lpcs
Definition: winuser.h:2950
struct tagCWP_Struct * PCWP_Struct
struct _EVENTPROC_CALLBACK_ARGUMENTS EVENTPROC_CALLBACK_ARGUMENTS
ACPI_SIZE Length
Definition: actypes.h:1043
FLONG TIF_flags
Definition: win32.h:94
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define USER32_CALLBACK_SENDASYNCPROC
Definition: callback.h:5
#define WH_MSGFILTER
Definition: winuser.h:29
#define WM_GETTEXT
Definition: winuser.h:1600
HCURSOR gDesktopCursor
Definition: desktop.c:38
struct tagKBDLLHOOKSTRUCT KBDLLHOOKSTRUCT
struct _HOOKPROC_CALLBACK_ARGUMENTS * PHOOKPROC_CALLBACK_ARGUMENTS
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
LONG NTSTATUS
Definition: precomp.h:26
struct _CLIENT_LOAD_LIBRARY_ARGUMENTS CLIENT_LOAD_LIBRARY_ARGUMENTS
HWND hWnd
Definition: settings.c:17
#define WH_SHELL
Definition: winuser.h:40
CWPSTRUCT cwps
Definition: callback.h:79
static VOID IntRestoreTebWndCallback(HWND hWnd, PWND pWnd, PVOID pActCtx)
Definition: callback.c:121
BOOL WINAPI InSendMessage(void)
Definition: message.c:1371
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define USER32_CALLBACK_SETOBM
Definition: callback.h:19
LPARAM lParam
Definition: winuser.h:2993
DWORD LCID
Definition: nls.h:13
UINT_PTR WPARAM
Definition: windef.h:207
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1274
#define GetWin32ClientInfo()
Definition: ntuser.h:320
#define HCBT_SETFOCUS
Definition: winuser.h:64
uint16_t * PWCHAR
Definition: typedefs.h:55
HICON HCURSOR
Definition: windef.h:299
LRESULT APIENTRY co_IntCallWindowProc(WNDPROC Proc, BOOLEAN IsAnsiProc, HWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam, INT lParamBufferSize)
Definition: callback.c:289
#define InsertTailList(ListHead, Entry)
static HWINEVENTHOOK(WINAPI *pSetWinEventHook)(DWORD
#define USER32_CALLBACK_GETCHARSETINFO
Definition: callback.h:13
struct tagCWPR_Struct CWPR_Struct
#define FASTCALL
Definition: nt_native.h:50
#define WM_NCCREATE
Definition: winuser.h:1665
VOID FASTCALL co_IntSetupOBM(VOID)
Definition: callback.c:1180
PSERVERINFO gpsi
Definition: main.c:27
int32_t INT
Definition: typedefs.h:57
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define OIC_WINLOGO
Definition: winuser.h:1153
WPARAM wParam
Definition: combotst.c:138
LRESULT(CALLBACK * HOOKPROC)(int, WPARAM, LPARAM)
Definition: winuser.h:2874
#define OIC_NOTE
Definition: winuser.h:1152
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
VOID IntLoadSystenIcons(HICON hcur, DWORD id)
Definition: cursoricon.c:137
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
_SEH2_TRY
Definition: create.c:4250
static __inline PVOID DesktopHeapAddressToUser(PVOID lpMem)
Definition: desktop.h:327
UNICODE_STRING strInitFuncName
Definition: callback.h:123
#define HCBT_KEYSKIPPED
Definition: winuser.h:62
struct tagMSLLHOOKSTRUCT MSLLHOOKSTRUCT
HWND hwndInsertAfter
Definition: winuser.h:2951
uint32_t ULONG_PTR
Definition: typedefs.h:64
#define WH_FOREGROUNDIDLE
Definition: winuser.h:41
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
CHARSETINFO Cs
Definition: callback.h:131
CLIENT_DATA ClientInfo
#define WM_NEXTMENU
Definition: winuser.h:1788
#define WH_MOUSE_LL
Definition: winuser.h:44
PTHREADINFO gptiDesktopThread
Definition: desktop.c:37
struct tagMOUSEHOOKSTRUCT MOUSEHOOKSTRUCT
Definition: window.c:28
VOID FASTCALL co_IntDeliverUserAPC(VOID)
Definition: callback.c:1157
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
BOOL FASTCALL co_IntSetWndIcons(VOID)
Definition: callback.c:1101
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define HCBT_DESTROYWND
Definition: winuser.h:59
HMENU APIENTRY co_IntCallLoadMenu(HINSTANCE hModule, PUNICODE_STRING pMenuName)
Definition: callback.c:900
#define UserLeaveCo
Definition: ntuser.h:10
PBYTE Extra[4]
Definition: callback.h:80
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define WM_SIZING
Definition: winuser.h:1789
#define USER32_CALLBACK_WINDOWPROC
Definition: callback.h:4
#define USER32_CALLBACK_EVENTPROC
Definition: callback.h:9
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:835
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
LIST_ENTRY W32CallbackListHead
Definition: win32.h:151
_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
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
LONG_PTR LPARAM
Definition: windef.h:208
#define WH_CBT
Definition: winuser.h:35
#define WH_CALLWNDPROCRET
Definition: winuser.h:42
static VOID IntSetTebWndCallback(HWND *hWnd, PWND *pWnd, PVOID *pActCtx)
Definition: callback.c:96
CWPRETSTRUCT cwprs
Definition: callback.h:86
struct _CLIENTTHREADINFO * pcti
Definition: win32.h:90
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
LIST_ENTRY ListEntry
Definition: callback.c:22
struct _LOADMENU_CALLBACK_ARGUMENTS * PLOADMENU_CALLBACK_ARGUMENTS
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
PVOID FASTCALL IntCbAllocateMemory(ULONG Size)
Definition: callback.c:27
HANDLE FASTCALL co_IntCopyImage(HANDLE hnd, UINT type, INT desiredx, INT desiredy, UINT flags)
Definition: callback.c:985
#define PCHAR
Definition: match.c:90
#define Code
Definition: deflate.h:80
struct _WINDOWPROC_CALLBACK_ARGUMENTS WINDOWPROC_CALLBACK_ARGUMENTS
LRESULT APIENTRY co_IntCallHookProc(INT HookId, INT Code, WPARAM wParam, LPARAM lParam, HOOKPROC Proc, INT Mod, ULONG_PTR offPfn, BOOLEAN Ansi, PUNICODE_STRING ModuleName)
Definition: callback.c:515
_In_ HANDLE Handle
Definition: extypes.h:390
LRESULT APIENTRY co_UserCBClientPrinterThunk(PVOID pkt, INT InSize, PVOID pvOutData, INT OutSize)
Definition: callback.c:1227
Definition: msg.h:42
VOID(CALLBACK * WINEVENTPROC)(HWINEVENTHOOK, DWORD, HWND, LONG, LONG, DWORD, DWORD)
Definition: winable.h:68
#define TRACE(s)
Definition: solgame.cpp:4
#define OIC_BANG
Definition: winuser.h:1151
#define WH_KEYBOARD_LL
Definition: winuser.h:43
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _HOOKPROC_CALLBACK_ARGUMENTS HOOKPROC_CALLBACK_ARGUMENTS
#define CTI_INSENDMESSAGE
Definition: ntuser.h:161
#define OIC_QUES
Definition: winuser.h:1150
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
void(CALLBACK * SENDASYNCPROC)(HWND, UINT, ULONG_PTR, LRESULT)
Definition: winuser.h:2891
#define USER32_CALLBACK_COPYIMAGE
Definition: callback.h:14
static INT iTheId
Definition: callback.c:512
#define USER32_CALLBACK_LOADDEFAULTCURSORS
Definition: callback.h:7
BOOL APIENTRY co_IntLoadDefaultCursors(VOID)
Definition: callback.c:478
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WM_MEASUREITEM
Definition: winuser.h:1628
LPARAM lParam
Definition: winuser.h:3000
struct tagCWP_Struct CWP_Struct
WPARAM wParam
Definition: winuser.h:3001
PBYTE Extra[4]
Definition: callback.h:87
#define UserEnterCo
Definition: ntuser.h:9
DBG_DEFAULT_CHANNEL(UserCallback)
int Window
Definition: x11stubs.h:26
VOID APIENTRY co_IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback, HWND hWnd, UINT Msg, ULONG_PTR CompletionCallbackContext, LRESULT Result)
Definition: callback.c:245
GLbitfield flags
Definition: glext.h:7161
#define HCBT_QS
Definition: winuser.h:57
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
CHAR Message[80]
Definition: alive.c:5
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
struct _COPYIMAGE_CALLBACK_ARGUMENTS COPYIMAGE_CALLBACK_ARGUMENTS
#define MSG
Definition: Mailslot.c:11
#define USER32_CALLBACK_SETWNDICONS
Definition: callback.h:15
UINT message
Definition: winuser.h:3002
BOOL NTAPI co_IntClientLoadLibrary(PUNICODE_STRING pstrLibName, PUNICODE_STRING pstrInitFunc, BOOL Unload, BOOL ApiHook)
Definition: callback.c:135
#define WM_MOVING
Definition: winuser.h:1791
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
struct tagCWPR_Struct * PCWPR_Struct
#define WH_CALLWNDPROC
Definition: winuser.h:34
struct _SETWNDICONS_CALLBACK_ARGUMENTS SETWNDICONS_CALLBACK_ARGUMENTS
LPCWSTR lpszName
Definition: winuser.h:2939
#define USER32_CALLBACK_LOADMENU
Definition: callback.h:10
#define LRESULT
Definition: ole.h:14
struct _GET_CHARSET_INFO GET_CHARSET_INFO
Definition: typedefs.h:118
UINT lParamMemorySize(UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:243
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
struct _cl_event * event
Definition: glext.h:7739
Status
Definition: gdiplustypes.h:24
#define HCBT_MINMAX
Definition: winuser.h:56
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
#define ERR(fmt,...)
Definition: debug.h:109
struct _SETOBM_CALLBACK_ARGUMENTS SETOBM_CALLBACK_ARGUMENTS
Definition: ntuser.h:657
#define USER32_CALLBACK_CLIENTTHREADSTARTUP
Definition: callback.h:11
_SEH2_END
Definition: create.c:4424
struct _LOADMENU_CALLBACK_ARGUMENTS LOADMENU_CALLBACK_ARGUMENTS
struct _SETOBM_CALLBACK_ARGUMENTS * PSETOBM_CALLBACK_ARGUMENTS
struct _SETWNDICONS_CALLBACK_ARGUMENTS * PSETWNDICONS_CALLBACK_ARGUMENTS
VOID FASTCALL IntCleanupThreadCallbacks(PTHREADINFO W32Thread)
Definition: callback.c:75
struct tagMSG * PMSG
struct _GET_CHARSET_INFO * PGET_CHARSET_INFO
struct _HOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS HOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS
DWORD state
Definition: ntuser.h:665
unsigned int * PULONG
Definition: retypes.h:1
HMENU APIENTRY co_IntLoadSysMenuTemplate(VOID)
Definition: callback.c:435
unsigned int UINT
Definition: ndis.h:50
NTSTATUS APIENTRY co_IntClientThreadSetup(VOID)
Definition: callback.c:959
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define WH_KEYBOARD
Definition: winuser.h:32
struct @1587 Msg[]
#define WM_CREATE
Definition: winuser.h:1590
LPCWSTR lpszClass
Definition: winuser.h:2940
unsigned int ULONG
Definition: retypes.h:1
#define USER32_CALLBACK_UMPD
Definition: callback.h:21
struct tagCBTACTIVATESTRUCT CBTACTIVATESTRUCT
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define HCBT_ACTIVATE
Definition: winuser.h:60
#define ULONG_PTR
Definition: config.h:101
#define USERTAG_CALLBACK
Definition: tags.h:200
struct RECTL RECTL
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
struct _INT_CALLBACK_HEADER * PINT_CALLBACK_HEADER
#define USER32_CALLBACK_HOOKPROC
Definition: callback.h:8
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
const TCHAR * CompletionCallback(unsigned __int64 &rnIndex, const BOOL *pblnForward, const TCHAR *pszContext, const TCHAR *pszBegin)
Definition: Completion.cpp:439
LONG_PTR LRESULT
Definition: windef.h:209
UNICODE_STRING strLibraryName
Definition: callback.h:122
#define OIC_SAMPLE
Definition: winuser.h:1148
#define WNDS_ANSICREATOR
Definition: ntuser.h:602
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define WH_SYSMSGFILTER
Definition: winuser.h:36
LPARAM lParam
Definition: combotst.c:139
#define WM_GETMINMAXINFO
Definition: winuser.h:1622
#define USER32_CALLBACK_CLIENTLOADLIBRARY
Definition: callback.h:12
#define TIF_INCLEANUP
Definition: ntuser.h:240
struct _HOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS * PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS
#define USER32_CALLBACK_DELIVERUSERAPC
Definition: callback.h:16
#define APIENTRY
Definition: api.h:79
struct tagOEMBITMAPINFO oembmi[93]
Definition: callback.h:156
HMODULE hModule
Definition: animate.c:44
#define OIC_HAND
Definition: winuser.h:1149