hi, This makes PEBrowse display debug symbols (in their mangled form) instead of garbage. Changelog: dlls/msvcrt : main.c, msvcrt.h, msvcrt.spec Two "unknown" parameters of _unDName() turn out to be the output string and it length. If possible, use these instead of allocating a new one. Put the code in _unDNameEx() and call that from _unDName(). Rein. -- Rein Klazes rklazes@xxxxxxxxx
--- wine/dlls/msvcrt/main.c 2004-01-07 07:36:19.000000000 +0100 +++ mywine/dlls/msvcrt/main.c 2004-01-13 19:15:00.000000000 +0100 @@ -123,30 +123,32 @@ } /********************************************************************* - * __unDName (MSVCRT.@) + * __unDNameEx (MSVCRT.@) * * Demangle a C++ identifier. * * PARAMS - * unknown [I] Not yet determined + * OutStr [O] If not NULL, the place to put the demangled string * mangled [I] Mangled name of the function - * unknown2 [I] Not yet determined + * OutStrLen[I] Length of OutStr * memget [I] Function to allocate memory with * memfree [I] Function to free memory with + * unknown [?] Unknown, possibly a call back * flags [I] Flags determining demangled format * * RETURNS * Success: A string pointing to the unmangled name, allocated with memget. * Failure: NULL. */ -char* MSVCRT___unDName(int unknown, const char* mangled, int unknown2, +char* MSVCRT___unDNameEx(char * OutStr, const char* mangled, int OutStrLen, MSVCRT_malloc_func memget, MSVCRT_free_func memfree, - unsigned int flags) + void * unknown, + unsigned short int flags) { - char* ret; - - FIXME("(%d,%s,%d,%p,%p,%x) stub!\n", unknown, mangled, unknown2, memget, memfree, flags); +static int ctr; + FIXME("(%p,%s,%d,%p,%p,%p,%x) stub!\n", + OutStr, mangled, OutStrLen, memget, memfree, unknown, flags); /* FIXME: The code in tools/winebuild/msmangle.c is pretty complete and * could be used here. @@ -164,17 +166,23 @@ * 0x2000 - Unknown, passed by type_info::name() */ /* Duplicate the mangled name; for comparisons it doesn't matter anyway */ - ret = memget(strlen(mangled) + 1); - strcpy(ret, mangled); - return ret; + if( OutStr == NULL) { + OutStrLen = strlen(mangled) + 1; + OutStr = memget( OutStrLen); + } + strncpy( OutStr, mangled, OutStrLen); + return OutStr; } /********************************************************************* - * __unDNameEx (MSVCRT.@) - * Function not really understood but needed to make the DLL work + * __unDName (MSVCRT.@) */ -char* MSVCRT___unDNameEx(void) +char* MSVCRT___unDName(char * OutStr, const char* mangled, int OutStrLen, + MSVCRT_malloc_func memget, + MSVCRT_free_func memfree, + unsigned short int flags) { - return NULL; + return MSVCRT___unDNameEx( OutStr, mangled, OutStrLen, memget, memfree, + NULL, flags); } --- wine/dlls/msvcrt/msvcrt.spec 2004-01-13 09:23:08.000000000 +0100 +++ mywine/dlls/msvcrt/msvcrt.spec 2004-01-13 14:52:17.000000000 +0100 @@ -137,8 +137,8 @@ @ cdecl __threadhandle() kernel32.GetCurrentThread @ cdecl __threadid() kernel32.GetCurrentThreadId @ cdecl __toascii(long) MSVCRT___toascii -@ cdecl __unDName(long str ptr ptr long) MSVCRT___unDName -@ cdecl __unDNameEx() MSVCRT___unDNameEx #FIXME +@ cdecl __unDName(str str long ptr ptr long) MSVCRT___unDName +@ cdecl __unDNameEx(str str long ptr ptr ptr long) MSVCRT___unDNameEx @ extern __unguarded_readlc_active MSVCRT___unguarded_readlc_active @ extern __wargv MSVCRT___wargv @ cdecl __wgetmainargs(ptr ptr ptr long ptr) --- wine/dlls/msvcrt/msvcrt.h 2004-01-13 09:23:08.000000000 +0100 +++ mywine/dlls/msvcrt/msvcrt.h 2004-01-13 14:45:29.000000000 +0100 @@ -75,7 +75,8 @@ typedef void* (*MSVCRT_malloc_func)(MSVCRT_size_t); typedef void (*MSVCRT_free_func)(void*); -extern char* MSVCRT___unDName(int,const char*,int,MSVCRT_malloc_func,MSVCRT_free_func,unsigned int); +extern char* MSVCRT___unDName(char *,const char*,int,MSVCRT_malloc_func,MSVCRT_free_func,unsigned short int); +extern char* MSVCRT___unDNameEx(char *,const char*,int,MSVCRT_malloc_func,MSVCRT_free_func,void *,unsigned short int); /* Setup and teardown multi threaded locks */ extern void msvcrt_init_mt_locks(void);