|
1 /* |
|
2 * Copyright (c) 2008-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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __R_COREIMAGEREADER_H__ |
|
20 #define __R_COREIMAGEREADER_H__ |
|
21 |
|
22 class TRomNode; |
|
23 class TRomLoaderHeader; |
|
24 class Memmap; |
|
25 |
|
26 /** |
|
27 class CoreRomImageReader |
|
28 |
|
29 @internalComponent |
|
30 @released |
|
31 */ |
|
32 class CoreRomImageReader |
|
33 { |
|
34 private: |
|
35 |
|
36 String iImgFileName; |
|
37 |
|
38 TUint8* iData; |
|
39 |
|
40 // Core ROM Image Headers |
|
41 TRomLoaderHeader *iLoaderHdr; |
|
42 TRomHeader *iRomHdr; |
|
43 TRomRootDirectoryList *iRootDirList; |
|
44 |
|
45 // Directory Structure |
|
46 TRomNode* iRootDirectory; |
|
47 |
|
48 TBool IsCoreROM(); |
|
49 TBool StoreImageHeader(); |
|
50 TInt GetDirectoryStructures(); |
|
51 TInt BuildDir(TRomDir* aDir, TRomNode* aPaFSEntry); |
|
52 TInt BuildDir(TInt16 *aOffsetTbl, TInt16 aOffsetTblCount, TRomDir *aPaRomDir, TRomNode* aPaFSEntry); |
|
53 TInt CreateRootDirectory(); |
|
54 TInt AddFile(TRomNode *aPa, char *entryName, TRomEntry* aRomEntry); |
|
55 void Name(String& aName, char * aUnicodeName, int aLen); |
|
56 TBool IsExecutable(TUint8* Uids1); |
|
57 TUint GetHdrSize(); |
|
58 |
|
59 TBool iUseMemMap; |
|
60 Memmap* iImageMap; |
|
61 |
|
62 TBool AllocateImageMap(Memmap*& aImageMap, TUint8*& aData, TUint aLen); |
|
63 public: |
|
64 |
|
65 CoreRomImageReader(String aFileName, TBool aUseMemMap = EFalse); |
|
66 ~CoreRomImageReader(); |
|
67 |
|
68 TBool OpenImage(); |
|
69 TBool ProcessImage(); |
|
70 |
|
71 TRomNode* GetRootDirectory() |
|
72 { |
|
73 return iRootDirectory; |
|
74 } |
|
75 |
|
76 TRomHeader* GetCoreRomHeader() |
|
77 { |
|
78 return iRomHdr; |
|
79 } |
|
80 TRomRootDirectoryList* GetRootDirList() |
|
81 { |
|
82 return iRootDirList; |
|
83 } |
|
84 |
|
85 void DeleteAll(TRomNode *node); |
|
86 void Display(TRomNode *node, TInt pad = 1); |
|
87 friend TInt OffsetCompare(const void *left, const void *right); |
|
88 }; |
|
89 |
|
90 #endif //__R_COREIMAGEREADER_H__ |