Cannot set permissions for registry keys; Everyone group should have full control - Advanced Installer Community
Basic_Coder
Posts: 12
Joined: Tue Jun 16, 2020 8:27 pm

Cannot set permissions for registry keys; Everyone group should have full control

Caphyon Team,

I hope I did not stumble into a limitation of the Windows Installer / Advanced Installer, having to do with registry key permissions. I hope it is just something I am missing. Could you help solve this issue?

My application requires read / write access to registry values, so sets the Everyone group to have full control. The application is not able to read (nor write) registry values at present.
I would prefer to fix this issue solely with Advanced Installer's interface, but understand if I need to use Regini with a custom action.
The closest post on this forum that I have seen is viewtopic.php?t=21587 , but it did not seem to help.
My application has multiple layers of registry keys. I have each layer (of registry key) set to Everyone group having full control, and the registry keys with values immediately inside them have issue, thereby preventing read / write access to the values. The layers with no values immediately inside have Everyone group set properly to full control.



````
Steps to reproduce:
Create Enterprise project in 15.8
Builds tab > single EXE setup (resources inside)
Install Parameters tab > Mixed 32/64-bit package, per-machine only
Registry tab > HKEY_LOCAL_MACHINE > Software Right click Software > Create New Key > right click New Key > Properties > Permissions > New > leave as no domain, Username [GRP_EVERYONE], give full control > OK.
Right click New Key, Go to Component > Uncheck 64-bit Component

I test this on an English Win10 (x64) virtual machine. I use RegEdit, right clicking New Key located at HKLM > Software > WOW6432Node > New_Key, and click Permissions in the context menu to show permissions of each user group. It will list:
Everyone with full control.
SYSTEM with full control.

Back to Registry tab > select New_Key > press New Value button at top.
Leave name as New Value, leave type as String / Replace existing value , leave Mark component as 64-bit unchecked. Write in the Data text box "New Data" . Press OK.

Back on the virtual machine with the afore-mentioned steps, check the permissions for New_Key. It will list:
ALL APPLICATION PACKAGES with read access.
Account Unknown (S-1-15-3-1024-<Many More Numbers>) with read access.
CREATOR OWNER with special permissions.
SYSTEM with full control.
Administrators (DESKTOP-<alphanumerics>\Administrators) with full control.
Users (DESKTOP-<alphanumerics>\Users) with read access.




````
Question:
How can I grant read / write access to Everyone group for registry values?

Thank you for your time,
Henry
Basic_Coder
Posts: 12
Joined: Tue Jun 16, 2020 8:27 pm

Re: Cannot set permissions for registry keys; Everyone group should have full control

Attaching the test project.
Attachments
Your Application.aip
test project
(19.18 KiB) Downloaded 926 times
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Cannot set permissions for registry keys; Everyone group should have full control

Hello,

Thank you very much for the detailed explanation and for the provided sample project.

Unfortunately, I was not quite able to replicate the described behavior using your project.

There is, though, a point of confusion in your test-case which I will address in the following lines.

So basically, here is how I have tested:

- open the project

- select the registry key --> "Go to component" --> uncheck the "64-bit component" option (as it was not unchecked)

- build & install the project

- checked the RegEdit and everything worked as described by you

- went back to the project and added a value to the key

- rebuilt the project

Now, here is the point of confusion. You do not mention what to do here. Should I uninstall and then install? Should I increase the version and then treat this as an upgrade? Here is what I've done:

- uninstalled the product from Control Panel

- checked RegEdit to see if the key was gone. It was

- installed the new setup with the new modification

- checked the RegEdit once again

- the key had the exact same permissions as it had before (SYSTEM and Everyone set to "Full Control")

permissions.png
permissions.png (101.67 KiB) Viewed 16230 times

Could you please let me know if you proceeded the same?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Basic_Coder
Posts: 12
Joined: Tue Jun 16, 2020 8:27 pm

Re: Cannot set permissions for registry keys; Everyone group should have full control

Caitlin,

Thank you for the response with the picture and sorry for the delay.

That discrepancy, it turns out, is the crux of the issue.

I have a virtual machine with a snapshot taken right after the virtual machine was installed. No developer tools or any extra environment than what comes from the Windows 10 OS. The virtual machine (using VMware) is customized to have no connection to the internet, if that matters.

EDIT: I made a mistake in my response and corrected below in bold and italics. END EDIT.

Before I installed each of the two Advanced Installer projects previously defined, I reverted to that snapshot. When I tested what you wrote, I did indeed get the same result you did. As in, I installed the first project, got the registry key with Everyone group / full permission. Then I uninstalled, which eliminated the registry key from RegEdit, but must have left a remnant on the virtual machine. I then installed the second project, and the registry key was correctly Everyone group / full permission, as you have pictured.

