diff --git a/DWeChatRobot/HookVoiceMessage.cpp b/DWeChatRobot/HookVoiceMessage.cpp index 54d665ad57f1aea82a662bf70868f2c18821a06b..0f78a95a2e6bfaa838b12f639a899871097c719b 100644 --- a/DWeChatRobot/HookVoiceMessage.cpp +++ b/DWeChatRobot/HookVoiceMessage.cpp @@ -12,10 +12,24 @@ static char VoiceMsgOldAsm[5] = { 0 }; static wstring savepath = L""; void SaveVoiceMsg(unsigned char* buffer, int length, DWORD msgHandle) { - time_t curtime = time(0); + /*time_t curtime = time(0); wchar_t timestamp[32] = { 0 }; - _itow_s((int)curtime, timestamp, 10); - wstring filename = savepath + timestamp + L".amr"; + _itow_s((int)curtime, timestamp, 10);*/ + wchar_t* temp; + int wxid_length = *(DWORD*)(msgHandle + 0x174); + temp = new wchar_t[wxid_length + 1]; + memcpy(temp, (void*)(*(DWORD*)(msgHandle + 0x170)), (wxid_length + 1) * 2); + wstring sender(temp); + delete[] temp; + temp = NULL; + + int clientmsg_length = *(DWORD*)(msgHandle + 0x188); + temp = new wchar_t[clientmsg_length + 1]; + memcpy(temp, (void*)(*(DWORD*)(msgHandle + 0x184)), (clientmsg_length + 1) * 2); + wstring clientmsgid(temp); + delete[] temp; + temp = NULL; + wstring filename = savepath + sender + L"-" + clientmsgid + L".amr"; HANDLE hFile = CreateFile(filename.c_str(), GENERIC_ALL, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { diff --git a/Release/DWeChatRobot.dll b/Release/DWeChatRobot.dll index 24b8274b802d27bb35a993ad9867d433cb11dff3..ff6877786c5e46b27c93359730006cd255bf7810 100644 Binary files a/Release/DWeChatRobot.dll and b/Release/DWeChatRobot.dll differ