?? keycommon.cpp
字號:
/*===========================================================================
===========================================================================
說明:
通用函數(shù) 支持平臺:WIN98/2K/XP...
文件名:
EpassCommon.cpp
---------------------------------------------------------------------------
描述:
調(diào)試函數(shù),公共變量
---------------------------------------------------------------------------
*===========================================================================*/
#include "stdafx.h"
#include "KeyCommon.h"
PCHAR DebugOutTime()
{
GetLocalTime(&DebugTime);
ZeroMemory(strTime, ARRAYSIZEOF(strTime));
sprintf(strTime, "%d:%d:%d:%04d",
DebugTime.wHour, DebugTime.wMinute, DebugTime.wSecond, DebugTime.wMilliseconds);
return strTime;
}
void OSReportWithBacktrace(LPCSTR strFormate, ...)
{
#ifdef _DEBUG
ZeroMemory(cbRepDebugBuf, ARRAYSIZEOF(cbRepDebugBuf));
va_list args;
va_start(args, strFormate);
_vsnprintf( cbRepDebugBuf, ARRAYSIZEOF(cbRepDebugBuf), strFormate, args);
va_end(args);
OutputDebugString (cbRepDebugBuf);
#endif
}
void DebugOutStr(LPCSTR strFormate, ...)
{
#ifdef _DEBUG
if(strFormate)
{
char cDebugBuf[4096] = {0};
va_list args;
va_start(args, strFormate);
_vsnprintf(cDebugBuf, ARRAYSIZEOF(cDebugBuf), strFormate, args);
va_end(args);
OSReportWithBacktrace("....[INFORMATION %s]\tInfo = %s.\n",
DebugOutTime(), cDebugBuf);
}
#endif
}
void DebugOutHex(LPSTR strFormate, PBYTE pbData, DWORD cbDataLen)
{
#ifdef _DEBUG
if(NULL_PTR != strFormate && NULL_PTR != pbData)
{
char*pszBuf = cbHexDebugBuf;
ZeroMemory(cbHexDebugBuf, ARRAYSIZEOF(cbHexDebugBuf));
for(DWORD id = 0; id < cbDataLen && cbDataLen < ARRAYSIZEOF(cbHexDebugBuf); id++)
{
sprintf(pszBuf, "0x%02x ", pbData[id]);
pszBuf += 5;
}
OSReportWithBacktrace("....[INFORMATION %s]\t%s Hex Value [%d] = %s.\n",
DebugOutTime(), strFormate, cbDataLen, cbHexDebugBuf);
}
#endif
}
void DebugOutPosition(LPCSTR strFile, ULONG ulLine)
{
#ifdef _DEBUG
if(strFile)
{
OSReportWithBacktrace("....[LOCATION %s]\tLines = %d, File= %s.\n",
DebugOutTime(), ulLine, strFile);
}
#endif
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -