diff options
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/win32/debug-win32.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/uisimulator/win32/debug-win32.c b/uisimulator/win32/debug-win32.c index 3152862d37..520473dd71 100644 --- a/uisimulator/win32/debug-win32.c +++ b/uisimulator/win32/debug-win32.c | |||
@@ -18,6 +18,7 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | #include <windows.h> | 20 | #include <windows.h> |
21 | #include <stdio.h> | ||
21 | 22 | ||
22 | char debugmembuf[100]; | 23 | char debugmembuf[100]; |
23 | char debugbuf[200]; | 24 | char debugbuf[200]; |
@@ -25,7 +26,25 @@ char debugbuf[200]; | |||
25 | 26 | ||
26 | void debug( const char *message ) | 27 | void debug( const char *message ) |
27 | { | 28 | { |
28 | OutputDebugString (message); | 29 | static int debugger = -1; |
30 | |||
31 | if (debugger == -1) | ||
32 | { | ||
33 | HINSTANCE hInst = LoadLibrary("kernel32.dll"); | ||
34 | debugger = 0; | ||
35 | |||
36 | if (hInst != NULL) | ||
37 | { | ||
38 | FARPROC pIsDebuggerPresent = GetProcAddress(hInst, "IsDebuggerPresent"); | ||
39 | if (pIsDebuggerPresent != NULL) | ||
40 | debugger = pIsDebuggerPresent(); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | if (debugger) | ||
45 | OutputDebugString (message); | ||
46 | else | ||
47 | printf("%s", message); | ||
29 | } | 48 | } |
30 | 49 | ||
31 | void debugf(char *fmt, ...) | 50 | void debugf(char *fmt, ...) |