提交 6e049261 编写于 作者: L ljc545w

优化语音保存文件名

上级 feccf179
......@@ -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)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册