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

📄 creadargument.cpp

📁 网络游戏龙族 完整的登陆器 C++ 源代码
💻 CPP
📖 第 1 页 / 共 4 页
字号:
#include "Stdafx.h"


#include <stdio.h>
#include "hong_sub.h"
#include "CReadArgument.h"
//#include "chigamec.h"

HINSTANCE hDll;  //傈开函荐唱 糕滚肺 贸府
SessionParameter	m_SessParam;
CClientBill *g_pBill;

CUnicheck *g_unitel;
//2001/02/19 zhh 汲疙: 牢磊蔼阑 弊措肺 ip客 port肺 镜 荐 乐绰 版快 弊 牢磊蔼狼 Command[]俊辑狼 困摹.
//2001/02/20 zhh 汲疙: 抗甫甸绢辑 onegame狼 版快 dragonraja.exe /moya IP Port 扼绰 牢磊肺 角青登骨肺,
//2001/02/20 zhh 汲疙: IP_pos[11]  = 1;	Port_pos[11]= 2; 捞 等促.
void	CClientBill::initipNport()
{
	for(int i=0;i<MAX_BILL_CORP;i++)	IP_pos[i]=-1;
	for(	i=0;i<MAX_BILL_CORP;i++)	Port_pos[i]=-1;	//Command[]俊 port啊 甸绢 乐绰 困摹

	::memset(IP,0,40);
	port=0;

	sockfd=0;

	//nownuri
	IP_pos[0]  = 1;
	Port_pos[0]= 2;

	//Mezzy System
	IP_pos[6]  = 1;
	Port_pos[6]= 2;

	//WeverNet
	IP_pos[7]  = 1;
	Port_pos[7]= 2;

	IP_pos[10]  = 1;
	Port_pos[10]= 2;

	IP_pos[11]  = 1;
	Port_pos[11]= 2;

	IP_pos[14]  = 1;
	Port_pos[14]= 2;

	IP_pos[15]  = 1;
	Port_pos[15]= 2;
}

CClientBill::CClientBill(const char *szLine)
{
	initipNport();					//努贰胶 郴何狼 函荐祦E檬扁拳.
	g_unitel=NULL;					//蜡聪炮 纴E丒努贰胶 檬扁拳.
	CommandLine=NULL;
	Command=NULL;					//Command肺 逞钧勐 巴甸阑 啊府懦 器牢磐

	CommandLineSlash=NULL;			//逞钧勐 牢磊蔼 / 肺 备盒茄促
	CommandLineSlashBackup=NULL;	//strtok甫 角青窍竵ECommandszLine捞 函窍骨肺 促矫 盔惑汗蓖 矫虐眮E困茄巴

	CommandLineBackup = NULL;

	WhatLineIUse=-1;					//钧欣 诀眉狼 雀急牢羴E备盒. -1捞竵E辆樊力啊 酒聪扼绰 秮E
	CommandNum=0;					//逞钧勐 牢磊蔼狼 箭磊
	CommandNumSlash=0;			//逞钧勐 牢磊蔼狼 箭磊

#ifdef	JAPAN_LOCALIZING_ //030207 lsw
	CoInitialize(NULL);
	HRESULT hr = m_pNgcEncrypto.CreateInstance(__uuidof(NgcEncrypt));
	if(FAILED(hr))
	{
		::MessageBox(NULL,"NGC init error ", "Error",0);		
	}
/*
	WCHAR* wszJapanTID= NULL;
	_bstr_t code = L"D819FA2C-4429-4511-AC6E-9823F743881F ";
	m_pNgcEncrypto->Encode(code, &wszJapanTID);
*/
//
//	::MessageBox(NULL,szLine,"In",0);
	WCHAR wszLine[100] = {0,};//酒胶虐甫 蜡内靛肺 函券
	::MultiByteToWideChar(CP_ACP, 0, szLine, strlen(szLine), wszLine, sizeof(WCHAR)*100);

	WCHAR* result= NULL;
	m_pNgcEncrypto->Decode( wszLine, &result);
//	MessageBox(NULL,(char*)result,"Decode1",0);

	::WideCharToMultiByte(CP_ACP, 0, result,-1, m_szJapanTID, sizeof(m_szJapanTID), NULL, NULL);
//	MessageBox(NULL,m_szJapanTID,"Decode2",0);
	m_pNgcEncrypto = NULL;

	WhatLineIUse=-1;
	return;
#endif

	const int len = lstrlen(szLine)+1;	//牢磊蔼捞 绝绢档 老窜篮 眉农甫 茄促.
	if(len>-1)
	{
		CommandLine				= new char[len];
		CommandLineBackup		= new char[len];		//2001/02/19 zhh 汲疙: strtok狼 版快 角力 郴侩阑 官操绢 滚府骨肺 归诀捞 鞘夸窍促.
		CommandLineSlash		= new char[len];			//逞绢柯 牢磊蔼 / 肺 备盒茄促
		CommandLineSlashBackup	= new char[len];	//strtok甫 角青窍搁 CommandszLine捞 函窍骨肺 促矫 盔惑汗蓖 矫虐扁 困茄巴
		::strcpy(CommandLine,szLine);
		::strcpy(CommandLineBackup,szLine);
		::strcpy(CommandLineSlash,szLine);
		::strcpy(CommandLineSlashBackup,szLine);
		CheckLine();	//绢恫 牢磊蔼捞 逞绢 吭绰瘤 犬牢窍绊
		PutLine();		//弊吧 肋扼辑 Command[]俊 持绰促
		DecideLine();	//逞绢柯 牢磊蔼阑 秦寸窍绰 诀眉啊 勒绰瘤 犬牢茄促.
	}
	else
	{
		WhatLineIUse=-1;	//-1捞搁 沥咀栏肺 静绰 荤恩捞促. 辆樊力啊 酒聪促
	}
}

