mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 11:26:10 +00:00
a0d77315e4
Fri Sep 11 13:14:35 1998 Andreas Mohr <100.30936@germany.net> * [files/file.c] [include/file.h] Fixed SetFilePointer to allow negative positions as in DOS. * [graphics/ddraw.c] Added some methods to IDirect3D. * [ole/compobj.c] [if1632/compobj.spec] Added/implemented CoCreateStandardMalloc16, CoGetClassObject, CoCreateInstance, LookupETask, SetETask, CoGetState16. * [loader/task.c] MakeProcInstance: return 0 if func == NULL. * [*/*] [tools/winapi-check] Added zillions of missing WINAPI's and __cdecl's. (oops, several caused by myself) Wrote script for automated checking. * [if1632/compobj.spec] Many stub names. * [misc/ddeml.c] [ole/compobj.c] Some stubs. Tue Sep 9 21:36:48 1998 Anders Carlsson <anders.carlsson@linux.nu> * [dlls/comctl32/Makefile.in] [dlls/comctl32/commctrl.c] [dlls/comctl32/tab.c] [include/commctrl.h] [include/tab.h] Added preliminary tab control support. Sat Sep 5 16:27:20 1998 Huw D M Davies <daviesh@abacus.physics.ox.ac.uk> * [graphics/psdrv/*] More changes to the PostScript driver: Implemented pens and solid brushes. Colour/greyscale for fonts, pens and brushes. To get coloured output you need to have *ColorDevice set to true in your PPD, otherwise you'll get greyscale. Landscape mode now works, as does non-A4 page sizes. Encoding of fonts to ANSI is better, Symbol works again. * [objects/dc.c] [include/gdi.h] [*/*] Moved dc->w.{text,background}Pixel to X11DRV_PDEVICE where they belong. Sat Sep 5 05:12:09 1998 Ove Kaaven <ovek@arcticnet.no> * [include/dosexe.h] [include/miscemu.h] [include/msdos.h] [loader/dos/dosvm.c] [loader/dos/module.c] [msdos/dpmi.c] [msdos/int2f.c] [msdos/interrupts.c] Fixed portability. Adapted some code to make it easier to integrate the DOS subsystem with the DPMI subsystem, made the DPMI simulated real-mode interrupts be handled the V86 way. Added support for .COM files. Made int2f DPMI check fail, to avoid pkunzip crashing in attempting to use DPMI. Generally moved stuff around a little. It is now technically possible to load several DOS programs into the same memory space. Not tested, though. Fri Sep 4 21:40:45 1998 Marcus Meissner <marcus@jet.franken.de> * [if1632/kernel.spec] Changed 500-53x stubnames accordingly to nt3.51 krnl386.exe. * [win32/except.c] Fixed one bad program behaviour, (deleting SEH while in first walk). RtlUnwind is broken too I think (it should unwind on success, not while walking the exception chain). * [ole/ole2nls.c] Get*DefaultLCID returns 0x400|id. expected by one application. * [if1632/snoop.c] Handle non-standard SP returns more graceful. * [windows/class.c] hinstances are mostly irrelevant for win32. * [memory/string.c] [misc/registry.c] lstrcmpi32W: use toupper for characters < 0x100. (speedup hack for registry.c) Some small speedup hacks for registry.c Thu Sep 3 20:40:16 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de> * [Makefile.in][configure][configure.in][dlls/Makefile.in] [dlls/comctl32/Makefile.in] Created dlls/comctl32 and moved the common controls stuff to it. * [misc/version.c] Removed COMCTL32_DllGetVersion. The fixed function is part of the common controls stuff. * [dlls/comctl32/*.c][include/commctrl.h] Added structure size tests. * [dlls/comctl32/toolbar.c] Fixed a bug in TOOLBAR_GetMaxWidth(). * [dlls/comctl32/animate.c][include/animate.h] [dlls/comctl32/comboex.c][include/comboex.h] [dlls/comctl32/hotkey.c][include/hotkey.h] [dlls/comctl32/listview.c][include/listview.h] [dlls/comctl32/commctrl.c][include/commctrl.h] New files. Added Animation, ComboBoxEx, Hotkey and Listview control dummies. * [dlls/comctl32/tooltips.c] Fixed a display bug and font selection. * [dlls/comctl32/comctl32undoc.c][include/commctrl.h] Added missing DPA functions. Fixed bugs and published the function prototypes. * [documentation/common_controls] Updated. Wed Sep 2 15:43:45 1998 Patrik Stridvall <ps@leissner.se> * [AUTHORS] [include/authors.h] Added myself as a Wine author. * [memory/virtual.c] [objects/dc.c] Fixed runtime errors for Solaris. * [misc/ddeml.c] [objects/gdiobj.c] Minor fixes. * [win32/device.c] Added stubs for IFSMgr VxDCall and a partial implementation of IFSMgr DeviceIo. * [relay32/Makefile.in] [relay32/builtin32.c] [relay32/imm32.spec] [relay32/msnet32.spec] [relay32/oledlg.spec] Added new spec files for IMM32.DLL, MSNET32.DLL, OLEDLG.DLL. * [misc/Makefile.in] [misc/imm.c] [include/imm.h] Added news files for implementation of IMM32.DLL. All functions return 0 as is correct for all Western Languages. * [ole/Makefile.in] [ole/oledlg.c] [include/oledlg.h] Added new files for implementation of OLEDLG.DLL. Added stubs with FIXME:s for all functions. Wed Sep 2 10:50:00 1998 Juergen Schmied <juergen.schmied@metronet.de> * [dlls/shell32/contmenu.c][dlls/shell32/shellole.c] [dlls/shell32/shlfolder.c][dlls/shell32/shlview.c] [documentation/shell32][include/shell.h] Clean up, bugfixes. * [dlls/shell32/enumidlist.c] Fileattributes implemented. * [dlls/shell32/pidl.c] Class pidlmgr splited into functions, structures changed, some functions rewritten. * [dlls/shell32/shell32_main.c] Small changes and bugfixes SHGetFileInfoA, SHGetSpecialFolderLocation. * [dlls/shell32/shellord.c][relay32/shell32.spec] Parameter documented, implemented SHCloneSpecialIDList. Stub improved ShellExecuteEx32A. New stubs SHFind_InitMenuPopup, FileMenu_InitMenuPopup, FileMenu_Create, FileMenu_TrackPopupMenuEx, SHWinHelp, SHRunConrolPanel, DAD_ShowDragImage, FileMenu_Destroy, SHGetDataFromIDListA, SHFileOperationA. * [include/winnls.h][include/ole2nls.c] TIME_FORCE24HOURFORMAT, TIME_NOTIMEMARKER implemented in OLE_GetFormatA, GetTimeFormat32A. * [win32/code_page.c] WideCharToMultiByte: parameter checking and returning of strlen implemented. * [windows/keyboard.c][windows/defwnd.c] Debug messages added. * [windows/win.c] WIN_SetWindowLong GWL_STYLE and GWL_EXSTYLE implemented. * [controls/menu.c] Missing line added. * [include/winerror.h] Macros for SUCCEEDED and FAILED added. Mon Aug 31 00:55:31 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de> * [loader/module.c] Bugfix: LoadModule16 should *not* call LoadModule32. * [files/dos_fs.c] Bugfix: don't crash if given directory doesn't exist. Sat Aug 29 15:00:49 1998 Turchanov Sergey <turchanov@usa.net> * [include/mmsystem.h][multimedia/mmsystem.c][relay32/winmm.spec] Almost completed implementation of [snd]PlaySound (except flags SND_ALIAS_ID and SND_APPLICATION). * [if1632/user.spec][windows/winpos.c] Added SetWindowRgn16 stub. Sat Aug 29 02:53:31 1998 Alexander Lukyanov <lav@long.yar.ru> * [files/drive.c] GetDriveType32A: return DRIVE_DOESNOTEXIST in case of non existent drive. * [msdos/int21.c] INT21_FindFirstFCB: check drive validity to prevent oops. * [win32/file.c] CreateFile32A: duplicate STD_{INPUT,OUTPUT}_HANDLE. * [files/dos_fs.c] Make DOSFS_OpenDir treat "" as "/". DOSFS_OpenDevice: duplicate STD_{INPUT,OUTPUT}_HANDLE. * [windows/dialog.c] GetNextDlgTabItem32: use last/first item instead of first/last when hwndCtrl==0. This fixes initial focus. Sat Aug 29 02:46:32 1998 Adrian Harvey <adrian@select.com.au> * [include/process.h] [include/process.c] Renamed PROCESS_SELF to CURRENT_PROCESS_PSEUDOHANDLE in line with thread constant, and Win32 documentation (which calls it a pseudohandle.) Made GetCurrentProcess actually use this constant instead of the value. * [include/process.h] [include/thread.h] [scheduler/thread.c] [scheduler/process.c] [scheduler/handle.c] Modify HANDLE_GetObjPtr to understand about CURRENT_THREAD_PSEUDOHANDLE and CURRENT_PROCESS_PSEUDOHANDLE. This allows DuplicateHandle to do the correct thing with these handles. Removed now duplicate functionality from THREAD_GetPtr and PROCESS_GetPtr. * [loader/ne/segment.c] Fixed two places where HFILE32s were being created and passed to 16-bit code. This should unbreak NE self-loading code. Added two casts to remove compile time warnings. Fri Aug 28 21:04:13 1998 Joseph Pranevich <knight@baltimore.wwaves.com> * [msdos/dosmem.c] [msdos/int2f.c] Added beginnings of DOS error table. * [msdos/int1a.c] Stub for subfunction 0xb0. * [msdos/int10.c] [loader/dos/dosvm.c] INT 10 support completely rewritten and lots of debugging added. Now, DOS apps that use INT 10 to write to the screen will work. (Beyond Zork does, at least. Somewhat.) * [include/miscemu.h] [msdos/dosmem.c] [msdos/int21.c] Another shot at getting MS's generic error message facility right. * [msdos/int21.c] Command.Com wanted to set its own PSP address. I let it. Wed Aug 26 12:26:20 1998 Matthew Toseland <Matthew.Toseland@btinternet.com> * [include/file.h] [misc/lzexpand.c] Fixed LZCopy16 by fixing HFILE16/HFILE32 convertor macros so don't convert lzw handles. Tue Aug 25 22:22:55 1998 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> * [misc/registry.c] In RegEnumvalue, ivalue == 0 is a legal request and should return the first entry. * [msdos/int21.c] Add handling for Int21-48/49 in Win16. Makes blinker demo work. * [windows/winproc.c] Add Msg32A<->Msg32W translation for LB_ADDSTRING. Tue Aug 25 21:03:31 1998 Kristian Nielsen <kristian.nielsen@risoe.dk> * [windows/win.c] Fix for SetParent(): MS Windows 3.11 does not clear the WS_CHILD flag when a child window is reparented to the desktop window. Mon Aug 24 20:55:22 1998 Berend Reitsma <berend at asset-control dot com> * [controls/menu.c] Menus created with SetMenuItemInfo and InsertMenuItem should work now. Sun Aug 23 23:23:23 1998 Alex Korobka <korobka@ams.sunysb.edu> * [controls/combo.c] Added CB_GETITEMHEIGHT. * [windows/winpos.c] WM_NCHITTEST, SWP_FRAMECHANGED bugfixes. Sat Aug 22 21:15:29 1998 Alex Priem <alexp@sci.kun.nl> * [files/profile.c] [include/windows.h] Added GetPrivateProfileSectionNames[AW],GetPrivateProfileSectionW, GetPrivateProfileStructW, GetProfileSectionW, WriteProfileSection[AW], WritePrivateProfileStructW.
334 lines
9.2 KiB
C
334 lines
9.2 KiB
C
/*
|
|
* 386-specific Win16 dll<->dll snooping functions
|
|
*
|
|
* Copyright 1998 Marcus Meissner
|
|
*/
|
|
|
|
#ifdef __i386__
|
|
|
|
#include <assert.h>
|
|
#include "windows.h"
|
|
#include "winbase.h"
|
|
#include "winnt.h"
|
|
#include "heap.h"
|
|
#include "global.h"
|
|
#include "selectors.h"
|
|
#include "stackframe.h"
|
|
#include "snoop.h"
|
|
#include "debugstr.h"
|
|
#include "debug.h"
|
|
|
|
#pragma pack(1)
|
|
|
|
void WINAPI SNOOP16_Entry(CONTEXT *context);
|
|
void WINAPI SNOOP16_Return(CONTEXT *context);
|
|
extern void CallFrom16_p_regs_();
|
|
|
|
/* Generic callfrom16_p_regs function entry.
|
|
* pushw %bp 0x55
|
|
* pushl $DOS3Call DWORD fun32
|
|
* .byte 0x9a 0x9a
|
|
* .long CallFrom16_p_regs_ DWORD addr
|
|
* .long 0x90900023 WORD seg;nop;nop
|
|
*/
|
|
|
|
typedef struct tagSNOOP16_FUN {
|
|
/* code part */
|
|
BYTE lcall; /* 0x9a call absolute with segment */
|
|
DWORD snr;
|
|
/* unreached */
|
|
int nrofargs;
|
|
FARPROC16 origfun;
|
|
char *name;
|
|
} SNOOP16_FUN;
|
|
|
|
typedef struct tagSNOOP16_DLL {
|
|
HMODULE16 hmod;
|
|
HANDLE16 funhandle;
|
|
SNOOP16_FUN *funs;
|
|
LPCSTR name;
|
|
struct tagSNOOP16_DLL *next;
|
|
} SNOOP16_DLL;
|
|
|
|
typedef struct tagSNOOP16_RETURNENTRY {
|
|
/* code part */
|
|
BYTE lcall; /* 0x9a call absolute with segment */
|
|
DWORD snr;
|
|
/* unreached */
|
|
FARPROC16 origreturn;
|
|
SNOOP16_DLL *dll;
|
|
DWORD ordinal;
|
|
WORD origSP;
|
|
WORD *args; /* saved args across a stdcall */
|
|
BYTE show;
|
|
} SNOOP16_RETURNENTRY;
|
|
|
|
typedef struct tagSNOOP16_RETURNENTRIES {
|
|
SNOOP16_RETURNENTRY entry[65500/sizeof(SNOOP16_RETURNENTRY)];
|
|
HANDLE16 rethandle;
|
|
struct tagSNOOP16_RETURNENTRIES *next;
|
|
} SNOOP16_RETURNENTRIES;
|
|
|
|
typedef struct tagSNOOP16_RELAY {
|
|
/* code part */
|
|
BYTE prefix; /* 0x66 , 32bit prefix */
|
|
BYTE pushbp; /* 0x55 */
|
|
BYTE pushl; /* 0x68 */
|
|
DWORD realfun; /* SNOOP16_Return */
|
|
BYTE lcall; /* 0x9a call absolute with segment */
|
|
DWORD callfromregs;
|
|
WORD seg;
|
|
/* unreached */
|
|
} SNOOP16_RELAY;
|
|
|
|
#pragma pack(4)
|
|
|
|
static SNOOP16_DLL *firstdll = NULL;
|
|
static SNOOP16_RETURNENTRIES *firstrets = NULL;
|
|
static SNOOP16_RELAY *snr;
|
|
static HANDLE16 xsnr = 0;
|
|
|
|
void
|
|
SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) {
|
|
SNOOP16_DLL **dll = &(firstdll);
|
|
char *s;
|
|
|
|
if (!TRACE_ON(snoop)) return;
|
|
if (!snr) {
|
|
xsnr=GLOBAL_Alloc(GMEM_ZEROINIT,2*sizeof(*snr),0,TRUE,TRUE,FALSE);
|
|
snr = GlobalLock16(xsnr);
|
|
snr[0].prefix = 0x66;
|
|
snr[0].pushbp = 0x55;
|
|
snr[0].pushl = 0x68;
|
|
snr[0].realfun = (DWORD)SNOOP16_Entry;
|
|
snr[0].lcall = 0x9a;
|
|
snr[0].callfromregs = (DWORD)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_;
|
|
GET_CS(snr[1].seg);
|
|
}
|
|
while (*dll) {
|
|
if ((*dll)->hmod == pModule->self)
|
|
return; /* already registered */
|
|
dll = &((*dll)->next);
|
|
}
|
|
*dll = (SNOOP16_DLL*)HeapAlloc(SystemHeap,HEAP_ZERO_MEMORY,sizeof(SNOOP16_DLL));
|
|
(*dll)->next = NULL;
|
|
(*dll)->hmod = pModule->self;
|
|
if ((s=strrchr(name,'\\')))
|
|
name = s+1;
|
|
(*dll)->name = HEAP_strdupA(SystemHeap,0,name);
|
|
if ((s=strrchr((*dll)->name,'.')))
|
|
*s='\0';
|
|
(*dll)->funhandle = GlobalHandleToSel(GLOBAL_Alloc(GMEM_ZEROINIT,65535,0,TRUE,FALSE,FALSE));
|
|
(*dll)->funs = GlobalLock16((*dll)->funhandle);
|
|
if (!(*dll)->funs) {
|
|
HeapFree(SystemHeap,0,*dll);
|
|
FIXME(snoop,"out of memory\n");
|
|
return;
|
|
}
|
|
memset((*dll)->funs,0,65535);
|
|
}
|
|
|
|
FARPROC16
|
|
SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) {
|
|
SNOOP16_DLL *dll = firstdll;
|
|
SNOOP16_FUN *fun;
|
|
NE_MODULE *pModule = NE_GetPtr(hmod);
|
|
unsigned char *cpnt;
|
|
char name[200];
|
|
|
|
if (!TRACE_ON(snoop) || !pModule || !HIWORD(origfun))
|
|
return origfun;
|
|
if (!*(LPBYTE)PTR_SEG_TO_LIN(origfun)) /* 0x00 is an imposs. opcode, poss. dataref. */
|
|
return origfun;
|
|
while (dll) {
|
|
if (hmod == dll->hmod)
|
|
break;
|
|
dll=dll->next;
|
|
}
|
|
if (!dll) /* probably internal */
|
|
return origfun;
|
|
if (ordinal>65535/sizeof(SNOOP16_FUN))
|
|
return origfun;
|
|
fun = dll->funs+ordinal;
|
|
/* already done? */
|
|
fun->lcall = 0x9a;
|
|
fun->snr = MAKELONG(0,xsnr);
|
|
fun->origfun = origfun;
|
|
if (fun->name)
|
|
return (FARPROC16)(SEGPTR)MAKELONG(((char*)fun-(char*)dll->funs),dll->funhandle);
|
|
cpnt = (unsigned char *)pModule + pModule->name_table;
|
|
while (*cpnt) {
|
|
cpnt += *cpnt + 1 + sizeof(WORD);
|
|
if (*(WORD*)(cpnt+*cpnt+1) == ordinal) {
|
|
sprintf(name,"%.*s",*cpnt,cpnt+1);
|
|
break;
|
|
}
|
|
}
|
|
/* Now search the non-resident names table */
|
|
|
|
if (!*cpnt && pModule->nrname_handle) {
|
|
cpnt = (char *)GlobalLock16( pModule->nrname_handle );
|
|
while (*cpnt) {
|
|
cpnt += *cpnt + 1 + sizeof(WORD);
|
|
if (*(WORD*)(cpnt+*cpnt+1) == ordinal) {
|
|
sprintf(name,"%.*s",*cpnt,cpnt+1);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (*cpnt)
|
|
fun->name = HEAP_strdupA(SystemHeap,0,name);
|
|
else
|
|
fun->name = HEAP_strdupA(SystemHeap,0,"");
|
|
/* more magic. do not try to snoop thunk data entries (MMSYSTEM) */
|
|
if (strchr(fun->name,'_')) {
|
|
char *s=strchr(fun->name,'_');
|
|
|
|
if (!strncasecmp(s,"_thunkdata",10)) {
|
|
HeapFree(SystemHeap,0,fun->name);
|
|
fun->name = NULL;
|
|
return origfun;
|
|
}
|
|
}
|
|
fun->lcall = 0x9a;
|
|
fun->snr = MAKELONG(0,xsnr);
|
|
fun->origfun = origfun;
|
|
fun->nrofargs = -1;
|
|
return (FARPROC16)(SEGPTR)MAKELONG(((char*)fun-(char*)dll->funs),dll->funhandle);
|
|
}
|
|
|
|
#define CALLER1REF (*(DWORD*)(PTR_SEG_OFF_TO_LIN(SS_reg(context),SP_reg(context)+4)))
|
|
void WINAPI SNOOP16_Entry(CONTEXT *context) {
|
|
DWORD ordinal=0;
|
|
DWORD entry=(DWORD)PTR_SEG_OFF_TO_LIN(CS_reg(context),IP_reg(context))-5;
|
|
WORD xcs = CS_reg(context);
|
|
SNOOP16_DLL *dll = firstdll;
|
|
SNOOP16_FUN *fun = NULL;
|
|
SNOOP16_RETURNENTRIES **rets = &firstrets;
|
|
SNOOP16_RETURNENTRY *ret;
|
|
int i,max;
|
|
/* from relay32/snoop.c */
|
|
extern int SNOOP_ShowDebugmsgSnoop(const char *dll,int ord,const char *fname);
|
|
|
|
while (dll) {
|
|
if (xcs == dll->funhandle) {
|
|
fun = (SNOOP16_FUN*)entry;
|
|
ordinal = fun-dll->funs;
|
|
break;
|
|
}
|
|
dll=dll->next;
|
|
}
|
|
if (!dll) {
|
|
FIXME(snoop,"entrypoint 0x%08lx not found\n",entry);
|
|
return; /* oops */
|
|
}
|
|
while (*rets) {
|
|
for (i=0;i<sizeof((*rets)->entry)/sizeof((*rets)->entry[0]);i++)
|
|
if (!(*rets)->entry[i].origreturn)
|
|
break;
|
|
if (i!=sizeof((*rets)->entry)/sizeof((*rets)->entry[0]))
|
|
break;
|
|
rets = &((*rets)->next);
|
|
}
|
|
if (!*rets) {
|
|
HANDLE16 hand = GlobalHandleToSel(GLOBAL_Alloc(GMEM_ZEROINIT,65535,0,TRUE,FALSE,FALSE));
|
|
*rets = GlobalLock16(hand);
|
|
memset(*rets,0,65535);
|
|
(*rets)->rethandle = hand;
|
|
i = 0; /* entry 0 is free */
|
|
}
|
|
ret = &((*rets)->entry[i]);
|
|
ret->lcall = 0x9a;
|
|
ret->snr = MAKELONG(sizeof(SNOOP16_RELAY),xsnr);
|
|
ret->origreturn = (FARPROC16)CALLER1REF;
|
|
CALLER1REF = MAKELONG((char*)&(ret->lcall)-(char*)((*rets)->entry),(*rets)->rethandle);
|
|
ret->dll = dll;
|
|
ret->args = NULL;
|
|
ret->ordinal = ordinal;
|
|
ret->origSP = SP_reg(context);
|
|
|
|
IP_reg(context)= LOWORD(fun->origfun);
|
|
CS_reg(context)= HIWORD(fun->origfun);
|
|
|
|
ret->show = SNOOP_ShowDebugmsgSnoop(dll->name, ordinal, fun->name);
|
|
if(!ret->show) return;
|
|
DPRINTF("Call %s.%ld: %s(",dll->name,ordinal,fun->name);
|
|
if (fun->nrofargs>0) {
|
|
max = fun->nrofargs;
|
|
if (max>16) max=16;
|
|
for (i=max;i--;)
|
|
DPRINTF("%04x%s",*(WORD*)(PTR_SEG_OFF_TO_LIN(SS_reg(context),SP_reg(context))+8+sizeof(WORD)*i),i?",":"");
|
|
if (max!=fun->nrofargs)
|
|
DPRINTF(" ...");
|
|
} else if (fun->nrofargs<0) {
|
|
DPRINTF("<unknown, check return>");
|
|
ret->args = HeapAlloc(SystemHeap,0,16*sizeof(WORD));
|
|
memcpy(ret->args,(LPBYTE)(PTR_SEG_OFF_TO_LIN(SS_reg(context),SP_reg(context))+8),sizeof(WORD)*16);
|
|
}
|
|
DPRINTF(") ret=%04x:%04x\n",HIWORD(ret->origreturn),LOWORD(ret->origreturn));
|
|
}
|
|
|
|
void WINAPI SNOOP16_Return(CONTEXT *context) {
|
|
SNOOP16_RETURNENTRY *ret = (SNOOP16_RETURNENTRY*)(PTR_SEG_OFF_TO_LIN(CS_reg(context),IP_reg(context))-5);
|
|
|
|
/* We haven't found out the nrofargs yet. If we called a cdecl
|
|
* function it is too late anyway and we can just set '0' (which
|
|
* will be the difference between orig and current SP
|
|
* If pascal -> everything ok.
|
|
*/
|
|
if (ret->dll->funs[ret->ordinal].nrofargs<0) {
|
|
ret->dll->funs[ret->ordinal].nrofargs=(SP_reg(context)-ret->origSP-4)/2;
|
|
}
|
|
IP_reg(context) = LOWORD(ret->origreturn);
|
|
CS_reg(context) = HIWORD(ret->origreturn);
|
|
if(!ret->show) {
|
|
;
|
|
} else if (ret->args) {
|
|
int i,max;
|
|
|
|
DPRINTF("Ret %s.%ld: %s(",ret->dll->name,ret->ordinal,ret->dll->funs[ret->ordinal].name);
|
|
max = ret->dll->funs[ret->ordinal].nrofargs;
|
|
if (max>16)
|
|
max=16;
|
|
if (max<0)
|
|
max=0;
|
|
|
|
for (i=max;i--;)
|
|
DPRINTF("%04x%s",ret->args[i],i?",":"");
|
|
if (max!=ret->dll->funs[ret->ordinal].nrofargs)
|
|
DPRINTF(" ...");
|
|
DPRINTF(") retval = %04x:%04x ret=%04x:%04x\n",
|
|
DX_reg(context),AX_reg(context),HIWORD(ret->origreturn),LOWORD(ret->origreturn)
|
|
);
|
|
HeapFree(SystemHeap,0,ret->args);
|
|
ret->args = NULL;
|
|
} else
|
|
DPRINTF("Ret %s.%ld: %s() retval = %04x:%04x ret=%04x:%04x\n",
|
|
ret->dll->name,ret->ordinal,ret->dll->funs[ret->ordinal].name,
|
|
DX_reg(context),AX_reg(context),HIWORD(ret->origreturn),LOWORD(ret->origreturn)
|
|
);
|
|
ret->origreturn = NULL; /* mark as empty */
|
|
}
|
|
#else /* !__i386__ */
|
|
void SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) {
|
|
FIXME(snoop,"snooping works only on i386 for now.\n");
|
|
return;
|
|
}
|
|
|
|
FARPROC16 SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) {
|
|
return origfun;
|
|
}
|
|
#endif /* !__i386__ */
|
|
|
|
void
|
|
SNOOP16_Init() {
|
|
fnSNOOP16_GetProcAddress16=SNOOP16_GetProcAddress16;
|
|
fnSNOOP16_RegisterDLL=SNOOP16_RegisterDLL;
|
|
}
|