code_junkie

How do I hide a process in Task Manager in C#?

Nov 11th, 2011
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. SECURITY_DESCRIPTOR sd;
  2. ACL dacl;
  3. SID_IDENTIFIER_AUTHORITY ntauth = SECURITY_NT_AUTHORITY;
  4. PSID owner;
  5.  
  6. assert(InitializeAcl(&dacl, sizeof dacl, ACL_REVISION));
  7.  
  8. assert(AllocateAndInitializeSid(&ntauth, 1, SECURITY_LOCAL_SYSTEM_RID, 0,0,0,0,0,0,0, &owner));
  9.  
  10. assert(InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION));
  11.  
  12. assert(SetSecurityDescriptorDacl(&sd, TRUE, &dacl, FALSE));
  13.  
  14. assert(SetSecurityDescriptorOwner(&sd, owner, FALSE));
  15.  
  16. assert(SetKernelObjectSecurity(GetCurrentProcess(), DACL_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION, &sd));
  17.  
  18. assert(FreeSid(owner) == NULL);
Add Comment
Please, Sign In to add comment