summaryrefslogtreecommitdiff
path: root/uisimulator/win32/debug-win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/win32/debug-win32.c')
-rw-r--r--uisimulator/win32/debug-win32.c21
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
22char debugmembuf[100]; 23char debugmembuf[100];
23char debugbuf[200]; 24char debugbuf[200];
@@ -25,7 +26,25 @@ char debugbuf[200];
25 26
26void debug( const char *message ) 27void 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
31void debugf(char *fmt, ...) 50void debugf(char *fmt, ...)