Porting Data Recognizers to Secure Platform

This page describes how to migrate data recognizers to the secure version of the Symbian platform.

Procedure

Converting data recognizers into ECOM plugins

  1. Changing the project specification (.mmp) file - Change the project specification (.mmp) file to specify an ECOM plug-in. For example:
    target            EXAMPLEREC.DLL 
    targettype        PLUGIN 
    UID                0x10009D8D <DLLUID> 
    capability        ProtServ 
    sourcepath        ..\path 
    systeminclude    ..\inc 
    systeminclude    ..\inc\ecom  
    source            EXAMPLEREC.CPP 
    start resource    <DLLUID>.RSC  
    TARGET            examplerec.rsc  
    library            EUSER.LIB APMIME.LIB
  2. Changing the ECOM resource file - Change the ECOM resource file to specify:

    • interface UID. This identifies the plugin scheme, and should be 0x101F7D87 for data recognizers

    • implementation UID. This uniquely identifies the plugin.

    For example:

    #include <RegistryInfo.rh> 
    RESOURCE REGISTRY_INFO r_registry
    { 
    dll_uid = <DLLUID>;  // Should match the name of this file 
                        // The name of the resource file is <DLLUID>.rss 
    interfaces =  
        { 
        INTERFACE_INFO 
            { 
            interface_uid = 0x101F7D87; // Const for all data recognizers 
            implementations = 
                { 
                IMPLEMENTATION_INFO 
                    { 
                    implementation_uid = <Unique Implementation Uid>;  
                    version_no = 1; 
                    display_name = "DataRecName"; 
                    default_data = "";  
                    opaque_data = ""; 
                    } 
                }; 
            } 
        }; 
    }
  3. Changing the source code -

    Both the data recognizer's .h and .cpp files need code adding to create the data recognizer. For example:

    example.h

    class CExampleDataRecognizer : public CApaDataRecognizerType
         {
         public:
             static CApaDataRecognizerType* CreateRecognizerL();
         };

    example.cpp

    CApaDataRecognizerType* CExampleDataRecognizer::CreateRecognizerL()
        {
        return new (ELeave) CExampleDataRecognizer ();
        }
    
    const TImplementationProxy ImplementationTable[] =
        { 
        IMPLEMENTATION_PROXY_ENTRY(UNIQUE IMPLEMENTATION UID, CExampleDataRecognizer::CreateRecognizerL)
        };
    
    EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
        {
        aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
        return ImplementationTable;
        }
    
    // Remove the previously EXPORTED function
    EXPORT_C CApaDataRecognizerType* CreateRecognizer ()
        {
        }

Converting data recognizers into pre-platform security style plugins

You can convert data recognizers into plug-ins of the sort used before Platform Security was introduced by:

  1. Changing the project specification (.mmp) file - Change the project specification (.mmp) file to specify a plug-in of the style used before Platform Security was introduced. For example:
    target            EXAMPLEREC.MDL 
    targettype        DLL 
    UID                0x10003A37 <DLLUID> 
    capability        TrustedUI ProtServ 
    sourcepath        ..\path 
    systeminclude    ..\inc 
    source            EXAMPLEREC.CPP 
    library            EUSER.LIB APMIME.LIB
  2. Changing the source code - The data recognizer's .cpp file needs code adding to create the data recognizer. For example:

    example.cpp

    EXPORT_C CApaDataRecognizerType* CreateRecognizer() 
        { 
        CExampleDataRecognizer * thing=NULL; 
        thing = new CExampleDataRecognizer(); 
        return thing; // null if new failed 
        }