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
c9d1a190
Commit
c9d1a190
authored
Apr 24, 2013
by
Dan Kegel
Committed by
Alexandre Julliard
Apr 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Add assembly wrapper for calling hook procedures.
parent
c371af0d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
4 deletions
+48
-4
hook.c
dlls/user32/hook.c
+48
-4
No files found.
dlls/user32/hook.c
View file @
c9d1a190
...
...
@@ -202,6 +202,48 @@ static HHOOK set_windows_hook( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid,
return
handle
;
}
#ifdef __i386__
/* Some apps pass a non-stdcall proc to SetWindowsHookExA,
* so we need a small assembly wrapper to call the proc.
*/
extern
LRESULT
HOOKPROC_wrapper
(
HOOKPROC
proc
,
INT
code
,
WPARAM
wParam
,
LPARAM
lParam
);
__ASM_GLOBAL_FUNC
(
HOOKPROC_wrapper
,
"pushl %ebp
\n\t
"
__ASM_CFI
(
".cfi_adjust_cfa_offset 4
\n\t
"
)
__ASM_CFI
(
".cfi_rel_offset %ebp,0
\n\t
"
)
"movl %esp,%ebp
\n\t
"
__ASM_CFI
(
".cfi_def_cfa_register %ebp
\n\t
"
)
"pushl %edi
\n\t
"
__ASM_CFI
(
".cfi_rel_offset %edi,-4
\n\t
"
)
"pushl %esi
\n\t
"
__ASM_CFI
(
".cfi_rel_offset %esi,-8
\n\t
"
)
"pushl %ebx
\n\t
"
__ASM_CFI
(
".cfi_rel_offset %ebx,-12
\n\t
"
)
"pushl 20(%ebp)
\n\t
"
"pushl 16(%ebp)
\n\t
"
"pushl 12(%ebp)
\n\t
"
"movl 8(%ebp),%eax
\n\t
"
"call *%eax
\n\t
"
"leal -12(%ebp),%esp
\n\t
"
"popl %ebx
\n\t
"
__ASM_CFI
(
".cfi_same_value %ebx
\n\t
"
)
"popl %esi
\n\t
"
__ASM_CFI
(
".cfi_same_value %esi
\n\t
"
)
"popl %edi
\n\t
"
__ASM_CFI
(
".cfi_same_value %edi
\n\t
"
)
"leave
\n\t
"
__ASM_CFI
(
".cfi_def_cfa %esp,4
\n\t
"
)
__ASM_CFI
(
".cfi_same_value %ebp
\n\t
"
)
"ret"
)
#else
static
inline
LRESULT
HOOKPROC_wrapper
(
HOOKPROC
proc
,
INT
code
,
WPARAM
wParam
,
LPARAM
lParam
)
{
return
proc
(
code
,
wParam
,
lParam
);
}
#endif
/* __i386__ */
/***********************************************************************
* call_hook_AtoW
...
...
@@ -210,7 +252,8 @@ static LRESULT call_hook_AtoW( HOOKPROC proc, INT id, INT code, WPARAM wparam, L
{
LRESULT
ret
;
UNICODE_STRING
usBuffer
;
if
(
id
!=
WH_CBT
||
code
!=
HCBT_CREATEWND
)
ret
=
proc
(
code
,
wparam
,
lparam
);
if
(
id
!=
WH_CBT
||
code
!=
HCBT_CREATEWND
)
ret
=
HOOKPROC_wrapper
(
proc
,
code
,
wparam
,
lparam
);
else
{
CBT_CREATEWNDA
*
cbtcwA
=
(
CBT_CREATEWNDA
*
)
lparam
;
...
...
@@ -233,7 +276,7 @@ static LRESULT call_hook_AtoW( HOOKPROC proc, INT id, INT code, WPARAM wparam, L
RtlCreateUnicodeStringFromAsciiz
(
&
usBuffer
,
cbtcwA
->
lpcs
->
lpszClass
);
csW
.
lpszClass
=
classW
=
usBuffer
.
Buffer
;
}
ret
=
proc
(
code
,
wparam
,
(
LPARAM
)
&
cbtcwW
);
ret
=
HOOKPROC_wrapper
(
proc
,
code
,
wparam
,
(
LPARAM
)
&
cbtcwW
);
cbtcwA
->
hwndInsertAfter
=
cbtcwW
.
hwndInsertAfter
;
HeapFree
(
GetProcessHeap
(),
0
,
nameW
);
HeapFree
(
GetProcessHeap
(),
0
,
classW
);
...
...
@@ -249,7 +292,8 @@ static LRESULT call_hook_WtoA( HOOKPROC proc, INT id, INT code, WPARAM wparam, L
{
LRESULT
ret
;
if
(
id
!=
WH_CBT
||
code
!=
HCBT_CREATEWND
)
ret
=
proc
(
code
,
wparam
,
lparam
);
if
(
id
!=
WH_CBT
||
code
!=
HCBT_CREATEWND
)
ret
=
HOOKPROC_wrapper
(
proc
,
code
,
wparam
,
lparam
);
else
{
CBT_CREATEWNDW
*
cbtcwW
=
(
CBT_CREATEWNDW
*
)
lparam
;
...
...
@@ -277,7 +321,7 @@ static LRESULT call_hook_WtoA( HOOKPROC proc, INT id, INT code, WPARAM wparam, L
csA
.
lpszClass
=
classA
;
}
ret
=
proc
(
code
,
wparam
,
(
LPARAM
)
&
cbtcwA
);
ret
=
HOOKPROC_wrapper
(
proc
,
code
,
wparam
,
(
LPARAM
)
&
cbtcwA
);
cbtcwW
->
hwndInsertAfter
=
cbtcwA
.
hwndInsertAfter
;
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
HeapFree
(
GetProcessHeap
(),
0
,
classA
);
...
...
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