Rizin
unix-like reverse engineering framework and cli tools
dotnet.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2022. The YARA Authors. All Rights Reserved.
2 // SPDX-FileCopyrightText: 2022 wingdeans <wingdeans@protonmail.com>
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #include <rz_types.h>
6 #include <rz_vector.h>
7 
8 #ifndef _INCLUDE_RZ_BIN_DOTNET_H_
9 #define _INCLUDE_RZ_BIN_DOTNET_H_
10 
11 typedef struct {
32 
33 typedef struct {
43 
44 typedef struct {
47  char *Name;
49 
50 // Used to store the number of rows of each table.
51 typedef struct {
97 
98 typedef struct {
107 
108 typedef struct {
124 
125 typedef struct {
133 
134 typedef struct {
137  ut32 namespace;
142 
143 typedef struct {
149 
150 typedef struct {
153  RzList /* Pe_image_metadata_stream */ *streams;
154 
155  // special streams
159 
160  // header data
163  RzPVector /* Pe_image_metadata_methoddef */ *methoddefs;
164  RzList /* Pe_image_metadata_typedef */ *typedefs;
165 } Pe_image_clr;
166 
167 int bin_pe_dotnet_init_metadata(Pe_image_clr *clr, bool big_endian, RzBuffer *b, ut64 metadata_directory);
168 int bin_pe_dotnet_init_clr(Pe_image_clr *clr, RzBuffer *b, ut64 image_clr_hdr_paddr);
171 
172 // These are the bit positions in Valid which will be set if the table
173 // exists.
174 #define BIT_MODULE 0x00
175 #define BIT_TYPEREF 0x01
176 #define BIT_TYPEDEF 0x02
177 #define BIT_FIELDPTR 0x03 // Not documented in ECMA-335
178 #define BIT_FIELD 0x04
179 #define BIT_METHODDEFPTR 0x05 // Not documented in ECMA-335
180 #define BIT_METHODDEF 0x06
181 #define BIT_PARAMPTR 0x07 // Not documented in ECMA-335
182 #define BIT_PARAM 0x08
183 #define BIT_INTERFACEIMPL 0x09
184 #define BIT_MEMBERREF 0x0A
185 #define BIT_CONSTANT 0x0B
186 #define BIT_CUSTOMATTRIBUTE 0x0C
187 #define BIT_FIELDMARSHAL 0x0D
188 #define BIT_DECLSECURITY 0x0E
189 #define BIT_CLASSLAYOUT 0x0F
190 #define BIT_FIELDLAYOUT 0x10
191 #define BIT_STANDALONESIG 0x11
192 #define BIT_EVENTMAP 0x12
193 #define BIT_EVENTPTR 0x13 // Not documented in ECMA-335
194 #define BIT_EVENT 0x14
195 #define BIT_PROPERTYMAP 0x15
196 #define BIT_PROPERTYPTR 0x16 // Not documented in ECMA-335
197 #define BIT_PROPERTY 0x17
198 #define BIT_METHODSEMANTICS 0x18
199 #define BIT_METHODIMPL 0x19
200 #define BIT_MODULEREF 0x1A
201 #define BIT_TYPESPEC 0x1B
202 #define BIT_IMPLMAP 0x1C
203 #define BIT_FIELDRVA 0x1D
204 #define BIT_ENCLOG 0x1E // Not documented in ECMA-335
205 #define BIT_ENCMAP 0x1F // Not documented in ECMA-335
206 #define BIT_ASSEMBLY 0x20
207 #define BIT_ASSEMBLYPROCESSOR 0x21
208 #define BIT_ASSEMBLYOS 0x22
209 #define BIT_ASSEMBLYREF 0x23
210 #define BIT_ASSEMBLYREFPROCESSOR 0x24
211 #define BIT_ASSEMBLYREFOS 0x25
212 #define BIT_FILE 0x26
213 #define BIT_EXPORTEDTYPE 0x27
214 #define BIT_MANIFESTRESOURCE 0x28
215 #define BIT_NESTEDCLASS 0x29
216 #define BIT_GENERICPARAM 0x2A
217 #define BIT_METHODSPEC 0x2B
218 #define BIT_GENERICPARAMCONSTRAINT 0x2C
219 
220 #endif /* #ifndef _INCLUDE_RZ_BIN_DOTNET_H_ */
uint16_t ut16
uint32_t ut32
int bin_pe_dotnet_read_method_header(Pe_image_clr *clr, RzBuffer *b, RzBinSymbol *sym)
Definition: dotnet.c:745
int bin_pe_dotnet_init_clr(Pe_image_clr *clr, RzBuffer *b, ut64 image_clr_hdr_paddr)
Definition: dotnet.c:932
int bin_pe_dotnet_init_metadata(Pe_image_clr *clr, bool big_endian, RzBuffer *b, ut64 metadata_directory)
Definition: dotnet.c:783
void bin_pe_dotnet_destroy_clr(Pe_image_clr *clr)
Definition: dotnet.c:968
uint8_t ut8
Definition: lh5801.h:11
#define b(i)
Definition: sha256.c:42
ut32 VTableFixupsAddress
Definition: dotnet.h:25
ut32 ExportAddressTableJumpsAddress
Definition: dotnet.h:27
ut32 CodeManagerTableSize
Definition: dotnet.h:24
ut32 StrongNameSignatureAddress
Definition: dotnet.h:21
ut32 VTableFixupsSize
Definition: dotnet.h:26
ut32 MetaDataDirectoryAddress
Definition: dotnet.h:15
ut32 ExportAddressTableJumpsSize
Definition: dotnet.h:28
ut32 ResourcesDirectoryAddress
Definition: dotnet.h:19
ut32 ManagedNativeHeaderAddress
Definition: dotnet.h:29
ut16 MajorRuntimeVersion
Definition: dotnet.h:13
ut32 MetaDataDirectorySize
Definition: dotnet.h:16
ut16 MinorRuntimeVersion
Definition: dotnet.h:14
ut32 EntryPointToken
Definition: dotnet.h:18
ut32 StrongNameSignatureSize
Definition: dotnet.h:22
ut32 ResourcesDirectorySize
Definition: dotnet.h:20
ut32 ManagedNativeHeaderSize
Definition: dotnet.h:30
ut32 CodeManagerTableAddress
Definition: dotnet.h:23
Pe_image_metadata_stream * tilde_stream
Definition: dotnet.h:156
RzList * typedefs
Definition: dotnet.h:164
RzPVector * methoddefs
Definition: dotnet.h:163
Pe_image_metadata_header * metadata_header
Definition: dotnet.h:152
RzList * streams
Definition: dotnet.h:153
Pe_image_clr_header * header
Definition: dotnet.h:151
Pe_image_metadata_stream * strings_stream
Definition: dotnet.h:157
Pe_image_metadata_stream * blob_stream
Definition: dotnet.h:158
Pe_image_metadata_tilde_header * tilde
Definition: dotnet.h:161
RzBuffer * strings
Definition: dotnet.h:162
ut64(WINAPI *w32_GetEnabledXStateFeatures)()