Friday, February 12, 2010

Problem: Unable to register an in-house generated PIA for a core component in Vista or Windows 7

Scenario:
One may create a PIA for a third party COM component when the vendor does not supply a PIA. However, if the component is a core Windows component such as MSScript.ocx or MSXMLx.dll the generated PIA cannot be registered.

Symptoms:
Regasm produces no error messages but the PIA is not registered for the component and the values are placed under HKLM\Software\Volatile.

And/Or

An installer runs but the PIA is not registered for the component and the values are placed under HKLM\Software\Volatile.

And/Or

You receive the following error when running tlbimp: TlbImp : error TI0000 : System.ApplicationException - Referenced type library ' does not have a primary interop assembly registered

Cause:
All registry keys for core windows components are owned by TrustedInstaller (Windows Resource Protection) and all others, including local service and administrators have Read Only access.

Resolutions:
Factor out the third party component by wrapping the exposed types or moving the dependencies into a module where a local interop assembly can be used or eliminate the use of components where PIA are not supplied.


It is possible to take ownership of the CLSID key from TrustedUser, change the permissions, register the component, and then revert the permissions and ownership. However it defeats the purpose of Windows Resource Protection and will break other components if valid PIA information is overwritten or a PIA is made available in the future.

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete