Folder access

Got a problem you cannot solve? Try here.
MartinF
Posts: 6
Joined: Wed Nov 21, 2007 7:31 am

Folder access

Postby MartinF » Wed Nov 21, 2007 8:14 am

Hi,

I have a problem that I can't seem to get around. I want 2 folders to be created by the installer, "$TARGETDIR$\\Cache" and "$TARGETDIR$\\Cache\\Rapport" and I want all users to be able to write and modify files in these folders. I have added the sub-folders via the Files page and it works just fine. Then I tried to give access to the folders via the Access Control page and that does not work. Write access is not granted to everyone. My MSI code look like this:

Create Folder $TARGETDIR$\\Cache
Create Folder $TARGETDIR$\\Cache
\\Rapport
Apply Install (get success into variable SUCCESS)
if Variable SUCCESS not Equals ERROR
if Variable SUCCESS not Equals CANCEL
set Read Write Permissions on Folder Share $TARGETDIR$\\Cache" for Everyone
set Read Write Permissions on Folder Share $TARGETDIR$\\Cache\\Rapport" for Everyone
set Read Write Permissions on File System Object $TARGETDIR$\\Cache" for Everyone
set Read Write Permissions on File System Object $TARGETDIR$\\Cache\\Rapport" for Everyone
end
end


This is all generated by the GUI. It looks fine to me but as I wrote, the users do not get write or modify rights. What am I doing wrong?

Regards,

Martin

Alex_Ronquillo
Site Admin
Posts: 364
Joined: Mon Jul 30, 2007 11:51 am
Location: USA
Contact:

Postby Alex_Ronquillo » Wed Nov 21, 2007 5:49 pm

The following lines must be included before the "Apply Install". They only have effect after Install has been applied.

Code: Select all

set Read Write Permissions on Folder Share $TARGETDIR$\\Cache" for Everyone
set Read Write Permissions on Folder Share $TARGETDIR$\\Cache\\Rapport" for Everyone
set Read Write Permissions on File System Object $TARGETDIR$\\Cache" for Everyone
set Read Write Permissions on File System Object $TARGETDIR$\\Cache\\Rapport" for Everyone
Alejandro Ronquillo
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

MartinF
Posts: 6
Joined: Wed Nov 21, 2007 7:31 am

Postby MartinF » Fri Nov 23, 2007 6:28 am

Thanks for the response. The code now looks like this:

Create Folder $TARGETDIR$\\Cache
Create Folder $TARGETDIR$\\Cache\\Rapport
set Read Write Permissions on Folder Share $TARGETDIR$\\Cache" for Everyone
set Read Write Permissions on Folder Share $TARGETDIR$\\Cache\\Rapport" for Everyone
set Read Write Permissions on File System Object $TARGETDIR$\\Cache" for Everyone
set Read Write Permissions on File System Object $TARGETDIR$\\Cache\\Rapport" for Everyone
Apply Install (get success into variable SUCCESS)

But the users are still not allowed to write or modify.

Regards,

Martin

Alex_Ronquillo
Site Admin
Posts: 364
Joined: Mon Jul 30, 2007 11:51 am
Location: USA
Contact:

Postby Alex_Ronquillo » Mon Nov 26, 2007 1:15 pm

Martin,

Try the following solution sugested by Sinan Karaka some time ago:

What you can do is pre-create the folder using the Call DLL Function plug-in command, and tapping into the CreateDirectoryA Win32 API in kernel32.dll. Just pass $TARGETDIR$ as the folder parameter and null as the second parameter. And then set the access control in the next line of your script. Be sure to do this all before you call Apply Install.

This way the folder will be pre-created, and access set; and then when Windows Installer copies files into that folder, they will inherit the parent permissions (and hence, access rights).


Of course you are creating two folders instead of one.
Alejandro Ronquillo

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/

MartinF
Posts: 6
Joined: Wed Nov 21, 2007 7:31 am

Postby MartinF » Wed Nov 28, 2007 6:57 am

Thanks you! That seems to work. The odd thing is I tried this a couple of days ago but then I could not make it work. But that doesn't matter since it works now. :D

/Martin


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 92 guests