Stay proceedings

Asked

Viewed 114 times

1

I’m trying to suspend a lawsuit from windows for Delphi, but without success, I am using the following code:

function SuspendProcess(pid:dword):boolean; // Suspende processo pelo PID 
var module,module1:thandle; 
    SusPendProcess:TNTdllApi; 
begin 
  result := false; 
  SetTokenPrivileges; 
  module := LoadLibrary('ntdll.dll'); 
  @SusPendProcess := Getprocaddress(module,'NtSuspendProcess'); 
  if @SusPendProcess <> nil then 
    begin 
      module1 := OpenProcess(PROCESS_ALL_ACCESS,FALSE,pid); 
      SusPendProcess(module1); 
    end; 
end; 

Where do I inform the PID, but nothing happens, now using the tool PC Hunter, he suspends without a problem. It would be possible to make use of the PSSuspendProcess/ZwSuspendProcess? Could you help me with an example? Thank you!

1 answer

0

Would closing the case solve your problem? Work it out try:

PostMessage(FindWindow(<nome_da_tela_principal_do_processo>, nil), WM_CLOSE, 0,0);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.