Browse Source

更改boot log占用问题

80374463 6 years ago
parent
commit
a7ff8704cb
2 changed files with 8 additions and 2 deletions
  1. 7 2
      sphost/sphost.c
  2. 1 0
      spshell/spshell.cpp

+ 7 - 2
sphost/sphost.c

@@ -70,12 +70,16 @@ static void SetEnvPath(const char *mod_name)
 
 DWORD sphostMonitor(LPVOID param)
 {
-	HANDLE spShellProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetProcessIdFromName(PROCESS_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_TIMEOUT == WaitForSingleObject(spShellProcess, 1000))	//spshell exit
+	while (WAIT_OBJECT_0 != WaitForSingleObject(spShellProcess, 1000))	//spshell exit
 	{
 		
 		if (waitTimes % DEFAULT_MEMORY_CLEAN_TIME == 0)
@@ -91,6 +95,7 @@ DWORD sphostMonitor(LPVOID param)
 		}
 		waitTimes++;
 	}
+
 	CloseHandle(spShellProcess);
 	ExitProcess(0);
 

+ 1 - 0
spshell/spshell.cpp

@@ -415,6 +415,7 @@ static bool SpTerminateProcess(HANDLE hProc, DWORD dwProcID)
 		sp_dbg_debug("terminate process %d fail: 0x%X, retry with taskkill", dwProcID, GetLastError());
 
 		sprintf_s(szCmd, 256, "TASKKILL /PID %d /F", dwProcID);
+		WinExec(szCmd, SW_HIDE);
 		//nRet = system(szCmd);
 		return nRet != -1;
 	}