UID Protection

Describes the identifiers used in a polymorphic DLL.

All files have an associated compound identifier, a TUidType, comprising three component UIDs that together identify the file. A compound identifier is also commonly known as a UID type.

For a polymorphic DLL, the first UID component always has the value KDynamicLibraryUidValue. The second UID component is used to verify that the DLL satisfies the protocol defined by the programming interface. Indeed, this UID identifies that protocol. The third UID component is used to identify a specific implementation; the use of the third component UID depends on the protocol.

For a UI application, the second UID component takes the value KAppUidValue. The third UID component must be defined and must be unique in order to differentiate it from all other applications. In contrast, a DLL which implements a printer driver does not require a third UID component.

The use of UIDs in DLLs provides a guarantee that the loaded DLL is the correct type. This prevents files which just happen to have the right name from being loaded inadvertently.

A polymorphic interface DLL is loaded dynamically. The handle to the DLL is encapsulated by an RLibrary object. The Type() member function of RLibrary is used to return the DLL's TUidType from which the individual UID components can be extracted.

KDynamicLibraryUidValue is defined in e32uid.h and KAppUidValue is defined in apadef.h.