开发者

Creating compound applications in Windows 7

开发者 https://www.devze.com 2022-12-24 05:04 出处:网络
I need to port a suite of Windows applications (running under XP with little security turned on) to Windows 7 with various levels of security, depending on how our clients may configure it. Each funct

I need to port a suite of Windows applications (running under XP with little security turned on) to Windows 7 with various levels of security, depending on how our clients may configure it. Each functional area is a seperate executable or DLL that is downloaded and registered by a central 'compound' application. This means that the different parts are all joined together to form in effect a large single application.

My problem is that the compound application knows about the other applications via COM registery, either as a typelibrary or as OCXs, where appropriate.

I have tried several questions here to try and solve the problems I am getting, but I don't seem to be able to get around the problem of needing elevated access to register applications and access the registry. Our clients will be expecting the same (relatively) seemless download and activation process as current under XP.

So does anyone have a so开发者_StackOverflowlution for registering typelibraries and OCX controls without need to go through an elevation process.

Update :

Any solutions don't necessarily have to be in Delphi, solving this for any language would help me enormously.

Thanks in advance


I think I have solved it. If you override the DllRegisterServer and DllUnRegisterServer methods for each OCX, and in them redirect the access to the registry HKCR hive to HKCU, AND then change RegisterTypeLibrary from comserv.pas to call RegisterTypeLibForUser when the RegisterTypeLib call fails, then OCX controls can be registered without needing elevation. I think the true is of typelibraries as well.

The secret is that the OCX control needs to be changed, rather than the programs that register it.

Not sure if I have summarised this properly yet!


Registering of COM applications etc requires the creation of keys and values under HKLM &/or HKCR in the registry. To write into those registry hives, an application MUST be elevated. For example, installers on Win7/Vista automatically run elevated, prompting users on startup with a UAC prompt (unless presumably your users have turned UAC off).

I think you will need to gently re-educate your clients with some modified expectations for Vista/Win7.

If you try and write into HKLM etc without being elevated, then you will probably run into issues where Vista/Win7 is virtualizing your access to the registry and your app then isn't writing into where it thinks it's writing.

There are a couple of SO answers here and here which should provide all of what you need to know to successfully get your Delphi app (or parts of it) elevated.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号