AddBrandContact.cpp 1.7 KB
Newer Older
L
ljc545w 已提交
1 2
#include "pch.h"

L
ljc545w 已提交
3 4
#define AddPublicNoticeCallOffset  0x1203DB14 - 0x10000000
#define AddPublicNoticeParamOffset 0x7A583DCC - 0x786A0000
L
ljc545w 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

struct AddBrandContactStruct {
	DWORD handle;
	WxString command;
	char buffer1[0x28] = { 0 };
	WxString params;
	char buffer2[0x7C] = { 0 };
	AddBrandContactStruct(wchar_t* param) {
		command.buffer = (wchar_t*)L"quicklyAddBrandContact";
		command.length = wcslen(command.buffer);
		command.maxLength = command.length * 2;
		params.buffer = param;
		params.length = wcslen(param);
		params.maxLength = wcslen(param) * 2;
	}
};

BOOL __stdcall AddBrandContact(wchar_t* PublicId) {
	DWORD WeChatWinBase = GetWeChatWinBase();
	DWORD AddPublicNoticeCall = WeChatWinBase + AddPublicNoticeCallOffset;
	DWORD AddPublicNoticeParam = WeChatWinBase + AddPublicNoticeParamOffset;
	wchar_t url[0x100] = { 0 };
	swprintf_s(url, L"weixin://resourceid/Subscription/profile.html?userName=%ws", PublicId);
	WxBaseStruct ptrurl(url);
	wchar_t param[0x100] = { 0 };
	swprintf_s(param, L"{\"username\":\"%ws\",\"webtype\":\"1\"}\n", PublicId);
	AddBrandContactStruct ptrparam(param);
	ptrparam.handle = AddPublicNoticeParam;
	DWORD NoticeCallHandle[10] = { 0 };
	NoticeCallHandle[0] = AddPublicNoticeCall;
	BOOL isSuccess = 0x0;
	__asm {
		pushad;
		pushfd;
		lea eax, ptrparam;
		push eax;
		lea eax, NoticeCallHandle;
		mov edx, dword ptr [eax];
		mov ecx, eax;
		lea esi, ptrurl;
		push esi;
		mov edi, 0x3;
		push edi;
		call dword ptr [edx + 0x4];
		mov isSuccess, eax;
		popfd;
		popad;
	}
	return isSuccess;
}

56
#ifndef USE_SOCKET
L
ljc545w 已提交
57 58 59
BOOL AddBrandContactRemote(LPVOID lpParameter) {
	int isSuccess = AddBrandContact((wchar_t*)lpParameter);
	return isSuccess;
60 61
}
#endif