CClientBill::CClientBill()		//弊成 父甸绢 初篮巴 挥. 静瘤 臼绰促.
{
	CommandLine=NULL;	
	Command=NULL;		//Command肺 逞绢柯 巴甸阑 啊府懦 器牢磐

	WhatLineIUse=0;		//绢蠢 诀眉狼 雀急栏肺 
	CommandNum=0;		//逞绢柯 牢磊蔼狼 箭磊
}
//2001/02/19 zhh 汲疙: new肺 父电 巴甸 delete.
CClientBill::~CClientBill()
{
	if(Command!=NULL)
	{
		for(int i=0;i<CommandNum;i++)
			if(Command[i]!=NULL)
				delete Command[i];
	//	delete Command;
	}

	if(CommandSlash!=NULL)
	{
		for(int i=0;i<CommandNumSlash;i++)
			if(CommandSlash[i]!=NULL)
				delete CommandSlash[i];
	//	delete CommandSlash;
	}

	if(CommandLine)	//逞绢柯 牢磊蔼
		delete CommandLine;
	if(CommandLineBackup)	//逞绢柯 牢磊蔼
		delete CommandLineBackup;

	if(CommandLine)	//逞绢柯 牢磊蔼
		delete CommandLineSlash;
	if(CommandLineBackup)	//逞绢柯 牢磊蔼
		delete CommandLineSlashBackup;

	if(g_unitel)
		delete g_unitel;

	if(sockfd!=0)
		closesocket(sockfd);
}		

//2001/02/19 zhh 汲疙: 巩磊凯 盖 第狼 white space甫 绝矩促.
int CClientBill::EatRearWhiteChar(char* eatit )
{	
	char*	szWhite = " \t\n\r";
	char*	pRear;
	
	pRear = eatit + strlen( eatit ) - 1;
	if ( pRear )
	{
		while ( eatit <= pRear )
		{
			if ( strchr( szWhite, *pRear ) )
			{
				*pRear-- = 0;
			}
			else
			{
				break;
			}
		}
	}	
	return 0;
}	

//2001/02/19 zhh 汲疙: 
int CClientBill::CheckLine()
{	
	char *p;
	p=strtok(CommandLine," ");
	if(p)
		CommandNum++;
	while(p!=NULL)
	{
		p=strtok(NULL," ");
		if(p)	CommandNum++;
	}

	p=NULL;	
	p=strtok(CommandLineSlash,"/");
	if(p)
		CommandNumSlash++;
	while(p!=NULL)
	{
		p=strtok(NULL,"/");
		if(p)	CommandNumSlash++;
	}
	return 0;
}


