开发者

Problems with OpenProcess while not in IDE

I created an application to watch my other applications and it run perfect while I'm debugging a console or vcl application.

When I try to watch a service application it give me some problems, I noticed that I got "Access denied" when I try to "OpenProcess(PROCESS_QUERY_INFORMATION, False, PID);". But if open my watcher by Delphi IDE I don't have t开发者_C百科his problem.

Some one know what can it be ?

My intention is to open the process to get its GetProcessTimes, to check how much of memory it's consuming. I know that procexp.exe from SysInternal can do it without problems, some one know how do they do it ?

Tks in advice.

Obs: In my machine I disabled the UAC and I executed the watcher as administrator.


New information:

I found that to access a service as want I do to other kind of application I must use OpenService. Now I can access it without problems, now I'll search a similar command of GetProcessTimes to it.


Resolved, I continue using OpenProcess but I used PROCESS_QUERY_LIMITED_INFORMATION (0x1000) to access it. The problem was just permission, using this I can access the process and use GetProcessTimes to get what I needed.

Tks all.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