|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, either version 3 of the License, or |
|
8 * (at your option) any later version. |
|
9 * |
|
10 * This program is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 * GNU Lesser General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU Lesser General Public License |
|
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 */ |
|
18 |
|
19 #ifndef E32ROMIMAGE_H_ |
|
20 #define E32ROMIMAGE_H_ |
|
21 |
|
22 #include <cassert> |
|
23 |
|
24 #include "defs.h" |
|
25 #include "filefragment.h" |
|
26 #include "inputfile.h" |
|
27 |
|
28 class E32RomImage : public FileFragmentOwner { |
|
29 public: |
|
30 typedef struct // this is the structure of an EPOC rom header |
|
31 { |
|
32 char name[16]; |
|
33 unsigned char versionStr[4]; |
|
34 unsigned char buildNumStr[4]; |
|
35 unsigned long romSize; |
|
36 unsigned long wrapSize; |
|
37 } E32RomHeader; |
|
38 public: |
|
39 |
|
40 E32RomImage(PathName aPath): |
|
41 iRomFile(aPath), iData(NULL) |
|
42 {}; |
|
43 |
|
44 void SetupRomData(); |
|
45 |
|
46 // The FileFragmentOwner protocol |
|
47 virtual void GetFileFragmentData(FileFragmentData & aFileFragmentData ); |
|
48 virtual size_t Size() { |
|
49 assert(iRomFile.Size() - iRomFile.GetOffset()); |
|
50 return iRomFile.Size() - iRomFile.GetOffset(); |
|
51 }; |
|
52 virtual void DeleteFileFragmentData(); |
|
53 |
|
54 private: |
|
55 |
|
56 void Open(); |
|
57 void Close(); |
|
58 void SetSize(); |
|
59 |
|
60 private: |
|
61 InputFile iRomFile; |
|
62 char * iData; |
|
63 E32RomHeader iE32RomHeader; |
|
64 |
|
65 |
|
66 }; |
|
67 |
|
68 #endif /*E32ROMIMAGE_H_*/ |