[CTFMON][MSCTFIME][MSCTF][MSUTB][SDK] Cicero is ANSI, not Unicode (#6230)

Cicero interface is not Unicode (W)
but ANSI (A).
- ctfmon.exe is ANSI, not Unicode.
- msutb.dll is ANSI, not Unicode.
- Apply generic text mapping to the
  cicero headers.
- Include <tchar.h> to use generic
  text mapping.
CORE-19361, CORE-19362, CORE-19363
This commit is contained in:
Katayama Hirofumi MZ 2023-12-26 12:07:01 +09:00 committed by GitHub
parent a8a4703699
commit bfa3e554d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 197 additions and 156 deletions

View file

@ -17,6 +17,7 @@
#include <imm.h>
#include <ddk/immdev.h>
#include <cguid.h>
#include <tchar.h>
#include <msctf.h>
#include <ctffunc.h>
#include <shlwapi.h>
@ -28,6 +29,23 @@
WINE_DEFAULT_DEBUG_CHANNEL(msctf);
BOOL StringFromGUID2A(REFGUID rguid, LPSTR pszGUID, INT cchGUID)
{
pszGUID[0] = ANSI_NULL;
WCHAR szWide[40];
szWide[0] = UNICODE_NULL;
BOOL ret = StringFromGUID2(rguid, szWide, _countof(szWide));
::WideCharToMultiByte(CP_ACP, 0, szWide, -1, pszGUID, cchGUID, NULL, NULL);
return ret;
}
#ifdef UNICODE
#define StringFromGUID2T StringFromGUID2
#else
#define StringFromGUID2T StringFromGUID2A
#endif
/***********************************************************************
* TF_RegisterLangBarAddIn (MSCTF.@)
*
@ -47,19 +65,19 @@ TF_RegisterLangBarAddIn(
return E_INVALIDARG;
}
WCHAR szBuff[MAX_PATH], szGUID[40];
StringCchCopyW(szBuff, _countof(szBuff), L"SOFTWARE\\Microsoft\\CTF\\LangBarAddIn\\");
StringFromGUID2(rguid, szGUID, _countof(szGUID));
StringCchCatW(szBuff, _countof(szBuff), szGUID);
TCHAR szBuff[MAX_PATH], szGUID[40];
StringCchCopy(szBuff, _countof(szBuff), TEXT("SOFTWARE\\Microsoft\\CTF\\LangBarAddIn\\"));
StringFromGUID2T(rguid, szGUID, _countof(szGUID));
StringCchCat(szBuff, _countof(szBuff), szGUID);
CicRegKey regKey;
HKEY hBaseKey = ((dwFlags & 1) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER);
LSTATUS error = regKey.Create(hBaseKey, szBuff);
if (error == ERROR_SUCCESS)
{
error = regKey.SetSz(L"FilePath", pszFilePath);
error = regKey.SetSzW(L"FilePath", pszFilePath);
if (error == ERROR_SUCCESS)
error = regKey.SetDword(L"Enable", !!(dwFlags & 4));
error = regKey.SetDword(TEXT("Enable"), !!(dwFlags & 4));
}
return ((error == ERROR_SUCCESS) ? S_OK : E_FAIL);
@ -83,8 +101,8 @@ TF_UnregisterLangBarAddIn(
return E_INVALIDARG;
}
WCHAR szSubKey[MAX_PATH];
StringCchCopyW(szSubKey, _countof(szSubKey), L"SOFTWARE\\Microsoft\\CTF\\LangBarAddIn\\");
TCHAR szSubKey[MAX_PATH];
StringCchCopy(szSubKey, _countof(szSubKey), TEXT("SOFTWARE\\Microsoft\\CTF\\LangBarAddIn\\"));
CicRegKey regKey;
HKEY hBaseKey = ((dwFlags & 1) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER);
@ -92,8 +110,8 @@ TF_UnregisterLangBarAddIn(
HRESULT hr = E_FAIL;
if (error == ERROR_SUCCESS)
{
WCHAR szGUID[40];
StringFromGUID2(rguid, szGUID, _countof(szGUID));
TCHAR szGUID[40];
StringFromGUID2T(rguid, szGUID, _countof(szGUID));
regKey.RecurseDeleteKey(szGUID);
hr = S_OK;
}