program Project1;
{$APPTYPE CONSOLE}
uses
//jwa... download from [url]http://jedi-apilib.sourceforge.net[/url]
jwaACLApi,
jwaAccCtrl,
jwaWinBase,
jwaWindows,
jwaNative,
SysUtils;
var AdminSID: PSID;
ExplicitAccesses: TExplicitAccess;
Acl: PACL;
dwRes : DWORD;
begin
{ TODO -oUser -cConsole Main : Hier Code einfügen }
if AllocateAndInitializeSid(@SECURITY_NT_AUTHORITY, 2,
SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0,
AdminSID)
then
begin
FillChar(ExplicitAccesses,sizeof(ExplicitAccesses),0);
ExplicitAccesses.grfAccessPermissions := KEY_READ;
//KEY_ALL_ACCESS;
ExplicitAccesses.grfAccessMode := SET_ACCESS;
ExplicitAccesses.grfInheritance := NO_INHERITANCE;
ExplicitAccesses.Trustee.TrusteeForm := TRUSTEE_IS_SID;
ExplicitAccesses.Trustee.TrusteeType := TRUSTEE_IS_GROUP;
ExplicitAccesses.Trustee.ptstrName := PAnsiChar(AdminSID);
end;
dwRes := SetEntriesInAcl(1, @ExplicitAccesses, 0,
ACL);
if (dwRes = 0)
then
begin
LocalFree(
ACL);
end;
end.