no message
parent
a58d20d811
commit
486c4ec4e8
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* @Author: your name
|
||||
* @Date: 2021-07-23 23:39:57
|
||||
* @LastEditTime: 2021-07-26 23:44:58
|
||||
* @LastEditTime: 2021-07-26 23:49:33
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @Description: In User Settings Edit
|
||||
* @FilePath: \generallib\general\src\function\daemon.c
|
||||
|
@ -9,6 +9,8 @@
|
|||
#include "daemon.h"
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
static BOOL KillProcess(DWORD dwPid)
|
||||
{
|
||||
HANDLE hPrc;
|
||||
|
@ -146,6 +148,7 @@ static int test_fork()
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
DaemonizeMonitor::DaemonizeMonitor(string path){
|
||||
this->m_path_process.push_back(path);
|
||||
|
@ -154,6 +157,7 @@ DaemonizeMonitor::DaemonizeMonitor(string path){
|
|||
|
||||
int DaemonizeMonitor::AddNewProcess(string path){
|
||||
this->m_path_process.push_back(path);
|
||||
#ifdef _WIN32
|
||||
STARTUPINFO si = {sizeof(si)};
|
||||
PROCESS_INFORMATION pi;
|
||||
si.dwFlags = STARTF_USESHOWWINDOW; //指定wShowWindow成员有效
|
||||
|
@ -180,9 +184,12 @@ int DaemonizeMonitor::AddNewProcess(string path){
|
|||
return 0;
|
||||
}
|
||||
return -1;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int DaemonizeMonitor::StartMonitor(){
|
||||
#ifdef _WIN32
|
||||
DWORD Proc_pid[1024], Retn_bytes, Proc_count, Retn_bytes2;
|
||||
unsigned int i;
|
||||
HMODULE hMod[1024];
|
||||
|
@ -236,18 +243,21 @@ int DaemonizeMonitor::StartMonitor(){
|
|||
}
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int DaemonizeMonitor::StopMonitor(string){
|
||||
|
||||
#ifdef _WIN32
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
*/
|
||||
int DaemonizeMonitor::StopProcess(string path){
|
||||
#ifdef _WIN32
|
||||
if(m_running_pid.find(path) != m_running_pid.end()){
|
||||
DWORD pid = m_running_pid.at(path);
|
||||
m_running_pid.erase(path);
|
||||
|
@ -258,4 +268,5 @@ int DaemonizeMonitor::StopProcess(string path){
|
|||
}
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
Loading…
Reference in New Issue