Leaving this registry on computer after uninstall is an intended behavior of my application, but flipping on the Permanent attribute is not part of the minimally reproducible error and did not seem to fix the issue when turned on.

Thus, can you help with registry permissions for Everyone Group / full control seeming to break for first time installations of the project previously attached?
Last edited by Basic_Coder on Fri Sep 04, 2020 8:18 pm, edited 1 time in total.
Basic_Coder
Posts: 12
Joined: Tue Jun 16, 2020 8:27 pm

Re: Cannot set permissions for registry keys; Everyone group should have full control

Caitlin,

I think that your response reveals another mismatch between what we are doing.

You said, " - open the project - select the registry key --> "Go to component" --> uncheck the "64-bit component" option (as it was not unchecked)"


Here are steps to go with the two screenshots I will attempt to attach:
Open project attached previously from thread
In Registry tab, right click HKEY_LOCAL_MACHINE > Software > New_Key
Option "Go to Component" is grayed out
Go to Organization tab
There are three items: AI_ExePath, NewValue, and ProductInformation
Select NewValue
It has "64-bit Coomponent" as unchecked.

When I make a new blank project and follow the steps in the first post to recreate, the registry key component seems to disappear at the exact moment when adding the registry value to that key.

Can you let me know if that is proper behavior? That the registry key component disappears, and you really meant you went to the registry value component?
Attachments
RegistryTab_NoKeyComponent.png
RegistryTab_NoKeyComponent.png (156.84 KiB) Viewed 16206 times
OrganizationTab_NoKeyComponent.png
OrganizationTab_NoKeyComponent.png (162.7 KiB) Viewed 16206 times
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Cannot set permissions for registry keys; Everyone group should have full control

Hello,

I am a little bit confused now in regards to the test case.

Let's recap a bit. First of all, you are saying that:
Leaving this registry on computer after uninstall is an intended behavior of my application, but flipping on the Permanent attribute is not part of the minimally reproducible error and did not seem to fix the issue when turned on.
If I understand correctly, during uninstall, you do not remove the registry key?

If so, how did you achieve this? In order to prevent the registry key to be removed during uninstall, in my tests, I have proceeded as it follows:

- right click on the key

- "Properties"

- "Operations" tab

- "Preserve key content" with the REMOVE = "ALL" condition

preserve.png
preserve.png (31.38 KiB) Viewed 16167 times
Thus, can you help with registry permissions for Everyone Group / full control seeming to break for first time installations of the project previously attached?
I am not quite sure I understand what you mean here. Are the permissions not set during a first time install?
When I make a new blank project and follow the steps in the first post to recreate, the registry key component seems to disappear at the exact moment when adding the registry value to that key.
You are indeed right here. When I said to use the "Go to component" option for your key, I meant that should be used in the first version of your project (the one where the registry value does not exist).

So, once again, here are the steps that I have used:

- install the first setup. This setup only installs the registry key (without any value added to that key). Additionally, the key is set to not be deleted upon uninstall (see above screenshot)

- I check the RegEdit and the key can be found here:

Code: Select all

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\New_Key
- uninstall the product

- check the RegEdit once again --> the key was not removed (as we have marked it accordingly)

- open the project in Advanced Installer

- in "Registry" page, add a new value to the key as per your steps

- rebuild the project

- install it

- check RegEdit --> the value was added to the key and the key permissions are exactly the same as before

Could you please take a look at the steps I've followed and let me know if everything is ok?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Basic_Coder
Posts: 12
Joined: Tue Jun 16, 2020 8:27 pm

Re: Cannot set permissions for registry keys; Everyone group should have full control

Catalin,

Thanks for explaining that discrepancy on the Go to Component option.

I'm sorry, I never should have mentioned about registry keys staying on the machine. It's a quirk of my application that lies outside the scope of this question, and probably only adds confusion. Let's just stick to the minimally reproducible example we have been discussing.



The trouble I am having is, I am not installing one thing and then uninstalling like you are doing. Users also will not do that.

My steps are as follows:
Revert to a snapshot of a fresh install of the Win10 OS, or the equivalent that you use on the Advanced Installer team, on which the first setup was never installed

Do not install the first setup.

Download the test project, "Your Application.aip" , that is attached to this forum thread.
(This test project has Organization tab > NewValue entry > 64-bit component as unchecked on my computer)
Build the test project, "Your Application.aip"

