Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you want to prevent users from killing the process from task manager, you can just use a security descriptor on the process to deny terminate access to everyone. Administrators technically can still kill the process by taking ownership of the process and resetting the DACL, but there is no interface to do either of these things from Task Manager. <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="noreferrer">Process Explorer</a> may have an interface to though.</p> <p>When your process starts, use <a href="http://msdn.microsoft.com/en-us/library/aa379578(VS.85).aspx" rel="noreferrer">SetKernelObjectSecurity</a> with <code>DACL_SECURITY_INFORMATION</code> using the current process handle. Set a DACL with zero ACLs. This will deny all access to everyone, including those trying to end your process with task manager.</p> <p>Here is an example that also changes the process's owner:</p> <pre><code>SECURITY_DESCRIPTOR sd; ACL dacl; SID_IDENTIFIER_AUTHORITY ntauth = SECURITY_NT_AUTHORITY; PSID owner; assert(InitializeAcl(&amp;dacl, sizeof dacl, ACL_REVISION)); assert(AllocateAndInitializeSid(&amp;ntauth, 1, SECURITY_LOCAL_SYSTEM_RID, 0,0,0,0,0,0,0, &amp;owner)); assert(InitializeSecurityDescriptor(&amp;sd, SECURITY_DESCRIPTOR_REVISION)); assert(SetSecurityDescriptorDacl(&amp;sd, TRUE, &amp;dacl, FALSE)); assert(SetSecurityDescriptorOwner(&amp;sd, owner, FALSE)); assert(SetKernelObjectSecurity(GetCurrentProcess(), DACL_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION, &amp;sd)); assert(FreeSid(owner) == NULL); </code></pre> <p>Unfortunately, it doesn't seem to be effective. I can still close the process (although not as a limited user). Perhaps Task Manager is taking ownership or invoking some other privilege to kill the process? I seem to remember this working in previous versions of Windows (I was testing 2003), but I could be mistaken.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload