fix: fix offset

This commit is contained in:
ttttupup 2024-07-27 14:00:06 +08:00
parent 1c0bdaf73d
commit 7d290e454c
4 changed files with 95 additions and 15 deletions

View File

@ -20,7 +20,6 @@ class ChatController : public http::HttpController<ChatController> {
ADD_PATH("/api/forwardMsg", ForwardMsg);
ADD_PATH("/api/forwardPublicMsgByMsgId", ForwardPublicMsgByMsgId);
ADD_PATH("/api/forwardPublicMsg", ForwardPublicMsg);
PATHS_END
public:

View File

@ -424,8 +424,8 @@ const uint64_t kForwordPublicMsg = 0xddc6c0;
const uint64_t kParseAppMsgXml = 0x11b0a70;
const uint64_t kNewAppMsgInfo = 0x91a550;
const uint64_t kFreeAppMsgInfo = 0x8fd1a0;
const uint64_t kGetPreDownLoadMgr = 0x9996f0;
const uint64_t kPushAttachTask = 0x9c0080;
const uint64_t kGetPreDownLoadMgr = 0x1c0a3a0;
const uint64_t kPushAttachTask = 0x1cda920;
const uint64_t kGetCustomSmileyMgr = 0x1ca0320;
const uint64_t kSendCustomEmotion = 0x21b04c0;
const uint64_t kNewJsApiShareAppMessage = 0x26cda20;
@ -451,12 +451,24 @@ const uint64_t kGetQRCodeLoginMgr = 0x201e350;
const uint64_t kUpdateMsg = 0x21421a0;
const uint64_t kGetVoiceMgr = 0x1e13320;
const uint64_t kChatMsg2NetSceneSendMsg = 0x1b70fd0;
const uint64_t kTranslateVoice = 0x11217e0;
const uint64_t kNewWebViewPageConfig = 0x9512f0;
const uint64_t kFreeWebViewPageConfig = 0x951520;
const uint64_t kTranslateVoice = 0x2353d50;
const uint64_t kNewWebViewPageConfig = 0x1b53ae0;
const uint64_t kFreeWebViewPageConfig = 0x1b53d10;
const uint64_t kGetWebViewMgr = 0x1b43950;
const uint64_t kShowWebView = 0x302ed30;
const uint64_t kSetUrl = 0x13dd410;
const uint64_t kNewPayInfo = 0x1bcd930;
const uint64_t kFreePayInfo = 0x1b92450;
const uint64_t kTransferConfirm = 0x2f8c750;
const uint64_t kTransferRefuse = 0x2f8d340;
const uint64_t kAddFriend = 0x1f3a350;
const uint64_t kVerifyApply = 0x1f3a940;
const uint64_t kDoDelContact = 0x2310120;
const uint64_t kGetSearchContactMgr = 0x1f9a730;
const uint64_t kStartSearch = 0x22a4200;
#else
#ifdef WECHAT_VERSION
#error "Unsupported WeChat version."

View File

@ -249,6 +249,15 @@ typedef uint64_t (*__NewWebViewPageConfig)(uint64_t);
typedef uint64_t (*__FreeWebViewPageConfig)(uint64_t);
typedef uint64_t (*__GetWebViewMgr)();
typedef uint64_t (*__SetUrl)(uint64_t,uint64_t,uint64_t);
typedef uint64_t (*__NewWCPayInfo)(uint64_t);
typedef uint64_t (*__FreeWCPayInfo)(uint64_t);
typedef uint64_t (*__PayTransferConfirm)(uint64_t,uint64_t);
typedef uint64_t (*__PayTransferRefuse)(uint64_t,uint64_t);
typedef uint64_t (*__AddFriend)(uint64_t,uint64_t,uint64_t,uint64_t,uint64_t,uint64_t,uint64_t,uint64_t,uint64_t);
typedef uint64_t (*__Verify)(uint64_t,uint64_t,uint64_t,uint64_t,uint64_t,uint64_t,uint64_t,uint64_t,uint64_t);
typedef uint64_t (*__DelContact)(uint64_t);
typedef uint64_t (*__GetSearchContactMgr)();
typedef uint64_t (*__StartSearch)(uint64_t,uint64_t);
} // namespace function

View File

@ -683,7 +683,7 @@ int64_t wechat::WeChatService::GetSNSNextPage(uint64_t sns_id) {
return success;
}
TODO("AddFavFromMsg")
int64_t wechat::WeChatService::AddFavFromMsg(uint64_t msg_id) {
int64_t success = -1;
uint64_t get_chat_mgr_addr = base_addr_ + offset::kGetChatMgr;
@ -723,7 +723,7 @@ int64_t wechat::WeChatService::AddFavFromMsg(uint64_t msg_id) {
return success;
}
TODO("AddFavFromImage")
int64_t wechat::WeChatService::AddFavFromImage(const std::wstring& wxid,
const std::wstring& image_path) {
int64_t success = -1;
@ -740,7 +740,6 @@ int64_t wechat::WeChatService::AddFavFromImage(const std::wstring& wxid,
reinterpret_cast<uint64_t>(send_id));
return success;
}
TODO("SendAtText")
int64_t wechat::WeChatService::SendAtText(
const std::wstring& room_id, const std::vector<std::wstring>& wxids,
const std::wstring& msg) {
@ -755,7 +754,7 @@ int64_t wechat::WeChatService::SendAtText(
if (at_all.compare(wxids[i]) == 0) {
nickname = L"\u6240\u6709\u4eba";
} else {
// nickname = GetContactOrChatRoomNickname(wxids[i]);
nickname = GetContactOrChatRoomNickname(wxids[i]);
}
if (nickname.length() == 0) {
continue;
@ -818,7 +817,7 @@ std::wstring wechat::WeChatService::GetContactOrChatRoomNickname(
}
}
TODO("GetContactByWxid")
int64_t wechat::WeChatService::GetContactByWxid(const std::wstring& wxid,
ContactProfileInner& profile) {
int64_t success = -1;
@ -1427,7 +1426,6 @@ std::string wechat::WeChatService::GetTranslateVoiceText(uint64_t msg_id) {
if (content.empty()) {
return {};
}
tinyxml2::XMLDocument doc;
if (doc.Parse(content.c_str(), content.size()) != 0) {
SPDLOG_INFO("tinyxml2 parse error");
@ -1483,23 +1481,41 @@ int64_t wechat::WeChatService::OpenUrlByWeChatBrowser(const std::wstring& url,
TODO("GetChatRoomMemberNickname")
std::wstring wechat::WeChatService::GetChatRoomMemberNickname(
const std::wstring& room_id, const std::wstring& member_id) {
return std::wstring();
}
TODO("DelContact")
int64_t wechat::WeChatService::DelContact(const std::wstring& wxid) {
return 0;
int64_t success = -1;
uint64_t del_contcat_addr = base_addr_ + offset::kDoDelContact;
func::__DelContact del_contcat = (func::__DelContact)del_contcat_addr;
return success;
}
TODO("SearchContact")
int64_t wechat::WeChatService::SearchContact(
const std::wstring& keyword, wechat::SearchContactInner& contact) {
return 0;
int64_t success = -1;
prototype::WeChatString key(keyword);
uint64_t search_mgr_addr = base_addr_ + offset::kGetSearchContactMgr;
uint64_t search_addr = base_addr_ + offset::kStartSearch;
func::__GetSearchContactMgr get_mgr =
(func::__GetSearchContactMgr)search_mgr_addr;
func::__StartSearch search = (func::__StartSearch)search_addr;
uint64_t mgr = get_mgr();
success = search(mgr,&key);
return success;
}
TODO("AddFriendByWxid")
int64_t wechat::WeChatService::AddFriendByWxid(const std::wstring& wxid,
const std::wstring& msg) {
uint64_t add_friend_addr = base_addr_ + offset::kAddFriend;
func::__AddFriend add_friend = (func::__AddFriend)add_friend_addr;
return 0;
}
@ -1507,6 +1523,8 @@ TODO("VerifyApply")
int64_t wechat::WeChatService::VerifyApply(const std::wstring& v3,
const std::wstring& v4,
int32_t permission) {
uint64_t verify_addr = base_addr_ + offset::kVerifyApply;
func::__Verify add_friend = (func::__Verify)verify_addr;
return 0;
}
@ -1519,6 +1537,25 @@ int64_t wechat::WeChatService::DoConfirmReceipt(
prototype::WeChatString transcation_id(transcationid);
prototype::WeChatString transfer_id(transferid);
char pay_info[0x224] = {0};
uint64_t new_pay_info_addr = base_addr_ + offset::kNewPayInfo;
uint64_t free_pay_info_addr = base_addr_ + offset::kFreePayInfo;
uint64_t do_confirm_addr = base_addr_ + offset::kTransferConfirm;
func::__NewWCPayInfo new_pay_info = (func::__NewWCPayInfo)new_pay_info_addr;
func::__FreeWCPayInfo free_pay_info =
(func::__FreeWCPayInfo)free_pay_info_addr;
func::__PayTransferConfirm do_confirm =
(func::__PayTransferConfirm)do_confirm_addr;
new_pay_info(reinterpret_cast<uint64_t>(&pay_info));
memcpy(&pay_info[0x30], &transcation_id, sizeof(transcation_id));
memcpy(&pay_info[0x58], &transfer_id, sizeof(transfer_id));
// memcpy(&pay_info[0xA0], &recv_id, sizeof(recv_id));
success = do_confirm(&pay_info, &recv_id);
free_pay_info(reinterpret_cast<uint64_t>(&pay_info));
return success;
}
@ -1526,5 +1563,28 @@ TODO("DoRefuseReceipt")
int64_t wechat::WeChatService::DoRefuseReceipt(
const std::wstring& wxid, const std::wstring& transcationid,
const std::wstring& transferid) {
return 0;
int success = -1;
prototype::WeChatString recv_id(wxid);
prototype::WeChatString transcation_id(transcationid);
prototype::WeChatString transfer_id(transferid);
char pay_info[0x224] = {0};
uint64_t new_pay_info_addr = base_addr_ + offset::kNewPayInfo;
uint64_t free_pay_info_addr = base_addr_ + offset::kFreePayInfo;
uint64_t do_refuse_addr = base_addr_ + offset::kTransferRefuse;
func::__NewWCPayInfo new_pay_info = (func::__NewWCPayInfo)new_pay_info_addr;
func::__FreeWCPayInfo free_pay_info =
(func::__FreeWCPayInfo)free_pay_info_addr;
func::__PayTransferRefuse do_refuse =
(func::__PayTransferRefuse)do_refuse_addr;
new_pay_info(reinterpret_cast<uint64_t>(&pay_info));
memcpy(&pay_info[0x30], &transcation_id, sizeof(transcation_id));
memcpy(&pay_info[0x58], &transfer_id, sizeof(transfer_id));
// memcpy(&pay_info[0xA0], &recv_id, sizeof(recv_id));
success = do_refuse(&pay_info, &recv_id);
free_pay_info(reinterpret_cast<uint64_t>(&pay_info));
return success;
}