Windows Limited User Installation

大城市里の小女人 提交于 2019-12-04 12:41:17

I don't know for sure, but I seem to recall COM servers support per-user installation, and maybe that goes for EXE servers as well.

If so, change your registration code to write information to HKEY_CURRENT_USER\Software\Classes instead of HKEY_CLASSES_ROOT.

The COM infrastructure should do the lookup first per-user and then per-machine.

It's worth an experiment anyway.

OK, I found a way to create a limited-user installation script with both my COM server and COM objects being registered per-user.

I am using the latest version of ATL (v9) that ships with MSVC 2008 to create my COM server and COM objects. Turns out that you can register the COM server per-user via the new /RegServerPerUser switch. I tested this with limited user accounts on XP, Vista and Windows 7 and it works perfectly.

Next, the COM controls. Again, ATL9 to the rescue. You can register a control per-user by ensuring that RegSvr32 calls your control's DllInstall function, passing it a command-line parameter of user. So, to register a control in this way you simply do:

regsvr32.exe /i:user /n MyControl.DLL

Again, I tested this on XP, Vista and Windows 7 and it works fine.

I then made the following changes to my Inno Setup script:

  • The default installation folder will be {pf} (i.e. C:\Program Files) if the user has Admin rights. If not, then it defaults to {commonappdata} (i.e. C:\Documents and Settings\All Users).
  • Register my COM server using the new /RegServerPerUser switch.
  • I removed the regserver flags from my COM objects and instead added support to call regsvr32 using the new 'user' switch.

All of these changes are easy to do using the Inno Setup {code} feature.

Thanks to Kim for setting me down the per-user COM install path.

If you dumped inno-setup and used MSIs - MSI files support the idea of limited user installation of patches. An administrator must authorize the initial install, thereafter, digital signatures in patch msi files are processed by the elevated msi service without requiring user elevation.

You can duplicate this basic idea yourself - during an initial administrative install, install a service component that has the necessary access. When processing patches, ask the service process to process the EXE COM server registrations.

You need to rethink your approache ... write access to a folder than can also allow for program execution by the same user is the cause for 99% of all virus/malware functionality. Please learn a little about Software Restriction Policy and the new App Locker behavior built into Windows 7 so that the computing infrastructure can move forward not backward.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!