首页 > 其他分享 >3123

3123

时间:2023-12-24 10:12:25浏览次数:25  
标签:case include cout 3123 DWORD NULL

#include <iostream>
#include <windows.h>
using namespace std;
/*声明变量 */
HWND hand=NULL; //游戏窗口
DWORD pid=0;//游戏进程ID
HANDLE hProcess=NULL;//进程对象
DWORD BaseValue=0;//游戏数据存放的基础值
DWORD SunshineAddress;
DWORD ZombiesAddress;
bool startGame(){
    hand=FindWindow("MainWindow","植物大战僵尸中文版");
    cout<<hand<<endl;
    if(hand==NULL){
        cout<<"游戏没有运行";
        return false;
    }
    cout<<"窗口"<<hand<<endl;
    GetWindowThreadProcessId(hand,&pid);
    if(pid==0){
        cout<<"无法找到植物大战僵尸进程";
        return false;
    }
    cout<<"进程:"<<pid<<endl;
    hProcess=OpenProcess(PROCESS_ALL_ACCESS,false,pid);
    if(hProcess==NULL){
        cout<<"无法打开进程"<<endl;
        return false;
    }
    cout<<"打开进程:"<<hProcess<<endl;
    DWORD BaseAddress=0x006A9EC0;
    bool Result=ReadProcessMemory(hProcess,(LPVOID)BaseAddress,&BaseValue,4,NULL);
    if(Result==false){
        cout<<"初始化基础地址失败";
        return false;
    }
    return true;
}
//初始化阳光地址 ----寻找真实的地址
bool initSunshine(){
    DWORD _Address=BaseValue+0x768;//一级偏移地址
    DWORD _Value=0;
    bool Result=ReadProcessMemory(hProcess,(LPVOID)_Address,&_Value,4,NULL);
    if(Result==false){
        cout<<"初始化阳光地址失败";
        return false;
    }
    SunshineAddress=_Value+0x5560;//二级偏移地址
    return true;
}
//获取阳光值
int getSunshineValue(){
    DWORD value=0;
    bool Result=ReadProcessMemory(hProcess,(LPVOID)SunshineAddress,&value,4,NULL);
    if(Result==false){
        cout<<"获取阳光数据失败";
        return 0;
    }
    cout<<"阳光数据:"<<value<<endl;
    return (int)value;
    }
//设置阳光数据
void setSunshineValue(int value){
    WriteProcessMemory(hProcess,(LPVOID)SunshineAddress,&value,4,NULL);
}
//无冷却
void noCoolDown(){
    cout<<"无冷却"<<endl;
    DWORD base=0x00488e73;
    DWORD pianyi=0x80;
    WriteProcessMemory(hProcess,(LPVOID)base,&pianyi,1,NULL);
}
void zanting(){
    cout<<"无暂停"<<endl;
    DWORD base=0x4502C0;
    DWORD pianyi=0xC3;
    WriteProcessMemory(hProcess,(LPVOID)base,&pianyi,1,NULL);
}
bool initZombies(){
	DWORD _Address=BaseValue+0x768;//一级偏移地址
    DWORD _Value=0;
    bool Result=ReadProcessMemory(hProcess,(LPVOID)_Address,&_Value,4,NULL);
    if(Result==false){
        cout<<"初始化僵尸地址失败";
        return false;
    }
    ZombiesAddress=_Value+0x90;
    Result=ReadProcessMemory(hProcess,(LPVOID)ZombiesAddress,&_Value,4,NULL);
     if(Result==false){
        cout<<"僵尸二次偏移失败";
        return false;
    }
    ZombiesAddress=_Value;
    cout<<"僵尸地址:"<<ZombiesAddress<<endl;
    return true;
} 
bool killZombies(){
	for(int i=-100;i<100;i++){
		DWORD _address=ZombiesAddress+0x28+i*0x15c;//一级偏移地址
	    DWORD _Value=0;
		bool Result=ReadProcessMemory(hProcess,(LPVOID)_address,&_Value,4,NULL);
		if(Result==false){
	        cout<<"僵尸血量获取失败";
	        continue;
    	}
    	int value=3;
    	if(_Value<100){
    		WriteProcessMemory(hProcess,(LPVOID)_address,&value,4,NULL);
		}else{
			cout<<"疑似僵尸血量"<<_Value<<endl;
		}
	}
	return true;
}
int main(){
    system("color 1A");
    system("title 植物大战僵外挂");
    bool Result=false;
    do{
        Result=startGame();
        if(Result==false){
            system("start C:\\Users\\Administrator\\Desktop\\植物大战僵尸1电脑版\\PlantsVsZombies.exe");
            Sleep(3000);
        }else{
            break;
        }
    }while(1);
    Result=initSunshine();
    if(Result==false){
        return false;  
    }
    int a;
    int sun_zhi;
    noCoolDown();
	zanting();
    while(1){
    	cin>>a;
    	switch(a){
    		case 1:
    			cout<<"请输入充值阳光的数目:";
				initSunshine();
				getSunshineValue();
				cin>>sun_zhi;
				setSunshineValue(sun_zhi);
			case 2:
				killZombies();	 
				break;
		}
        
    }
    return 0;
}

  

标签:case,include,cout,3123,DWORD,NULL
From: https://www.cnblogs.com/boyeyuan/p/17924082.html

相关文章

  • 32131231
    include<bits/stdc++.h>includeusingnamespacestd;intkg(stringa){while(a.find("")>=0&&a.find("")<=a.size()){a.replace(a.find(""),1,"");}}intjia(stringa){intno1=kg(0.a.find(&qu......
  • 1113123131
    //#include<bits/stdc++.h>//usingnamespacestd;//intmain(){// inta,b,c;// scanf("%d%d%d",&a,&b,&c);// cout<<setw(8)<<a<<""<<setw(8)<<b<<""<<setw(8)<<......
  • 12312313
    首发于编程喵的草稿纸写文章Multisim电路仿真(一)青羽学生,学计算机科学,也学点玄学。关注他360人赞同了该文章开一个系列,这个系列主要讲用Multisim进行电路仿真实验。0.准备工作这一长串是万用表、示波器以及电源、地线等等:如果你没有看到这个的话,在View里把它点上就行了。这里就只......
  • 标图123123666
    HTML:target=_blank_百度知道3个回答-提问时间:2009年02月16日最佳答案:_blank--在新窗口中打开链接_parent--在父窗体中打开链接_self--在当前窗体打开链接,此为默认值_top--在当前窗体打开链接,并替换当前...https://zhidao.baidu.com/quest...超链接加上ta......
  • 标图123123
    HTML:target=_blank_百度知道3个回答-提问时间:2009年02月16日最佳答案:_blank--在新窗口中打开链接_parent--在父窗体中打开链接_self--在当前窗体打开链接,此为默认值_top--在当前窗体打开链接,并替换当前...https://zhidao.baidu.com/quest...超链接加上ta......