@@ -32,10 +32,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
3232/// only. Members are not guaranteed to be sane.
3333///
3434typedef struct {
35- MACH_HEADER_ANY * MachHeader ;
35+ VOID * FileData ;
3636 UINT32 FileSize ;
3737
38- UINT32 ContainerOffset ;
38+ MACH_HEADER_ANY * MachHeader ;
39+ UINT32 InnerSize ;
3940 MACH_SYMTAB_COMMAND * Symtab ;
4041 MACH_NLIST_ANY * SymbolTable ;
4142 CHAR8 * StringTable ;
@@ -50,11 +51,12 @@ typedef struct {
5051/**
5152 Initializes a 32-bit Mach-O Context.
5253
53- @param[out] Context Mach-O Context to initialize.
54- @param[in] FileData Pointer to the file's expected Mach-O header.
55- @param[in] FileSize File size of FileData.
56- @param[in] ContainerOffset The amount of Bytes the Mach-O header is offset
57- from the base (container, e.g. KC) of the file.
54+ @param[out] Context Mach-O Context to initialize.
55+ @param[in] FileData Pointer to the file's expected Mach-O header.
56+ @param[in] FileSize File size of FileData.
57+ @param[in] HeaderOffset The amount of Bytes the Mach-O header is offset from
58+ the base (container, e.g. KC) of the file.
59+ @param[in] InnerSize The size, in Bytes, of the inner Mach-O file.
5860
5961 @return Whether Context has been initialized successfully.
6062
@@ -64,17 +66,19 @@ MachoInitializeContext32 (
6466 OUT OC_MACHO_CONTEXT * Context ,
6567 IN VOID * FileData ,
6668 IN UINT32 FileSize ,
67- IN UINT32 ContainerOffset
69+ IN UINT32 HeaderOffset ,
70+ IN UINT32 InnerSize
6871 );
6972
7073/**
7174 Initializes a 64-bit Mach-O Context.
7275
73- @param[out] Context Mach-O Context to initialize.
74- @param[in] FileData Pointer to the file's expected Mach-O header.
75- @param[in] FileSize File size of FileData.
76- @param[in] ContainerOffset The amount of Bytes the Mach-O header is offset
77- from the base (container, e.g. KC) of the file.
76+ @param[out] Context Mach-O Context to initialize.
77+ @param[in] FileData Pointer to the file's expected Mach-O header.
78+ @param[in] FileSize File size of FileData.
79+ @param[in] HeaderOffset The amount of Bytes the Mach-O header is offset from
80+ the base (container, e.g. KC) of the file.
81+ @param[in] InnerSize The size, in Bytes, of the inner Mach-O file.
7882
7983 @return Whether Context has been initialized successfully.
8084
@@ -84,18 +88,20 @@ MachoInitializeContext64 (
8488 OUT OC_MACHO_CONTEXT * Context ,
8589 IN VOID * FileData ,
8690 IN UINT32 FileSize ,
87- IN UINT32 ContainerOffset
91+ IN UINT32 HeaderOffset ,
92+ IN UINT32 InnerSize
8893 );
8994
9095/**
9196 Initializes a Mach-O Context.
9297
93- @param[out] Context Mach-O Context to initialize.
94- @param[in] FileData Pointer to the file's expected Mach-O header.
95- @param[in] FileSize File size of FileData.
96- @param[in] ContainerOffset The amount of Bytes the Mach-O header is offset
97- from the base (container, e.g. KC) of the file.
98- @param[in] Is32Bit TRUE if Mach-O is 32-bit.
98+ @param[out] Context Mach-O Context to initialize.
99+ @param[in] FileData Pointer to the file's expected Mach-O header.
100+ @param[in] FileSize File size of FileData.
101+ @param[in] HeaderOffset The amount of Bytes the Mach-O header is offset from
102+ the base (container, e.g. KC) of the file.
103+ @param[in] InnerSize The size, in Bytes, of the inner Mach-O file.
104+ @param[in] Is32Bit TRUE if Mach-O is 32-bit.
99105
100106 @return Whether Context has been initialized successfully.
101107
@@ -105,7 +111,8 @@ MachoInitializeContext (
105111 OUT OC_MACHO_CONTEXT * Context ,
106112 IN VOID * FileData ,
107113 IN UINT32 FileSize ,
108- IN UINT32 ContainerOffset ,
114+ IN UINT32 HeaderOffset ,
115+ IN UINT32 InnerSize ,
109116 IN BOOLEAN Is32Bit
110117 );
111118
@@ -120,6 +127,17 @@ MachoGetMachHeader (
120127 IN OUT OC_MACHO_CONTEXT * Context
121128 );
122129
130+ /**
131+ Returns the size of the inner Mach-O file (otherwise, the file size).
132+
133+ @param[in,out] Context Context of the Mach-O.
134+
135+ **/
136+ UINT32
137+ MachoGetInnerSize (
138+ IN OUT OC_MACHO_CONTEXT * Context
139+ );
140+
123141/**
124142 Returns the 32-bit Mach-O Header structure.
125143
@@ -142,6 +160,17 @@ MachoGetMachHeader64 (
142160 IN OUT OC_MACHO_CONTEXT * Context
143161 );
144162
163+ /**
164+ Returns the file data of the Mach-O.
165+
166+ @param[in,out] Context Context of the Mach-O.
167+
168+ **/
169+ VOID *
170+ MachoGetFileData (
171+ IN OUT OC_MACHO_CONTEXT * Context
172+ );
173+
145174/**
146175 Returns the Mach-O's file size.
147176
0 commit comments