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
f5547635
Commit
f5547635
authored
Dec 27, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Make the relay debug code more generic to allow supporting 64-bit platforms.
parent
01722d60
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
35 deletions
+40
-35
relay.c
dlls/ntdll/relay.c
+40
-35
No files found.
dlls/ntdll/relay.c
View file @
f5547635
...
...
@@ -40,14 +40,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(relay);
#ifdef __i386__
WINE_DECLARE_DEBUG_CHANNEL
(
snoop
);
WINE_DECLARE_DEBUG_CHANNEL
(
seh
);
struct
relay_descr
/* descriptor for a module */
{
void
*
magic
;
/* signature */
void
*
relay_
from_32
;
/* functions to call from relay thunks */
void
*
relay_
from_32
_regs
;
void
*
relay_
call
;
/* functions to call from relay thunks */
void
*
relay_
call
_regs
;
void
*
private
;
/* reserved for the relay code private data */
const
char
*
entry_point_base
;
/* base address of entry point thunks */
const
unsigned
int
*
entry_point_offsets
;
/* offsets of entry points thunks */
...
...
@@ -302,25 +299,25 @@ static BOOL check_from_module( const WCHAR **includelist, const WCHAR **excludel
/***********************************************************************
* RELAY_PrintArgs
*/
static
inline
void
RELAY_PrintArgs
(
const
int
*
args
,
int
nb_args
,
unsigned
int
typemask
)
static
inline
void
RELAY_PrintArgs
(
const
INT_PTR
*
args
,
int
nb_args
,
unsigned
int
typemask
)
{
while
(
nb_args
--
)
{
if
((
typemask
&
3
)
&&
HIWORD
(
*
args
))
{
if
(
typemask
&
2
)
DPRINTF
(
"%08x %s"
,
*
args
,
debugstr_w
((
LPCWSTR
)
*
args
)
);
DPRINTF
(
"%08
l
x %s"
,
*
args
,
debugstr_w
((
LPCWSTR
)
*
args
)
);
else
DPRINTF
(
"%08x %s"
,
*
args
,
debugstr_a
((
LPCSTR
)
*
args
)
);
DPRINTF
(
"%08
l
x %s"
,
*
args
,
debugstr_a
((
LPCSTR
)
*
args
)
);
}
else
DPRINTF
(
"%08x"
,
*
args
);
else
DPRINTF
(
"%08
l
x"
,
*
args
);
if
(
nb_args
)
DPRINTF
(
","
);
args
++
;
typemask
>>=
2
;
}
}
extern
LONGLONG
call_entry_point
(
void
*
func
,
int
nb_args
,
const
int
*
args
);
extern
LONGLONG
call_entry_point
(
void
*
func
,
int
nb_args
,
const
INT_PTR
*
args
);
__ASM_GLOBAL_FUNC
(
call_entry_point
,
"
\t
pushl %ebp
\n
"
"
\t
movl %esp,%ebp
\n
"
...
...
@@ -345,11 +342,11 @@ __ASM_GLOBAL_FUNC( call_entry_point,
/***********************************************************************
* relay_call
_from_32
* relay_call
*
* stack points to the return address, i.e. the first argument is stack[1].
*/
static
LONGLONG
WINAPI
relay_call
_from_32
(
struct
relay_descr
*
descr
,
unsigned
int
idx
,
const
int
*
stack
)
static
LONGLONG
WINAPI
relay_call
(
struct
relay_descr
*
descr
,
unsigned
int
idx
,
const
INT_PTR
*
stack
)
{
LONGLONG
ret
;
WORD
ordinal
=
LOWORD
(
idx
);
...
...
@@ -367,7 +364,7 @@ static LONGLONG WINAPI relay_call_from_32( struct relay_descr *descr, unsigned i
else
DPRINTF
(
"%04x:Call %s.%u("
,
GetCurrentThreadId
(),
data
->
dllname
,
data
->
base
+
ordinal
);
RELAY_PrintArgs
(
stack
+
1
,
nb_args
,
descr
->
arg_types
[
ordinal
]
);
DPRINTF
(
") ret=%08x
\n
"
,
stack
[
0
]
);
DPRINTF
(
") ret=%08
l
x
\n
"
,
stack
[
0
]
);
ret
=
call_entry_point
(
entry_point
->
orig_func
,
nb_args
,
stack
+
1
);
...
...
@@ -377,21 +374,21 @@ static LONGLONG WINAPI relay_call_from_32( struct relay_descr *descr, unsigned i
DPRINTF
(
"%04x:Ret %s.%u()"
,
GetCurrentThreadId
(),
data
->
dllname
,
data
->
base
+
ordinal
);
if
(
flags
&
1
)
/* 64-bit return value */
DPRINTF
(
" retval=%08x%08x ret=%08x
\n
"
,
DPRINTF
(
" retval=%08x%08x ret=%08
l
x
\n
"
,
(
UINT
)(
ret
>>
32
),
(
UINT
)
ret
,
stack
[
0
]
);
else
DPRINTF
(
" retval=%08
x ret=%08x
\n
"
,
(
UINT
)
ret
,
stack
[
0
]
);
DPRINTF
(
" retval=%08
lx ret=%08lx
\n
"
,
(
UINT_PTR
)
ret
,
stack
[
0
]
);
}
return
ret
;
}
/***********************************************************************
* relay_call_
from_32_
regs
* relay_call_regs
*/
void
WINAPI
__regs_relay_call_
from_32_
regs
(
struct
relay_descr
*
descr
,
unsigned
int
idx
,
unsigned
int
orig_eax
,
unsigned
int
ret_addr
,
CONTEXT86
*
context
)
void
WINAPI
__regs_relay_call_regs
(
struct
relay_descr
*
descr
,
unsigned
int
idx
,
unsigned
int
orig_eax
,
unsigned
int
ret_addr
,
CONTEXT86
*
context
)
{
WORD
ordinal
=
LOWORD
(
idx
);
BYTE
nb_args
=
LOBYTE
(
HIWORD
(
idx
));
...
...
@@ -399,8 +396,8 @@ void WINAPI __regs_relay_call_from_32_regs( struct relay_descr *descr, unsigned
struct
relay_private_data
*
data
=
descr
->
private
;
struct
relay_entry_point
*
entry_point
=
data
->
entry_points
+
ordinal
;
BYTE
*
orig_func
=
entry_point
->
orig_func
;
int
*
args
=
(
int
*
)
context
->
Esp
;
int
args_copy
[
32
];
INT_PTR
*
args
=
(
INT_PTR
*
)
context
->
Esp
;
INT_PTR
args_copy
[
32
];
/* restore the context to what it was before the relay thunk */
context
->
Eax
=
orig_eax
;
...
...
@@ -452,8 +449,8 @@ void WINAPI __regs_relay_call_from_32_regs( struct relay_descr *descr, unsigned
context
->
SegDs
,
context
->
SegEs
,
context
->
SegFs
,
context
->
SegGs
,
context
->
EFlags
);
}
}
extern
void
WINAPI
relay_call_
from_32_
regs
(
void
);
DEFINE_REGS_ENTRYPOINT
(
relay_call_
from_32_
regs
,
16
,
16
)
extern
void
WINAPI
relay_call_regs
(
void
);
DEFINE_REGS_ENTRYPOINT
(
relay_call_regs
,
16
,
16
)
/***********************************************************************
...
...
@@ -502,8 +499,8 @@ void RELAY_SetupDLL( HMODULE module )
(
exports
->
NumberOfFunctions
-
1
)
*
sizeof
(
data
->
entry_points
)
)))
return
;
descr
->
relay_
from_32
=
relay_call_from_32
;
descr
->
relay_
from_32_regs
=
relay_call_from_32
_regs
;
descr
->
relay_
call
=
relay_call
;
descr
->
relay_
call_regs
=
relay_call
_regs
;
descr
->
private
=
data
;
data
->
module
=
module
;
...
...
@@ -538,12 +535,30 @@ void RELAY_SetupDLL( HMODULE module )
}
}
#else
/* __i386__ */
FARPROC
RELAY_GetProcAddress
(
HMODULE
module
,
const
IMAGE_EXPORT_DIRECTORY
*
exports
,
DWORD
exp_size
,
FARPROC
proc
,
DWORD
ordinal
,
const
WCHAR
*
user
)
{
return
proc
;
}
void
RELAY_SetupDLL
(
HMODULE
module
)
{
}
#endif
/* __i386__ */
/***********************************************************************/
/* snoop support */
/***********************************************************************/
#ifdef __i386__
WINE_DECLARE_DEBUG_CHANNEL
(
seh
);
WINE_DECLARE_DEBUG_CHANNEL
(
snoop
);
#include "pshpack1.h"
typedef
struct
...
...
@@ -931,22 +946,12 @@ DEFINE_REGS_ENTRYPOINT( SNOOP_Return, 0, 0 )
#else
/* __i386__ */
FARPROC
RELAY_GetProcAddress
(
HMODULE
module
,
const
IMAGE_EXPORT_DIRECTORY
*
exports
,
DWORD
exp_size
,
FARPROC
proc
,
DWORD
ordinal
,
const
WCHAR
*
user
)
{
return
proc
;
}
FARPROC
SNOOP_GetProcAddress
(
HMODULE
hmod
,
const
IMAGE_EXPORT_DIRECTORY
*
exports
,
DWORD
exp_size
,
FARPROC
origfun
,
DWORD
ordinal
,
const
WCHAR
*
user
)
{
return
origfun
;
}
void
RELAY_SetupDLL
(
HMODULE
module
)
{
}
void
SNOOP_SetupDLL
(
HMODULE
hmod
)
{
FIXME
(
"snooping works only on i386 for now.
\n
"
);
...
...
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