ReactOS  0.4.13-dev-241-g63286c6
user_x.h
Go to the documentation of this file.
1 #pragma once
2 
3 static __inline PVOID
5 {
6  ASSERT(Ptr != NULL);
8  return (PVOID)((ULONG_PTR)Ptr - g_ulSharedDelta);
9 }
10 
11 static __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 
36 static __inline BOOL
38 {
39  return (pci->fsHooks|pci->pDeskInfo->fsHooks) != 0;
40 }
41 
42 static __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 
55 static __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 */
65 static __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 
85 static __inline void LoadUserApiHook()
86 {
87  if (!gfServerProcess &&
88  !IsInsideUserApiHook() &&
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)))
ULONG fsHooks
Definition: ntuser.h:296
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IN
Definition: typedefs.h:38
#define TRUE
Definition: types.h:120
DWORD fsHooks
Definition: ntuser.h:137
static __inline BOOL IsThreadHooked(PCLIENTINFO pci)
Definition: user_x.h:37
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define GetWin32ClientInfo()
Definition: ntuser.h:320
ULONG_PTR g_ulSharedDelta
Definition: dllmain.c:17
PSERVERINFO gpsi
Definition: main.c:27
BOOLEAN gfServerProcess
Definition: dllmain.c:19
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:781
uint32_t ULONG_PTR
Definition: typedefs.h:63
static __inline PVOID DesktopPtrToUser(PVOID Ptr)
Definition: user_x.h:12
DWORD dwSRVIFlags
Definition: ntuser.h:1004
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
ULONG_PTR ulClientDelta
Definition: ntuser.h:294
static __inline BOOL STATIC_update_uistate(HWND hwnd, BOOL unicode)
Definition: user_x.h:65
BOOL FASTCALL IsInsideUserApiHook(VOID)
Definition: usrapihk.c:98
GLbitfield flags
Definition: glext.h:7161
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATIC_UISTATE_GWL_OFFSET
Definition: user_x.h:62
#define SRVINFO_APIHOOK
Definition: ntuser.h:911
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
PDESKTOPINFO pDeskInfo
Definition: ntuser.h:293
DWORD_PTR NTAPI NtUserCallNoParam(DWORD Routine)
Definition: simplecall.c:59
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
static __inline void LoadUserApiHook()
Definition: user_x.h:85
BOOLEAN NTAPI RtlIsThreadWithinLoaderCallout(VOID)
Definition: libsupp.c:348
static __inline PVOID SharedPtrToUser(PVOID Ptr)
Definition: user_x.h:4
#define ULONG_PTR
Definition: config.h:101
static __inline BOOL IsCallProcHandle(IN WNDPROC lpWndProc)
Definition: user_x.h:56
static __inline PDESKTOPINFO GetThreadDesktopInfo(VOID)
Definition: user_x.h:43
EXTINLINE PVOID NtUserxGetDesktopMapping(PVOID ptr)
Definition: ntwrapper.h:806
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO * pdi
Definition: winddi.h:3553