[PATCH] dbghelp: Replace another usage of GetEnvironmentVariable() with the target process's environment.
Fixes: 2b0977fc711e1faadfef69e3a46c2d1848b4826b Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> --- 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 82ba032145e..a2057947a42 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) { -- 2.27.0
participants (2)
-
Jacek Caban -
Zebediah Figura