From f4460c3fcd97f90b0684fdea7f9ab8a1046a4ca1 Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Mon, 25 Dec 2023 22:29:57 +0900 Subject: [PATCH] [CTFMON][MSCTF][MSUTB][SDK] Add msutb.dll (stub) (#6222) msutb.dll is the GUI back-end of Language Bar (Tipbar). - Add msutb.dll module at dll/win32/msutb/. - The implementation of msutb.dll is currently stub. - Modify msctf.spec and msctf.idl. - Add . - Adapt ctfmon.exe to these changes. CORE-19362, CORE-19363 --- base/applications/ctfmon/CLoaderWnd.cpp | 2 +- base/applications/ctfmon/CLoaderWnd.h | 2 +- base/applications/ctfmon/CMakeLists.txt | 4 +- base/applications/ctfmon/CRegWatcher.cpp | 10 +- base/applications/ctfmon/ctfmon.cpp | 8 +- base/applications/ctfmon/precomp.h | 11 +- dll/win32/CMakeLists.txt | 1 + dll/win32/msctf/msctf.spec | 4 +- dll/win32/msutb/CMakeLists.txt | 19 ++ dll/win32/msutb/lang/en-US.rc | 19 ++ dll/win32/msutb/msutb.cpp | 221 +++++++++++++++++++++++ dll/win32/msutb/msutb.rc | 28 +++ dll/win32/msutb/msutb.spec | 8 + dll/win32/msutb/precomp.h | 31 ++++ dll/win32/msutb/resource.h | 9 + sdk/include/psdk/msctf.idl | 2 + sdk/include/reactos/cicero/cicutb.h | 13 ++ 17 files changed, 367 insertions(+), 25 deletions(-) create mode 100644 dll/win32/msutb/CMakeLists.txt create mode 100644 dll/win32/msutb/lang/en-US.rc create mode 100644 dll/win32/msutb/msutb.cpp create mode 100644 dll/win32/msutb/msutb.rc create mode 100644 dll/win32/msutb/msutb.spec create mode 100644 dll/win32/msutb/precomp.h create mode 100644 dll/win32/msutb/resource.h create mode 100644 sdk/include/reactos/cicero/cicutb.h diff --git a/base/applications/ctfmon/CLoaderWnd.cpp b/base/applications/ctfmon/CLoaderWnd.cpp index a95259dd584..45072bafe1b 100644 --- a/base/applications/ctfmon/CLoaderWnd.cpp +++ b/base/applications/ctfmon/CLoaderWnd.cpp @@ -1,7 +1,7 @@ /* * PROJECT: ReactOS CTF Monitor * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) - * PURPOSE: Cicero TIP Bar loader window + * PURPOSE: Cicero Tipbar (Language Bar) loader window * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ */ diff --git a/base/applications/ctfmon/CLoaderWnd.h b/base/applications/ctfmon/CLoaderWnd.h index 9127a40155e..0ae5f51aa8d 100644 --- a/base/applications/ctfmon/CLoaderWnd.h +++ b/base/applications/ctfmon/CLoaderWnd.h @@ -1,7 +1,7 @@ /* * PROJECT: ReactOS CTF Monitor * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) - * PURPOSE: Cicero TIP Bar loader window + * PURPOSE: Cicero Tipbar (Language Bar) loader window * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ */ diff --git a/base/applications/ctfmon/CMakeLists.txt b/base/applications/ctfmon/CMakeLists.txt index f88d8f5ad1a..2bc6d6a50f2 100644 --- a/base/applications/ctfmon/CMakeLists.txt +++ b/base/applications/ctfmon/CMakeLists.txt @@ -7,8 +7,8 @@ list(APPEND SOURCE add_rc_deps(ctfmon.rc ${CMAKE_CURRENT_SOURCE_DIR}/res/ctfmon.ico) add_executable(ctfmon ${SOURCE} ctfmon.rc) set_module_type(ctfmon win32gui UNICODE) -add_dependencies(ctfmon msctf) +add_dependencies(ctfmon msctf msutb) target_link_libraries(ctfmon uuid) -add_importlibs(ctfmon msctf advapi32 shell32 user32 msvcrt kernel32) +add_importlibs(ctfmon msctf msutb advapi32 shell32 user32 msvcrt kernel32) add_pch(ctfmon precomp.h SOURCE) add_cd_file(TARGET ctfmon DESTINATION reactos/system32 FOR all) diff --git a/base/applications/ctfmon/CRegWatcher.cpp b/base/applications/ctfmon/CRegWatcher.cpp index 04d3f213622..d7271820f68 100644 --- a/base/applications/ctfmon/CRegWatcher.cpp +++ b/base/applications/ctfmon/CRegWatcher.cpp @@ -112,11 +112,11 @@ CRegWatcher::InitEvent( } // Start registry watching - error = RegNotifyChangeKeyValue(entry.hKey, - TRUE, - REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_CHANGE_NAME, - s_ahWatchEvents[iEvent], - TRUE); + error = ::RegNotifyChangeKeyValue(entry.hKey, + TRUE, + REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_CHANGE_NAME, + s_ahWatchEvents[iEvent], + TRUE); return error == ERROR_SUCCESS; } diff --git a/base/applications/ctfmon/ctfmon.cpp b/base/applications/ctfmon/ctfmon.cpp index 71e7aeae2af..7756ee75097 100644 --- a/base/applications/ctfmon/ctfmon.cpp +++ b/base/applications/ctfmon/ctfmon.cpp @@ -26,7 +26,7 @@ BOOL g_bOnWow64 = FALSE; // Is the app running on WoW64? BOOL g_fNoRunKey = FALSE; // Don't write registry key "Run"? BOOL g_fJustRunKey = FALSE; // Just write registry key "Run"? DWORD g_dwOsInfo = 0; // The OS version info. See cicGetOSInfo -CLoaderWnd* g_pLoaderWnd = NULL; // TIP Bar loader window +CLoaderWnd* g_pLoaderWnd = NULL; // Tipbar loader window static VOID ParseCommandLine( @@ -209,7 +209,7 @@ InitApp( if (!g_bOnWow64) CRegWatcher::Init(); - // Create TIP Bar loader window + // Create Tipbar loader window g_pLoaderWnd = new CLoaderWnd(); if (!g_pLoaderWnd || !g_pLoaderWnd->Init()) return FALSE; @@ -221,7 +221,7 @@ InitApp( SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); } - // Display TIP Bar Popup if x86/x64 native + // Display Tipbar Popup if x86/x64 native and necessary if (!g_bOnWow64) GetPopupTipbar(g_pLoaderWnd->m_hWnd, g_fWinLogon); @@ -234,7 +234,7 @@ InitApp( VOID UninitApp(VOID) { - // Close TIP Bar Popup + // Close Tipbar Popup ClosePopupTipbar(); // Release Cicero diff --git a/base/applications/ctfmon/precomp.h b/base/applications/ctfmon/precomp.h index 4a8a5d121d5..6e1282e2bfa 100644 --- a/base/applications/ctfmon/precomp.h +++ b/base/applications/ctfmon/precomp.h @@ -17,6 +17,7 @@ #include #include #include +#include #include "resource.h" @@ -43,13 +44,3 @@ typedef enum WATCH_INDEX WI_ASSEMBLIES = 11, WI_DESKTOP_SWITCH = 12, } WATCH_INDEX; - -// FIXME: Use msutb.dll and header -static inline void ClosePopupTipbar(void) -{ -} - -// FIXME: Use msutb.dll and header -static inline void GetPopupTipbar(HWND hwnd, BOOL fWinLogon) -{ -} diff --git a/dll/win32/CMakeLists.txt b/dll/win32/CMakeLists.txt index da4dfb9162d..dbf6ec11dd7 100644 --- a/dll/win32/CMakeLists.txt +++ b/dll/win32/CMakeLists.txt @@ -115,6 +115,7 @@ add_subdirectory(msrle32) add_subdirectory(mssign32) add_subdirectory(mssip32) add_subdirectory(mstask) +add_subdirectory(msutb) add_subdirectory(msv1_0) add_subdirectory(msvcrt) add_subdirectory(msvcrt20) diff --git a/dll/win32/msctf/msctf.spec b/dll/win32/msctf/msctf.spec index a38e8d7da2b..e5a1a714c00 100644 --- a/dll/win32/msctf/msctf.spec +++ b/dll/win32/msctf/msctf.spec @@ -8,9 +8,9 @@ @ stub TF_CUASAppFix @ stub TF_CheckThreadInputIdle @ stub TF_ClearLangBarAddIns -@ stub TF_CreateCategoryMgr +@ stdcall -stub TF_CreateCategoryMgr(ptr) @ stdcall -stub TF_CreateCicLoadMutex(ptr) -@ stub TF_CreateDisplayAttributeMgr +@ stdcall -stub TF_CreateDisplayAttributeMgr(ptr) @ stdcall TF_CreateInputProcessorProfiles(ptr) @ stdcall TF_CreateLangBarItemMgr(ptr) @ stdcall TF_CreateLangBarMgr(ptr) diff --git a/dll/win32/msutb/CMakeLists.txt b/dll/win32/msutb/CMakeLists.txt new file mode 100644 index 00000000000..84760f101e8 --- /dev/null +++ b/dll/win32/msutb/CMakeLists.txt @@ -0,0 +1,19 @@ + +spec2def(msutb.dll msutb.spec ADD_IMPORTLIB) + +list(APPEND SOURCE + msutb.cpp) + +#file(GLOB msutb_rc_deps res/*.*) +#add_rc_deps(msutb.rc ${msutb_rc_deps}) + +add_library(msutb MODULE + ${SOURCE} + msutb.rc + ${CMAKE_CURRENT_BINARY_DIR}/msutb.def) +set_module_type(msutb win32dll UNICODE) +add_dependencies(msutb msctf psdk) +target_link_libraries(msutb wine uuid atl_classes) +add_importlibs(msutb user32 gdi32 advapi32 comctl32 msvcrt kernel32 ntdll) +add_delay_importlibs(msutb msctf ole32 oleaut32) +add_cd_file(TARGET msutb DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/msutb/lang/en-US.rc b/dll/win32/msutb/lang/en-US.rc new file mode 100644 index 00000000000..646ca61f2c1 --- /dev/null +++ b/dll/win32/msutb/lang/en-US.rc @@ -0,0 +1,19 @@ +/* + * PROJECT: ReactOS msutb.dll + * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) + * PURPOSE: English (United States) resource file + * TRANSLATOR: Copyright 2023 Katayama Hirofumi MZ + */ + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +STRINGTABLE +BEGIN + IDS_OK "OK" + IDS_CANCEL "Cancel" + IDS_ABORT "&Abort" + IDS_RETRY "&Retry" + IDS_IGNORE "&Ignore" + IDS_YES "&Yes" + IDS_NO "&No" +END diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp new file mode 100644 index 00000000000..29ecbe7d330 --- /dev/null +++ b/dll/win32/msutb/msutb.cpp @@ -0,0 +1,221 @@ +/* + * PROJECT: ReactOS msutb.dll + * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) + * PURPOSE: Language Bar (Tipbar) + * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ + */ + +#include "precomp.h" + +WINE_DEFAULT_DEBUG_CHANNEL(msutb); + +HINSTANCE g_hInst = NULL; +UINT g_wmTaskbarCreated = 0; +UINT g_uACP = CP_ACP; +DWORD g_dwOSInfo = 0; +CRITICAL_SECTION g_cs; + +EXTERN_C void __cxa_pure_virtual(void) +{ + ERR("__cxa_pure_virtual\n"); +} + +class CMsUtbModule : public CComModule +{ +}; + +BEGIN_OBJECT_MAP(ObjectMap) + //OBJECT_ENTRY(CLSID_MSUTBDeskBand, CDeskBand) // FIXME: Implement this +END_OBJECT_MAP() + +CMsUtbModule gModule; + +/*********************************************************************** + * GetLibTls (MSUTB.@) + * + * @unimplemented + */ +EXTERN_C LPVOID WINAPI +GetLibTls(VOID) +{ + FIXME("stub:()\n"); + return NULL; +} + +/*********************************************************************** + * GetPopupTipbar (MSUTB.@) + * + * @unimplemented + */ +EXTERN_C BOOL WINAPI +GetPopupTipbar(HWND hWnd, BOOL fWinLogon) +{ + FIXME("stub:(%p, %d)\n", hWnd, fWinLogon); + return FALSE; +} + +/*********************************************************************** + * SetRegisterLangBand (MSUTB.@) + * + * @unimplemented + */ +EXTERN_C HRESULT WINAPI +SetRegisterLangBand(BOOL bRegister) +{ + FIXME("stub:(%d)\n", bRegister); + return E_NOTIMPL; +} + +/*********************************************************************** + * ClosePopupTipbar (MSUTB.@) + * + * @unimplemented + */ +EXTERN_C VOID WINAPI +ClosePopupTipbar(VOID) +{ + FIXME("stub:()\n"); +} + +/*********************************************************************** + * DllRegisterServer (MSUTB.@) + * + * @implemented + */ +STDAPI DllRegisterServer(VOID) +{ + TRACE("()\n"); + return gModule.DllRegisterServer(FALSE); +} + +/*********************************************************************** + * DllUnregisterServer (MSUTB.@) + * + * @implemented + */ +STDAPI DllUnregisterServer(VOID) +{ + TRACE("()\n"); + return gModule.DllUnregisterServer(FALSE); +} + +/*********************************************************************** + * DllCanUnloadNow (MSUTB.@) + * + * @implemented + */ +STDAPI DllCanUnloadNow(VOID) +{ + TRACE("()\n"); + return gModule.DllCanUnloadNow(); +} + +/*********************************************************************** + * DllGetClassObject (MSUTB.@) + * + * @implemented + */ +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) +{ + TRACE("()\n"); + return gModule.DllGetClassObject(rclsid, riid, ppv); +} + +/** + * @unimplemented + */ +VOID InitUIFLib(VOID) +{ + //FIXME +} + +/** + * @unimplemented + */ +VOID DoneUIFLib(VOID) +{ + //FIXME +} + +/** + * @implemented + */ +HRESULT APIENTRY +MsUtbCoCreateInstance( + REFCLSID rclsid, + LPUNKNOWN pUnkOuter, + DWORD dwClsContext, + REFIID iid, + LPVOID *ppv) +{ + if (IsEqualCLSID(rclsid, CLSID_TF_CategoryMgr)) + return TF_CreateCategoryMgr((ITfCategoryMgr**)ppv); + if (IsEqualCLSID(rclsid, CLSID_TF_DisplayAttributeMgr)) + return TF_CreateDisplayAttributeMgr((ITfDisplayAttributeMgr **)ppv); + return cicRealCoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv); +} + +/** + * @unimplemented + */ +BOOL ProcessAttach(HINSTANCE hinstDLL) +{ + ::InitializeCriticalSectionAndSpinCount(&g_cs, 0); + + g_hInst = hinstDLL; + + cicGetOSInfo(&g_uACP, &g_dwOSInfo); + + TFInitLib(MsUtbCoCreateInstance); + InitUIFLib(); + + //CTrayIconWnd::RegisterClassW(); //FIXME + + g_wmTaskbarCreated = RegisterWindowMessageW(L"TaskbarCreated"); + + gModule.Init(ObjectMap, hinstDLL, NULL); + ::DisableThreadLibraryCalls(hinstDLL); + + return TRUE; +} + +/** + * @implemented + */ +VOID ProcessDetach(HINSTANCE hinstDLL) +{ + DoneUIFLib(); + TFUninitLib(); + ::DeleteCriticalSection(&g_cs); + gModule.Term(); +} + +/** + * @implemented + */ +EXTERN_C BOOL WINAPI +DllMain( + _In_ HINSTANCE hinstDLL, + _In_ DWORD dwReason, + _Inout_opt_ LPVOID lpvReserved) +{ + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + { + TRACE("(%p, %lu, %p)\n", hinstDLL, dwReason, lpvReserved); + if (!ProcessAttach(hinstDLL)) + { + ProcessDetach(hinstDLL); + return FALSE; + } + break; + } + case DLL_PROCESS_DETACH: + { + ProcessDetach(hinstDLL); + break; + } + } + return TRUE; +} diff --git a/dll/win32/msutb/msutb.rc b/dll/win32/msutb/msutb.rc new file mode 100644 index 00000000000..21964d264da --- /dev/null +++ b/dll/win32/msutb/msutb.rc @@ -0,0 +1,28 @@ +/* + * PROJECT: ReactOS msutb.dll + * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) + * PURPOSE: Resource of msutb.dll + * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ + */ + +#include +#include + +#include "resource.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS msutb.dll" +#define REACTOS_STR_INTERNAL_NAME "msutb" +#define REACTOS_STR_ORIGINAL_FILENAME "msutb.dll" +#include + +#include + +/* UTF-8 */ +#pragma code_page(65001) + +#ifdef LANGUAGE_EN_US + #include "lang/en-US.rc" +#endif diff --git a/dll/win32/msutb/msutb.spec b/dll/win32/msutb/msutb.spec new file mode 100644 index 00000000000..15794440f7a --- /dev/null +++ b/dll/win32/msutb/msutb.spec @@ -0,0 +1,8 @@ +@ stdcall ClosePopupTipbar() +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() +@ stdcall GetLibTls() +@ stdcall GetPopupTipbar(ptr long) +@ stdcall SetRegisterLangBand(long) diff --git a/dll/win32/msutb/precomp.h b/dll/win32/msutb/precomp.h new file mode 100644 index 00000000000..0a77ed7f3ef --- /dev/null +++ b/dll/win32/msutb/precomp.h @@ -0,0 +1,31 @@ +/* + * PROJECT: ReactOS msutb.dll + * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) + * PURPOSE: Language Bar (Tipbar) + * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ + */ + +#pragma once + +#include + +#define WIN32_NO_STATUS +#define COBJMACROS +#define INITGUID + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#undef STATUS_NO_MEMORY +#include + +#include + +#include "resource.h" diff --git a/dll/win32/msutb/resource.h b/dll/win32/msutb/resource.h new file mode 100644 index 00000000000..c91662cb293 --- /dev/null +++ b/dll/win32/msutb/resource.h @@ -0,0 +1,9 @@ +#pragma once + +#define IDS_OK 100 +#define IDS_CANCEL 101 +#define IDS_ABORT 102 +#define IDS_RETRY 103 +#define IDS_IGNORE 104 +#define IDS_YES 105 +#define IDS_NO 106 diff --git a/sdk/include/psdk/msctf.idl b/sdk/include/psdk/msctf.idl index 2cbb888f3d3..e3d642c651c 100644 --- a/sdk/include/psdk/msctf.idl +++ b/sdk/include/psdk/msctf.idl @@ -41,6 +41,8 @@ cpp_quote("EXTERN_C HANDLE WINAPI TF_CreateCicLoadMutex(_Out_ LPBOOL pfWinLogon cpp_quote("EXTERN_C HRESULT WINAPI TF_InvalidAssemblyListCache(VOID);") cpp_quote("EXTERN_C HRESULT WINAPI TF_InvalidAssemblyListCacheIfExist(VOID);") cpp_quote("EXTERN_C HRESULT WINAPI TF_DllDetachInOther(VOID);") +cpp_quote("EXTERN_C HRESULT WINAPI TF_CreateCategoryMgr(ITfCategoryMgr **ppcat);") +cpp_quote("EXTERN_C HRESULT WINAPI TF_CreateDisplayAttributeMgr(ITfDisplayAttributeMgr **ppdam);") cpp_quote("EXTERN_C const GUID GUID_PROP_TEXTOWNER;") cpp_quote("EXTERN_C const GUID GUID_PROP_ATTRIBUTE;") diff --git a/sdk/include/reactos/cicero/cicutb.h b/sdk/include/reactos/cicero/cicutb.h new file mode 100644 index 00000000000..1865cbdaf7c --- /dev/null +++ b/sdk/include/reactos/cicero/cicutb.h @@ -0,0 +1,13 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) + * PURPOSE: Private header for msutb.dll + * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ + */ + +#pragma once + +EXTERN_C LPVOID WINAPI GetLibTls(VOID); +EXTERN_C BOOL WINAPI GetPopupTipbar(HWND hWnd, BOOL fWinLogon); +EXTERN_C HRESULT WINAPI SetRegisterLangBand(BOOL bRegister); +EXTERN_C VOID WINAPI ClosePopupTipbar(VOID);