E32Image file format on Symbian OS 9
The executable files on Symbian OS v9, i.e., .exe or .dll, use a special format, called E32Image. It is based on ELF file format. It is different on pre-Symbian OS v9. The E32Image on pre-Symbian OS v9 is based on PE file format.
Like standard ELF executable file, E32Image contains of several sections, i.e.:
- Code section. It contains three parts: text section, export address table and import address table.
- BSS section. It contains un-initialized data.
- Data section. It contains initialized data.
- Import section. It contains the information about all imported functions used by the code.
- Relocation section. It contains relocation table needed by Symbian OS loader to load the code.
The header information of E32Image is defined in a header file called f32image.h. It is part of the public Symbian SDKs located at \epoc32\include. The declaration of the header is splitted into three parts.
The first part, E32ImageHeader, is the main part. It is quite similar to the header on pre-Symbian OS 9.
The second part, E32ImageHeaderComp is needed when the executable file is compressed.
class E32ImageHeaderComp : public E32ImageHeader
The third part, E32ImageHeaderV contains some extra information.
class E32ImageHeaderV : public E32ImageHeaderComp
- iUid1, iUid2, iUid3, are the first, second and third UIDs of the executable file respectively.
- iUidChecksum, is the checksum of the first three UIDs.
- iSignature, is a unique signature of E32 file, always has a value of 'EPOC'.
- iHeaderCrc, is the checksum of entire header, calculated with CCITT CRC-32 algorithm.
- iModuleVersion, is the version number for this executable.
- iCompressionType, is the UID of the library used to compress the executable file. It is 0 if the executable is not compressed or KUidCompressionDeflate (=0x101F 7AFC) if it is compressed with Deflate algorithm.
- iToolsVersion, is the version of ELFTRAN that generates this file.
- iTimeLo, iTimeHi, is the lowest and highest word of the timestamp when the file is created respectively.
- iFlags, flags for this executable. There are some flags defined in f32image.h, for example, KImageDll, KImageNoCallEntryPoint, etc.
- iCodeSize, is the size of code section, import address table, constant data and export dir.
- iDataSize, is size of initialized data.
- iHeapSizeMin, is the minimum size of the heap.
- iHeapSizeMax, is the maximum size of the heap.
- iStackSize, is the size of the stack.
- iBssSize, is the size of the un-initialized data section.
- iEntryPoint, is the offset into code of entry point.
- iCodeBase, where the code is linked for.
- iDataBase, where the data is linked for.
- iDllRefTableCount, is the number of DLLs imported by this program.
- iExportDirOffset, is the offset into the file of the export address table.
- iExportDirCount, is the offset of the export address table.
- iTextSize, is size of just the text section.
- iCodeOffset, is the file offset to code section.
- iDataOffset, is the file offset to data section.
- iImportOffset, is the file offset to import section.
- iCodeRelocOffset, is the relocations for code and constants.
- iDataRelocOffset, is the relocations for data.
- iProcessPriority, is the executables priority.
- iCpuIdentifier, is the identifier of CPU.
- iUncompressedSize, the uncompressed size of file. Remember that E32Image file might be compressed.
- iS.iSecureId, is secure ID of the executable. It is usually the same as the UID3 of the executable.
- iS.iVendorId, is vendor ID of executable. For third party application, it is usually 0.
- iS.iCaps.iCaps, is capabilities needed to run the executable. The definition of all Symbian OS capabilities can be found at e32capability.h.
- iExceptionDescriptor, is the offset in bytes from start of code section to Exception Descriptor, bit 0 set if valid
- iSpare2, reserved.
- iExportDescSize, is the size of bitmap section.
- iExportDescType, is type of description of holes in export table.
- iExportDesc, is the description of holes in export table.