Skip to content

Commit

Permalink
support voice backup and switch
Browse files Browse the repository at this point in the history
  • Loading branch information
anhkgg committed Feb 1, 2019
1 parent 07d9eee commit 3ae88eb
Show file tree
Hide file tree
Showing 25 changed files with 446 additions and 9 deletions.
14 changes: 14 additions & 0 deletions MultiWechat/MultiWeChat.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,30 @@ VisualStudioVersion = 15.0.28010.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MultiWeChat", "MultiWebchat.vcxproj", "{06ABD385-B50D-491D-8FBD-2B26B46568CC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WeChatResource", "..\WeChatResource\WeChatResource.vcxproj", "{CC8544D5-1A6E-4515-B737-4DA205371032}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{06ABD385-B50D-491D-8FBD-2B26B46568CC}.Debug|Win32.ActiveCfg = Debug|Win32
{06ABD385-B50D-491D-8FBD-2B26B46568CC}.Debug|Win32.Build.0 = Debug|Win32
{06ABD385-B50D-491D-8FBD-2B26B46568CC}.Debug|x64.ActiveCfg = Debug|Win32
{06ABD385-B50D-491D-8FBD-2B26B46568CC}.Release|Win32.ActiveCfg = Release|Win32
{06ABD385-B50D-491D-8FBD-2B26B46568CC}.Release|Win32.Build.0 = Release|Win32
{06ABD385-B50D-491D-8FBD-2B26B46568CC}.Release|x64.ActiveCfg = Release|Win32
{CC8544D5-1A6E-4515-B737-4DA205371032}.Debug|Win32.ActiveCfg = Debug|Win32
{CC8544D5-1A6E-4515-B737-4DA205371032}.Debug|Win32.Build.0 = Debug|Win32
{CC8544D5-1A6E-4515-B737-4DA205371032}.Debug|x64.ActiveCfg = Debug|x64
{CC8544D5-1A6E-4515-B737-4DA205371032}.Debug|x64.Build.0 = Debug|x64
{CC8544D5-1A6E-4515-B737-4DA205371032}.Release|Win32.ActiveCfg = Release|Win32
{CC8544D5-1A6E-4515-B737-4DA205371032}.Release|Win32.Build.0 = Release|Win32
{CC8544D5-1A6E-4515-B737-4DA205371032}.Release|x64.ActiveCfg = Release|x64
{CC8544D5-1A6E-4515-B737-4DA205371032}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Binary file modified MultiWechat/MultiWebchat.aps
Binary file not shown.
8 changes: 4 additions & 4 deletions MultiWechat/MultiWebchat.rc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,1,2,0
PRODUCTVERSION 1,1,2,0
FILEVERSION 1,1,3,0
PRODUCTVERSION 1,1,3,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -69,12 +69,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Anhkgg. China"
VALUE "FileDescription", "WeChat���Զ˶࿪��"
VALUE "FileVersion", "1.1.2.0"
VALUE "FileVersion", "1.1.3.0"
VALUE "InternalName", "MultiWeChat"
VALUE "LegalCopyright", "Copyright (C) 2017 by Anhkgg"
VALUE "OriginalFilename", "MultiWeChat.exe"
VALUE "ProductName", "WeChat���Զ˶࿪��"
VALUE "ProductVersion", "1.1.2.0"
VALUE "ProductVersion", "1.1.3.0"
END
END
BLOCK "VarFileInfo"
Expand Down
4 changes: 3 additions & 1 deletion MultiWechat/MultiWebchat.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
<ProjectGuid>{06ABD385-B50D-491D-8FBD-2B26B46568CC}</ProjectGuid>
<RootNamespace>MultiWebchat</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<UseOfMfc>Static</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
Expand Down Expand Up @@ -74,7 +76,7 @@
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
Expand Down
19 changes: 16 additions & 3 deletions MultiWechat/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include "main.h"
#include <stdio.h>

#pragma comment(lib, "Advapi32")
#pragma comment(lib, "Shell32")

//进程提权
BOOL ElevatePrivileges()
{
Expand Down Expand Up @@ -238,14 +241,24 @@ bool InstallRevokeDll(LPWSTR Path, bool Update)
WCHAR wszDll[MAX_PATH] = { 0 };
WCHAR wszDllOrig[MAX_PATH] = { 0 };
WCHAR wszDll1[MAX_PATH] = { 0 };
WCHAR wszConfig[MAX_PATH] = { 0 };
WCHAR wszConfig1[MAX_PATH] = { 0 };

GetModuleFileName(NULL, wszDll, MAX_PATH);
PathRemoveFileSpec(wszDll);
wcscpy_s(wszDll1, Path);
PathRemoveFileSpec(wszDll);

wcscpy_s(wszConfig1, Path);
PathAppend(wszConfig1, L"superwx.ini");
wcscpy_s(wszConfig, wszDll);
PathAppend(wszConfig, L"superwx.ini");

CopyFile(wszConfig, wszConfig1, false);

wcscpy_s(wszDll1, Path);
PathAppend(wszDll, L"WeChatResource.dll");
PathAppend(wszDll1, L"WeChatResource.dll.1");
wcscpy_s(wszDllOrig, Path);
PathAppend(wszDllOrig, L"WeChatResource.dll");


if (!PathFileExists(wszDll1)) {
MoveFile(wszDllOrig, wszDll1);
Expand Down
Binary file modified WeChatResource/Resource.rc
Binary file not shown.
Binary file modified WeChatResource/WeChatResource.cpp
Binary file not shown.
12 changes: 12 additions & 0 deletions WeChatResource/WeChatResource.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,31 +149,43 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="common.h" />
<ClInclude Include="config.h" />
<ClInclude Include="dllhijack.h" />
<ClInclude Include="hook.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="util.h" />
<ClInclude Include="version.h" />
<ClInclude Include="voice.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="config.cpp" />
<ClCompile Include="dllhijack.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="hook.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="util.cpp" />
<ClCompile Include="voice.cpp" />
<ClCompile Include="WeChatResource.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Resource.rc" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="common.cpp">
<FileType>Document</FileType>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
24 changes: 24 additions & 0 deletions WeChatResource/WeChatResource.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@
<ClInclude Include="resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="voice.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="hook.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="common.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="config.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
Expand All @@ -50,6 +62,18 @@
<ClCompile Include="dllhijack.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="voice.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="hook.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="config.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="common.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Resource.rc">
Expand Down
48 changes: 48 additions & 0 deletions WeChatResource/common.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include "stdafx.h"
#include "common.h"
#include "util.h"

bool IsSupportedWxVersion(
const SuppWxCfg* cfg,
INT cfg_count,
DWORD* offset/* = NULL*/,
BYTE* orig_code/* = NULL*/,
DWORD* orig_code_count/* = NULL*/,
BYTE* fake_code/* = NULL*/,
DWORD* fake_code_count/* = NULL*/)
{
TCHAR tszDllPath[MAX_PATH] = { 0 };

GetModuleFileName(NULL, tszDllPath, MAX_PATH);
PathRemoveFileSpec(tszDllPath);
PathAppend(tszDllPath, WECHATWINDLL);

TCHAR version[100] = { 0 };
if (!GetFileVersion(tszDllPath, version))
{
return false;
}

for (int i = 0; i < cfg_count; i++) {
if (!_tcsicmp(cfg[i].version, version)) {
if (offset) {
*offset = cfg[i].revoke_offset;
}
if (orig_code) {
memcpy(orig_code, cfg[i].code.orig_code, cfg[i].code.orig_code_count);
}
if (fake_code) {
memcpy(fake_code, cfg[i].code.fake_code, cfg[i].code.fake_code_count);
}
if (orig_code_count) {
*orig_code_count = cfg[i].code.orig_code_count;
}
if (fake_code_count) {
*fake_code_count = cfg[i].code.fake_code_count;
}
return true;
}
}

return false;
}
31 changes: 31 additions & 0 deletions WeChatResource/common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pragma once

#include <windows.h>

#define WECHATWINDLL TEXT("WeChatWin.dll")
#define WECHATRESOURCE TEXT("WeChatResource.dll")
#define ORGWECHATRESOURCE TEXT("WeChatResource.dll.1")

typedef struct _FAKE_WX_CODE
{
DWORD orig_code_count;
BYTE orig_code[100];
DWORD fake_code_count;
BYTE fake_code[100];
}FakeWxCode, *PFakeWxCode;

typedef struct _SUP_WX_CFG
{
const TCHAR* version;
DWORD revoke_offset;
FakeWxCode code;
}SuppWxCfg, *PSuppWxCfg;

bool IsSupportedWxVersion(
const SuppWxCfg* cfg,
INT cfg_count,
DWORD* offset = NULL,
BYTE* orig_code = NULL,
DWORD* orig_code_count = NULL,
BYTE* fake_code = NULL,
DWORD* fake_code_count = NULL);
47 changes: 47 additions & 0 deletions WeChatResource/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "stdafx.h"
#include "config.h"

#define CONFIGFILE TEXT("superwx.ini")

WxFuncConfig::WxFuncConfig()
{
Init();
}

WxFuncConfig::~WxFuncConfig()
{

}

void WxFuncConfig::Init()
{
TCHAR tszCfgPath[MAX_PATH] = { 0 };

GetModuleFileName(GetModuleHandle(WECHATRESOURCE), tszCfgPath, MAX_PATH);
PathRemoveFileSpec(tszCfgPath);
PathAppend(tszCfgPath, CONFIGFILE);

_tcscpy_s(m_configPath, tszCfgPath);
}

bool WxFuncConfig::IsRevokeMsg()
{
return GetPrivateProfileInt(TEXT("config"), TEXT("revokemsg"), 0, m_configPath) != 0;
}

bool WxFuncConfig::IsSaveVoiceMsg(TCHAR * path)
{
TCHAR voiceMsgPath[MAX_PATH] = { 0 };

GetPrivateProfileString(TEXT("config"), TEXT("voicemsg"), TEXT(""), voiceMsgPath, MAX_PATH, m_configPath);
if (_tcslen(voiceMsgPath) > 0) {
if (path) {
_tcscpy_s(path, MAX_PATH, voiceMsgPath);
}
return true;
}
else {
return false;
}
}

18 changes: 18 additions & 0 deletions WeChatResource/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#include <windows.h>

class WxFuncConfig
{
public:
WxFuncConfig();
~WxFuncConfig();

bool IsRevokeMsg();
bool IsSaveVoiceMsg(TCHAR* path);
private:
void Init();

private:
TCHAR m_configPath[MAX_PATH];
};
Binary file modified WeChatResource/dllmain.cpp
Binary file not shown.
Loading

0 comments on commit 3ae88eb

Please sign in to comment.