home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 April / Chip_2002-04_cd1.bin / zkuste / delphi / kolekce / d56 / NT.ZIP / NTAllAccess.pas < prev    next >
Pascal/Delphi Source File  |  2002-01-17  |  1KB  |  57 lines

  1. // NTAllAccess
  2. // Modifies a process's DACL information to allow any other process to end it
  3.  
  4. unit NTAllAccess;
  5.  
  6. interface
  7.  
  8. uses
  9.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
  10.  
  11. type
  12.   TNTAllAccess = class(TComponent)
  13.   private
  14.     { Private declarations }
  15.   protected
  16.     { Protected declarations }
  17.   public
  18.     { Public declarations }
  19.   published
  20.     { Published declarations }
  21.     function Execute:Integer;
  22.   end;
  23.  
  24. const SECURITY_DESCRIPTOR_REVISION=1;
  25.  
  26. procedure Register;
  27.  
  28. implementation
  29.  
  30. function TNTAllAccess.Execute:Integer;
  31. var SecurityDescriptor:TSecurityDescriptor;
  32. begin
  33.      Result:=0;
  34.      If Not InitializeSecurityDescriptor(@SecurityDescriptor,SECURITY_DESCRIPTOR_REVISION) Then
  35.      Begin
  36.           Result:=GetLastError;
  37.           Exit;
  38.      End;
  39.      If Not SetSecurityDescriptorDACL(@SecurityDescriptor,True,nil,False) Then
  40.      Begin
  41.           Result:=GetLastError;
  42.           Exit;
  43.      End;
  44.      If Not SetKernelObjectSecurity(GetCurrentProcess,DACL_SECURITY_INFORMATION,@SecurityDescriptor) Then
  45.      Begin
  46.           Result:=GetLastError;
  47.           Exit;
  48.      End;
  49. end;
  50.  
  51. procedure Register;
  52. begin
  53.      RegisterComponents('NT Tools - Additional', [TNTAllAccess]);
  54. end;
  55.  
  56. end.
  57.