]> git.cworth.org Git - apitrace/blobdiff - os_win32.cpp
Update ignore.
[apitrace] / os_win32.cpp
old mode 100755 (executable)
new mode 100644 (file)
index e96cc93..f9fb56a
@@ -28,7 +28,7 @@
 #include <stdio.h>
 
 #include "os.hpp"
-#include "log.hpp"
+#include "trace_write.hpp"
 
 
 namespace OS {
@@ -46,14 +46,14 @@ CriticalSection = {
 void
 AcquireMutex(void)
 {
-    //EnterCriticalSection(&CriticalSection); 
+    EnterCriticalSection(&CriticalSection); 
 }
 
 
 void
 ReleaseMutex(void)
 {
-    //LeaveCriticalSection(&CriticalSection); 
+    LeaveCriticalSection(&CriticalSection); 
 }
 
 
@@ -89,12 +89,20 @@ GetCurrentDir(char *str, size_t size)
 }
 
 void
-DebugMessage(const char *message)
+DebugMessage(const char *format, ...)
 {
-   OutputDebugStringA(message);
+   char buf[4096];
+
+   va_list ap;
+   va_start(ap, format);
+   fflush(stdout);
+   vsnprintf(buf, sizeof buf, format, ap);
+   va_end(ap);
+
+   OutputDebugStringA(buf);
    if (!IsDebuggerPresent()) {
       fflush(stdout);
-      fputs(message, stderr);
+      fputs(buf, stderr);
       fflush(stderr);
    }
 }
@@ -123,7 +131,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
     case DLL_THREAD_DETACH:
         return TRUE;
     case DLL_PROCESS_DETACH:
-        Log::Close();
+        Trace::Close();
         return TRUE;
     }
     (void)hinstDLL;