snoop: fix ordinal base
Andreas Mohr
a.mohr at mailto.de
Thu May 24 11:01:03 CDT 2001
Hi all,
--debugmsg +snoop didn't take the ordinal base of DLLs into account,
which is why relay ordinals vs. snoop ordinals differed by 1 for shlwapi,
which was quite confusing.
Make snoop code take ordinal base into account.
Alexandre: is ordinal base 0 ok for ELF DLLs ? (elf.c)
Andreas Mohr
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at rhlx01.fht-esslingen.de:/home/wine
Index: include/snoop.h
===================================================================
RCS file: /home/wine/wine/include/snoop.h,v
retrieving revision 1.4
diff -u -r1.4 snoop.h
--- include/snoop.h 1999/08/15 12:45:01 1.4
+++ include/snoop.h 2001/05/24 13:56:19
@@ -6,7 +6,7 @@
#include "module.h"
-extern void SNOOP_RegisterDLL(HMODULE,LPCSTR,DWORD);
+extern void SNOOP_RegisterDLL(HMODULE,LPCSTR,DWORD,DWORD);
extern FARPROC SNOOP_GetProcAddress(HMODULE,LPCSTR,DWORD,FARPROC);
extern void SNOOP16_RegisterDLL(NE_MODULE*,LPCSTR);
extern FARPROC16 SNOOP16_GetProcAddress16(HMODULE16,DWORD,FARPROC16);
Index: loader/elf.c
===================================================================
RCS file: /home/wine/wine/loader/elf.c,v
retrieving revision 1.30
diff -u -r1.30 elf.c
--- loader/elf.c 2001/01/05 04:08:07 1.30
+++ loader/elf.c 2001/05/24 13:56:19
@@ -162,7 +162,7 @@
hmod = ELF_CreateDummyModule( t, modname );
- SNOOP_RegisterDLL(hmod,libname,STUBSIZE/sizeof(ELF_STDCALL_STUB));
+ SNOOP_RegisterDLL(hmod,libname,0,STUBSIZE/sizeof(ELF_STDCALL_STUB));
wm = PE_CreateModule( hmod, libname, 0, 0, FALSE );
wm->find_export = ELF_FindExportedFunction;
Index: loader/pe_image.c
===================================================================
RCS file: /home/wine/wine/loader/pe_image.c,v
retrieving revision 1.93
diff -u -r1.93 pe_image.c
--- loader/pe_image.c 2001/05/08 00:13:39 1.93
+++ loader/pe_image.c 2001/05/24 13:56:19
@@ -115,13 +115,13 @@
}
}
-/* Look up the specified function or ordinal in the exportlist:
+/* Look up the specified function or ordinal in the export list:
* If it is a string:
- * - look up the name in the Name list.
+ * - look up the name in the name list.
* - look up the ordinal with that index.
* - use the ordinal as offset into the functionlist
- * If it is a ordinal:
- * - use ordinal-pe_export->Base as offset into the functionlist
+ * If it is an ordinal:
+ * - use ordinal-pe_export->Base as offset into the function list
*/
static FARPROC PE_FindExportedFunction(
WINE_MODREF *wm, /* [in] WINE modreference */
@@ -656,7 +656,7 @@
}
if (pe_export)
- SNOOP_RegisterDLL( hModule, wm->modname, pe_export->NumberOfFunctions );
+ SNOOP_RegisterDLL( hModule, wm->modname, pe_export->Base, pe_export->NumberOfFunctions );
/* Send DLL load event */
/* we don't need to send a dll event for the main exe */
Index: relay32/snoop.c
===================================================================
RCS file: /home/wine/wine/relay32/snoop.c,v
retrieving revision 1.41
diff -u -r1.41 snoop.c
--- relay32/snoop.c 2001/05/08 00:13:39 1.41
+++ relay32/snoop.c 2001/05/24 13:56:19
@@ -59,6 +59,7 @@
HMODULE hmod;
SNOOP_FUN *funs;
LPCSTR name;
+ DWORD ordbase;
DWORD nrofordinals;
struct tagSNOOP_DLL *next;
} SNOOP_DLL;
@@ -126,7 +127,7 @@
}
void
-SNOOP_RegisterDLL(HMODULE hmod,LPCSTR name,DWORD nrofordinals) {
+SNOOP_RegisterDLL(HMODULE hmod,LPCSTR name,DWORD ordbase,DWORD nrofordinals) {
SNOOP_DLL **dll = &(firstdll);
char *s;
@@ -139,6 +140,7 @@
*dll = (SNOOP_DLL*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SNOOP_DLL));
(*dll)->next = NULL;
(*dll)->hmod = hmod;
+ (*dll)->ordbase = ordbase;
(*dll)->nrofordinals = nrofordinals;
(*dll)->name = HEAP_strdupA(GetProcessHeap(),0,name);
if ((s=strrchr((*dll)->name,'.')))
@@ -322,7 +324,7 @@
context->Eip = (DWORD)fun->origfun;
- DPRINTF("%08lx:CALL %s.%ld: %s(",GetCurrentThreadId(),dll->name,ordinal,fun->name);
+ DPRINTF("%08lx:CALL %s.%ld: %s(",GetCurrentThreadId(),dll->name,dll->ordbase+ordinal,fun->name);
if (fun->nrofargs>0) {
max = fun->nrofargs; if (max>16) max=16;
for (i=0;i<max;i++)
@@ -355,7 +357,7 @@
DPRINTF("%08lx:RET %s.%ld: %s(",
GetCurrentThreadId(),
- ret->dll->name,ret->ordinal,ret->dll->funs[ret->ordinal].name);
+ ret->dll->name,ret->dll->ordbase+ret->ordinal,ret->dll->funs[ret->ordinal].name);
max = ret->dll->funs[ret->ordinal].nrofargs;
if (max>16) max=16;
@@ -368,7 +370,7 @@
} else
DPRINTF("%08lx:RET %s.%ld: %s() retval = %08lx ret=%08lx tid=%08lx\n",
GetCurrentThreadId(),
- ret->dll->name,ret->ordinal,ret->dll->funs[ret->ordinal].name,
+ ret->dll->name,ret->dll->ordbase+ret->ordinal,ret->dll->funs[ret->ordinal].name,
context->Eax, (DWORD)ret->origreturn, GetCurrentThreadId());
ret->origreturn = NULL; /* mark as empty */
}
More information about the wine-patches
mailing list