Unify all log recording in the program
This commit is contained in:
@@ -371,7 +371,7 @@ VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName
|
||||
EnterCriticalSection(&m_cs);
|
||||
if (IsExitItem(m_CList_Online, (ULONG_PTR)ContextObject)) {
|
||||
LeaveCriticalSection(&m_cs);
|
||||
OutputDebugStringA(CString("===> '") + strIP + CString("' already exist!!\n"));
|
||||
Mprintf(CString("===> '") + strIP + CString("' already exist!!\n"));
|
||||
return;
|
||||
}
|
||||
//Ĭ<><C4AC>Ϊ0<CEAA><30> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -641,11 +641,11 @@ void CMy2015RemoteDlg::OnClose()
|
||||
{
|
||||
// <20><><EFBFBD>ش<EFBFBD><D8B4>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD>ǹر<C7B9>
|
||||
ShowWindow(SW_HIDE);
|
||||
OutputDebugStringA("======> Hide\n");
|
||||
Mprintf("======> Hide\n");
|
||||
}
|
||||
|
||||
void CMy2015RemoteDlg::Release(){
|
||||
OutputDebugStringA("======> Release\n");
|
||||
Mprintf("======> Release\n");
|
||||
isClosed = TRUE;
|
||||
ShowWindow(SW_HIDE);
|
||||
|
||||
@@ -1101,7 +1101,7 @@ BOOL CMy2015RemoteDlg::Activate(int nPort,int nMaxConnection)
|
||||
UINT ret = 0;
|
||||
if ( (ret=m_iocpServer->StartServer(NotifyProc, OfflineProc, nPort)) !=0 )
|
||||
{
|
||||
OutputDebugStringA("======> StartServer Failed \n");
|
||||
Mprintf("======> StartServer Failed \n");
|
||||
char code[32];
|
||||
sprintf_s(code, "%d", ret);
|
||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD>StartServerʧ<EFBFBD><EFBFBD>! <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:"+CString(code));
|
||||
@@ -1339,7 +1339,7 @@ LRESULT CMy2015RemoteDlg::OnUserToOnlineList(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
char buf[100];
|
||||
sprintf_s(buf, "*** Received [%s] invalid login data! ***\n", inet_ntoa(ClientAddr.sin_addr));
|
||||
OutputDebugStringA(buf);
|
||||
Mprintf(buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1368,7 +1368,7 @@ LRESULT CMy2015RemoteDlg::OnUserToOnlineList(WPARAM wParam, LPARAM lParam)
|
||||
delete LoginInfor;
|
||||
return S_OK;
|
||||
}catch(...){
|
||||
OutputDebugStringA("[ERROR] OnUserToOnlineList catch an error \n");
|
||||
Mprintf("[ERROR] OnUserToOnlineList catch an error \n");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -1376,7 +1376,7 @@ LRESULT CMy2015RemoteDlg::OnUserToOnlineList(WPARAM wParam, LPARAM lParam)
|
||||
|
||||
LRESULT CMy2015RemoteDlg::OnUserOfflineMsg(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
OutputDebugStringA("======> OnUserOfflineMsg\n");
|
||||
Mprintf("======> OnUserOfflineMsg\n");
|
||||
CString ip, port;
|
||||
port.Format("%d", lParam);
|
||||
EnterCriticalSection(&m_cs);
|
||||
|
||||
@@ -947,18 +947,18 @@ void CFileManagerDlg::OnReceiveComplete()
|
||||
}
|
||||
catch (CMemoryException* e)
|
||||
{
|
||||
OutputDebugStringA("[ERROR] CMemoryException\n");
|
||||
Mprintf("[ERROR] CMemoryException\n");
|
||||
}
|
||||
catch (CFileException* e)
|
||||
{
|
||||
OutputDebugStringA("[ERROR] CFileException\n");
|
||||
Mprintf("[ERROR] CFileException\n");
|
||||
}
|
||||
catch (CException* e)
|
||||
{
|
||||
OutputDebugStringA("[ERROR] CException\n");
|
||||
Mprintf("[ERROR] CException\n");
|
||||
}
|
||||
catch (...) {
|
||||
OutputDebugStringA("[ERROR] Other exception\n");
|
||||
Mprintf("[ERROR] Other exception\n");
|
||||
}
|
||||
break;
|
||||
case TOKEN_FILE_SIZE: // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʱ<EFBFBD>ĵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
|
||||
@@ -329,7 +329,7 @@ BOOL IOCPServer::InitializeIOCP(VOID)
|
||||
|
||||
DWORD IOCPServer::WorkThreadProc(LPVOID lParam)
|
||||
{
|
||||
OutputDebugStringA("======> IOCPServer WorkThreadProc begin \n");
|
||||
Mprintf("======> IOCPServer WorkThreadProc begin \n");
|
||||
|
||||
IOCPServer* This = (IOCPServer*)(lParam);
|
||||
|
||||
@@ -362,7 +362,7 @@ DWORD IOCPServer::WorkThreadProc(LPVOID lParam)
|
||||
if (ContextObject && This->m_bTimeToKill == FALSE &&dwTrans==0)
|
||||
{
|
||||
ContextObject->olps = NULL;
|
||||
OutputDebugStringA("!!! RemoveStaleContext \n");
|
||||
Mprintf("!!! RemoveStaleContext \n");
|
||||
This->RemoveStaleContext(ContextObject);
|
||||
}
|
||||
SAFE_DELETE(OverlappedPlus);
|
||||
@@ -416,7 +416,7 @@ DWORD IOCPServer::WorkThreadProc(LPVOID lParam)
|
||||
ContextObject = NULL;
|
||||
}
|
||||
catch (...) {
|
||||
OutputDebugStringA("This->HandleIO catched an error!!!");
|
||||
Mprintf("This->HandleIO catched an error!!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,7 +432,7 @@ DWORD IOCPServer::WorkThreadProc(LPVOID lParam)
|
||||
if (n == 0) {
|
||||
Mprintf("======> IOCPServer All WorkThreadProc done\n");
|
||||
}
|
||||
OutputDebugStringA("======> IOCPServer WorkThreadProc end \n");
|
||||
Mprintf("======> IOCPServer WorkThreadProc end \n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -454,7 +454,7 @@ BOOL IOCPServer::HandleIO(IOType PacketFlags,PCONTEXT_OBJECT ContextObject, DWOR
|
||||
bRet = OnClientPostSending(ContextObject,dwTrans);
|
||||
break;
|
||||
case IOIdle:
|
||||
OutputDebugStringA("=> HandleIO PacketFlags= IOIdle\n");
|
||||
Mprintf("=> HandleIO PacketFlags= IOIdle\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -512,7 +512,7 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans
|
||||
ContextObject->Decode(CompressedBuffer, ulOriginalLength);
|
||||
m_NotifyProc(ContextObject);
|
||||
SAFE_DELETE_ARRAY(CompressedBuffer);
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
bool usingZstd = ContextObject->CompressMethod == COMPRESS_ZSTD, zlibFailed = false;
|
||||
PBYTE DeCompressedBuffer = new BYTE[ulOriginalLength]; //<2F><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>
|
||||
@@ -522,7 +522,6 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans
|
||||
if (usingZstd ? C_SUCCESS(iRet) : (S_OK==iRet))
|
||||
{
|
||||
ContextObject->InDeCompressedBuffer.ClearBuffer();
|
||||
//ContextObject->InCompressedBuffer.ClearBuffer();
|
||||
ContextObject->InDeCompressedBuffer.WriteBuffer(DeCompressedBuffer, ulOriginalLength);
|
||||
ContextObject->Decode(DeCompressedBuffer, ulOriginalLength);
|
||||
m_NotifyProc(ContextObject); //֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>
|
||||
@@ -544,7 +543,7 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans
|
||||
delete [] CompressedBuffer;
|
||||
delete [] DeCompressedBuffer;
|
||||
if (zlibFailed) {
|
||||
OutputDebugStringA("[ERROR] ZLIB uncompress failed \n");
|
||||
Mprintf("[ERROR] ZLIB uncompress failed \n");
|
||||
throw "Bad Buffer";
|
||||
}
|
||||
}else{
|
||||
@@ -553,7 +552,7 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans
|
||||
}
|
||||
}catch(...)
|
||||
{
|
||||
OutputDebugStringA("[ERROR] OnClientReceiving catch an error \n");
|
||||
Mprintf("[ERROR] OnClientReceiving catch an error \n");
|
||||
ContextObject->InCompressedBuffer.ClearBuffer();
|
||||
ContextObject->InDeCompressedBuffer.ClearBuffer();
|
||||
}
|
||||
@@ -574,7 +573,7 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe
|
||||
else {
|
||||
memcpy(buf, szBuffer, ulOriginalLength);
|
||||
}
|
||||
OutputDebugStringA("[COMMAND] Send: " + CString(buf) + "\r\n");
|
||||
Mprintf("[COMMAND] Send: " + CString(buf) + "\r\n");
|
||||
}
|
||||
try
|
||||
{
|
||||
@@ -582,7 +581,7 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe
|
||||
{
|
||||
if (ulOriginalLength <= 0) return;
|
||||
if (ContextObject->CompressMethod == COMPRESS_UNKNOWN) {
|
||||
OutputDebugStringA("[ERROR] UNKNOWN compress method \n");
|
||||
Mprintf("[ERROR] UNKNOWN compress method \n");
|
||||
return;
|
||||
}
|
||||
else if (ContextObject->CompressMethod == COMPRESS_NONE) {
|
||||
@@ -596,7 +595,8 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe
|
||||
unsigned long ulCompressedLength = usingZstd ?
|
||||
ZSTD_compressBound(ulOriginalLength) : (double)ulOriginalLength * 1.001 + 12;
|
||||
#endif
|
||||
LPBYTE CompressedBuffer = new BYTE[ulCompressedLength];
|
||||
BYTE buf[1024];
|
||||
LPBYTE CompressedBuffer = ulCompressedLength>1024 ? new BYTE[ulCompressedLength]:buf;
|
||||
Buffer tmp(szBuffer, ulOriginalLength); szBuffer = tmp.Buf();
|
||||
ContextObject->Encode(szBuffer, ulOriginalLength);
|
||||
size_t iRet = usingZstd ?
|
||||
@@ -605,15 +605,15 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe
|
||||
|
||||
if (usingZstd ? C_FAILED(iRet) : (S_OK != iRet))
|
||||
{
|
||||
OutputDebugStringA("[ERROR] compress failed \n");
|
||||
delete [] CompressedBuffer;
|
||||
Mprintf("[ERROR] compress failed \n");
|
||||
if (CompressedBuffer != buf) delete [] CompressedBuffer;
|
||||
return;
|
||||
}
|
||||
|
||||
ulCompressedLength = usingZstd ? iRet : ulCompressedLength;
|
||||
|
||||
ContextObject->WriteBuffer(CompressedBuffer, ulCompressedLength, ulOriginalLength);
|
||||
delete [] CompressedBuffer;
|
||||
if (CompressedBuffer != buf) delete [] CompressedBuffer;
|
||||
}while (false);
|
||||
|
||||
OVERLAPPEDPLUS* OverlappedPlus = new OVERLAPPEDPLUS(IOWrite);
|
||||
@@ -621,12 +621,12 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe
|
||||
if ( (!bOk && GetLastError() != ERROR_IO_PENDING) ) //<2F><><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6>ʧ<EFBFBD><CAA7>
|
||||
{
|
||||
int a = GetLastError();
|
||||
OutputDebugStringA("!!! OnClientPreSending Ͷ<><CDB6><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>\n");
|
||||
Mprintf("!!! OnClientPreSending Ͷ<><CDB6><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>\n");
|
||||
RemoveStaleContext(ContextObject);
|
||||
SAFE_DELETE(OverlappedPlus);
|
||||
}
|
||||
}catch(...){
|
||||
OutputDebugStringA("[ERROR] OnClientPreSending catch an error \n");
|
||||
Mprintf("[ERROR] OnClientPreSending catch an error \n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,13 +653,13 @@ BOOL IOCPServer::OnClientPostSending(CONTEXT_OBJECT* ContextObject,ULONG ulCompl
|
||||
if ( iOk == SOCKET_ERROR && WSAGetLastError() != WSA_IO_PENDING )
|
||||
{
|
||||
int a = GetLastError();
|
||||
OutputDebugStringA("!!! OnClientPostSending Ͷ<><CDB6><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>\n");
|
||||
Mprintf("!!! OnClientPostSending Ͷ<><CDB6><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>\n");
|
||||
RemoveStaleContext(ContextObject);
|
||||
SAFE_DELETE(OverlappedPlus);
|
||||
}
|
||||
}
|
||||
}catch(...){
|
||||
OutputDebugStringA("[ERROR] OnClientPostSending catch an error \n");
|
||||
Mprintf("[ERROR] OnClientPostSending catch an error \n");
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -775,7 +775,7 @@ void IOCPServer::OnAccept()
|
||||
if ( (!bOk && GetLastError() != ERROR_IO_PENDING)) //<2F><><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6>ʧ<EFBFBD><CAA7>
|
||||
{
|
||||
int a = GetLastError();
|
||||
OutputDebugStringA("!!! OnAccept Ͷ<><CDB6><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>\n");
|
||||
Mprintf("!!! OnAccept Ͷ<><CDB6><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>\n");
|
||||
RemoveStaleContext(ContextObject);
|
||||
SAFE_DELETE(OverlappedPlus);
|
||||
return;
|
||||
@@ -800,7 +800,7 @@ VOID IOCPServer::PostRecv(CONTEXT_OBJECT* ContextObject)
|
||||
if (iOk == SOCKET_ERROR && WSAGetLastError() != WSA_IO_PENDING)
|
||||
{
|
||||
int a = GetLastError();
|
||||
OutputDebugStringA("!!! PostRecv Ͷ<><CDB6><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>\n");
|
||||
Mprintf("!!! PostRecv Ͷ<><CDB6><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>\n");
|
||||
RemoveStaleContext(ContextObject);
|
||||
SAFE_DELETE(OverlappedPlus);
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ public:
|
||||
#if TRACK_OVERLAPPEDPLUS
|
||||
char szLog[100];
|
||||
sprintf_s(szLog, "=> [new] OVERLAPPEDPLUS %p by thread [%d].\n", this, GetCurrentThreadId());
|
||||
OutputDebugStringA(szLog);
|
||||
Mprintf(szLog);
|
||||
#endif
|
||||
ZeroMemory(this, sizeof(OVERLAPPEDPLUS));
|
||||
m_ioType = ioType;
|
||||
@@ -381,7 +381,7 @@ public:
|
||||
#if TRACK_OVERLAPPEDPLUS
|
||||
char szLog[100];
|
||||
sprintf_s(szLog, "=> [delete] OVERLAPPEDPLUS %p by thread [%d].\n", this, GetCurrentThreadId());
|
||||
OutputDebugStringA(szLog);
|
||||
Mprintf(szLog);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
// CSystemDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
typedef struct
|
||||
typedef struct ItemData
|
||||
{
|
||||
DWORD ID;
|
||||
CString Data[3];
|
||||
|
||||
@@ -308,7 +308,7 @@ void CVideoDlg::InitCodec(DWORD fccHandler)
|
||||
m_pVideoCodec = new CVideoCodec;
|
||||
if (!m_pVideoCodec->InitCompressor(m_BitmapInfor_Full, fccHandler))
|
||||
{
|
||||
OutputDebugStringA("======> InitCompressor failed \n");
|
||||
Mprintf("======> InitCompressor failed \n");
|
||||
delete m_pVideoCodec;
|
||||
// <20><>NULL, <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD>ΪNULL<4C><4C><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD>ѹ<EFBFBD><D1B9>
|
||||
m_pVideoCodec = NULL;
|
||||
|
||||
Reference in New Issue
Block a user