if you want to give permission for "everyone" for folder, you can use with function without call external programms.
This function work in my install program. (D7)
PS. some OS restriction: WinNt and above
Main Topics
Browse All TopicsHi there,
I need to use cacls.exe or xcacls.exe to set folder permissions in Delphi. How I can execute this program and get the return code from it in order for me to know whether it succeed or failed.
This is the syntax for cacls:
cacls c:\test /G everyone:F <C:\yes.txt
Regards
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
for administrator:
const
SECURITY_NT_AUTHORITY: TSIDIdentifierAuthority = (Value: (0, 0, 0, 0, 0, 5));
SECURITY_BUILTIN_DOMAIN_RI
DOMAIN_ALIAS_RID_ADMINS = $00000220;
...
AllocateAndInitializeSid(S
for user1 or another you can fill stutcture EXPLICIT_ACCESS for user:
_ea.grfAccessPermissions := GENERIC_ALL;
_ea.grfAccessMode := SET_ACCESS;
_ea.grfInheritance := SUB_CONTAINERS_AND_OBJECTS
_ea.Trustee.TrusteeForm := TRUSTEE_IS_NAME;
_ea.Trustee.TrusteeType := TRUSTEE_IS_USER;
_ea.Trustee.ptstrName := 'User1';
That script didn't do what I need.
If you execute the below command for the test folder you can notice that there are just administrator and user1 have the full access to that folder and no one else have any permission.
echo y|cacls C:\test /G administrator:F
cacls C:\test /E /G user1:F
That is what I need exactly.
Thank you very much.
SetEntriesInAcl(1, @_ea, _old_ACL, _new_ACL);
OldAcl
[in] A pointer to the existing ACL. This parameter can be NULL, in which case, the function creates a new ACL based on the EXPLICIT_ACCESS entries. (MSDN)
if you set _old_ACL to nil, then SetNamedSecurityInfo set permission only for new SID without inherited permissions
pseudocode:
Business Accounts
Answer for Membership
by: ciulyPosted on 2009-01-13 at 00:00:26ID: 23360702
here is a page with a bunch of such functions: http://www.swissdelphicent er.ch/torr y/showcode .php?id=93
you will need the winexecandwait32 funciton which will return the exit code