Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
e7d088a6
Commit
e7d088a6
authored
Nov 19, 2020
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Nov 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imm32: Use wide-char string literals.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
68831826
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
37 deletions
+18
-37
imm.c
dlls/imm32/imm.c
+15
-30
imm32.c
dlls/imm32/tests/imm32.c
+3
-7
No files found.
dlls/imm32/imm.c
View file @
e7d088a6
...
...
@@ -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
;
...
...
dlls/imm32/tests/imm32.c
View file @
e7d088a6
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment