Page 1 of 1

Creating folder for Application Data and All Users

Posted: Tue Oct 16, 2007 4:20 pm
by jimdalrymp
I though I found the solution to my problem in this topic, however, it doesn't seem to work for my script.

http://www.installaware.com/forum/viewtopic.php?t=2920

This is the code before files are installed to these folders. The files that are installed can be read, but not modified by even the Admin account that installed the app. What am I doing wrong?

Code: Select all

Create Folder $APPDATAALL$\\Railcar Tracking Co
    Create Folder $APPDATAALL$\\Railcar Tracking Co\\RMS
    Create Folder $APPDATAALL$\\Railcar Tracking Co\\RMS\\FlatFiles
    Apply Install (get result into variable SUCCESS)
    if Variable SUCCESS not Equals ERROR
      if Variable SUCCESS not Equals CANCEL
        Grant Complete Access to File System             Object "$APPDATAALL$\\Railcar Tracking Co\\RMS"
        Grant Complete Access to File System Object "$APPDATAALL$\\Railcar Tracking Co\\RMS\\FlatFiles"
        Grant Complete Access to Folder Share "$APPDATAALL$\\Railcar Tracking Co\\RMS"
        Grant Complete Access to Folder Share "$APPDATAALL$\\Railcar Tracking Co\\RMS\\FlatFiles"
        Apply Install (get result into variable SUCCESS)
      end
    end
Thanks for the help.

Posted: Tue Oct 16, 2007 5:41 pm
by Alex_Ronquillo
I am not sure if this will work but try it. Your code seems to be right, except for one thing. Please remove all back slashes from the paths after the $APPDATAALL$ variable .

For example, replace:

Code: Select all

Grant Complete Access to File System Object "$APPDATAALL$\\Railcar Tracking Co\\RMS\\FlatFiles"
for:

Code: Select all

Grant Complete Access to File System Object "$APPDATAALL$Railcar Tracking Co\\RMS\\FlatFiles"

Posted: Tue Oct 16, 2007 7:58 pm
by jimdalrymp
I tried removing the "\\" from the end of the $APPDATAALL$ variable and the setup program behaves exactly the same.

Any other ideas?

Posted: Wed Oct 17, 2007 12:00 pm
by Alex_Ronquillo
Try the solution described in http://www.installaware.com/forum/viewtopic.php?t=320 by sinan. By looking at your code, it seems you did not try it that way:
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.
Also, when setting the permissions, make sure to eliminate the back slashes as I told you before. I hope this helped.

Posted: Wed Oct 17, 2007 4:09 pm
by jimdalrymp
I didn't try that method because the person who was being helped tried that method and it didn't create the folder.

Anyway, I tried that method, and I couldn't get it to create the folder either. This is not really the issue, the Create Folder command creates the folder just fine, the problem is with the Set Access Control command - it doesn't seem to properly set the security and permissions for the folder.

Is there an order that needs to be followed? For example, do I need to Grant Complete Access to Folder Share before setting Grant Complete Access to File System Object?

Posted: Wed Oct 17, 2007 7:30 pm
by jimdalrymp
I've done some experimenting and found that it seems that the Create Share command is required to make the folder a share, then you can grant the permissions and security. So I create the folder; make the folder a share; grant access to the share; grant access to the folder.

After running this code, the folder properties Sharing tab shows the correct Share name, permissions for Everyone with Full Control. It shows on the Security tab Everyone has Full Control permissions. However, the ini file that is installed into the folder during installation cannot be modified by an Administrator. Plus, the ini file cannot even be opened by a Limited User.

Code: Select all

  Create Folder $ALLAPPDATA$Railcar Tracking Co\\RMS\  Apply Install (get result into variable SUCCESS)
  Share Folder $ALLAPPDATA$Railcar Tracking Co\\RMS\\ as "RMSShare" (RMSShare)
  Apply Install (get result into variable SUCCESS)
  Grant Complete Access to Folder Share "RMSShare"
  Apply Install (get result into variable SUCCESS)
  Grant Complete Access to File System Object "$ALLAPPDATA$Railcar Tracking Co\\RMS\\"
  Apply Install (get result into variable SUCCESS)

Posted: Thu Oct 18, 2007 9:39 am
by Alex_Ronquillo
Try granting access to the file also. Altough, it is suppose to inherit the permissions.