From eb23bde45832cb95f2b0ce35f44f5a7505376322 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Tue, 12 Jul 2011 21:25:51 +0000 Subject: [PATCH] [apihooksrv] - Commit a test utility that can install user api hooks and give for the first time real themes support. This is a temporary test program till the same functionality is integrated to winlogon. To use it someone has to activate themes with themecfg and then run "apihook uxtheme.dll". Also note that it is possible to use this tool in windows for testing purposes svn path=/branches/GSoC_2011/ThemesSupport/; revision=52665 --- dll/win32/uxtheme/CMakeLists.txt | 1 + dll/win32/uxtheme/apihooksrv/CMakeLists.txt | 13 +++++ dll/win32/uxtheme/apihooksrv/apihooksrv.c | 57 +++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 dll/win32/uxtheme/apihooksrv/CMakeLists.txt create mode 100644 dll/win32/uxtheme/apihooksrv/apihooksrv.c diff --git a/dll/win32/uxtheme/CMakeLists.txt b/dll/win32/uxtheme/CMakeLists.txt index 9252062e433..ab30d15a67d 100644 --- a/dll/win32/uxtheme/CMakeLists.txt +++ b/dll/win32/uxtheme/CMakeLists.txt @@ -1,5 +1,6 @@ add_subdirectory(themecfg) +add_subdirectory(apihooksrv) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) add_definitions(-D__WINESRC__) diff --git a/dll/win32/uxtheme/apihooksrv/CMakeLists.txt b/dll/win32/uxtheme/apihooksrv/CMakeLists.txt new file mode 100644 index 00000000000..51251d50680 --- /dev/null +++ b/dll/win32/uxtheme/apihooksrv/CMakeLists.txt @@ -0,0 +1,13 @@ + +set_rc_compiler() + +list(APPEND SOURCE + apihooksrv.c) + +add_executable(apihooksrv ${SOURCE}) + +set_module_type(apihooksrv win32cui) + +add_importlibs(apihooksrv msvcrt user32 kernel32) + +add_cd_file(TARGET apihooksrv DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/uxtheme/apihooksrv/apihooksrv.c b/dll/win32/uxtheme/apihooksrv/apihooksrv.c new file mode 100644 index 00000000000..2eb0a3dcc3d --- /dev/null +++ b/dll/win32/uxtheme/apihooksrv/apihooksrv.c @@ -0,0 +1,57 @@ +#include +#include +#include + +typedef BOOL (WINAPI * PTHEMESHOOKINSTALL) (); + +int _tmain(int argc, _TCHAR* argv[]) +{ + HMODULE hmodRosTheme; + PTHEMESHOOKINSTALL fnInstall, fnRemove; + BOOL ret; + DWORD info = BSM_APPLICATIONS; + + if ( argc != 2 ) + { + return 0; + } + + + //hmodRosTheme = LoadLibrary(L"C:\\Reactos\\src\\themes-priv\\output-MinGW-i386\\reactos\\dll\\win32\\uxtheme\\rostheme.dll"); + hmodRosTheme = LoadLibrary(argv[1]); + if(!hmodRosTheme) + { + printf("failed to load rostheme\n"); + return 0; + } + + fnInstall = GetProcAddress(hmodRosTheme, (LPCSTR)34); + fnRemove = GetProcAddress(hmodRosTheme, (LPCSTR)35); + + if(!fnInstall) + { + printf("failed to get ThemeHooksInstall\n"); + return 0; + } + + if(!fnRemove) + { + printf("failed to get ThemeHooksRemove\n"); + return 0; + } + + ret = fnInstall(); + printf("ThemeHooksInstall returned %d\n", ret); + + BroadcastSystemMessage(BSF_POSTMESSAGE, &info,WM_SETFOCUS,0,0); + + Sleep(36000); + + ret = fnRemove(); + printf("ThemeHooksRemove returned %d\n", ret); + + BroadcastSystemMessage(BSF_POSTMESSAGE, &info,WM_SETFOCUS,0,0); + + return 0; +} +