void Assertion(const char * assertion, const char * file, const uint32 line) { char buffer[MAXLOGLINESIZE+100]; sprintf(buffer, "%s(%i)(%d.%d): ASSERTION FAILED: %s", file, line, UPPER_VERSION, LOWER_VERSION, assertion); PutLogFileList((const char*)buffer, DEBUG_LOGFILE); }
/*void PutLogList(char * cMsg, BYTE MsgLvl, bool PutOnFile, char *FileName) { if(strlen(cMsg) <= MAXLOGMSGSIZE) { G_cMsgUpdated = TRUE; LogMsg.CurMsg++; if(LogMsg.CurMsg >= MAXLOGMSGS) LogMsg.CurMsg = 0; ZeroMemory(LogMsg.Message[LogMsg.CurMsg], sizeof(LogMsg.Message[LogMsg.CurMsg])); SafeCopy(LogMsg.Message[LogMsg.CurMsg], cMsg); LogMsg.MsgLvl[LogMsg.CurMsg] = MsgLvl; UpdateScreen(); } else if(strlen(cMsg) > MAXLOGLINESIZE) return; if(PutOnFile == TRUE) PutLogFileList(cMsg, FileName); }*/ void PutLogList(const char * cMsg) { G_cMsgUpdated = TRUE; PutLogFileList(cMsg, ADMIN_LOGFILE); SendMessage(List1,(UINT)LB_ADDSTRING,(WPARAM)0,(LPARAM)cMsg); if(scrolling) SendMessage(List1,(UINT)LB_SETCURSEL,ItemCount,0); ItemCount++; }
bool CGateCore::bAccept(class XSocket * pXSock) { register int i; class XSocket * pTmpSock; bool btrue = false; // 비어있는 배열을 찾는다. for (i = 1; i < DEF_MAXCLIENTS; i++) if (m_pClientList[i] == NULL) { m_pClientList[i] = new class CClient(); pXSock->bAccept(m_pClientList[i]->m_pXSock, WM_ONCLIENTSOCKETEVENT + i); m_pClientList[i]->m_pXSock->bInitBufferSize(DEF_MSGBUFFERSIZE); m_pClientList[i]->m_pXSock->iGetPeerAddress(m_pClientList[i]->m_cAddress); //2002-11-27일 정진 수정 for(int j = 0;j < 10 ; j++) //2002-11-27일 정진 수정 허가된 아이피 체크 { if(memcmp(m_cAddress[j],m_pClientList[i]->m_cAddress,16) == 0) { btrue = true; break; } } if(btrue != true) { sprintf(G_cTxt,"<%d> <%s> 씨바 해커닷.", i,m_pClientList[i]->m_cAddress); PutLogFileList(G_cTxt); delete m_pClientList[i] ; m_pClientList[i] = NULL ; return false; } sprintf(G_cTxt,"<%d> Accept! Add New Client.", i); PutLogList(G_cTxt); m_pClientList[i]->m_dwAliveTime = timeGetTime(); return true; } // 비어있는 배열이 없어 접속을 받을 수 없다. Accept한 후 그냥 끊는다. pTmpSock = new class XSocket(300); pXSock->bAccept(pTmpSock, 0); delete pTmpSock; //delete pXSock; return false; }
//============================================================================= int XSocket::iSendMsg(char * cData, DWORD dwSize, char cKey, BOOL log) { WORD * wp; int iRet; DWORD i; char m_msgBuff[50000], dataBuff[50000]; PutLogList("iSendMsg"); if (dwSize > m_dwBufferSize) return XSOCKEVENT_MSGSIZETOOLARGE; if (m_cType != XSOCK_NORMALSOCK) return XSOCKEVENT_SOCKETMISMATCH; if (m_cType == NULL) return XSOCKEVENT_NOTINITIALIZED; m_pSndBuffer[0] = cKey; wp = (WORD *)(m_pSndBuffer + 1); *wp = (WORD)(dwSize + 3); memcpy((char *)(m_pSndBuffer + 3), cData, dwSize); if(log){ ZeroMemory(m_msgBuff, sizeof(m_msgBuff)); ZeroMemory(dataBuff, sizeof(dataBuff)); wsprintf(m_msgBuff,"Msg [%lu] was sent = ", dwSize); memcpy(dataBuff, cData, dwSize); for(i = 0; i < dwSize; i++) if(dataBuff[i] == NULL) dataBuff[i] = ' '; strcat(m_msgBuff, dataBuff); PutLogFileList(m_msgBuff, XSOCKET_LOGFILE); } if (cKey != NULL) {//Encryption for (i = 0; i < dwSize; i++) { m_pSndBuffer[3+i] += (i ^ cKey); m_pSndBuffer[3+i] = (char)(m_pSndBuffer[3+i] ^ (cKey ^ (dwSize - i))); } } iRet = _iSend(m_pSndBuffer, dwSize + 3, TRUE); if (iRet < 0) return iRet; else return (iRet - 3); }