int CClientBill::PutLine()
{
	strcpy(CommandLine,CommandLineBackup);
	strcpy(CommandLineSlash,CommandLineSlashBackup);
	
  if( 0 >= CommandNum)
	{
		return 0;
	}

	Command = new char* [CommandNum];
	CommandSlash = new char* [CommandNumSlash];

	for(int i=0;i<CommandNum;i++)	Command[i]=NULL;
	for(    i=0;i<CommandNumSlash;i++)	CommandSlash[i]=NULL;

	i=0;
	char *p;
	p=strtok(CommandLine," ");
	if(p)
	{
		Command[i] = new char [lstrlen(p)+1];
		strcpy(Command[i],p);
		i++;		
	}
	while(p!=NULL)
	{
		p=strtok(NULL," ");
		if(p && strcmp(p," "))
		{
			Command[i] = new char [lstrlen(p)+1];
			strcpy(Command[i],p);
			i++;			
		}
	}

	i=0;
	p=NULL;
	p=strtok(CommandLineSlash,"/");
	if(p)
	{
		CommandSlash[i] = new char [lstrlen(p)+1];
		EatRearWhiteChar(p);
		strcpy(CommandSlash[i],p);
		i++;		
	}
	while(p!=NULL)
	{
		p=strtok(NULL,"/");
		if(p/* && strcmp(p," ")*/)
		{
			CommandSlash[i] = new char [lstrlen(p)+1];
			EatRearWhiteChar(p);
			strcpy(CommandSlash[i],p);
			i++;			
		}
	}
	return 0;
}

char*	CClientBill::ReturnUserID()				//辆樊力 诀眉俊 肺弊牢 茄 ID	//泅力 葛福绰 巴篮 NowNuri挥.楷扁登菌栏骨肺 眠饶眠啊.
{
	memset(Return,0,sizeof(Return));
	if(WhatLineIUse<0)	return NULL;
	switch(WhatLineIUse)
	{
	case 0:
	case 1:
	case 2:		
		return UserID;
		break;
	case 3:
		{
			memset(UserID,0,sizeof(UserID));
			strcpy(UserID,g_unitel->Uniwin_szpUserID);
		}
	case 4:
	case 5:
	case 6:
	case 7:
		return UserID;
		break;
	case 8:
		WiseTop_ID();
		return UserID;
		break;
	case 9:
	case 10:
	case 11:
	case 12:

	case 13:
	case 14:
	case 15:	
		return UserID;
		break;

	default: return NULL;
		break;
	}
	return NULL;
}

char*	CClientBill::ReturnUserPW()				//辆樊力 诀眉俊 肺弊牢 茄 PW
{
	if(WhatLineIUse<0)	return NULL;
	memset(Return,0,sizeof(Return));
	return NULL;
}


int		CClientBill::ReturnLineNum()
{
//	_asm int 3; 
	if(WhatLineIUse<0)	
		return -1;
	return WhatLineIUse;
}


char*	CClientBill::ReturnCharValue(int Where)
{
	if(Where>CommandNum)	return NULL;
	memset(Return,0,sizeof(Return));
	strcpy(Return,Command[Where]);
	return Return;
}

int		CClientBill::ReturnNumValue(int Where)
{
	if(Where>CommandNum)	return -1;
	return (atoi(Command[Where]));
}
void	CClientBill::DisplayAllCommand()	//叼滚彪侩
{
	for(int i=0;i<CommandNum;i++)
		MessageBox(NULL,Command[i],"White Space",NULL);	
	for(    i=0;i<CommandNumSlash;i++)	
		MessageBox(NULL,CommandSlash[i],"Slash",NULL);

//	if(CommandNum==0 && CommandNumSlash==0)
//		return;
	
	char ip[20];
	int  port;  
	char dis[100],linename[20];
	if(ReturnLineNum()<0)	return;
	wsprintf(ip,ReturnIPaddress());
	port = ReturnPORTNumber();
	switch(WhatLineIUse)
	{
	case 0:		strcpy(linename,"Nownuri");	break;
	case 1:		strcpy(linename,"Thrunet");	break;
	case 2:		strcpy(linename,"Channel i");	break;
	case 3:		strcpy(linename,"Unitel");	break;
	case 4:		strcpy(linename,"Netsgo");	break; 
	case 5:		strcpy(linename,"Kornet World");	break; 
	case 6:		strcpy(linename,"Mezzy System");	break; 
	case 7:		strcpy(linename,"WeverNet");	break; 
	case 8:		strcpy(linename,"WiseTop");	break; 
	case 9:		strcpy(linename,"MediaWeb");	break; 
	case 10:	strcpy(linename,"Pcbang.com");	break; 
	case 11:	strcpy(linename,"One Game");	break; 
	case 12:	strcpy(linename,"Excite Game");	break; 
	case 13:	strcpy(linename,"UnitelWeb");	break; 
	case 14:	strcpy(linename,"Chollian");	break; 
	case 15:	strcpy(linename,"HyunJuComputer");	break; 

	default: strcpy(linename,"Can't Detect Line");	break;		
	}
	sprintf(dis,"ip : %s port : %d LineName:%s",ip,port,linename);
	MessageBox(NULL,dis,linename,NULL);
}
int		CClientBill::ReturnHeader()
{
	if(WhatLineIUse<0)	return 0;
	return(WhatLineIUse+710);
}

