From 6da436656ccd6d06718db75902d29093da6b6c43 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 8 Jul 2002 20:46:58 +0000 Subject: [PATCH] Remove .dll extension from module name, added wildcard support in relay specifications (with the help of Dmitry Timoshkov). --- relay32/relay386.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/relay32/relay386.c b/relay32/relay386.c index b5eb97002e1..d9a4e9f725f 100644 --- a/relay32/relay386.c +++ b/relay32/relay386.c @@ -156,12 +156,12 @@ static BOOL check_relay_include( const char *module, const char *func ) } for(; *listitem; listitem++) { - char *p = strchr( *listitem, '.' ); + char *p = strrchr( *listitem, '.' ); if (p && p > *listitem) /* check module and function */ { int len = p - *listitem; if (strncasecmp( *listitem, module, len-1 ) || module[len]) continue; - if (!strcmp( p + 1, func )) return !show; + if (!strcmp( p + 1, func ) || !strcmp( p + 1, "*" )) return !show; } else /* function only */ { @@ -202,7 +202,7 @@ static void get_entry_point( char *buffer, DEBUG_ENTRY_POINT *relay ) IMAGE_DATA_DIRECTORY *dir; IMAGE_EXPORT_DIRECTORY *exp = NULL; DEBUG_ENTRY_POINT *debug; - char *base = NULL; + char *p, *base = NULL; const char *name; int ordinal = 0; WINE_MODREF *wm; @@ -226,10 +226,14 @@ static void get_entry_point( char *buffer, DEBUG_ENTRY_POINT *relay ) /* Now find the function */ + strcpy( buffer, base + exp->Name ); + p = buffer + strlen(buffer); + if (p > buffer + 4 && !strcasecmp( p - 4, ".dll" )) p -= 4; + if ((name = find_exported_name( base, exp, ordinal + exp->Base ))) - sprintf( buffer, "%s.%s", base + exp->Name, name ); + sprintf( p, ".%s", name ); else - sprintf( buffer, "%s.%ld", base + exp->Name, ordinal + exp->Base ); + sprintf( p, ".%ld", ordinal + exp->Base ); } @@ -505,14 +509,17 @@ void RELAY_SetupDLL( const char *module ) DEBUG_ENTRY_POINT *debug; DWORD *funcs; int i; - const char *name, *dllname; + const char *name; + char *p, dllname[80]; dir = &PE_HEADER(module)->OptionalHeader.DataDirectory[IMAGE_FILE_EXPORT_DIRECTORY]; if (!dir->Size) return; exports = (IMAGE_EXPORT_DIRECTORY *)(module + dir->VirtualAddress); debug = (DEBUG_ENTRY_POINT *)((char *)exports + dir->Size); funcs = (DWORD *)(module + exports->AddressOfFunctions); - dllname = module + exports->Name; + strcpy( dllname, module + exports->Name ); + p = dllname + strlen(dllname) - 4; + if (p > dllname && !strcasecmp( p, ".dll" )) *p = 0; for (i = 0; i < exports->NumberOfFunctions; i++, funcs++, debug++) {