Update contrib.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\dll\t_path.cpp
16 // Test imported DLL path search order.
18 // None (implicit searching when loading an executable)
20 // - t_pathdll1 and t_pathdll2 both export the same function which returns 1
22 // - Run t_path2 (linked to t_pathdll1) and check return value from DLL - should
24 // - Copy t_pathdll2 to C: and rename to t_pathdll1 - it should now be loaded
26 // - Run t_path2 again and check return value from DLL - should be 2.
27 // Platforms/Drives/Compatibility:
29 // Assumptions/Requirement/Pre-requisites:
30 // Failures and causes:
31 // Base Port information:
35 #define __E32TEST_EXTENSION__
39 #include <e32ldr_private.h>
41 RTest test(_L("T_PATH"));
48 test.Start(_L("Test imported DLL search path order"));
50 if (!PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin))
52 test.Printf(_L("Skipping test as sysbin enforcement is disabled"));
56 // Turn off evil lazy dll unloading
58 test_KErrNone(l.Connect());
59 test_KErrNone(l.CancelLazyDllUnload());
62 CTrapCleanup* ct = CTrapCleanup::New();
64 test_KErrNone(gFs.Connect());
65 TRAPD(r, gFileMan=CFileMan::NewL(gFs));
68 test.Next(_L("Run t_path2, expecting DLL 1 to be loaded"));
69 _LIT(KPath2, "t_path2");
71 test_KErrNone(path2.Create(KPath2, KNullDesC));
75 User::WaitForRequest(stat);
76 test_Equal(EExitKill, path2.ExitType());
77 test_Equal(1, path2.ExitReason());
80 test.Next(_L("Copy DLL 2 to C drive"));
81 _LIT(KCopySrc, "Z:\\sys\\bin\\t_pathdll2.dll");
82 _LIT(KCopyDest, "C:\\sys\\bin\\");
83 test_KErrNone(gFileMan->Copy(KCopySrc(), KCopyDest(), CFileMan::ERecurse));
84 _LIT(KRenSrc, "C:\\sys\\bin\\t_pathdll2.dll");
85 _LIT(KRenDest, "C:\\sys\\bin\\t_pathdll1.dll");
86 test_KErrNone(gFileMan->Rename(KRenSrc(), KRenDest()));
88 test.Next(_L("Run t_path2, expecting DLL 2 to be loaded"));
89 test_KErrNone(path2.Create(KPath2, KNullDesC));
92 User::WaitForRequest(stat);
93 test_Equal(EExitKill, path2.ExitType());
94 test_Equal(2, path2.ExitReason());
98 gFileMan->Delete(KRenDest);