Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
63e8517a
Commit
63e8517a
authored
Dec 17, 2001
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed no longer used thunking and callout functions.
parent
88ff58ee
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 addition
and
207 deletions
+1
-207
.cvsignore
if1632/.cvsignore
+0
-1
Makefile.in
if1632/Makefile.in
+1
-4
thunk.c
if1632/thunk.c
+0
-152
callback.h
include/callback.h
+0
-50
No files found.
if1632/.cvsignore
View file @
63e8517a
Makefile
relay16.s
thunk.glue.c
if1632/Makefile.in
View file @
63e8517a
...
...
@@ -8,14 +8,11 @@ MODULE = if1632
C_SRCS
=
\
builtin.c
\
relay.c
\
snoop.c
\
thunk.c
snoop.c
GEN_ASM_SRCS
=
\
relay16.s
GLUE
=
thunk.c
all
:
$(MODULE).o
@MAKE_RULES@
...
...
if1632/thunk.c
deleted
100644 → 0
View file @
88ff58ee
/*
* Emulator thunks
*
* Copyright 1996, 1997 Alexandre Julliard
* Copyright 1998 Ulrich Weigand
*/
#include <string.h>
#include "wine/winbase16.h"
#include "callback.h"
#include "builtin16.h"
#include "module.h"
#include "stackframe.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL
(
thunk
);
/* List of the 16-bit callback functions. This list is used */
/* by the build program to generate the file if1632/callto16.S */
/* ### start build ### */
extern
WORD
CALLBACK
THUNK_CallTo16_word_lllw
(
FARPROC16
,
LONG
,
LONG
,
LONG
,
WORD
);
extern
WORD
CALLBACK
THUNK_CallTo16_word_ww
(
FARPROC16
,
WORD
,
WORD
);
/* ### stop build ### */
static
THUNK
*
firstThunk
=
NULL
;
CALLOUT_TABLE
Callout
=
{
/* UserSignalProc */
NULL
,
/* DestroyIcon32 */
NULL
};
/***********************************************************************
* THUNK_Alloc
*/
FARPROC
THUNK_Alloc
(
FARPROC16
func
,
RELAY
relay
)
{
HANDLE16
hSeg
;
NE_MODULE
*
pModule
;
THUNK
*
thunk
;
/* NULL maps to NULL */
if
(
!
func
)
return
NULL
;
/*
* If we got an 16-bit built-in API entry point, retrieve the Wine
* 32-bit handler for that API routine.
*
* NOTE: For efficiency reasons, we only check whether the selector
* of 'func' points to the code segment of a built-in module.
* It might be theoretically possible that the offset is such
* that 'func' does not point, in fact, to an API entry point.
* In this case, however, the pointer is corrupt anyway.
*/
hSeg
=
GlobalHandle16
(
SELECTOROF
(
func
)
);
pModule
=
NE_GetPtr
(
FarGetOwner16
(
hSeg
)
);
if
(
pModule
&&
(
pModule
->
flags
&
NE_FFLAGS_BUILTIN
)
&&
NE_SEG_TABLE
(
pModule
)[
0
].
hSeg
==
hSeg
)
{
FARPROC
proc
=
(
FARPROC
)((
ENTRYPOINT16
*
)
MapSL
(
(
SEGPTR
)
func
))
->
target
;
TRACE
(
"(%04x:%04x, %p) -> built-in API %p
\n
"
,
SELECTOROF
(
func
),
OFFSETOF
(
func
),
relay
,
proc
);
return
proc
;
}
/* Otherwise, we need to alloc a thunk */
thunk
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
thunk
)
);
if
(
thunk
)
{
thunk
->
popl_eax
=
0x58
;
thunk
->
pushl_func
=
0x68
;
thunk
->
proc
=
func
;
thunk
->
pushl_eax
=
0x50
;
thunk
->
jmp
=
0xe9
;
thunk
->
relay
=
(
RELAY
)((
char
*
)
relay
-
(
char
*
)(
&
thunk
->
next
));
thunk
->
magic
=
CALLTO16_THUNK_MAGIC
;
thunk
->
next
=
firstThunk
;
firstThunk
=
thunk
;
}
TRACE
(
"(%04x:%04x, %p) -> allocated thunk %p
\n
"
,
SELECTOROF
(
func
),
OFFSETOF
(
func
),
relay
,
thunk
);
return
(
FARPROC
)
thunk
;
}
/***********************************************************************
* THUNK_Free
*/
void
THUNK_Free
(
FARPROC
thunk
)
{
THUNK
*
t
=
(
THUNK
*
)
thunk
;
if
(
!
t
||
IsBadReadPtr
(
t
,
sizeof
(
*
t
)
)
||
t
->
magic
!=
CALLTO16_THUNK_MAGIC
)
return
;
if
(
HeapValidate
(
GetProcessHeap
(),
0
,
t
))
{
THUNK
**
prev
=
&
firstThunk
;
while
(
*
prev
&&
(
*
prev
!=
t
))
prev
=
&
(
*
prev
)
->
next
;
if
(
*
prev
)
{
*
prev
=
t
->
next
;
HeapFree
(
GetProcessHeap
(),
0
,
t
);
return
;
}
}
ERR
(
"invalid thunk addr %p
\n
"
,
thunk
);
return
;
}
/***********************************************************************
* THUNK_GetCalloutThunk
*
* Retrieve API entry point with given name from given module.
* If module is builtin, return the 32-bit entry point, otherwise
* create a 32->16 thunk to the 16-bit entry point, using the
* given relay code.
*
*/
static
FARPROC
THUNK_GetCalloutThunk
(
NE_MODULE
*
pModule
,
LPSTR
name
,
RELAY
relay
)
{
FARPROC16
proc
=
GetProcAddress16
(
pModule
->
self
,
name
);
if
(
!
proc
)
return
0
;
if
(
pModule
->
flags
&
NE_FFLAGS_BUILTIN
)
return
(
FARPROC
)((
ENTRYPOINT16
*
)
MapSL
(
(
SEGPTR
)
proc
))
->
target
;
else
return
(
FARPROC
)
THUNK_Alloc
(
proc
,
relay
);
}
/***********************************************************************
* THUNK_InitCallout
*/
void
THUNK_InitCallout
(
void
)
{
NE_MODULE
*
pModule
=
NE_GetPtr
(
GetModuleHandle16
(
"USER.EXE"
)
);
if
(
pModule
)
{
#define GETADDR( var, name, thk ) \
*(FARPROC *)&Callout.var = THUNK_GetCalloutThunk( pModule, name, \
(RELAY)THUNK_CallTo16_##thk )
GETADDR
(
DestroyIcon32
,
"DestroyIcon32"
,
word_ww
);
GETADDR
(
UserSignalProc
,
"SignalProc32"
,
word_lllw
);
#undef GETADDR
}
else
WARN
(
"no 16-bit USER
\n
"
);
}
include/callback.h
View file @
63e8517a
...
...
@@ -9,26 +9,6 @@
#include "windef.h"
#include "winnt.h"
#include "wingdi.h"
#include "wine/winuser16.h"
extern
void
SYSDEPS_SwitchToThreadStack
(
void
(
*
func
)(
void
)
)
WINE_NORETURN
;
typedef
void
(
*
RELAY
)();
extern
FARPROC
THUNK_Alloc
(
FARPROC16
func
,
RELAY
relay
);
extern
void
THUNK_Free
(
FARPROC
thunk
);
extern
BOOL
THUNK_Init
(
void
);
extern
void
THUNK_InitCallout
(
void
);
typedef
struct
{
WORD
WINAPI
(
*
UserSignalProc
)(
UINT
,
DWORD
,
DWORD
,
HMODULE16
);
WORD
WINAPI
(
*
DestroyIcon32
)(
HGLOBAL16
,
UINT16
);
}
CALLOUT_TABLE
;
extern
CALLOUT_TABLE
Callout
;
typedef
struct
{
void
WINAPI
(
*
LoadDosExe
)(
LPCSTR
filename
,
HANDLE
hFile
);
...
...
@@ -49,34 +29,4 @@ typedef struct {
extern
DOSVM_TABLE
Dosvm
;
#include "pshpack1.h"
typedef
struct
tagTHUNK
{
BYTE
popl_eax
;
/* 0x58 popl %eax (return address)*/
BYTE
pushl_func
;
/* 0x68 pushl $proc */
FARPROC16
proc
WINE_PACKED
;
BYTE
pushl_eax
;
/* 0x50 pushl %eax */
BYTE
jmp
;
/* 0xe9 jmp relay (relative jump)*/
RELAY
relay
WINE_PACKED
;
struct
tagTHUNK
*
next
WINE_PACKED
;
DWORD
magic
;
}
THUNK
;
#include "poppack.h"
#define CALLTO16_THUNK_MAGIC 0x54484e4b
/* "THNK" */
#define DECL_THUNK(aname,aproc,arelay) \
THUNK aname; \
aname.popl_eax = 0x58; \
aname.pushl_func = 0x68; \
aname.proc = (FARPROC16) (aproc); \
aname.pushl_eax = 0x50; \
aname.jmp = 0xe9; \
aname.relay = (RELAY)((char *)(arelay) - (char *)(&(aname).next)); \
aname.next = NULL; \
aname.magic = CALLTO16_THUNK_MAGIC;
#endif
/* __WINE_CALLBACK_H */
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