CN109426591A - Guard the method and apparatus of multiple processes of the single program of windows - Google Patents
Guard the method and apparatus of multiple processes of the single program of windows Download PDFInfo
- Publication number
- CN109426591A CN109426591A CN201710787819.0A CN201710787819A CN109426591A CN 109426591 A CN109426591 A CN 109426591A CN 201710787819 A CN201710787819 A CN 201710787819A CN 109426591 A CN109426591 A CN 109426591A
- Authority
- CN
- China
- Prior art keywords
- turned
- list
- parameter
- information
- new
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1415—Saving, restoring, recovering or retrying at system level
- G06F11/1438—Restarting or rejuvenating
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1479—Generic software techniques for error detection or fault masking
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The present invention provides the method and apparatus for guarding multiple processes of the single program of windows, wherein, which comprises receive the title of target windows program and timing executes following steps: obtaining all id informations for having been turned on process relevant to the target windows program;By all id informations for having been turned on process and finger daemon guard it is all in list be compared by the id information of finger daemon, judge whether there is the process newly started and the process being turned off;The guarding in list of the finger daemon is added in the process of the new starting by the process newly started if it exists;And/or the process being turned off if it exists, then judge whether to need to restart the process being turned off, if desired restart, then the process being turned off is restarted according to acquired start-up parameter.The present invention, which realizes, guards multiple processes of single program.
Description
Technical field
The present invention relates to field of computer technology, more particularly, to the multiple processes for guarding the single program of windows
Method and apparatus.
Background technique
Under normal conditions, finger daemon is guarded the single process of some program, the effect of finger daemon
It is that can restart the process when process guarded is pent because of certain reason.But in actual development, it can meet
It needs to open multiple processes to a certain program and multiple processes requires the case where guarding.
The multiple processes opened to a certain program are guarded, and more difficulties, such as the phase of process can be related to
It closes the catalogue that possible different or even these processes of start-up parameter are opened and is also possible to difference, cause using existing to a certain journey
Multiple processes that sequence is opened, which guard, to be not easy to realize.It would therefore be highly desirable to provide a kind of method, can be realized to a certain program
The multiple processes opened are guarded.
Summary of the invention
In order to solve the problems, such as that the prior art is not easy to realize that the multiple processes for opening a certain program are guarded, the present invention
The method and apparatus for guarding multiple processes of the single program of windows is provided.
According to an aspect of the present invention, the method for guarding multiple processes of the single program of windows is provided, comprising:
It receives the title of target windows program and timing executes following steps:
S1 obtains all id informations for having been turned on process relevant to the target windows program;
S2, guarding for all id informations for having been turned on process and finger daemon is all by finger daemon in list
Id information is compared, and judges whether there is the process newly started and the process being turned off;
The guarding in list of the finger daemon is added in the process of the new starting by S3, the process newly started if it exists;
And/or
S4, the process being turned off if it exists and exit code at the start-up parameter for the process being turned off described in acquisition, and according to institute
The value whether start-up parameter obtained successfully and exited code is stated, judges whether to need to restart the process being turned off, if desired weigh
It opens, then the process being turned off is restarted according to acquired start-up parameter.
Wherein, the method also includes:
If getting the target windows program there are new launching process, by the start-up parameter of new launching process and
Exit guarding in configuration file under catalogue where the target windows program is written in code;
If getting user has actively closed process, kept described in the id information update of the process actively closed by user
The process that the user in shield configuration file actively closes exits code.
Wherein, the step S1 further comprises:
S11 process list snapshot handle and traverses all system process in the process list in acquisition system;
S12 compares the process name of all system process and the title of the target windows program that traversal obtains
Compared with acquisition all id informations for having been turned on process relevant to the target windows program;
S13 closes the process list snapshot handle, free system resources.
Wherein, the step S11 further comprises:
Process list snapshot handle in CreateToolhelp32Snapshot function acquisition system is called, and is passed through
Process32First function is directed toward the head of the process list, traverses the process list by Process32Next function
In all system process.
Wherein, the step S3 further comprises:
S31, the process newly started if it exists obtain the new starting then according to the id information of the process of the new starting
Process contain starting path filename;
The id information of the process of the new starting and the filename are stored in guarding for the finger daemon by S32 simultaneously
List is guarded in list to update.
Wherein, the step S31 further comprises:
OpenProcess function is used by the id information of the process of the new starting for the process of all new startings
The handle of the process of the new starting is obtained, and obtains the process of the new starting by GetModuleFileNameExA function
Filename.
Wherein, the mesh by the start-up parameter of the new launching process and where exiting the code write-in target windows program
The step guarded in configuration file under record further comprises:
Guarding under the starting catalogue where calling WritePrivateProfileStringA function toward new launching process
The start-up parameter of the new launching process is written for key with the id information of the new launching process in configuration file and exits code,
Wherein, exiting yard default setting is 1;Correspondingly, it actively closes to guard described in the id information update of process by the user and match
Set that the user in file actively closes process further comprises the step of exiting yard:
The id information of process for calling WritePrivateProfileStringA function to actively close with the user is
Key sets 0 for the code that exits for guarding the process that user described in configuration file actively closes.
Wherein, the step S4 further comprises:
S41, the process being turned off if it exists then guard the text of the process being turned off saved in list according to
Part name, the starting path for the process being turned off described in acquisition;
S42 accesses and guards configuration file under the starting path, calls GetPrivateProfileStringA function
The start-up parameter for the process being turned off described in acquisition and exit code;
S43, if it is 1 that the start-up parameter, which obtains successfully and exits code, it is determined that the process being turned off is abnormal closes
Process is closed, calls CreateProcessA function to restart the abnormal closing process according to the start-up parameter and filename, and
The new process id information after the abnormal closing process is restarted is obtained, is guarded in list and is protected with the new process ID information update
The abnormal id information for closing process deposited;Alternatively,
If it is 0 that the start-up parameter, which obtains failure or exits code, the process being turned off is not restarted, is kept described
The relevant information for guarding the process being turned off described in deletion in list of shield process.
According to another aspect of the present invention, the equipment for guarding multiple processes of the single program of windows is provided, comprising:
Memory, processor and bus,
The processor and memory complete mutual communication by the bus;
The memory is stored with the program instruction that can be executed by the processor, and the processor calls the memory
In program instruction, to execute foregoing method.
According to a further aspect of the invention, a kind of non-transient computer readable storage medium, the non-transient meter are provided
Calculation machine readable storage medium storing program for executing stores computer instruction, and the computer instruction makes the computer execute foregoing method.
The method and apparatus of the multiple processes proposed by the present invention for guarding the single program of windows, it is fixed by finger daemon
When all processes by demons for starting in polling system, obtain the process of all new startings and the process of closing,
The process newly started is guarded, the process closed extremely is restarted, is realized to the multiple of single windows program
Process is guarded.
Detailed description of the invention
Fig. 1 is that the process of the method for the multiple processes for guarding the single program of windows that one embodiment of the invention provides is shown
It is intended to;
Fig. 2 be another embodiment of the present invention provides based on the above embodiment in step S1 flow diagram;
Fig. 3 be another embodiment of the present invention provides based on the above embodiment in step S3 flow diagram;
Fig. 4 be another embodiment of the present invention provides based on the above embodiment in step S4 flow diagram;
Fig. 5 be another embodiment of the present invention provides the multiple processes for guarding the single program of windows equipment structure
Schematic diagram.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, the technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only
It is only a part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiment of the present invention, ordinary skill people
Member's every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
As shown in Figure 1, be the method for the multiple processes for guarding the single program of windows that one embodiment of the invention provides
Flow diagram, comprising:
It receives the title of target windows program and timing executes following steps:
S1 obtains all id informations for having been turned on process relevant to the target windows program;
S2, guarding for all id informations for having been turned on process and finger daemon is all by finger daemon in list
Id information is compared, and judges whether there is the process newly started and the process being turned off;
The guarding in list of the finger daemon is added in the process of the new starting by S3, the process newly started if it exists;
And/or
S4, the process being turned off if it exists and exit code at the start-up parameter for the process being turned off described in acquisition, and according to institute
The value whether start-up parameter obtained successfully and exited code is stated, judges whether to need to restart the process being turned off, if desired weigh
It opens, then the process being turned off is restarted according to acquired start-up parameter.
Specifically, target windows program is the windows program guarded, and finger daemon is to target windows program
Guarded, it is necessary first to receive and guarded the title of windows program, then in timing Ergodic Theory with guarded
Windows program is relevant all to have been turned on process.In S1, finger daemon obtains all in the process list of system first
Process, all processes in system process list are all the processes having been started up at current time, then according to being guarded windows
The title of program filtered out from system process list it is relevant to windows program is guarded it is all have been turned on process, and obtain
Take all id informations for having been turned on process relevant to by windows program is guarded.
S2, finger daemon believe the accessed all IDs that have been turned on process relevant to by windows program is guarded
It ceases and is compared with stored in list all of guarding of finger daemon by the id information of finger daemon, judge whether deposit in system
In the process newly started and the process being turned off, and then the ID of the process of available new starting and/or the process being turned off believes
Breath.When finger daemon goes to step S2 for the first time, finger daemon guards that list is empty, at this point, in system with guarded
The relevant all processes that have been turned on of windows program are the process newly started.What the guarding of finger daemon saved in list is
All processes relevant to windows program is guarded started in system in upper a cycle.By the process of having been turned on
All be compared by the id information of finger daemon of id information and finger daemon guarded in list also i.e. will be acquired in this
To the id information for having been turned on process it is all relevant with windows program is guarded in system after upper a cycle
Process is compared, if there is newly-increased id information, illustrates there is the process newly started in current system, be newly meant that with
Upper a cycle, which is compared, to be got.Certain id informations are lacked if getting, have illustrated that the process in current system is one week relatively upper
There is the process being closed in the phase.
According to step S2's as a result, correspondingly execute step S3 and/or S4, specifically include following three kinds of situations:
If only existing the process newly started, guarding in list to finger daemon is added in the process of the new starting, with
Guard finger daemon to the process newly started, by the step for, enable the finger daemon of the embodiment of the present invention
Multiple processes are guarded, multiple processes that user starts at any time can be guarded simultaneously.
If only existing the process being turned off, obtain first described in the start-up parameter of process that is turned off and exit code,
In the embodiment of the present invention, the process of each starting is corresponding with start-up parameter and exits code, and start-up parameter is moved back for restarting process
It is that user actively closes or exception is closed that code, which is used to indicate the process, out, for the process that user actively closes, finger daemon
Ignore, for the process closed extremely, finger daemon can just go to go to restart according to start-up parameter.Then, it is opened according to described
The value whether dynamic parameter obtained successfully and exited code judges whether to need to restart the process closed, if start-up parameter energy
It enough successfully obtains and exits code and also indicate that the process is closed extremely, then illustrate that process needs are restarted;If starting ginseng
Number successfully can not obtain or exit code and indicate that the process is that user actively closes, then ignores the process, by the process from keeping
Guarding in list for shield process is deleted.If desired restart, then the process being turned off is restarted according to acquired start-up parameter;
Alternatively, the relevant information of the process being turned off is deleted from guarding in list for the finger daemon if not needing to restart
It removes.
If existing simultaneously the process newly started and the process being turned off, the process newly started is added to finger daemon
It guards in list;Meanwhile judge whether the process being turned off needs to restart, if desired restart, then restart it is described be turned off into
Journey, so that finger daemon can continue to guard the process being turned off;If not needing to restart, it is not restarted, by institute
It states the relevant information of the process being turned off and deletes from guarding in list.
Finger daemon periodically sequentially repeats above-mentioned steps, is guarded with realizing target windows program.
The method of the multiple processes provided in an embodiment of the present invention for guarding the single program of windows, it is fixed by finger daemon
When all processes by demons for starting in polling system, obtain the process of all new startings and the process of closing,
The process newly started is guarded, the process closed extremely is restarted, is realized to the multiple of single windows program
Process is guarded.
Based on the above embodiment, the method also includes:
If getting the target windows program there are new launching process, by the start-up parameter of new launching process and
Exit guarding in configuration file under catalogue where the target windows program is written in code;
If getting user has actively closed process, kept described in the id information update of the process actively closed by user
The process that the user in shield configuration file actively closes exits code.
Either finger daemon arbitrarily twice in polling system the relevant process of target windows program interprocedual every
In, or in any one secondary polling system of finger daemon during process relevant to target windows program, if system
It gets and is guarded the process of windows program and successfully start up, then by the start-up parameter of new launching process and exit code simultaneously
Guarding in configuration file under the catalogue where guarding windows program is written.Start-up parameter already mentioned above is used for
Restart process, usually the information such as port numbers, server, exit code be used to indicate process exit be user actively close also
Extremely occur.For example, can will move out yard default setting is 1, exiting code is that 0 expression user normally exits, when normally exiting,
Finger daemon does not need to restart the process;Exiting code is that other values indicate that process exception exits, and exits extremely and means that need
Finger daemon is wanted to restart the process.
When finger daemon starting, guards configuration file and be read.But after finger daemon starting, if system administration
Member, which has changed, guards configuration file, needs that finger daemon is notified to read this again and guard configuration file, finger daemon is guarded by reading again
Configuration file can get start-up parameter corresponding to process and exit code, to be restarted and other movements.Pay attention to
Here start multiple processes in the program under a catalogue, although the information such as parameter, which are all that write-in is same, guards configuration text
It in part, but is all with process ID number for label, so will not influence each other.
If system gets user and has actively closed process, finger daemon do not need to guard again user actively closed into
Journey, then the id information of the process actively closed by the user update described in the user that guards in configuration file actively close
The process closed exits code, such as sets 0 for the code that exits for the process that user actively closes, and indicates that the process is normally to exit
's.
It can be seen that whether being needed to restart by finger daemon, it is to be determined by user, also avoids user not
The possibility of the process initiation needed.The information of configuration file is guarded by being written, it is known that the phase of the process of program starting
It closes parameter information and whether this by finger daemon is the information such as to actively close.
As shown in Fig. 2, for another embodiment of the present invention provides based on the above embodiment in step S1 process signal
Figure, i.e., the described step S1 further comprises:
S11 process list snapshot handle and traverses all system process in the process list in acquisition system;
S12 compares the process name of all system process and the title of the target windows program that traversal obtains
Compared with acquisition all id informations for having been turned on process relevant to the target windows program;
S13 closes the process list snapshot handle, free system resources.
Step S11 is specially to call process list snapshot sentence in CreateToolhelp32Snapshot function acquisition system
Handle, and it is directed toward by Process32First function the head of the process list, by described in Process32Next function traversal
All system process in process list.
Then the process title of the system process obtained traversal in S12 and the title of the target windows program
It is compared, so that it may obtain the essential information of the associated process of the program of target windows described in current system starting, here
We only need to obtain process id information.
S13 is finally executed, CloseHandle function is called to close acquired in CreateToolhelp32Snapshot function
Process list snapshot handle, with free system resources.
As shown in figure 3, for another embodiment of the present invention provides based on the above embodiment in step S3 process signal
Figure, i.e., the described step S3 further comprises:
S31, the process newly started if it exists obtain the new starting then according to the id information of the new launching process
Process contains the filename in starting path;
The id information of the process of the new starting and the filename are stored in guarding for the finger daemon by S32 simultaneously
List is guarded in list to update.
Specifically, step S31 uses the process of all new startings by the id information of the process of the new starting
OpenProcess function obtains the handle of the new launching process, and obtains institute by GetModuleFileNameExA function
State the filename of new launching process.The process file name includes the path of the process initiation.It is aware of the path of the starting of process,
Guarding configuration file " daemon.data " for process can be got by the path, the step for be starting to process
Path is confirmed, guards configuration file corresponding to the process so as to correctly be accessed.
Then the id information of process of the new starting and the filename of the process are saved in together and keep by execution step S32
It protects in list.The process guarded in list is exactly the process that finger daemon needs to guard, when wherein a certain process is former because of exception
When because closing, finger daemon accesses the start-up parameter of the process guarded in configuration file by the filename of the process, thus
It is restarted according to start-up parameter.Finally CloseHandle function is called to close the process that OpenProcess function is opened
Handle.
Based on the above embodiment, the target windows is written into code is exited in the start-up parameter of the new launching process
The step guarded in configuration file under catalogue where program further comprises:
Guarding under the starting catalogue where calling WritePrivateProfileStringA function toward new launching process
The start-up parameter of the new launching process is written for key with the id information of the new launching process in configuration file and exits code,
Wherein, exiting yard default setting is 1;Correspondingly, it actively closes to guard described in the id information update of process by the user and match
Set that the user in file actively closes process further comprises the step of exiting yard:
WritePrivateProfileStringA function is called to actively close the id information of process with the user as key
By it is described guard user described in configuration file and actively close the code that exits of process be set as 0.
Specifically, with the id information of new launching process be key be to distinguish each process for convenience, then according to each into
The id information of journey very easily start-up parameter corresponding to lookup process and can exit code in guarding configuration file.Although into
It the start-up parameter of journey and exits code all and is that write-in is same guards in configuration file, but be label, Bu Huixiang with process id information
Mutually influence.Keeping under the starting catalogue where calling WritePrivateProfileStringA function toward the new launching process
Opening for the new launching process is written for key with the id information of the new launching process in shield configuration file " daemon.data "
It moves parameter and exits code, wherein exiting yard default setting is 1;
Correspondingly, it is actively closed by the user and guards the use in configuration file described in the id information update of process
What family actively closed process further comprises the step of exiting yard:
The id information of process for calling WritePrivateProfileStringA function to actively close with the user is
Key sets 0 for the code that exits for guarding the process that user described in configuration file " daemon.data " actively closes.It will
The code that exits for the process that user actively closes is set as 0, indicates that the process normally exits.
As shown in figure 4, for another embodiment of the present invention provides based on the above embodiment in step S4 process signal
Figure, i.e., the described step S4 further comprises:
S41, the process being turned off if it exists then guard the text of the process being turned off saved in list according to
Part name, the starting path for the process being turned off described in acquisition;
S42 accesses and guards configuration file under the starting path, calls GetPrivateProfileStringA function
The start-up parameter for the process being turned off described in acquisition and exit code;
S43, if it is 1 that the start-up parameter, which obtains successfully and exits code, it is determined that the process being turned off is abnormal closes
Process is closed, calls CreateProcessA function to restart the abnormal closing process according to the start-up parameter and filename, and
The new process id information after the abnormal closing process is restarted is obtained, is guarded in list and is protected with the new process ID information update
The abnormal id information for closing process deposited;Alternatively,
If it is 0 that the start-up parameter, which obtains failure or exits code, the process being turned off is not restarted, is kept described
The relevant information for guarding the process being turned off described in deletion in list of shield process.
Specifically, step S4 is handled the process being turned off.For all processes being turned off, by guarding column
The information of the process file name saved in table obtains the catalogue started by finger daemon, so that it may which access program guards configuration
File " daemon.data " calls GetPrivateProfileStringA function guarding configuration by the process id information
The start-up parameter of the process is obtained in file " daemon.data " and exits code.If can obtain process relevant parameter and
Exiting code is not 0, it is determined that the process being turned off is that abnormal closing process needs are restarted, then opens by the way that the process is corresponding
Dynamic parameter and process file name call CreateProcessA function to restart the process, and obtain after restarting into
Journey id information guards the id information of the process being turned off saved in list with new process ID information update;If no
Getting start-up parameter and perhaps exiting code is 0 to have meant that abnormal conditions or user have actively closed the process, then does not start
The process, and the relevant information for guarding the process saved in list is deleted in guarding list, relevant information includes the process
Id information and filename.
As shown in figure 5, for another embodiment of the present invention provides the multiple processes for guarding the single program of windows equipment
Structural schematic diagram, comprising: memory 51, processor 52 and bus 53,
The processor 52 and memory 51 complete mutual communication by the bus 53;
The memory 51 is stored with the program instruction that can be executed by the processor 52, and the processor 52 calls described
Program instruction in memory, to execute the method as described in the various embodiments described above, for example, S1 is obtained and the target
The relevant all id informations for having been turned on process of windows program;S2, by all id informations for having been turned on process with guard
Process guard it is all in list be compared by the id information of finger daemon, judge whether there is the process newly started and closed
The process closed;S3, the process newly started if it exists guard list for what the process of the new starting was added the finger daemon
In;And/or S4, the process being turned off if it exists, the start-up parameter for the process being turned off described in acquisition and code is exited, according to institute
It states start-up parameter and whether obtains successfully and exit code and judge whether to need to restart the process being turned off, if desired restart, then
The process being turned off is restarted according to acquired start-up parameter.
According to a further aspect of the invention, a kind of non-transient computer readable storage medium, the non-transient meter are provided
Calculation machine readable storage medium storing program for executing stores computer instruction, and the computer instruction executes the computer such as the various embodiments described above institute
The method stated, it may for example comprise: S1 obtains all id informations for having been turned on process relevant to the target windows program;
S2, by all id informations for having been turned on process and finger daemon guard in list all id informations by finger daemon into
Row compares, and judges whether there is the process newly started and the process being turned off;S3, the process newly started if it exists will be described new
The guarding in list of the finger daemon is added in the process of starting;And/or S4, the process being turned off if it exists, acquisition are described
The start-up parameter of the process of closing and code is exited, whether obtains successfully and exit code according to the start-up parameter and judge whether needs
Restart the process being turned off, if desired restart, then the process being turned off is restarted according to acquired start-up parameter.
Those of ordinary skill in the art will appreciate that: realize that all or part of the steps of above method embodiment can pass through
The relevant hardware of program instruction is completed, and program above-mentioned can be stored in a computer readable storage medium, the program
When being executed, step including the steps of the foregoing method embodiments is executed;And storage medium above-mentioned includes: ROM, RAM, magnetic disk or light
The various media that can store program code such as disk.
The apparatus embodiments of the multiple processes for guarding the single program of windows of offer described above are only to illustrate
Property, wherein the unit as illustrated by the separation member may or may not be physically separated, as unit
The component of display may or may not be physical unit, it can and it is in one place, or may be distributed over more
In a network unit.Some or all of the modules therein can be selected to realize this embodiment scheme according to the actual needs
Purpose.Those of ordinary skill in the art are without paying creative labor, it can understand and implement.
Through the above description of the embodiments, those skilled in the art can be understood that each embodiment can
It realizes by means of software and necessary general hardware platform, naturally it is also possible to pass through hardware.Based on this understanding, on
Stating technical solution, substantially the part that contributes to existing technology can be embodied in the form of software products in other words, should
Computer software product may be stored in a computer readable storage medium, such as ROM/RAM, magnetic disk, CD, including several fingers
It enables and using so that a computer equipment (can be personal computer, server or the network equipment etc.) executes each implementation
Method described in certain parts of example or embodiment.
Finally, method of the invention is only preferable embodiment, it is not intended to limit the scope of the present invention.It is all
Within the spirit and principles in the present invention, any modification, equivalent replacement, improvement and so on should be included in protection of the invention
Within the scope of.
Claims (10)
1. the method for guarding multiple processes of the single program of windows characterized by comprising
It receives the title of target windows program and timing executes following steps:
S1 obtains all id informations for having been turned on process relevant to the target windows program;
S2 believes all ID by finger daemon in list that guard of all id informations for having been turned on process and finger daemon
Breath is compared, and judges whether there is the process newly started and the process being turned off;
The guarding in list of the finger daemon is added in the process of the new starting by S3, the process newly started if it exists;With/
Or,
S4, the process being turned off if it exists and exits code at the start-up parameter for the process being turned off described in acquisition, and is opened according to described
Whether dynamic parameter obtains successfully and exits the value of code, judges whether to need to restart the process being turned off, if desired restart, then
The process being turned off is restarted according to acquired start-up parameter.
2. the method according to claim 1, wherein the method also includes:
If getting the target windows program there are new launching process, by the start-up parameter of the new launching process and
Exit guarding in configuration file under catalogue where the target windows program is written in code;
If getting user has actively closed process, guards and match described in the id information update of the process actively closed by user
That sets the process that the user in file actively closes exits code.
3. according to the method described in claim 2, it is characterized in that, the step S1 further comprises:
S11 process list snapshot handle and traverses all system process in the process list in acquisition system;
The process name for all system process that traversal obtains is compared by S12 with the title of the target windows program,
Obtain all id informations for having been turned on process relevant to the target windows program;
S13 closes the process list snapshot handle, free system resources.
4. according to the method described in claim 3, it is characterized in that, the step S11 further comprises:
Process list snapshot handle in CreateToolhelp32Snapshot function acquisition system is called, and is passed through
Process32First function is directed toward the head of the process list, traverses the process list by Process32Next function
In all system process.
5. according to the method described in claim 2, it is characterized in that, the step S3 further comprises:
S31, the process newly started if it exists, then according to the id information of the process of the new starting, obtain the new starting into
Journey contains the filename in starting path;
S32, what the id information of the process of the new starting and the filename were stored in the finger daemon simultaneously guards list
In with update guard list.
6. according to the method described in claim 5, it is characterized in that, the step S31 further comprises:
The process of all new startings is obtained by the id information of the process of the new starting using OpenProcess function
The handle of the process of the new starting, and obtain by GetModuleFileNameExA function the text of the process of the new starting
Part name.
7. according to the method described in claim 2, it is characterized in that, by the start-up parameter of the new launching process and exiting code and writing
The step guarded in configuration file under catalogue where entering the target windows program further comprises:
Configuration is guarded under starting catalogue where calling WritePrivateProfileStringA function toward new launching process
The start-up parameter of the new launching process is written for key with the id information of the new launching process in file and exits code, wherein
Exiting yard default setting is 1;Correspondingly, the id information of the process actively closed by the user guards configuration text described in updating
The process that the user in part actively closes further comprises the step of exiting yard:
Calling WritePrivateProfileStringA function to actively close the id information of process with the user is key by institute
It states to guard user described in configuration file and actively close the code that exits of process and is set as 0.
8. the method according to the description of claim 7 is characterized in that the step S4 further comprises:
S41, the process being turned off if it exists then guard the file of the process being turned off saved in list according to
, the starting path for the process being turned off described in acquisition;
S42 accesses and guards configuration file under the starting path, GetPrivateProfileStringA function is called to obtain
The start-up parameter of the process being turned off and exit code;
S43, if it is 1 that the start-up parameter, which obtains successfully and exits code, it is determined that the process being turned off be it is abnormal close into
Journey is called CreateProcessA function to restart the abnormal closing process, and is obtained according to the start-up parameter and filename
The exception closing process restart after new process id information, guarded with the new process ID information update and to be saved in list
The abnormal id information for closing process;Alternatively,
If it is 0 that the start-up parameter, which obtains failure or exits code, do not restart the process being turned off, it is described guard into
The relevant information for guarding the process being turned off described in deletion in list of journey.
9. the equipment for guarding multiple processes of the single program of windows characterized by comprising memory, processor and
Bus,
The processor and memory complete mutual communication by the bus;
The memory is stored with the program instruction that can be executed by the processor, and the processor calls in the memory
Program instruction, to execute method as described in any of the claims 1 to 8.
10. a kind of non-transient computer readable storage medium, which is characterized in that the non-transient computer readable storage medium is deposited
Computer instruction is stored up, the computer instruction makes the computer execute method as described in any of the claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710787819.0A CN109426591B (en) | 2017-09-04 | 2017-09-04 | Method and equipment for guarding multiple processes of windows single program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710787819.0A CN109426591B (en) | 2017-09-04 | 2017-09-04 | Method and equipment for guarding multiple processes of windows single program |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109426591A true CN109426591A (en) | 2019-03-05 |
CN109426591B CN109426591B (en) | 2021-01-01 |
Family
ID=65513800
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710787819.0A Active CN109426591B (en) | 2017-09-04 | 2017-09-04 | Method and equipment for guarding multiple processes of windows single program |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109426591B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110704281A (en) * | 2019-10-14 | 2020-01-17 | 山东超越数控电子股份有限公司 | Method for monitoring system operation |
CN112000382A (en) * | 2020-08-26 | 2020-11-27 | 绿盟科技集团股份有限公司 | Linux system starting method and device and readable storage medium |
CN112052098A (en) * | 2020-09-02 | 2020-12-08 | 北京微步在线科技有限公司 | Process protection method and device |
CN112860408A (en) * | 2021-03-03 | 2021-05-28 | 苏州沁游网络科技有限公司 | Process keep-alive method, device and system in cloud reality machine and storage medium |
CN113946815A (en) * | 2021-10-21 | 2022-01-18 | 深圳致星科技有限公司 | Authorization method for federal learning and privacy calculations |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101290587A (en) * | 2008-06-12 | 2008-10-22 | 中兴通讯股份有限公司 | Realization progress start-up and control process |
CN101980171A (en) * | 2010-10-08 | 2011-02-23 | 广东威创视讯科技股份有限公司 | Failure self-recovery method for software system and software watchdog system used by same |
US20130227587A1 (en) * | 2010-05-11 | 2013-08-29 | Libo DENG | Method and apparatus for cross-process communication, and computer storage medium |
CN104216795A (en) * | 2013-06-04 | 2014-12-17 | 上海联影医疗科技有限公司 | Multiprocess protection system and implementation method thereof |
CN106371911A (en) * | 2016-09-06 | 2017-02-01 | 北京海誉动想科技股份有限公司 | Method for rebooting guarded process by daemon processes |
CN106371927A (en) * | 2016-09-09 | 2017-02-01 | 深圳创维数字技术有限公司 | Linux daemon process realization method and system |
-
2017
- 2017-09-04 CN CN201710787819.0A patent/CN109426591B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101290587A (en) * | 2008-06-12 | 2008-10-22 | 中兴通讯股份有限公司 | Realization progress start-up and control process |
US20130227587A1 (en) * | 2010-05-11 | 2013-08-29 | Libo DENG | Method and apparatus for cross-process communication, and computer storage medium |
CN101980171A (en) * | 2010-10-08 | 2011-02-23 | 广东威创视讯科技股份有限公司 | Failure self-recovery method for software system and software watchdog system used by same |
CN104216795A (en) * | 2013-06-04 | 2014-12-17 | 上海联影医疗科技有限公司 | Multiprocess protection system and implementation method thereof |
CN106371911A (en) * | 2016-09-06 | 2017-02-01 | 北京海誉动想科技股份有限公司 | Method for rebooting guarded process by daemon processes |
CN106371927A (en) * | 2016-09-09 | 2017-02-01 | 深圳创维数字技术有限公司 | Linux daemon process realization method and system |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110704281A (en) * | 2019-10-14 | 2020-01-17 | 山东超越数控电子股份有限公司 | Method for monitoring system operation |
CN112000382A (en) * | 2020-08-26 | 2020-11-27 | 绿盟科技集团股份有限公司 | Linux system starting method and device and readable storage medium |
CN112000382B (en) * | 2020-08-26 | 2023-10-13 | 绿盟科技集团股份有限公司 | Linux system starting method and device and readable storage medium |
CN112052098A (en) * | 2020-09-02 | 2020-12-08 | 北京微步在线科技有限公司 | Process protection method and device |
CN112860408A (en) * | 2021-03-03 | 2021-05-28 | 苏州沁游网络科技有限公司 | Process keep-alive method, device and system in cloud reality machine and storage medium |
CN113946815A (en) * | 2021-10-21 | 2022-01-18 | 深圳致星科技有限公司 | Authorization method for federal learning and privacy calculations |
Also Published As
Publication number | Publication date |
---|---|
CN109426591B (en) | 2021-01-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109426591A (en) | Guard the method and apparatus of multiple processes of the single program of windows | |
CN104899126B (en) | The local method, apparatus and system monitored in real time is carried out to container in host | |
WO2020019458A1 (en) | Page switching method of hybrid application, framework, computer device and storage medium | |
CN105335435B (en) | File management method and information processing equipment | |
US11210196B1 (en) | Systems and methods for locally streaming applications in a computing system | |
CN110955598B (en) | Breakpoint processing method and device for kernel mode program | |
EP3015987A1 (en) | System update method, apparatus, and device | |
CN109002330A (en) | A kind of method, device and equipment identifying UEFI OS startup item | |
CN111125065A (en) | Visual data synchronization method, system, terminal and computer readable storage medium | |
CN112905613A (en) | Data bidirectional synchronization method and device for heterogeneous database | |
CN108958969B (en) | Database disaster recovery method, device and disaster recovery and backup systems | |
CN105573788B (en) | The method and apparatus of patch processing and the method and apparatus for generating patch | |
CN109782982A (en) | A kind of processing method and terminal reading log | |
CN109324942A (en) | The dual-active processing method of micro services, apparatus and system, equipment, storage medium | |
CN104461621B (en) | A kind of method and device of Update attribute information | |
CN106372160A (en) | Distributive database and management method | |
CN110737504B (en) | Fault-tolerant method, system, terminal and storage medium for deep learning model training | |
CN113515317A (en) | Data recovery method and device | |
CN108279905A (en) | The method and device of library file is introduced in a kind of component | |
CN106959906A (en) | Information processing method, information processor and electronic equipment | |
CN104424306A (en) | Method, device and terminal equipment for recording log | |
CN109254805A (en) | A kind of application self-start method, terminal installation and readable storage medium storing program for executing | |
CN113849233A (en) | BIOS null boot entry deleting method, system, terminal and storage medium | |
CN113157377A (en) | Method and equipment for controlling application part by Android system | |
CN112181277B (en) | Data storage space management method and device, storage medium and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |