mscoree: Add a setting to access mono's tracing functionality.

This commit is contained in:
Vincent Povirk 2010-03-24 13:35:57 -05:00 committed by Alexandre Julliard
parent 929bac964a
commit b8c7dec6b8
1 changed files with 19 additions and 0 deletions

View File

@ -144,6 +144,11 @@ __int32 WINAPI _CorExeMain(void)
PROCESS_INFORMATION pi;
WCHAR *mono_exe, *cmd_line;
DWORD size, exit_code;
static const WCHAR WINE_MONO_TRACE[]={'W','I','N','E','_','M','O','N','O','_','T','R','A','C','E',0};
static const WCHAR trace_switch_start[]={'"','-','-','t','r','a','c','e','=',0};
static const WCHAR trace_switch_end[]={'"',' ',0};
int trace_size;
WCHAR trace_setting[256];
if (!(mono_exe = get_mono_exe()))
{
@ -151,7 +156,13 @@ __int32 WINAPI _CorExeMain(void)
return -1;
}
trace_size = GetEnvironmentVariableW(WINE_MONO_TRACE, trace_setting, sizeof(trace_setting)/sizeof(WCHAR));
size = (lstrlenW(mono_exe) + lstrlenW(GetCommandLineW()) + 1) * sizeof(WCHAR);
if (trace_size)
size += (trace_size + lstrlenW(trace_switch_start) + lstrlenW(trace_switch_end)) * sizeof(WCHAR);
if (!(cmd_line = HeapAlloc(GetProcessHeap(), 0, size)))
{
HeapFree(GetProcessHeap(), 0, mono_exe);
@ -160,6 +171,14 @@ __int32 WINAPI _CorExeMain(void)
lstrcpyW(cmd_line, mono_exe);
HeapFree(GetProcessHeap(), 0, mono_exe);
if (trace_size)
{
lstrcatW(cmd_line, trace_switch_start);
lstrcatW(cmd_line, trace_setting);
lstrcatW(cmd_line, trace_switch_end);
}
lstrcatW(cmd_line, GetCommandLineW());
TRACE("new command line: %s\n", debugstr_w(cmd_line));