Changing permissions for a file in system32 (64 bits)

Got a problem you cannot solve? Try here.
frank5625
Posts: 11
Joined: Wed Jul 17, 2013 10:41 am

Changing permissions for a file in system32 (64 bits)

Postby frank5625 » Fri Jul 26, 2013 9:35 am

Hi,

I made a very small and simple installaware installation program which simply installs a file in system32 folder and gives everyone read/write permissions on this file.
It doesn't work. I also tested the same steps in another folder and it works.
I'm using InstallAware Studio 15. It's a native 64-bit project on a 64 bit Win 7 machine.

I've tried with a dll and a simple empty text file. It works on a native 32-bit project.
On a native 64-bit project the result is the following:
The file gets copied (installed) but permissions aren't set.

After Define Setup Globals' end region:
=================================

[DEFINE REGION: MyProject]
Install Files abc.txt to $SYSTEM32$ (Permanent, Never Overwrite)
Apply Install
Set Read Write Permissions on File System Object "$SYSTEM32$\abc.txt" for Everyone
Install Files abc.txt to C:\ (Permanent, Never Overwrite)
Apply Install
Set Read Write Permissions on File System Object "C:\abc.txt" for Everyone
[END REGION]


Thanks a lot!

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Changing permissions for a file in system32 (64 bits)

Postby FrancescoT » Fri Jul 26, 2013 9:57 am

Dear Frank,

First of all:
did you explicitly set with your script that you are installing a native 64 bit package?

This behavior is controlled by the statement:
Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode

If don't declare the above code, your package runs as NATIVE 32 bit.
Consequently, the System32 folder will be redirected to "C:\Windows\SysWOW64" instead of "C:\Windows\System32".

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

frank5625
Posts: 11
Joined: Wed Jul 17, 2013 10:41 am

Re: Changing permissions for a file in system32 (64 bits)

Postby frank5625 » Fri Jul 26, 2013 11:26 am

Hi,

Sure. In fact I never had to set it manually. It was already done when I created the project.

I've attached the mia.txt file of my project. The only code I added starts at line 232 and ends at line 237
New Project64.mia.txt
(9.2 KiB) Downloaded 444 times


Here are the steps I done:
- Create new project: New project Templates -> Win64 Setup
- Then I wrote the few lines of code after the comment "TO-DO: Insert any additional install commands here"

Code: Select all

~InstallAware Clipboard Data~
~Apply Changes~
~{40EC5702-EC50-4679-B470-F233CD63B0B0}~
~~
~~
~TRUE~
~FALSE~
~Install Files~
~{A0205275-5E84-48B7-AE7E-37552FA53BFF}~
~abc.txt~
~FALSE|~
~C:\~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~TRUE~
~TRUE~
~Set Access Control~
~{DEB8ED29-6D1B-4B5A-9EE9-0E39CC10EEBA}~
~$SYSTEM32$\abc.txt~
~TRUE~
~FALSE~
~FALSE~
~FALSE~
~~
~TRUE~
~TRUE~
~TRUE~
~FALSE~
~FALSE~
~TRUE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~Apply Changes~
~{591BFBEB-CA10-421E-9C6B-075674A14DFA}~
~~
~~
~TRUE~
~FALSE~
~Install Files~
~{0F66E9A0-F1D1-4F5A-B01E-5ABCB9234E43}~
~abc.txt~
~FALSE|~
~$SYSTEM32$~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~TRUE~
~TRUE~

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Changing permissions for a file in system32 (64 bits)

Postby FrancescoT » Mon Jul 29, 2013 5:47 am

Dear Frank,

... let me check it.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

frank5625
Posts: 11
Joined: Wed Jul 17, 2013 10:41 am

Re: Changing permissions for a file in system32 (64 bits)

Postby frank5625 » Mon Aug 19, 2013 12:46 pm

Dear Francesco,

Have you had any time to check it?

Thanks!

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Changing permissions for a file in system32 (64 bits)

Postby FrancescoT » Tue Aug 20, 2013 5:11 am

Dear Frank,

Yes, it seems that I found the same.

Currently, I may suggest you to use the "CALCS" utility as workaround to have those setting applied.

First install those files;

Code: Select all

 Install Files abc.txt to $TARGETDIR$
Install Files abc.txt to $WINSYSDIR$
Install Files abc.txt to C:

then just after Apply Install;

Code: Select all

Apply Install (get result into variable SUCCESS)
Set Read Write Permissions on File System Object "C:\abc.txt" for Everyone
Comment: Set Read Write Permissions on File System Object "$WINSYSDIR$\abc.txt" for Everyone
Set Read Write Permissions on File System Object "$TARGETDIR$\abc.txt" for Everyone
Run Program cacls "$WINSYSDIR$\abc.txt" /e /grant Everyone:R
Run Program cacls "$WINSYSDIR$\abc.txt" /e /grant Everyone:W

The same as InstallAware Clipboard format;

Code: Select all

~InstallAware Clipboard Data~
~Run Program~
~{A75F1AB8-40D6-460A-8A78-BA9DF935CCFE}~
~cacls~
~FALSE~
~"$WINSYSDIR$\abc.txt" /e /grant Everyone:W~
~FALSE~
~~
~Run Program~
~{F9A9803E-6F09-41A4-AA21-ECCB6C243625}~
~cacls~
~FALSE~
~"$WINSYSDIR$\abc.txt" /e /grant Everyone:R~
~FALSE~
~~
~Set Access Control~
~{BEC33A14-ADEA-4842-B24A-261F22E9AF63}~
~$TARGETDIR$\abc.txt~
~TRUE~
~FALSE~
~FALSE~
~FALSE~
~~
~TRUE~
~TRUE~
~TRUE~
~FALSE~
~FALSE~
~TRUE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~Set Access Control~
~{2CA40A60-79A5-406A-8D17-992F215EA3FC}~
~$WINSYSDIR$\abc.txt~
~TRUE~
~FALSE~
~FALSE~
~FALSE~
~~
~TRUE~
~TRUE~
~TRUE~
~FALSE~
~FALSE~
~TRUE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~Set Access Control~
~{C356712F-F403-45A5-8FF9-EDCE64A102AD}~
~C:\abc.txt~
~TRUE~
~FALSE~
~FALSE~
~FALSE~
~~
~TRUE~
~TRUE~
~TRUE~
~FALSE~
~FALSE~
~TRUE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~Apply Changes~
~{5F6CD929-F41B-480A-974E-51CAC4CAFD8F}~
~progress~
~SUCCESS~
~TRUE~
~FALSE~


For more details on how to use the "CALCS" utility, please refer to the available Microsoft documentation.

PS.
With more recent OSes as WIN 7 "ICALCS" should be used instead of "CALCS" ... I just tried using the above code snippet and it works fine.

Hope this helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

frank5625
Posts: 11
Joined: Wed Jul 17, 2013 10:41 am

Re: Changing permissions for a file in system32 (64 bits)

Postby frank5625 » Tue Aug 20, 2013 7:21 am

Dear Francesco,

Thanks a lot. It works now. Is this issue fixed in the latest version (17)?

PS:
I ended up using cacls (instead of icacls) since I want it to work on both XP and Win7. Plus, the line is more like this:

Code: Select all

Run Program cacls "$WINSYSDIR$\abc.txt" /e /g Everyone:R


Thanks again!

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Changing permissions for a file in system32 (64 bits)

Postby FrancescoT » Tue Aug 20, 2013 8:34 am

I happy you solved!!

I tested the issue with IA 17.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 59 guests