⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keycommon.cpp

📁 对PKCS11接口的封装
💻 CPP
字号:
/*===========================================================================


===========================================================================

		说明:

			通用函数 支持平台:WIN98/2K/XP...

		文件名:	

			EpassCommon.cpp
---------------------------------------------------------------------------
		描述:		

			调试函数,公共变量

---------------------------------------------------------------------------
*===========================================================================*/

#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
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -