diff --git a/CWeChatRobot/pch.cpp b/CWeChatRobot/pch.cpp index fa20ab235faf4671d6bff732c7bcdf05f54e6ed6..6cc9a69097a429bf9c98c124831a4bee0139af30 100644 --- a/CWeChatRobot/pch.cpp +++ b/CWeChatRobot/pch.cpp @@ -234,6 +234,7 @@ DWORD StartRobotService() { bool status = Injert(wxPid, workPath); if (status == 1) { CloseHandle(hProcess); + hProcess = NULL; return status; } return status; @@ -242,13 +243,16 @@ DWORD StartRobotService() { DWORD StopRobotService() { DWORD cpid = GetCurrentProcessId(); DWORD wxPid = GetWeChatPid(); - if (!wxPid) + if (!wxPid) { + hProcess = NULL; return cpid; + } if (!hProcess) hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, wxPid); RemoveDll(wxPid); ZeroMemory((wchar_t*)SelfInfoString.c_str(), SelfInfoString.length() * 2 + 2); CloseHandle(hProcess); + hProcess = NULL; StopReceiveMessage(); return cpid; } diff --git a/Release/CWeChatRobot.exe b/Release/CWeChatRobot.exe index 5b756837d02ab29e8cbbd1a943b7cf9b17a7d6fb..5f263194134b758a8a9bbdee7d2e907eb14d3d32 100644 Binary files a/Release/CWeChatRobot.exe and b/Release/CWeChatRobot.exe differ