From 805f0699eb69e5505c2b2df83063cd161d4990b2 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 11 Mar 2004 00:47:49 +0000 Subject: [PATCH] Remove the WINEDEBUG variable from the environment of the debugger process. --- dlls/kernel/except.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/dlls/kernel/except.c b/dlls/kernel/except.c index 5641ee20a04..2e4ddf86359 100644 --- a/dlls/kernel/except.c +++ b/dlls/kernel/except.c @@ -219,11 +219,11 @@ static BOOL start_debugger(PEXCEPTION_POINTERS epointers, HANDLE hEvent) { OBJECT_ATTRIBUTES attr; UNICODE_STRING nameW; + char *cmdline, *env, *p; HKEY hDbgConf; DWORD bAuto = FALSE; PROCESS_INFORMATION info; STARTUPINFOA startup; - char* cmdline; char* format = NULL; BOOL ret = FALSE; @@ -329,12 +329,27 @@ static BOOL start_debugger(PEXCEPTION_POINTERS epointers, HANDLE hEvent) } } + /* remove WINEDEBUG from the environment */ + env = GetEnvironmentStringsA(); + for (p = env; *p; p += strlen(p) + 1) + { + if (!memcmp( p, "WINEDEBUG=", sizeof("WINEDEBUG=")-1 )) + { + char *next = p + strlen(p) + 1; + char *end = next; + while (*end) end += strlen(end) + 1; + memmove( p, next, end + 1 - next ); + break; + } + } + TRACE("Starting debugger %s\n", debugstr_a(cmdline)); memset(&startup, 0, sizeof(startup)); startup.cb = sizeof(startup); startup.dwFlags = STARTF_USESHOWWINDOW; startup.wShowWindow = SW_SHOWNORMAL; - ret = CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &info); + ret = CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, 0, env, NULL, &startup, &info); + FreeEnvironmentStringsA( env ); if (ret) WaitForSingleObject(hEvent, INFINITE); /* wait for debugger to come up... */ else ERR("Couldn't start debugger (%s) (%ld)\n"