ReactOS 0.4.15-dev-7788-g1ad9096
user_x.h
Go to the documentation of this file.
1#pragma once
2
3static __inline PVOID
5{
6 ASSERT(Ptr != NULL);
9}
10
11static __inline PVOID
13{
14 PCLIENTINFO pci;
17 pci = GetWin32ClientInfo();
18 pdi = pci->pDeskInfo;
19
20 ASSERT(Ptr != NULL);
21 ASSERT(pdi != NULL);
22 if ((ULONG_PTR)Ptr >= (ULONG_PTR)pdi->pvDesktopBase &&
23 (ULONG_PTR)Ptr < (ULONG_PTR)pdi->pvDesktopLimit)
24 {
25 return (PVOID)((ULONG_PTR)Ptr - pci->ulClientDelta);
26 }
27 else
28 {
29 /* NOTE: This is slow as it requires a call to win32k. This should only be
30 neccessary if a thread wants to access an object on a different
31 desktop */
33 }
34}
35
36static __inline BOOL
38{
39 return (pci->fsHooks|pci->pDeskInfo->fsHooks) != 0;
40}
41
42static __inline PDESKTOPINFO
44{
45 PTHREADINFO ti;
46 PDESKTOPINFO di = NULL;
47
48 ti = GetW32ThreadInfo();
49 if (ti != NULL)
50 di = GetWin32ClientInfo()->pDeskInfo;
51
52 return di;
53}
54
55static __inline BOOL
57{
58 /* FIXME - check for 64 bit architectures... */
59 return ((ULONG_PTR)lpWndProc & 0xFFFF0000) == 0xFFFF0000;
60}
61
62#define STATIC_UISTATE_GWL_OFFSET (sizeof(HFONT)+sizeof(HICON))// see UISTATE_GWL_OFFSET in static.c
63
64/* Retrieve the UI state for the control */
65static __inline BOOL STATIC_update_uistate(HWND hwnd, BOOL unicode)
66{
67 LONG flags, prevflags;
68
69 if (unicode)
70 flags = DefWindowProcW(hwnd, WM_QUERYUISTATE, 0, 0);
71 else
72 flags = DefWindowProcA(hwnd, WM_QUERYUISTATE, 0, 0);
73
75
76 if (prevflags != flags)
77 {
79 return TRUE;
80 }
81
82 return FALSE;
83}
84
85static __inline void LoadUserApiHook()
86{
87 if (!gfServerProcess &&
91 {
93 }
94}
95
96#define UserHasDlgFrameStyle(Style, ExStyle) \
97 (((ExStyle) & WS_EX_DLGMODALFRAME) || \
98 (((Style) & WS_DLGFRAME) && (!((Style) & WS_THICKFRAME))))
99
100#define UserHasThickFrameStyle(Style, ExStyle) \
101 (((Style) & WS_THICKFRAME) && \
102 (!(((Style) & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)))
103
104#define UserHasThinFrameStyle(Style, ExStyle) \
105 (((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP))))
106
107/* macro for source compatibility with wine */
108#define WIN_GetFullHandle(h) ((HWND)(h))
109
110#define HOOKID_TO_FLAG(HookId) (1 << ((HookId) + 1))
111#define ISITHOOKED(HookId) (GetWin32ClientInfo()->fsHooks & HOOKID_TO_FLAG(HookId) ||\
112 (GetWin32ClientInfo()->pDeskInfo && GetWin32ClientInfo()->pDeskInfo->fsHooks & HOOKID_TO_FLAG(HookId)))
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOLEAN NTAPI RtlIsThreadWithinLoaderCallout(VOID)
Definition: libsupp.c:345
SHAREDINFO gSharedInfo
Definition: imm.c:19
PSERVERINFO gpsi
Definition: imm.c:18
#define ULONG_PTR
Definition: config.h:101
unsigned int BOOL
Definition: ntddk_ex.h:94
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
GLbitfield flags
Definition: glext.h:7161
DWORD_PTR NTAPI NtUserCallNoParam(DWORD Routine)
Definition: simplecall.c:59
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:805
@ NOPARAM_ROUTINE_LOADUSERAPIHOOK
Definition: ntuser.h:1524
#define SRVINFO_APIHOOK
Definition: ntuser.h:950
#define GetWin32ClientInfo()
Definition: ntuser.h:352
#define ASSERT(a)
Definition: mode.c:44
EXTINLINE PVOID NtUserxGetDesktopMapping(PVOID ptr)
Definition: ntwrapper.h:806
long LONG
Definition: pedump.c:60
ULONG_PTR ulClientDelta
Definition: ntuser.h:326
ULONG fsHooks
Definition: ntuser.h:328
PDESKTOPINFO pDeskInfo
Definition: ntuser.h:325
DWORD fsHooks
Definition: ntuser.h:138
ULONG_PTR ulSharedDelta
Definition: ntuser.h:1133
DWORD dwSRVIFlags
Definition: ntuser.h:1051
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
BOOLEAN gfServerProcess
Definition: dllmain.c:35
BOOL FASTCALL IsInsideUserApiHook(VOID)
Definition: usrapihk.c:98
static __inline BOOL IsCallProcHandle(IN WNDPROC lpWndProc)
Definition: user_x.h:56
static __inline PVOID SharedPtrToUser(PVOID Ptr)
Definition: user_x.h:4
static __inline void LoadUserApiHook()
Definition: user_x.h:85
static __inline BOOL STATIC_update_uistate(HWND hwnd, BOOL unicode)
Definition: user_x.h:65
static __inline BOOL IsThreadHooked(PCLIENTINFO pci)
Definition: user_x.h:37
static __inline PVOID DesktopPtrToUser(PVOID Ptr)
Definition: user_x.h:12
#define STATIC_UISTATE_GWL_OFFSET
Definition: user_x.h:62
static __inline PDESKTOPINFO GetThreadDesktopInfo(VOID)
Definition: user_x.h:43
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO * pdi
Definition: winddi.h:3554
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906