Would an MSI able to launch programs/files with elevated permissions automatically?
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 aut开发者_运维百科omatically run cmd as an administrator. I appreciate any direction or help given, thank you very much!
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
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.
精彩评论