好友
阅读权限10
听众
最后登录1970-1-1
|
奋斗蜗牛
发表于 2023-4-23 12:03
IDA查询和修改问题,遇到的难题,不忙的大神帮看看!我需要查找到并且修改,在查找这里遇到问题了,需要修改的文件是C语言编译生成的Liunx文件!生成文件有参考源码但是不一定完全一致!
先粘贴源码
[C++] 纯文本查看 复制代码 /**
* \file
* \version $
* \author
* \date
* \brief 实现家族命令的处理
*
*/
#include "SceneUser.h"
#include "Scene.h"
#include "RecordClient.h"
#include "Sept.h"
#include "Chat.h"
#include "SessionCommand.h"
#include "SessionClient.h"
using namespace SeptDef;
/**
* \brief 一个比较器
*
* 用于查找建立家族所需要的道具是否存在
*
*
*/
class SeptObjectCompare:public UserObjectCompare
{
public:
DWORD dwObjectID;
bool isIt(zObject *object)
{
if (object->data.dwObjectID == dwObjectID) return true;
return false;
}
};
/**
* \brief 处理用户家族命令
*
* 处理的关系命令如下:
*
* Cmd::SEPT_STATUS_CHECK_PARA
*
* Cmd::CREATE_SEPT_PARA
*
* Cmd::ADD_MEMBER_TO_SEPT_PARA
*
* \param rev: 家族命令
* \param cmdLen: 命令长度
*
* \return 命令被处理返回TRUE,否则为FALSE
*
*
*/
bool SceneUser::doSeptCmd(const Cmd::stSeptUserCmd *rev,unsigned int cmdLen)
{
switch(rev->byParam)
{
case Cmd::DONATE_HONOR_PARA:
{
Cmd::stDonateHonor* ptCmd = (Cmd::stDonateHonor*)rev;
if (ptCmd->dwHonor>this->charbase.honor)
{
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "您的荣誉点不够!");
}
if (ptCmd->dwHonor%10!=0)
{
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "您的荣誉点不是5的倍数");
}
if (this->charbase.honor>ptCmd->dwHonor)
{
this->charbase.honor = this->charbase.honor - ptCmd->dwHonor;
}
else
{
this->charbase.honor = 0;
}
//通知客户端
Cmd::stMainUserDataUserCmd send;
this->full_t_MainUserData(send.data);
this->sendCmdToMe(&send,sizeof(send));
Cmd::Session::t_OpRepute_SceneSession sendSession;
sendSession.dwSeptID = this->charbase.septid;
sendSession.dwRepute = ptCmd->dwHonor/10;
sessionClient->sendCmd(&send, sizeof(send));
return true;
}
break;
case Cmd::SEPT_STATUS_CHECK_PARA:
case Cmd::CREATE_SEPT_PARA:
{
BYTE bState = 1; //先初始化成成功状态
if (charbase.septid == 0) // 家族ID大于0表示加入家族
{
time_t cur_time = time(NULL);
if ((cur_time - charbase.levelsept) < 24*60*60)
{
//离开时间不足24小时
bState = 0;
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL,
"离开家族后24小时, 才能再建立家族");
}
else {
if (charbase.level >= CREATE_SEPT_NEED_LEVEL)
{
#ifdef CREATE_SEPT_NEED_ITEM_ID
SeptObjectCompare found;
found.dwObjectID = CREATE_SEPT_NEED_ITEM_ID;
zObject *itemobj = packs.uom.getObject(found);// 查找道具
if (itemobj)
{
#endif
/*
zObject *gold=packs.getGold();
if (gold&&gold->data.dwNum >= CREATE_SEPT_NEED_PRICE_GOLD) // 建立家族需要金钱100万
{
//报告成功状态
bState = 1;
}
*/
if (packs.checkMoney(CREATE_SEPT_NEED_PRICE_GOLD) /*&& packs.removeMoney(CREATE_SEPT_NEED_PRICE_GOLD)*/) {
//报告成功状态
bState = 1;
}
else
{
//报告没有足够的钱
bState = 0;
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "你需要%u文钱来创建家族,你没有足够的钱",CREATE_SEPT_NEED_PRICE_GOLD);
}//dwItemID = itemobj->data.qwThisID; // test
#ifdef CREATE_SEPT_NEED_ITEM_ID
}
else
{
//报告没有道具
bState = 0;
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "缺少任务道具无法创建家族");
}
#endif
}
else
{
//报告等级不够
bState = 0;
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "等级没有达到%u级无法创建家族",CREATE_SEPT_NEED_LEVEL);
}
}
}
else
{
bState = 0;
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "已经加入家族无法再创建家族");
}
//返回家族建立状态
if (Cmd::CREATE_SEPT_PARA == rev->byParam)
{
Cmd::stCreateSeptCmd *ptCmd=(Cmd::stCreateSeptCmd *)rev;
if (1 == bState)
{
Cmd::Session::t_addSept_SceneSession send;
send.dwMapTempID = scene->tempid;
send.info.dwSeptID = 0; // 家族的ID
strncpy(send.info.name,ptCmd->SeptName,MAX_NAMESIZE); // 家族名称
send.info.dwCharID = charbase.id; // 会长的角色ID
send.info.byVote = 0; // 默认不进入投票期间
send.info.dwRepute = 0;
send.info.dwUnionID = 0;
send.info.dwLevel = 1;
send.info.dwSpendGold = 0;
send.info.dwIsExp = 0;
send.info.calltimes = 0;
send.info.calldaytime = 0;
send.info.normalexptime = 0;
strncpy(send.info.masterName,charbase.name,MAX_NAMESIZE); // 会长的名字
bzero(send.info.note, sizeof(send.info.note));
sessionClient->sendCmd(&send, sizeof(send));
return true;
}
}
////////////////////////////////////////
if (1 == bState)
{
Cmd::stSeptStatusCheckCmd retCmd;
sendCmdToMe(&retCmd,sizeof(retCmd));
}
///////////////////////////////////////
return true;
}
break;
case Cmd::ADD_MEMBER_TO_SEPT_PARA:
{
Cmd::stAddMemberToSeptCmd *ptCmd=(Cmd::stAddMemberToSeptCmd *)rev;
switch(ptCmd->byState)
{
case Cmd::QUESTION:
{
if (0 == charbase.septid)
{
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "你必须先创立家族才能招收成员");
return true;
}
SceneUser *pUser=scene->getUserByName(ptCmd->memberName);
if (NULL != pUser)
{
//if (scene->checkUserInNine(this,pUser))
//{
if (!isset_state(pUser->sysSetting , Cmd::USER_SETTING_FAMILY))
{
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "玩家 %s加入家族未开启", pUser->name);
return true;
}
if (pUser->charbase.level >=JOIN_SEPT_NEED_LEVEL)
{
// 为0表示未加入家族
if (0==pUser->charbase.septid
&& pUser->charbase.unionid==0)
{
time_t cur_time = time(NULL);
if ((cur_time - pUser->charbase.levelsept) < 24*60*60)
{
Channel::sendSys(this,
Cmd::INFO_TYPE_FAIL, "现在还不能邀请该玩家, 该玩家还剩 %d 秒才能再次加入家族",
24*60*60-(cur_time-pUser->charbase.levelsept));
return true;
}
if ((cur_time - (int)pUser->charbase.levelsept) < 24*60*60)
{
Channel::sendSys(this,
Cmd::INFO_TYPE_FAIL, "现在还不能邀请该玩家");
return true;
}
if(pUser->charbase.country == charbase.country)
{
strncpy(ptCmd->memberName,name,MAX_NAMESIZE);
ptCmd->memberID = id;
pUser->sendCmdToMe(ptCmd,sizeof(Cmd::stAddMemberToSeptCmd));
return true;
}
else
{
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "他跟你不是一个国家不能邀请他");
}
}
else
{
if (pUser->charbase.septid == charbase.septid)
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "他已经加入本族了,无需再次邀请");
else
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "他已经入会需要他退会才能加入你的家族");
}
}
else
{
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "等级不够%d不能邀请他进入家族!",JOIN_SEPT_NEED_LEVEL);
}
//}
//else
//{
// Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "距离太远无法邀请");
//}
}
else
{
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "玩家不在跟前,无法回应邀请");
}
return true;
}
break;
case Cmd::ANSWER_YES:
{
SceneUser *pUser=scene->getUserByID(ptCmd->memberID);
if (pUser)
{
//charbase.septid = pUser->charbase.septid;
//Channel::sendSys(pUser, Cmd::INFO_TYPE_GAME, "%s接受了你的邀请加入了家族",name);
pUser->removeWarRecord(Cmd::SEPT_DARE);
pUser->removeWarRecord(Cmd::SEPT_NPC_DARE);
//pUser->sendNineToMe();
pUser->sendMeToNine();
Cmd::Session::t_addSeptMember_SceneSession send;
send.dwSeptID = pUser->charbase.septid;
send.member.dwCharID = charbase.id; // 会员角色ID
send.member.wdOccupation = charbase.face;
bzero(send.member.aliasname, sizeof(send.member.aliasname));
strncpy(send.member.name,charbase.name,MAX_NAMESIZE); // 会员角色名称
sessionClient->sendCmd(&send, sizeof(send));
}
else
{
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL, "对方已经离开,他放弃了这次邀请");
}
return true;
}
break;
case Cmd::ANSWER_NO:
{
SceneUser *pUser=scene->getUserByID(ptCmd->memberID);
if (pUser)
{
Channel::sendSys(pUser, Cmd::INFO_TYPE_FAIL, "%s不愿意加入家族, 拒绝了你的邀请",name);
}
return true;
}
break;
default:
break;
}
return true;
}
break;
default:
break;
}
return false;
}
我想修改的部分
[C++] 纯文本查看 复制代码 case Cmd::CREATE_SEPT_PARA:
{
BYTE bState = 1; //先初始化成成功状态
if (charbase.septid == 0) // 家族ID大于0表示加入家族
{
time_t cur_time = time(NULL);
if ((cur_time - charbase.levelsept) < 24*60*60)
{
//离开时间不足24小时
bState = 0;
Channel::sendSys(this, Cmd::INFO_TYPE_FAIL,
"离开家族后24小时, 才能再建立家族");
}
24*60*60改成60
需求解释完毕!
IDA我操作的流出
找到函数了SceneUser::doSeptCmd
IDA伪代码
[C++] 纯文本查看 复制代码 __int64 __fastcall SceneUser::doSeptCmd(SceneUser *this, const Cmd::stSeptUserCmd *a2, int a3, const char *a4)
{
const char *v4; // rcx@8
const char *v5; // rcx@15
const char *v6; // rcx@37
const char *v7; // rcx@38
const char *v8; // rcx@43
const char *v9; // rcx@56
signed int v11; // [sp+4h] [bp-2FCh]@1
signed int v12; // [sp+8h] [bp-2F8h]@29
signed int v13; // [sp+Ch] [bp-2F4h]@13
time_t v14; // [sp+10h] [bp-2F0h]@43
SceneUser *v15; // [sp+10h] [bp-2F0h]@56
Channel *v16; // [sp+10h] [bp-2F0h]@60
SceneUser *v17; // [sp+18h] [bp-2E8h]@37
char v18; // [sp+20h] [bp-2E0h]@25
int v19; // [sp+26h] [bp-2DAh]@25
int v20; // [sp+2Ah] [bp-2D6h]@25
__int16 v21; // [sp+2Eh] [bp-2D2h]@25
int v22; // [sp+4Fh] [bp-2B1h]@25
_BYTE v23[5]; // [sp+53h] [bp-2ADh]@25
char v24; // [sp+74h] [bp-28Ch]@25
int v25; // [sp+79h] [bp-287h]@25
int v26; // [sp+81h] [bp-27Fh]@25
int v27; // [sp+85h] [bp-27Bh]@25
int v28; // [sp+89h] [bp-277h]@25
int v29; // [sp+8Dh] [bp-273h]@25
_BYTE v30[7]; // [sp+91h] [bp-26Fh]@25
int v31; // [sp+190h] [bp-170h]@25
int v32; // [sp+194h] [bp-16Ch]@25
int v33; // [sp+198h] [bp-168h]@25
char v34; // [sp+1AFh] [bp-151h]@14
char v35; // [sp+1B0h] [bp-150h]@13
int v36; // [sp+1B2h] [bp-14Eh]@13
unsigned int v37; // [sp+1B6h] [bp-14Ah]@13
_BYTE v38[6]; // [sp+1BAh] [bp-146h]@57
char v39; // [sp+1C0h] [bp-140h]@13
__int16 v40; // [sp+1C6h] [bp-13Ah]@13
_BYTE v41[5]; // [sp+1DBh] [bp-125h]@57
__int16 v42; // [sp+1FCh] [bp-104h]@57
void *v43; // [sp+2E0h] [bp-20h]@6
int v44; // [sp+2ECh] [bp-14h]@1
const Cmd::stSeptUserCmd *v45; // [sp+2F0h] [bp-10h]@1
SceneUser *v46; // [sp+2F8h] [bp-8h]@1
v46 = this;
v45 = a2;
v44 = a3;
v11 = *((_BYTE *)a2 + 1);
if ( v11 == 7 )
{
v43 = (void *)v45;
v12 = *((_BYTE *)v45 + 74);
if ( v12 == 1 )
{
v15 = (SceneUser *)Scene::getUserByID(*((Scene **)v46 + 642), *(_DWORD *)((char *)v43 + 38));
if ( v15 )
{
SceneUser::removeWarRecord(v15, 2u, 0);
SceneUser::removeWarRecord(v15, 3u, 0);
SceneUser::sendMeToNine(v15);
Cmd::Session::t_addSeptMember_SceneSession::t_addSeptMember_SceneSession((Cmd::Session::t_addSeptMember_SceneSession *)&v35);
v36 = *((_DWORD *)v15 + 1740);
v37 = *((_DWORD *)v46 + 1713);
v42 = *(_WORD *)((char *)v46 + 6893);
bzero(v41, 0x21uLL);
strncpy(v38, (const char *)v46 + 6856, 0x20uLL);
(*(void (__fastcall **)(zThread *, char *, signed __int64))(*(_QWORD *)sessionClient + 32LL))(
sessionClient,
&v35,
78LL);
}
else
{
Channel::sendSys(v46, (SceneUser *)9, 10005656, v9);
}
v13 = 1;
return (unsigned int)v13;
}
if ( v12 > 1 )
{
if ( v12 == 2 )
{
v16 = (Channel *)Scene::getUserByID(*((Scene **)v46 - 0xFFFFFD7D), *(_DWORD *)((char *)v43 + 38));
if ( v16 )
Channel::sendSys(v16, (SceneUser *)9, 10005688, (const char *)v46 + 16);
v13 = 1;
return (unsigned int)v13;
}
}
else if ( !*((_BYTE *)v45 + 74) )
{
if ( *((_DWORD *)v46 + 1740) )
{
v17 = (SceneUser *)Scene::getUserByName(*((Scene **)v46 + 642), (const char *)v43 + 6);
if ( v17 )
{
if ( !(unsigned __int8)Cmd::isset_state((SceneUser *)((char *)v17 + 6336), (const unsigned __int8 *)0xB) )
{
Channel::sendSys(v46, (SceneUser *)9, 10005380, (const char *)v17 + 16);
v13 = 1;
return (unsigned int)v13;
}
if ( *(_WORD *)((char *)v17 + 6891) <= 0x13u )
{
Channel::sendSys(v46, (SceneUser *)9, 10005592, (const char *)0x14);
}
else if ( *((_DWORD *)v17 + 1740) || *((_DWORD *)v17 + 1738) )
{
if ( *((_DWORD *)v17 + 1740) == *((_DWORD *)v46 + 1740) )
Channel::sendSys(v46, (SceneUser *)9, 10005520, v7);
else
Channel::sendSys(v46, (SceneUser *)9, 10005552, v7);
}
else
{
v14 = time(0LL);
if ( v14 - *(_DWORD *)((char *)v17 + 7150) <= 28799 )
{
Channel::sendSys(
v46,
(SceneUser *)9,
10005408,
(const char *)(28800 - (v14 - *(_DWORD *)((char *)v17 + 7150))));
v13 = 1;
return (unsigned int)v13;
}
if ( v14 - *(_DWORD *)((char *)v17 + 7150) <= 28799 )
{
Channel::sendSys(v46, (SceneUser *)9, 10005463, v8);
v13 = 1;
return (unsigned int)v13;
}
if ( *(_DWORD *)((char *)v17 + 6990) == *(_DWORD *)((char *)v46 + 6990) )
{
strncpy((char *)v43 + 6, (const char *)v46 + 16, 0x20uLL);
*(_DWORD *)((char *)v43 + 38) = *((_DWORD *)v46 + 2);
SceneUser::sendCmdToMe(v17, v43, 0x4Bu);
v13 = 1;
return (unsigned int)v13;
}
Channel::sendSys(v46, (SceneUser *)9, 10005484, v8);
}
}
else
{
Channel::sendSys(v46, (SceneUser *)9, 10005623, v6);
}
v13 = 1;
return (unsigned int)v13;
}
Channel::sendSys(v46, (SceneUser *)9, 10005351, a4);
v13 = 1;
return (unsigned int)v13;
}
v13 = 1;
return (unsigned int)v13;
}
if ( v11 <= 7 )
{
if ( (unsigned int)(v11 - 1) <= 1 )
{
v34 = 1;
if ( *((_DWORD *)v46 + 1740) )
{
v34 = 0;
Channel::sendSys(v46, (SceneUser *)9, 10005324, a4);
}
else
{
v43 = (void *)time(0LL);
if ( (signed __int64)((char *)v43 - *(_DWORD *)((char *)v46 + 7150)) > 28799 )
{
if ( *(_WORD *)((char *)v46 + 6891) <= 0x22u )
{
v34 = 0;
Channel::sendSys(v46, (SceneUser *)9, 10005295, (const char *)0x23);
}
else if ( (unsigned __int8)Packages::checkMoney((SceneUser *)((char *)v46 + 7608), 0x7D0u) )
{
v34 = 1;
}
else
{
v34 = 0;
Channel::sendSys(v46, (SceneUser *)9, 10005256, (const char *)0x7D0);
}
}
else
{
v34 = 0;
Channel::sendSys(v46, (SceneUser *)9, 10005224, v5);
}
}
if ( *((_BYTE *)v45 + 1) != 2 || (v43 = (void *)v45, v34 != 1) )
{
if ( v34 == 1 )
{
Cmd::stSeptStatusCheckCmd::stSeptStatusCheckCmd((Cmd::stSeptStatusCheckCmd *)&v35);
SceneUser::sendCmdToMe(v46, &v35, 6u);
}
v13 = 1;
}
else
{
Cmd::Session::t_addSept_SceneSession::t_addSept_SceneSession((Cmd::Session::t_addSept_SceneSession *)&v18);
v19 = *(_DWORD *)(*((_QWORD *)v46 + 642) + 12LL);
v20 = 0;
strncpy((char *)&v21, (const char *)v43 + 6, 0x20uLL);
v22 = *((_DWORD *)v46 + 1713);
v24 = 0;
v25 = 0;
v26 = 0;
v27 = 1;
v28 = 0;
v29 = 0;
v31 = 0;
v32 = 0;
v33 = 0;
strncpy(v23, (const char *)v46 + 6856, 0x20uLL);
bzero(v30, 0xFFuLL);
(*(void (__fastcall **)(zThread *, char *, signed __int64))(*(_QWORD *)sessionClient + 32LL))(
sessionClient,
&v18,
380LL);
v13 = 1;
}
return (unsigned int)v13;
}
LABEL_64:
v13 = 0;
return (unsigned int)v13;
}
if ( v11 != 17 )
goto LABEL_64;
v43 = (void *)v45;
if ( *(_DWORD *)((char *)v45 + 6) > *(_DWORD *)((char *)v46 + 7105) )
Channel::sendSys(v46, (SceneUser *)9, 10005184, a4);
v4 = (const char *)(*(_DWORD *)((char *)v43 + 6) % 0xAu);
if ( (_DWORD)v4 )
Channel::sendSys(v46, (SceneUser *)9, 10005200, v4);
if ( *(_DWORD *)((char *)v46 + 7105) <= *(_DWORD *)((char *)v43 + 6) )
*(_DWORD *)((char *)v46 + 7105) = 0;
else
*(_DWORD *)((char *)v46 + 7105) -= *(_DWORD *)((char *)v43 + 6);
Cmd::stMainUserDataUserCmd::stMainUserDataUserCmd((Cmd::stMainUserDataUserCmd *)&v39);
SceneUser::full_t_MainUserData(v46, &v40);
SceneUser::sendCmdToMe(v46, &v39, 0x112u);
Cmd::Session::t_OpRepute_SceneSession::t_OpRepute_SceneSession((Cmd::Session::t_OpRepute_SceneSession *)&v35);
v36 = *((_DWORD *)v46 + 1740);
v37 = *(_DWORD *)((char *)v43 + 6) 编辑/注释/输入 0xAu;
(*(void (__fastcall **)(_QWORD, char *, signed __int64))(*(_QWORD *)sessionClient + 32LL))(sessionClient, &v39, 274LL);
v13 = 1;
return (unsigned int)v13;
}
需要找到对应的 case Cmd::CREATE_SEPT_PARA:
if ((cur_time - charbase.levelsept) < 24*60*60)修改 60 遇到的问题在这里无法找到 对应的位置请问用什么方法可以找到!转换16进制查询不到!
谢谢了!
|
|