Try the command line utility cacls.exe (in %windir%\system32 to set 
access rights on directories or files in XP easily.

Spawn it from an application which runs with administrative rights 
and appropriate switches if required.  If need be, run the 
application from a non-administrator account with runas in the 
Properties box and as /user:xxxxx, with xxxxx an administrator name. 
Under Vista, always use runas.

If you don't want to have to give the password to a user, put the 
/savecred switch in before the /user switch and run it once as an 
administrator. It won't ask for a password again. If on a domain, see 
the command line help for runas.

For greater control,  download the Windows 2000 resource kit or 
search for it on the MSDN DVD's and install to get xcacls.exe which 
has a few additional rarely needed switches.

Cacls.exe is on all versions of 32 bit Windows, and xcacls.exe is a 
ca. 80 kb file which can be distributed with an application or called 
from an installation program when it closes.

If you are interested in all the gory details, enter "access control 
list" on the MSDN web site where you'll find references to all the 
API's which of course you can use in any program that is run with 
administrative rights or with runas.


Irwin Scollar

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to