I do something like this:

EnumProcesses(@prcs, sizeof(prcs), cP); ShowMessage(IntToStr(cP)); for i := 0 to cP div 4 - 1 do begin hP := OpenProcess(PROCESS_ALL_ACCESS ,false, prcs[i]); if hP <> 0 then ShowMessage(IntToStr(hP)); end; 

PS In fact, the code is a bit longer, but the essence is reflected here. and it is in this code that the behavior is also described below. The results of the launch from the environment and without different little.

In the case of launch from the studio environment - the first message 176, followed by a bunch of messages (the list coincides with the task manager)

In the case of launching through the executable (I tried to launch from the admin) the first message 176, then just 2 messages, checked what it sees - C:\WINDOWS\system32\svchost.exe (both) and nothing more. What could be the problem?

PPS In Delphi 7, the code is triggered with a bang (as if it did not run, although there are no antiviruses from the guest) -

  • I looked through the api, understood the error, but did not find a solution yet, how to indicate the privileges of the debug discovery (debug state to your Oo process?)? - Vladimir Klykov
  • 2
    PROCESS_ALL_ACCESS - strong! - mega