sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@internalComponent
|
sl@0
|
22 |
*/
|
sl@0
|
23 |
|
sl@0
|
24 |
#include "dumpprocessor.h"
|
sl@0
|
25 |
#include <e32cons.h>
|
sl@0
|
26 |
#include <cryptospi/cryptospidef.h>
|
sl@0
|
27 |
#include <bacline.h>
|
sl@0
|
28 |
#include <cryptospi/cryptocharacteristics.h>
|
sl@0
|
29 |
#include <cryptospi/cryptospistateapi.h>
|
sl@0
|
30 |
|
sl@0
|
31 |
using namespace CryptoSpi;
|
sl@0
|
32 |
|
sl@0
|
33 |
//Copy-right, Tool name format
|
sl@0
|
34 |
_LIT(KShortName, "Dump CryptoSpi Tool");
|
sl@0
|
35 |
_LIT(KName, "Symbian Dump CryptoSpi Tool");
|
sl@0
|
36 |
_LIT(KCopyright, "Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.");
|
sl@0
|
37 |
_LIT(KDone, "Complete Dumping... \n");
|
sl@0
|
38 |
|
sl@0
|
39 |
//dumpcryptoplugin options
|
sl@0
|
40 |
_LIT(KAll, "-all");
|
sl@0
|
41 |
_LIT(KAllShort, "-a");
|
sl@0
|
42 |
|
sl@0
|
43 |
_LIT(KInterface, "-interface");
|
sl@0
|
44 |
_LIT(KInterfaceShort, "-i");
|
sl@0
|
45 |
|
sl@0
|
46 |
_LIT(KAlgorithm, "-algorithm");
|
sl@0
|
47 |
_LIT(KAlgorithmShort, "-al");
|
sl@0
|
48 |
|
sl@0
|
49 |
_LIT(KExtended, "-extended");
|
sl@0
|
50 |
_LIT(KExtendedShort, "-e");
|
sl@0
|
51 |
|
sl@0
|
52 |
_LIT(KDll, "-dll");
|
sl@0
|
53 |
_LIT(KDllShort, "-d");
|
sl@0
|
54 |
|
sl@0
|
55 |
_LIT(KHelp, "-help");
|
sl@0
|
56 |
_LIT(KHelpShort, "-h");
|
sl@0
|
57 |
|
sl@0
|
58 |
_LIT(KOutputFile, "-out");
|
sl@0
|
59 |
_LIT(KOutputFileShort, "-o");
|
sl@0
|
60 |
|
sl@0
|
61 |
|
sl@0
|
62 |
//Error messages
|
sl@0
|
63 |
_LIT(KMissingInterfaceName, "Missing Interface Name. \n");
|
sl@0
|
64 |
_LIT(KInvalidInterfaceName, "Invalid Interface Name. \n");
|
sl@0
|
65 |
_LIT(KMissingAlgorithmName, "Missing Algorithm Name. \n");
|
sl@0
|
66 |
_LIT(KInvalidAlgorithmName, "Invalid Algorithm Name. \n");
|
sl@0
|
67 |
_LIT(KMissingDllName, "Missing Plugin Dll Name. \n");
|
sl@0
|
68 |
_LIT(KMissingOutputName, "Missing Output Name. \n");
|
sl@0
|
69 |
_LIT(KError, "Error=%d \n");
|
sl@0
|
70 |
|
sl@0
|
71 |
/**
|
sl@0
|
72 |
The method converts the given interface name to interface uid
|
sl@0
|
73 |
*/
|
sl@0
|
74 |
TInt ConvertToInterfaceId(const TDesC& aInterfaceName, TInt32& aInterfaceId)
|
sl@0
|
75 |
{
|
sl@0
|
76 |
if (aInterfaceName.CompareF(KHash)==0)
|
sl@0
|
77 |
{
|
sl@0
|
78 |
aInterfaceId=KHashInterface;
|
sl@0
|
79 |
return KErrNone;
|
sl@0
|
80 |
}
|
sl@0
|
81 |
|
sl@0
|
82 |
if (aInterfaceName.CompareF(KRandom)==0)
|
sl@0
|
83 |
{
|
sl@0
|
84 |
aInterfaceId=KRandomInterface;
|
sl@0
|
85 |
return KErrNone;
|
sl@0
|
86 |
}
|
sl@0
|
87 |
|
sl@0
|
88 |
if (aInterfaceName.CompareF(KSymmetricCipher)==0)
|
sl@0
|
89 |
{
|
sl@0
|
90 |
aInterfaceId=KSymmetricCipherInterface;
|
sl@0
|
91 |
return KErrNone;
|
sl@0
|
92 |
}
|
sl@0
|
93 |
|
sl@0
|
94 |
if (aInterfaceName.CompareF(KAsymmetricCipher)==0)
|
sl@0
|
95 |
{
|
sl@0
|
96 |
aInterfaceId=KAsymmetricCipherInterface;
|
sl@0
|
97 |
return KErrNone;
|
sl@0
|
98 |
}
|
sl@0
|
99 |
|
sl@0
|
100 |
if (aInterfaceName.CompareF(KSigner)==0)
|
sl@0
|
101 |
{
|
sl@0
|
102 |
aInterfaceId=KSignerInterface;
|
sl@0
|
103 |
return KErrNone;
|
sl@0
|
104 |
}
|
sl@0
|
105 |
|
sl@0
|
106 |
if (aInterfaceName.CompareF(KVerifier)==0)
|
sl@0
|
107 |
{
|
sl@0
|
108 |
aInterfaceId=KVerifierInterface;
|
sl@0
|
109 |
return KErrNone;
|
sl@0
|
110 |
}
|
sl@0
|
111 |
|
sl@0
|
112 |
if (aInterfaceName.CompareF(KKeyPairGenerator)==0)
|
sl@0
|
113 |
{
|
sl@0
|
114 |
aInterfaceId=KKeypairGeneratorInterface;
|
sl@0
|
115 |
return KErrNone;
|
sl@0
|
116 |
}
|
sl@0
|
117 |
|
sl@0
|
118 |
if (aInterfaceName.CompareF(KKeyAgreement)==0)
|
sl@0
|
119 |
{
|
sl@0
|
120 |
aInterfaceId=KKeyAgreementInterface;
|
sl@0
|
121 |
return KErrNone;
|
sl@0
|
122 |
}
|
sl@0
|
123 |
|
sl@0
|
124 |
if (aInterfaceName.CompareF(KAsyncHash)==0)
|
sl@0
|
125 |
{
|
sl@0
|
126 |
aInterfaceId=KAsyncHashInterface;
|
sl@0
|
127 |
return KErrNone;
|
sl@0
|
128 |
}
|
sl@0
|
129 |
|
sl@0
|
130 |
if (aInterfaceName.CompareF(KAsyncRandom)==0)
|
sl@0
|
131 |
{
|
sl@0
|
132 |
aInterfaceId=KAsyncRandomInterface;
|
sl@0
|
133 |
return KErrNone;
|
sl@0
|
134 |
}
|
sl@0
|
135 |
|
sl@0
|
136 |
if (aInterfaceName.CompareF(KAsyncSymmetricCipher)==0)
|
sl@0
|
137 |
{
|
sl@0
|
138 |
aInterfaceId=KAsyncSymmetricCipherInterface;
|
sl@0
|
139 |
return KErrNone;
|
sl@0
|
140 |
}
|
sl@0
|
141 |
|
sl@0
|
142 |
if (aInterfaceName.CompareF(KAsyncAsymmetricCipher)==0)
|
sl@0
|
143 |
{
|
sl@0
|
144 |
aInterfaceId=KAsyncAsymmetricCipherInterface;
|
sl@0
|
145 |
return KErrNone;
|
sl@0
|
146 |
}
|
sl@0
|
147 |
|
sl@0
|
148 |
if (aInterfaceName.CompareF(KAsyncSigner)==0)
|
sl@0
|
149 |
{
|
sl@0
|
150 |
aInterfaceId=KAsyncSignerInterface;
|
sl@0
|
151 |
return KErrNone;
|
sl@0
|
152 |
}
|
sl@0
|
153 |
|
sl@0
|
154 |
if (aInterfaceName.CompareF(KAsyncVerifier)==0)
|
sl@0
|
155 |
{
|
sl@0
|
156 |
aInterfaceId=KAsyncVerifierInterface;
|
sl@0
|
157 |
return KErrNone;
|
sl@0
|
158 |
}
|
sl@0
|
159 |
|
sl@0
|
160 |
if (aInterfaceName.CompareF(KAsyncKeyPairGenerator)==0)
|
sl@0
|
161 |
{
|
sl@0
|
162 |
aInterfaceId=KAsyncKeypairGeneratorInterface;
|
sl@0
|
163 |
return KErrNone;
|
sl@0
|
164 |
}
|
sl@0
|
165 |
|
sl@0
|
166 |
if (aInterfaceName.CompareF(KAsyncKeyAgreement)==0)
|
sl@0
|
167 |
{
|
sl@0
|
168 |
aInterfaceId=KAsyncKeyAgreementInterface;
|
sl@0
|
169 |
return KErrNone;
|
sl@0
|
170 |
}
|
sl@0
|
171 |
|
sl@0
|
172 |
return KErrNotFound;
|
sl@0
|
173 |
}
|
sl@0
|
174 |
|
sl@0
|
175 |
/**
|
sl@0
|
176 |
The method converts the given algorithm name to algorithm uid
|
sl@0
|
177 |
*/
|
sl@0
|
178 |
TInt ConvertToAlgorithmId(const TDesC& aAlgorithmName, TInt32& aAlgorithmId)
|
sl@0
|
179 |
{
|
sl@0
|
180 |
if (aAlgorithmName.CompareF(KMd2)==0)
|
sl@0
|
181 |
{
|
sl@0
|
182 |
aAlgorithmId=KAlgorithmHashMd2;
|
sl@0
|
183 |
return KErrNone;
|
sl@0
|
184 |
}
|
sl@0
|
185 |
|
sl@0
|
186 |
if (aAlgorithmName.CompareF(KMd5)==0)
|
sl@0
|
187 |
{
|
sl@0
|
188 |
aAlgorithmId=KAlgorithmHashMd5;
|
sl@0
|
189 |
return KErrNone;
|
sl@0
|
190 |
}
|
sl@0
|
191 |
|
sl@0
|
192 |
if (aAlgorithmName.CompareF(KMd4)==0)
|
sl@0
|
193 |
{
|
sl@0
|
194 |
aAlgorithmId=KAlgorithmHashMd4;
|
sl@0
|
195 |
return KErrNone;
|
sl@0
|
196 |
}
|
sl@0
|
197 |
|
sl@0
|
198 |
if (aAlgorithmName.CompareF(KSha1)==0)
|
sl@0
|
199 |
{
|
sl@0
|
200 |
aAlgorithmId=KAlgorithmHashSha1;
|
sl@0
|
201 |
return KErrNone;
|
sl@0
|
202 |
}
|
sl@0
|
203 |
|
sl@0
|
204 |
if (aAlgorithmName.CompareF(KDes)==0)
|
sl@0
|
205 |
{
|
sl@0
|
206 |
aAlgorithmId=KAlgorithmCipherDes;
|
sl@0
|
207 |
return KErrNone;
|
sl@0
|
208 |
}
|
sl@0
|
209 |
|
sl@0
|
210 |
if (aAlgorithmName.CompareF(K3Des)==0)
|
sl@0
|
211 |
{
|
sl@0
|
212 |
aAlgorithmId=KAlgorithmCipher3Des;
|
sl@0
|
213 |
return KErrNone;
|
sl@0
|
214 |
}
|
sl@0
|
215 |
|
sl@0
|
216 |
if (aAlgorithmName.CompareF(KRC2)==0)
|
sl@0
|
217 |
{
|
sl@0
|
218 |
aAlgorithmId=KAlgorithmCipherRc2;
|
sl@0
|
219 |
return KErrNone;
|
sl@0
|
220 |
}
|
sl@0
|
221 |
|
sl@0
|
222 |
if (aAlgorithmName.CompareF(KAes)==0)
|
sl@0
|
223 |
{
|
sl@0
|
224 |
aAlgorithmId=KAlgorithmCipherAes;
|
sl@0
|
225 |
return KErrNone;
|
sl@0
|
226 |
}
|
sl@0
|
227 |
|
sl@0
|
228 |
if (aAlgorithmName.CompareF(KRC4)==0)
|
sl@0
|
229 |
{
|
sl@0
|
230 |
aAlgorithmId=KAlgorithmCipherArc4;
|
sl@0
|
231 |
return KErrNone;
|
sl@0
|
232 |
}
|
sl@0
|
233 |
|
sl@0
|
234 |
if (aAlgorithmName.CompareF(KRsaCipher)==0)
|
sl@0
|
235 |
{
|
sl@0
|
236 |
aAlgorithmId=KAlgorithmCipherRsa;
|
sl@0
|
237 |
return KErrNone;
|
sl@0
|
238 |
}
|
sl@0
|
239 |
|
sl@0
|
240 |
if (aAlgorithmName.CompareF(KRsaSigner)==0)
|
sl@0
|
241 |
{
|
sl@0
|
242 |
aAlgorithmId=KAlgorithmSignerRsa;
|
sl@0
|
243 |
return KErrNone;
|
sl@0
|
244 |
}
|
sl@0
|
245 |
|
sl@0
|
246 |
if (aAlgorithmName.CompareF(KRsaVerifier)==0)
|
sl@0
|
247 |
{
|
sl@0
|
248 |
aAlgorithmId=KAlgorithmVerifierRsa;
|
sl@0
|
249 |
return KErrNone;
|
sl@0
|
250 |
}
|
sl@0
|
251 |
|
sl@0
|
252 |
if (aAlgorithmName.CompareF(KRsaKeyPair)==0)
|
sl@0
|
253 |
{
|
sl@0
|
254 |
aAlgorithmId=KAlgorithmRSAKeyPairGenerator;
|
sl@0
|
255 |
return KErrNone;
|
sl@0
|
256 |
}
|
sl@0
|
257 |
|
sl@0
|
258 |
if (aAlgorithmName.CompareF(KDsaSigner)==0)
|
sl@0
|
259 |
{
|
sl@0
|
260 |
aAlgorithmId=KAlgorithmSignerDsa;
|
sl@0
|
261 |
return KErrNone;
|
sl@0
|
262 |
}
|
sl@0
|
263 |
|
sl@0
|
264 |
if (aAlgorithmName.CompareF(KDsaVerifier)==0)
|
sl@0
|
265 |
{
|
sl@0
|
266 |
aAlgorithmId=KAlgorithmVerifierDsa;
|
sl@0
|
267 |
return KErrNone;
|
sl@0
|
268 |
}
|
sl@0
|
269 |
|
sl@0
|
270 |
if (aAlgorithmName.CompareF(KDsaKeyPair)==0)
|
sl@0
|
271 |
{
|
sl@0
|
272 |
aAlgorithmId=KAlgorithmDSAKeyPairGenerator;
|
sl@0
|
273 |
return KErrNone;
|
sl@0
|
274 |
}
|
sl@0
|
275 |
|
sl@0
|
276 |
if (aAlgorithmName.CompareF(KDhKeyPair)==0)
|
sl@0
|
277 |
{
|
sl@0
|
278 |
aAlgorithmId=KAlgorithmDHKeyPairGenerator;
|
sl@0
|
279 |
return KErrNone;
|
sl@0
|
280 |
}
|
sl@0
|
281 |
|
sl@0
|
282 |
if (aAlgorithmName.CompareF(KDhKeyAgreement)==0)
|
sl@0
|
283 |
{
|
sl@0
|
284 |
aAlgorithmId=KAlgorithmKeyAgreementDH;
|
sl@0
|
285 |
return KErrNone;
|
sl@0
|
286 |
}
|
sl@0
|
287 |
|
sl@0
|
288 |
return KErrNotFound;
|
sl@0
|
289 |
}
|
sl@0
|
290 |
|
sl@0
|
291 |
|
sl@0
|
292 |
/**
|
sl@0
|
293 |
Displays tool name and copy-right informations.
|
sl@0
|
294 |
*/
|
sl@0
|
295 |
void BoilerPlate(CConsoleBase* console)
|
sl@0
|
296 |
{
|
sl@0
|
297 |
console->Printf(KNewLine);
|
sl@0
|
298 |
console->Printf(KName);
|
sl@0
|
299 |
console->Printf(KNewLine);
|
sl@0
|
300 |
console->Printf(KCopyright);
|
sl@0
|
301 |
console->Printf(KNewLine);
|
sl@0
|
302 |
console->Printf(KNewLine);
|
sl@0
|
303 |
}
|
sl@0
|
304 |
|
sl@0
|
305 |
/**
|
sl@0
|
306 |
The method retrieves the command line parameters and build the CDumpToolParameters object.
|
sl@0
|
307 |
*/
|
sl@0
|
308 |
|
sl@0
|
309 |
void ExtractOptionL(const CCommandLineArguments& aInput, CDumpToolParameters& aParam, CConsoleBase* aConsole)
|
sl@0
|
310 |
{
|
sl@0
|
311 |
TInt count=aInput.Count();
|
sl@0
|
312 |
TInt i=0;
|
sl@0
|
313 |
while (i<count-1)
|
sl@0
|
314 |
{
|
sl@0
|
315 |
i++;
|
sl@0
|
316 |
|
sl@0
|
317 |
//Handle -a and -all
|
sl@0
|
318 |
if ((aInput.Arg(i).Compare(KAll)==0)||(aInput.Arg(i).Compare(KAllShort)==0))
|
sl@0
|
319 |
{
|
sl@0
|
320 |
continue;
|
sl@0
|
321 |
}
|
sl@0
|
322 |
|
sl@0
|
323 |
//Handle -i and -interface
|
sl@0
|
324 |
if ((aInput.Arg(i).Compare(KInterface)==0)||(aInput.Arg(i).Compare(KInterfaceShort)==0))
|
sl@0
|
325 |
{
|
sl@0
|
326 |
//Move to interface name
|
sl@0
|
327 |
i++;
|
sl@0
|
328 |
if (i>count-1)
|
sl@0
|
329 |
{
|
sl@0
|
330 |
aConsole->Printf(KMissingInterfaceName);
|
sl@0
|
331 |
User::Leave(KErrArgument);
|
sl@0
|
332 |
}
|
sl@0
|
333 |
|
sl@0
|
334 |
//Currently point to interface name
|
sl@0
|
335 |
if (KErrNone!=ConvertToInterfaceId(aInput.Arg(i), aParam.iInterface))
|
sl@0
|
336 |
{
|
sl@0
|
337 |
//Invalid interface name
|
sl@0
|
338 |
aConsole->Printf(KInvalidInterfaceName);
|
sl@0
|
339 |
User::Leave(KErrArgument);
|
sl@0
|
340 |
}
|
sl@0
|
341 |
continue;
|
sl@0
|
342 |
}
|
sl@0
|
343 |
|
sl@0
|
344 |
//Handle -al and -algorithm
|
sl@0
|
345 |
if ((aInput.Arg(i).Compare(KAlgorithm)==0)||(aInput.Arg(i).Compare(KAlgorithmShort)==0))
|
sl@0
|
346 |
{
|
sl@0
|
347 |
//Move to algorithm name
|
sl@0
|
348 |
i++;
|
sl@0
|
349 |
if (i>count-1)
|
sl@0
|
350 |
{
|
sl@0
|
351 |
aConsole->Printf(KMissingAlgorithmName);
|
sl@0
|
352 |
User::Leave(KErrArgument);
|
sl@0
|
353 |
}
|
sl@0
|
354 |
|
sl@0
|
355 |
//Currently point to algorithm name
|
sl@0
|
356 |
if (KErrNone!=ConvertToAlgorithmId(aInput.Arg(i), aParam.iAlgorithm))
|
sl@0
|
357 |
{
|
sl@0
|
358 |
//Invalid algorithm name
|
sl@0
|
359 |
aConsole->Printf(KInvalidAlgorithmName);
|
sl@0
|
360 |
User::Leave(KErrArgument);
|
sl@0
|
361 |
}
|
sl@0
|
362 |
continue;
|
sl@0
|
363 |
}
|
sl@0
|
364 |
|
sl@0
|
365 |
//Handle -e and -extended
|
sl@0
|
366 |
if ((aInput.Arg(i).Compare(KExtended)==0)||(aInput.Arg(i).Compare(KExtendedShort)==0))
|
sl@0
|
367 |
{
|
sl@0
|
368 |
aParam.iOptions.AppendL(CDumpToolParameters::EOptionExtendedCharacteristic);
|
sl@0
|
369 |
continue;
|
sl@0
|
370 |
}
|
sl@0
|
371 |
|
sl@0
|
372 |
//Handle -d and -dll
|
sl@0
|
373 |
if ((aInput.Arg(i).Compare(KDll)==0)||(aInput.Arg(i).Compare(KDllShort)==0))
|
sl@0
|
374 |
{
|
sl@0
|
375 |
i++;
|
sl@0
|
376 |
if (i>count-1)
|
sl@0
|
377 |
{
|
sl@0
|
378 |
aConsole->Printf(KMissingDllName);
|
sl@0
|
379 |
User::Leave(KErrArgument);
|
sl@0
|
380 |
}
|
sl@0
|
381 |
aParam.iDllName=aInput.Arg(i);
|
sl@0
|
382 |
continue;
|
sl@0
|
383 |
}
|
sl@0
|
384 |
|
sl@0
|
385 |
//Handle -o and -out
|
sl@0
|
386 |
if ((aInput.Arg(i).Compare(KOutputFile)==0)||(aInput.Arg(i).Compare(KOutputFileShort)==0))
|
sl@0
|
387 |
{
|
sl@0
|
388 |
i++;
|
sl@0
|
389 |
if (i>count-1)
|
sl@0
|
390 |
{
|
sl@0
|
391 |
aConsole->Printf(KMissingOutputName);
|
sl@0
|
392 |
User::Leave(KErrArgument);
|
sl@0
|
393 |
}
|
sl@0
|
394 |
aParam.iDumpFileName=aInput.Arg(i);
|
sl@0
|
395 |
continue;
|
sl@0
|
396 |
}
|
sl@0
|
397 |
|
sl@0
|
398 |
//Handle -h and -help
|
sl@0
|
399 |
if ((aInput.Arg(i).Compare(KHelp)==0)||(aInput.Arg(i).Compare(KHelpShort)==0))
|
sl@0
|
400 |
{
|
sl@0
|
401 |
aParam.iOptions.AppendL(CDumpToolParameters::EOptionHelp);
|
sl@0
|
402 |
continue;
|
sl@0
|
403 |
}
|
sl@0
|
404 |
|
sl@0
|
405 |
HBufC* temp=aInput.Arg(i).AllocLC();
|
sl@0
|
406 |
aParam.iInvalidOptions.AppendL(temp);
|
sl@0
|
407 |
CleanupStack::Pop(temp);
|
sl@0
|
408 |
}
|
sl@0
|
409 |
}
|
sl@0
|
410 |
|
sl@0
|
411 |
|
sl@0
|
412 |
void DoProcessL(CConsoleBase* aConsole)
|
sl@0
|
413 |
{
|
sl@0
|
414 |
//Get the command line arguments
|
sl@0
|
415 |
CCommandLineArguments* args = CCommandLineArguments::NewLC();
|
sl@0
|
416 |
|
sl@0
|
417 |
//Construct the parameters holder
|
sl@0
|
418 |
CDumpToolParameters* params = CDumpToolParameters::NewLC();
|
sl@0
|
419 |
|
sl@0
|
420 |
//Retrieve the command line options
|
sl@0
|
421 |
ExtractOptionL(*args, *params, aConsole);
|
sl@0
|
422 |
|
sl@0
|
423 |
//Process the command line and output the characteristics.
|
sl@0
|
424 |
CDumpToolProcessor* processor=CDumpToolProcessor::NewLC(*params, aConsole);
|
sl@0
|
425 |
processor->ProcessL();
|
sl@0
|
426 |
aConsole->Printf(KNewLine);
|
sl@0
|
427 |
CleanupStack::PopAndDestroy(processor);
|
sl@0
|
428 |
CleanupStack::PopAndDestroy(2, args); // params, args,
|
sl@0
|
429 |
}
|
sl@0
|
430 |
|
sl@0
|
431 |
/**
|
sl@0
|
432 |
Main function to retrieve and log the characteristics
|
sl@0
|
433 |
*/
|
sl@0
|
434 |
void DoMainL()
|
sl@0
|
435 |
{
|
sl@0
|
436 |
//New a console and print tool information
|
sl@0
|
437 |
CConsoleBase* console = Console::NewL(KShortName, TSize(KDefaultConsWidth, KDefaultConsHeight));
|
sl@0
|
438 |
CleanupStack::PushL(console);
|
sl@0
|
439 |
BoilerPlate(console);
|
sl@0
|
440 |
TRAPD(err, DoProcessL(console));
|
sl@0
|
441 |
if (err!=KErrArgument && err!=KErrNone)
|
sl@0
|
442 |
{
|
sl@0
|
443 |
console->Printf(KError, err);
|
sl@0
|
444 |
}
|
sl@0
|
445 |
if (err!=KErrNone)
|
sl@0
|
446 |
{
|
sl@0
|
447 |
console->Printf(KPressAnyKey);
|
sl@0
|
448 |
console->Getch();
|
sl@0
|
449 |
}
|
sl@0
|
450 |
console->Printf(KDone);
|
sl@0
|
451 |
//console->Getch();
|
sl@0
|
452 |
CleanupStack::PopAndDestroy(console); // params, args, console
|
sl@0
|
453 |
}
|
sl@0
|
454 |
|
sl@0
|
455 |
/**
|
sl@0
|
456 |
@return KErrNone (0) if successful, KErrMemory if out of memory
|
sl@0
|
457 |
otherwise error result from DoMainL
|
sl@0
|
458 |
*/
|
sl@0
|
459 |
TInt E32Main()
|
sl@0
|
460 |
{
|
sl@0
|
461 |
__UHEAP_MARK;
|
sl@0
|
462 |
CTrapCleanup* trapCleanup=CTrapCleanup::New();
|
sl@0
|
463 |
if (!trapCleanup)
|
sl@0
|
464 |
{
|
sl@0
|
465 |
return KErrNoMemory;
|
sl@0
|
466 |
}
|
sl@0
|
467 |
|
sl@0
|
468 |
TRAPD(err, DoMainL());
|
sl@0
|
469 |
delete trapCleanup;
|
sl@0
|
470 |
__UHEAP_MARKEND;
|
sl@0
|
471 |
return err;
|
sl@0
|
472 |
}
|
sl@0
|
473 |
|
sl@0
|
474 |
|
sl@0
|
475 |
|
sl@0
|
476 |
|
sl@0
|
477 |
|