Add debug build

This commit is contained in:
Changhua
2023-02-25 01:53:02 +08:00
parent 6b94c3d6aa
commit b6b38376f8
9 changed files with 98 additions and 37 deletions
+1 -2
View File
@@ -126,8 +126,7 @@
<ModuleDefinitionFile>sdk.def</ModuleDefinitionFile>
</Link>
<PostBuildEvent>
<Command>xcopy /y $(OutDir)sdk.dll $(OutDir)out\launcher
xcopy /y $(OutDir)sdk.dll $(SolutionDir)python\wcferry</Command>
<Command>xcopy /y $(OutDir)sdk.dll $(SolutionDir)Out</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy files</Message>
+27
View File
@@ -0,0 +1,27 @@
#include <stdio.h>
#include <string.h>
#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;
}
+8 -4
View File
@@ -1,4 +1,4 @@
#include "Shlwapi.h"
#include "Shlwapi.h"
#include "framework.h"
#include <process.h>
#include <tlhelp32.h>
@@ -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;
}
+2 -2
View File
@@ -1,4 +1,4 @@
#pragma once
#pragma once
int WxInitSDK();
int WxInitSDK(bool debug);
int WxDestroySDK();