This commit is contained in:
Changhua 2023-11-22 22:37:16 +08:00
parent 6b954e0a4b
commit 689106844f

View File

@ -2,7 +2,6 @@
#include "framework.h" #include "framework.h"
#include <condition_variable> #include <condition_variable>
#include <filesystem>
#include <mutex> #include <mutex>
#include <queue> #include <queue>
@ -12,8 +11,6 @@
#include "user_info.h" #include "user_info.h"
#include "util.h" #include "util.h"
namespace fs = std::filesystem;
// Defined in rpc_server.cpp // Defined in rpc_server.cpp
extern bool gIsListening, gIsListeningPyq; extern bool gIsListening, gIsListeningPyq;
extern mutex gMutex; extern mutex gMutex;
@ -99,7 +96,7 @@ void UnHookAddress(DWORD hookAddr, CHAR restoreCode[5])
void DispatchMsg(DWORD reg) void DispatchMsg(DWORD reg)
{ {
WxMsg_t wxMsg; WxMsg_t wxMsg;
try {
wxMsg.id = GET_QWORD(reg + g_WxCalls.recvMsg.msgId); wxMsg.id = GET_QWORD(reg + g_WxCalls.recvMsg.msgId);
wxMsg.type = GET_DWORD(reg + g_WxCalls.recvMsg.type); wxMsg.type = GET_DWORD(reg + g_WxCalls.recvMsg.type);
wxMsg.is_self = GET_DWORD(reg + g_WxCalls.recvMsg.isSelf); wxMsg.is_self = GET_DWORD(reg + g_WxCalls.recvMsg.isSelf);
@ -128,15 +125,20 @@ void DispatchMsg(DWORD reg)
wxMsg.thumb = GetStringByStrAddr(reg + g_WxCalls.recvMsg.thumb); wxMsg.thumb = GetStringByStrAddr(reg + g_WxCalls.recvMsg.thumb);
if (!wxMsg.thumb.empty()) { if (!wxMsg.thumb.empty()) {
wxMsg.thumb = fs::path(GetHomePath() + wxMsg.thumb).make_preferred().string(); wxMsg.thumb = GetHomePath() + wxMsg.thumb;
replace(wxMsg.thumb.begin(), wxMsg.thumb.end(), '\\', '/'); replace(wxMsg.thumb.begin(), wxMsg.thumb.end(), '\\', '/');
} }
wxMsg.extra = GetStringByStrAddr(reg + g_WxCalls.recvMsg.extra); wxMsg.extra = GetStringByStrAddr(reg + g_WxCalls.recvMsg.extra);
if (!wxMsg.extra.empty()) { if (!wxMsg.extra.empty()) {
wxMsg.extra = fs::path(GetHomePath() + wxMsg.extra).make_preferred().string(); wxMsg.extra = GetHomePath() + wxMsg.extra;
replace(wxMsg.extra.begin(), wxMsg.extra.end(), '\\', '/'); replace(wxMsg.extra.begin(), wxMsg.extra.end(), '\\', '/');
} }
} catch (const std::exception &e) {
LOG_ERROR(GB2312ToUtf8(e.what()));
} catch (...) {
LOG_ERROR("Unknow exception.");
}
{ {
unique_lock<mutex> lock(gMutex); unique_lock<mutex> lock(gMutex);