freakinout
8th March 2006 16:30 UTC
File permissions
I need to install files to a subdirectory under the All Users $APPDATA directory and all users need to have read/write access to the files in that subdirectory as well as the ability to create files in that subdirectory. What I have now is something like this:
.
.
.
SetShellVarContext all
SetOutPath "$APPDATA\SharedStuff"
File "EveryoneReadWrite1.txt"
File "EveryoneReadWrite2.txt"
.
.
.
The permissions for SharedStuff and the two files it contains end up inherited from the $APPDATA folder. Some system adminstrators have set the permissions on $APPDATA to be very restrictive. I need to set the permissions for SharedStuff to not inherit from $APPDATA and allow 'Full Control'. How do I do this with NSIS?
flizebogen
8th March 2006 19:02 UTC
You can invoke a command line tool like SetACL using exec or execwait.
freakinout
8th March 2006 20:21 UTC
Thank you.
I was hoping it was an instruction that I had overlooked (something like SetFilePremissions fullControl) that the SetOutPath and File instructions would use when creating folders and files. Oh well, this will work.
Thanks again.
freakinout
17th March 2006 15:37 UTC
In my search for alternate solutions I found the AccessControl plugin.
http://nsis.sourceforge.net/AccessControl_plug-in
However, I ended up creating the base directory prior to installing the files using the System plugin.
!define SECURITY_ATTRIBUTES '(&l4, i, i) i'
.
.
.
SetShellVarContext all
SetPluginUnload alwaysoff
System::Call "advapi32::ConvertStringSecurityDescriptorToSecurityDescriptorA(
t 'D:(A;OICI;GA;;;AU)(A;;GA;;;BA)(A;;GA;;;SY)', i 1, *i .r0, i 0) i.r5"
System::Call '*${SECURITY_ATTRIBUTES}(12, r0, 0) .r1'
System::Call "kernel32::CreateDirectoryA(t '$APPDATA\CompanyName', i r1) i.r5"
System::Call "kernel32::LocalFree(i r0) i.r5"
SetPluginUnload manual
System::Free $1
SetOutPath "$APPDATA\CompanyName\Templates"
File "Template1.txt"
File "Template2.txt"