diff --git a/WeChatFerry.sln b/WeChatFerry.sln
index 7c8422a..aa5cbf3 100644
--- a/WeChatFerry.sln
+++ b/WeChatFerry.sln
@@ -17,13 +17,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "launcher", "launcher\launch
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4DE80B82-5F6A-4C4C-9D16-1574308110FA}.Debug|x86.ActiveCfg = Debug|Win32
+ {4DE80B82-5F6A-4C4C-9D16-1574308110FA}.Debug|x86.Build.0 = Debug|Win32
{4DE80B82-5F6A-4C4C-9D16-1574308110FA}.Release|x86.ActiveCfg = Release|Win32
{4DE80B82-5F6A-4C4C-9D16-1574308110FA}.Release|x86.Build.0 = Release|Win32
+ {ABFCB647-137F-478B-A73E-F0B1E3ADC215}.Debug|x86.ActiveCfg = Debug|x64
{ABFCB647-137F-478B-A73E-F0B1E3ADC215}.Release|x86.ActiveCfg = Release|Win32
{ABFCB647-137F-478B-A73E-F0B1E3ADC215}.Release|x86.Build.0 = Release|Win32
+ {B11ADC6F-20DA-4DEF-A8A0-60374427D4C6}.Debug|x86.ActiveCfg = Debug|x64
{B11ADC6F-20DA-4DEF-A8A0-60374427D4C6}.Release|x86.ActiveCfg = Release|Win32
{B11ADC6F-20DA-4DEF-A8A0-60374427D4C6}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
diff --git a/launcher/Launcher.h b/launcher/Launcher.h
index 00967af..32b6d0e 100644
--- a/launcher/Launcher.h
+++ b/launcher/Launcher.h
@@ -107,7 +107,7 @@ namespace launcher {
private: System::Void Start_Click(System::Object^ sender, System::EventArgs^ e) {
this->Start->Enabled = false;
this->Stop->Enabled = true;
- WxInitSDK();
+ WxInitSDK(true);
}
private: System::Void Stop_Click(System::Object^ sender, System::EventArgs^ e) {
this->Stop->Enabled = false;
diff --git a/launcher/launcher.vcxproj b/launcher/launcher.vcxproj
index ff368f2..073a34f 100644
--- a/launcher/launcher.vcxproj
+++ b/launcher/launcher.vcxproj
@@ -85,7 +85,7 @@
main
- xcopy /y $(OutDir)launcher.exe $(OutDir)out\launcher
+ xcopy /y $(OutDir)launcher.exe $(SolutionDir)Out
Copy files
diff --git a/sdk/SDK.vcxproj b/sdk/SDK.vcxproj
index 2667810..e51793b 100644
--- a/sdk/SDK.vcxproj
+++ b/sdk/SDK.vcxproj
@@ -126,8 +126,7 @@
sdk.def
- xcopy /y $(OutDir)sdk.dll $(OutDir)out\launcher
-xcopy /y $(OutDir)sdk.dll $(SolutionDir)python\wcferry
+ xcopy /y $(OutDir)sdk.dll $(SolutionDir)Out
Copy files
diff --git a/sdk/main.cpp b/sdk/main.cpp
new file mode 100644
index 0000000..7a3e90a
--- /dev/null
+++ b/sdk/main.cpp
@@ -0,0 +1,27 @@
+#include
+#include
+
+#include "sdk.h"
+
+void help() { printf("Usage: sdk.exe start|stop [debug]"); }
+
+int main(int argc, char *argv[])
+{
+ int ret = -1;
+ bool debug = false;
+ if ((argc < 2) || (argc > 3)) {
+ help();
+ } else if (argc == 3) {
+ debug = (strcmp(argv[2], "debug") == 0);
+ }
+
+ if (strcmp(argv[1], "start") == 0) {
+ ret = WxInitSDK(debug);
+ } else if (strcmp(argv[1], "stop") == 0) {
+ ret = WxDestroySDK();
+ } else {
+ help();
+ }
+
+ return ret;
+}
\ No newline at end of file
diff --git a/sdk/sdk.cpp b/sdk/sdk.cpp
index 3951efe..db33369 100644
--- a/sdk/sdk.cpp
+++ b/sdk/sdk.cpp
@@ -1,4 +1,4 @@
-#include "Shlwapi.h"
+#include "Shlwapi.h"
#include "framework.h"
#include
#include
@@ -13,17 +13,21 @@ static HANDLE wcProcess = NULL;
static HMODULE spyBase = NULL;
static WCHAR spyDllPath[MAX_PATH] = { 0 };
-int WxInitSDK()
+int WxInitSDK(bool debug)
{
int status = 0;
InitLogger();
LOG_INFO("WxInitSDK.");
GetModuleFileName(GetModuleHandle(WECHATSDKDLL), spyDllPath, MAX_PATH);
PathRemoveFileSpec(spyDllPath);
- PathAppend(spyDllPath, WECHATINJECTDLL);
+ if (debug) {
+ PathAppend(spyDllPath, WECHATINJECTDLL_DEBUG);
+ } else {
+ PathAppend(spyDllPath, WECHATINJECTDLL);
+ }
if (!PathFileExists(spyDllPath)) {
- LOG_ERROR("DLL does not exists.");
+ LOG_ERROR("DLL does not exists: {}.", Wstring2String(spyDllPath));
return ERROR_FILE_NOT_FOUND;
}
diff --git a/sdk/sdk.h b/sdk/sdk.h
index d982143..1f5eacf 100644
--- a/sdk/sdk.h
+++ b/sdk/sdk.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
-int WxInitSDK();
+int WxInitSDK(bool debug);
int WxDestroySDK();
diff --git a/spy/Spy.vcxproj b/spy/Spy.vcxproj
index 88a7114..222e66f 100644
--- a/spy/Spy.vcxproj
+++ b/spy/Spy.vcxproj
@@ -74,6 +74,7 @@
true
+ $(ProjectName)_debug
false
@@ -90,28 +91,9 @@
true
+ Release
-
- Level3
- true
- WIN32;_DEBUG;SPY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
- NotUsing
-
-
- stdcpp17
- $(SolutionDir)rpc;$(SolutionDir)rpc\nanopb;$(SolutionDir)rpc\proto;$(SolutionDir)spy;C:\Tools\vcpkg\installed\x86-windows-static\include
-
-
-
- Windows
- true
- false
- spy.def
-
-
-
Level3
true
@@ -138,9 +120,52 @@
spy.def
- cd $(OutDir)
-md out\launcher
-xcopy /y $(OutDir)spy.dll $(SolutionDir)python\wcferry
+ cd $(SolutionDir)
+md Out
+xcopy /y $(OutDir)$(TargetFileName) Out
+
+
+ Copy spy.dll
+
+
+ cd $(SolutionDir)rpc\proto
+C:\Tools\nanopb\protoc --nanopb_out=. wcf.proto
+
+
+
+ Generating PB files
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;SPY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ NotUsing
+
+
+ $(SolutionDir)rpc;$(SolutionDir)rpc\nanopb;$(SolutionDir)rpc\proto;$(SolutionDir)spy;C:\Tools\vcpkg\installed\x86-windows-static\include
+
+ 4251;4819
+ MultiThreaded
+ stdcpp17
+
+
+ Windows
+ true
+ true
+ true
+ false
+ iphlpapi.lib;wsock32.lib;ws2_32.lib;crypt32.lib;%(AdditionalDependencies)
+ spy.def
+
+
+ cd $(SolutionDir)
+md Out
+xcopy /y $(OutDir)$(TargetFileName) Out
Copy spy.dll
diff --git a/spy/util.h b/spy/util.h
index 26542a2..948fbf5 100644
--- a/spy/util.h
+++ b/spy/util.h
@@ -2,10 +2,11 @@
#include
-#define WECHAREXE L"WeChat.exe"
-#define WECHATWINDLL L"WeChatWin.dll"
-#define WECHATSDKDLL L"sdk.dll"
-#define WECHATINJECTDLL L"spy.dll"
+#define WECHAREXE L"WeChat.exe"
+#define WECHATWINDLL L"WeChatWin.dll"
+#define WECHATSDKDLL L"sdk.dll"
+#define WECHATINJECTDLL L"spy.dll"
+#define WECHATINJECTDLL_DEBUG L"spy_debug.dll"
#define GET_DWORD(addr) ((DWORD) * (DWORD *)(addr))
#define GET_STRING(addr) ((CHAR *)(*(DWORD *)(addr)))