ReactOS 0.4.15-dev-7887-g64a59a1
dbghelp.c File Reference
#include "windef.h"
#include "verrsrc.h"
#include "dbghelp.h"
#include "wine/test.h"
Include dependency graph for dbghelp.c:

Go to the source code of this file.

Functions

static void test_stack_walk (void)
 
static void test_search_path (void)
 
 START_TEST (dbghelp)
 

Function Documentation

◆ START_TEST()

START_TEST ( dbghelp  )

Definition at line 193 of file dbghelp.c.

194{
195 BOOL ret;
196
197 /* Don't let the user's environment influence our symbol path */
198 SetEnvironmentVariableA("_NT_SYMBOL_PATH", NULL);
199 SetEnvironmentVariableA("_NT_ALT_SYMBOL_PATH", NULL);
200
202 ok(ret, "got error %u\n", GetLastError());
203
206
208 ok(ret, "got error %u\n", GetLastError());
209}
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
BOOL WINAPI SymInitialize(HANDLE hProcess, PCSTR UserSearchPath, BOOL fInvadeProcess)
Definition: dbghelp.c:534
#define GetCurrentProcess()
Definition: compat.h:759
BOOL WINAPI SymCleanup(HANDLE hProcess)
Definition: dbghelp.c:557
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableA(IN LPCSTR lpName, IN LPCSTR lpValue)
Definition: environ.c:218
unsigned int BOOL
Definition: ntddk_ex.h:94
static void test_stack_walk(void)
Definition: dbghelp.c:129
static void test_search_path(void)
Definition: dbghelp.c:135
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ test_search_path()

static void test_search_path ( void  )
static

Definition at line 135 of file dbghelp.c.

136{
137 char search_path[128];
138 BOOL ret;
139
140 /* The default symbol path is ".[;%_NT_SYMBOL_PATH%][;%_NT_ALT_SYMBOL_PATH%]".
141 * We unset both variables earlier so should simply get "." */
142 ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
143 ok(ret == TRUE, "ret = %d\n", ret);
144 ok(!strcmp(search_path, "."), "Got search path '%s', expected '.'\n", search_path);
145
146 /* Set an arbitrary search path */
148 ok(ret == TRUE, "ret = %d\n", ret);
149 ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
150 ok(ret == TRUE, "ret = %d\n", ret);
151 ok(!strcmp(search_path, "W:\\"), "Got search path '%s', expected 'W:\\'\n", search_path);
152
153 /* Setting to NULL resets to the default */
155 ok(ret == TRUE, "ret = %d\n", ret);
156 ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
157 ok(ret == TRUE, "ret = %d\n", ret);
158 ok(!strcmp(search_path, "."), "Got search path '%s', expected '.'\n", search_path);
159
160 /* With _NT_SYMBOL_PATH */
161 SetEnvironmentVariableA("_NT_SYMBOL_PATH", "X:\\");
163 ok(ret == TRUE, "ret = %d\n", ret);
164 ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
165 ok(ret == TRUE, "ret = %d\n", ret);
166 ok(!strcmp(search_path, ".;X:\\"), "Got search path '%s', expected '.;X:\\'\n", search_path);
167
168 /* With both _NT_SYMBOL_PATH and _NT_ALT_SYMBOL_PATH */
169 SetEnvironmentVariableA("_NT_ALT_SYMBOL_PATH", "Y:\\");
171 ok(ret == TRUE, "ret = %d\n", ret);
172 ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
173 ok(ret == TRUE, "ret = %d\n", ret);
174 ok(!strcmp(search_path, ".;X:\\;Y:\\"), "Got search path '%s', expected '.;X:\\;Y:\\'\n", search_path);
175
176 /* With just _NT_ALT_SYMBOL_PATH */
177 SetEnvironmentVariableA("_NT_SYMBOL_PATH", NULL);
179 ok(ret == TRUE, "ret = %d\n", ret);
180 ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
181 ok(ret == TRUE, "ret = %d\n", ret);
182 ok(!strcmp(search_path, ".;Y:\\"), "Got search path '%s', expected '.;Y:\\'\n", search_path);
183
184 /* Restore original search path */
185 SetEnvironmentVariableA("_NT_ALT_SYMBOL_PATH", NULL);
187 ok(ret == TRUE, "ret = %d\n", ret);
188 ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
189 ok(ret == TRUE, "ret = %d\n", ret);
190 ok(!strcmp(search_path, "."), "Got search path '%s', expected '.'\n", search_path);
191}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define ARRAY_SIZE(A)
Definition: main.h:33
BOOL WINAPI SymSetSearchPath(HANDLE hProcess, PCSTR searchPath)
Definition: dbghelp.c:263
BOOL WINAPI SymGetSearchPath(HANDLE hProcess, PSTR szSearchPath, DWORD SearchPathLength)
Definition: dbghelp.c:299

Referenced by START_TEST().

◆ test_stack_walk()

static void test_stack_walk ( void  )
static

Definition at line 129 of file dbghelp.c.

130{
131}

Referenced by START_TEST().