ReactOS  0.4.13-dev-464-g6b95727
themehooks.c File Reference
#include "uxthemep.h"
Include dependency graph for themehooks.c:

Go to the source code of this file.

Typedefs

typedef BOOL(WINAPIPREGISTER_UAH_WINXP) (HINSTANCE hInstance, USERAPIHOOKPROC CallbackFunc)
 
typedef BOOL(WINAPIPREGISTER_UUAH_WIN2003) (PUSERAPIHOOKINFO puah)
 

Functions

PWND_DATA ThemeGetWndData (HWND hWnd)
 
void ThemeDestroyWndData (HWND hWnd)
 
HTHEME GetNCCaptionTheme (HWND hWnd, DWORD style)
 
HTHEME GetNCScrollbarTheme (HWND hWnd, DWORD style)
 
static BOOL CALLBACK ThemeCleanupChildWndContext (HWND hWnd, LPARAM msg)
 
static BOOL CALLBACK ThemeCleanupWndContext (HWND hWnd, LPARAM msg)
 
void SetThemeRegion (HWND hWnd)
 
int OnPostWinPosChanged (HWND hWnd, WINDOWPOS *pWinPos)
 
static LRESULT CALLBACK ThemeDefWindowProcW (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK ThemeDefWindowProcA (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK ThemePreWindowProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ret, PDWORD unknown)
 
static LRESULT CALLBACK ThemePostWindowProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ret, PDWORD unknown)
 
HRESULT GetDiaogTextureBrush (HTHEME theme, HWND hwnd, HDC hdc, HBRUSH *result, BOOL changeOrigin)
 
void HackFillStaticBg (HWND hwnd, HDC hdc, HBRUSH *result)
 
static LRESULT CALLBACK ThemeDlgPreWindowProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ret, PDWORD unknown)
 
static LRESULT CALLBACK ThemeDlgPostWindowProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ret, PDWORD unknown)
 
int WINAPI ThemeSetWindowRgn (HWND hWnd, HRGN hRgn, BOOL bRedraw)
 
BOOL WINAPI ThemeGetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi)
 
BOOL CALLBACK ThemeInitApiHook (UAPIHK State, PUSERAPIHOOK puah)
 
BOOL WINAPI ThemeHooksInstall ()
 
BOOL WINAPI ThemeHooksRemove ()
 
INT WINAPI ClassicSystemParametersInfoW (UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
 
INT WINAPI ClassicSystemParametersInfoA (UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
 
INT WINAPI ClassicGetSystemMetrics (int nIndex)
 
BOOL WINAPI ClassicAdjustWindowRectEx (LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle)
 

Variables

USERAPIHOOK g_user32ApiHook
 
BYTE gabDWPmessages [UAHOWP_MAX_SIZE]
 
BYTE gabMSGPmessages [UAHOWP_MAX_SIZE]
 
BYTE gabDLGPmessages [UAHOWP_MAX_SIZE]
 
BOOL g_bThemeHooksActive = FALSE
 

Typedef Documentation

◆ PREGISTER_UAH_WINXP

typedef BOOL(WINAPI * PREGISTER_UAH_WINXP) (HINSTANCE hInstance, USERAPIHOOKPROC CallbackFunc)

Definition at line 665 of file themehooks.c.

◆ PREGISTER_UUAH_WIN2003

typedef BOOL(WINAPI * PREGISTER_UUAH_WIN2003) (PUSERAPIHOOKINFO puah)

Definition at line 666 of file themehooks.c.

Function Documentation

◆ ClassicAdjustWindowRectEx()

BOOL WINAPI ClassicAdjustWindowRectEx ( LPRECT  lpRect,
DWORD  dwStyle,
BOOL  bMenu,
DWORD  dwExStyle 
)

Definition at line 752 of file themehooks.c.

753 {
755  {
756  return g_user32ApiHook.AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle);
757  }
758 
759  return AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle);
760 }
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
ADJUSTWINDOWRECTEX AdjustWindowRectEx
Definition: undocuser.h:337
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
USERAPIHOOK g_user32ApiHook
Definition: themehooks.c:11

◆ ClassicGetSystemMetrics()

INT WINAPI ClassicGetSystemMetrics ( int  nIndex)

Definition at line 742 of file themehooks.c.

743 {
745  {
746  return g_user32ApiHook.GetSystemMetrics(nIndex);
747  }
748 
749  return GetSystemMetrics(nIndex);
750 }
GETSYSTEMMETRICS GetSystemMetrics
Definition: undocuser.h:345
int WINAPI GetSystemMetrics(_In_ int)
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
USERAPIHOOK g_user32ApiHook
Definition: themehooks.c:11

◆ ClassicSystemParametersInfoA()

INT WINAPI ClassicSystemParametersInfoA ( UINT  uiAction,
UINT  uiParam,
PVOID  pvParam,
UINT  fWinIni 
)

Definition at line 732 of file themehooks.c.

