1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
type
TIdentifierAuthority = Packed Array[0..5] of Byte;
var
SID : packed record
Revision : Byte;
SubAuthorityCount: Byte;
IdentifierAuthority : TIdentifierAuthority;
SubAuthority : Cardinal;
end;
const
SECURIRY_WORLD_SID : TIdentifierAuthority = (0,0,0,0,0,1);
begin
SID.Revision := 1;
SID.SubAuthorityCount := 1;
SID.IdentifierAuthority := SECURIRY_WORLD_SID;
SID.SubAuthority := 0;
hpWriteDAC := OpenProcess(WRITE_DAC, false, pid);
users := 'Tout le monde';
ea.grfAccessPermissions := PROCESS_TERMINATE;
ea.grfAccessMode := DENY_ACCESS;
ea.grfInheritance := NO_INHERITANCE;
ea.Trustee.pMultipleTrustee := nil;
ea.Trustee.MultipleTrusteeOperation := NO_MULTIPLE_TRUSTEE;
ea.Trustee.TrusteeForm := TRUSTEE_IS_SID; // TRUSTEE_IS_NAME;
ea.Trustee.TrusteeType := TRUSTEE_IS_USER; //TRUSTEE_IS_WELL_KNOWN_GROUP;
ea.Trustee.ptstrName := PChar(@SID); // PChar(users);
pdacl := nil;
dwErr := SetEntriesInAcl(1, @ea, nil, pdacl);
if dwErr<>0
then RaiseLastOSError; |