Commit 950da26b authored by Rein Klazes's avatar Rein Klazes Committed by Alexandre Julliard

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().
parent 3d6eb2db
......@@ -123,30 +123,31 @@ void MSVCRT_I10_OUTPUT(void)
}
/*********************************************************************
* __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);
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 +165,23 @@ char* MSVCRT___unDName(int unknown, const char* mangled, int unknown2,
* 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);
}
......@@ -75,7 +75,8 @@ void MSVCRT_operator_delete(void*);
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);
......
......@@ -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(ptr str long ptr ptr long) MSVCRT___unDName
@ cdecl __unDNameEx(ptr 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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment