title: Prevent Process Kill From Task Manager, Reversed
body: <p>I use the code below to prevent the user from killing my program from Task Manager (I found it somewhere):</p>
  
  <pre><code>function PreventProcessKill: Integer;
  var
    hProcess:Thandle;
    EmptyDacl: TACL ;
    pEmptyDacl: PACL ;
    dwErr : DWORD ;
  begin
    hProcess := GetCurrentProcess();
    ZeroMemory(@EmptyDacl, SizeOF(tacl));
    pEmptyDacl := @EmptyDacl;
    if (not InitializeAcl(EmptyDacl, sizeof(tACL), 2)) then dwErr := GetLastError()
    else dwErr := SetSecurityInfo(hProcess, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, nil, nil,
    @EmptyDacl, nil);
    Result:= dwErr;
  end;
  </code></pre>
  
  <p>It works great, but at some point in my program I need to revert the effect and allow closing from Task Manager.
  Any ideas?</p>