Commit 3dff7bb8 authored by Ulrich Weigand's avatar Ulrich Weigand Committed by Alexandre Julliard

Modularized CallFrom/To16 routines. Adapted dependent routines,

16-bit snoop/relay debugging, and make rules.
parent 03c13bbd
......@@ -9,6 +9,8 @@
# ASM_SRCS : assembly sources (optional)
# GEN_ASM_SRCS : generated assembly sources (optional)
# RC_SRCS : resource source files (optional)
# SPEC_SRCS : interface definition files (optional)
# GLUE : C sources for which glue code needs to be generated (optional)
# EXTRA_SRCS : extra source files for make depend (optional)
# EXTRA_OBJS : extra object files (optional)
# WRCEXTRA : extra wrc flags (e.g. '-p _SysRes') (optional)
......@@ -69,12 +71,12 @@ mandir = @mandir@/man1
manext = .1
includedir = @includedir@/wine
OBJS = $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) \
$(RC_SRCS:.rc=.o) $(EXTRA_OBJS)
OBJS = $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) $(RC_SRCS:.rc=.o) \
$(SPEC_SRCS:.spec=.spec.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
# Implicit rules
.SUFFIXES: .rc .res
.SUFFIXES: .rc .res .spec .spec.c .glue.s
.c.o:
$(CC) -c $(ALLCFLAGS) -o $*.o $<
......@@ -100,6 +102,11 @@ OBJS = $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) \
.res.h:
$(WRC) $(WRCFLAGS) $(WRCEXTRA) -bnh $<
.spec.spec.c:
$(BUILD) -o $@ -spec $<
.c.glue.s:
$(BUILD) -o $@ -glue $<
# Rule to rebuild the resource compiler
......@@ -147,11 +154,15 @@ lint:
# Misc. rules
$(SPEC_SRCS:.spec=.spec.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h
$(GLUE:.c=.glue.s): $(BUILD)
depend:: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
$(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
clean::
$(RM) *.o \#*\# *~ *% .#* *.bak *.orig *.rej *.flc y.tab.c y.tab.h lex.yy.c core $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.s) $(RC_SRCS:.rc=.h) $(PROGRAMS)
$(RM) *.o \#*\# *~ *% .#* *.bak *.orig *.rej *.flc y.tab.c y.tab.h lex.yy.c core $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.s) $(RC_SRCS:.rc=.h) $(SPEC_SRCS:.spec=.spec.c) $(GLUE:.c=.glue.s) $(PROGRAMS)
dummy:
......
Makefile
avifile.s
callfrom16.s
callto16.s
comm.s
commdlg.s
compobj.s
ddeml.s
dispdib.s
display.s
gdi.s
kernel.s
keyboard.s
lzexpand.s
mmsystem.s
mouse.s
msacm.s
msvideo.s
ole2.s
ole2conv.s
ole2disp.s
ole2nls.s
ole2prox.s
ole2thk.s
olecli.s
olesvr.s
rasapi16.s
shell.s
sound.s
storage.s
stress.s
system.s
toolhelp.s
typelib.s
user.s
ver.s
w32sys.s
win32s16.s
win87em.s
winaspi.s
windebug.s
wineps.s
wing.s
winsock.s
wprocs.s
avifile.spec.c
avifile.spec.glue.s
call16.s
callfrom16.spec.c
callfrom16.spec.glue.s
callto16.spec.c
callto16.spec.glue.s
comm.spec.c
comm.spec.glue.s
commdlg.spec.c
commdlg.spec.glue.s
compobj.spec.c
compobj.spec.glue.s
ddeml.spec.c
ddeml.spec.glue.s
dispdib.spec.c
dispdib.spec.glue.s
display.spec.c
display.spec.glue.s
gdi.spec.c
gdi.spec.glue.s
kernel.spec.c
kernel.spec.glue.s
keyboard.spec.c
keyboard.spec.glue.s
lzexpand.spec.c
lzexpand.spec.glue.s
mmsystem.spec.c
mmsystem.spec.glue.s
mouse.spec.c
mouse.spec.glue.s
msacm.spec.c
msacm.spec.glue.s
msvideo.spec.c
msvideo.spec.glue.s
ole2.spec.c
ole2.spec.glue.s
ole2conv.spec.c
ole2conv.spec.glue.s
ole2disp.spec.c
ole2disp.spec.glue.s
ole2nls.spec.c
ole2nls.spec.glue.s
ole2prox.spec.c
ole2prox.spec.glue.s
ole2thk.spec.c
ole2thk.spec.glue.s
olecli.spec.c
olecli.spec.glue.s
olesvr.spec.c
olesvr.spec.glue.s
rasapi16.spec.c
rasapi16.spec.glue.s
shell.spec.c
shell.spec.glue.s
sound.spec.c
sound.spec.glue.s
storage.spec.c
storage.spec.glue.s
stress.spec.c
stress.spec.glue.s
system.spec.c
system.spec.glue.s
thunk.glue.s
toolhelp.spec.c
toolhelp.spec.glue.s
typelib.spec.c
typelib.spec.glue.s
user.spec.c
user.spec.glue.s
ver.spec.c
ver.spec.glue.s
w32sys.spec.c
w32sys.spec.glue.s
win32s16.spec.c
win32s16.spec.glue.s
win87em.spec.c
win87em.spec.glue.s
winaspi.spec.c
winaspi.spec.glue.s
windebug.spec.c
windebug.spec.glue.s
wineps.spec.c
wineps.spec.glue.s
wing.spec.c
wing.spec.glue.s
winsock.spec.c
winsock.spec.glue.s
wprocs.spec.c
wprocs.spec.glue.s
......@@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = if1632
DLLS = \
SPEC_SRCS = \
avifile.spec \
comm.spec \
commdlg.spec \
......@@ -49,8 +49,6 @@ DLLS = \
winsock.spec \
wprocs.spec
SPEC_FILES = $(DLLS:.spec=.s)
C_SRCS = \
builtin.c \
dummy.c \
......@@ -59,25 +57,16 @@ C_SRCS = \
thunk.c
GEN_ASM_SRCS = \
$(SPEC_FILES) \
callfrom16.s \
callto16.s
.SUFFIXES: .spec
call16.s
.spec.s:
$(BUILD) -o $@ -spec $<
GLUE = $(SPEC_SRCS:.spec=.spec.c) \
thunk.c
all: checkbuild $(MODULE).o
all: $(MODULE).o
@MAKE_RULES@
$(SPEC_FILES): $(BUILD)
callfrom16.s: $(SPEC_FILES)
$(BUILD) -o $@ -callfrom16 `cat $(SPEC_FILES) | grep CallFrom16_ | sed 's/.*CallFrom16_\(.*\)/\1/' | sort | uniq`
callto16.s: $(SRCDIR)/thunk.c $(BUILD)
$(BUILD) -o $@ -callto16 $(SRCDIR)/thunk.c
call16.s: $(BUILD)
$(BUILD) -o $@ -call16
### Dependencies:
......@@ -263,12 +263,11 @@ HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL force )
/***********************************************************************
* BUILTIN_GetEntryPoint16
*
* Return the ordinal and name corresponding to a CS:IP address.
* Return the ordinal, name, and type info corresponding to a CS:IP address.
* This is used only by relay debugging.
*/
LPCSTR BUILTIN_GetEntryPoint16( WORD cs, WORD ip, WORD *pOrd )
LPCSTR BUILTIN_GetEntryPoint16( WORD cs, WORD ip, LPSTR name, WORD *pOrd )
{
static char buffer[80];
WORD i, max_offset;
register BYTE *p;
NE_MODULE *pModule;
......@@ -286,7 +285,7 @@ LPCSTR BUILTIN_GetEntryPoint16( WORD cs, WORD ip, WORD *pOrd )
entry = (ET_ENTRY *)((BYTE *)bundle+6);
for (i = bundle->first + 1; i <= bundle->last; i++)
{
if ((entry->offs <= ip)
if ((entry->offs < ip)
&& (entry->segnum == 1) /* code segment ? */
&& (entry->offs >= max_offset))
{
......@@ -308,11 +307,13 @@ LPCSTR BUILTIN_GetEntryPoint16( WORD cs, WORD ip, WORD *pOrd )
if (*(WORD *)(p + *p + 1) == *pOrd) break;
}
sprintf( buffer, "%.*s.%d: %.*s",
sprintf( name, "%.*s.%d: %.*s",
*((BYTE *)pModule + pModule->name_table),
(char *)pModule + pModule->name_table + 1,
*pOrd, *p, (char *)(p + 1) );
return buffer;
/* Retrieve type info string */
return *(LPCSTR *)((LPBYTE)PTR_SEG_OFF_TO_LIN( cs, ip ) - 6) + 10;
}
......@@ -324,8 +325,9 @@ LPCSTR BUILTIN_GetEntryPoint16( WORD cs, WORD ip, WORD *pOrd )
void BUILTIN_DefaultIntHandler( CONTEXT86 *context )
{
WORD ordinal;
char name[80];
STACK16FRAME *frame = CURRENT_STACK16;
BUILTIN_GetEntryPoint16( frame->entry_cs, frame->entry_ip, &ordinal );
BUILTIN_GetEntryPoint16( frame->entry_cs, frame->entry_ip, name, &ordinal );
INT_BARF( context, ordinal - FIRST_INTERRUPT_ORDINAL );
}
......@@ -30,34 +30,27 @@ BOOL RELAY_Init(void)
/* Allocate the code selector for CallTo16 routines */
extern void CALLTO16_Start(), CALLTO16_End();
extern void CALLTO16_Ret_word(), CALLTO16_Ret_long();
extern void CALLTO16_Ret_eax();
extern void Call16_Ret_Start(), Call16_Ret_End();
extern void CallTo16_Ret();
extern void CALL32_CBClient_Ret();
extern void CALL32_CBClientEx_Ret();
extern DWORD CALLTO16_RetAddr_word;
extern DWORD CALLTO16_RetAddr_long;
extern DWORD CALLTO16_RetAddr_eax;
extern DWORD CallTo16_RetAddr;
extern DWORD CALL32_CBClient_RetAddr;
extern DWORD CALL32_CBClientEx_RetAddr;
codesel = GLOBAL_CreateBlock( GMEM_FIXED, (void *)CALLTO16_Start,
(int)CALLTO16_End - (int)CALLTO16_Start,
codesel = GLOBAL_CreateBlock( GMEM_FIXED, (void *)Call16_Ret_Start,
(int)Call16_Ret_End - (int)Call16_Ret_Start,
0, TRUE, TRUE, FALSE, NULL );
if (!codesel) return FALSE;
/* Patch the return addresses for CallTo16 routines */
CALLTO16_RetAddr_word=MAKELONG( (int)CALLTO16_Ret_word-(int)CALLTO16_Start,
codesel );
CALLTO16_RetAddr_long=MAKELONG( (int)CALLTO16_Ret_long-(int)CALLTO16_Start,
codesel );
CALLTO16_RetAddr_eax =MAKELONG( (int)CALLTO16_Ret_eax -(int)CALLTO16_Start,
codesel );
CallTo16_RetAddr =
MAKELONG( (int)CallTo16_Ret -(int)Call16_Ret_Start, codesel );
CALL32_CBClient_RetAddr =
MAKELONG( (int)CALL32_CBClient_Ret -(int)CALLTO16_Start, codesel );
MAKELONG( (int)CALL32_CBClient_Ret -(int)Call16_Ret_Start, codesel );
CALL32_CBClientEx_RetAddr =
MAKELONG( (int)CALL32_CBClientEx_Ret -(int)CALLTO16_Start, codesel );
MAKELONG( (int)CALL32_CBClientEx_Ret -(int)Call16_Ret_Start, codesel );
/* Create built-in modules */
if (!BUILTIN_Init()) return FALSE;
......@@ -73,25 +66,29 @@ extern char **debug_relay_excludelist,**debug_relay_includelist;
/***********************************************************************
* RELAY_DebugCallFrom16
*/
void RELAY_DebugCallFrom16( int func_type, char *args,
void *entry_point, CONTEXT86 *context )
void RELAY_DebugCallFrom16( CONTEXT86 *context )
{
STACK16FRAME *frame;
WORD ordinal;
char *args16;
const char *funstr;
int i;
char *args16, funstr[80];
const char *args;
int i, usecdecl, reg_func;
if (!TRACE_ON(relay)) return;
frame = CURRENT_STACK16;
funstr = BUILTIN_GetEntryPoint16(frame->entry_cs,frame->entry_ip,&ordinal);
if (!funstr) return; /* happens for the two snoop register relays */
args = BUILTIN_GetEntryPoint16(frame->entry_cs,frame->entry_ip,funstr,&ordinal);
if (!args) return; /* happens for the two snoop register relays */
if (!RELAY_ShowDebugmsgRelay(funstr)) return;
DPRINTF( "Call %s(",funstr);
VA_START16( args16 );
if (func_type & 4) /* cdecl */
usecdecl = ( *args == 'c' );
args += 2;
reg_func = ( memcmp( args, "regs_", 5 ) == 0 );
args += 5;
if (usecdecl)
{
while (*args)
{
......@@ -185,11 +182,11 @@ void RELAY_DebugCallFrom16( int func_type, char *args,
DPRINTF( ") ret=%04x:%04x ds=%04x\n", frame->cs, frame->ip, frame->ds );
VA_END16( args16 );
if (func_type & 2) /* register function */
DPRINTF( " AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), SI_reg(context), DI_reg(context),
(WORD)ES_reg(context), EFL_reg(context) );
if (reg_func)
DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), SI_reg(context), DI_reg(context),
(WORD)ES_reg(context), EFL_reg(context) );
SYSLEVEL_CheckNotLevel( 2 );
}
......@@ -198,36 +195,38 @@ void RELAY_DebugCallFrom16( int func_type, char *args,
/***********************************************************************
* RELAY_DebugCallFrom16Ret
*/
void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, CONTEXT86 *context)
void RELAY_DebugCallFrom16Ret( CONTEXT86 *context, int ret_val )
{
STACK16FRAME *frame;
WORD ordinal;
const char *funstr;
char funstr[80];
const char *args;
if (!TRACE_ON(relay)) return;
frame = CURRENT_STACK16;
funstr = BUILTIN_GetEntryPoint16(frame->entry_cs,frame->entry_ip,&ordinal);
if (!funstr) return;
args = BUILTIN_GetEntryPoint16(frame->entry_cs,frame->entry_ip,funstr,&ordinal);
if (!args) return;
if (!RELAY_ShowDebugmsgRelay(funstr)) return;
DPRINTF( "Ret %s() ",funstr);
switch(func_type)
if ( memcmp( args+2, "long_", 5 ) == 0 )
{
case 0: /* long */
DPRINTF( "retval=0x%08x ret=%04x:%04x ds=%04x\n",
ret_val, frame->cs, frame->ip, frame->ds );
break;
case 1: /* word */
}
else if ( memcmp( args+2, "word_", 5 ) == 0 )
{
DPRINTF( "retval=0x%04x ret=%04x:%04x ds=%04x\n",
ret_val & 0xffff, frame->cs, frame->ip, frame->ds );
break;
case 2: /* regs */
}
else if ( memcmp( args+2, "regs_", 5 ) == 0 )
{
DPRINTF("retval=none ret=%04x:%04x ds=%04x\n",
(WORD)CS_reg(context), IP_reg(context), (WORD)DS_reg(context));
DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), SI_reg(context), DI_reg(context),
(WORD)ES_reg(context), EFL_reg(context) );
break;
}
SYSLEVEL_CheckNotLevel( 2 );
......@@ -243,10 +242,11 @@ void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, CONTEXT86 *context)
void RELAY_Unimplemented16(void)
{
WORD ordinal;
char name[80];
STACK16FRAME *frame = CURRENT_STACK16;
BUILTIN_GetEntryPoint16(frame->entry_cs,frame->entry_ip,name,&ordinal);
MESSAGE("No handler for Win16 routine %s (called from %04x:%04x)\n",
BUILTIN_GetEntryPoint16(frame->entry_cs,frame->entry_ip,&ordinal),
frame->cs, frame->ip );
name, frame->cs, frame->ip );
ExitProcess(1);
}
......
......@@ -24,7 +24,7 @@ DEFAULT_DEBUG_CHANNEL(snoop)
void WINAPI SNOOP16_Entry(CONTEXT86 *context);
void WINAPI SNOOP16_Return(CONTEXT86 *context);
extern void CallFrom16_p_regs_();
extern void KERNEL_CallFrom16_p_regs_();
/* Generic callfrom16_p_regs function entry.
* pushw %bp 0x55
......@@ -103,14 +103,14 @@ SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) {
snr[0].pushl = 0x68;
snr[0].realfun = (DWORD)SNOOP16_Entry;
snr[0].lcall = 0x9a;
snr[0].callfromregs = (DWORD)CallFrom16_p_regs_;
snr[0].callfromregs = (DWORD)KERNEL_CallFrom16_p_regs_;
GET_CS(snr[0].seg);
snr[1].prefix = 0x66;
snr[1].pushbp = 0x55;
snr[1].pushl = 0x68;
snr[1].realfun = (DWORD)SNOOP16_Return;
snr[1].lcall = 0x9a;
snr[1].callfromregs = (DWORD)CallFrom16_p_regs_;
snr[1].callfromregs = (DWORD)KERNEL_CallFrom16_p_regs_;
GET_CS(snr[1].seg);
}
while (*dll) {
......
/*
* Win16 built-in DLLs definitions
*
* Copyright 1999 Ulrich Weigand
*/
#ifndef __WINE_BUILTIN16_H
#define __WINE_BUILTIN16_H
#include "windef.h"
#include "pshpack1.h"
typedef struct
{
WORD pushw_bp; /* pushw %bp */
BYTE pushl; /* pushl $target */
DWORD target;
BYTE lcall; /* lcall __FLATCS__:relay */
DWORD relay;
WORD flatcs;
} STD_ENTRYPOINT16;
typedef struct
{
WORD movw_ax; /* movw $<ax>, %ax */
WORD ax;
WORD movw_dx; /* movw $<dx>, %dx */
WORD dx;
WORD lret; /* lret $<args> */
WORD args;
WORD nopnop; /* nop; nop */
} RET_ENTRYPOINT16;
typedef union
{
STD_ENTRYPOINT16 std;
RET_ENTRYPOINT16 ret;
} ENTRYPOINT16;
#define EP_STD( target, relay ) \
{ std: { 0x5566, 0x68, (DWORD)(target), 0x9a, (DWORD)(relay), __FLATCS__ } }
#define EP_RET( retval, nargs ) \
{ ret: { 0xb866, LOWORD(retval), 0xba66, HIWORD(retval), \
(nargs)? 0xca66 : 0xcb66, (nargs)? (nargs) : 0x9090, 0x9090 } }
#include "poppack.h"
typedef struct
{
const char *name; /* DLL name */
void *module_start; /* 32-bit address of the module data */
int module_size; /* Size of the module data */
const BYTE *code_start; /* 32-bit address of DLL code */
const BYTE *data_start; /* 32-bit address of DLL data */
} WIN16_DESCRIPTOR;
extern void RELAY_Unimplemented16(void);
#endif /* __WINE_BUILTIN16_H */
......@@ -20,53 +20,53 @@ extern int (*IF1632_CallLargeStack)( int (*func)(void), void *arg );
typedef struct
{
LONG (CALLBACK *CallRegisterShortProc)( CONTEXT86 *, INT );
LONG (CALLBACK *CallRegisterLongProc)( CONTEXT86 *, INT );
VOID (CALLBACK *CallFrom16WndProc)(void);
LRESULT (CALLBACK *CallWndProc)( WNDPROC16, HWND16, UINT16,
LONG (*CallRegisterShortProc)( CONTEXT86 *, INT );
LONG (*CallRegisterLongProc)( CONTEXT86 *, INT );
VOID (*CallFrom16WndProc)(void);
LRESULT (*CallWndProc)( WNDPROC16, HWND16, UINT16,
WPARAM16, LPARAM );
LRESULT (CALLBACK *CallDriverProc)( DRIVERPROC16, DWORD, HDRVR16,
LRESULT (*CallDriverProc)( DRIVERPROC16, DWORD, HDRVR16,
UINT16, LPARAM, LPARAM );
LRESULT (CALLBACK *CallDriverCallback)( FARPROC16, HANDLE16, UINT16,
LRESULT (*CallDriverCallback)( FARPROC16, HANDLE16, UINT16,
DWORD, LPARAM, LPARAM );
LRESULT (CALLBACK *CallTimeFuncProc)( FARPROC16, WORD, UINT16,
LRESULT (*CallTimeFuncProc)( FARPROC16, WORD, UINT16,
DWORD, LPARAM, LPARAM );
INT16 (CALLBACK *CallWindowsExitProc)( FARPROC16, INT16 );
INT16 (CALLBACK *CallWordBreakProc)( EDITWORDBREAKPROC16, SEGPTR, INT16,
INT16 (*CallWindowsExitProc)( FARPROC16, INT16 );
INT16 (*CallWordBreakProc)( EDITWORDBREAKPROC16, SEGPTR, INT16,
INT16, INT16 );
VOID (CALLBACK *CallBootAppProc)( FARPROC16, HANDLE16, HFILE16 );
WORD (CALLBACK *CallLoadAppSegProc)( FARPROC16, HANDLE16, HFILE16, WORD );
WORD (CALLBACK *CallLocalNotifyFunc)( FARPROC16, WORD, HLOCAL16, WORD );
HGLOBAL16 (CALLBACK *CallResourceHandlerProc)( FARPROC16, HGLOBAL16, HMODULE16, HRSRC16 );
DWORD (CALLBACK *CallWOWCallbackProc)( FARPROC16, DWORD );
BOOL (CALLBACK *CallWOWCallback16Ex)( FARPROC16, DWORD, DWORD, LPVOID,
VOID (*CallBootAppProc)( FARPROC16, HANDLE16, HFILE16 );
WORD (*CallLoadAppSegProc)( FARPROC16, HANDLE16, HFILE16, WORD );
WORD (*CallLocalNotifyFunc)( FARPROC16, WORD, HLOCAL16, WORD );
HGLOBAL16 (*CallResourceHandlerProc)( FARPROC16, HGLOBAL16, HMODULE16, HRSRC16 );
DWORD (*CallWOWCallbackProc)( FARPROC16, DWORD );
BOOL (*CallWOWCallback16Ex)( FARPROC16, DWORD, DWORD, LPVOID,
LPDWORD );
DWORD (CALLBACK *CallUTProc)( FARPROC16, DWORD, DWORD );
LRESULT (CALLBACK *CallASPIPostProc)( FARPROC16, SEGPTR );
DWORD (*CallUTProc)( FARPROC16, DWORD, DWORD );
LRESULT (*CallASPIPostProc)( FARPROC16, SEGPTR );
/* Following are the graphics driver callbacks */
WORD (CALLBACK *CallDrvControlProc)( FARPROC16, SEGPTR, WORD,
WORD (*CallDrvControlProc)( FARPROC16, SEGPTR, WORD,
SEGPTR, SEGPTR );
WORD (CALLBACK *CallDrvEnableProc)( FARPROC16, SEGPTR, WORD, SEGPTR,
WORD (*CallDrvEnableProc)( FARPROC16, SEGPTR, WORD, SEGPTR,
SEGPTR, SEGPTR );
WORD (CALLBACK *CallDrvEnumDFontsProc)( FARPROC16, SEGPTR, SEGPTR,
WORD (*CallDrvEnumDFontsProc)( FARPROC16, SEGPTR, SEGPTR,
FARPROC16, SEGPTR );
WORD (CALLBACK *CallDrvEnumObjProc)( FARPROC16, SEGPTR, WORD, FARPROC16,
WORD (*CallDrvEnumObjProc)( FARPROC16, SEGPTR, WORD, FARPROC16,
SEGPTR );
WORD (CALLBACK *CallDrvOutputProc)( FARPROC16, SEGPTR, WORD, WORD, SEGPTR,
WORD (*CallDrvOutputProc)( FARPROC16, SEGPTR, WORD, WORD, SEGPTR,
SEGPTR, SEGPTR, SEGPTR, SEGPTR );
DWORD (CALLBACK *CallDrvRealizeProc)( FARPROC16, SEGPTR, WORD, SEGPTR,
DWORD (*CallDrvRealizeProc)( FARPROC16, SEGPTR, WORD, SEGPTR,
SEGPTR, SEGPTR );
WORD (CALLBACK *CallDrvStretchBltProc)( FARPROC16, SEGPTR, WORD, WORD,
WORD (*CallDrvStretchBltProc)( FARPROC16, SEGPTR, WORD, WORD,
WORD, WORD, SEGPTR, WORD, WORD,
WORD, WORD, DWORD, SEGPTR, SEGPTR,
SEGPTR );
DWORD (CALLBACK *CallDrvExtTextOutProc)( FARPROC16, SEGPTR, WORD, WORD,
DWORD (*CallDrvExtTextOutProc)( FARPROC16, SEGPTR, WORD, WORD,
SEGPTR, SEGPTR, INT16, SEGPTR,
SEGPTR, SEGPTR, SEGPTR, SEGPTR,
WORD );
WORD (CALLBACK *CallDrvGetCharWidthProc)( FARPROC16, SEGPTR, SEGPTR, WORD,
WORD (*CallDrvGetCharWidthProc)( FARPROC16, SEGPTR, SEGPTR, WORD,
WORD, SEGPTR, SEGPTR, SEGPTR );
BOOL16 (CALLBACK *CallDrvAbortProc)( FARPROC16, HDC16, INT16 );
BOOL16 (*CallDrvAbortProc)( FARPROC16, HDC16, INT16 );
} CALLBACKS_TABLE;
extern const CALLBACKS_TABLE *Callbacks;
......
......@@ -235,7 +235,7 @@ HGLOBAL16 NE_LoadPEResource( NE_MODULE *pModule, WORD type, LPVOID bits, DWORD s
/* if1632/builtin.c */
extern BOOL BUILTIN_Init(void);
extern HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL force );
extern LPCSTR BUILTIN_GetEntryPoint16( WORD cs, WORD ip, WORD *pOrd );
extern LPCSTR BUILTIN_GetEntryPoint16( WORD cs, WORD ip, LPSTR name, WORD *pOrd );
/* relay32/builtin.c */
extern HMODULE BUILTIN32_LoadImage(LPCSTR name, OFSTRUCT *ofs);
......
......@@ -32,17 +32,20 @@ typedef struct _STACK32FRAME
typedef struct
{
STACK32FRAME *frame32; /* 00 32-bit frame from last CallTo16() */
DWORD ebp; /* 04 full 32-bit content of ebp */
WORD mutex_count; /* 08 Win16Mutex recursion count */
WORD fs; /* 0a fs */
WORD entry_ip; /* 0c ip of entry point */
WORD ds; /* 0e ds */
WORD entry_cs; /* 10 cs of entry point */
WORD es; /* 12 es */
DWORD entry_point; /* 14 32-bit entry point to call */
WORD bp; /* 18 16-bit bp */
WORD ip; /* 1a return address */
WORD cs; /* 1c */
DWORD edx; /* 04 saved registers */
DWORD ecx; /* 08 */
DWORD ebp; /* 0c */
WORD ds; /* 10 */
WORD es; /* 12 */
WORD fs; /* 14 */
WORD gs; /* 16 */
DWORD relay; /* 18 address of argument relay stub */
DWORD entry_ip; /* 1c ip of entry point */
DWORD entry_cs; /* 20 cs of entry point */
DWORD entry_point; /* 24 API entry point to call, reused as mutex count */
WORD bp; /* 28 16-bit stack frame chain */
WORD ip; /* 2a return address */
WORD cs; /* 2c */
} STACK16FRAME;
#include "poppack.h"
......
......@@ -27,12 +27,8 @@ extern int (*INSTR_IsRelay)( const void *addr );
static int is_relay_addr( const void *addr )
{
extern char CallFrom16_Start, CallFrom16_End, CALLTO16_Start, CALLTO16_End;
return ((((char *)addr >= &CallFrom16_Start) &&
((char *)addr < &CallFrom16_End)) ||
(((char *)addr >= &CALLTO16_Start) &&
((char *)addr < &CALLTO16_End)));
extern char Call16_Start, Call16_End;
return ((char *)addr >= &Call16_Start) && ((char *)addr < &Call16_End);
}
/***********************************************************************
......
Makefile
advapi32.c
avifil32.c
advapi32.spec.c
avifil32.spec.c
call32.s
comctl32.c
comdlg32.c
crtdll.c
dciman32.c
ddraw.c
dinput.c
dplay.c
dplayx.c
dsound.c
gdi32.c
imagehlp.c
imm32.c
kernel32.c
lz32.c
mcianim.c
mciavi.c
mcicda.c
mciseq.c
mciwave.c
mpr.c
msacm32.c
msnet32.c
msvfw32.c
ntdll.c
ole32.c
oleaut32.c
olecli32.c
oledlg.c
olesvr32.c
psapi.c
rasapi32.c
shell32.c
tapi32.c
user32.c
version.c
w32skrnl.c
winmm.c
winspool.c
wnaspi32.c
wow32.c
wsock32.c
comctl32.spec.c
comdlg32.spec.c
crtdll.spec.c
dciman32.spec.c
ddraw.spec.c
dinput.spec.c
dplay.spec.c
dplayx.spec.c
dsound.spec.c
gdi32.spec.c
imagehlp.spec.c
imm32.spec.c
kernel32.spec.c
lz32.spec.c
mcianim.spec.c
mciavi.spec.c
mcicda.spec.c
mciseq.spec.c
mciwave.spec.c
mpr.spec.c
msacm32.spec.c
msnet32.spec.c
msvfw32.spec.c
ntdll.spec.c
ole32.spec.c
oleaut32.spec.c
olecli32.spec.c
oledlg.spec.c
olesvr32.spec.c
psapi.spec.c
rasapi32.spec.c
shell32.spec.c
tapi32.spec.c
user32.spec.c
version.spec.c
w32skrnl.spec.c
winmm.spec.c
winspool.spec.c
wnaspi32.spec.c
wow32.spec.c
wsock32.spec.c
......@@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = relay32
DLLS = \
SPEC_SRCS = \
advapi32.spec \
avifil32.spec \
comctl32.spec \
......@@ -56,30 +56,14 @@ C_SRCS = \
snoop.c \
utthunk.c
SPEC_FILES = $(DLLS:.spec=.c)
EXTRA_OBJS = $(DLLS:.spec=.o)
GEN_ASM_SRCS = \
call32.s
.SUFFIXES: .spec
.spec.c:
$(BUILD) -o $@ -spec $<
all: checkbuild $(MODULE).o
all: $(MODULE).o
@MAKE_RULES@
$(SPEC_FILES): $(BUILD)
$(EXTRA_OBJS): $(TOPSRCDIR)/include/builtin32.h
call32.s: $(BUILD)
$(BUILD) -o $@ -call32
clean::
$(RM) $(SPEC_FILES)
### Dependencies:
......@@ -204,14 +204,10 @@ VOID WINAPI RestoreThunkLock(DWORD mutex_count)
*/
VOID SYSLEVEL_ReleaseWin16Lock(VOID)
{
DWORD count;
/* entry_point is never used again once the entry point has
been called. Thus we re-use it to hold the Win16Lock count */
ReleaseThunkLock(&count);
if (count > 0xffff)
ERR("Win16Mutex recursion count too large!\n");
CURRENT_STACK16->mutex_count = (WORD)count;
ReleaseThunkLock(&CURRENT_STACK16->entry_point);
}
/************************************************************************
......@@ -219,12 +215,7 @@ VOID SYSLEVEL_ReleaseWin16Lock(VOID)
*/
VOID SYSLEVEL_RestoreWin16Lock(VOID)
{
DWORD count = CURRENT_STACK16->mutex_count;
if (!count)
ERR("Win16Mutex recursion count is zero!\n");
RestoreThunkLock(count);
RestoreThunkLock(CURRENT_STACK16->entry_point);
}
/************************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment