Separation is the way to go if the application sometimes does not execute the registry, and sometimes it does. Three keys to the separation: (1) have a manifest on the second exe, as Ho says, (2) put the screen on the button / menu item so that the user expects an elevation, and (3) launch it using ShellExecute (before calling Start, set to UseShellExecuteFlag (true) to use the manifest.
However, before solving the problem of breaking down the application, I would ask two questions. Firstly, is it ever used for non-administrative purposes or does each user always “click this button” and have to pick it up? If so, just put the admin manifest in the application and do not separate it. Secondly, you definitely need to write this part of the registry? Could you move your key to something under HKCU? If you can, then you no longer need the hill, and all is happier. I always like these features first, as they mean less code and fewer tests than partioning.
Kate gregory
source share