int		CClientBill::ReturnPayPORTNumber()			//霸捞飘傀捞 器飘 锅龋
{
	if(WhatLineIUse<0)	return 0;

	if(IP_pos[WhatLineIUse]==-1 || Port_pos[WhatLineIUse]==-1)		//父距 牢磊蔼栏肺 酒捞乔客 器飘啊 逞绢坷瘤 臼栏搁
	switch(WhatLineIUse)
	{
		case 1:
		//	if(ThrunetIP==NULL)	
		//	return 9010;
			return ThrunetPort;
		//	return 5000;
		//	return g_GameInfo.port;
			break;
		case 2:
			return m_SessParam.nPortNum;
		//	return htons(m_SessParam.nPortNum);
			break;
		case 3:
			return Unitel_Port();
		case 4:
			return Netsgo_Port();
		case 5:
			return 9000;

		default:
		//	MessageBox(NULL,"Can't Detect Line","Please Ask Release Corp.",NULL);
			break;
	}
	int port  = atoi(Command[ Port_pos[WhatLineIUse] ]);
	if(port<0) port=0;
	return (port);
}


char*	CClientBill::ReturnPayIPaddress()			//霸捞飘傀捞 酒捞乔 锅龋
{
	if(WhatLineIUse<0)	return NULL;
	memset(Return,0,sizeof(Return));
	if(IP_pos[WhatLineIUse]==-1 || Port_pos[WhatLineIUse]==-1)		//父距 牢磊蔼栏肺 酒捞乔客 器飘啊 逞绢坷瘤 臼栏搁
	switch(WhatLineIUse)
	{
		case 1:		
	//	if(ThrunetIP==NULL)	
			{				
				memset(Return,0,sizeof(Return));
			//	strcpy(Return, g_GameInfo.server);
			//	strcpy(Return, "203.248.248.228");				
				strcpy(Return, ThrunetIP);
				return Return;
			} 
			break;
	//	return ThrunetIP;
		case 2: 
			{
			//	_asm int 3;
				strcpy(Return, m_SessParam.lpszIPAddress);
				return Return;
			}
			break;
				
		case 3:
			Unitel_IP();
			return Return;
		case 4:
			Netsgo_IP();
			return Return;
		case 5:
			KornetWorld_IP();
			//	PostQuitMessage(0);
			return Return;		
			
		default:
		//	MessageBox(NULL,"Can't Detect Line","Please Ask Release Corp.",NULL);
			break;
	}
	memset(Return,0,sizeof(Return));
	strcpy(Return, Command[ IP_pos[WhatLineIUse] ]);
	return Return;
}



