CRO0: Difference between revisions

Wwylele (talk | contribs)
No edit summary
DeltaF1 (talk | contribs)
Add headers to all the structs
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:File formats]]
[[Category:File formats]]
CRO with extension .cro is used for "DLLs". CRS with extension .crs is in the same format of CRO but storing the symbol information of the static module (the main application). The end of the file is aligned to a 0x1000-byte boundary with 0xCC bytes.
The first hash-table entry hashes the 0x100-byte header following the hash-table. The following hash-table entries hash the sections specified in the header.
When the RO module loads the entire CRO into process memory(mapped in the 0x00100000-0x04000000 region), it modifies the mapped CRO data. The magic field is also changed to "FIXD" if fix level is not 0.
Upon loading, the RO module will look for export symbol "nnroAeabiAtexit_" to patch it to its import symbol "__aeabi_atexit".
For dumping symbols and loading a CRO into IDA, see [https://github.com/plutooo/ctr/] and [https://github.com/wwylele/IDA_plugin_CRO].


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 31: Line 41:
|-
|-
| 0x94
| 0x94
| 0x10
| 0x04
| "Segment offset" that is always the same as export symbol "nnroControlObject_". 0xFFFFFFFF in CRS
| .bss size
|-
| 0x98
| 0x04
| Unknown
|-
| 0x9C
| 0x04
| Unknown
|-
| 0xA0
| 0x04
| [[#Segment offset (4 bytes)|Segment offset]] that is always the same as export symbol "nnroControlObject_". 0xFFFFFFFF in CRS
|-
|-
| 0xA4
| 0xA4
| 0x04
| 0x04
| "Segment offset" for "OnLoad" function, which will be called when the module is initialized. Set to 0xFFFFFFFF if not exists.
| [[#Segment offset (4 bytes)|Segment offset]] for "OnLoad" function, which will be called when the module is initialized. Set to 0xFFFFFFFF if not exists.
|-
|-
| 0xA8
| 0xA8
| 0x04
| 0x04
| "Segment offset" for "OnExit" function, which will be called when the module is finalized. Set to 0xFFFFFFFF if not exists.
| [[#Segment offset (4 bytes)|Segment offset]] for "OnExit" function, which will be called when the module is finalized. Set to 0xFFFFFFFF if not exists.
|-
|-
| 0xAC
| 0xAC
| 0x04
| 0x04
| "Segment offset" for "OnUnresolved" function, which will be called when an unresolved function is called. Set to 0xFFFFFFFF if not exists.
| [[#Segment offset (4 bytes)|Segment offset]] for "OnUnresolved" function, which will be called when an unresolved function is called. Set to 0xFFFFFFFF if not exists.
|-
|-
| 0xB0
| 0xB0
Line 56: Line 78:
| 0xB8
| 0xB8
| 0x04
| 0x04
| unk1 offset
| .data offset
|-
|-
| 0xBC
| 0xBC
| 0x04
| 0x04
| unk1 size
| .data size
|-
|-
| 0xC0
| 0xC0
Line 183: Line 205:
|}
|}


Segment offset (4 bytes)
==Segment offset (4 bytes)==


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 196: Line 218:
|}
|}


Segment Table entry (12 bytes)
==Segment Table entry (12 bytes)==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
!  Offset
!  Offset
Line 215: Line 237:
|}
|}


Named Export Table entry (8 bytes)
==Named Export Table entry (8 bytes)==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
!  Offset
!  Offset
Line 227: Line 249:
| 0x4
| 0x4
| 0x4
| 0x4
| "Segment offset" for export
| [[#Segment offset (4 bytes)|Segment offset]] for export
|}
|}


Indexed Export Table entry (4 bytes)
==Indexed Export Table entry (4 bytes)==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
!  Offset
!  Offset
Line 238: Line 260:
| 0x0
| 0x0
| 0x4
| 0x4
| "Segment offset" for export
| [[#Segment offset (4 bytes)|Segment offset]] for export
|}
|}


Named Import Table entry (8 bytes)
==Named Import Table entry (8 bytes)==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
!  Offset
!  Offset
Line 256: Line 278:
|}
|}


Indexed Import Table entry (8 bytes)
==Indexed Import Table entry (8 bytes)==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
!  Offset
!  Offset
Line 271: Line 293:
|}
|}


Anonymous Import Table entry (8 bytes)
==Anonymous Import Table entry (8 bytes)==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
!  Offset
!  Offset
Line 279: Line 301:
| 0x0
| 0x0
| 0x4
| 0x4
| "Segment offset" of the export symbol
| [[#Segment offset (4 bytes)|Segment offset]] of the export symbol
|-
|-
| 0x4
| 0x4
Line 286: Line 308:
|}
|}


Import Module Table entry (20 bytes)
==Import Module Table entry (20 bytes)==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
!  Offset
!  Offset
Line 313: Line 335:
|}
|}


Patch entry (12 bytes)
==Patch entry (12 bytes)==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
!  Offset
!  Offset
Line 321: Line 343:
| 0x0
| 0x0
| 0x4
| 0x4
| "Segment offset" for output.
| [[#Segment offset (4 bytes)|Segment offset]] for output.
|-
|-
| 0x4
| 0x4
Line 350: Line 372:


----
----
CRO with extension .cro is used for "DLLs". CRS with extension .crs is in the same format of CRO but storing the symbol information of the static module (the main application). The end of the file is aligned to a 0x1000-byte boundary with 0xCC bytes.
The first hash-table entry hashes the 0x100-byte header following the hash-table. The following hash-table entries hash the sections specified in the header.
When the RO module loads the entire CRO into process memory(mapped in the 0x00100000-0x04000000 region), it modifies the mapped CRO data. The magic field is also changed to "FIXD" if fix level is not 0.
Upon loading, the RO module will look for export symbol "nnroAeabiAtexit_" to patch it to its import symbol "__aeabi_atexit".
For dumping symbols and loading a CRO into IDA, see [https://github.com/plutooo/ctr/] and [https://github.com/wwylele/IDA_plugin_CRO].