OD汇编代码如下(微信版本:3.0.0.47,WeChatWin.dll基址:780C0000):
汇编分析清楚了,接下来就是写代码(VC++):
/*==================================发送图片=======================================
//参数wchar_t* wxid 微信ID
//wchar_t* filepath 图片路径
*/
void SendImageMessage(wchar_t* wxid, wchar_t* filepath)
{
log("发图片\n");
//接收图片的Wxid结构体
struct SendImageWxidStruct
{
wchar_t* pWxid;
DWORD length = 0;
DWORD maxLength = 0;
};
//发送图片的结构体
struct SendImageFileStruct
{
wchar_t* filePath;
DWORD length = 0;
DWORD maxLength = 0;
char fillbuff[0x18] = { 0 };
};
// 获取微信基址
DWORD winAddress = GetWeChatWinBase();
//组装微信ID的数据结构
SendImageWxidStruct imagewxid;
imagewxid.pWxid = wxid;
imagewxid.length = wcslen(wxid);
imagewxid.maxLength = wcslen(wxid) * 2;
//组装文件路径的数据结构
SendImageFileStruct imagefilepath;
imagefilepath.filePath = filepath;
imagefilepath.length = wcslen(filepath);
imagefilepath.maxLength = wcslen(filepath) * 2;
DWORD dwCall1= winAddress + 0x5660F0;
DWORD dwCall2 = winAddress + 0x59700;;
DWORD dwCall3 = winAddress + 0x38D330;;
char buffwxid[0x20] = { 0 };
char buff[0x568] = { 0 };
__asm {
pushad
sub esp, 0x14;
lea eax, buffwxid;
mov ecx, esp;
push eax;
call dwCall1;
lea ebx, imagefilepath;
push ebx;
lea eax, imagewxid;
push eax;
lea eax, buff;
push eax;
call dwCall2;
mov ecx, eax;
call dwCall3;
popad
}
}
到此,发图片代码结束,也不存在图片占用问题!如果此代码对大家有帮助,请点个赞!