733 {
735  {
736  return g_user32ApiHook.SystemParametersInfoA(uiAction, uiParam, pvParam, fWinIni);
737  }
738 
739  return SystemParametersInfoA(uiAction, uiParam, pvParam, fWinIni);
740 }
BOOL WINAPI SystemParametersInfoA(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
SYSTEMPARAMETERSINFOA SystemParametersInfoA
Definition: undocuser.h:346
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
USERAPIHOOK g_user32ApiHook
Definition: themehooks.c:11

◆ ClassicSystemParametersInfoW()

INT WINAPI ClassicSystemParametersInfoW ( UINT  uiAction,
UINT  uiParam,
PVOID  pvParam,
UINT  fWinIni 
)

Definition at line 722 of file themehooks.c.

723 {
725  {
726  return g_user32ApiHook.SystemParametersInfoW(uiAction, uiParam, pvParam, fWinIni);
727  }
728 
729  return SystemParametersInfoW(uiAction, uiParam, pvParam, fWinIni);
730 }
SYSTEMPARAMETERSINFOW SystemParametersInfoW
Definition: undocuser.h:347
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
USERAPIHOOK g_user32ApiHook
Definition: themehooks.c:11

◆ GetDiaogTextureBrush()

HRESULT GetDiaogTextureBrush ( HTHEME  theme,
HWND  hwnd,
HDC  hdc,
HBRUSH *  result,
BOOL  changeOrigin 
)

Definition at line 402 of file themehooks.c.

403 {
404  PWND_DATA pwndData;
405 
406  pwndData = ThemeGetWndData(hwnd);
407  if (pwndData == NULL)
408  return E_FAIL;
409 
410  if (pwndData->hTabBackgroundBrush == NULL)
411  {
412  HBITMAP hbmp;
413  RECT dummy, bmpRect;
414  BOOL hasImageAlpha;
415  HRESULT hr;
416 
417  hr = UXTHEME_LoadImage(theme, 0, TABP_BODY, 0, &dummy, FALSE, &hbmp, &bmpRect, &hasImageAlpha);
418  if (FAILED(hr))
419  return hr;
420 
421  if (changeOrigin)
422  {
423  /* Unfortunately SetBrushOrgEx doesn't work at all */
424  RECT rcWindow, rcParent;
425  UINT y;
426  HDC hdcPattern, hdcHackPattern;
427  HBITMAP hbmpOld1, hbmpold2, hbmpHack;
428 
429  GetWindowRect(hwnd, &rcWindow);
430  GetWindowRect(GetParent(hwnd), &rcParent);
431  y = (rcWindow.top - rcParent.top) % bmpRect.bottom;
432 
433  hdcPattern = CreateCompatibleDC(hdc);
434  hbmpOld1 = (HBITMAP)SelectObject(hdcPattern, hbmp);
435 
436  hdcHackPattern = CreateCompatibleDC(hdc);
437  hbmpHack = CreateCompatibleBitmap(hdc, bmpRect.right, bmpRect.bottom);
438  hbmpold2 = (HBITMAP)SelectObject(hdcHackPattern, hbmpHack);
439 
440  BitBlt(hdcHackPattern, 0, 0, bmpRect.right, bmpRect.bottom - y, hdcPattern, 0, y, SRCCOPY);
441  BitBlt(hdcHackPattern, 0, bmpRect.bottom - y, bmpRect.right, y, hdcPattern, 0, 0, SRCCOPY);
442 
443  hbmpold2 = (HBITMAP)SelectObject(hdcHackPattern, hbmpold2);
444  hbmpOld1 = (HBITMAP)SelectObject(hdcPattern, hbmpOld1);
445 
446  DeleteDC(hdcPattern);
447  DeleteDC(hdcHackPattern);
448 
449  /* Keep the handle of the bitmap we created so that it can be used later */
450  pwndData->hTabBackgroundBmp = hbmpHack;
451  hbmp = hbmpHack;
452  }
453 
454  /* hbmp is cached so there is no need to free it */
456  }
457 
458  if (!pwndData->hTabBackgroundBrush)
459  return E_FAIL;
460 
461  *result = pwndData->hTabBackgroundBrush;
462  return S_OK;
463 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HBRUSH hTabBackgroundBrush
Definition: uxthemep.h:160
HRESULT UXTHEME_LoadImage(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, BOOL glyph, HBITMAP *hBmp, RECT *bmpRect, BOOL *hasImageAlpha)
Definition: draw.c:230
HRESULT hr
Definition: shlfolder.c:183
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HBITMAP hTabBackgroundBmp
Definition: uxthemep.h:161
LONG right
Definition: windef.h:293
#define E_FAIL
Definition: ddrawi.h:102
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:416
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
HBITMAP hbmp
HBRUSH WINAPI CreatePatternBrush(_In_ HBITMAP)
LONG HRESULT
Definition: typedefs.h:77
HDC hdc
Definition: main.c:9
HWND WINAPI GetParent(_In_ HWND)
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI DeleteDC(_In_ HDC)
unsigned char dummy
Definition: maze.c:118
unsigned int UINT
Definition: ndis.h:50
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
LONG bottom
Definition: windef.h:294
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
static HBITMAP
Definition: button.c:44
PWND_DATA ThemeGetWndData(HWND hWnd)
Definition: themehooks.c:17
GLuint64EXT * result
Definition: glext.h:11304
#define SRCCOPY
Definition: wingdi.h:332

Referenced by ThemeDlgPostWindowProc().

◆ GetNCCaptionTheme()

HTHEME GetNCCaptionTheme ( HWND  hWnd,
DWORD  style 
)

Definition at line 88 of file themehooks.c.

89 {
90  PWND_DATA pwndData;
91 
92  /* We only get the theme for the window class if the window has a caption */
93  if((style & WS_CAPTION) != WS_CAPTION)
94  return NULL;
95 
96  /* Get theme data for this window */
97  pwndData = ThemeGetWndData(hWnd);
98  if (pwndData == NULL)
99  return NULL;
100 
101  if (!(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
102  {
103  if (pwndData->hthemeWindow)
104  {
105  CloseThemeData(pwndData->hthemeWindow);
106  pwndData->hthemeWindow = NULL;
107  }
108  return NULL;
109  }
110 
111  /* If the theme data was not cached, open it now */
112  if (!pwndData->hthemeWindow)
113  pwndData->hthemeWindow = OpenThemeDataEx(hWnd, L"WINDOW", OTD_NONCLIENT);
114 
115  return pwndData->hthemeWindow;
116 }
HWND hWnd
Definition: settings.c:17
DWORD WINAPI GetThemeAppProperties(void)
Definition: system.c:933
smooth NULL
Definition: ftsmooth.c:416
#define WS_CAPTION
Definition: pedump.c:624
HTHEME WINAPI OpenThemeDataEx(HWND hwnd, LPCWSTR pszClassList, DWORD flags)
Definition: system.c:819
static const WCHAR L[]
Definition: oid.c:1250
HTHEME hthemeWindow
Definition: uxthemep.h:151
PWND_DATA ThemeGetWndData(HWND hWnd)
Definition: themehooks.c:17
Arabic default style
Definition: afstyles.h:93
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950

Referenced by SetThemeRegion(), ThemeCalculateCaptionButtonsPos(), and ThemeInitDrawContext().

◆ GetNCScrollbarTheme()

HTHEME GetNCScrollbarTheme ( HWND  hWnd,
DWORD  style 
)

Definition at line 118 of file themehooks.c.

119 {
120  PWND_DATA pwndData;
121 
122  /* We only get the theme for the scrollbar class if the window has a scrollbar */
123  if((style & (WS_HSCROLL|WS_VSCROLL)) == 0)
124  return NULL;
125 
126  /* Get theme data for this window */
127  pwndData = ThemeGetWndData(hWnd);
128  if (pwndData == NULL)
129  return NULL;
130 
131  if (!(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
132  {
133  if (pwndData->hthemeScrollbar)
134  {
135  CloseThemeData(pwndData->hthemeScrollbar);
136  pwndData->hthemeScrollbar = NULL;
137  }
138  return NULL;
139  }
140 
141  /* If the theme data was not cached, open it now */
142  if (!pwndData->hthemeScrollbar)
143  pwndData->hthemeScrollbar = OpenThemeDataEx(hWnd, L"SCROLLBAR", OTD_NONCLIENT);
144 
145  return pwndData->hthemeScrollbar;
146 }
HWND hWnd
Definition: settings.c:17
DWORD WINAPI GetThemeAppProperties(void)
Definition: system.c:933
HTHEME hthemeScrollbar
Definition: uxthemep.h:152
smooth NULL
Definition: ftsmooth.c:416
HTHEME WINAPI OpenThemeDataEx(HWND hwnd, LPCWSTR pszClassList, DWORD flags)
Definition: system.c:819
#define WS_HSCROLL
Definition: pedump.c:628
static const WCHAR L[]
Definition: oid.c:1250
#define WS_VSCROLL
Definition: pedump.c:627
PWND_DATA ThemeGetWndData(HWND hWnd)
Definition: themehooks.c:17
Arabic default style
Definition: afstyles.h:93
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950

Referenced by ThemeInitDrawContext().

◆ HackFillStaticBg()

void HackFillStaticBg ( HWND  hwnd,
HDC  hdc,
HBRUSH *  result 
)

Definition at line 465 of file themehooks.c.

466 {
467  RECT rcStatic;
468 
469  GetClientRect(hwnd, &rcStatic);
470  FillRect(hdc, &rcStatic, *result);
471 
474 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define NULL_BRUSH
Definition: wingdi.h:900
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
#define TRANSPARENT
Definition: wingdi.h:949
HDC hdc
Definition: main.c:9
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
GLuint64EXT * result
Definition: glext.h:11304

Referenced by ThemeDlgPostWindowProc().

◆ OnPostWinPosChanged()

int OnPostWinPosChanged ( HWND  hWnd,
WINDOWPOS pWinPos 
)

Definition at line 218 of file themehooks.c.

219 {
220  PWND_DATA pwndData;
221  DWORD style;
222 
223  /* We only proceed to change the window shape if it has a caption */
225  if((style & WS_CAPTION)!=WS_CAPTION)
226  return 0;
227 
228  /* Get theme data for this window */
229  pwndData = ThemeGetWndData(hWnd);
230  if (pwndData == NULL)
231  return 0;
232 
233  /* Do not change the region of the window if its size wasn't changed */
234  if ((pWinPos->flags & SWP_NOSIZE) != 0 && pwndData->DirtyThemeRegion == FALSE)
235  return 0;
236 
237  /* We don't touch the shape of the window if the application sets it on its own */
238  if (pwndData->HasAppDefinedRgn != FALSE)
239  return 0;
240 
241  /* Calling SetWindowRgn will call SetWindowPos again so we need to avoid this recursion */
242  if (pwndData->UpdatingRgn != FALSE)
243  return 0;
244 
245  if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
246  {
247  if(pwndData->HasThemeRgn)
248  {
249  pwndData->HasThemeRgn = FALSE;
251  }
252  return 0;
253  }
254 
255  pwndData->DirtyThemeRegion = FALSE;
256  pwndData->HasThemeRgn = TRUE;
257  pwndData->UpdatingRgn = TRUE;
259  pwndData->UpdatingRgn = FALSE;
260 
261  return 0;
262  }
#define TRUE
Definition: types.h:120
BOOL UpdatingRgn
Definition: uxthemep.h:158
HWND hWnd
Definition: settings.c:17
DWORD WINAPI GetThemeAppProperties(void)
Definition: system.c:933
BOOL HasAppDefinedRgn
Definition: uxthemep.h:156
SETWINDOWRGN SetWindowRgn
Definition: undocuser.h:338
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
UINT flags
Definition: winuser.h:3536
#define WS_CAPTION
Definition: pedump.c:624
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL DirtyThemeRegion
Definition: uxthemep.h:159
void SetThemeRegion(HWND hWnd)
Definition: themehooks.c:169
BOOL HasThemeRgn
Definition: uxthemep.h:157
#define SWP_NOSIZE
Definition: winuser.h:1230
#define GWL_STYLE
Definition: winuser.h:846
PWND_DATA ThemeGetWndData(HWND hWnd)
Definition: themehooks.c:17
Arabic default style
Definition: afstyles.h:93
USERAPIHOOK g_user32ApiHook
Definition: themehooks.c:11

Referenced by ThemePostWindowProc().

◆ SetThemeRegion()

void SetThemeRegion ( HWND  hWnd)

Definition at line 169 of file themehooks.c.

170 {
171  HTHEME hTheme;
172  RECT rcWindow;
173  HRGN hrgn, hrgn1;
174  int CaptionHeight, iPart;
175  WINDOWINFO wi;
176 
177  TRACE("SetThemeRegion %d\n", hWnd);
178 
179  wi.cbSize = sizeof(wi);
180  GetWindowInfo(hWnd, &wi);
181 
182  /* Get the caption part id */
183  if (wi.dwStyle & WS_MINIMIZE)
184  iPart = WP_MINCAPTION;
185  else if (wi.dwExStyle & WS_EX_TOOLWINDOW)
186  iPart = WP_SMALLCAPTION;
187  else if (wi.dwStyle & WS_MAXIMIZE)
188  iPart = WP_MAXCAPTION;
189  else
190  iPart = WP_CAPTION;
191 
192  CaptionHeight = wi.cyWindowBorders;
194 
195  GetWindowRect(hWnd, &rcWindow);
196  rcWindow.right -= rcWindow.left;
197  rcWindow.bottom = CaptionHeight;
198  rcWindow.top = 0;
199  rcWindow.left = 0;
200 
201  hTheme = GetNCCaptionTheme(hWnd, wi.dwStyle);
202  GetThemeBackgroundRegion(hTheme, 0, iPart, FS_ACTIVE, &rcWindow, &hrgn);
203 
204  GetWindowRect(hWnd, &rcWindow);
205  rcWindow.right -= rcWindow.left;
206  rcWindow.bottom -= rcWindow.top;
207  rcWindow.top = CaptionHeight;
208  rcWindow.left = 0;
209  hrgn1 = CreateRectRgnIndirect(&rcWindow);
210 
211  CombineRgn(hrgn, hrgn, hrgn1, RGN_OR );
212 
213  DeleteObject(hrgn1);
214 
216 }
int WINAPI CombineRgn(_In_opt_ HRGN hrgnDest, _In_opt_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ int fnCombineMode)
HTHEME GetNCCaptionTheme(HWND hWnd, DWORD style)
Definition: themehooks.c:88
#define TRUE
Definition: types.h:120
DWORD cbSize
Definition: winuser.h:3708
HRESULT WINAPI GetThemeBackgroundRegion(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, HRGN *pRegion)
Definition: draw.c:1724
DWORD dwStyle
Definition: winuser.h:3711
HRGN WINAPI CreateRectRgnIndirect(_In_ LPCRECT)
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:292
UINT cyWindowBorders
Definition: winuser.h:3715
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
SETWINDOWRGN SetWindowRgn
Definition: undocuser.h:338
#define WS_MINIMIZE
Definition: pedump.c:622
#define RGN_OR
Definition: wingdi.h:358
DWORD dwExStyle
Definition: winuser.h:3712
#define TRACE(s)
Definition: solgame.cpp:4
#define SM_CYCAPTION
Definition: winuser.h:953
int WINAPI GetSystemMetrics(_In_ int)
static HRGN hrgn
Definition: win.c:55
BOOL WINAPI GetWindowInfo(_In_ HWND, _Inout_ PWINDOWINFO)
LONG bottom
Definition: windef.h:294
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
USERAPIHOOK g_user32ApiHook
Definition: themehooks.c:11
#define SM_CYSMCAPTION
Definition: winuser.h:1004
#define WS_MAXIMIZE
Definition: pedump.c:623

Referenced by OnPostWinPosChanged().

◆ ThemeCleanupChildWndContext()

static BOOL CALLBACK ThemeCleanupChildWndContext ( HWND  hWnd,
LPARAM  msg 
)
static

Definition at line 148 of file themehooks.c.

149 {
151  return TRUE;
152 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
void ThemeDestroyWndData(HWND hWnd)
Definition: themehooks.c:38

Referenced by ThemeCleanupWndContext().

◆ ThemeCleanupWndContext()

static BOOL CALLBACK ThemeCleanupWndContext ( HWND  hWnd,
LPARAM  msg 
)
static

Definition at line 154 of file themehooks.c.

155 {
156  if (hWnd == NULL)
157  {
159  }
160  else
161  {
164  }
165 
166  return TRUE;
167 }
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
smooth NULL
Definition: ftsmooth.c:416
static BOOL CALLBACK ThemeCleanupChildWndContext(HWND hWnd, LPARAM msg)
Definition: themehooks.c:148
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC, _In_ LPARAM)
void ThemeDestroyWndData(HWND hWnd)
Definition: themehooks.c:38
static BOOL CALLBACK ThemeCleanupWndContext(HWND hWnd, LPARAM msg)
Definition: themehooks.c:154

Referenced by ThemeInitApiHook().

◆ ThemeDefWindowProcA()

static LRESULT CALLBACK ThemeDefWindowProcA ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 293 of file themehooks.c.

294 {
295  PWND_DATA pwndData;
296 
298 
299  if(!IsAppThemed() ||
300  !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT) ||
301  (pwndData && pwndData->HasAppDefinedRgn))
302  {
304  Msg,
305  wParam,
306  lParam);
307  }
308 
309  return ThemeWndProc(hWnd,
310  Msg,
311  wParam,
312  lParam,
314 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
HWND hWnd
Definition: settings.c:17
DWORD WINAPI GetThemeAppProperties(void)
Definition: system.c:933
ATOM atWndContext
Definition: system.c:52
WPARAM wParam
Definition: combotst.c:138
BOOL HasAppDefinedRgn
Definition: uxthemep.h:156
struct @1571 Msg[]
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
struct _WND_DATA * PWND_DATA
WNDPROC DefWindowProcA
Definition: undocuser.h:331
LRESULT CALLBACK ThemeWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, WNDPROC DefWndProc)
Definition: nonclient.c:998
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
USERAPIHOOK g_user32ApiHook
Definition: themehooks.c:11
LPARAM lParam
Definition: combotst.c:139
#define MAKEINTATOM(i)
Definition: winbase.h:1416

Referenced by ThemeInitApiHook().

◆ ThemeDefWindowProcW()

static LRESULT CALLBACK ThemeDefWindowProcW ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 269 of file themehooks.c.

270 {
271  PWND_DATA pwndData;
272 
274 
275  if(!IsAppThemed() ||
276  !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT) ||
277  (pwndData && pwndData->HasAppDefinedRgn))
278  {
280  Msg,
281  wParam,
282  lParam);
283  }
284 
285  return ThemeWndProc(hWnd,
286  Msg,
287  wParam,
288  lParam,
290 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
HWND hWnd
Definition: settings.c:17
DWORD WINAPI GetThemeAppProperties(void)
Definition: system.c:933
ATOM atWndContext
Definition: system.c:52
WPARAM wParam
Definition: combotst.c:138
BOOL HasAppDefinedRgn
Definition: uxthemep.h:156
struct @1571 Msg[]
WNDPROC DefWindowProcW
Definition: undocuser.h:332
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
struct _WND_DATA * PWND_DATA
LRESULT CALLBACK ThemeWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, WNDPROC DefWndProc)
Definition: nonclient.c:998
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
USERAPIHOOK g_user32ApiHook
Definition: themehooks.c:11
LPARAM lParam
Definition: combotst.c:139
#define MAKEINTATOM(i)
Definition: winbase.h:1416

Referenced by ThemeInitApiHook().

◆ ThemeDestroyWndData()

void ThemeDestroyWndData ( HWND  hWnd)

Definition at line 38 of file themehooks.c.

39 {
40  PWND_DATA pwndData;
42 
43  /*Do not destroy WND_DATA of a window that belong to another process */
46  {
47  return;
48  }
49 
51  if(pwndData == NULL)
52  {
53  return;
54  }
55 
56  if(pwndData->HasThemeRgn)
57  {
59  }
60 
61  if (pwndData->hTabBackgroundBrush != NULL)
62  {
64 
66  }
67 
68  if (pwndData->hTabBackgroundBmp != NULL)
69  {
71  }
72 
73  if (pwndData->hthemeWindow)
74  {
75  CloseThemeData(pwndData->hthemeWindow);
76  }
77 
78  if (pwndData->hthemeScrollbar)
79  {
81  }
82 
83  HeapFree(GetProcessHeap(), 0, pwndData);
84 
86 }
HBRUSH hTabBackgroundBrush
Definition: uxthemep.h:160
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
#define TRUE
Definition: types.h:120
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
HWND hWnd
Definition: settings.c:17
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
ATOM atWndContext
Definition: system.c:52
HBITMAP hTabBackgroundBmp
Definition: uxthemep.h:161
HTHEME hthemeScrollbar
Definition: uxthemep.h:152
SETWINDOWRGN SetWindowRgn
Definition: undocuser.h:338
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
struct _WND_DATA * PWND_DATA
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
unsigned long DWORD
Definition: ntddk_ex.h:95
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
BOOL HasThemeRgn
Definition: uxthemep.h:157
HTHEME hthemeWindow
Definition: uxthemep.h:151
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
USERAPIHOOK g_user32ApiHook
Definition: themehooks.c:11
#define HeapFree(x, y, z)
Definition: compat.h:394
#define MAKEINTATOM(i)
Definition: winbase.h:1416
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1188

Referenced by ThemeCleanupChildWndContext(), ThemeCleanupWndContext(), and ThemePostWindowProc().

◆ ThemeDlgPostWindowProc()

static LRESULT CALLBACK ThemeDlgPostWindowProc ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
ULONG_PTR  ret,
PDWORD  unknown 
)
static

Definition at line 483 of file themehooks.c.

484 {
485  switch(Msg)
486  {
487  case WM_CTLCOLORDLG:
488  case WM_CTLCOLORBTN:
489  case WM_CTLCOLORSTATIC:
490  {
491  HWND hwndTarget = (HWND)lParam;
492  HDC hdc = (HDC)wParam;
493  HBRUSH* phbrush = (HBRUSH*)ret;
494  HTHEME hTheme;
495 
496  if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
497  break;
498 
500  break;
501 
502  hTheme = GetWindowTheme(hWnd);
503  if (!hTheme)
504  hTheme = OpenThemeData(hWnd, L"TAB");
505 
506  if (!hTheme)
507  break;
508 
509  GetDiaogTextureBrush(hTheme, hwndTarget, hdc, phbrush, Msg != WM_CTLCOLORDLG);
510 
511 #if 1
512  {
513  WCHAR controlClass[32];
514  GetClassNameW (hwndTarget, controlClass, sizeof(controlClass) / sizeof(controlClass[0]));
515 
516  /* This is a hack for the static class. Windows have a v6 static class just for this. */
517  if (lstrcmpiW (controlClass, WC_STATICW) == 0)
518  HackFillStaticBg(hwndTarget, hdc, phbrush);
519  }
520 #endif
522  break;
523  }
524  }
525 
526  return 0;
527 }
void HackFillStaticBg(HWND hwnd, HDC hdc, HBRUSH *result)
Definition: themehooks.c:465
#define WM_CTLCOLORDLG
Definition: winuser.h:1746
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1748
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
HANDLE HWND
Definition: compat.h:13
DWORD WINAPI GetThemeAppProperties(void)
Definition: system.c:933
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
BOOL WINAPI IsThemeDialogTextureEnabled(HWND hwnd)
Definition: draw.c:56
HRESULT GetDiaogTextureBrush(HTHEME theme, HWND hwnd, HDC hdc, HBRUSH *result, BOOL changeOrigin)
Definition: themehooks.c:402
WPARAM wParam
Definition: combotst.c:138
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
struct @1571 Msg[]
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
#define WM_CTLCOLORBTN
Definition: winuser.h:1745
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
#define TRANSPARENT
Definition: wingdi.h:949
__wchar_t WCHAR
Definition: xmlstorage.h:180
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
int ret
static const WCHAR L[]
Definition: oid.c:1250
HDC hdc
Definition: main.c:9
#define WC_STATICW
Definition: commctrl.h:4651
LPARAM lParam
Definition: combotst.c:139

Referenced by ThemeInitApiHook().

◆ ThemeDlgPreWindowProc()

static LRESULT CALLBACK ThemeDlgPreWindowProc ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
ULONG_PTR  ret,
PDWORD  unknown 
)
static

Definition at line 477 of file themehooks.c.

478 {
479  return 0;
480 }

Referenced by ThemeInitApiHook().

◆ ThemeGetScrollInfo()

BOOL WINAPI ThemeGetScrollInfo ( HWND  hwnd,
int  fnBar,
LPSCROLLINFO  lpsi 
)

Definition at line 541 of file themehooks.c.

542 {
543  PWND_DATA pwndData;
544  DWORD style;
545  BOOL ret;
546 
547  /* Avoid creating a window context if it is not needed */
548  if(!IsAppThemed() || !(GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
549  goto dodefault;
550 
552  if((style & (WS_HSCROLL|WS_VSCROLL))==0)
553  goto dodefault;
554 
555  pwndData = ThemeGetWndData(hwnd);
556  if (pwndData == NULL)
557  goto dodefault;
558 
559  /*
560  * Uxtheme needs to handle the tracking of the scrollbar itself
561  * This means than if an application needs to get the track position
562  * with GetScrollInfo, it will get wrong data. So uxtheme needs to
563  * hook it and set the correct tracking position itself
564  */
565  ret = g_user32ApiHook.GetScrollInfo(hwnd, fnBar, lpsi);
566  if ( lpsi &&
567  (lpsi->fMask & SIF_TRACKPOS) &&
568  pwndData->SCROLL_TrackingWin == hwnd &&
569  pwndData->SCROLL_TrackingBar == fnBar)
570  {
571  lpsi->nTrackPos = pwndData->SCROLL_TrackingVal;
572  }
573  return ret;
574 
575 dodefault:
576  return g_user32ApiHook.GetScrollInfo(hwnd, fnBar, lpsi);
577 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
INT SCROLL_TrackingVal
Definition: uxthemep.h:169
DWORD WINAPI GetThemeAppProperties(void)
Definition: system.c:933
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
GETSCROLLINFO GetScrollInfo
Definition: undocuser.h:334
INT SCROLL_TrackingBar
Definition: uxthemep.h:167
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WS_HSCROLL
Definition: pedump.c:628
int ret
#define GWL_STYLE
Definition: winuser.h:846
#define SIF_TRACKPOS
Definition: winuser.h:1223
#define WS_VSCROLL
Definition: pedump.c:627
HWND SCROLL_TrackingWin
Definition: uxthemep.h:166
PWND_DATA ThemeGetWndData(HWND hWnd)
Definition: themehooks.c:17
Arabic default style
Definition: afstyles.h:93
USERAPIHOOK g_user32ApiHook
Definition: themehooks.c:11

Referenced by ThemeInitApiHook().

◆ ThemeGetWndData()

PWND_DATA ThemeGetWndData ( HWND  hWnd)

Definition at line 17 of file themehooks.c.

18 {
19  PWND_DATA pwndData;
20 
22  if(pwndData == NULL)
23  {
24  pwndData = HeapAlloc(GetProcessHeap(),
26  sizeof(WND_DATA));
27  if(pwndData == NULL)
28  {
29  return NULL;
30  }
31 
33  }
34 
35  return pwndData;
36 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
HWND hWnd
Definition: settings.c:17
ATOM atWndContext
Definition: system.c:52
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
struct _WND_DATA * PWND_DATA
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define MAKEINTATOM(i)
Definition: winbase.h:1416

Referenced by DefWndNCHitTest(), GetDiaogTextureBrush(), GetNCCaptionTheme(), GetNCScrollbarTheme(), OnPostWinPosChanged(), SCROLL_TrackScrollBar(), ThemeCalculateCaptionButtonsPos(), ThemeDrawCaptionButton(), ThemeDrawScrollBar(), ThemeGetScrollInfo(), ThemeHandleButton(), ThemeHandleNcMouseLeave(), ThemeHandleNcMouseMove(), ThemePreWindowProc(), and ThemeSetWindowRgn().

◆ ThemeHooksInstall()

BOOL WINAPI ThemeHooksInstall ( )

Definition at line 669 of file themehooks.c.

670 {
671  PVOID lpFunc;
673  BOOL ret;
674 
675  lpFunc = GetProcAddress(GetModuleHandle("user32.dll"), "RegisterUserApiHook");
676 
677  ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
679  GetVersionEx(&osvi);
680 
681  if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
682  {
683  PREGISTER_UAH_WINXP lpfuncxp = (PREGISTER_UAH_WINXP)lpFunc;
684  ret = lpfuncxp(hDllInst, ThemeInitApiHook);
685  }
686  else if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
687  {
688  PREGISTER_UUAH_WIN2003 lpfunc2003 = (PREGISTER_UUAH_WIN2003)lpFunc;
689  USERAPIHOOKINFO uah;
690 
691  uah.m_size = sizeof(uah);
692  uah.m_dllname1 = L"uxtheme.dll";
693  uah.m_funname1 = L"ThemeInitApiHook";
694  uah.m_dllname2 = NULL;
695  uah.m_funname2 = NULL;
696 
697  ret = lpfunc2003(&uah);
698  }
699  else
700  {
702  ret = FALSE;
703  }
704 
706 
707  return ret;
708 }
#define TRUE
Definition: types.h:120
ULONG dwMajorVersion
Definition: rtltypes.h:234
OSVERSIONINFO osvi
Definition: ver.c:28
LPCWSTR m_dllname2
Definition: undocuser.h:369
HINSTANCE hDllInst
Definition: system.c:45
#define ZeroMemory
Definition: winbase.h:1635
OSVERSIONINFOA OSVERSIONINFO
Definition: rtltypes.h:289
LPCWSTR m_funname1
Definition: undocuser.h:368
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:233
LPCWSTR m_dllname1
Definition: undocuser.h:367
BOOL(WINAPI * PREGISTER_UAH_WINXP)(HINSTANCE hInstance, USERAPIHOOKPROC CallbackFunc)
Definition: themehooks.c:665
int ret
static const WCHAR L[]
Definition: oid.c:1250
ULONG dwMinorVersion
Definition: rtltypes.h:235
BOOL(WINAPI * PREGISTER_UUAH_WIN2003)(PUSERAPIHOOKINFO puah)
Definition: themehooks.c:666
BOOL CALLBACK UXTHEME_broadcast_theme_changed(HWND hWnd, LPARAM enable)
Definition: system.c:68
#define GetModuleHandle
Definition: winbase.h:3641
#define GetVersionEx
Definition: winbase.h:3666
BOOL CALLBACK ThemeInitApiHook(UAPIHK State, PUSERAPIHOOK puah)
Definition: themehooks.c:584
#define UNIMPLEMENTED
Definition: debug.h:114
#define GetProcAddress(x, y)
Definition: compat.h:410
LPCWSTR m_funname2
Definition: undocuser.h:370

Referenced by ThemeStartCallback().

◆ ThemeHooksRemove()

BOOL WINAPI ThemeHooksRemove ( )

Definition at line 711 of file themehooks.c.

712 {
713  BOOL ret;
714 
716 
718 
719  return ret;
720 }
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
int ret
BOOL WINAPI UnregisterUserApiHook(VOID)
Definition: usrapihk.c:394
BOOL CALLBACK UXTHEME_broadcast_theme_changed(HWND hWnd, LPARAM enable)
Definition: system.c:68

Referenced by ThemeStopCallback().

◆ ThemeInitApiHook()

BOOL CALLBACK ThemeInitApiHook ( UAPIHK  State,
PUSERAPIHOOK  puah 
)

Definition at line 584 of file themehooks.c.

585 {
586  if (!puah || State != uahLoadInit)
587  {
591  return TRUE;
592  }
593 
595 
596  /* Store the original functions from user32 */
597  g_user32ApiHook = *puah;
598 
611 
614 
626  UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_STYLECHANGED);
627  UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_SETICON);
633 
640  UAH_HOOK_MESSAGE(puah->WndProcArray, WM_STYLECHANGING);
641  UAH_HOOK_MESSAGE(puah->WndProcArray, WM_STYLECHANGED);
647  UAH_HOOK_MESSAGE(puah->WndProcArray, WM_THEMECHANGED);
649 
652 
659 
661 
662  return TRUE;
663 }
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1674
#define TRUE
Definition: types.h:120
BYTE gabDLGPmessages[UAHOWP_MAX_SIZE]
Definition: themehooks.c:14
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define UAH_HOOK_MESSAGE(uahowp, msg)
Definition: undocuser.h:324
#define WM_MENUCHAR
Definition: winuser.h:1724
WNDPROC_OWP PostDefDlgProc
Definition: undocuser.h:343
UAHOWP DlgProcArray
Definition: undocuser.h:344
#define WM_CTLCOLORDLG
Definition: winuser.h:1746
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1748
static LRESULT CALLBACK ThemePostWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ret, PDWORD unknown)
Definition: themehooks.c:384
BYTE gabDWPmessages[UAHOWP_MAX_SIZE]
Definition: themehooks.c:12
#define WM_NCHITTEST
Definition: winuser.h:1668
#define WM_MDISETMENU
Definition: winuser.h:1798
#define WM_NCCREATE
Definition: winuser.h:1665
#define WM_SETTINGCHANGE
Definition: winuser.h:1611
#define WM_PRINTCLIENT
Definition: richedit.h:70
void UXTHEME_LoadTheme(BOOL bLoad)
Definition: system.c:183
#define WM_NCPAINT
Definition: winuser.h:1669
SETWINDOWRGN SetWindowRgn
Definition: undocuser.h:338
#define WM_CTLCOLORBTN
Definition: winuser.h:1745
WNDPROC DefWindowProcW
Definition: undocuser.h:332
WNDPROC_OWP PostWndProc
Definition: undocuser.h:340
#define WM_NCACTIVATE
Definition: winuser.h:1670
UAHOWP DefWndProcArray
Definition: undocuser.h:333
smooth NULL
Definition: ftsmooth.c:416
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1742
#define WM_SETTEXT
Definition: winuser.h:1599
GETSCROLLINFO GetScrollInfo
Definition: undocuser.h:334
#define WM_NCUAHDRAWCAPTION
Definition: undocuser.h:45
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define WM_NCDESTROY
Definition: winuser.h:1666
#define WM_MEASUREITEM
Definition: winuser.h:1628
DWORD Size
Definition: undocuser.h:321
WNDPROC_OWP PreDefDlgProc
Definition: undocuser.h:342
WNDPROC DefWindowProcA
Definition: undocuser.h:331
BYTE * MsgBitArray
Definition: undocuser.h:320
static LRESULT CALLBACK ThemeDlgPreWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ret, PDWORD unknown)
Definition: themehooks.c:477
static BOOL CALLBACK ThemeCleanupWndContext(HWND hWnd, LPARAM msg)
Definition: themehooks.c:154
int WINAPI ThemeSetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw)
Definition: themehooks.c:529
#define UAHOWP_MAX_SIZE
Definition: undocuser.h:326
BOOL WINAPI ThemeGetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi)
Definition: themehooks.c:541
static LRESULT CALLBACK ThemeDefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: themehooks.c:293
WNDPROC_OWP PreWndProc
Definition: undocuser.h:339
UAHOWP WndProcArray
Definition: undocuser.h:341
#define WM_DRAWITEM
Definition: winuser.h:1627
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define WM_NCUAHDRAWFRAME
Definition: undocuser.h:46
#define WM_UAHINIT
Definition: undocuser.h:60
#define WM_CREATE
Definition: winuser.h:1590
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
#define WM_NCMOUSELEAVE
Definition: winuser.h:1818
static LRESULT CALLBACK ThemeDlgPostWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ret, PDWORD unknown)
Definition: themehooks.c:483
static LRESULT CALLBACK ThemePreWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ret, PDWORD unknown)
Definition: themehooks.c:317
USERAPIHOOK g_user32ApiHook
Definition: themehooks.c:11
#define WM_SYSCOMMAND
Definition: winuser.h:1717
#define WM_INITDIALOG
Definition: winuser.h:1715
BYTE gabMSGPmessages[UAHOWP_MAX_SIZE]
Definition: themehooks.c:13
#define WM_NCMOUSEMOVE
Definition: winuser.h:1673
static LRESULT CALLBACK ThemeDefWindowProcW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: themehooks.c:269

