testexecfw/tef/utils/src/tefutils.cpp
changeset 0 3e07fef1e154
equal deleted inserted replaced
-1:000000000000 0:3e07fef1e154
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file TEFUtils.cpp
       
    22 */
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <f32file.h>
       
    26 #include <test/tefexportconst.h>
       
    27 #include "TEFUtils.h"
       
    28 
       
    29 EXPORT_C CWrapperUtilsPlugin* TEFUtils::WrapperPluginNew(RLibrary& aLibrary)
       
    30 	{
       
    31 	const TInt KDllNameLength = 32;
       
    32 	TInt pluginErr = KErrGeneral;
       
    33 	CWrapperUtilsPlugin* plugin = NULL;
       
    34 	TInt index = KOsVersionCount;
       
    35 	TBuf<KDllNameLength> wrapperDllName;
       
    36 	_LIT(wrapperDllNameFormat, "WrapperUtilsPlugin%d.dll");
       
    37 	pluginErr = aLibrary.Load(_L("WrapperUtilsPlugin.dll"));
       
    38 	while (KErrNone != pluginErr && index != 0)
       
    39 		{
       
    40 		wrapperDllName.Format(wrapperDllNameFormat, index);
       
    41 		pluginErr = aLibrary.Load(wrapperDllName); //KTEFWrapperPluginDll
       
    42 		--index;
       
    43 		}
       
    44 	
       
    45 	if (pluginErr == KErrNone)
       
    46 		{
       
    47 		TLibraryFunction newl;
       
    48 		newl = aLibrary.Lookup(1);
       
    49 		TRAP(pluginErr, plugin = (CWrapperUtilsPlugin*)newl());
       
    50 		if (KErrNone != pluginErr)
       
    51 			{
       
    52 			aLibrary.Close();
       
    53 			}
       
    54 		}
       
    55 	
       
    56 	return plugin;
       
    57 	}