From: Iain Patterson Date: Sun, 2 Dec 2012 02:22:08 +0000 (-0800) Subject: Fixed crash when stopping the service. X-Git-Tag: v2.16~1 X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=9884e231415258809dfb1ef117b6bc9a5b011514;hp=9884e231415258809dfb1ef117b6bc9a5b011514;p=nssm.git Fixed crash when stopping the service. NSSM tidies up by looking for processes whose parent PID matches the PID of the monitored application. Because process IDs are reused, however, it's possible for NSSM to kill a process which was not a child of the monitored application if that process had a now-exited parent process whose PID was reused. On UNIX the PPID would show as 1 for an orphaned process but under Windows, at least when querying a process with the Toolhelp32 toolkit, we see the original PPID of the process even if the parent is no longer running. Thus it is not sufficient to compare parent PIDs when checking if a process was launched by our application. In the worst case scenario NSSM could even terminate itself and trigger a bluescreen. When we find process with matching PPID we now also check that it was created after our application was created and before our application exited. ---