ADXAddinModule RegisterForAllUsers Property vs. adxloader.dll.manifest privileges="user" vs. adxregister /privileges

Add-in Express™ Support Service
That's what is more important than anything else

ADXAddinModule RegisterForAllUsers Property vs. adxloader.dll.manifest privileges="user" vs. adxregister /privileges
Which configuration effects the registration of a COM Add-In 
dirkln




Posts: 73
Joined: 2017-10-05
Hello,
There are 2 options to define if a COM Add-In based on ADXAddinModule are register for all users or the current user.
1) use adxregsiter /privileges=user or use adxregsiter /privileges=admin
2) ADXAddinModule has a property RegisterForAllUsers = true or RegisterForAllUsers = false
3) There is a setting in the adxloader.<addinname>.dll.manifest privileges="user" or privileges="admin" in the loaderSettings node.


I've read the documentation.

Here is what I found so far:
1) If I register the COM Add-IN with adxregister /privileges=user and the COM Add-In property is set RegisterForAllUsers=true. The COM Add-In is registered per user on HKCU\Software\... and seems to ignore the setting RegisterForAllUsers=true. I'm fine with this.

2) If I use the Excel Add-In manager to install the COM Add-In the RegisterForAllUsers=true or RegisterForAllUsers=false is respected. I do this by selecting adxloader.<ourAddInName>.dll (for 32bit excel). I think the adxloader.dll.manifest need to have to same value. In this case no registration is done before with adxregister. I'm fine with this.

Here my questions:
A) What happens if RegisterForAllUsers and adxloader.<ourAddInName>.dll don't have the same scope user/admin?

B) Is the RegisterForAllUsers property only used if I register the COM AddIn with the Excel Add-In manager?
Does the adxregister overwrite the RegisterForAllUsers property in the ADXAddinModule?

C) Can I set the ADXAddinModule.RegisterForAllUsers=false and force an installation for all user by using adxregister /install=?Â?Ð?? /privileges=admin?

D) Can I set the ADXAddinModule.RegisterForAllUsers=false and force an installation for current user by using adxregister /install=?Â?Ð?? /privileges=user?


best regards
Dirk
Posted 11 Apr, 2019 07:01:00 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hello Dirk,

You've mistakenly use "the Excel Add-In manager" above: to manage COM add-ins, you use the COM Add-ins dialog.

Note that changing RegisterForAllUsers also changes the manifest (it must be writable). The manifest is used when you register the add-in by specifying adxloader.dll (adxloader64.dll) in the COM Add-ins dialog.

As to specifying the privileges command-line parameter of adxregistrator.exe, I suggest that you check section Registration-time Privileges, see the PDF file in the folder {Add-in Express}\Docs on your development PC.

Regarding B), C) and D) above, I suppose you look for a possibility to define whether the COM add-in is per-user or per-machine at the install time. If so, check section Dual-Purpose Installers. It describes a setup project wizard's option that lets you create such an installer using WiX.


Andrei Smolin
Add-in Express Team Leader
Posted 11 Apr, 2019 07:40:01 Top
dirkln




Posts: 73
Joined: 2017-10-05
Yes you are right. I used the Add-In Manager from Excel for COM Add-Ins.
Ok. I understand that adxloader.<xxx>.manifest and ADXAddinModule.RegisterForAllUser have always the same configuration.
I read the section but still got no answer for A,B,C.

We already have a Dual Purpose Setup. Based on a checkbox "For All user" or "For Me" we use adxregister /privileges=admin or adxregister /privileges=user and change the default install location. My question is regarding the ADXAddinModule.RegisterForAllUsers. Does this property affect the adxregister comamnd?
Posted 11 Apr, 2019 08:02:28 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
dirkln writes:
Ok. I understand that adxloader.<xxx>.manifest and ADXAddinModule.RegisterForAllUser have always the same configuration. I read the section but still got no answer for A,B,C.


