no message
parent
b3f5cc3589
commit
a58d20d811
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* @Author: your name
|
||||
* @Date: 2021-07-23 23:39:57
|
||||
* @LastEditTime: 2021-07-26 00:28:04
|
||||
* @LastEditTime: 2021-07-26 23:44:58
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @Description: In User Settings Edit
|
||||
* @FilePath: \generallib\general\src\function\daemon.c
|
||||
|
@ -109,7 +109,7 @@ static int RangeProcess()
|
|||
{
|
||||
EnumProcessModules(hProcess, hMod, sizeof(hMod), &Retn_bytes2);
|
||||
GetModuleFileNameEx(hProcess, hMod[0], szModName, sizeof(szModName));
|
||||
printf("PID=%d Path=%s\n", Proc_pid[i], szModName);
|
||||
// printf("PID=%d Path=%s\n", Proc_pid[i], szModName);
|
||||
}
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ int DaemonizeMonitor::StartMonitor(){
|
|||
{
|
||||
EnumProcessModules(hProcess, hMod, sizeof(hMod), &Retn_bytes2);
|
||||
GetModuleFileNameEx(hProcess, hMod[0], szModName, sizeof(szModName));
|
||||
printf("PID=%d Path=%s\n", Proc_pid[i], szModName);
|
||||
// printf("PID=%d Path=%s\n", Proc_pid[i], szModName);
|
||||
if(itr->second == Proc_pid[i]){
|
||||
found = true;
|
||||
break;
|
||||
|
@ -216,18 +216,25 @@ int DaemonizeMonitor::StartMonitor(){
|
|||
SetProcessPrivilege("SeDebugPrivilege", 0);
|
||||
if(!found){
|
||||
// 没找到该应用实例就重启应用
|
||||
for(int i = 0;i < m_path_process.size();i++){
|
||||
if(itr->first == m_path_process.at(i)){
|
||||
|
||||
auto it = m_path_process.begin();
|
||||
while (it != m_path_process.end())
|
||||
{
|
||||
if (*it == itr->first)
|
||||
{
|
||||
it = m_path_process.erase(it);
|
||||
}
|
||||
|
||||
else
|
||||
it++;
|
||||
}
|
||||
for(auto it = m_path_process.begin();it != m_path_process.end();it++){
|
||||
std::cout<<*it<<std::endl;
|
||||
}
|
||||
this->AddNewProcess(itr->first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue