提交 35663e4f 编写于 作者: L ljc545w

替换信息中的双引号字符

上级 0b527e72
......@@ -70,6 +70,12 @@ void ReadFriendMessageByAddress(WxFriendAddrStruct* lpWxFriendAddr, WxFriendStru
ZeroMemory(lpWxFriend->wxRemark, sizeof(wchar_t) * (length + 1));
ReadProcessMemory(hProcess, (LPCVOID)lpWxFriendAddr->wxRemarkAddr, &bufferaddr, sizeof(DWORD), 0);
ReadProcessMemory(hProcess, (LPCVOID)bufferaddr, lpWxFriend->wxRemark, length * sizeof(wchar_t), 0);
wstring wswxRemark = wreplace(lpWxFriend->wxRemark,L'\"',L"\\\"");
delete[] lpWxFriend->wxRemark;
lpWxFriend->wxRemark = new wchar_t[wswxRemark.length() + 1];
ZeroMemory(lpWxFriend->wxRemark, sizeof(wchar_t) * (wswxRemark.length() + 1));
memcpy(lpWxFriend->wxRemark, wswxRemark.c_str(), wswxRemark.length() * 2);
wcout << lpWxFriend->wxRemark << endl;
}
}
else {
......
......@@ -32,7 +32,7 @@ bool isFileExists_stat(string& name) {
return (stat(name.c_str(), &buffer) == 0);
}
BOOL CreateConsole(void) {
BOOL CreateConsole() {
if (AllocConsole()) {
AttachConsole(GetCurrentProcessId());
FILE* retStream;
......@@ -169,4 +169,17 @@ wstring GetComWorkPath() {
int pos = wpath.find_last_of(L"\\");
wpath = wpath.substr(0,pos);
return wpath;
}
wstring wreplace(wstring source, wchar_t replaced, wstring replaceto) {
wstring temp = L"";
wchar_t* buffer = (wchar_t*)source.c_str();
for (unsigned int i = 0; i < source.length(); i++) {
if (buffer[i] == replaced) {
temp += replaceto;
continue;
}
temp += buffer[i];
}
return temp;
}
\ No newline at end of file
......@@ -34,5 +34,6 @@ DWORD GetWeChatRobotBase();
DWORD GetWeChatPid();
DWORD StartRobotService();
DWORD StopRobotService();
BOOL CreateConsole(void);
wstring GetComWorkPath();
\ No newline at end of file
BOOL CreateConsole();
wstring GetComWorkPath();
wstring wreplace(wstring source, wchar_t replaced, wstring replaceto);
\ No newline at end of file
......@@ -59,7 +59,8 @@ DWORD GetSelfInfoRemote() {
wchar_t* wtemp = new wchar_t[strlen(temp) + 1];
ZeroMemory(wtemp, (strlen(temp) + 1) * 2);
MultiByteToWideChar(CP_UTF8, 0, temp, -1, wtemp, strlen(temp) + 1);
selfinfo = selfinfo + wtemp;
wstring wrtemp = wreplace(wtemp,L'\"',L"\\\"");
selfinfo = selfinfo + wrtemp;
selfinfo = selfinfo + L"\"";
if(i!= SelfInfoAddr.size() - 1)
selfinfo = selfinfo + L",";
......
......@@ -24,6 +24,7 @@ VOID WxUserInfo(DWORD address) {
address + 0x10,
address + 0x24,
address + 0x38,
address + 0x58,
address + 0x6C,
address + 0xFC,
address + 0x110,
......@@ -37,6 +38,7 @@ VOID WxUserInfo(DWORD address) {
(WCHAR*)L"\"wxId\"",
(WCHAR*)L"\"wxNumber\"",
(WCHAR*)L"\"wxV3\"",
(WCHAR*)L"\"wxRemark\"",
(WCHAR*)L"\"wxNickName\"",
(WCHAR*)L"\"wxBigAvatar\"",
(WCHAR*)L"\"wxSmallAvatar\"",
......@@ -49,7 +51,8 @@ VOID WxUserInfo(DWORD address) {
wUserInfo += L"{";
for (unsigned int i = 0; i < InfoType.size(); i++) {
wchar_t* wstemp = ((*((DWORD*)InfoType[i])) != 0) ? (WCHAR*)(*((LPVOID*)InfoType[i])) : (WCHAR*)L"null";
wUserInfo = wUserInfo + InfoTypeName[i] + L":\"" + wstemp + L"\"";
wstring wsrtemp = wreplace(wstemp,L'\"',L"\\\"");
wUserInfo = wUserInfo + InfoTypeName[i] + L":\"" + wsrtemp + L"\"";
if (i != InfoType.size() - 1) {
wUserInfo += L",";
}
......
......@@ -65,4 +65,17 @@ void UnHookAnyAddress(DWORD dwHookAddr, char* originalRecieveCode)
void UnHookAll() {
UnHookLogMsgInfo();
return;
}
wstring wreplace(wstring source, wchar_t replaced, wstring replaceto) {
wstring temp = L"";
wchar_t* buffer = (wchar_t*)source.c_str();
for (unsigned int i = 0; i < source.length(); i++) {
if (buffer[i] == replaced) {
temp += replaceto;
continue;
}
temp += buffer[i];
}
return temp;
}
\ No newline at end of file
......@@ -59,3 +59,4 @@ void Wchar_tToString(std::string& szDst, wchar_t* wchar);
void HookAnyAddress(DWORD dwHookAddr, LPVOID dwJmpAddress, char* originalRecieveCode);
void UnHookAnyAddress(DWORD dwHookAddr, char* originalRecieveCode);
DLLEXPORT void UnHookAll();
wstring wreplace(wstring source, wchar_t replaced, wstring replaceto);
......@@ -189,5 +189,4 @@ def test_FriendStatus():
wx.StopService()
if __name__ == '__main__':
test_SendText()
test_SendText()
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册