Re: how to set PROCESS_TERMINATE privilege?
From: Ndi (Ndi_at_Ndi_dot_ro)
Date: 10/23/03
- Next message: thorssonj at hotmail dot com: "Re: cfgmgr32 and CM_Request_Device_Eject"
- Previous message: Ndi: "Re: ShellApi property page with own Tab"
- In reply to: Jose Luis: "how to set PROCESS_TERMINATE privilege?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 23 Oct 2003 08:48:01 +0300
> >Note that you need admin rights to open a process with
> >PROCESS_TERMINATE access.
I'll allow tar and feathers if I'm wrong, but you don't?
Anybody can aquire PROCESS_TERMINATE for the processes running as his own
user (under NT) and to any process (Wintendo - 9x/ME).
You can kill any process you started, either by hand or with any other
tool that states by the Explorer or whatever (they inherit). That is unless
the process is a service or started on purpose by another user and left
there, you can kill it.
> how can i set this privilege settings for the current user and
> then reset it to the default value for that user?
You only need privileges if you want to kill a process that does not
belong to you. In that case, I think you need SE_DEBUG privilege (actually,
I KNOW you need it. There might, however, be another way).
What you DO need to do with PROCESS_TERMINATE is to set the flag when
calling OpenProcess. It should be
hProcess := OpenProcess( PROCESS_TERMINATE, false, PID);
if hProcess <> 0 then
TerminateProcess( hProcess, 0)
else
Showmessage('I wuz un''able tuh open the blasted process. You do not
have no permissions here. Shoo.'); // change this in production code
This is from memory and against Peter's recomandation to not type code in
the newsreader. :)
-- Andrei "Ndi" Dobrin Brainbench MVP www.Brainbench.com
- Next message: thorssonj at hotmail dot com: "Re: cfgmgr32 and CM_Request_Device_Eject"
- Previous message: Ndi: "Re: ShellApi property page with own Tab"
- In reply to: Jose Luis: "how to set PROCESS_TERMINATE privilege?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|