Install it on the virtual machine that was never touched by first setup
Check RegEdit permission of Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\New_Key


Get the below pictures, which detail that permissions are:
ALL APPLICATION PACKAGES with read access.
Account Unknown (S-1-15-3-1024-<Many More Numbers>) with read access.
CREATOR OWNER with special permissions.
SYSTEM with full control.
Administrators (DESKTOP-<alphanumerics>\Administrators) with full control.
Users (DESKTOP-<alphanumerics>\Users) with read access.



Could you let me know if you get my same result when following my steps?
Attachments
BrokenPermissions_1.PNG
BrokenPermissions_1.PNG (60.08 KiB) Viewed 16159 times
BrokenPermissions_2.PNG
BrokenPermissions_2.PNG (22.24 KiB) Viewed 16159 times
BrokenPermissions_3.PNG
BrokenPermissions_3.PNG (19.49 KiB) Viewed 16159 times
Last edited by Basic_Coder on Thu Sep 10, 2020 11:52 pm, edited 2 times in total.
Basic_Coder
Posts: 12
Joined: Tue Jun 16, 2020 8:27 pm

Re: Cannot set permissions for registry keys; Everyone group should have full control

Last three pictures
Attachments
BrokenPermissions_4.PNG
BrokenPermissions_4.PNG (18.16 KiB) Viewed 16159 times
BrokenPermissions_5.PNG
BrokenPermissions_5.PNG (18.44 KiB) Viewed 16159 times
BrokenPermissions_6.PNG
BrokenPermissions_6.PNG (17.57 KiB) Viewed 16159 times
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Cannot set permissions for registry keys; Everyone group should have full control

Hello,

First of all, please accept my apologies for such a delayed reply, but we were very busy lately.

Thank you very much for the detailed test-case.

I have tested this once again following your steps and I can indeed confirm the behavior.

I am not quite sure what happened in my earlier tests as I was not able to reproduce this at all, it is really strange.

I have now forwarded this to our development team so this can be fixed in a future version of Advanced Installer.

Until then, as a workaround, you could try to create your own custom action that sets the desired permissions for your key. The custom action should be scheduled after the "WriteRegistryValues" action.

In order to display the above mentioned action in the sequence, please proceed as in the screenshot below:

WriteRegistryValues.png
WriteRegistryValues.png (153.71 KiB) Viewed 16050 times
From that list, please select both "WriteRegistryValues" and "WriteIniValues" actions.

After doing so, simply drag and drop your custom action between those two mentioned above.

If you require assistance in creating the custom action, please let me know and I will gladly assist.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Basic_Coder
Posts: 12
Joined: Tue Jun 16, 2020 8:27 pm

Re: Cannot set permissions for registry keys; Everyone group should have full control

Catalin,

Thank you. And I would like to apologize myself; I realize my first few posts were not written as well as they should have been and lead readers in the wrong direction.

I would like some assistance for the creation of custom action, when you are available. I've created custom actions before from batch files to copy/move files, but not to set registry permissions.
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Cannot set permissions for registry keys; Everyone group should have full control

Hello,
I would like some assistance for the creation of custom action, when you are available.
Sure thing!

A script (PowerShell) that modifies registry permissions looks something like this:

Code: Select all

$acl = Get-Acl "HKLM:\SOFTWARE\New_Key"
$users = [System.Security.Principal.NTAccount]"Everyone"
$access = [System.Security.AccessControl.RegistryRights]"FullControl"
$inheritance = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit,ObjectInherit"
$propagation = [System.Security.AccessControl.PropagationFlags]"None"
$type = [System.Security.AccessControl.AccessControlType]"Allow"
$rule = New-Object System.Security.AccessControl.RegistryAccessRule($users, $access,$inheritance, $propagation, $type)
$acl.SetAccessRule($rule)
$acl | Set-Acl
As mentioned earlier, the custom action should be scheduled between "WriteRegistryValues" and "WriteIniValues" standard actions.

Please have a look over the following setup project which I have created for your reference (it is created from the one you have provided):
Your Application.aip
(21.85 KiB) Downloaded 1141 times
Hope this will help!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Basic_Coder
Posts: 12
Joined: Tue Jun 16, 2020 8:27 pm

Re: Cannot set permissions for registry keys; Everyone group should have full control

Catalin,

Thank you so so much. I believe this will work like a charm. And, with all hope, help other users of Advanced Installer.

Thanks,
Henry
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Cannot set permissions for registry keys; Everyone group should have full control

You are always welcome, Henry!

I am really glad I could help.

I will update this thread once the issue discussed above will be fixed in a future version of Advanced Installer.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”