mirror of
https://github.com/Cr4sh/KernelForge
synced 2026-06-08 10:43:38 +00:00
51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
#include "stdafx.h"
|
|
//--------------------------------------------------------------------------------------
|
|
#ifdef DBG
|
|
|
|
void DbgMsg(char *lpszFile, int Line, char *lpszMsg, ...)
|
|
{
|
|
va_list arg_list;
|
|
va_start(arg_list, lpszMsg);
|
|
|
|
int Len = _vscprintf(lpszMsg, arg_list) + MAX_PATH;
|
|
|
|
char *lpszBuff = (char *)M_ALLOC(Len);
|
|
if (lpszBuff == NULL)
|
|
{
|
|
va_end(arg_list);
|
|
return;
|
|
}
|
|
|
|
char *lpszOutBuff = (char *)M_ALLOC(Len);
|
|
if (lpszOutBuff == NULL)
|
|
{
|
|
M_FREE(lpszBuff);
|
|
va_end(arg_list);
|
|
return;
|
|
}
|
|
|
|
vsprintf(lpszBuff, lpszMsg, arg_list);
|
|
va_end(arg_list);
|
|
|
|
sprintf(lpszOutBuff, "%s(%d) : %s", GetNameFromFullPath(lpszFile), Line, lpszBuff);
|
|
|
|
// write message into the debug output
|
|
OutputDebugStringA(lpszOutBuff);
|
|
|
|
HANDLE hStd = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
if (hStd != INVALID_HANDLE_VALUE)
|
|
{
|
|
DWORD dwWritten = 0;
|
|
|
|
// write message into the console
|
|
WriteFile(hStd, lpszOutBuff, lstrlen(lpszOutBuff), &dwWritten, NULL);
|
|
}
|
|
|
|
M_FREE(lpszBuff);
|
|
M_FREE(lpszOutBuff);
|
|
}
|
|
|
|
#endif // DBG
|
|
//--------------------------------------------------------------------------------------
|
|
// EoF
|