ReactOS  0.4.15-dev-1389-g828d5fa
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  RtlZeroMemory(Mem, Size + sizeof(INT_CALLBACK_HEADER));
39  W32Thread = PsGetCurrentThreadWin32Thread();
40  ASSERT(W32Thread);
41 
42  /* Insert the callback memory into the thread's callback list */
43 
44  InsertTailList(&W32Thread->W32CallbackListHead, &Mem->ListEntry);
45 
46  return (Mem + 1);
47 }
48 
51 {
53  PTHREADINFO W32Thread;
54 
55  W32Thread = PsGetCurrentThreadWin32Thread();
56  ASSERT(W32Thread);
57 
58  if (W32Thread->TIF_flags & TIF_INCLEANUP)
59  {
60  ERR("CbFM Thread is already in cleanup\n");
61  return;
62  }
63 
64  ASSERT(Data);
65 
66  Mem = ((PINT_CALLBACK_HEADER)Data - 1);
67 
68  /* Remove the memory block from the thread's callback list */
70 
71  /* Free memory */
73 }
74 
77 {
78  PLIST_ENTRY CurrentEntry;
80 
81  while (!IsListEmpty(&W32Thread->W32CallbackListHead))
82  {
83  CurrentEntry = RemoveHeadList(&W32Thread->W32CallbackListHead);
84  Mem = CONTAINING_RECORD(CurrentEntry, INT_CALLBACK_HEADER,
85  ListEntry);
86 
87  /* Free memory */
89  }
90 }
91 
92 //
93 // Pass the Current Window handle and pointer to the Client Callback.
94 // This will help user space programs speed up read access with the window object.
95 //
96 static VOID
97 IntSetTebWndCallback (HWND * hWnd, PWND * pWnd, PVOID * pActCtx)
98 {
99  HWND hWndS = *hWnd;
102 
103  *hWnd = ClientInfo->CallbackWnd.hWnd;
104  *pWnd = ClientInfo->CallbackWnd.pWnd;
105  *pActCtx = ClientInfo->CallbackWnd.pActCtx;
106 
107  if (Window)
108  {
109  ClientInfo->CallbackWnd.hWnd = hWndS;
110  ClientInfo->CallbackWnd.pWnd = DesktopHeapAddressToUser(Window);
111  ClientInfo->CallbackWnd.pActCtx = Window->pActCtx;
112  }
113  else
114  {
115  ClientInfo->CallbackWnd.hWnd = hWndS;
116  ClientInfo->CallbackWnd.pWnd = Window;
117  ClientInfo->CallbackWnd.pActCtx = 0;
118  }
119 }
120 
121 static VOID
123 {
125 
126  ClientInfo->CallbackWnd.hWnd = hWnd;
127  ClientInfo->CallbackWnd.pWnd = pWnd;
128  ClientInfo->CallbackWnd.pActCtx = pActCtx;
129 }
130 
131 /* FUNCTIONS *****************************************************************/
132 
133 /* Calls ClientLoadLibrary in user32 */
134 BOOL
135 NTAPI
137  PUNICODE_STRING pstrInitFunc,
138  BOOL Unload,
139  BOOL ApiHook)
140 {
141  PVOID ResultPointer;
143  ULONG ArgumentLength;
146  BOOL bResult;
147  ULONG_PTR pLibNameBuffer = 0, pInitFuncBuffer = 0;
148 
149  /* Do not allow the desktop thread to do callback to user mode */
151 
152  TRACE("co_IntClientLoadLibrary: %S, %S, %d, %d\n", pstrLibName->Buffer, pstrLibName->Buffer, Unload, ApiHook);
153 
154  /* Calculate the size of the argument */
155  ArgumentLength = sizeof(CLIENT_LOAD_LIBRARY_ARGUMENTS);
156  if(pstrLibName)
157  {
158  pLibNameBuffer = ArgumentLength;
159  ArgumentLength += pstrLibName->Length + sizeof(WCHAR);
160  }
161  if(pstrInitFunc)
162  {
163  pInitFuncBuffer = ArgumentLength;
164  ArgumentLength += pstrInitFunc->Length + sizeof(WCHAR);
165  }
166 
167  /* Allocate the argument */
168  pArguments = IntCbAllocateMemory(ArgumentLength);
169  if(pArguments == NULL)
170  {
171  return FALSE;
172  }
173 
174  /* Fill the argument */
175  pArguments->Unload = Unload;
176  pArguments->ApiHook = ApiHook;
177  if(pstrLibName)
178  {
179  /* Copy the string to the callback memory */
180  pLibNameBuffer += (ULONG_PTR)pArguments;
181  pArguments->strLibraryName.Buffer = (PWCHAR)pLibNameBuffer;
182  pArguments->strLibraryName.MaximumLength = pstrLibName->Length + sizeof(WCHAR);
183  RtlCopyUnicodeString(&pArguments->strLibraryName, pstrLibName);
184 
185  /* Fix argument pointer to be relative to the argument */
186  pLibNameBuffer -= (ULONG_PTR)pArguments;
187  pArguments->strLibraryName.Buffer = (PWCHAR)(pLibNameBuffer);
188  }
189 
190  if(pstrInitFunc)
191  {
192  /* Copy the strings to the callback memory */
193  pInitFuncBuffer += (ULONG_PTR)pArguments;
194  pArguments->strInitFuncName.Buffer = (PWCHAR)pInitFuncBuffer;
195  pArguments->strInitFuncName.MaximumLength = pstrInitFunc->Length + sizeof(WCHAR);
196  RtlCopyUnicodeString(&pArguments->strInitFuncName, pstrInitFunc);
197 
198  /* Fix argument pointers to be relative to the argument */
199  pInitFuncBuffer -= (ULONG_PTR)pArguments;
200  pArguments->strInitFuncName.Buffer = (PWCHAR)(pInitFuncBuffer);
201  }
202 
203  /* Do the callback */
204  UserLeaveCo();
205 
207  pArguments,
208  ArgumentLength,
209  &ResultPointer,
210  &ResultLength);
211 
212  UserEnterCo();
213 
214  /* Free the argument */
215  IntCbFreeMemory(pArguments);
216 
217  if(!NT_SUCCESS(Status))
218  {
219  return FALSE;
220  }
221 
222  _SEH2_TRY
223  {
224  /* Probe and copy the usermode result data */
225  ProbeForRead(ResultPointer, sizeof(HMODULE), 1);
226  bResult = *(BOOL*)ResultPointer;
227  }
229  {
230  bResult = FALSE;
231  }
232  _SEH2_END;
233 
234  return bResult;
235 }
236 
239  HWND hWnd,
240  UINT Msg,
241  ULONG_PTR CompletionCallbackContext,
242  LRESULT Result)
243 {
245  PVOID ResultPointer, pActCtx;
246  PWND pWnd;
249 
250  /* Do not allow the desktop thread to do callback to user mode */
252 
253  Arguments.Callback = CompletionCallback;
254  Arguments.Wnd = hWnd;
255  Arguments.Msg = Msg;
256  Arguments.Context = CompletionCallbackContext;
257  Arguments.Result = Result;
258 
259  IntSetTebWndCallback (&hWnd, &pWnd, &pActCtx);
260 
261  UserLeaveCo();
262 
264  &Arguments,
266  &ResultPointer,
267  &ResultLength);
268 
269  UserEnterCo();
270 
271  IntRestoreTebWndCallback (hWnd, pWnd, pActCtx);
272 
273  if (!NT_SUCCESS(Status))
274  {
275  ERR("KeUserModeCallback failed with %lx\n", Status);
276  return;
277  }
278  return;
279 }
280 
283  BOOLEAN IsAnsiProc,
284  HWND Wnd,
285  UINT Message,
286  WPARAM wParam,
287  LPARAM lParam,
288  INT lParamBufferSize)
289 {
290  WINDOWPROC_CALLBACK_ARGUMENTS StackArguments = { 0 };
293  PVOID ResultPointer, pActCtx;
294  PWND pWnd;
296  ULONG ArgumentLength;
297  LRESULT Result;
298 
299  TRACE("co_IntCallWindowProc(Proc %p, IsAnsiProc: %s, Wnd %p, Message %u, wParam %Iu, lParam %Id, lParamBufferSize %d)\n",
300  Proc, IsAnsiProc ? "TRUE" : "FALSE", Wnd, Message, wParam, lParam, lParamBufferSize);
301 
302  /* Do not allow the desktop thread to do callback to user mode */
304 
305  if (lParamBufferSize != -1)
306  {
307  ArgumentLength = sizeof(WINDOWPROC_CALLBACK_ARGUMENTS) + lParamBufferSize;
308  Arguments = IntCbAllocateMemory(ArgumentLength);
309  if (NULL == Arguments)
310  {
311  ERR("Unable to allocate buffer for window proc callback\n");
312  return -1;
313  }
314  RtlMoveMemory((PVOID) ((char *) Arguments + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)),
315  (PVOID) lParam, lParamBufferSize);
316  }
317  else
318  {
319  Arguments = &StackArguments;
320  ArgumentLength = sizeof(WINDOWPROC_CALLBACK_ARGUMENTS);
321  }
322  Arguments->Proc = Proc;
323  Arguments->IsAnsiProc = IsAnsiProc;
324  Arguments->Wnd = Wnd;
325  Arguments->Msg = Message;
326  Arguments->wParam = wParam;
327  Arguments->lParam = lParam;
328  Arguments->lParamBufferSize = lParamBufferSize;
329  ResultPointer = NULL;
330  ResultLength = ArgumentLength;
331 
332  IntSetTebWndCallback (&Wnd, &pWnd, &pActCtx);
333 
334  UserLeaveCo();
335 
337  Arguments,
338  ArgumentLength,
339  &ResultPointer,
340  &ResultLength);
341  if (!NT_SUCCESS(Status))
342  {
343  ERR("Error Callback to User space Status %lx Message %d\n",Status,Message);
344  UserEnterCo();
345  return 0;
346  }
347 
348  _SEH2_TRY
349  {
350  /* Simulate old behaviour: copy into our local buffer */
351  RtlMoveMemory(Arguments, ResultPointer, ArgumentLength);
352  }
354  {
355  ERR("Failed to copy result from user mode, Message %u lParam size %d!\n", Message, lParamBufferSize);
357  }
358  _SEH2_END;
359 
360  UserEnterCo();
361 
362  IntRestoreTebWndCallback (Wnd, pWnd, pActCtx);
363 
364  if (!NT_SUCCESS(Status))
365  {
366  ERR("Call to user mode failed! 0x%08lx\n",Status);
367  if (lParamBufferSize != -1)
368  {
369  IntCbFreeMemory(Arguments);
370  }
371  return -1;
372  }
373  Result = Arguments->Result;
374 
375  if (lParamBufferSize != -1)
376  {
378  // Is this message being processed from inside kernel space?
379  BOOL InSendMessage = (pti->pcti->CTI_flags & CTI_INSENDMESSAGE);
380 
381  TRACE("Copy lParam Message %u lParam %d!\n", Message, lParam);
382  switch (Message)
383  {
384  default:
385  TRACE("Don't copy lParam, Message %u Size %d lParam %d!\n", Message, lParamBufferSize, lParam);
386  break;
387  // Write back to user/kernel space. Also see g_MsgMemory.
388  case WM_CREATE:
389  case WM_GETMINMAXINFO:
390  case WM_GETTEXT:
391  case WM_NCCALCSIZE:
392  case WM_NCCREATE:
393  case WM_STYLECHANGING:
395  case WM_SIZING:
396  case WM_MOVING:
397  case WM_MEASUREITEM:
398  case WM_NEXTMENU:
399  TRACE("Copy lParam, Message %u Size %d lParam %d!\n", Message, lParamBufferSize, lParam);
400  if (InSendMessage)
401  // Copy into kernel space.
403  (PVOID) ((char *) Arguments + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)),
404  lParamBufferSize);
405  else
406  {
407  _SEH2_TRY
408  { // Copy into user space.
410  (PVOID) ((char *) Arguments + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)),
411  lParamBufferSize);
412  }
414  {
415  ERR("Failed to copy lParam to user space, Message %u!\n", Message);
416  }
417  _SEH2_END;
418  }
419  break;
420  }
421  IntCbFreeMemory(Arguments);
422  }
423 
424  return Result;
425 }
426 
429 {
430  LRESULT Result = 0;
432  PVOID ResultPointer;
434 
435  /* Do not allow the desktop thread to do callback to user mode */
437 
438  ResultPointer = NULL;
439  ResultLength = sizeof(LRESULT);
440 
441  UserLeaveCo();
442 
444  &ResultPointer,
445  0,
446  &ResultPointer,
447  &ResultLength);
448  if (NT_SUCCESS(Status))
449  {
450  /* Simulate old behaviour: copy into our local buffer */
451  _SEH2_TRY
452  {
453  ProbeForRead(ResultPointer, sizeof(LRESULT), 1);
454  Result = *(LRESULT*)ResultPointer;
455  }
457  {
458  Result = 0;
459  }
460  _SEH2_END;
461  }
462 
463  UserEnterCo();
464 
465  return (HMENU)Result;
466 }
467 
468 extern HCURSOR gDesktopCursor;
469 
472 {
474  PVOID ResultPointer;
476  BOOL DefaultCursor = TRUE;
477 
478  /* Do not allow the desktop thread to do callback to user mode */
480 
481  ResultPointer = NULL;
482  ResultLength = sizeof(HCURSOR);
483 
484  UserLeaveCo();
485 
487  &DefaultCursor,
488  sizeof(BOOL),
489  &ResultPointer,
490  &ResultLength);
491 
492  UserEnterCo();
493 
494  if (!NT_SUCCESS(Status))
495  {
496  return FALSE;
497  }
498 
499  /* HACK: The desktop class doen't have a proper cursor yet, so set it here */
500  gDesktopCursor = *((HCURSOR*)ResultPointer);
501 
502  return TRUE;
503 }
504 
505 static INT iTheId = -2; // Set it out of range.
506 
509  INT Code,
510  WPARAM wParam,
511  LPARAM lParam,
512  HOOKPROC Proc,
513  INT Mod,
514  ULONG_PTR offPfn,
515  BOOLEAN Ansi,
517 {
518  ULONG ArgumentLength;
519  PVOID Argument = NULL;
520  LRESULT Result = 0;
522  PVOID ResultPointer;
525  CBT_CREATEWNDW *CbtCreateWnd = NULL;
526  PCHAR Extra;
527  PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS CbtCreatewndExtra = NULL;
528  PTHREADINFO pti;
529  PWND pWnd;
530  PMSG pMsg = NULL;
531  BOOL Hit = FALSE;
532  UINT lParamSize = 0;
533  CWPSTRUCT* pCWP = NULL;
534  CWPRETSTRUCT* pCWPR = NULL;
535 
536  ASSERT(Proc);
537  /* Do not allow the desktop thread to do callback to user mode */
539 
541  if (pti->TIF_flags & TIF_INCLEANUP)
542  {
543  ERR("Thread is in cleanup and trying to call hook %d\n", Code);
544  return 0;
545  }
546 
547  ArgumentLength = sizeof(HOOKPROC_CALLBACK_ARGUMENTS);
548 
549  switch(HookId)
550  {
551  case WH_CBT:
552  TRACE("WH_CBT: Code %d\n", Code);
553  switch(Code)
554  {
555  case HCBT_CREATEWND:
556  pWnd = UserGetWindowObject((HWND) wParam);
557  if (!pWnd)
558  {
559  ERR("WH_CBT HCBT_CREATEWND wParam bad hWnd!\n");
560  goto Fault_Exit;
561  }
562  TRACE("HCBT_CREATEWND AnsiCreator %s, AnsiHook %s\n", pWnd->state & WNDS_ANSICREATOR ? "True" : "False", Ansi ? "True" : "False");
563  // Due to KsStudio.exe, just pass the callers original pointers
564  // except class which point to kernel space if not an atom.
565  // Found by, Olaf Siejka
566  CbtCreateWnd = (CBT_CREATEWNDW *) lParam;
567  ArgumentLength += sizeof(HOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS);
568  break;
569 
570  case HCBT_MOVESIZE:
571  ArgumentLength += sizeof(RECTL);
572  break;
573  case HCBT_ACTIVATE:
574  ArgumentLength += sizeof(CBTACTIVATESTRUCT);
575  break;
576  case HCBT_CLICKSKIPPED:
577  ArgumentLength += sizeof(MOUSEHOOKSTRUCT);
578  break;
579 /* ATM pass on */
580  case HCBT_KEYSKIPPED:
581  case HCBT_MINMAX:
582  case HCBT_SETFOCUS:
583  case HCBT_SYSCOMMAND:
584 /* These types pass through. */
585  case HCBT_DESTROYWND:
586  case HCBT_QS:
587  break;
588  default:
589  ERR("Trying to call unsupported CBT hook %d\n", Code);
590  goto Fault_Exit;
591  }
592  break;
593  case WH_KEYBOARD_LL:
594  ArgumentLength += sizeof(KBDLLHOOKSTRUCT);
595  break;
596  case WH_MOUSE_LL:
597  ArgumentLength += sizeof(MSLLHOOKSTRUCT);
598  break;
599  case WH_MOUSE:
600  ArgumentLength += sizeof(MOUSEHOOKSTRUCT);
601  break;
602  case WH_CALLWNDPROC:
603  {
604  pCWP = (CWPSTRUCT*) lParam;
605  ArgumentLength = sizeof(CWP_Struct);
606  if ( pCWP->message == WM_CREATE || pCWP->message == WM_NCCREATE )
607  {
608  lParamSize = sizeof(CREATESTRUCTW);
609  }
610  else
611  lParamSize = lParamMemorySize(pCWP->message, pCWP->wParam, pCWP->lParam);
612  ArgumentLength += lParamSize;
613  break;
614  }
615  case WH_CALLWNDPROCRET:
616  {
617  pCWPR = (CWPRETSTRUCT*) lParam;
618  ArgumentLength = sizeof(CWPR_Struct);
619  if ( pCWPR->message == WM_CREATE || pCWPR->message == WM_NCCREATE )
620  {
621  lParamSize = sizeof(CREATESTRUCTW);
622  }
623  else
624  lParamSize = lParamMemorySize(pCWPR->message, pCWPR->wParam, pCWPR->lParam);
625  ArgumentLength += lParamSize;
626  break;
627  }
628  case WH_MSGFILTER:
629  case WH_SYSMSGFILTER:
630  case WH_GETMESSAGE:
631  ArgumentLength += sizeof(MSG);
632  break;
633  case WH_FOREGROUNDIDLE:
634  case WH_KEYBOARD:
635  case WH_SHELL:
636  break;
637  default:
638  ERR("Trying to call unsupported window hook %d\n", HookId);
639  goto Fault_Exit;
640  }
641 
642  Argument = IntCbAllocateMemory(ArgumentLength);
643  if (NULL == Argument)
644  {
645  ERR("HookProc callback %d failed: out of memory %d\n",HookId,ArgumentLength);
646  goto Fault_Exit;
647  }
648  Common = (PHOOKPROC_CALLBACK_ARGUMENTS) Argument;
649  Common->HookId = HookId;
650  Common->Code = Code;
651  Common->wParam = wParam;
652  Common->lParam = lParam;
653  Common->Proc = Proc;
654  Common->Mod = Mod;
655  Common->offPfn = offPfn;
656  Common->Ansi = Ansi;
657  Common->lParamSize = lParamSize;
658  if (ModuleName->Buffer && ModuleName->Length)
659  {
660  RtlCopyMemory(&Common->ModuleName, ModuleName->Buffer, ModuleName->Length);
661  // If ModuleName->Buffer NULL while in destroy,
662  // this will make User32:Hook.c complain about not loading the library module.
663  // Fix symptom for CORE-10549.
664  }
665  Extra = (PCHAR) Common + sizeof(HOOKPROC_CALLBACK_ARGUMENTS);
666 
667  switch(HookId)
668  {
669  case WH_CBT:
670  switch(Code)
671  { // Need to remember this is not the first time through! Call Next Hook?
672  case HCBT_CREATEWND:
673  CbtCreatewndExtra = (PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS) Extra;
674  RtlCopyMemory( &CbtCreatewndExtra->Cs, CbtCreateWnd->lpcs, sizeof(CREATESTRUCTW) );
675  CbtCreatewndExtra->WndInsertAfter = CbtCreateWnd->hwndInsertAfter;
676  CbtCreatewndExtra->Cs.lpszClass = CbtCreateWnd->lpcs->lpszClass;
677  CbtCreatewndExtra->Cs.lpszName = CbtCreateWnd->lpcs->lpszName;
678  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
679  //ERR("HCBT_CREATEWND: hWnd %p Csw %p Name %p Class %p\n", Common->wParam, CbtCreateWnd->lpcs, CbtCreateWnd->lpcs->lpszName, CbtCreateWnd->lpcs->lpszClass);
680  break;
681  case HCBT_CLICKSKIPPED:
682  RtlCopyMemory(Extra, (PVOID) lParam, sizeof(MOUSEHOOKSTRUCT));
683  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
684  break;
685  case HCBT_MOVESIZE:
686  RtlCopyMemory(Extra, (PVOID) lParam, sizeof(RECTL));
687  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
688  break;
689  case HCBT_ACTIVATE:
690  RtlCopyMemory(Extra, (PVOID) lParam, sizeof(CBTACTIVATESTRUCT));
691  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
692  break;
693  }
694  break;
695  case WH_KEYBOARD_LL:
696  RtlCopyMemory(Extra, (PVOID) lParam, sizeof(KBDLLHOOKSTRUCT));
697  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
698  break;
699  case WH_MOUSE_LL:
700  RtlCopyMemory(Extra, (PVOID) lParam, sizeof(MSLLHOOKSTRUCT));
701  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
702  break;
703  case WH_MOUSE:
704  RtlCopyMemory(Extra, (PVOID) lParam, sizeof(MOUSEHOOKSTRUCT));
705  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
706  break;
707  case WH_CALLWNDPROC:
708  {
709  PCWP_Struct pcwps = (PCWP_Struct)Common;
710  RtlCopyMemory( &pcwps->cwps, pCWP, sizeof(CWPSTRUCT));
711  /* For CALLWNDPROC and CALLWNDPROCRET, we must be wary of the fact that
712  * lParam could be a pointer to a buffer. This buffer must be exported
713  * to user space too */
714  if ( lParamSize )
715  {
716  RtlCopyMemory( &pcwps->Extra, (PVOID)pCWP->lParam, lParamSize );
717  }
718  }
719  break;
720  case WH_CALLWNDPROCRET:
721  {
722  PCWPR_Struct pcwprs = (PCWPR_Struct)Common;
723  RtlCopyMemory( &pcwprs->cwprs, pCWPR, sizeof(CWPRETSTRUCT));
724  if ( lParamSize )
725  {
726  RtlCopyMemory( &pcwprs->Extra, (PVOID)pCWPR->lParam, lParamSize );
727  }
728  }
729  break;
730  case WH_MSGFILTER:
731  case WH_SYSMSGFILTER:
732  case WH_GETMESSAGE:
733  pMsg = (PMSG)lParam;
734  RtlCopyMemory(Extra, (PVOID) pMsg, sizeof(MSG));
735  Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
736  break;
737  case WH_FOREGROUNDIDLE:
738  case WH_KEYBOARD:
739  case WH_SHELL:
740  break;
741  }
742 
743  ResultPointer = NULL;
744  ResultLength = ArgumentLength;
745 
746  UserLeaveCo();
747 
749  Argument,
750  ArgumentLength,
751  &ResultPointer,
752  &ResultLength);
753 
754  UserEnterCo();
755 
756  if (!NT_SUCCESS(Status))
757  {
758  if ( iTheId != HookId ) // Hook ID can change.
759  {
760  ERR("Failure to make Callback %d! Status 0x%x ArgumentLength %d\n",HookId,Status,ArgumentLength);
761  iTheId = HookId;
762  }
763  goto Fault_Exit;
764  }
765 
766  if (ResultPointer)
767  {
768  _SEH2_TRY
769  {
770  /* Simulate old behaviour: copy into our local buffer */
771  RtlMoveMemory(Argument, ResultPointer, ArgumentLength);
772  Result = Common->Result;
773  }
775  {
776  Result = 0;
777  Hit = TRUE;
778  }
779  _SEH2_END;
780  }
781  else
782  {
783  ERR("ERROR: Hook %d Code %d ResultPointer 0x%p ResultLength %u\n",HookId,Code,ResultPointer,ResultLength);
784  }
785 
786  /* Support write backs... SEH is in UserCallNextHookEx. */
787  switch (HookId)
788  {
789  case WH_CBT:
790  {
791  switch (Code)
792  {
793  case HCBT_CREATEWND:
794  if (CbtCreatewndExtra)
795  {/*
796  The parameters could have been changed, include the coordinates
797  and dimensions of the window. We copy it back.
798  */
799  CbtCreateWnd->hwndInsertAfter = CbtCreatewndExtra->WndInsertAfter;
800  CbtCreateWnd->lpcs->x = CbtCreatewndExtra->Cs.x;
801  CbtCreateWnd->lpcs->y = CbtCreatewndExtra->Cs.y;
802  CbtCreateWnd->lpcs->cx = CbtCreatewndExtra->Cs.cx;
803  CbtCreateWnd->lpcs->cy = CbtCreatewndExtra->Cs.cy;
804  }
805  break;
806  case HCBT_MOVESIZE:
807  if (Extra && lParam)
808  {
809  RtlCopyMemory((PVOID) lParam, Extra, sizeof(RECTL));
810  }
811  break;
812  }
813  }
814  // "The GetMsgProc hook procedure can examine or modify the message."
815  case WH_GETMESSAGE:
816  if (pMsg)
817  {
818  RtlCopyMemory((PVOID) pMsg, Extra, sizeof(MSG));
819  }
820  break;
821  }
822 
823 Fault_Exit:
824  if (Hit)
825  {
826  ERR("Exception CallHookProc HookId %d Code %d\n",HookId,Code);
827  }
828  if (Argument) IntCbFreeMemory(Argument);
829 
830  return Result;
831 }
832 
833 //
834 // Events are notifications w/o results.
835 //
836 LRESULT
837 APIENTRY
839  DWORD event,
840  HWND hWnd,
841  LONG idObject,
842  LONG idChild,
843  DWORD dwEventThread,
844  DWORD dwmsEventTime,
845  WINEVENTPROC Proc,
846  INT Mod,
847  ULONG_PTR offPfn)
848 {
849  LRESULT Result = 0;
852  ULONG ArgumentLength, ResultLength;
853  PVOID Argument, ResultPointer;
854 
855  ArgumentLength = sizeof(EVENTPROC_CALLBACK_ARGUMENTS);
856 
857  Argument = IntCbAllocateMemory(ArgumentLength);
858  if (NULL == Argument)
859  {
860  ERR("EventProc callback failed: out of memory\n");
861  return 0;
862  }
863  Common = (PEVENTPROC_CALLBACK_ARGUMENTS) Argument;
864  Common->hook = hook;
865  Common->event = event;
866  Common->hwnd = hWnd;
867  Common->idObject = idObject;
868  Common->idChild = idChild;
869  Common->dwEventThread = dwEventThread;
870  Common->dwmsEventTime = dwmsEventTime;
871  Common->Proc = Proc;
872  Common->Mod = Mod;
873  Common->offPfn = offPfn;
874 
875  ResultPointer = NULL;
876  ResultLength = sizeof(LRESULT);
877 
878  UserLeaveCo();
879 
881  Argument,
882  ArgumentLength,
883  &ResultPointer,
884  &ResultLength);
885 
886  UserEnterCo();
887 
888  IntCbFreeMemory(Argument);
889 
890  if (!NT_SUCCESS(Status))
891  {
892  return 0;
893  }
894 
895  return Result;
896 }
897 
898 //
899 // Callback Load Menu and results.
900 //
901 HMENU
902 APIENTRY
904  PUNICODE_STRING pMenuName )
905 {
906  LRESULT Result = 0;
909  ULONG ArgumentLength, ResultLength;
910  PVOID Argument, ResultPointer;
911 
912  ArgumentLength = sizeof(LOADMENU_CALLBACK_ARGUMENTS);
913 
914  ArgumentLength += pMenuName->Length + sizeof(WCHAR);
915 
916  Argument = IntCbAllocateMemory(ArgumentLength);
917  if (NULL == Argument)
918  {
919  ERR("LoadMenu callback failed: out of memory\n");
920  return 0;
921  }
922  Common = (PLOADMENU_CALLBACK_ARGUMENTS) Argument;
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
signed char * PCHAR
Definition: retypes.h:7
#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 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:50
VOID NTAPI Unload(PDRIVER_OBJECT DriverObject)
Definition: csqtest.c:160
BOOL APIENTRY co_IntGetCharsetInfo(LCID Locale, PCHARSETINFO pCs)
Definition: callback.c:1040
#define TRUE
Definition: types.h:120
#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:1044
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:122
BOOL WINAPI InSendMessage(void)
Definition: message.c:1372
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#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:56
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:282
#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:58
_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:264
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:4226
static __inline PVOID DesktopHeapAddressToUser(PVOID lpMem)
Definition: desktop.h:326
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:65
#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
struct @1620 Msg[]
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h: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:903
#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:838
unsigned char BOOLEAN
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
struct tagCREATESTRUCTW CREATESTRUCTW
#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:97
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
Status
Definition: gdiplustypes.h:24
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:508
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 ASSERT(a)
Definition: mode.c:45
#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:505
#define USER32_CALLBACK_LOADDEFAULTCURSORS
Definition: callback.h:7
BOOL APIENTRY co_IntLoadDefaultCursors(VOID)
Definition: callback.c:471
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:238
GLbitfield flags
Definition: glext.h:7161
#define HCBT_QS
Definition: winuser.h:57
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:136
#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
_In_ UCHAR _In_ UCHAR _In_ ULONG Code
Definition: wdfdevice.h:1697
#define USER32_CALLBACK_LOADMENU
Definition: callback.h:10
#define LRESULT
Definition: ole.h:14
struct _GET_CHARSET_INFO GET_CHARSET_INFO
Definition: typedefs.h:119
UINT lParamMemorySize(UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:255
struct _cl_event * event
Definition: glext.h:7739
#define HCBT_MINMAX
Definition: winuser.h:56
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
#define ERR(fmt,...)
Definition: debug.h:110
struct _SETOBM_CALLBACK_ARGUMENTS SETOBM_CALLBACK_ARGUMENTS
Definition: ntuser.h:657
#define USER32_CALLBACK_CLIENTTHREADSTARTUP
Definition: callback.h:11
_SEH2_END
Definition: create.c:4400
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:76
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:428
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
NTSTATUS APIENTRY co_IntClientThreadSetup(VOID)
Definition: callback.c:959
_In_ HANDLE Handle
Definition: extypes.h:390
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define WH_KEYBOARD
Definition: winuser.h:32
#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:262
#define HCBT_ACTIVATE
Definition: winuser.h:60
#define ULONG_PTR
Definition: config.h:101
#define USERTAG_CALLBACK
Definition: tags.h:200
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
struct RECTL RECTL
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
struct _INT_CALLBACK_HEADER * PINT_CALLBACK_HEADER
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#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
NTSTATUS NTAPI KeUserModeCallback(IN ULONG RoutineIndex, IN PVOID Argument, IN ULONG ArgumentLength, OUT PVOID *Result, OUT PULONG ResultLength)
Definition: usercall.c:229
#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