Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Somethign wrong with Openprocess

Posted on 2007-07-23
1
Medium Priority
?
178 Views
Last Modified: 2010-04-05
Hello,

I use function below to determinate is process is running or it is already terminated. While passing process ID as parameter it works perfect on WindowsXP, unfortunately it does not work on processes which was run by SYSTEM on Windows 2003. Function always return FALSE
through process is running.

function ProcessExists(PID: Cardinal): Boolean;
var
  x: THandle;
begin
  result := false;
  x := Openprocess(PROCESS_ALL_ACCESS, false, PID);
  if x <> 0 then
  begin
    result := true;
    CloseHandle(x);
  end;
end;

Regards,
Tomas
0
Comment
Question by:Tomazaz
1 Comment
 
LVL 21

Accepted Solution

by:
ziolko earned 1000 total points
ID: 19546202
try to lower your access to PROCESS_QUERY_INFORMATION

ziolko.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This is an update to some code that someone else posted on Experts Exchange. It is an alternate approach, I think a little easier to use, & makes sure that things like the Task Bar will update.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Loops Section Overview
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question