ReactOS 0.4.16-dev-92-g0c2cdca
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;
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}
#define NULL
Definition: types.h:112
ULONG Handle
Definition: gdb_input.c:15
@ UserGetCPDU2A
Definition: ntuser.h:541
@ UserGetCPDA2U
Definition: ntuser.h:540
struct _CALLPROCDATA * PCALLPROCDATA
@ TYPE_CALLPROC
Definition: ntuser.h:47
static refpint_t pi[]
Definition: server.c:96
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: solitaire.cpp:614
GETCPD wType
Definition: ntuser.h:553
WNDPROC pfnClientPrevious
Definition: ntuser.h:552
struct _CALLPROCDATA * spcpdNext
Definition: ntuser.h:551
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:644
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:568

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}
#define TRUE
Definition: types.h:120
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:717

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 ULONG_PTR
Definition: config.h:101
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2909

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
194Cleanup:
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
static const WCHAR Cleanup[]
Definition: register.c:80
@ UserGetCPDClass
Definition: ntuser.h:542
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:258
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:249
Definition: ntuser.h:694
uint32_t ULONG_PTR
Definition: typedefs.h:65
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:124
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

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 FALSE
Definition: types.h:117
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:495

◆ 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}
PCALLPROCDATA CreateCallProc(IN PDESKTOP Desktop, IN WNDPROC WndProc, IN BOOL Unicode, IN PPROCESSINFO pi)
Definition: callproc.c:29
WNDPROC GetCallProcHandle(IN PCALLPROCDATA CallProc)
Definition: callproc.c:15
PCALLPROCDATA FASTCALL UserSearchForCallProc(PCALLPROCDATA pcpd, WNDPROC WndProc, GETCPD Type)
Definition: callproc.c:89
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
@ UserGetCPDWndtoCls
Definition: ntuser.h:545
@ UserGetCPDDialog
Definition: ntuser.h:544
@ UserGetCPDWindow
Definition: ntuser.h:543
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define TRACE(s)
Definition: solgame.cpp:4
Definition: ntuser.h:566
struct _DESKTOP * rpdeskParent
Definition: ntuser.h:571
PCALLPROCDATA spcpdFirst
Definition: ntuser.h:576
RTL_ATOM atomClassName
Definition: ntuser.h:568
PPROCESSINFO ppi
Definition: win32.h:88
struct _DESKTOP * rpdesk
Definition: win32.h:92
PCLS pcls
Definition: ntuser.h:720

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}
Type
Definition: Type.h:7

Referenced by UserGetCPD().