sl@0: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\dll\t_oeexport_wins.cpp sl@0: // Overview: sl@0: // Emulator version that tests it is possible to retrieve the 0th sl@0: // ordinal from exes and dlls that are marked as having named sl@0: // symbol export data. sl@0: // API Information: sl@0: // RProcess, RLibrary sl@0: // Details: sl@0: // - Test reading 0th ordinal from a dll which has a E32EmulExpSymInfoHdr sl@0: // struct at the 0th ordinal and verify the contents of the header sl@0: // - Test NULL is returned on attempts to get the 0th ordinal from a sl@0: // dll without the named symbol data sl@0: // - Test reading the named symbol data from an exe that contains a sl@0: // E32EmulExpSymInfoHdr struct at the 0th ordinal and verify the contents sl@0: // - Test NULL is returned when attempting to read the 0th ordinal of sl@0: // an exe that doesn't contain a E32EmulExpSymInfoHdr sl@0: // Platforms/Drives/Compatibility: sl@0: // All sl@0: // Assumptions/Requirement/Pre-requisites: sl@0: // Failures and causes: sl@0: // Base Port information: sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: RTest test(_L("T_OEEXPORT")); sl@0: sl@0: LOCAL_D void VerifyHdr(E32EmulExpSymInfoHdr& aExpectedHdr, E32EmulExpSymInfoHdr &aReadHdr) sl@0: { sl@0: test(aExpectedHdr.iSymCount == aReadHdr.iSymCount); sl@0: test(aExpectedHdr.iDllCount == aReadHdr.iDllCount); sl@0: } sl@0: sl@0: TInt E32Main() sl@0: { sl@0: test.Title(); sl@0: sl@0: test.Start(_L("Test retrieving 0th ordinal and therefore named symbol export data")); sl@0: sl@0: E32EmulExpSymInfoHdr tmpHdr; sl@0: E32EmulExpSymInfoHdr *readHdr; sl@0: RLibrary library; sl@0: sl@0: // The values for the header of the dll with a 0th ordinal sl@0: tmpHdr.iSymCount = 0x0; sl@0: tmpHdr.iDllCount = 0x3; sl@0: test(library.Load(_L("t_oedll.dll")) == KErrNone); sl@0: test.Next(_L("Attempt to retrieve named symbol data from t_oedll.dll")); sl@0: readHdr = (E32EmulExpSymInfoHdr*)library.Lookup(0); sl@0: test(readHdr!=NULL); sl@0: //#define PRINT_ZEROTH sl@0: #ifdef PRINT_ZEROTH sl@0: test.Printf(_L("iSymCount=%08x;iDllCounts=%08x\n"),readHdr->iSymCount,readHdr->iDllCount); sl@0: #endif sl@0: test.Next(_L("Verify export data of t_oedll.dll is that expected")); sl@0: VerifyHdr(tmpHdr, *readHdr); sl@0: library.Close(); sl@0: sl@0: test.Next(_L("Verify lookup on dll without oe export data returns NULL")); sl@0: test(library.Load(_L("t_dll1.dll")) == KErrNone); sl@0: readHdr = (E32EmulExpSymInfoHdr*)library.Lookup(0); sl@0: test(readHdr == NULL); sl@0: library.Close(); sl@0: sl@0: // The values for the header of the exe of the current process with a 0th ordinal sl@0: tmpHdr.iSymCount = 0x3; sl@0: tmpHdr.iDllCount = 0x5; sl@0: test.Next(_L("Attempt to retrieve named symbol data from current process")); sl@0: readHdr = (E32EmulExpSymInfoHdr*)(RProcess::ExeExportData()); sl@0: test(readHdr!=NULL); sl@0: test.Next(_L("Verify export data 0th ordinal data of this exe is that expected")); sl@0: #ifdef PRINT_ZEROTH sl@0: test.Printf(_L("iSymCount=%08x;iDllCounts=%08x;\n"),readHdr->iSymCount,readHdr->iDllCount); sl@0: #endif sl@0: VerifyHdr(tmpHdr, *readHdr); sl@0: sl@0: /* sl@0: On Emulator can't examine fixups & depdencies via export data as data not included sl@0: in E32EmulExpSymInfoHdr. This is all handled by the MS loader. sl@0: sl@0: */ sl@0: test.End(); sl@0: return KErrNone; sl@0: }