Author: gadamopoulos Date: Sat May 14 18:31:47 2011 New Revision: 51741
URL: http://svn.reactos.org/svn/reactos?rev=51741&view=rev Log: [uxtheme] - Begin implementing ThemeHooksInstall, ThemeHooksRemove and ThemeInitApiHook
Added: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c (with props) branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/themehooks.c (with props) Modified: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/CMakeLists.txt branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/uxtheme.spec
Modified: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/dll/win3... ============================================================================== --- branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/CMakeLists.txt [iso-8859-1] (original) +++ branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/CMakeLists.txt [iso-8859-1] Sat May 14 18:31:47 2011 @@ -11,9 +11,11 @@ main.c metric.c msstyles.c + nonclient.c property.c stylemap.c system.c + themehooks.c uxini.c version.rc ${CMAKE_CURRENT_BINARY_DIR}/uxtheme_stubs.c
Added: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/dll/win3... ============================================================================== --- branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c (added) +++ branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c [iso-8859-1] Sat May 14 18:31:47 2011 @@ -1,0 +1,38 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS uxtheme.dll + * FILE: dll/win32/uxtheme/themehooks.c + * PURPOSE: uxtheme non client area management + * PROGRAMMER: Giannis Adamopoulos + */ + + + +#include "config.h" + +#include <stdlib.h> +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "vfwmsgs.h" +#include "uxtheme.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); + + +LRESULT +ThemeDefWindowProcAW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, WNDPROC defWndProc, BOOL ANSI) +{ + UNIMPLEMENTED; + + /* Some test */ + if(Msg == WM_NCPAINT || Msg == WM_NCACTIVATE) + return FALSE; + + return defWndProc(hWnd, Msg, wParam, lParam); +}
Propchange: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/themehooks.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/dll/win3... ============================================================================== --- branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/themehooks.c (added) +++ branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/themehooks.c [iso-8859-1] Sat May 14 18:31:47 2011 @@ -1,0 +1,127 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS uxtheme.dll + * FILE: dll/win32/uxtheme/themehooks.c + * PURPOSE: uxtheme user api hook functions + * PROGRAMMER: Giannis Adamopoulos + */ + +#include <windows.h> +#include <undocuser.h> + +#include "vfwmsgs.h" +#include "uxtheme.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); + + + +extern HINSTANCE hDllInst; + +LRESULT +ThemeDefWindowProcAW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, WNDPROC defWndProc, BOOL ANSI); + +USERAPIHOOK user32ApiHook; +BYTE gabDWPmessages[UAHOWP_MAX_SIZE]; + +static LRESULT CALLBACK +ThemeDefWindowProcW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + return ThemeDefWindowProcAW(hWnd, + Msg, + wParam, + lParam, + user32ApiHook.DefWindowProcW, + FALSE); +} + +static LRESULT CALLBACK +ThemeDefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + return ThemeDefWindowProcAW(hWnd, + Msg, + wParam, + lParam, + user32ApiHook.DefWindowProcA, + TRUE); +} + +BOOL CALLBACK +ThemeInitApiHook(UAPIHK State, PUSERAPIHOOK puah) +{ + /* Sanity checks for the caller */ + if (!puah || State != uahLoadInit) + { + return TRUE; + } + + /* Store the original functions from user32 */ + user32ApiHook = *puah; + + puah->DefWindowProcA = ThemeDefWindowProcA; + puah->DefWindowProcW = ThemeDefWindowProcW; + puah->DefWndProcArray.MsgBitArray = gabDWPmessages; + puah->DefWndProcArray.Size = UAHOWP_MAX_SIZE; + + UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_CREATE); + UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_DESTROY); + UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_THEMECHANGED); + UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_NCPAINT); + UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_NCACTIVATE); + UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_NCMOUSEMOVE); + UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_MOUSEMOVE); + UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_NCMOUSELEAVE); + UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_NCHITTEST); + UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_NCLBUTTONDOWN); + UAH_HOOK_MESSAGE(puah->DefWndProcArray, WM_NCLBUTTONDBLCLK); + + return TRUE; +} + +typedef BOOL (WINAPI * PREGISTER_UAH_WINXP)(HINSTANCE hInstance, USERAPIHOOKPROC CallbackFunc); +typedef BOOL (WINAPI * PREGISTER_UUAH_WIN2003)(PUSERAPIHOOKINFO puah); + +BOOL WINAPI +ThemeHooksInstall() +{ + PVOID lpFunc; + OSVERSIONINFO osvi; + + lpFunc = GetProcAddress(GetModuleHandle("user32.dll"), "RegisterUserApiHook"); + + ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&osvi); + + if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) + { + PREGISTER_UAH_WINXP lpfuncxp = (PREGISTER_UAH_WINXP)lpFunc; + return lpfuncxp(hDllInst, ThemeInitApiHook); + } + else if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) + { + PREGISTER_UUAH_WIN2003 lpfunc2003 = (PREGISTER_UUAH_WIN2003)lpFunc; + USERAPIHOOKINFO uah; + + uah.m_size = sizeof(uah); + uah.m_dllname1 = L"uxtheme.dll"; + uah.m_funname1 = L"ThemeInitApiHook"; + uah.m_dllname2 = NULL; + uah.m_funname2 = NULL; + + return lpfunc2003(&uah); + } + else + { + UNIMPLEMENTED; + return FALSE; + } +} + +BOOL WINAPI +ThemeHooksRemove() +{ + return UnregisterUserApiHook(); +}
Propchange: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/themehooks.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/uxtheme.spec URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/dll/win3... ============================================================================== --- branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/uxtheme.spec [iso-8859-1] (original) +++ branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/uxtheme.spec [iso-8859-1] Sat May 14 18:31:47 2011 @@ -29,8 +29,8 @@ 31 stub -noname InitUserTheme 32 stub -noname InitUserRegistry 33 stub -noname ReestablishServerConnection -34 stub -noname ThemeHooksInstall -35 stub -noname ThemeHooksRemove +34 stdcall -noname ThemeHooksInstall() +35 stdcall -noname ThemeHooksRemove() 36 stub -noname RefreshThemeForTS 43 stub -noname ClassicGetSystemMetrics 44 stub -noname ClassicSystemParametersInfoA @@ -95,3 +95,4 @@ @ stdcall OpenThemeData(ptr wstr) @ stdcall SetThemeAppProperties(long) @ stdcall SetWindowTheme(ptr wstr wstr) +@ stdcall ThemeInitApiHook(long ptr)