|
Prev: Problem while getting file size from IFilter for a .doc file
Next: Read/Write to storage class device using sector/block addresses
From: wrenashe on 23 Apr 2008 06:34 OpenProcess() failed to detect if a process is running via given PID. Does anyone have idea to do the check by win32 api?
From: Mike Collins on 23 Apr 2008 07:53 At a guess, you could use CreateToolhelp32Snapshot to look for the process depending on what information you have before hand... Mike C "wrenashe" <wrenashe(a)gmail.com> wrote in message news:03c65e6e-a556-4f39-917a-854ae0d510e1(a)24g2000hsh.googlegroups.com... > OpenProcess() failed to detect if a process is running via given PID. > Does anyone have idea to do the check by win32 api?
From: na on 23 Apr 2008 13:54 "wrenashe" <wrenashe(a)gmail.com> wrote in message news:03c65e6e-a556-4f39-917a-854ae0d510e1(a)24g2000hsh.googlegroups.com... > OpenProcess() failed to detect if a process is running via given PID. > Does anyone have idea to do the check by win32 api? Use the HKEY_PERFORMANCE_DATA section of the Registry.
From: wrenashe on 23 Apr 2008 23:47 On Apr 23, 7:53 pm, "Mike Collins" <its(a)TheBottomOfThePost> wrote: > At a guess, you could use CreateToolhelp32Snapshot to look for theprocess > depending on what information you have before hand... > > Mike C > > "wrenashe" <wrena...(a)gmail.com> wrote in message > > news:03c65e6e-a556-4f39-917a-854ae0d510e1(a)24g2000hsh.googlegroups.com... > > > OpenProcess() failed to detect if aprocessisrunningvia given PID. > > Does anyone have idea to do thecheckby win32 api? Since a killed process's pid still exists in windows handle table, so openprocess() fails to report its actual state. I used CreateToolhelp32Snapshot() to list all known PIDs, and then check if my pid(that killed one's) is in there. If there, process is running otherwise, it is gone already. Now it seems work well.
From: Ben Voigt [C++ MVP] on 24 Apr 2008 09:59
wrenashe wrote: > On Apr 23, 7:53 pm, "Mike Collins" <its(a)TheBottomOfThePost> wrote: >> At a guess, you could use CreateToolhelp32Snapshot to look for >> theprocess depending on what information you have before hand... >> >> Mike C >> >> "wrenashe" <wrena...(a)gmail.com> wrote in message >> >> news:03c65e6e-a556-4f39-917a-854ae0d510e1(a)24g2000hsh.googlegroups.com... >> >>> OpenProcess() failed to detect if aprocessisrunningvia given PID. >>> Does anyone have idea to do thecheckby win32 api? > > Since a killed process's pid still exists in windows handle table, so > openprocess() fails to report its actual state. I used GetExitCodeProcess? http://msdn2.microsoft.com/en-us/library/ms683189(VS.85).aspx > CreateToolhelp32Snapshot() to list all known PIDs, and then check if > my pid(that killed one's) is in there. If there, process is running > otherwise, it is gone already. Now it seems work well. |