ReactOS  0.4.14-dev-390-g34947ad
callproc.c File Reference
#include <win32k.h>
Include dependency graph for callproc.c:

Go to the source code of this file.

Functions

 DBG_DEFAULT_CHANNEL (UserClass)
 
WNDPROC GetCallProcHandle (IN PCALLPROCDATA CallProc)
 
BOOLEAN DestroyCallProc (_Inout_ PVOID Object)
 
PCALLPROCDATA CreateCallProc (IN PDESKTOP Desktop, IN WNDPROC WndProc, IN BOOL Unicode, IN PPROCESSINFO pi)
 
BOOL UserGetCallProcInfo (IN HANDLE hCallProc, OUT PWNDPROC_INFO wpInfo)
 
PCALLPROCDATA FASTCALL UserSearchForCallProc (PCALLPROCDATA pcpd, WNDPROC WndProc, GETCPD Type)
 
ULONG_PTR FASTCALL UserGetCPD (PVOID pvClsWnd, GETCPD Flags, ULONG_PTR ProcIn)
 
ULONG_PTR APIENTRY NtUserGetCPD (HWND hWnd, GETCPD Flags, ULONG_PTR ProcIn)
 

Function Documentation

◆ CreateCallProc()

PCALLPROCDATA CreateCallProc ( IN PDESKTOP  Desktop,
IN WNDPROC  WndProc,
IN BOOL  Unicode,
IN PPROCESSINFO  pi 
)

Definition at line 29 of file callproc.c.

33 {
34  PCALLPROCDATA NewCallProc;
35  HANDLE Handle;
36 
37  /* We can send any thread pointer to the object manager here,
38  * What's important is the process info */
40  Desktop,
41  pi->ptiList,
42  &Handle,
44  sizeof(CALLPROCDATA));
45  if (NewCallProc != NULL)
46  {
47  NewCallProc->pfnClientPrevious = WndProc;
48  NewCallProc->wType |= Unicode ? UserGetCPDA2U : UserGetCPDU2A ;
49  NewCallProc->spcpdNext = NULL;
50 
51  /* Release the extra reference (UserCreateObject added 2 references) */
52  UserDereferenceObject(NewCallProc);
53  }
54 
55  return NewCallProc;
56 }
WNDPROC pfnClientPrevious
Definition: ntuser.h:520
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:610
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:535
struct _CALLPROCDATA * spcpdNext
Definition: ntuser.h:519
GETCPD wType
Definition: ntuser.h:521
smooth NULL
Definition: ftsmooth.c:416
_In_ HANDLE Handle
Definition: extypes.h:390
static DWORD pi
Definition: protocol.c:150
struct _CALLPROCDATA * PCALLPROCDATA
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: solitaire.cpp:598
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13

Referenced by IntCreateWindow(), and UserGetCPD().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserClass  )

◆ DestroyCallProc()

BOOLEAN DestroyCallProc ( _Inout_ PVOID  Object)

Definition at line 22 of file callproc.c.

23 {
25  return TRUE;
26 }
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:683
#define TRUE
Definition: types.h:120
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
static IUnknown Object
Definition: main.c:512

Referenced by IntDestroyClass().

◆ GetCallProcHandle()

WNDPROC GetCallProcHandle ( IN PCALLPROCDATA  CallProc)

Definition at line 15 of file callproc.c.

16 {
17  /* FIXME: Check for 64 bit architectures... */
18  return (WNDPROC)((ULONG_PTR)UserHMGetHandle(CallProc) | 0xFFFF0000);
19 }
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
#define ULONG_PTR
Definition: config.h:101

Referenced by UserGetCPD().

◆ NtUserGetCPD()

ULONG_PTR APIENTRY NtUserGetCPD ( HWND  hWnd,
GETCPD  Flags,
ULONG_PTR  ProcIn 
)

Definition at line 176 of file callproc.c.

180 {
181  PWND Wnd;
182  ULONG_PTR Result = 0;
183 
185  if (!(Wnd = UserGetWindowObject(hWnd)))
186  {
187  goto Cleanup;
188  }
189 
190  // Processing Window only from User space.
192  Result = UserGetCPD(Wnd, Flags, ProcIn);
193 
194 Cleanup:
195  UserLeave();
196  return Result;
197 }
HWND hWnd
Definition: settings.c:17
ULONG_PTR FASTCALL UserGetCPD(PVOID pvClsWnd, GETCPD Flags, ULONG_PTR ProcIn)
Definition: callproc.c:107
uint32_t ULONG_PTR
Definition: typedefs.h:63
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_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
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
static const WCHAR Cleanup[]
Definition: register.c:80
Definition: ntuser.h:657
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255

Referenced by IntGetClsWndProc(), and IntGetWndProc().

◆ UserGetCallProcInfo()

