Speed up relay32, snoop16 and snoop32 include/excludes by doing them

just once at creation time.
This commit is contained in:
Marcus Meissner 1998-11-14 17:06:55 +00:00 committed by Alexandre Julliard
parent 06b4eb326e
commit 30c112e665
4 changed files with 21 additions and 13 deletions

View File

@ -60,7 +60,6 @@ typedef struct tagSNOOP16_RETURNENTRY {
DWORD ordinal;
WORD origSP;
WORD *args; /* saved args across a stdcall */
BYTE show;
} SNOOP16_RETURNENTRY;
typedef struct tagSNOOP16_RETURNENTRIES {
@ -187,6 +186,9 @@ SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) {
fun->name = HEAP_strdupA(SystemHeap,0,name);
else
fun->name = HEAP_strdupA(SystemHeap,0,"");
if (!SNOOP_ShowDebugmsgSnoop(dll->name, ordinal, fun->name))
return origfun;
/* more magic. do not try to snoop thunk data entries (MMSYSTEM) */
if (strchr(fun->name,'_')) {
char *s=strchr(fun->name,'_');
@ -214,8 +216,6 @@ void WINAPI SNOOP16_Entry(CONTEXT *context) {
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) {
@ -257,8 +257,7 @@ void WINAPI SNOOP16_Entry(CONTEXT *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;
@ -288,9 +287,7 @@ void WINAPI SNOOP16_Return(CONTEXT *context) {
}
IP_reg(context) = LOWORD(ret->origreturn);
CS_reg(context) = HIWORD(ret->origreturn);
if(!ret->show) {
;
} else if (ret->args) {
if (ret->args) {
int i,max;
DPRINTF("Ret %s.%ld: %s(",ret->dll->name,ret->ordinal,ret->dll->funs[ret->ordinal].name);

View File

@ -11,4 +11,5 @@ extern FARPROC32 SNOOP_GetProcAddress32(HMODULE32,LPCSTR,DWORD,FARPROC32);
extern void (*fnSNOOP16_RegisterDLL)(NE_MODULE*,LPCSTR);
extern FARPROC16 (*fnSNOOP16_GetProcAddress16)(HMODULE16,DWORD,FARPROC16);
extern void SNOOP16_Init();
extern int SNOOP_ShowDebugmsgSnoop(const char *dll,int ord,const char *fname);
#endif

View File

@ -236,10 +236,23 @@ static HMODULE32 BUILTIN32_DoLoadModule( BUILTIN32_DLL *dll, PDB32 *pdb )
for (i = 0; i < dll->descr->nb_funcs; i++, funcs++, debug++)
{
BYTE args = dll->descr->args[i];
int j;
if (!dll->descr->functions[i]) continue;
*funcs = (LPVOID)((BYTE *)dll->descr->functions[i] - addr);
#ifdef __i386__
if (!TRACE_ON(relay)) continue;
for (j=0;j<dll->descr->nb_names;j++)
if (dll->descr->ordinals[j] == i)
break;
if (j<dll->descr->nb_names) {
if (dll->descr->names[j]) {
char buffer[200];
sprintf(buffer,"%s.%d: %s",dll->descr->name,i,dll->descr->names[j]);
if (!RELAY_ShowDebugmsgRelay(buffer))
continue;
}
}
switch(args)
{
case 0xfe: /* register func */

View File

@ -197,6 +197,8 @@ SNOOP_GetProcAddress32(HMODULE32 hmod,LPCSTR name,DWORD ordinal,FARPROC32 origfu
}
if (!dll) /* probably internal */
return origfun;
if (!SNOOP_ShowDebugmsgSnoop(dll->name,ordinal,name))
return origfun;
assert(ordinal<dll->nrofordinals);
fun = dll->funs+ordinal;
if (!fun->name) fun->name = HEAP_strdupA(SystemHeap,0,name);
@ -285,11 +287,6 @@ REGS_ENTRYPOINT(SNOOP_Entry) {
FIXME(snoop,"entrypoint 0x%08lx not found\n",entry);
return; /* oops */
}
if (!SNOOP_ShowDebugmsgSnoop(dll->name, ordinal, fun->name)) {
/* we don't display, so we don't need returndisplay either */
EIP_reg(context)= (DWORD)fun->origfun;
return;
}
/* guess cdecl ... */
if (fun->nrofargs<0) {
/* Typical cdecl return frame is: