Zebediah Figura : dbghelp: Replace another usage of GetEnvironmentVariable() with the target process's environment.

Alexandre Julliard julliard at winehq.org
Sat Aug 1 05:45:56 CDT 2020


Module: wine
Branch: master
Commit: 70b2d181b1547dbe3c2a62e57c6afb0ee903f358
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=70b2d181b1547dbe3c2a62e57c6afb0ee903f358

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Jul 30 17:36:36 2020 -0500

dbghelp: Replace another usage of GetEnvironmentVariable() with the target process's environment.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dbghelp/path.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c
index 82ba032145..a2057947a4 100644
--- a/dlls/dbghelp/path.c
+++ b/dlls/dbghelp/path.c
@@ -755,12 +755,9 @@ BOOL search_dll_path(const struct process *process, const WCHAR *name, BOOL (*ma
         WCHAR env_name[64];
         swprintf(env_name, ARRAY_SIZE(env_name), L"WINEDLLDIR%u", i);
         if (!(env = process_getenv(process, env_name))) return FALSE;
-        len = lstrlenW(env);
-        if (!(buf = heap_alloc((len + lstrlenW(name) + 2) * sizeof(WCHAR)))) return FALSE;
-
-        len = GetEnvironmentVariableW(env_name, buf, len);
-        buf[len++] = '\\';
-        lstrcpyW(buf + len, name);
+        len = wcslen(env) + wcslen(name) + 2;
+        if (!(buf = heap_alloc(len * sizeof(WCHAR)))) return FALSE;
+        swprintf(buf, len, L"%s\\%s", env, name);
         file = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
         if (file != INVALID_HANDLE_VALUE)
         {




More information about the wine-cvs mailing list