In terms used in that section of the manual, RegisterForAllUsers and manifest describe the add-in side of your COM add-in. Namely, you use them to decide whether the Microsoft\Software\Office\{an application}\Addins\{your add-in ProgId} branch is located in HKCU (RegisterDorAllUsers=false) or HKLM (RegisterDorAllUsers=true).

In these terms, the privileges parameter of adxregistrator.exe influences the COM-class side. Namely, it creates the ProgID key and CLSID key (these terms are defined in section "Locating COM Add-ins in the Registry") either in HKCU (/privileges=user) or HKLM (/privileges=admin).

If A) refers to adxloder.dll, I don't understand the question. If A) refers to the manifest, the manifest prevails over RegisterForAllUsers at the registration time. Still, you should understand that RegisterForAllUsers is used as well e.g. at the design time. This is why we strongly recommend that the manifest and RegisterForAllUsers are in sync.

dirkln writes:
Does the adxregister overwrite the RegisterForAllUsers property in the ADXAddinModule?


It can't because they do not intersect; see above.

C) This creates a non-recommended combination: RegisterForAllUsers=false creates the add-in key in HKCU while the ProgID and CLSID keys are created in HKLM. That is, although the COM-side of the COM add-in is registered with admin permissions, the Office add-in itself is registered for the current user only: no other user on the PC will see that add-in in the COM Add-ins dialog.


Andrei Smolin
Add-in Express Team Leader
Posted 11 Apr, 2019 08:55:08 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Please remember that by default writing to HKLM (and Program Files) requires administrative permissions.


Andrei Smolin
Add-in Express Team Leader
Posted 11 Apr, 2019 08:56:11 Top
dirkln




Posts: 73
Joined: 2017-10-05
My experience is:
If I set the property RegisterDorAllUsers=true AND use adxregistrator /install privileges=user, then
the COM-AddIn is registered in HKCU for
a) the excel part
b) the com part.

So imo the adxregister somehow overwrites the RegisterDorAllUsers=true.
If I execute adxregistrator /install privileges=admin with admin rights I expect all registry key for in HKLM.
And this is the case.

If I set RegisterDorAllUsers=true AND use adxregistrator /install privileges=user with admin rights
only HKCU is manipulated. And this is the case.

Did I misunderstand you? For me it seems that adxregister controls where the excel part and the com part is registered per user or per machine in HKCU or HKLM

My Goal:
1) I want one setup and all assemblies once that I deliver to our customers. This contains all needed from adx and our COM-AddIn.
2) I want the customer to decide whether or not to install on HKLM or in HKCU that is for all user or only the current user.
3) I know about the extended privileges you need the register COM Classes in HKLM.

Our solution:
1a) Set ADXAddinModule.RegisterForAllUsers = true
1b) In the adxloader.<addinname>.dll.manifest the set privileges="administrator"
1c) For step 2) and step 3) I use exactly the same binaries.
2) Use adxregister /install ?Â?Ð?? /privilegs=admin to install the COM -AddIn for all users including Excel and COM part
3) use adxregister /install ?Â?Ð?? /privilegs=user to install the COM -AddIn for the current user include Excel and COM part
4) I know that for (2) I need more privileges.
5) Our MSI setup triggers either step 2) or step 3) based on the users choice.
5) This worked so far without any problem.
Posted 11 Apr, 2019 09:48:02 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hello Dirk,

dirkln writes:
If I set RegisterDorAllUsers=true AND use adxregistrator /install privileges=user with admin rights only HKCU is manipulated. And this is the case.


Whenever you have a registration-time issue, look in the adxregistrator.log. If you run the installer with a standard user's permissions, you can't write to HKLM.

I would use a dual-purpose installer with these settings:
- RegisterForAllUsers=false
- adxloader.dll.manifest; privileges=user

Do you set ComVisible(False) on the XLL module and register the XLL using RegisterXLL?


Andrei Smolin
Add-in Express Team Leader
Andrei Smolin
Add-in Express Team Leader
Posted 12 Apr, 2019 04:23:02 Top