#include <stdio.h>
#include "os.hpp"
-#include "log.hpp"
+#include "trace_write.hpp"
namespace OS {
void
AcquireMutex(void)
{
- //EnterCriticalSection(&CriticalSection);
+ EnterCriticalSection(&CriticalSection);
}
void
ReleaseMutex(void)
{
- //LeaveCriticalSection(&CriticalSection);
+ LeaveCriticalSection(&CriticalSection);
}
}
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);
}
}
case DLL_THREAD_DETACH:
return TRUE;
case DLL_PROCESS_DETACH:
- Log::Close();
+ Trace::Close();
return TRUE;
}
(void)hinstDLL;