Commit bb280298 authored by Thomas Faber's avatar Thomas Faber Committed by Alexandre Julliard

dbghelp: Use . instead of concrete path for search path.

parent 6bedd7cc
......@@ -178,29 +178,36 @@ struct cpu* cpu_find(DWORD machine)
static WCHAR* make_default_search_path(void)
{
WCHAR* search_path;
unsigned size;
unsigned len;
search_path = HeapAlloc(GetProcessHeap(), 0, (len = MAX_PATH) * sizeof(WCHAR));
while ((size = GetCurrentDirectoryW(len, search_path)) >= len)
search_path = HeapReAlloc(GetProcessHeap(), 0, search_path, (len *= 2) * sizeof(WCHAR));
search_path = HeapReAlloc(GetProcessHeap(), 0, search_path, (size + 1) * sizeof(WCHAR));
len = GetEnvironmentVariableW(L"_NT_SYMBOL_PATH", NULL, 0);
if (len)
WCHAR* p;
unsigned sym_path_len;
unsigned alt_sym_path_len;
sym_path_len = GetEnvironmentVariableW(L"_NT_SYMBOL_PATH", NULL, 0);
alt_sym_path_len = GetEnvironmentVariableW(L"_NT_ALTERNATE_SYMBOL_PATH", NULL, 0);
/* The default symbol path is ".[;%_NT_SYMBOL_PATH%][;%_NT_ALTERNATE_SYMBOL_PATH%]".
* If the variables exist, the lengths include a null-terminator. We use that
* space for the semicolons, and only add the initial dot and the final null. */
search_path = HeapAlloc(GetProcessHeap(), 0,
(1 + sym_path_len + alt_sym_path_len + 1) * sizeof(WCHAR));
if (!search_path) return NULL;
p = search_path;
*p++ = L'.';
if (sym_path_len)
{
search_path = HeapReAlloc(GetProcessHeap(), 0, search_path, (size + 1 + len + 1) * sizeof(WCHAR));
search_path[size] = ';';
GetEnvironmentVariableW(L"_NT_SYMBOL_PATH", search_path + size + 1, len);
size += 1 + len;
*p++ = L';';
GetEnvironmentVariableW(L"_NT_SYMBOL_PATH", p, sym_path_len);
p += sym_path_len - 1;
}
len = GetEnvironmentVariableW(L"_NT_ALTERNATE_SYMBOL_PATH", NULL, 0);
if (len)
if (alt_sym_path_len)
{
search_path = HeapReAlloc(GetProcessHeap(), 0, search_path, (size + 1 + len + 1) * sizeof(WCHAR));
search_path[size] = ';';
GetEnvironmentVariableW(L"_NT_ALTERNATE_SYMBOL_PATH", search_path + size + 1, len);
*p++ = L';';
GetEnvironmentVariableW(L"_NT_ALTERNATE_SYMBOL_PATH", p, alt_sym_path_len);
p += alt_sym_path_len - 1;
}
*p = L'\0';
return search_path;
}
......
......@@ -141,7 +141,6 @@ static void test_search_path(void)
* We unset both variables earlier so should simply get "." */
ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
ok(ret == TRUE, "ret = %d\n", ret);
todo_wine
ok(!strcmp(search_path, "."), "Got search path '%s', expected '.'\n", search_path);
/* Set an arbitrary search path */
......@@ -156,7 +155,6 @@ static void test_search_path(void)
ok(ret == TRUE, "ret = %d\n", ret);
ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
ok(ret == TRUE, "ret = %d\n", ret);
todo_wine
ok(!strcmp(search_path, "."), "Got search path '%s', expected '.'\n", search_path);
/* With _NT_SYMBOL_PATH */
......@@ -165,7 +163,6 @@ static void test_search_path(void)
ok(ret == TRUE, "ret = %d\n", ret);
ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
ok(ret == TRUE, "ret = %d\n", ret);
todo_wine
ok(!strcmp(search_path, ".;X:\\"), "Got search path '%s', expected '.;X:\\'\n", search_path);
/* With both _NT_SYMBOL_PATH and _NT_ALT_SYMBOL_PATH */
......@@ -192,7 +189,6 @@ static void test_search_path(void)
ok(ret == TRUE, "ret = %d\n", ret);
ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
ok(ret == TRUE, "ret = %d\n", ret);
todo_wine
ok(!strcmp(search_path, "."), "Got search path '%s', expected '.'\n", search_path);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment