From 9e1f9ec19e46a576f8921658ecc7fb1a7e7b032c Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Wed, 21 Feb 2007 21:55:41 +0100 Subject: [PATCH] dbghelp: Implemented SearchTreeForFileW. --- dlls/dbghelp/dbghelp.spec | 4 ++-- dlls/dbghelp/path.c | 26 ++++++++++++++++++++++---- include/dbghelp.h | 1 + 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/dlls/dbghelp/dbghelp.spec b/dlls/dbghelp/dbghelp.spec index 0b5a1e40f35..7c0433b7504 100644 --- a/dlls/dbghelp/dbghelp.spec +++ b/dlls/dbghelp/dbghelp.spec @@ -26,8 +26,8 @@ @ stdcall MapDebugInformation(long str str long) @ stdcall MiniDumpReadDumpStream(ptr long ptr ptr ptr) @ stdcall MiniDumpWriteDump(ptr long ptr long long long long) -@ stdcall SearchTreeForFile(str str str) -@ stub SearchTreeForFileW +@ stdcall SearchTreeForFile(str str ptr) +@ stdcall SearchTreeForFileW(wstr wstr ptr) @ stdcall StackWalk(long long long ptr ptr ptr ptr ptr ptr) @ stdcall StackWalk64(long long long ptr ptr ptr ptr ptr ptr) @ stub SymAddSymbol diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c index fb7300f219d..d1273b6ebf1 100644 --- a/dlls/dbghelp/path.c +++ b/dlls/dbghelp/path.c @@ -272,15 +272,33 @@ static BOOL do_search(const char* file, char* buffer, BOOL recurse, return found; } +/*********************************************************************** + * SearchTreeForFileW (DBGHELP.@) + */ +BOOL WINAPI SearchTreeForFileW(PCWSTR root, PCWSTR file, PWSTR buffer) +{ + TRACE("(%s, %s, %p)\n", + debugstr_w(root), debugstr_w(file), buffer); + strcpyW(buffer, root); + return do_searchW(file, buffer, TRUE, NULL, NULL); +} + /*********************************************************************** * SearchTreeForFile (DBGHELP.@) */ BOOL WINAPI SearchTreeForFile(PCSTR root, PCSTR file, PSTR buffer) { - TRACE("(%s, %s, %p)\n", - debugstr_a(root), debugstr_a(file), buffer); - strcpy(buffer, root); - return do_search(file, buffer, TRUE, NULL, NULL); + WCHAR rootW[MAX_PATH]; + WCHAR fileW[MAX_PATH]; + WCHAR bufferW[MAX_PATH]; + BOOL ret; + + MultiByteToWideChar(CP_ACP, 0, root, -1, rootW, MAX_PATH); + MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH); + ret = SearchTreeForFileW(rootW, fileW, bufferW); + if (ret) + WideCharToMultiByte(CP_ACP, 0, bufferW, -1, buffer, MAX_PATH, NULL, NULL); + return ret; } /****************************************************************** diff --git a/include/dbghelp.h b/include/dbghelp.h index 53c37834101..2752f47026b 100644 --- a/include/dbghelp.h +++ b/include/dbghelp.h @@ -1020,6 +1020,7 @@ BOOL WINAPI SymSetSearchPathW(HANDLE, PCWSTR); DWORD WINAPI GetTimestampForLoadedLibrary(HMODULE); BOOL WINAPI MakeSureDirectoryPathExists(PCSTR); BOOL WINAPI SearchTreeForFile(PCSTR, PCSTR, PSTR); +BOOL WINAPI SearchTreeForFileW(PCWSTR, PCWSTR, PWSTR); typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACK)(LPCSTR, PVOID); BOOL WINAPI EnumDirTree(HANDLE, PCSTR, PCSTR, PSTR, PENUMDIRTREE_CALLBACK, void*); typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACKW)(LPCWSTR, PVOID);