[wix-users] Changing Burn registration to per-machine from BA

Steve Dower steve.dower at python.org
Tue Sep 29 11:00:22 PDT 2015

On 29Sep2015 1010, Rob Mensching wrote:
> One per-user package in the Chain makes the Bundle per-user.

This is determined at build-time, right? So it doesn't matter if the 
condition eventually evaluates to false.

I was going to ask why not go the other way and have one all-user 
package make the Bundle all-users, but I figured it out (an all-user 
package would be refcounted/skipped between users, and separate users 
could install the per-user packages independently for themselves). 
There's also not really a good automatic way to determine where the 
registration should be, even after planning, so relying on a custom BA 
to know is the only option.

> Yeah, you'll need to start in the Binder (to handle the case above) and work all the way through all parts of the engine. This is not the feature I'd typically recommend starting with as a new developer on the WiX toolset. <smile/>

I'm brave :) Also motivated.

ISTM it could be made to work with:
* RegistrationDetectInstalled checks both HKCU and HKLM for per-user 
bundles, switching to per-machine if it is already registered in HKLM

* IBootstrapperApplication gains an OnChangeBundleScope callback that 
occurs before Plan and is the only opportunity to change fPerMachine.
* IBootstrapperEngine gains a SetBundleScope method that can only be 
called between Detect and Plan.

Changing the scope calls SetPaths() again (with enhancement to handle 
this without leaking so much memory), and maybe the only permitted 
change is from per-user to per-machine. Since it is before Plan, all 
packages could be forced to machine scope (which would also 
significantly simplify authoring these dual-purpose bundles).

 From reading how bundle registration works, this seems like it should 
be enough for switching between complete/partial per-user installs and 
complete per-machine installs at runtime. But it's highly likely I've 
missed something. Is it worth giving it a go and seeing what breaks?

More information about the wix-users mailing list