📄 network6.cpp
字号:
#include "StdAfx.h"
#include "packed.h"
#include "servertable.h"
#include "MAIN.H"
#include "Scrp_exe.H"
#include "ID.h"
#include "SealStone.h"
#include "Debug.h"
#include "mainheader.h"
#include "monitor.h"
#include "Citem.h"
#include "Pay.h"
#include "ChrLog.h"
#include "dragonloginserver2.h" // 010406 YGI
#include "hong_sub.h"
#include "auction.h"
#include "MailMgr.h"
#include "MySql.h"
extern HDBC hDBC_ChrLogDB;
extern HDBC hDBC_TotalDB;
extern HENV hEnv ;
extern HDBC hDBC ;
extern int g_wday;
//SadonixControl sadonixcontrol[24];//24矫埃 捞聪鳖
int CheckGameMakeTool( char *id, char ip[40]) // 020830 YGI
{
SDWORD cbValue;
int oksign=0;
char dbip[40];
memset(dbip,0,40);
char szQuerry[255];
HSTMT hStmt= NULL ;
sprintf(szQuerry, "select * from AccessAbleGMTOOLIpAddress where ip='%s'", ip);
SQLAllocStmt(hDBC_ChrLogDB, &hStmt);
int retCode = SQLExecDirect(hStmt, (UCHAR *)szQuerry, SQL_NTS);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
retCode = SQLFetch(hStmt);
if( retCode == SQL_NO_DATA )
{
MyLog(0,"!!!!----------------------------------!!!!" );
MyLog(0,"GmTool Stealed Thief Ip = '%s'" ,ip);
MyLog(0,"!!!!----------------------------------!!!!" );
SQLFreeStmt(hStmt, SQL_DROP);
return oksign;
}
retCode = SQLGetData(hStmt, 1, SQL_C_CHAR, dbip, 40 , &cbValue);
EatRearWhiteChar(dbip);
if(!strcmp(ip, dbip))
{
SQLFreeStmt(hStmt, SQL_DROP);
if(LocalMgr.IsAbleNation(CHINA))//021007 lsw
{
sprintf(szQuerry, "select * FROM AccessAbleGMTOOLID WHERE id='%s'", id);
SQLAllocStmt(hDBC_ChrLogDB, &hStmt);
retCode = SQLExecDirect(hStmt, (UCHAR *)szQuerry, SQL_NTS);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
retCode = SQLFetch(hStmt);
SQLFreeStmt(hStmt, SQL_DROP);
if( retCode == SQL_NO_DATA )
{
MyLog(0,"!!!!----------------------------------!!!!" );
MyLog(0,"GmTool Stealed Thief ID = '%s'" ,id);
MyLog(0,"!!!!----------------------------------!!!!" );
return 0;
}
return 1;
}
else
{
SQLFreeStmt(hStmt, SQL_DROP);
MyLog(0,"Check error GM_TOOL ID because no exist AccessAbleGMTOOLID table" ,id);
return 0;
}
}
else
{
return 1;
}
}
}
else
{
MyLog(0,"!!!!--------------------------------------------------!!!!");
MyLog(0,"ChrLogDB in AccessAbleGMTOOLIpAddress Table Error Check DB");
MyLog(0,"!!!!--------------------------------------------------!!!!");
}
SQLFreeStmt(hStmt, SQL_DROP);
return oksign;
}
int GetNowUpdateSadonixCount(const short nValue)//020822 lsw
{
HSTMT hStmt = NULL;
RETCODE retCode;
SDWORD cbValue;
const int iDay = nValue/100;
const int iHour = nValue%100;
if(LocalMgr.IsAbleNation(KOREA))//021007 lsw
{
SQLAllocStmt(hDBC_ChrLogDB, &hStmt);
}
else
{
SQLAllocStmt(hDBC, &hStmt);
}
int iSadCount=0;
char q[255];
sprintf(q,"select [%d] from SadonixControlOrigin where [no] = %d ",iDay, iHour);//020508 lsw
retCode = SQLExecDirect(hStmt, (UCHAR *)q, SQL_NTS);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
int i = 0;
retCode = SQLFetch(hStmt);
while( retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
retCode = SQLGetData(hStmt, 1, SQL_C_LONG, &iSadCount , 0, &cbValue);
retCode = SQLFetch(hStmt);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
break;
}
else if( retCode == SQL_NO_DATA )
{
break;
}
}
}
SQLFreeStmt(hStmt, SQL_DROP); // 0308 YGI
return iSadCount;
}
bool UpdateNowSadonixCount(const int iValue)//020822 lsw
{
HSTMT hStmt = NULL;
RETCODE retCode;
if(LocalMgr.IsAbleNation(KOREA))//021007 lsw
{
SQLAllocStmt(hDBC_ChrLogDB, &hStmt);
}
else
{
SQLAllocStmt(hDBC, &hStmt);
}
int iSadCount=0;
char szQuerry[255];
sprintf(szQuerry,"UPDATE SadonixControl SET No = %d",iValue);
retCode = SQLExecDirect(hStmt, (UCHAR *)szQuerry, SQL_NTS);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
SQLFreeStmt(hStmt, SQL_DROP);
return true;
}
else
{
SQLFreeStmt(hStmt, SQL_DROP);
return false;
}
return false;
}
bool RefreshNowSadonixCount(const short nValue)
{
const int iCount = GetNowUpdateSadonixCount(nValue);
MyLog(1,"Refresh NOW Update Sadonix Count '%d'",iCount);
return UpdateNowSadonixCount(iCount);
}
int GetNowSadonixCount()//020822 lsw
{
HSTMT hStmt = NULL;
RETCODE retCode;
SDWORD cbValue;
if(LocalMgr.IsAbleNation(KOREA))//021007 lsw
{
SQLAllocStmt(hDBC_ChrLogDB, &hStmt);
}
else
{
SQLAllocStmt(hDBC, &hStmt);
}
int iSadCount=0;
char q[255];
// sprintf(q,"select %d from SadonixControl where [no] = %d ",g_wday , g_hour);
sprintf(q,"select * from SadonixControl");//捞 抛捞喉俊绰 1青 1凯 楼府促
retCode = SQLExecDirect(hStmt, (UCHAR *)q, SQL_NTS);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
int i = 0;
retCode = SQLFetch(hStmt);
while( retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
retCode = SQLGetData(hStmt, 1, SQL_C_LONG, &iSadCount , 0, &cbValue);
retCode = SQLFetch(hStmt);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
break;
}
else if( retCode == SQL_NO_DATA )
{
break;
}
}
}
SQLFreeStmt(hStmt, SQL_DROP); // 0308 YGI
return iSadCount;
}
void RecvCMD_CONFORM_SADONIX(const int cn, t_packet &p)
{
int iSadCount = GetNowSadonixCount();
if( 0 >= iSadCount )//临 荐 乐绰 荤靛坷葱胶 肮荐啊 乐唱?
{
MyLog(1,"No More Sadonix Now Count is '%d'",iSadCount);
return;
}
else
{
iSadCount--;
if(UpdateNowSadonixCount(iSadCount))//茄俺 玲促
{
// 030923 HK YGI
MyLog(1,"Give to Sadonix '%s' Now Count is '%d' Recommand ItemNo = %d",p.u.ConformSadonix.name, iSadCount, p.u.ConformSadonix.item.item_no);
}
else
{
MyLog(1,"SadonixControlUpdate Failed Now Count is day ='%d' time = '%d' coount ='%d'", g_wday , g_hour,iSadCount);
return;
}
}
//倾啊 菩哦 父甸绢 焊辰促.
//RecvCMD_Give_Sadonix俊辑 罐绰促.
t_packet sp = p;
sp.h.header.type = CMD_CONFORM_SADONIX;
sp.h.header.size = sizeof(t_ConformSadonix);
memcpy(&sp.u.ConformSadonix.name,&p.u.ConformSadonix.name,20);
sp.u.ConformSadonix.item = p.u.ConformSadonix.item;
sp.u.ConformSadonix.x = p.u.ConformSadonix.x;
sp.u.ConformSadonix.y = p.u.ConformSadonix.y;
QueuePacket(connections,cn,&sp,1);
return;
}
int IsBlockedId(const char *check_name)
{
return 0;//瘤陛篮 烙矫肺 公炼扒 喉肺欧 登瘤 臼疽促绊 富茄促
SDWORD cbValue;
int oksign=0;
char dbip[40];
memset(dbip,0,40);
char szQuerry[255];
HSTMT hStmt= NULL ;
sprintf(szQuerry, "select * from Black_List where [Name] ='%s'", check_name);
SQLAllocStmt(hDBC, &hStmt);
int retCode = SQLExecDirect(hStmt, (UCHAR *)szQuerry, SQL_NTS);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)//孽府俊 己傍 沁绊
{
retCode = SQLFetch(hStmt);
switch(retCode)
{
case SQL_NO_DATA://弊捞抚捞 扁废 登绢 乐瘤 臼匙
{
SQLFreeStmt(hStmt, SQL_DROP);
return 0;//020802 lsw
}break;
default://捞抚捞 扁废 登绢 乐促
{
char Name[20];
retCode = SQLGetData(hStmt, 1, SQL_C_CHAR, Name, 20 , &cbValue);
SQLFreeStmt(hStmt, SQL_DROP);
MyLog(0,"!!!!----------------------------------!!!!" );
MyLog(0,"Is Blocked Id = '%s'" ,check_name);
MyLog(0,"!!!!----------------------------------!!!!" );
return 1;
}break;
}
}
else
{
MyLog(0,"!!!!--------------------------------------------------!!!!");
MyLog(0,"DragonDB in BlockedId Table Error!!! PLZ Check DB Table");
MyLog(0,"!!!!--------------------------------------------------!!!!");
}
SQLFreeStmt(hStmt, SQL_DROP);
return 0;
}
int IsSecretKeyCodeOk(const char *szLogInID,const char *szSecretKeyCode)//020822 lsw
{
if(!szLogInID) {return 0;}
char query[256]= {0, } ;
if(LocalMgr.IsAbleNation(CHINA))//吝惫篮 菩胶况靛 腮飘
{
::sprintf(query, "SELECT passwd_hint FROM chr_log_info WHERE (login_id = '%s')", szLogInID) ;//拌沥 急琶
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// BBD 031107 1.1苞 1.2绰 富饭捞啊 菩胶况靛 腮飘甫 荤侩茄促
// 侩坷揪啊 官槽 内靛肺 背眉窃
/*
else if( LocalMgr.IsAbleNation(THAI|USA))
{
::sprintf(query, "SELECT d_email FROM chr_log_info WHERE (login_id = '%s')", szLogInID);
}
*/
else if( LocalMgr.IsAbleNation(THAI))
{
::sprintf(query, "SELECT d_email FROM chr_log_info WHERE (login_id = '%s')", szLogInID);
}
else if( LocalMgr.IsAbleNation(USA) ) // 030716 kyo malaysia wants using
{
sprintf(query, "SELECT passwd_hint FROM chr_log_info WHERE (login_id = '%s')", szLogInID);
}
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
else if( LocalMgr.IsAbleNation(JAPAN) )
{
::sprintf(query, "SELECT uemail FROM member_view WHERE (uid = '%s')", szLogInID);
}
else
{
::sprintf(query, "SELECT d_jumin FROM chr_log_info WHERE (login_id = '%s')", szLogInID) ;//拌沥 急琶
}
SQLRETURN retcode = 0;
SQLHSTMT hstmt = 0;
SQLINTEGER cbvalue = 0;
HDBC &hDBCTemp = ((LocalMgr.IsAbleNation(JAPAN))?hDBC_NGCDB:hDBC_TotalDB);
::SQLAllocStmt(hDBCTemp, &hstmt);//叼厚急琶
retcode = ::SQLExecDirect(hstmt, (UCHAR *)query, SQL_NTS);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
retcode = ::SQLFetch(hstmt);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
char szTableKeyCode[51] = {0,};
retcode= ::SQLGetData(hstmt, 1, SQL_C_CHAR, szTableKeyCode, 50, &cbvalue);
if(!::strcmp(szSecretKeyCode,szTableKeyCode))//虐内靛啊 鞍促搁
{
SQLFreeStmt(hstmt, SQL_DROP);//橇府饶
return 1;
}
else
{
::MyLog( LOG_NORMAL, "Failed SecretKeyCode Wrong %s", szSecretKeyCode);
}
}
else
{
::SQLFreeStmt(hstmt, SQL_DROP);
return 0 ;
}
}
else
{
::SQLFreeStmt(hstmt, SQL_DROP);
return 0 ;
}
::SQLFreeStmt(hstmt, SQL_DROP);//
return 0 ;
}
//acer7
BOOL DumpException(LPEXCEPTION_POINTERS lpExcep,char* szOutMsg, void *pData, int nSize )
{
if (!lpExcep)
return FALSE;
BOOL result = TRUE;
SYSTEMTIME time;
FILE* fp = NULL;
const DWORD dwExceptionAddress = (DWORD)lpExcep->ExceptionRecord->ExceptionAddress;
const DWORD dwExceptionCode = lpExcep->ExceptionRecord->ExceptionCode;
const DWORD dwExceptionFlags = lpExcep->ExceptionRecord->ExceptionFlags;
const DWORD dwNumberParameters = lpExcep->ExceptionRecord->NumberParameters;
const DWORD dwDr0 = lpExcep->ContextRecord->Dr0;
const DWORD dwDr1 = lpExcep->ContextRecord->Dr1;
const DWORD dwDr2 = lpExcep->ContextRecord->Dr2;
const DWORD dwDr3 = lpExcep->ContextRecord->Dr3;
const DWORD dwDr6 = lpExcep->ContextRecord->Dr6;
const DWORD dwDr7 = lpExcep->ContextRecord->Dr7;
const DWORD dwSegCs = lpExcep->ContextRecord->SegCs;
const DWORD dwSegGs = lpExcep->ContextRecord->SegGs;
const DWORD dwSegFs = lpExcep->ContextRecord->SegFs;
const DWORD dwSegEs = lpExcep->ContextRecord->SegEs;
const DWORD dwEFlags = lpExcep->ContextRecord->EFlags;
const DWORD dwEsi = lpExcep->ContextRecord->Esi;
const DWORD dwEdi = lpExcep->ContextRecord->Edi;
const DWORD dwEbp = lpExcep->ContextRecord->Ebp;
const DWORD dwEsp = lpExcep->ContextRecord->Esp;
const DWORD dwEip = lpExcep->ContextRecord->Eip;
const DWORD dwEax = lpExcep->ContextRecord->Eax;
const DWORD dwEbx = lpExcep->ContextRecord->Ebx;
const DWORD dwEcx = lpExcep->ContextRecord->Ecx;
const DWORD dwEdx = lpExcep->ContextRecord->Edx;
__try
{
char szFileName[256+1];
GetLocalTime(&time);
sprintf( szFileName, "DBCrash_%d_%d_%d_%d_%d_%d.log", time.wYear,time.wMonth,time.wDay,time.wMinute,time.wSecond );
fp = fopen( szFileName, "w");
fprintf(fp,"%d year, %d month, %d day,%d hour, %d minute, %d second\n",
time.wYear,time.wMonth,time.wDay,time.wMinute,time.wSecond);
fprintf(fp,"%s\n",szOutMsg);
fprintf(fp,"Crashed address %xh \n",dwExceptionAddress);
fprintf(fp,"Crashed Map Address %04X:%08X\n",
dwSegCs,
dwExceptionAddress);
fprintf(fp,"Exception Code %u \n",dwExceptionCode);
fprintf(fp,"Exception Flag %xh \n",dwExceptionFlags);
fprintf(fp,"NumberParameters %d \n",dwNumberParameters);
fprintf(fp,"Dr0 %xh \n",dwDr0);
fprintf(fp,"Dr1 %xh \n",dwDr1);
fprintf(fp,"Dr2 %xh \n",dwDr2);
fprintf(fp,"Dr3 %xh \n",dwDr3);
fprintf(fp,"Dr6 %xh \n",dwDr6);
fprintf(fp,"Dr7 %xh \n",dwDr7);
fprintf(fp,"SegGs %xh \n",dwSegGs);
fprintf(fp,"SegFs %xh \n",dwSegFs);
fprintf(fp,"SegEs %xh \n",dwSegEs);
fprintf(fp,"EFlags %xh \n",dwEFlags);
fprintf(fp,"Esi %xh \n",dwEsi);
fprintf(fp,"Edi %xh \n",dwEdi);
fprintf(fp,"Ebp %xh \n",dwEbp);
fprintf(fp,"Esp %xh \n",dwEsp);
fprintf(fp,"Eip %xh \n",dwEip);
fprintf(fp,"Eax %xh \n",dwEax);
fprintf(fp,"Ebx %xh \n",dwEbx);
fprintf(fp,"Ecx %xh \n",dwEcx);
fprintf(fp,"Edx %xh \n",dwEdx);
if( pData ) fprintf(fp,"info : packet_type(PTCL_) = %d \n",*((char*)pData));
fprintf(fp,"\n\n");
fclose(fp);
fp = NULL;
if( pData )
{
sprintf( szFileName, "DBCrash_info_%d_%d_%d_%d_%d_%d.bin", time.wYear,time.wMonth,time.wDay,time.wMinute,time.wSecond );
fp = fopen( szFileName, "w");
fwrite( &nSize, 4, 1, fp );
fwrite( pData, 1, nSize, fp );
fclose( fp );
fp = NULL;
}
}
__except (GetExceptionCode())
{
if (fp)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -