|
|
@@ -70,16 +70,16 @@ static void SetEnvPath(const char *mod_name)
|
|
|
|
|
|
DWORD sphostMonitor(LPVOID param)
|
|
|
{
|
|
|
- HANDLE spShellProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetProcessIdFromName(PROCESS_SPSHELL)); //获取的是准确的spshell.exe的pid
|
|
|
- int waitTimes = 1;
|
|
|
- if (NULL == spShellProcess)
|
|
|
- {
|
|
|
- CloseHandle(spShellProcess);
|
|
|
- ExitProcess(-1); //can not find spShell
|
|
|
- }
|
|
|
+// HANDLE spShellProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetProcessIdFromName(PROCESS_SPSHELL)); //获取的是准确的spshell.exe的pid
|
|
|
+// int waitTimes = 1;
|
|
|
+// if (NULL == spShellProcess)
|
|
|
+// {
|
|
|
+// CloseHandle(spShellProcess);
|
|
|
+// ExitProcess(-1); //can not find spShell
|
|
|
+// }
|
|
|
|
|
|
-
|
|
|
- while (WAIT_OBJECT_0 != WaitForSingleObject(spShellProcess, 1000)) //spshell exit
|
|
|
+ int waitTimes = 1;
|
|
|
+ while (0 != GetProcessIdFromName(PROCESS_SPSHELL)) //spshell exit
|
|
|
{
|
|
|
|
|
|
if (waitTimes % DEFAULT_MEMORY_CLEAN_TIME == 0)
|
|
|
@@ -94,9 +94,9 @@ DWORD sphostMonitor(LPVOID param)
|
|
|
Dbg("进程%d, 释放内存, 当前占用为:\t%dK", GetCurrentProcessId(), memoryInfo / 1000);
|
|
|
}
|
|
|
waitTimes++;
|
|
|
+ Sleep(1000);
|
|
|
}
|
|
|
|
|
|
- CloseHandle(spShellProcess);
|
|
|
ExitProcess(0);
|
|
|
|
|
|
return 0;
|