BOOL UserGetCallProcInfo ( IN HANDLE  hCallProc,
OUT PWNDPROC_INFO  wpInfo 
)

Definition at line 59 of file callproc.c.

61 {
62  PCALLPROCDATA CallProc;
63 
64  CallProc = UserGetObject(gHandleTable,
65  hCallProc,
67  if (CallProc == NULL)
68  {
69  return FALSE;
70  }
71 
72 /* Use Handle pEntry->ppi!
73  if (CallProc->pi != GetW32ProcessInfo())
74  {
75  return FALSE;
76  }*/
77 
78  wpInfo->WindowProc = CallProc->pfnClientPrevious;
79  wpInfo->IsUnicode = !!(CallProc->wType & UserGetCPDA2U);
80 
81  return TRUE;
82 }
#define TRUE
Definition: types.h:120
WNDPROC pfnClientPrevious
Definition: ntuser.h:520
GETCPD wType
Definition: ntuser.h:521
smooth NULL
Definition: ftsmooth.c:416
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:462
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13

◆ UserGetCPD()

ULONG_PTR FASTCALL UserGetCPD ( PVOID  pvClsWnd,
GETCPD  Flags,
ULONG_PTR  ProcIn 
)

Definition at line 107 of file callproc.c.

111 {
112  PCLS pCls;
113  PWND pWnd;
114  PDESKTOP pDesk;
115  PCALLPROCDATA CallProc = NULL;
116  PTHREADINFO pti;
117 
119 
122  {
123  pWnd = pvClsWnd;
124  pCls = pWnd->pcls;
125  }
126  else
127  pCls = pvClsWnd;
128 
129  // Search Class call proc data list.
130  if (pCls->spcpdFirst)
131  CallProc = UserSearchForCallProc( pCls->spcpdFirst, (WNDPROC)ProcIn, Flags);
132 
133  // No luck, create a new one for the requested proc.
134  if (!CallProc)
135  {
136  if (!pCls->rpdeskParent)
137  {
138  TRACE("Null DESKTOP Atom %u\n",pCls->atomClassName);
139  pDesk = pti->rpdesk;
140  }
141  else
142  pDesk = pCls->rpdeskParent;
143  CallProc = CreateCallProc( pDesk,
144  (WNDPROC)ProcIn,
145  !!(Flags & UserGetCPDA2U),
146  pti->ppi);
147  if (CallProc)
148  {
149  CallProc->spcpdNext = pCls->spcpdFirst;
151  CallProc);
152  CallProc->wType = Flags;
153  }
154  }
155  return (ULONG_PTR)(CallProc ? GetCallProcHandle(CallProc) : NULL);
156 }
struct _DESKTOP * rpdeskParent
Definition: ntuser.h:539
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
RTL_ATOM atomClassName
Definition: ntuser.h:536
struct _DESKTOP * rpdesk
Definition: win32.h:91
WNDPROC GetCallProcHandle(IN PCALLPROCDATA CallProc)
Definition: callproc.c:15
PPROCESSINFO ppi
Definition: win32.h:87
PCALLPROCDATA CreateCallProc(IN PDESKTOP Desktop, IN WNDPROC WndProc, IN BOOL Unicode, IN PPROCESSINFO pi)
Definition: callproc.c:29
uint32_t ULONG_PTR
Definition: typedefs.h:63
struct _CALLPROCDATA * spcpdNext
Definition: ntuser.h:519
GETCPD wType
Definition: ntuser.h:521
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
smooth NULL
Definition: ftsmooth.c:416
Definition: ntuser.h:533
PCALLPROCDATA spcpdFirst
Definition: ntuser.h:544
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
Definition: ntuser.h:657
PCALLPROCDATA FASTCALL UserSearchForCallProc(PCALLPROCDATA pcpd, WNDPROC WndProc, GETCPD Type)
Definition: callproc.c:89
PCLS pcls
Definition: ntuser.h:684

Referenced by IntGetClassWndProc(), IntGetWindowProc(), and NtUserGetCPD().

◆ UserSearchForCallProc()

PCALLPROCDATA FASTCALL UserSearchForCallProc ( PCALLPROCDATA  pcpd,
WNDPROC  WndProc,
GETCPD  Type 
)

Definition at line 89 of file callproc.c.

93 {
94  while ( pcpd && (pcpd->pfnClientPrevious != WndProc || pcpd->wType != Type) )
95  {
96  pcpd = pcpd->spcpdNext;
97  }
98  return pcpd;
99 }
WNDPROC pfnClientPrevious
Definition: ntuser.h:520
Type
Definition: Type.h:6
struct _CALLPROCDATA * spcpdNext
Definition: ntuser.h:519
GETCPD wType
Definition: ntuser.h:521
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: solitaire.cpp:598

Referenced by UserGetCPD().