0
votes

I am trying to make it possible for an .msi file to open an executable which will register a Browser Helper Object. Since this involves writing to the registry, cmd.exe must be elevated with administrative privelages. I am able to manipulate the ShellExecute() function to make a UAC dialog pop up and ask whether the user wants to run cmd as an administrator, however, I would not like to give the user any control over the installation. Much research online has lead me to conclude that it is impossible to user a Browser Helper Object without administrative rights, so my question is: Would cmd.exe be able to inherit the permissions of the msi installer, assuming that the installer is already running with administrative rights? To no avail, I have also tried to automatically run cmd as an administrator. I appreciate any direction or help given, thank you very much!

2
Why are you trying to make a separate process that writes to the registry instead of letting the MSI write the necessary changes? The MSI is being executed by the Windows Installer, which should have already elevated. - Adrian McCarthy

2 Answers

2
votes

You should be able to achieve this without using CMD in around 100 lines of WiX and just write the required registry entries manually, no need to execute cmd.exe or regsvr32. Note that self-registration (what you're trying to do) is a really bad practice and leads to messy installs.

The following command should get you started:

heat.exe file MyBHO.dll -o MyBHO.wxs -template product -ag -suid
0
votes

My understanding is that IF UAC is enabled there should be no way to get around it. If there is it is an exploit and should be avoided.