Enhance robustness
This commit is contained in:
parent
7228fb35ea
commit
7c1f4123f0
@ -8,9 +8,7 @@
|
|||||||
#include "sdk.h"
|
#include "sdk.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#define WCF_LOCK ".wcf.lock"
|
static BOOL injected = false;
|
||||||
|
|
||||||
static bool dbg = false;
|
|
||||||
static HANDLE wcProcess = NULL;
|
static HANDLE wcProcess = NULL;
|
||||||
static HMODULE spyBase = NULL;
|
static HMODULE spyBase = NULL;
|
||||||
static WCHAR spyDllPath[MAX_PATH] = { 0 };
|
static WCHAR spyDllPath[MAX_PATH] = { 0 };
|
||||||
@ -35,7 +33,6 @@ static int GetDllPath(bool debug, wchar_t *dllPath)
|
|||||||
|
|
||||||
int WxInitSDK(bool debug, int port)
|
int WxInitSDK(bool debug, int port)
|
||||||
{
|
{
|
||||||
dbg = debug;
|
|
||||||
int status = 0;
|
int status = 0;
|
||||||
DWORD wcPid = 0;
|
DWORD wcPid = 0;
|
||||||
|
|
||||||
@ -66,17 +63,22 @@ int WxInitSDK(bool debug, int port)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
injected = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WxDestroySDK()
|
int WxDestroySDK()
|
||||||
{
|
{
|
||||||
if (!CallDllFunc(wcProcess, spyDllPath, spyBase, "CleanupSpy", NULL)) {
|
if (!injected) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!CallDllFunc(wcProcess, spyDllPath, spyBase, "CleanupSpy", NULL)) {
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
if (!EjectDll(wcProcess, spyBase)) {
|
if (!EjectDll(wcProcess, spyBase)) {
|
||||||
return -1; // TODO: Unify error codes
|
return -3; // TODO: Unify error codes
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user