Remove .dll extension from module name, added wildcard support in

relay specifications (with the help of Dmitry Timoshkov).
This commit is contained in:
Alexandre Julliard 2002-07-08 20:46:58 +00:00
parent 13bfbc9530
commit 6da436656c
1 changed files with 14 additions and 7 deletions

View File

@ -156,12 +156,12 @@ static BOOL check_relay_include( const char *module, const char *func )
} }
for(; *listitem; listitem++) for(; *listitem; listitem++)
{ {
char *p = strchr( *listitem, '.' ); char *p = strrchr( *listitem, '.' );
if (p && p > *listitem) /* check module and function */ if (p && p > *listitem) /* check module and function */
{ {
int len = p - *listitem; int len = p - *listitem;
if (strncasecmp( *listitem, module, len-1 ) || module[len]) continue; 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 */ else /* function only */
{ {
@ -202,7 +202,7 @@ static void get_entry_point( char *buffer, DEBUG_ENTRY_POINT *relay )
IMAGE_DATA_DIRECTORY *dir; IMAGE_DATA_DIRECTORY *dir;
IMAGE_EXPORT_DIRECTORY *exp = NULL; IMAGE_EXPORT_DIRECTORY *exp = NULL;
DEBUG_ENTRY_POINT *debug; DEBUG_ENTRY_POINT *debug;
char *base = NULL; char *p, *base = NULL;
const char *name; const char *name;
int ordinal = 0; int ordinal = 0;
WINE_MODREF *wm; WINE_MODREF *wm;
@ -226,10 +226,14 @@ static void get_entry_point( char *buffer, DEBUG_ENTRY_POINT *relay )
/* Now find the function */ /* 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 ))) if ((name = find_exported_name( base, exp, ordinal + exp->Base )))
sprintf( buffer, "%s.%s", base + exp->Name, name ); sprintf( p, ".%s", name );
else 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; DEBUG_ENTRY_POINT *debug;
DWORD *funcs; DWORD *funcs;
int i; int i;
const char *name, *dllname; const char *name;
char *p, dllname[80];
dir = &PE_HEADER(module)->OptionalHeader.DataDirectory[IMAGE_FILE_EXPORT_DIRECTORY]; dir = &PE_HEADER(module)->OptionalHeader.DataDirectory[IMAGE_FILE_EXPORT_DIRECTORY];
if (!dir->Size) return; if (!dir->Size) return;
exports = (IMAGE_EXPORT_DIRECTORY *)(module + dir->VirtualAddress); exports = (IMAGE_EXPORT_DIRECTORY *)(module + dir->VirtualAddress);
debug = (DEBUG_ENTRY_POINT *)((char *)exports + dir->Size); debug = (DEBUG_ENTRY_POINT *)((char *)exports + dir->Size);
funcs = (DWORD *)(module + exports->AddressOfFunctions); 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++) for (i = 0; i < exports->NumberOfFunctions; i++, funcs++, debug++)
{ {