[2/2] dbghelp: Implement SymMatchStringW

André Hentschel nerv at dawncrow.de
Mon Oct 31 14:08:00 CDT 2011


---
 dlls/dbghelp/dbghelp.spec |    2 +-
 dlls/dbghelp/symbol.c     |   29 +++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/dlls/dbghelp/dbghelp.spec b/dlls/dbghelp/dbghelp.spec
index 926218b..5b48ae5 100644
--- a/dlls/dbghelp/dbghelp.spec
+++ b/dlls/dbghelp/dbghelp.spec
@@ -139,7 +139,7 @@
 @ stdcall SymMatchFileNameW(wstr wstr ptr ptr)
 @ stdcall SymMatchString(str str long) SymMatchStringA
 @ stdcall SymMatchStringA(str str long)
-@ stub SymMatchStringW
+@ stdcall SymMatchStringW(wstr wstr long)
 @ stub SymNext
 @ stub SymNextW
 @ stub SymPrev
diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c
index 4ee0695..add3a1a 100644
--- a/dlls/dbghelp/symbol.c
+++ b/dlls/dbghelp/symbol.c
@@ -1891,6 +1891,35 @@ BOOL WINAPI SymMatchStringA(PCSTR string, PCSTR re, BOOL _case)
 }
 
 /******************************************************************
+ *		SymMatchStringW (DBGHELP.@)
+ *
+ * FIXME: SymMatchStringA should convert and pass the strings to SymMatchStringW,
+ *        but that needs a unicode RE library.
+ */
+BOOL WINAPI SymMatchStringW(PCWSTR string, PCWSTR re, BOOL _case)
+{
+    BOOL ret;
+    LPSTR s, r;
+    DWORD len;
+
+    TRACE("%s %s %c\n", debugstr_w(string), debugstr_w(re), _case ? 'Y' : 'N');
+
+    len = WideCharToMultiByte( CP_ACP, 0, string, -1, NULL, 0, NULL, NULL );
+    s = HeapAlloc( GetProcessHeap(), 0, len );
+    WideCharToMultiByte( CP_ACP, 0, string, -1, s, len, NULL, NULL );
+
+    len = WideCharToMultiByte( CP_ACP, 0, re, -1, NULL, 0, NULL, NULL );
+    r = HeapAlloc( GetProcessHeap(), 0, len );
+    WideCharToMultiByte( CP_ACP, 0, re, -1, r, len, NULL, NULL );
+
+    ret = SymMatchStringA(s, r, _case);
+
+    HeapFree( GetProcessHeap(), 0, r );
+    HeapFree( GetProcessHeap(), 0, s );
+    return ret;
+}
+
+/******************************************************************
  *		SymSearch (DBGHELP.@)
  */
 BOOL WINAPI SymSearch(HANDLE hProcess, ULONG64 BaseOfDll, DWORD Index,
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list