char*	CClientBill::ReturnIPaddress()			//霸捞飘傀捞 酒捞乔 锅龋
{
//	_asm int 3;
	if(WhatLineIUse<0)	return NULL;
	memset(Return,0,sizeof(Return));
	if(IP[0]!=0)		//捞固 林家啊 乐栏搁
	{
		return IP;
	}
	if(IP_pos[WhatLineIUse]==-1 || Port_pos[WhatLineIUse]==-1)		//父距 牢磊蔼栏肺 酒捞乔客 器飘啊 逞绢坷瘤 臼栏搁
	switch(WhatLineIUse)
	{
		case 1:		
	//	if(ThrunetIP==NULL)	
			{				
				memset(Return,0,sizeof(Return));
			//	strcpy(Return, g_GameInfo.server);
			//	strcpy(Return, "203.248.248.228");				
				strcpy(Return, ThrunetIP);
				return Return;
			} 
			break;
	//	return ThrunetIP;
		case 2: 
			{
			//	_asm int 3;
				strcpy(Return, m_SessParam.lpszIPAddress);
				return Return;
			}
			break;
				
		case 3:
			Unitel_IP();
			return Return;
		case 4:
			Netsgo_IP();
			return Return;
		case 5:
			KornetWorld_IP();
			strcpy(IP,Return);
			//	PostQuitMessage(0);
			return IP;
		

		case 8:
			WiseTop_IP();
			strcpy(IP,Return);
			return IP;

		case 9:
			strcpy(IP,"211.174.52.137");
			return IP;		
			
		default:
		//	MessageBox(NULL,"Can't Detect Line","Please Ask Release Corp.",NULL);
			break;
	}
	memset(Return,0,sizeof(Return));
	strcpy(Return, Command[ IP_pos[WhatLineIUse] ]);
	return Return;
}

int		CClientBill::ReturnPORTNumber()			//霸捞飘傀捞 器飘 锅龋
{
	if(WhatLineIUse<0)	return 0;

	if(IP_pos[WhatLineIUse]==-1 || Port_pos[WhatLineIUse]==-1)		//父距 牢磊蔼栏肺 酒捞乔客 器飘啊 逞绢坷瘤 臼栏搁
	switch(WhatLineIUse)
	{
		case 1:
		//	if(ThrunetIP==NULL)
		//	return 9010;
			return ThrunetPort;
		//	return 5000;
		//	return g_GameInfo.port;
			break;
		case 2:
			return m_SessParam.nPortNum;
		//	return htons(m_SessParam.nPortNum);
			break;
		case 3:
			return Unitel_Port();
		case 4:
			return Netsgo_Port();
		case 5:
			return KornetWorld_Port();

		case 8:
			return WiseTop_Port();
		case 9:
			return 9001;
		case 12:	//excite game
			return this->port;

		case 13:
			return Unitel_Port();

		default:
		//	MessageBox(NULL,"Can't Detect Line","Please Ask Release Corp.",NULL);
			break;
	}
	int port  = atoi(Command[ Port_pos[WhatLineIUse] ]);
	if(port<0) port=0;
	return (port);
}

void CheckGameSocketAndSendHeartBeat(void* ThreadParam);	//30檬俊 茄锅究 霸烙 家南捞 摧洒搁 辆樊力 家南档 摧绰促.
int		CClientBill::SendSpecifiedMessage(HWND hwnd)		//秦寸诀眉啊 霸捞飘傀捞辑滚肺 立加茄 饶 绢恫 漂沥茄 沥焊甫 朝妨林扁甫 盔且版快 朝府绰 窃荐
{
//	_asm int 3;
	if(WhatLineIUse<0) return 0;	
	unsigned long hHeartBeatSensor = _beginthread( CheckGameSocketAndSendHeartBeat, NULL,(void*) 1);
	if (hHeartBeatSensor == -1)
		return -2;
	switch(WhatLineIUse)
	{
	case 0:
		break;

	case 1:
	//	MessageBox(NULL,"asdfasdf","haha",NULL);
		if(Thrunet_SendMessage()==0)
		{
			PostQuitMessage(0);
			return -1;
		}
		else			return 1;
		break;

	case 2:
		if(Channel_i_SendEncryptedData()==0)
		{
			PostQuitMessage(0);
			return -2;
		}
		else 
			return 2;
		break;
	case 3:
		g_unitel->Uniwin_Init(hwnd);
		if(Unitel_SendMessage()==0)			return -3;
		else			return 3;
		break; 

	case 4:
		if(Netsgo_SendMessage()==0)			return -4;
		else			return 4;
		break;
	case 5:		//内齿岿靛绰 家泡阑 窍唱 凯绢辑 20檬 郴寇俊辑 皋矫瘤 酒公芭唱 窍唱究 焊郴搁 等促.
	//	if(MakePaySocket(2)!=1)				return -5;
		if(Kornet_SendMessage()==0)			return -5;
		else			return 5;
		break;

	case 6:
		break;

	case 12:		

⌨️ 快捷键说明

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