Referenced by ThemeHooksInstall().

◆ ThemePostWindowProc()

static LRESULT CALLBACK ThemePostWindowProc ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
ULONG_PTR  ret,
PDWORD  unknown 
)
static

Definition at line 384 of file themehooks.c.

385 {
386  switch(Msg)
387  {
388  case WM_WINDOWPOSCHANGED:
389  {
391  }
392  case WM_NCDESTROY:
393  {
395  return 0;
396  }
397  }
398 
399  return 0;
400 }
HWND hWnd
Definition: settings.c:17
struct @1571 Msg[]
#define WM_NCDESTROY
Definition: winuser.h:1666
void ThemeDestroyWndData(HWND hWnd)
Definition: themehooks.c:38
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
int OnPostWinPosChanged(HWND hWnd, WINDOWPOS *pWinPos)
Definition: themehooks.c:218
LPARAM lParam
Definition: combotst.c:139

Referenced by ThemeInitApiHook().

◆ ThemePreWindowProc()

static LRESULT CALLBACK ThemePreWindowProc ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
ULONG_PTR  ret,
PDWORD  unknown 
)
static

Definition at line 317 of file themehooks.c.

318 {
319  switch(Msg)
320  {
321  case WM_CREATE:
322  case WM_STYLECHANGED:
323  case WM_SIZE:
324  case WM_WINDOWPOSCHANGED:
325  {
326  if(IsAppThemed() && (GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
328  break;
329  }
330  case WM_THEMECHANGED:
331  {
332  PWND_DATA pwndData = ThemeGetWndData(hWnd);
333 
336 
337  if (pwndData == NULL)
338  return 0;
339 
340  if (pwndData->hTabBackgroundBrush != NULL)
341  {
343  pwndData->hTabBackgroundBrush = NULL;
344  }
345 
346  if (pwndData->hTabBackgroundBmp != NULL)
347  {
348  DeleteObject(pwndData->hTabBackgroundBmp);
349  pwndData->hTabBackgroundBmp = NULL;
350  }
351 
352  if (pwndData->hthemeWindow)
353  {
354  CloseThemeData(pwndData->hthemeWindow);
355  pwndData->hthemeWindow = NULL;
356  }
357 
358  if (pwndData->hthemeScrollbar)
359  {
360  CloseThemeData(pwndData->hthemeScrollbar);
361  pwndData->hthemeScrollbar = NULL;
362  }
363 
364  if(IsAppThemed() && (GetThemeAppProperties() & STAP_ALLOW_NONCLIENT))
366 
367  pwndData->DirtyThemeRegion = TRUE;
368  break;
369  }
370  case WM_NCCREATE:
371  {
372  PWND_DATA pwndData = ThemeGetWndData(hWnd);
373  if (pwndData == NULL)
374  return 0;
375  pwndData->DirtyThemeRegion = TRUE;
376  }
377  }
378 
379  return 0;
380 }
HBRUSH hTabBackgroundBrush
Definition: uxthemep.h:160
HWND WINAPI GetAncestor(_In_ HWND, _In_ UINT)
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
DWORD WINAPI GetThemeAppProperties(void)
Definition: system.c:933
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HBITMAP hTabBackgroundBmp
Definition: uxthemep.h:161
#define WM_NCCREATE
Definition: winuser.h:1665
HTHEME hthemeScrollbar
Definition: uxthemep.h:152
struct @1571 Msg[]
void UXTHEME_LoadTheme(BOOL bLoad)
Definition: system.c:183
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
#define GA_PARENT
Definition: winuser.h:2742
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
#define WM_SIZE
Definition: winuser.h:1593
void ThemeCalculateCaptionButtonsPos(HWND hWnd, HTHEME htheme)
Definition: nonclient.c:213
BOOL DirtyThemeRegion
Definition: uxthemep.h:159
HTHEME hthemeWindow
Definition: uxthemep.h:151
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
#define WM_CREATE
Definition: winuser.h:1590
PWND_DATA ThemeGetWndData(HWND hWnd)
Definition: themehooks.c:17
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950

Referenced by ThemeInitApiHook().

◆ ThemeSetWindowRgn()

int WINAPI ThemeSetWindowRgn ( HWND  hWnd,
HRGN  hRgn,
BOOL  bRedraw 
)

Definition at line 529 of file themehooks.c.

530 {
531  PWND_DATA pwndData = ThemeGetWndData(hWnd);
532  if(pwndData)
533  {
534  pwndData->HasAppDefinedRgn = TRUE;
535  pwndData->HasThemeRgn = FALSE;
536  }
537 
538  return g_user32ApiHook.SetWindowRgn(hWnd, hRgn, bRedraw);
539 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
static HRGN hRgn
Definition: mapping.c:33
BOOL HasAppDefinedRgn
Definition: uxthemep.h:156
SETWINDOWRGN SetWindowRgn
Definition: undocuser.h:338
BOOL HasThemeRgn
Definition: uxthemep.h:157
PWND_DATA ThemeGetWndData(HWND hWnd)
Definition: themehooks.c:17
USERAPIHOOK g_user32ApiHook
Definition: themehooks.c:11

Referenced by ThemeInitApiHook().

Variable Documentation

◆ g_bThemeHooksActive

◆ g_user32ApiHook

◆ gabDLGPmessages

BYTE gabDLGPmessages[UAHOWP_MAX_SIZE]

Definition at line 14 of file themehooks.c.

Referenced by ThemeInitApiHook().

◆ gabDWPmessages

BYTE gabDWPmessages[UAHOWP_MAX_SIZE]

Definition at line 12 of file themehooks.c.

Referenced by ThemeInitApiHook().

◆ gabMSGPmessages

BYTE gabMSGPmessages[UAHOWP_MAX_SIZE]

Definition at line 13 of file themehooks.c.

Referenced by ThemeInitApiHook().