|
1 /* |
|
2 * Copyright (c) 2006-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 the License "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 * e32test\dll\t_oeexport_wins.cpp* |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 |
|
21 Overview: |
|
22 |
|
23 Emulator version that tests it is possible to retrieve the 0th |
|
24 |
|
25 ordinal from exes and dlls that are marked as having named |
|
26 |
|
27 symbol export data. |
|
28 |
|
29 |
|
30 |
|
31 API Information: |
|
32 |
|
33 RProcess, RLibrary |
|
34 |
|
35 |
|
36 |
|
37 Details: |
|
38 |
|
39 - Test reading 0th ordinal from a dll which has a E32EmulExpSymInfoHdr |
|
40 |
|
41 struct at the 0th ordinal and verify the contents of the header |
|
42 |
|
43 - Test NULL is returned on attempts to get the 0th ordinal from a |
|
44 |
|
45 dll without the named symbol data |
|
46 |
|
47 - Test reading the named symbol data from an exe that contains a |
|
48 |
|
49 E32EmulExpSymInfoHdr struct at the 0th ordinal and verify the contents |
|
50 |
|
51 - Test NULL is returned when attempting to read the 0th ordinal of |
|
52 |
|
53 an exe that doesn't contain a E32EmulExpSymInfoHdr |
|
54 |
|
55 |
|
56 |
|
57 Platforms/Drives/Compatibility: |
|
58 |
|
59 All |
|
60 |
|
61 |
|
62 |
|
63 Assumptions/Requirement/Pre-requisites: |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 Failures and causes: |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 Base Port information: |
|
76 |
|
77 |
|
78 |
|
79 */ |
|
80 |
|
81 #include <t_oedll.h> |
|
82 |
|
83 #include <e32test.h> |
|
84 |
|
85 #include <e32panic.h> |
|
86 |
|
87 #include <f32image.h> |
|
88 |
|
89 |
|
90 |
|
91 RTest test(_L("T_OEEXPORT")); |
|
92 |
|
93 |
|
94 |
|
95 LOCAL_D void VerifyHdr(E32EmulExpSymInfoHdr& aExpectedHdr, E32EmulExpSymInfoHdr &aReadHdr) |
|
96 |
|
97 { |
|
98 |
|
99 test(aExpectedHdr.iSymCount == aReadHdr.iSymCount); |
|
100 |
|
101 test(aExpectedHdr.iDllCount == aReadHdr.iDllCount); |
|
102 |
|
103 } |
|
104 |
|
105 |
|
106 |
|
107 TInt E32Main() |
|
108 |
|
109 { |
|
110 |
|
111 test.Title(); |
|
112 |
|
113 |
|
114 |
|
115 test.Start(_L("Test retrieving 0th ordinal and therefore named symbol export data")); |
|
116 |
|
117 |
|
118 |
|
119 E32EmulExpSymInfoHdr tmpHdr; |
|
120 |
|
121 E32EmulExpSymInfoHdr *readHdr; |
|
122 |
|
123 RLibrary library; |
|
124 |
|
125 |
|
126 |
|
127 // The values for the header of the dll with a 0th ordinal |
|
128 |
|
129 tmpHdr.iSymCount = 0x0; |
|
130 |
|
131 tmpHdr.iDllCount = 0x3; |
|
132 |
|
133 test(library.Load(_L("t_oedll.dll")) == KErrNone); |
|
134 |
|
135 test.Next(_L("Attempt to retrieve named symbol data from t_oedll.dll")); |
|
136 |
|
137 readHdr = (E32EmulExpSymInfoHdr*)library.Lookup(0); |
|
138 |
|
139 test(readHdr!=NULL); |
|
140 |
|
141 //#define PRINT_ZEROTH |
|
142 |
|
143 #ifdef PRINT_ZEROTH |
|
144 |
|
145 test.Printf(_L("iSymCount=%08x;iDllCounts=%08x\n"),readHdr->iSymCount,readHdr->iDllCount); |
|
146 |
|
147 #endif |
|
148 |
|
149 test.Next(_L("Verify export data of t_oedll.dll is that expected")); |
|
150 |
|
151 VerifyHdr(tmpHdr, *readHdr); |
|
152 |
|
153 library.Close(); |
|
154 |
|
155 |
|
156 |
|
157 test.Next(_L("Verify lookup on dll without oe export data returns NULL")); |
|
158 |
|
159 test(library.Load(_L("t_dll1.dll")) == KErrNone); |
|
160 |
|
161 readHdr = (E32EmulExpSymInfoHdr*)library.Lookup(0); |
|
162 |
|
163 test(readHdr == NULL); |
|
164 |
|
165 library.Close(); |
|
166 |
|
167 |
|
168 |
|
169 // The values for the header of the exe of the current process with a 0th ordinal |
|
170 |
|
171 tmpHdr.iSymCount = 0x3; |
|
172 |
|
173 tmpHdr.iDllCount = 0x5; |
|
174 |
|
175 test.Next(_L("Attempt to retrieve named symbol data from current process")); |
|
176 |
|
177 readHdr = (E32EmulExpSymInfoHdr*)(RProcess::ExeExportData()); |
|
178 |
|
179 test(readHdr!=NULL); |
|
180 |
|
181 test.Next(_L("Verify export data 0th ordinal data of this exe is that expected")); |
|
182 |
|
183 #ifdef PRINT_ZEROTH |
|
184 |
|
185 test.Printf(_L("iSymCount=%08x;iDllCounts=%08x;\n"),readHdr->iSymCount,readHdr->iDllCount); |
|
186 |
|
187 #endif |
|
188 |
|
189 VerifyHdr(tmpHdr, *readHdr); |
|
190 |
|
191 |
|
192 |
|
193 /* |
|
194 |
|
195 On Emulator can't examine fixups & depdencies via export data as data not included |
|
196 |
|
197 in E32EmulExpSymInfoHdr. This is all handled by the MS loader. |
|
198 |
|
199 |
|
200 |
|
201 */ |
|
202 |
|
203 test.End(); |
|
204 |
|
205 return KErrNone; |
|
206 |
|
207 } |
|
208 |