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
1d40658a
Commit
1d40658a
authored
Mar 11, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imm32: Use NtUserQueryInputContext to check cross-thread access.
parent
c66ea947
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
35 deletions
+11
-35
imm.c
dlls/imm32/imm.c
+11
-35
No files found.
dlls/imm32/imm.c
View file @
1d40658a
...
...
@@ -90,7 +90,6 @@ typedef struct tagInputContextData
HIMC
handle
;
DWORD
dwLock
;
INPUTCONTEXT
IMC
;
DWORD
threadID
;
struct
ime
*
ime
;
UINT
lastVK
;
...
...
@@ -682,17 +681,6 @@ static HIMCC ImmCreateBlankCompStr(void)
return
rc
;
}
static
BOOL
IMM_IsCrossThreadAccess
(
HIMC
hIMC
)
{
InputContextData
*
data
;
data
=
get_imc_data
(
hIMC
);
if
(
data
&&
data
->
threadID
!=
GetCurrentThreadId
())
return
TRUE
;
return
FALSE
;
}
/***********************************************************************
* ImmSetActiveContext (IMM32.@)
*/
...
...
@@ -898,7 +886,6 @@ static InputContextData *create_input_context(HIMC default_imc)
IMM_DestroyContext
(
new_context
);
return
0
;
}
new_context
->
threadID
=
GetCurrentThreadId
();
SendMessageW
(
GetFocus
(),
WM_IME_SELECT
,
TRUE
,
(
LPARAM
)
new_context
->
ime
);
TRACE
(
"Created context %p
\n
"
,
new_context
);
...
...
@@ -937,10 +924,8 @@ static BOOL IMM_DestroyContext(HIMC hIMC)
BOOL
WINAPI
ImmDestroyContext
(
HIMC
hIMC
)
{
if
((
UINT_PTR
)
hIMC
==
NtUserGetThreadInfo
()
->
default_imc
)
return
FALSE
;
if
(
!
IMM_IsCrossThreadAccess
(
hIMC
))
return
IMM_DestroyContext
(
hIMC
);
else
return
FALSE
;
if
(
NtUserQueryInputContext
(
hIMC
,
NtUserInputContextThreadId
)
!=
GetCurrentThreadId
())
return
FALSE
;
return
IMM_DestroyContext
(
hIMC
);
}
/***********************************************************************
...
...
@@ -2239,8 +2224,7 @@ BOOL WINAPI ImmSetCandidateWindow(
if
(
!
data
||
!
lpCandidate
)
return
FALSE
;
if
(
IMM_IsCrossThreadAccess
(
hIMC
))
return
FALSE
;
if
(
NtUserQueryInputContext
(
hIMC
,
NtUserInputContextThreadId
)
!=
GetCurrentThreadId
())
return
FALSE
;
TRACE
(
"
\t
%lx, %lx, %s, %s
\n
"
,
lpCandidate
->
dwIndex
,
lpCandidate
->
dwStyle
,
...
...
@@ -2271,8 +2255,7 @@ BOOL WINAPI ImmSetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf)
return
FALSE
;
}
if
(
IMM_IsCrossThreadAccess
(
hIMC
))
return
FALSE
;
if
(
NtUserQueryInputContext
(
hIMC
,
NtUserInputContextThreadId
)
!=
GetCurrentThreadId
())
return
FALSE
;
memcpy
(
&
data
->
IMC
.
lfFont
.
W
,
lplf
,
sizeof
(
LOGFONTA
));
MultiByteToWideChar
(
CP_ACP
,
0
,
lplf
->
lfFaceName
,
-
1
,
data
->
IMC
.
lfFont
.
W
.
lfFaceName
,
...
...
@@ -2297,8 +2280,7 @@ BOOL WINAPI ImmSetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
return
FALSE
;
}
if
(
IMM_IsCrossThreadAccess
(
hIMC
))
return
FALSE
;
if
(
NtUserQueryInputContext
(
hIMC
,
NtUserInputContextThreadId
)
!=
GetCurrentThreadId
())
return
FALSE
;
data
->
IMC
.
lfFont
.
W
=
*
lplf
;
ImmNotifyIME
(
hIMC
,
NI_CONTEXTUPDATED
,
0
,
IMC_SETCOMPOSITIONFONT
);
...
...
@@ -2328,8 +2310,7 @@ BOOL WINAPI ImmSetCompositionStringA(
if
(
!
data
)
return
FALSE
;
if
(
IMM_IsCrossThreadAccess
(
hIMC
))
return
FALSE
;
if
(
NtUserQueryInputContext
(
hIMC
,
NtUserInputContextThreadId
)
!=
GetCurrentThreadId
())
return
FALSE
;
if
(
!
(
dwIndex
==
SCS_SETSTR
||
dwIndex
==
SCS_CHANGEATTR
||
...
...
@@ -2385,8 +2366,7 @@ BOOL WINAPI ImmSetCompositionStringW(
if
(
!
data
)
return
FALSE
;
if
(
IMM_IsCrossThreadAccess
(
hIMC
))
return
FALSE
;
if
(
NtUserQueryInputContext
(
hIMC
,
NtUserInputContextThreadId
)
!=
GetCurrentThreadId
())
return
FALSE
;
if
(
!
(
dwIndex
==
SCS_SETSTR
||
dwIndex
==
SCS_CHANGEATTR
||
...
...
@@ -2446,8 +2426,7 @@ BOOL WINAPI ImmSetCompositionWindow(
return
FALSE
;
}
if
(
IMM_IsCrossThreadAccess
(
hIMC
))
return
FALSE
;
if
(
NtUserQueryInputContext
(
hIMC
,
NtUserInputContextThreadId
)
!=
GetCurrentThreadId
())
return
FALSE
;
data
->
IMC
.
cfCompForm
=
*
lpCompForm
;
...
...
@@ -2482,8 +2461,7 @@ BOOL WINAPI ImmSetConversionStatus(
return
FALSE
;
}
if
(
IMM_IsCrossThreadAccess
(
hIMC
))
return
FALSE
;
if
(
NtUserQueryInputContext
(
hIMC
,
NtUserInputContextThreadId
)
!=
GetCurrentThreadId
())
return
FALSE
;
if
(
fdwConversion
!=
data
->
IMC
.
fdwConversion
)
{
...
...
@@ -2518,8 +2496,7 @@ BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen)
return
FALSE
;
}
if
(
IMM_IsCrossThreadAccess
(
hIMC
))
return
FALSE
;
if
(
NtUserQueryInputContext
(
hIMC
,
NtUserInputContextThreadId
)
!=
GetCurrentThreadId
())
return
FALSE
;
if
(
data
->
ime
->
ui_hwnd
==
NULL
)
{
...
...
@@ -2555,8 +2532,7 @@ BOOL WINAPI ImmSetStatusWindowPos(HIMC hIMC, LPPOINT lpptPos)
return
FALSE
;
}
if
(
IMM_IsCrossThreadAccess
(
hIMC
))
return
FALSE
;
if
(
NtUserQueryInputContext
(
hIMC
,
NtUserInputContextThreadId
)
!=
GetCurrentThreadId
())
return
FALSE
;
TRACE
(
"
\t
%s
\n
"
,
wine_dbgstr_point
(
lpptPos
));
...
...
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