|
||
ECom provides two ways to prevent a RAM-based plug-in from being used:
by using the ROM-only resolver to restrict plug-ins to those that live in ROM
by preventing a ROM-based implementation from being overridden by a RAM-based implementation.
The ROM-only resolver provides the ability to prevent the use of plug-ins that are not in the ROM when searching for an implementation.
To use this resolver, applications must specify
KRomOnlyResolverUid
as the CResolver
UID passed to those variants of
REComSession::ListImplementationsL()
and
REComSession::CreateImplementationL()
that take the
TUid aResolverUid
parameter.
If an installable upgrade to a ROM-based plug-in is correctly supplied by a vendor, then the ROM-only resolver will find and use the upgrade. Platform security controls are used to ensure that the upgrade is secure. For details, see How to upgrade ROM-based plug-ins securely.
A plug-in wishing to prevent one or more of its implementations being
overridden by a RAM-based implementation with a higher version number can
specify that those implementations are ROM-only. It does this in the source
resource file (.rss
).
The resource file is where the plug-in declares its set of
implementations and interfaces. The resource structures are usually defined in
the file RegistryInfo.rh
, which is included in the source resource
(.rss) file. However, a plug-in that wants to declare one or more
ROM-only implementations must use slightly modified resource
structures declared in the file RegistryInfoV2.rh
, and this header
file must be used instead of (i.e. not in addition to)
RegistryInfo.rh
.
The two structs: REGISTRY_INFO
and
IMPLEMENTATION_INFO
are slightly modified
in RegistryInfoV2.rh
:
The REGISTRY_INFO
struct
contains an additional member labelled resource_format_version
that, when set to RESOURCE_FORMAT_VERSION_2, tells ECom that this plug-in
resource file is in the version 2 format.
The IMPLEMENTATION_INFO
struct
contains an additional member labelled rom_only
. This is set to 1
to indicate a ROM-only implementation, and is set to 0 for implementations that
do not require this protection.
Care must be taken to explicitly set one of these values for all implementations declared in the file; those implementation that are not intended to be ROM-only must have a value set.
Note that RAM-based plug-ins can also use the version 2 resource file format. However, any implementation in such a plug-in that tries to declare itself as ROM-only is discarded and cannot be used.
See the example in writing a version 2 registration resource file.