From a49010b6e76350753c0d05a7a975eeafdb984c78 Mon Sep 17 00:00:00 2001 From: Tony Date: Thu, 8 Aug 2024 08:14:07 +0800 Subject: [PATCH] 3.9.11.25 --- inc/{base => include}/base_config.h | 0 inc/{base => include}/memory.h | 0 inc/{base => include}/noncopyable.h | 0 inc/{base => include}/singleton.h | 0 inc/{base => include}/thread_pool.h | 0 inc/{base => include}/utils.h | 7 + inc/{base => include}/win_header.h | 0 inc/offset.h | 120 --------------- src/chat_controller.cc | 2 +- src/thread_pool.cc | 44 ++++++ src/utils.cc | 225 ++++++++++++++++++++++++++++ src/wechat_service.cc | 57 ++++--- wxhelper.vcxproj | 11 +- 13 files changed, 312 insertions(+), 154 deletions(-) rename inc/{base => include}/base_config.h (100%) rename inc/{base => include}/memory.h (100%) rename inc/{base => include}/noncopyable.h (100%) rename inc/{base => include}/singleton.h (100%) rename inc/{base => include}/thread_pool.h (100%) rename inc/{base => include}/utils.h (84%) rename inc/{base => include}/win_header.h (100%) create mode 100644 src/thread_pool.cc create mode 100644 src/utils.cc diff --git a/inc/base/base_config.h b/inc/include/base_config.h similarity index 100% rename from inc/base/base_config.h rename to inc/include/base_config.h diff --git a/inc/base/memory.h b/inc/include/memory.h similarity index 100% rename from inc/base/memory.h rename to inc/include/memory.h diff --git a/inc/base/noncopyable.h b/inc/include/noncopyable.h similarity index 100% rename from inc/base/noncopyable.h rename to inc/include/noncopyable.h diff --git a/inc/base/singleton.h b/inc/include/singleton.h similarity index 100% rename from inc/base/singleton.h rename to inc/include/singleton.h diff --git a/inc/base/thread_pool.h b/inc/include/thread_pool.h similarity index 100% rename from inc/base/thread_pool.h rename to inc/include/thread_pool.h diff --git a/inc/base/utils.h b/inc/include/utils.h similarity index 84% rename from inc/base/utils.h rename to inc/include/utils.h index cd1da97..17e2caf 100644 --- a/inc/base/utils.h +++ b/inc/include/utils.h @@ -7,6 +7,13 @@ namespace base { namespace utils { + +#define STRINGIFY(S) #S +#define DEFER_STRINGIFY(S) STRINGIFY(S) +#define PRAGMA_MESSAGE(MSG) _Pragma(STRINGIFY(message(MSG))) +#define FORMATTED_MESSAGE(MSG) "warning [TODO-" DEFER_STRINGIFY(__COUNTER__) "] " MSG " : " __FILE__ "(" DEFER_STRINGIFY(__LINE__) ")" +#define TODO(MSG) PRAGMA_MESSAGE(FORMATTED_MESSAGE(MSG)) + std::wstring Utf8ToWstring(const std::string &str); std::string WstringToUtf8(const std::wstring &str); diff --git a/inc/base/win_header.h b/inc/include/win_header.h similarity index 100% rename from inc/base/win_header.h rename to inc/include/win_header.h diff --git a/inc/offset.h b/inc/offset.h index 58917a0..873af15 100644 --- a/inc/offset.h +++ b/inc/offset.h @@ -6,7 +6,6 @@ namespace wechat { #define V_3_9_9_43 39943 #define V_3_9_10_19 391019 #define V_3_9_11_19 391119 -#define V_3_9_11_25 391125 #ifndef WECHAT_VERSION #error " WECHAT_VERSION not defined ." #endif @@ -468,125 +467,6 @@ 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; -#elif WECHAT_VERSION == V_3_9_11_25 -const uint64_t kGetAccountServiceMgr = 0x1b50d00; -const uint64_t kSyncMsg = 0xc39680; -const uint64_t kSyncMsgNext = 0xc39680; -const uint64_t kGetCurrentDataPath = 0x2248ce0; -const uint64_t kGetAppDataSavePath = 0x25dc0e0; -const uint64_t kGetSendMessageMgr = 0x1b4f500; -const uint64_t kSendTextMsg = 0x22c2010; -const uint64_t kFreeChatMsg = 0x1b50d80; - -const uint64_t kDoAddMsg = 0x230a3e0; -const uint64_t kSendImageMsg = 0x22b77a0; -const uint64_t kChatMsgInstanceCounter = 0x1b59670; -const uint64_t kSendFileMsg = 0x20cb6f0; -const uint64_t kGetAppMsgMgr = 0x1b544a0; -const uint64_t kGetContactMgr = 0x1b3ccd0; -const uint64_t kGetContactList = 0x219a1c0; - -const uint64_t k_sqlite3_exec = 0x3a59b30; -const uint64_t k_sqlite3_prepare = 0x3a617b0; -const uint64_t k_sqlite3_open = 0x3a98fa0; -const uint64_t k_sqlite3_step = 0x3a1db30; -const uint64_t k_sqlite3_column_count = 0x3a1e350; -const uint64_t k_sqlite3_column_name = 0x3a1ed50; -const uint64_t k_sqlite3_column_type = 0x3a1eba0; -const uint64_t k_sqlite3_column_blob = 0x3a1e380; -const uint64_t k_sqlite3_column_bytes = 0x3a1e470; -const uint64_t k_sqlite3_finalize = 0x3a1cbe0; - -const uint64_t kGPInstance = 0x58dd300; -const uint64_t kMultiDBMgr = 0x593abf8; -const uint64_t kPublicMsgMgr = 0x5938198; -const uint64_t kFavoriteStorageMgr = 0x593b790; -const uint64_t kHardLinkMgr = 0x593ab28; - -const uint64_t kChatRoomMgr = 0x1b7f100; -const uint64_t kGetChatRoomDetailInfo = 0x2160bb0; -const uint64_t kNewChatRoomInfo = 0x2505120; -const uint64_t kFreeChatRoomInfo = 0x2505300; -const uint64_t kDoAddMemberToChatRoom = 0x21505b0; -const uint64_t kDoModChatRoomMemberNickName = 0x215a360; -const uint64_t kDelMemberFromChatRoom = 0x2150bf0; -const uint64_t kGetMemberFromChatRoom = 0x2162400; -const uint64_t kNewChatRoom = 0x2502540; -const uint64_t kFreeChatRoom = 0x2502740; - -const uint64_t kTopMsg = 0x1d7d160; -const uint64_t kRemoveTopMsg = 0x2166090; -const uint64_t kInviteMember = 0x214ff90; -const uint64_t kHookLog = 0x1304e60; - -const uint64_t kCreateChatRoom = 0x214fc60; -const uint64_t kQuitChatRoom = 0x215ac00; -const uint64_t kForwardMsg = 0x22c1590; - -const uint64_t kOnSnsTimeLineSceneFinish = 0x1a73150; -const uint64_t kSNSGetFirstPage = 0x2e1bec0; -const uint64_t kSNSGetNextPageScene = 0x2e41a70; -const uint64_t kSNSDataMgr = 0x21dd6b0; -const uint64_t kSNSTimeLineMgr = 0x2dadf20; -const uint64_t kGetMgrByPrefixLocalId = 0x213afb0; -const uint64_t kAddFavFromMsg = 0x2930e40; -const uint64_t kGetChatMgr = 0x1b82bf0; -const uint64_t kGetFavoriteMgr = 0x1b57ba0; -const uint64_t kAddFavFromImage = 0x293d0f0; -const uint64_t kGetContact = 0x22609B0; -const uint64_t kNewContact = 0x25E4430; -const uint64_t kFreeContact = 0x25E4AE0; -const uint64_t kNewMMReaderItem = 0x8c79a0; -const uint64_t kFreeMMReaderItem = 0x8c6da0; -const uint64_t kForwordPublicMsg = 0xddc6c0; -const uint64_t kParseAppMsgXml = 0x11b0a70; -const uint64_t kNewAppMsgInfo = 0x91a550; -const uint64_t kFreeAppMsgInfo = 0x8fd1a0; -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; -const uint64_t kInitJsConfig = 0x137bc00; -const uint64_t kSendApplet = 0x13c0920; -const uint64_t kSendAppletSecond = 0x13c1150; -const uint64_t kGetAppInfoByWaid = 0x13c5790; -const uint64_t kCopyShareAppMessageRequest = 0x13c0670; -const uint64_t kNewWAUpdatableMsgInfo = 0x919ca0; -const uint64_t kFreeWAUpdatableMsgInfo = 0x8fc230; -const uint64_t kSendPatMsg = 0x2ca9790; -const uint64_t kGetOCRManager = 0x999780; -const uint64_t kDoOCRTask = 0x2c53910; - -const uint64_t kGetLockWechatMgr = 0x1c85010; -const uint64_t kRequestLockWechat = 0x1c397d0; -const uint64_t kRequestUnLockWechat = 0x1c39a70; - -const uint64_t kOnLoginBtnClick = 0x202bc30; - -const uint64_t kGetQRCodeLoginMgr = 0x201e350; - -const uint64_t kUpdateMsg = 0x21421a0; -const uint64_t kGetVoiceMgr = 0x1e13320; -const uint64_t kChatMsg2NetSceneSendMsg = 0x1b70fd0; -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 diff --git a/src/chat_controller.cc b/src/chat_controller.cc index aca78d9..0c60ead 100644 --- a/src/chat_controller.cc +++ b/src/chat_controller.cc @@ -84,7 +84,7 @@ std::string ChatController::SendCustomEmotion(std::string params) { return ret.dump(); } -//TODO("") +TODO("") std::string ChatController::SendApplet(std::string params) { SPDLOG_INFO("SendApplet params={}", params); nlohmann::json jp = nlohmann::json::parse(params); diff --git a/src/thread_pool.cc b/src/thread_pool.cc new file mode 100644 index 0000000..ede980c --- /dev/null +++ b/src/thread_pool.cc @@ -0,0 +1,44 @@ +#include "include/thread_pool.h" + +namespace base { +ThreadPool::~ThreadPool() { + if (cleanup_group_) { + CloseThreadpoolCleanupGroupMembers(cleanup_group_, true, NULL); + CloseThreadpoolCleanupGroup(cleanup_group_); + } + DestroyThreadpoolEnvironment(&env_); + if (pool_) { + CloseThreadpool(pool_); + } +} + +bool ThreadPool::Create(unsigned long min, unsigned long max) { + InitializeThreadpoolEnvironment(&env_); + pool_ = CreateThreadpool(NULL); + if (NULL == pool_) { + return false; + } + SetThreadpoolThreadMaximum(pool_, max); + BOOL ret = SetThreadpoolThreadMinimum(pool_, min); + if (FALSE == ret) { + return false; + } + cleanup_group_ = CreateThreadpoolCleanupGroup(); + if (NULL == cleanup_group_) { + return false; + } + SetThreadpoolCallbackPool(&env_, pool_); + SetThreadpoolCallbackCleanupGroup(&env_, cleanup_group_, NULL); + return true; +} + +bool ThreadPool::AddWork(PTP_WORK_CALLBACK callback, PVOID opt) { + PTP_WORK work = CreateThreadpoolWork(callback, opt, &env_); + if (NULL == work) { + return false; + } + SubmitThreadpoolWork(work); + return true; +} + +} // namespace base \ No newline at end of file diff --git a/src/utils.cc b/src/utils.cc new file mode 100644 index 0000000..427256a --- /dev/null +++ b/src/utils.cc @@ -0,0 +1,225 @@ +#include "include/utils.h" + +#include + +#include + +#include "utils.h" +namespace base { +namespace utils { +const std::string hex_table = "0123456789abcdef"; +std::wstring Utf8ToWstring(const std::string &str) { + return AnsiToWstring(str, CP_UTF8); +} + +std::string WstringToUtf8(const std::wstring &str) { + return WstringToAnsi(str, CP_UTF8); +} + +std::wstring AnsiToWstring(const std::string &input, INT64 locale) { + int wchar_len = MultiByteToWideChar(locale, 0, input.c_str(), -1, NULL, 0); + if (wchar_len > 0) { + std::vector temp(wchar_len); + MultiByteToWideChar(CP_UTF8, 0, input.c_str(), -1, &temp[0], wchar_len); + return std::wstring(&temp[0]); + } + return std::wstring(); +} + +std::string WstringToAnsi(const std::wstring &input, INT64 locale) { + int char_len = WideCharToMultiByte(locale, 0, input.c_str(), -1, 0, 0, 0, 0); + if (char_len > 0) { + std::vector temp(char_len); + WideCharToMultiByte(locale, 0, input.c_str(), -1, &temp[0], char_len, 0, 0); + return std::string(&temp[0]); + } + return std::string(); +} + +std::string WcharToUtf8(wchar_t *wstr) { + int c_size = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, FALSE); + if (c_size > 0) { + char *buffer = new char[c_size]; + WideCharToMultiByte(CP_UTF8, 0, wstr, -1, buffer, c_size, NULL, FALSE); + std::string str(buffer); + delete[] buffer; + buffer = NULL; + return str; + } + return std::string(); +} + +std::string StringToHex(const std::string &str) { + std::string sb; + for (int i = 0; i < str.length(); i++) { + sb += hex_table.at((str[i] & 0xf0) >> 4); + sb += hex_table.at((str[i] & 0x0f) >> 0); + } + return sb; +} + +std::string HexToString(const std::string &hex_str) { + std::string ret; + for (int i = 0; i < hex_str.length(); i += 2) { + ret += BYTE(hex_table.find(hex_str.at(i)) << 4 | + hex_table.find(hex_str.at(i + 1))); + } + return ret; +} + +std::string BytesToHex(const BYTE *bytes, const int length) { + if (bytes == NULL) { + return ""; + } + std::string buff; + const int len = length; + for (int j = 0; j < len; j++) { + int high = bytes[j] / 16, low = bytes[j] % 16; + buff += (high < 10) ? ('0' + high) : ('a' + high - 10); + buff += (low < 10) ? ('0' + low) : ('a' + low - 10); + } + return buff; +} +void HexToBytes(const std::string &hex, BYTE *bytes) { + int byte_len = hex.length() / 2; + std::string str; + unsigned int n; + for (int i = 0; i < byte_len; i++) { + str = hex.substr(i * 2, 2); + sscanf_s(str.c_str(), "%x", &n); + bytes[i] = n; + } +} + +bool CreateConsole() { + if (AllocConsole()) { + AttachConsole(GetCurrentProcessId()); + FILE *retStream; + freopen_s(&retStream, "CONOUT$", "w", stdout); + if (!retStream) throw std::runtime_error("Stdout redirection failed."); + freopen_s(&retStream, "CONOUT$", "w", stderr); + if (!retStream) throw std::runtime_error("Stderr redirection failed."); + return false; + } + return true; +} + +void CloseConsole() { + fclose(stdin); + fclose(stdout); + fclose(stderr); + FreeConsole(); +} + +void HideModule(HMODULE module) { +#ifdef _WIN64 + PPEB peb = (PPEB)__readgsqword(0x60); + PPEB_LDR_DATA ldr = peb->Ldr; + + void *cur_ptr = *((void **)((unsigned char *)ldr + 0x18)); + void *next_ptr = cur_ptr; + do { + void *next = *((void **)((unsigned char *)next_ptr)); + void *last = *((void **)((unsigned char *)next_ptr + 0x8)); + void *base_addr = *((void **)((unsigned char *)next_ptr + 0x30)); + if (base_addr == module) { + *((void **)((unsigned char *)last)) = next; + *((void **)((unsigned char *)next + 0x8)) = last; + cur_ptr = next; + } + next_ptr = *((void **)next_ptr); + } while (cur_ptr != next_ptr); +#else + void *peb_ptr = nullptr; + _asm { + PUSH EAX + MOV EAX, FS:[0x30] + MOV peb_ptr, EAX + POP EAX + } + void *ldr_ptr = *((void **)((unsigned char *)peb_ptr + 0xc)); + void *cur_ptr = *((void **)((unsigned char *)ldr_ptr + 0x0c)); + void *next_ptr = cur_ptr; + do { + void *next = *((void **)((unsigned char *)next_ptr)); + void *last = *((void **)((unsigned char *)next_ptr + 0x4)); + void *base_addr = *((void **)((unsigned char *)next_ptr + 0x18)); + if (base_addr == module) { + *((void **)((unsigned char *)last)) = next; + *((void **)((unsigned char *)next + 0x4)) = last; + cur_ptr = next; + } + next_ptr = *((void **)next_ptr); + } while (cur_ptr != next_ptr); +} +#endif +} + +bool IsDigit(const std::string &str) { + if (str.length() == 0) { + return false; + } + for (auto it : str) { + if (it < '0' || it > '9') { + return false; + } + } + return true; +} + +std::string Bytes2Hex(const BYTE *bytes, const int length) { + if (bytes == NULL) { + return ""; + } + std::string buff; + const int len = length; + for (int j = 0; j < len; j++) { + int high = bytes[j] / 16, low = bytes[j] % 16; + buff += (high < 10) ? ('0' + high) : ('a' + high - 10); + buff += (low < 10) ? ('0' + low) : ('a' + low - 10); + } + return buff; +} + +bool IsTextUtf8(const char *str, INT64 length) { + char endian = 1; + bool littlen_endian = (*(char *)&endian == 1); + + size_t i; + int bytes_num; + unsigned char chr; + + i = 0; + bytes_num = 0; + while (i < length) { + if (littlen_endian) { + chr = *(str + i); + } else { // Big Endian + chr = (*(str + i) << 8) | *(str + i + 1); + i++; + } + + if (bytes_num == 0) { + if ((chr & 0x80) != 0) { + while ((chr & 0x80) != 0) { + chr <<= 1; + bytes_num++; + } + if ((bytes_num < 2) || (bytes_num > 6)) { + return false; + } + bytes_num--; + } + } else { + if ((chr & 0xC0) != 0x80) { + return false; + } + bytes_num--; + } + i++; + } + return (bytes_num == 0); +} + +} // namespace utils +} // namespace base diff --git a/src/wechat_service.cc b/src/wechat_service.cc index 51935a1..e08000a 100644 --- a/src/wechat_service.cc +++ b/src/wechat_service.cc @@ -21,14 +21,12 @@ #define GIF1 0x49 #define GIF2 0x46 - namespace offset = wechat::offset; namespace prototype = wechat::prototype; namespace func = wechat::function; namespace utils = base::utils; namespace jsonutils = wxhelper::jsonutils; namespace wxutils = wxhelper::wxutils; - prototype::WeChatString* BuildWechatString(const std::wstring& ws) { prototype::WeChatString* p = base::utils::WxHeapAlloc( @@ -575,7 +573,7 @@ int64_t wechat::WeChatService::RemoveTopMsg(const std::wstring& room_id, reinterpret_cast(chat_room_id)); return success; } -//TODO("InviteMemberToChatRoom") +TODO("InviteMemberToChatRoom") int64_t wechat::WeChatService::InviteMemberToChatRoom( const std::wstring& room_id, const std::vector& wxids) { int64_t success = -1; @@ -598,7 +596,7 @@ int64_t wechat::WeChatService::InviteMemberToChatRoom( return success; } -//TODO("CreateChatRoom") +TODO("CreateChatRoom") int64_t wechat::WeChatService::CreateChatRoom( const std::vector& wxids) { int64_t success = -1; @@ -621,7 +619,7 @@ int64_t wechat::WeChatService::CreateChatRoom( return success; } -//TODO("QuitChatRoom") +TODO("QuitChatRoom") int64_t wechat::WeChatService::QuitChatRoom(const std::wstring& room_id) { int64_t success = -1; uint64_t get_chat_room_mgr_addr = base_addr_ + offset::kChatRoomMgr; @@ -657,7 +655,7 @@ int64_t wechat::WeChatService::ForwardMsg(uint64_t msg_id, return success; } -//TODO("GetSNSFirstPage") +TODO("GetSNSFirstPage") int64_t wechat::WeChatService::GetSNSFirstPage() { int64_t success = -1; uint64_t sns_data_mgr_addr = base_addr_ + offset::kSNSDataMgr; @@ -671,7 +669,7 @@ int64_t wechat::WeChatService::GetSNSFirstPage() { return success; } -//TODO("GetSNSNextPage") +TODO("GetSNSNextPage") int64_t wechat::WeChatService::GetSNSNextPage(uint64_t sns_id) { int64_t success = -1; uint64_t time_line_mgr_addr = base_addr_ + offset::kSNSTimeLineMgr; @@ -790,7 +788,7 @@ int64_t wechat::WeChatService::SendAtText( free(reinterpret_cast(&chat_msg)); return 0; } -//TODO("GetContactOrChatRoomNickname") +TODO("GetContactOrChatRoomNickname") std::wstring wechat::WeChatService::GetContactOrChatRoomNickname( const std::wstring& wxid) { int64_t success = -1; @@ -846,7 +844,7 @@ int64_t wechat::WeChatService::GetContactByWxid(const std::wstring& wxid, return success; } -//TODO("DoDownloadTask") +TODO("DoDownloadTask") int64_t wechat::WeChatService::DoDownloadTask(uint64_t msg_id) { int64_t success = -1; uint64_t get_by_local_id_addr = base_addr_ + offset::kGetMgrByPrefixLocalId; @@ -981,7 +979,7 @@ int64_t wechat::WeChatService::DoDownloadTask(uint64_t msg_id) { return success; } -//TODO("ForwardPublicMsg") +TODO("ForwardPublicMsg") int64_t wechat::WeChatService::ForwardPublicMsg(const std::wstring& wxid, const std::wstring& title, const std::wstring& url, @@ -992,12 +990,12 @@ int64_t wechat::WeChatService::ForwardPublicMsg(const std::wstring& wxid, return 0; } -//TODO("ForwardPublicMsgByMsgId") +TODO("ForwardPublicMsgByMsgId") int64_t wechat::WeChatService::ForwardPublicMsgByMsgId(const std::wstring& wxid, uint64_t msg_id) { return 0; } -//TODO("DecodeImage") +TODO("DecodeImage") int64_t wechat::WeChatService::DecodeImage(const std::wstring& file_path, const std::wstring& save_dir) { if (!wxutils::FindOrCreateDirectory(save_dir)) { @@ -1073,12 +1071,12 @@ int64_t wechat::WeChatService::DecodeImage(const std::wstring& file_path, CloseHandle(save_img); return 1; } -//TODO("GetVoiceByDB") +TODO("GetVoiceByDB") int64_t wechat::WeChatService::GetVoiceByDB(ULONG64 msg_id, const std::wstring& dir) { return 0; } -//TODO("SendCustomEmotion") +TODO("SendCustomEmotion") int64_t wechat::WeChatService::SendCustomEmotion(const std::wstring& file_path, const std::wstring& wxid) { int64_t success = -1; @@ -1101,7 +1099,7 @@ int64_t wechat::WeChatService::SendCustomEmotion(const std::wstring& file_path, return success; } -//TODO("SendApplet") +TODO("SendApplet") int64_t wechat::WeChatService::SendApplet( const std::wstring& recv_wxid, const std::wstring& waid_suff, const std::wstring& waid_w, const std::wstring& waid_s, @@ -1218,7 +1216,7 @@ int64_t wechat::WeChatService::SendPatMsg(const std::wstring& room_id, return success; } -//TODO("DoOCRTask") +TODO("DoOCRTask") int64_t wechat::WeChatService::DoOCRTask(const std::wstring& img_path, std::string& result) { int64_t success = -1; @@ -1286,7 +1284,8 @@ int64_t wechat::WeChatService::EnterWeChat() { int64_t base_addr = wxutils::GetWeChatWinBase(); uint64_t click_cb_addr = base_addr + offset::kOnLoginBtnClick; func::__OnLoginBtnClick cb = (func::__OnLoginBtnClick)click_cb_addr; - auto vec = base::memory::ScanAndMatchValue(base_addr + 0x4ecedf8, 0x1000, 0x8); + auto vec = + base::memory::ScanAndMatchValue(base_addr + 0x4ecedf8, 0x1000, 0x8); for (int i = 0; i < vec.size(); i++) { int64_t ptr = vec.at(i); if (*(int64_t*)ptr == base_addr + 0x4ecedf8) { @@ -1298,7 +1297,7 @@ int64_t wechat::WeChatService::EnterWeChat() { return success; } -//TODO("SendMultiAtText") +TODO("SendMultiAtText") int64_t wechat::WeChatService::SendMultiAtText( const std::wstring& room_id, const std::vector>& at) { @@ -1363,7 +1362,7 @@ void wechat::WeChatService::SetJsApiAddr(uint64_t addr) { this->js_api_addr_ = addr; } -//TODO("TranslateVoice") +TODO("TranslateVoice") int64_t wechat::WeChatService::TranslateVoice(uint64_t msg_id) { int64_t success = -1; uint64_t get_by_local_id_addr = base_addr_ + offset::kGetMgrByPrefixLocalId; @@ -1420,7 +1419,7 @@ int64_t wechat::WeChatService::TranslateVoice(uint64_t msg_id) { return success; } -//TODO("GetTranslateVoiceText") +TODO("GetTranslateVoiceText") std::string wechat::WeChatService::GetTranslateVoiceText(uint64_t msg_id) { std::string content = wechat::WeChatDb::GetInstance().GetChatMsgStrContentByMsgId(msg_id); @@ -1443,7 +1442,7 @@ std::string wechat::WeChatService::GetTranslateVoiceText(uint64_t msg_id) { return ""; } -//TODO("OpenUrlByWeChatBrowser") +TODO("OpenUrlByWeChatBrowser") int64_t wechat::WeChatService::OpenUrlByWeChatBrowser(const std::wstring& url, int flag) { int64_t success = -1; @@ -1479,14 +1478,14 @@ int64_t wechat::WeChatService::OpenUrlByWeChatBrowser(const std::wstring& url, return success; } -//TODO("GetChatRoomMemberNickname") +TODO("GetChatRoomMemberNickname") std::wstring wechat::WeChatService::GetChatRoomMemberNickname( const std::wstring& room_id, const std::wstring& member_id) { return std::wstring(); } -//TODO("DelContact") +TODO("DelContact") int64_t wechat::WeChatService::DelContact(const std::wstring& wxid) { int64_t success = -1; uint64_t del_contcat_addr = base_addr_ + offset::kDoDelContact; @@ -1495,7 +1494,7 @@ int64_t wechat::WeChatService::DelContact(const std::wstring& wxid) { return success; } -//TODO("SearchContact") +TODO("SearchContact") int64_t wechat::WeChatService::SearchContact( const std::wstring& keyword, wechat::SearchContactInner& contact) { int64_t success = -1; @@ -1507,12 +1506,12 @@ int64_t wechat::WeChatService::SearchContact( (func::__GetSearchContactMgr)search_mgr_addr; func::__StartSearch search = (func::__StartSearch)search_addr; uint64_t mgr = get_mgr(); - // success = search(mgr,&key); + //success = search(mgr,&key); return success; } -//TODO("AddFriendByWxid") +TODO("AddFriendByWxid") int64_t wechat::WeChatService::AddFriendByWxid(const std::wstring& wxid, const std::wstring& msg) { uint64_t add_friend_addr = base_addr_ + offset::kAddFriend; @@ -1520,7 +1519,7 @@ int64_t wechat::WeChatService::AddFriendByWxid(const std::wstring& wxid, return 0; } -//TODO("VerifyApply") +TODO("VerifyApply") int64_t wechat::WeChatService::VerifyApply(const std::wstring& v3, const std::wstring& v4, int32_t permission) { @@ -1529,7 +1528,7 @@ int64_t wechat::WeChatService::VerifyApply(const std::wstring& v3, return 0; } -//TODO("DoConfirmReceipt") +TODO("DoConfirmReceipt") int64_t wechat::WeChatService::DoConfirmReceipt( const std::wstring& wxid, const std::wstring& transcationid, const std::wstring& transferid) { @@ -1560,7 +1559,7 @@ int64_t wechat::WeChatService::DoConfirmReceipt( return success; } -//TODO("DoRefuseReceipt") +TODO("DoRefuseReceipt") int64_t wechat::WeChatService::DoRefuseReceipt( const std::wstring& wxid, const std::wstring& transcationid, const std::wstring& transferid) { diff --git a/wxhelper.vcxproj b/wxhelper.vcxproj index 28b2f00..6a09509 100644 --- a/wxhelper.vcxproj +++ b/wxhelper.vcxproj @@ -24,8 +24,11 @@ + + + @@ -118,13 +121,13 @@ ProgramDatabase Disabled stdcpp14 - inc\nlohmann;inc\tinyxml2;inc\mongoose;inc\lz4;inc\Detours;inc\base;inc\base64;inc;inc\spdlog;%(AdditionalIncludeDirectories) + inc\nlohmann;inc\tinyxml2;inc\mongoose;inc\lz4;inc\Detours;inc\include;inc\base64;inc;inc\spdlog;%(AdditionalIncludeDirectories) true NotSet MachineX64 - base.lib;base64.lib;detours.lib;lz4.lib;mongoose.lib;spdlogd.lib;tinyxml2.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;%(AdditionalDependencies) + base64.lib;detours.lib;lz4.lib;mongoose.lib;spdlogd.lib;tinyxml2.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;%(AdditionalDependencies) %(IgnoreSpecificDefaultLibraries) RequireAdministrator lib\debug;%(AdditionalLibraryDirectories) @@ -143,7 +146,7 @@ Level3 ProgramDatabase stdcpp17 - inc\nlohmann;inc\tinyxml2;inc\mongoose;inc\lz4;inc\Detours;inc\base;inc\base64;inc;inc\spdlog;%(AdditionalIncludeDirectories) + inc\nlohmann;inc\tinyxml2;inc\mongoose;inc\lz4;inc\Detours;inc\include;inc\base64;inc;inc\spdlog;%(AdditionalIncludeDirectories) true @@ -151,7 +154,7 @@ true true MachineX64 - base.lib;base64.lib;detours.lib;lz4.lib;mongoose.lib;spdlog.lib;tinyxml2.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;%(AdditionalDependencies) + base64.lib;detours.lib;lz4.lib;mongoose.lib;spdlog.lib;tinyxml2.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;%(AdditionalDependencies) %(IgnoreSpecificDefaultLibraries) lib\release;%(AdditionalLibraryDirectories)