Michael Stefaniuc : imm32: Use wide-char string literals.
Alexandre Julliard
julliard at winehq.org
Fri Nov 20 14:54:31 CST 2020
Module: wine
Branch: master
Commit: e7d088a6295f894fedb43cf9f748e9473f49f102
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e7d088a6295f894fedb43cf9f748e9473f49f102
Author: Michael Stefaniuc <mstefani at winehq.org>
Date: Thu Nov 19 23:03:03 2020 +0100
imm32: Use wide-char string literals.
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/imm32/imm.c | 45 +++++++++++++++------------------------------
dlls/imm32/tests/imm32.c | 10 +++-------
2 files changed, 18 insertions(+), 37 deletions(-)
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
index 0f3d7d5f8c8..9d2a09f22be 100644
--- a/dlls/imm32/imm.c
+++ b/dlls/imm32/imm.c
@@ -99,14 +99,8 @@ typedef struct _tagIMMThreadData {
static struct list ImmHklList = LIST_INIT(ImmHklList);
static struct list ImmThreadDataList = LIST_INIT(ImmThreadDataList);
-static const WCHAR szwWineIMCProperty[] = {'W','i','n','e','I','m','m','H','I','M','C','P','r','o','p','e','r','t','y',0};
-
-static const WCHAR szImeFileW[] = {'I','m','e',' ','F','i','l','e',0};
-static const WCHAR szLayoutTextW[] = {'L','a','y','o','u','t',' ','T','e','x','t',0};
-static const WCHAR szImeRegFmt[] = {'S','y','s','t','e','m','\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\','C','o','n','t','r','o','l','\\','K','e','y','b','o','a','r','d',' ','L','a','y','o','u','t','s','\\','%','0','8','l','x',0};
-
-static const WCHAR szwIME[] = {'I','M','E',0};
-static const WCHAR szwDefaultIME[] = {'D','e','f','a','u','l','t',' ','I','M','E',0};
+static const WCHAR szwWineIMCProperty[] = L"WineImmHIMCProperty";
+static const WCHAR szImeRegFmt[] = L"System\\CurrentControlSet\\Control\\Keyboard Layouts\\%08lx";
static CRITICAL_SECTION threaddata_cs;
static CRITICAL_SECTION_DEBUG critsect_debug =
@@ -297,23 +291,15 @@ static void IMM_FreeThreadData(void)
static HMODULE load_graphics_driver(void)
{
- static const WCHAR display_device_guid_propW[] = {
- '_','_','w','i','n','e','_','d','i','s','p','l','a','y','_',
- 'd','e','v','i','c','e','_','g','u','i','d',0 };
- static const WCHAR key_pathW[] = {
- 'S','y','s','t','e','m','\\',
- 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
- 'C','o','n','t','r','o','l','\\',
- 'V','i','d','e','o','\\','{',0};
- static const WCHAR displayW[] = {'}','\\','0','0','0','0',0};
- static const WCHAR driverW[] = {'G','r','a','p','h','i','c','s','D','r','i','v','e','r',0};
+ static const WCHAR key_pathW[] = L"System\\CurrentControlSet\\Control\\Video\\{";
+ static const WCHAR displayW[] = L"}\\0000";
HMODULE ret = 0;
HKEY hkey;
DWORD size;
WCHAR path[MAX_PATH];
WCHAR key[ARRAY_SIZE( key_pathW ) + ARRAY_SIZE( displayW ) + 40];
- UINT guid_atom = HandleToULong( GetPropW( GetDesktopWindow(), display_device_guid_propW ));
+ UINT guid_atom = HandleToULong( GetPropW( GetDesktopWindow(), L"__wine_display_device_guid" ));
if (!guid_atom) return 0;
memcpy( key, key_pathW, sizeof(key_pathW) );
@@ -321,7 +307,8 @@ static HMODULE load_graphics_driver(void)
lstrcatW( key, displayW );
if (RegOpenKeyW( HKEY_LOCAL_MACHINE, key, &hkey )) return 0;
size = sizeof(path);
- if (!RegQueryValueExW( hkey, driverW, NULL, NULL, (BYTE *)path, &size )) ret = LoadLibraryW( path );
+ if (!RegQueryValueExW( hkey, L"GraphicsDriver", NULL, NULL, (BYTE *)path, &size ))
+ ret = LoadLibraryW( path );
RegCloseKey( hkey );
TRACE( "%s %p\n", debugstr_w(path), ret );
return ret;
@@ -1642,7 +1629,7 @@ static BOOL needs_ime_window(HWND hwnd)
{
WCHAR classW[8];
- if (GetClassNameW(hwnd, classW, ARRAY_SIZE(classW)) && !lstrcmpW(classW, szwIME))
+ if (GetClassNameW(hwnd, classW, ARRAY_SIZE(classW)) && !lstrcmpW(classW, L"IME"))
return FALSE;
if (GetClassLongPtrW(hwnd, GCL_STYLE) & CS_IME) return FALSE;
@@ -1680,7 +1667,7 @@ BOOL WINAPI __wine_register_window(HWND hwnd)
{
/* Do not create the window inside of a critical section */
LeaveCriticalSection(&threaddata_cs);
- new = CreateWindowExW( 0, szwIME, szwDefaultIME,
+ new = CreateWindowExW( 0, L"IME", L"Default IME",
WS_POPUP | WS_DISABLED | WS_CLIPSIBLINGS,
0, 0, 1, 1, 0, 0, 0, 0);
/* thread_data is in the current thread so we can assume it's still valid */
@@ -1785,13 +1772,11 @@ UINT WINAPI ImmGetDescriptionA(
*/
UINT WINAPI ImmGetDescriptionW(HKL hKL, LPWSTR lpszDescription, UINT uBufLen)
{
- static const WCHAR name[] = { 'W','i','n','e',' ','X','I','M',0 };
-
FIXME("(%p, %p, %d): semi stub\n", hKL, lpszDescription, uBufLen);
if (!hKL) return 0;
- if (!uBufLen) return lstrlenW( name );
- lstrcpynW( lpszDescription, name, uBufLen );
+ if (!uBufLen) return lstrlenW(L"Wine XIM" );
+ lstrcpynW( lpszDescription, L"Wine XIM", uBufLen );
return lstrlenW( lpszDescription );
}
@@ -1872,7 +1857,7 @@ UINT WINAPI ImmGetIMEFileNameW(HKL hKL, LPWSTR lpszFileName, UINT uBufLen)
}
length = 0;
- rc = RegGetValueW(hkey, NULL, szImeFileW, RRF_RT_REG_SZ, NULL, NULL, &length);
+ rc = RegGetValueW(hkey, NULL, L"Ime File", RRF_RT_REG_SZ, NULL, NULL, &length);
if (rc != ERROR_SUCCESS)
{
@@ -1892,7 +1877,7 @@ UINT WINAPI ImmGetIMEFileNameW(HKL hKL, LPWSTR lpszFileName, UINT uBufLen)
return length / sizeof(WCHAR);
}
- RegGetValueW(hkey, NULL, szImeFileW, RRF_RT_REG_SZ, NULL, lpszFileName, &length);
+ RegGetValueW(hkey, NULL, L"Ime File", RRF_RT_REG_SZ, NULL, lpszFileName, &length);
RegCloseKey(hkey);
@@ -2111,10 +2096,10 @@ HKL WINAPI ImmInstallIMEW(
if (rc == ERROR_SUCCESS)
{
- rc = RegSetValueExW(hkey, szImeFileW, 0, REG_SZ, (const BYTE*)lpszIMEFileName,
+ rc = RegSetValueExW(hkey, L"Ime File", 0, REG_SZ, (const BYTE*)lpszIMEFileName,
(lstrlenW(lpszIMEFileName) + 1) * sizeof(WCHAR));
if (rc == ERROR_SUCCESS)
- rc = RegSetValueExW(hkey, szLayoutTextW, 0, REG_SZ, (const BYTE*)lpszLayoutText,
+ rc = RegSetValueExW(hkey, L"Layout Text", 0, REG_SZ, (const BYTE*)lpszLayoutText,
(lstrlenW(lpszLayoutText) + 1) * sizeof(WCHAR));
RegCloseKey(hkey);
return hkl;
diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c
index 827b31eec2e..cc9e0e8c01f 100644
--- a/dlls/imm32/tests/imm32.c
+++ b/dlls/imm32/tests/imm32.c
@@ -1099,10 +1099,9 @@ static void test_ImmDefaultHwnd(void)
static BOOL CALLBACK is_ime_window_proc(HWND hWnd, LPARAM param)
{
- static const WCHAR imeW[] = {'I','M','E',0};
WCHAR class_nameW[16];
HWND *ime_window = (HWND *)param;
- if (GetClassNameW(hWnd, class_nameW, ARRAY_SIZE(class_nameW)) && !lstrcmpW(class_nameW, imeW))
+ if (GetClassNameW(hWnd, class_nameW, ARRAY_SIZE(class_nameW)) && !lstrcmpW(class_nameW, L"IME"))
{
*ime_window = hWnd;
return FALSE;
@@ -1562,9 +1561,6 @@ static LRESULT CALLBACK processkey_wnd_proc( HWND hWnd, UINT msg, WPARAM wParam,
static void test_ime_processkey(void)
{
- WCHAR classNameW[] = {'P','r','o','c','e','s','s', 'K','e','y','T','e','s','t','C','l','a','s','s',0};
- WCHAR windowNameW[] = {'P','r','o','c','e','s','s', 'K','e','y',0};
-
MSG msg;
WNDCLASSW wclass;
HANDLE hInstance = GetModuleHandleW(NULL);
@@ -1573,7 +1569,7 @@ static void test_ime_processkey(void)
INT rc;
HWND hWndTest;
- wclass.lpszClassName = classNameW;
+ wclass.lpszClassName = L"ProcessKeyTestClass";
wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = processkey_wnd_proc;
wclass.hInstance = hInstance;
@@ -1589,7 +1585,7 @@ static void test_ime_processkey(void)
}
/* create the test window that will receive the keystrokes */
- hWndTest = CreateWindowW(wclass.lpszClassName, windowNameW,
+ hWndTest = CreateWindowW(wclass.lpszClassName, L"ProcessKey",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, 100, 100,
NULL, NULL, hInstance, NULL);
More information about the wine-cvs
mailing list