Re: implement dbghelp's C++ name undecoration on top of msvcrt's

2004-11-09 Thread Alexandre Julliard
Eric Pouech [EMAIL PROTECTED] writes:

 diff -u -u -r1.1 Makefile.in
 --- dlls/dbghelp/Makefile.in  5 Apr 2004 22:21:27 -   1.1
 +++ dlls/dbghelp/Makefile.in  6 Nov 2004 14:28:59 -
 @@ -4,6 +4,7 @@
  VPATH = @srcdir@
  MODULE= dbghelp.dll
  IMPORTS   = psapi kernel32 ntdll
 +DELAYIMPORTS = msvcrt

You don't want to import msvcrt from other dlls, that won't work
right. You can do an explicit LoadLibrary/GetProcAddress though.

-- 
Alexandre Julliard
[EMAIL PROTECTED]



Re: implement dbghelp's C++ name undecoration on top of msvcrt's

2004-11-06 Thread Eric Pouech
Eric Pouech a écrit :
see Changelog for the details
A+
with the patch this time.
A+
Name:  dbghelp_undname
ChangeLog: implement SymUnDName and UndecorateSymbolName on top of msvcrt.__unDName
License:   X11
GenDate:   2004/11/06 18:24:05 UTC
ModifiedFiles: dlls/dbghelp/Makefile.in dlls/dbghelp/symbol.c
AddedFiles:
RemovedFiles:  
===
RCS file: /home/cvs/cvsroot/wine/wine/dlls/dbghelp/Makefile.in,v
retrieving revision 1.1
diff -u -u -r1.1 Makefile.in
--- dlls/dbghelp/Makefile.in	5 Apr 2004 22:21:27 -	1.1
+++ dlls/dbghelp/Makefile.in	6 Nov 2004 14:28:59 -
@@ -4,6 +4,7 @@
 VPATH = @srcdir@
 MODULE= dbghelp.dll
 IMPORTS   = psapi kernel32 ntdll
+DELAYIMPORTS = msvcrt
 
 C_SRCS = \
 	dbghelp.c \
Index: dlls/dbghelp/symbol.c
===
RCS file: /home/cvs/cvsroot/wine/wine/dlls/dbghelp/symbol.c,v
retrieving revision 1.12
diff -u -u -r1.12 symbol.c
--- dlls/dbghelp/symbol.c	11 Oct 2004 21:00:17 -	1.12
+++ dlls/dbghelp/symbol.c	15 Oct 2004 18:52:55 -
@@ -1186,21 +1186,29 @@
  */
 BOOL WINAPI SymUnDName(PIMAGEHLP_SYMBOL sym, LPSTR UnDecName, DWORD UnDecNameLength)
 {
-FIXME((%p %s %lu): stub\n, sym, UnDecName, UnDecNameLength);
+TRACE((%p %s %lu): stub\n, sym, UnDecName, UnDecNameLength);
 return UnDecorateSymbolName(sym-Name, UnDecName, UnDecNameLength, 
-UNDNAME_COMPLETE);
+UNDNAME_COMPLETE) != 0;
 }
 
+/* undocumented from msvcrt */
+extern char* __unDName(char*, const char*, int, void* (*)(size_t), void (*)(void*), unsigned short);
+
+static void* und_alloc(size_t len) { return HeapAlloc(GetProcessHeap(), 0, len); }
+static void  und_free (void* ptr)  { HeapFree(GetProcessHeap(), 0, ptr); }
+
 /***
  *		UnDecorateSymbolName (DBGHELP.@)
  */
 DWORD WINAPI UnDecorateSymbolName(LPCSTR DecoratedName, LPSTR UnDecoratedName,
   DWORD UndecoratedLength, DWORD Flags)
 {
-FIXME((%s, %p, %ld, 0x%08lx): stub\n,
+TRACE((%s, %p, %ld, 0x%08lx): stub\n,
   debugstr_a(DecoratedName), UnDecoratedName, UndecoratedLength, Flags);
 
-strncpy(UnDecoratedName, DecoratedName, UndecoratedLength);
-UnDecoratedName[UndecoratedLength - 1] = '\0';
-return TRUE;
+if (!UnDecoratedName) return 0;
+if (!__unDName(UnDecoratedName, DecoratedName, UndecoratedLength, 
+   und_alloc, und_free, Flags))
+return 0;
+return strlen(UnDecoratedName);
 }