From bee641fd6ef998fef994038e45b62f34f09eb178 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 24 Mar 2010 13:35:57 -0500 Subject: [PATCH] mscoree: Add a setting to access mono's tracing functionality. --- dlls/mscoree/mscoree_main.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c index dcdc91a..f9d8070 100644 --- a/dlls/mscoree/mscoree_main.c +++ b/dlls/mscoree/mscoree_main.c @@ -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)); -- 1.6.3.3