il2cpp-object-internals.h 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596
  1. #pragma once
  2. #include "il2cpp-config.h"
  3. #include <stdint.h>
  4. #include <stddef.h>
  5. #include "il2cpp-class-internals.h"
  6. struct Il2CppClass;
  7. struct MethodInfo;
  8. struct PropertyInfo;
  9. struct FieldInfo;
  10. struct EventInfo;
  11. struct Il2CppType;
  12. struct Il2CppAssembly;
  13. struct Il2CppException;
  14. struct Il2CppImage;
  15. struct Il2CppDomain;
  16. struct Il2CppString;
  17. struct Il2CppReflectionMethod;
  18. struct Il2CppAsyncCall;
  19. struct Il2CppIUnknown;
  20. struct Il2CppWaitHandle;
  21. struct MonitorData;
  22. namespace il2cpp
  23. {
  24. namespace os
  25. {
  26. class FastMutex;
  27. class Thread;
  28. }
  29. }
  30. struct Il2CppReflectionAssembly;
  31. struct Il2CppObject
  32. {
  33. Il2CppClass *klass;
  34. MonitorData *monitor;
  35. };
  36. typedef int32_t il2cpp_array_lower_bound_t;
  37. #define IL2CPP_ARRAY_MAX_INDEX ((int32_t) 0x7fffffff)
  38. #define IL2CPP_ARRAY_MAX_SIZE ((uint32_t) 0xffffffff)
  39. struct Il2CppArrayBounds
  40. {
  41. il2cpp_array_size_t length;
  42. il2cpp_array_lower_bound_t lower_bound;
  43. };
  44. #if IL2CPP_COMPILER_MSVC
  45. #pragma warning( push )
  46. #pragma warning( disable : 4200 )
  47. #elif defined(__clang__)
  48. #pragma clang diagnostic push
  49. #pragma clang diagnostic ignored "-Winvalid-offsetof"
  50. #endif
  51. struct Il2CppArray : public Il2CppObject
  52. {
  53. /* bounds is NULL for szarrays */
  54. Il2CppArrayBounds *bounds;
  55. /* total number of elements of the array */
  56. il2cpp_array_size_t max_length;
  57. };
  58. struct Il2CppArraySize : public Il2CppArray
  59. {
  60. ALIGN_TYPE(8) void* vector;
  61. };
  62. const size_t kIl2CppSizeOfArray = (offsetof(Il2CppArraySize, vector));
  63. const size_t kIl2CppOffsetOfArrayBounds = (offsetof(Il2CppArray, bounds));
  64. const size_t kIl2CppOffsetOfArrayLength = (offsetof(Il2CppArray, max_length));
  65. // System.String
  66. struct Il2CppString
  67. {
  68. Il2CppObject object;
  69. int32_t length; ///< Length of string *excluding* the trailing null (which is included in 'chars').
  70. Il2CppChar chars[IL2CPP_ZERO_LEN_ARRAY];
  71. };
  72. #if IL2CPP_COMPILER_MSVC
  73. #pragma warning( pop )
  74. #elif defined(__clang__)
  75. #pragma clang diagnostic pop
  76. #endif
  77. #define IL2CPP_OBJECT_SETREF(obj, fieldname, value) do {\
  78. /* mono_gc_wbarrier_set_field ((MonoObject*)(obj), &((obj)->fieldname), (MonoObject*)value); */ \
  79. (obj)->fieldname = (value); \
  80. } while (0)
  81. /* This should be used if 's' can reside on the heap */
  82. #define IL2CPP_STRUCT_SETREF(s, field, value) do {\
  83. /* mono_gc_wbarrier_generic_store (&((s)->field), (MonoObject*)(value)); */ \
  84. (s)->field = (value); \
  85. } while (0)
  86. struct Il2CppReflectionType
  87. {
  88. Il2CppObject object;
  89. const Il2CppType *type;
  90. };
  91. // IMPORTANT: All managed types corresponding to the objects below must be blacklisted in mscorlib.xml
  92. #if NET_4_0
  93. // System.RuntimeType
  94. struct Il2CppReflectionRuntimeType
  95. {
  96. Il2CppReflectionType type;
  97. Il2CppObject *type_info;
  98. Il2CppObject* genericCache;
  99. Il2CppObject* serializationCtor;
  100. };
  101. #endif
  102. // System.MonoType
  103. struct Il2CppReflectionMonoType
  104. {
  105. #if !NET_4_0
  106. Il2CppReflectionType type;
  107. Il2CppObject *type_info;
  108. #else
  109. Il2CppReflectionRuntimeType type;
  110. #endif
  111. const Il2CppType* GetIl2CppType() const
  112. {
  113. #if !NET_4_0
  114. return type.type;
  115. #else
  116. return type.type.type;
  117. #endif
  118. }
  119. };
  120. // System.Reflection.EventInfo
  121. struct Il2CppReflectionEvent
  122. {
  123. Il2CppObject object;
  124. Il2CppObject *cached_add_event;
  125. };
  126. // System.Reflection.MonoEvent
  127. struct Il2CppReflectionMonoEvent
  128. {
  129. Il2CppReflectionEvent event;
  130. Il2CppReflectionType* reflectedType;
  131. const EventInfo* eventInfo;
  132. };
  133. // System.Reflection.MonoEventInfo
  134. struct Il2CppReflectionMonoEventInfo
  135. {
  136. Il2CppReflectionType* declaringType;
  137. Il2CppReflectionType* reflectedType;
  138. Il2CppString* name;
  139. Il2CppReflectionMethod* addMethod;
  140. Il2CppReflectionMethod* removeMethod;
  141. Il2CppReflectionMethod* raiseMethod;
  142. uint32_t eventAttributes;
  143. Il2CppArray* otherMethods;
  144. };
  145. #if !NET_4_0
  146. // System.MonoEnumInfo
  147. struct Il2CppEnumInfo
  148. {
  149. Il2CppReflectionType *utype;
  150. Il2CppArray *values;
  151. Il2CppArray *names;
  152. void* name_hash;
  153. };
  154. #endif
  155. // System.Reflection.MonoField
  156. struct Il2CppReflectionField
  157. {
  158. Il2CppObject object;
  159. Il2CppClass *klass;
  160. FieldInfo *field;
  161. Il2CppString *name;
  162. Il2CppReflectionType *type;
  163. uint32_t attrs;
  164. };
  165. // System.Reflection.MonoProperty
  166. struct Il2CppReflectionProperty
  167. {
  168. Il2CppObject object;
  169. Il2CppClass *klass;
  170. const PropertyInfo *property;
  171. };
  172. // System.Reflection.MonoMethod
  173. struct Il2CppReflectionMethod
  174. {
  175. Il2CppObject object;
  176. const MethodInfo *method;
  177. Il2CppString *name;
  178. Il2CppReflectionType *reftype;
  179. };
  180. // System.Reflection.MonoGenericMethod
  181. struct Il2CppReflectionGenericMethod
  182. {
  183. Il2CppReflectionMethod base;
  184. };
  185. // System.Reflection.MonoMethodInfo
  186. struct Il2CppMethodInfo
  187. {
  188. Il2CppReflectionType *parent;
  189. Il2CppReflectionType *ret;
  190. uint32_t attrs;
  191. uint32_t implattrs;
  192. uint32_t callconv;
  193. };
  194. // System.Reflection.MonoPropertyInfo
  195. struct Il2CppPropertyInfo
  196. {
  197. Il2CppReflectionType* parent;
  198. #if NET_4_0
  199. Il2CppReflectionType* declaringType;
  200. #endif
  201. Il2CppString *name;
  202. Il2CppReflectionMethod *get;
  203. Il2CppReflectionMethod *set;
  204. uint32_t attrs;
  205. };
  206. // System.Reflection.ParameterInfo
  207. struct Il2CppReflectionParameter
  208. {
  209. Il2CppObject object;
  210. Il2CppReflectionType *ClassImpl;
  211. Il2CppObject *DefaultValueImpl;
  212. Il2CppObject *MemberImpl;
  213. Il2CppString *NameImpl;
  214. int32_t PositionImpl;
  215. uint32_t AttrsImpl;
  216. Il2CppObject *MarshalAsImpl;
  217. };
  218. // System.Reflection.Module
  219. struct Il2CppReflectionModule
  220. {
  221. Il2CppObject obj;
  222. const Il2CppImage* image;
  223. Il2CppReflectionAssembly* assembly;
  224. Il2CppString* fqname;
  225. Il2CppString* name;
  226. Il2CppString* scopename;
  227. bool is_resource;
  228. uint32_t token;
  229. };
  230. // System.Reflection.AssemblyName
  231. struct Il2CppReflectionAssemblyName
  232. {
  233. Il2CppObject obj;
  234. Il2CppString *name;
  235. Il2CppString *codebase;
  236. int32_t major, minor, build, revision;
  237. Il2CppObject *cultureInfo;
  238. uint32_t flags;
  239. uint32_t hashalg;
  240. Il2CppObject *keypair;
  241. Il2CppArray *publicKey;
  242. Il2CppArray *keyToken;
  243. uint32_t versioncompat;
  244. Il2CppObject *version;
  245. uint32_t processor_architecture;
  246. #if NET_4_0
  247. uint32_t contentType;
  248. #endif
  249. };
  250. // System.Reflection.Assembly
  251. struct Il2CppReflectionAssembly
  252. {
  253. Il2CppObject object;
  254. const Il2CppAssembly *assembly;
  255. Il2CppObject *resolve_event_holder;
  256. /* CAS related */
  257. Il2CppObject *evidence; /* Evidence */
  258. Il2CppObject *minimum; /* PermissionSet - for SecurityAction.RequestMinimum */
  259. Il2CppObject *optional; /* PermissionSet - for SecurityAction.RequestOptional */
  260. Il2CppObject *refuse; /* PermissionSet - for SecurityAction.RequestRefuse */
  261. Il2CppObject *granted; /* PermissionSet - for the resolved assembly granted permissions */
  262. Il2CppObject *denied; /* PermissionSet - for the resolved assembly denied permissions */
  263. /* */
  264. bool from_byte_array;
  265. Il2CppString *name;
  266. };
  267. // System.Reflection.Emit.UnmanagedMarshal
  268. struct Il2CppReflectionMarshal
  269. {
  270. Il2CppObject object;
  271. int32_t count;
  272. int32_t type;
  273. int32_t eltype;
  274. Il2CppString* guid;
  275. Il2CppString* mcookie;
  276. Il2CppString* marshaltype;
  277. Il2CppObject* marshaltyperef;
  278. int32_t param_num;
  279. bool has_size;
  280. };
  281. // System.Reflection.Pointer
  282. struct Il2CppReflectionPointer
  283. {
  284. Il2CppObject object;
  285. void* data;
  286. Il2CppReflectionType* type;
  287. };
  288. #if NET_4_0
  289. // System.Threading.InternalThread
  290. struct Il2CppInternalThread
  291. {
  292. Il2CppObject obj;
  293. int lock_thread_id;
  294. il2cpp::os::Thread* handle;
  295. void* native_handle;
  296. Il2CppArray* cached_culture_info;
  297. Il2CppChar* name;
  298. int name_len;
  299. uint32_t state;
  300. Il2CppObject* abort_exc;
  301. int abort_state_handle;
  302. uint64_t tid;
  303. void* stack_ptr;
  304. void** static_data;
  305. void* runtime_thread_info;
  306. Il2CppObject* current_appcontext;
  307. Il2CppObject* root_domain_thread;
  308. Il2CppArray* _serialized_principal;
  309. int _serialized_principal_version;
  310. void* appdomain_refs;
  311. int32_t interruption_requested;
  312. il2cpp::os::FastMutex* synch_cs;
  313. bool threadpool_thread;
  314. bool thread_interrupt_requested;
  315. int stack_size;
  316. uint8_t apartment_state;
  317. int critical_region_level;
  318. int managed_id;
  319. uint32_t small_id;
  320. void* manage_callback;
  321. void* interrupt_on_stop;
  322. void* flags;
  323. void* thread_pinning_ref;
  324. void* abort_protected_block_count;
  325. int32_t priority;
  326. void* owned_mutexes;
  327. void * suspended;
  328. int32_t self_suspended;
  329. size_t thread_state;
  330. size_t unused2;
  331. void* last;
  332. };
  333. /* Keep in sync with System.IOSelectorJob in mcs/class/System/System/IOSelectorJob.cs */
  334. struct Il2CppIOSelectorJob
  335. {
  336. Il2CppObject object;
  337. int32_t operation;
  338. Il2CppObject *callback;
  339. Il2CppObject *state;
  340. };
  341. /* This is a copy of System.Runtime.Remoting.Messaging.CallType */
  342. typedef enum
  343. {
  344. Il2Cpp_CallType_Sync = 0,
  345. Il2Cpp_CallType_BeginInvoke = 1,
  346. Il2Cpp_CallType_EndInvoke = 2,
  347. Il2Cpp_CallType_OneWay = 3
  348. } Il2CppCallType;
  349. struct Il2CppMethodMessage
  350. {
  351. Il2CppObject obj;
  352. Il2CppReflectionMethod *method;
  353. Il2CppArray *args;
  354. Il2CppArray *names;
  355. Il2CppArray *arg_types;
  356. Il2CppObject *ctx;
  357. Il2CppObject *rval;
  358. Il2CppObject *exc;
  359. Il2CppAsyncResult *async_result;
  360. uint32_t call_type;
  361. };
  362. #endif
  363. /* This is a copy of System.AppDomainSetup */
  364. struct Il2CppAppDomainSetup
  365. {
  366. Il2CppObject object;
  367. Il2CppString* application_base;
  368. Il2CppString* application_name;
  369. Il2CppString* cache_path;
  370. Il2CppString* configuration_file;
  371. Il2CppString* dynamic_base;
  372. Il2CppString* license_file;
  373. Il2CppString* private_bin_path;
  374. Il2CppString* private_bin_path_probe;
  375. Il2CppString* shadow_copy_directories;
  376. Il2CppString* shadow_copy_files;
  377. uint8_t publisher_policy;
  378. uint8_t path_changed;
  379. int loader_optimization;
  380. uint8_t disallow_binding_redirects;
  381. uint8_t disallow_code_downloads;
  382. Il2CppObject* activation_arguments; /* it is System.Object in 1.x, ActivationArguments in 2.0 */
  383. Il2CppObject* domain_initializer;
  384. Il2CppObject* application_trust; /* it is System.Object in 1.x, ApplicationTrust in 2.0 */
  385. Il2CppArray* domain_initializer_args;
  386. uint8_t disallow_appbase_probe;
  387. Il2CppArray* configuration_bytes;
  388. #if NET_4_0
  389. Il2CppArray* serialized_non_primitives;
  390. #endif
  391. };
  392. // System.Threading.Thread
  393. struct Il2CppThread
  394. {
  395. Il2CppObject obj;
  396. #if !NET_4_0
  397. int lock_thread_id; /* to be used as the pre-shifted thread id in thin locks */
  398. il2cpp::os::Thread* handle;
  399. Il2CppArray *cached_culture_info;
  400. void* unused1;
  401. bool threadpool_thread;//bool threadpool_thread;
  402. Il2CppChar* name;
  403. uint32_t name_len;
  404. uint32_t state;
  405. Il2CppObject* abort_exc;//MonoException *abort_exc;
  406. int abort_state_handle;
  407. uint64_t tid; /* This is accessed as a gsize in the code (so it can hold a 64bit pointer on systems that need it), but needs to reserve 64 bits of space on all machines as it corresponds to a field in managed code */
  408. void* start_notify;
  409. void* stack_ptr;
  410. void* *static_data;
  411. void* jit_data;
  412. void* lock_data;
  413. Il2CppObject* current_appcontext;//MonoAppContext *current_appcontext;
  414. int stack_size;
  415. Il2CppObject* start_obj;//MonoObject *start_obj;
  416. void* appdomain_refs;//GSList *appdomain_refs;
  417. ///* This is modified using atomic ops, so keep it a int32_t */
  418. int32_t interruption_requested;
  419. void* suspend_event;
  420. void* suspended_event;
  421. void* resume_event;
  422. il2cpp::os::FastMutex* synch_cs;
  423. uint8_t* serialized_culture_info;
  424. uint32_t serialized_culture_info_len;
  425. uint8_t* serialized_ui_culture_info;
  426. uint32_t serialized_ui_culture_info_len;
  427. bool thread_dump_requested;//bool thread_dump_requested;
  428. void* end_stack; /* This is only used when running in the debugger. */
  429. bool thread_interrupt_requested;//bool thread_interrupt_requested;
  430. uint8_t apartment_state;
  431. int32_t critical_region_level;
  432. uint32_t small_id; /* A small, unique id, used for the hazard pointer table. */
  433. void* manage_callback;
  434. Il2CppException *pending_exception;
  435. Il2CppObject *ec_to_set;
  436. ///*
  437. // * These fields are used to avoid having to increment corlib versions
  438. // * when a new field is added to the unmanaged MonoThread structure.
  439. // */
  440. void* interrupt_on_stop;
  441. uintptr_t flags;
  442. void* unused4;
  443. void* unused5;
  444. void* unused6;
  445. Il2CppObject* threadstart;
  446. int managed_id;
  447. Il2CppObject* principal;
  448. bool in_currentculture;
  449. #else
  450. Il2CppInternalThread* internal_thread;
  451. Il2CppObject* start_obj;
  452. Il2CppException* pending_exception;
  453. Il2CppObject* principal;
  454. int32_t principal_version;
  455. Il2CppDelegate* delegate;
  456. Il2CppObject* executionContext;
  457. bool executionContextBelongsToOuterScope;
  458. #endif
  459. #if !NET_4_0
  460. Il2CppThread* GetInternalThread()
  461. {
  462. return this;
  463. }
  464. #else
  465. Il2CppInternalThread* GetInternalThread() const
  466. {
  467. return internal_thread;
  468. }
  469. #endif
  470. };
  471. // System.Exception
  472. struct Il2CppException : public Il2CppObject
  473. {
  474. #if !NET_4_0
  475. /* Stores the IPs and the generic sharing infos
  476. (vtable/MRGCTX) of the frames. */
  477. Il2CppArray *trace_ips;
  478. Il2CppException *inner_ex;
  479. Il2CppString *message;
  480. Il2CppString *help_link;
  481. Il2CppString *class_name;
  482. Il2CppString *stack_trace;
  483. Il2CppString *remote_stack_trace;
  484. int32_t remote_stack_index;
  485. il2cpp_hresult_t hresult;
  486. Il2CppString *source;
  487. Il2CppObject *_data;
  488. #else
  489. Il2CppString* className;
  490. Il2CppString* message;
  491. Il2CppObject* _data;
  492. Il2CppException* inner_ex;
  493. Il2CppString* _helpURL;
  494. Il2CppArray* trace_ips;
  495. Il2CppString* stack_trace;
  496. Il2CppString* remote_stack_trace;
  497. int remote_stack_index;
  498. Il2CppObject* _dynamicMethods;
  499. il2cpp_hresult_t hresult;
  500. Il2CppString* source;
  501. Il2CppObject* safeSerializationManager;
  502. Il2CppArray* captured_traces;
  503. Il2CppArray* native_trace_ips;
  504. #endif
  505. };
  506. // System.SystemException
  507. struct Il2CppSystemException
  508. {
  509. Il2CppException base;
  510. };
  511. // System.ArgumentException
  512. struct Il2CppArgumentException
  513. {
  514. Il2CppException base;
  515. Il2CppString *argName;
  516. };
  517. // System.TypedReference
  518. struct Il2CppTypedRef
  519. {
  520. Il2CppType *type;
  521. void* value;
  522. Il2CppClass *klass;
  523. };
  524. // System.Delegate
  525. struct Il2CppDelegate
  526. {
  527. Il2CppObject object;
  528. /* The compiled code of the target method */
  529. Il2CppMethodPointer method_ptr;
  530. /* The invoke code */
  531. InvokerMethod invoke_impl;
  532. Il2CppObject *target;
  533. #if RUNTIME_MONO
  534. const MonoMethod *method;
  535. #else
  536. const MethodInfo *method;
  537. #endif
  538. void* delegate_trampoline;
  539. #if NET_4_0
  540. intptr_t extraArg;
  541. #endif
  542. /*
  543. * If non-NULL, this points to a memory location which stores the address of
  544. * the compiled code of the method, or NULL if it is not yet compiled.
  545. */
  546. uint8_t **method_code;
  547. Il2CppReflectionMethod *method_info;
  548. Il2CppReflectionMethod *original_method_info;
  549. Il2CppObject *data;
  550. #if NET_4_0
  551. bool method_is_virtual;
  552. #endif
  553. };
  554. #if NET_4_0
  555. struct Il2CppMulticastDelegate
  556. {
  557. Il2CppDelegate delegate;
  558. Il2CppArray *delegates;
  559. };
  560. #endif
  561. // System.MarshalByRefObject
  562. struct Il2CppMarshalByRefObject
  563. {
  564. Il2CppObject obj;
  565. Il2CppObject *identity;
  566. };
  567. // System.__Il2CppComObject (dummy type that replaces System.__ComObject)
  568. struct Il2CppComObject : Il2CppObject
  569. {
  570. Il2CppIUnknown* identity;
  571. // Same native object can be marshaled to managed code several times. If that happens,
  572. // we have to marshal it to the same RCW (same Il2CppComObject). We use a map of
  573. // IUnknown pointer -> weak GC handles to achieve it, and that works. When managed code
  574. // stops referencing the RCW, GC just garbage collects it and the finalizer will clean it
  575. // from our map. So far so good, eh?
  576. //
  577. // Enter Marshal.ReleaseComObject. This beast is designed to release the underlying COM object,
  578. // but ONLY after we used N amount of times (where N is the amount of times we marshaled
  579. // IUnknown into Il2CppComObject). In order to make it work, we need to implement ref counting.
  580. // This ref count gets incremented each time we marshal IUnknown to Il2CppComObject,
  581. // and gets decremented when Marshal.ReleaseComObject gets called. Fortunately, since we
  582. // live in a world of fairies and garbage collectors, we don't actually have to release it
  583. // manually in order for it to get cleaned up automatically in the future.
  584. volatile int32_t refCount;
  585. };
  586. // System.AppDomain
  587. struct Il2CppAppDomain
  588. {
  589. Il2CppMarshalByRefObject mbr;
  590. Il2CppDomain *data;
  591. };
  592. // System.Diagnostics.StackFrame
  593. struct Il2CppStackFrame
  594. {
  595. Il2CppObject obj;
  596. int32_t il_offset;
  597. int32_t native_offset;
  598. #if NET_4_0
  599. uint64_t methodAddress;
  600. uint32_t methodIndex;
  601. #endif
  602. Il2CppReflectionMethod *method;
  603. Il2CppString *filename;
  604. int32_t line;
  605. int32_t column;
  606. Il2CppString *internal_method_name;
  607. };
  608. // System.Globalization.DateTimeFormatInfo
  609. struct Il2CppDateTimeFormatInfo
  610. {
  611. Il2CppObject obj;
  612. #if !NET_4_0
  613. bool readOnly;
  614. Il2CppString* AMDesignator;
  615. Il2CppString* PMDesignator;
  616. Il2CppString* DateSeparator;
  617. Il2CppString* TimeSeparator;
  618. Il2CppString* ShortDatePattern;
  619. Il2CppString* LongDatePattern;
  620. Il2CppString* ShortTimePattern;
  621. Il2CppString* LongTimePattern;
  622. Il2CppString* MonthDayPattern;
  623. Il2CppString* YearMonthPattern;
  624. Il2CppString* FullDateTimePattern;
  625. Il2CppString* RFC1123Pattern;
  626. Il2CppString* SortableDateTimePattern;
  627. Il2CppString* UniversalSortableDateTimePattern;
  628. uint32_t FirstDayOfWeek;
  629. Il2CppObject* Calendar;
  630. uint32_t CalendarWeekRule;
  631. Il2CppArray* AbbreviatedDayNames;
  632. Il2CppArray* DayNames;
  633. Il2CppArray* MonthNames;
  634. Il2CppArray* AbbreviatedMonthNames;
  635. Il2CppArray* ShortDatePatterns;
  636. Il2CppArray* LongDatePatterns;
  637. Il2CppArray* ShortTimePatterns;
  638. Il2CppArray* LongTimePatterns;
  639. Il2CppArray* MonthDayPatterns;
  640. Il2CppArray* YearMonthPatterns;
  641. Il2CppArray* ShortDayNames;
  642. #else
  643. Il2CppObject* CultureData;
  644. Il2CppString* Name;
  645. Il2CppString* LangName;
  646. Il2CppObject* CompareInfo;
  647. Il2CppObject* CultureInfo;
  648. Il2CppString* AMDesignator;
  649. Il2CppString* PMDesignator;
  650. Il2CppString* DateSeparator;
  651. Il2CppString* GeneralShortTimePattern;
  652. Il2CppString* GeneralLongTimePattern;
  653. Il2CppString* TimeSeparator;
  654. Il2CppString* MonthDayPattern;
  655. Il2CppString* DateTimeOffsetPattern;
  656. Il2CppObject* Calendar;
  657. uint32_t FirstDayOfWeek;
  658. uint32_t CalendarWeekRule;
  659. Il2CppString* FullDateTimePattern;
  660. Il2CppArray* AbbreviatedDayNames;
  661. Il2CppArray* ShortDayNames;
  662. Il2CppArray* DayNames;
  663. Il2CppArray* AbbreviatedMonthNames;
  664. Il2CppArray* MonthNames;
  665. Il2CppArray* GenitiveMonthNames;
  666. Il2CppArray* GenitiveAbbreviatedMonthNames;
  667. Il2CppArray* LeapYearMonthNames;
  668. Il2CppString* LongDatePattern;
  669. Il2CppString* ShortDatePattern;
  670. Il2CppString* YearMonthPattern;
  671. Il2CppString* LongTimePattern;
  672. Il2CppString* ShortTimePattern;
  673. Il2CppArray* YearMonthPatterns;
  674. Il2CppArray* ShortDatePatterns;
  675. Il2CppArray* LongDatePatterns;
  676. Il2CppArray* ShortTimePatterns;
  677. Il2CppArray* LongTimePatterns;
  678. Il2CppArray* EraNames;
  679. Il2CppArray* AbbrevEraNames;
  680. Il2CppArray* AbbrevEnglishEraNames;
  681. Il2CppArray* OptionalCalendars;
  682. bool readOnly;
  683. int32_t FormatFlags;
  684. int32_t CultureID;
  685. bool UseUserOverride;
  686. bool UseCalendarInfo;
  687. int32_t DataItem;
  688. bool IsDefaultCalendar;
  689. Il2CppArray* DateWords;
  690. Il2CppString* FullTimeSpanPositivePattern;
  691. Il2CppString* FullTimeSpanNegativePattern;
  692. Il2CppArray* dtfiTokenHash;
  693. #endif
  694. };
  695. // System.Globalization.NumberFormatInfo
  696. struct Il2CppNumberFormatInfo
  697. {
  698. Il2CppObject obj;
  699. #if !NET_4_0
  700. bool readOnly;
  701. Il2CppString* decimalFormats;
  702. Il2CppString* currencyFormats;
  703. Il2CppString* percentFormats;
  704. Il2CppString* digitPattern;
  705. Il2CppString* zeroPattern;
  706. int32_t currencyDecimalDigits;
  707. Il2CppString* currencyDecimalSeparator;
  708. Il2CppString* currencyGroupSeparator;
  709. Il2CppArray* currencyGroupSizes;
  710. int32_t currencyNegativePattern;
  711. int32_t currencyPositivePattern;
  712. Il2CppString* currencySymbol;
  713. Il2CppString* naNSymbol;
  714. Il2CppString* negativeInfinitySymbol;
  715. Il2CppString* negativeSign;
  716. uint32_t numberDecimalDigits;
  717. Il2CppString* numberDecimalSeparator;
  718. Il2CppString* numberGroupSeparator;
  719. Il2CppArray* numberGroupSizes;
  720. int32_t numberNegativePattern;
  721. int32_t percentDecimalDigits;
  722. Il2CppString* percentDecimalSeparator;
  723. Il2CppString* percentGroupSeparator;
  724. Il2CppArray* percentGroupSizes;
  725. int32_t percentNegativePattern;
  726. int32_t percentPositivePattern;
  727. Il2CppString* percentSymbol;
  728. Il2CppString* perMilleSymbol;
  729. Il2CppString* positiveInfinitySymbol;
  730. Il2CppString* positiveSign;
  731. #else
  732. Il2CppArray* numberGroupSizes;
  733. Il2CppArray* currencyGroupSizes;
  734. Il2CppArray* percentGroupSizes;
  735. Il2CppString* positiveSign;
  736. Il2CppString* negativeSign;
  737. Il2CppString* numberDecimalSeparator;
  738. Il2CppString* numberGroupSeparator;
  739. Il2CppString* currencyGroupSeparator;
  740. Il2CppString* currencyDecimalSeparator;
  741. Il2CppString* currencySymbol;
  742. Il2CppString* ansiCurrencySymbol;
  743. Il2CppString* naNSymbol;
  744. Il2CppString* positiveInfinitySymbol;
  745. Il2CppString* negativeInfinitySymbol;
  746. Il2CppString* percentDecimalSeparator;
  747. Il2CppString* percentGroupSeparator;
  748. Il2CppString* percentSymbol;
  749. Il2CppString* perMilleSymbol;
  750. Il2CppArray* nativeDigits;
  751. int dataItem;
  752. int numberDecimalDigits;
  753. int currencyDecimalDigits;
  754. int currencyPositivePattern;
  755. int currencyNegativePattern;
  756. int numberNegativePattern;
  757. int percentPositivePattern;
  758. int percentNegativePattern;
  759. int percentDecimalDigits;
  760. int digitSubstitution;
  761. bool readOnly;
  762. bool useUserOverride;
  763. bool isInvariant;
  764. bool validForParseAsNumber;
  765. bool validForParseAsCurrency;
  766. #endif
  767. };
  768. #if NET_4_0
  769. struct Il2CppCultureData
  770. {
  771. Il2CppObject obj;
  772. Il2CppString *AMDesignator;
  773. Il2CppString *PMDesignator;
  774. Il2CppString *TimeSeparator;
  775. Il2CppArray *LongTimePatterns;
  776. Il2CppArray *ShortTimePatterns;
  777. uint32_t FirstDayOfWeek;
  778. uint32_t CalendarWeekRule;
  779. };
  780. struct Il2CppCalendarData
  781. {
  782. Il2CppObject obj;
  783. Il2CppString *NativeName;
  784. Il2CppArray *ShortDatePatterns;
  785. Il2CppArray *YearMonthPatterns;
  786. Il2CppArray *LongDatePatterns;
  787. Il2CppString *MonthDayPattern;
  788. Il2CppArray *EraNames;
  789. Il2CppArray *AbbreviatedEraNames;
  790. Il2CppArray *AbbreviatedEnglishEraNames;
  791. Il2CppArray *DayNames;
  792. Il2CppArray *AbbreviatedDayNames;
  793. Il2CppArray *SuperShortDayNames;
  794. Il2CppArray *MonthNames;
  795. Il2CppArray *AbbreviatedMonthNames;
  796. Il2CppArray *GenitiveMonthNames;
  797. Il2CppArray *GenitiveAbbreviatedMonthNames;
  798. };
  799. #endif
  800. // System.Globalization.CultureInfo
  801. struct Il2CppCultureInfo
  802. {
  803. Il2CppObject obj;
  804. bool is_read_only;
  805. int32_t lcid;
  806. int32_t parent_lcid;
  807. #if !NET_4_0
  808. int32_t specific_lcid;
  809. #endif
  810. int32_t datetime_index;
  811. int32_t number_index;
  812. #if NET_4_0
  813. int32_t default_calendar_type;
  814. #endif
  815. bool use_user_override;
  816. Il2CppNumberFormatInfo* number_format;
  817. Il2CppDateTimeFormatInfo* datetime_format;
  818. Il2CppObject* textinfo;
  819. Il2CppString* name;
  820. #if !NET_4_0
  821. Il2CppString* displayname;
  822. #endif
  823. Il2CppString* englishname;
  824. Il2CppString* nativename;
  825. Il2CppString* iso3lang;
  826. Il2CppString* iso2lang;
  827. #if !NET_4_0
  828. Il2CppString* icu_name;
  829. #endif
  830. Il2CppString* win3lang;
  831. Il2CppString* territory;
  832. #if NET_4_0
  833. Il2CppArray* native_calendar_names;
  834. #endif
  835. Il2CppString* compareinfo;
  836. #if !NET_4_0
  837. const int32_t* calendar_data;
  838. #endif
  839. const void* text_info_data;
  840. #if NET_4_0
  841. int dataItem;
  842. Il2CppObject* calendar;
  843. Il2CppObject* parent_culture;
  844. bool constructed;
  845. Il2CppArray* cached_serialized_form;
  846. Il2CppObject* cultureData;
  847. bool isInherited;
  848. #endif
  849. };
  850. // System.Globalization.RegionInfo
  851. struct Il2CppRegionInfo
  852. {
  853. Il2CppObject obj;
  854. #if NET_4_0
  855. int32_t geo_id;
  856. #else
  857. int32_t lcid;
  858. int32_t region_id;
  859. #endif
  860. Il2CppString* iso2name;
  861. Il2CppString* iso3name;
  862. Il2CppString* win3name;
  863. Il2CppString* english_name;
  864. Il2CppString* currency_symbol;
  865. Il2CppString* iso_currency_symbol;
  866. Il2CppString* currency_english_name;
  867. };
  868. // System.Runtime.InteropServices.SafeHandle
  869. // Inherited by Microsoft.Win32.SafeHandles.SafeWaitHandle
  870. struct Il2CppSafeHandle
  871. {
  872. Il2CppObject base;
  873. void* handle;
  874. #if !NET_4_0
  875. void* invalid_handle_value;
  876. int refcount;
  877. bool owns_handle;
  878. #else
  879. int state;
  880. bool owns_handle;
  881. bool fullyInitialized;
  882. #endif
  883. };
  884. // System.Text.StringBuilder
  885. struct Il2CppStringBuilder
  886. {
  887. Il2CppObject object;
  888. #if !NET_4_0
  889. int32_t length;
  890. Il2CppString *str;
  891. Il2CppString *cached_str;
  892. int32_t max_capacity;
  893. #else
  894. Il2CppArray* chunkChars;
  895. Il2CppStringBuilder* chunkPrevious;
  896. int chunkLength;
  897. int chunkOffset;
  898. int maxCapacity;
  899. #endif
  900. };
  901. // System.Net.SocketAddress
  902. struct Il2CppSocketAddress
  903. {
  904. Il2CppObject base;
  905. #if !NET_4_0
  906. Il2CppArray* data;
  907. #else
  908. int m_Size;
  909. Il2CppArray* data;
  910. bool m_changed;
  911. int m_hash;
  912. #endif
  913. };
  914. // System.Globalization.SortKey
  915. struct Il2CppSortKey
  916. {
  917. Il2CppObject base;
  918. Il2CppString *str;
  919. #if !NET_4_0
  920. int32_t options;
  921. Il2CppArray *key;
  922. #else
  923. Il2CppArray *key;
  924. int32_t options;
  925. #endif
  926. int32_t lcid;
  927. };
  928. // System.Runtime.InteropServices.ErrorWrapper
  929. struct Il2CppErrorWrapper
  930. {
  931. Il2CppObject base;
  932. int32_t errorCode;
  933. };
  934. // System.Runtime.Remoting.Messaging.AsyncResult
  935. struct Il2CppAsyncResult
  936. {
  937. Il2CppObject base;
  938. Il2CppObject *async_state;
  939. Il2CppWaitHandle *handle;
  940. Il2CppDelegate *async_delegate;
  941. void* data; // We pass delegate arguments here. This is repurposed. Depends on Mono C# code not using the field.
  942. Il2CppAsyncCall *object_data;
  943. bool sync_completed;
  944. bool completed;
  945. bool endinvoke_called;
  946. Il2CppObject *async_callback;
  947. Il2CppObject *execution_context;
  948. Il2CppObject *original_context;
  949. };
  950. // System.MonoAsyncCall
  951. struct Il2CppAsyncCall
  952. {
  953. Il2CppObject base;
  954. #if !NET_4_0
  955. void *msg; // We pass exceptions through here for now.
  956. #else
  957. Il2CppMethodMessage *msg;
  958. #endif
  959. MethodInfo *cb_method; // We don't set this.
  960. Il2CppDelegate *cb_target; // We pass the actual delegate here.
  961. Il2CppObject *state;
  962. Il2CppObject *res;
  963. Il2CppArray *out_args;
  964. #if !NET_4_0
  965. /* This is a HANDLE, we use guint64 so the managed object layout remains constant */
  966. uint64_t wait_event;
  967. #endif
  968. };
  969. #if RUNTIME_MONO
  970. extern "C"
  971. {
  972. #include <mono/metadata/object.h>
  973. }
  974. #endif
  975. struct Il2CppExceptionWrapper
  976. {
  977. #if RUNTIME_MONO
  978. MonoException* ex;
  979. Il2CppExceptionWrapper(MonoException* ex) : ex(ex) {}
  980. #else
  981. Il2CppException* ex;
  982. Il2CppExceptionWrapper(Il2CppException* ex) : ex(ex) {}
  983. #endif
  984. };
  985. #if NET_4_0
  986. struct Il2CppIOAsyncResult
  987. {
  988. Il2CppObject base;
  989. Il2CppDelegate* callback;
  990. Il2CppObject* state;
  991. Il2CppWaitHandle* wait_handle;
  992. bool completed_synchronously;
  993. bool completed;
  994. };
  995. #endif
  996. /// Corresponds to Mono's internal System.Net.Sockets.Socket.SocketAsyncResult
  997. /// class. Has no relation to Il2CppAsyncResult.
  998. struct Il2CppSocketAsyncResult
  999. {
  1000. #if !NET_4_0
  1001. Il2CppObject base;
  1002. Il2CppObject *socket;
  1003. intptr_t handle;
  1004. Il2CppObject *state;
  1005. Il2CppDelegate *callback;
  1006. Il2CppWaitHandle *wait_handle;
  1007. Il2CppException *delayedException;
  1008. Il2CppObject *ep;
  1009. Il2CppArray *buffer;
  1010. int32_t offset;
  1011. int32_t size;
  1012. int32_t socket_flags;
  1013. Il2CppObject *accept_reuse_socket;
  1014. Il2CppArray *addresses;
  1015. int32_t port;
  1016. Il2CppObject *buffers;
  1017. bool reusesocket;
  1018. Il2CppObject *acceptSocket;
  1019. int32_t total;
  1020. bool completed_synchronously;
  1021. bool completed;
  1022. bool blocking;
  1023. int32_t error;
  1024. int32_t operation;
  1025. Il2CppAsyncResult *ares;
  1026. #else
  1027. Il2CppIOAsyncResult base;
  1028. Il2CppObject* socket;
  1029. int32_t operation;
  1030. Il2CppException* delayedException;
  1031. Il2CppObject* endPoint;
  1032. Il2CppArray* buffer;
  1033. int32_t offset;
  1034. int32_t size;
  1035. int32_t socket_flags;
  1036. Il2CppObject* acceptSocket;
  1037. Il2CppArray* addresses;
  1038. int32_t port;
  1039. Il2CppObject* buffers;
  1040. bool reuseSocket;
  1041. int32_t currentAddress;
  1042. Il2CppObject* acceptedSocket;
  1043. int32_t total;
  1044. int32_t error;
  1045. int32_t endCalled;
  1046. #endif
  1047. };
  1048. enum Il2CppResourceLocation
  1049. {
  1050. IL2CPP_RESOURCE_LOCATION_EMBEDDED = 1,
  1051. IL2CPP_RESOURCE_LOCATION_ANOTHER_ASSEMBLY = 2,
  1052. IL2CPP_RESOURCE_LOCATION_IN_MANIFEST = 4
  1053. };
  1054. // System.Reflection.ManifestResourceInfo
  1055. struct Il2CppManifestResourceInfo
  1056. {
  1057. Il2CppObject object;
  1058. Il2CppReflectionAssembly* assembly;
  1059. Il2CppString* filename;
  1060. uint32_t location;
  1061. };
  1062. #define IL2CPP_CHECK_ARG_NULL(arg) do { \
  1063. if (arg == NULL) \
  1064. { \
  1065. il2cpp::vm::Exception::Raise (il2cpp::vm::Exception::GetArgumentNullException (#arg)); \
  1066. }; } while (0)
  1067. // System.Runtime.Remoting.Contexts.Context
  1068. struct Il2CppAppContext
  1069. {
  1070. Il2CppObject obj;
  1071. int32_t domain_id;
  1072. int32_t context_id;
  1073. void* static_data;
  1074. };
  1075. #if !NET_4_0
  1076. // System.Decimal
  1077. typedef struct
  1078. {
  1079. //Note that we are not taking care of endianess.
  1080. union
  1081. {
  1082. uint32_t ss32;
  1083. struct signscale
  1084. {
  1085. unsigned int reserved1 : 16;
  1086. unsigned int scale : 8;
  1087. unsigned int reserved2 : 7;
  1088. unsigned int sign : 1;
  1089. } signscale;
  1090. } u;
  1091. uint32_t hi32;
  1092. uint32_t lo32;
  1093. uint32_t mid32;
  1094. } il2cpp_decimal_repr;
  1095. #else
  1096. struct Il2CppDecimal
  1097. {
  1098. // Decimal.cs treats the first two shorts as one long
  1099. // And they seriable the data so we need to little endian
  1100. // seriliazation
  1101. // The wReserved overlaps with Variant's vt member
  1102. #if IL2CPP_BYTE_ORDER == IL2CPP_BIG_ENDIAN
  1103. union
  1104. {
  1105. struct
  1106. {
  1107. uint8_t sign;
  1108. uint8_t scale;
  1109. } u;
  1110. uint16_t signscale;
  1111. } u;
  1112. uint16_t reserved;
  1113. #else
  1114. uint16_t reserved;
  1115. union
  1116. {
  1117. struct
  1118. {
  1119. uint8_t scale;
  1120. uint8_t sign;
  1121. } u;
  1122. uint16_t signscale;
  1123. } u;
  1124. #endif
  1125. uint32_t Hi32;
  1126. union
  1127. {
  1128. struct
  1129. {
  1130. uint32_t Lo32;
  1131. uint32_t Mid32;
  1132. } v;
  1133. uint64_t Lo64;
  1134. } v;
  1135. };
  1136. // Structure to access an encoded double floating point
  1137. struct Il2CppDouble
  1138. {
  1139. #if IL2CPP_BYTE_ORDER == IL2CPP_BIG_ENDIAN
  1140. uint32_t sign : 1;
  1141. uint32_t exp : 11;
  1142. uint32_t mantHi : 20;
  1143. uint32_t mantLo : 32;
  1144. #else // BIGENDIAN
  1145. uint32_t mantLo : 32;
  1146. uint32_t mantHi : 20;
  1147. uint32_t exp : 11;
  1148. uint32_t sign : 1;
  1149. #endif
  1150. };
  1151. typedef union
  1152. {
  1153. Il2CppDouble s;
  1154. double d;
  1155. } Il2CppDouble_double;
  1156. typedef enum
  1157. {
  1158. IL2CPP_DECIMAL_CMP_LT = -1,
  1159. IL2CPP_DECIMAL_CMP_EQ,
  1160. IL2CPP_DECIMAL_CMP_GT
  1161. } Il2CppDecimalCompareResult;
  1162. // Structure to access an encoded single floating point
  1163. struct Il2CppSingle
  1164. {
  1165. #if IL2CPP_BYTE_ORDER == IL2CPP_BIG_ENDIAN
  1166. uint32_t sign : 1;
  1167. uint32_t exp : 8;
  1168. uint32_t mant : 23;
  1169. #else
  1170. uint32_t mant : 23;
  1171. uint32_t exp : 8;
  1172. uint32_t sign : 1;
  1173. #endif
  1174. };
  1175. typedef union
  1176. {
  1177. Il2CppSingle s;
  1178. float f;
  1179. } Il2CppSingle_float;
  1180. #endif
  1181. // System.Guid
  1182. struct Il2CppGuid
  1183. {
  1184. uint32_t data1;
  1185. uint16_t data2;
  1186. uint16_t data3;
  1187. uint8_t data4[8];
  1188. };
  1189. struct Il2CppSafeArrayBound
  1190. {
  1191. uint32_t element_count;
  1192. int32_t lower_bound;
  1193. };
  1194. struct Il2CppSafeArray
  1195. {
  1196. uint16_t dimension_count;
  1197. uint16_t features;
  1198. uint32_t element_size;
  1199. uint32_t lock_count;
  1200. void* data;
  1201. Il2CppSafeArrayBound bounds[1];
  1202. };
  1203. struct Il2CppWin32Decimal
  1204. {
  1205. uint16_t reserved;
  1206. union
  1207. {
  1208. struct
  1209. {
  1210. uint8_t scale;
  1211. uint8_t sign;
  1212. } s;
  1213. uint16_t signscale;
  1214. } u;
  1215. uint32_t hi32;
  1216. union
  1217. {
  1218. struct
  1219. {
  1220. uint32_t lo32;
  1221. uint32_t mid32;
  1222. } s2;
  1223. uint64_t lo64;
  1224. } u2;
  1225. };
  1226. typedef int16_t IL2CPP_VARIANT_BOOL;
  1227. #define IL2CPP_VARIANT_TRUE ((IL2CPP_VARIANT_BOOL)-1)
  1228. #define IL2CPP_VARIANT_FALSE ((IL2CPP_VARIANT_BOOL)0)
  1229. enum Il2CppVarType
  1230. {
  1231. IL2CPP_VT_EMPTY = 0,
  1232. IL2CPP_VT_NULL = 1,
  1233. IL2CPP_VT_I2 = 2,
  1234. IL2CPP_VT_I4 = 3,
  1235. IL2CPP_VT_R4 = 4,
  1236. IL2CPP_VT_R8 = 5,
  1237. IL2CPP_VT_CY = 6,
  1238. IL2CPP_VT_DATE = 7,
  1239. IL2CPP_VT_BSTR = 8,
  1240. IL2CPP_VT_DISPATCH = 9,
  1241. IL2CPP_VT_ERROR = 10,
  1242. IL2CPP_VT_BOOL = 11,
  1243. IL2CPP_VT_VARIANT = 12,
  1244. IL2CPP_VT_UNKNOWN = 13,
  1245. IL2CPP_VT_DECIMAL = 14,
  1246. IL2CPP_VT_I1 = 16,
  1247. IL2CPP_VT_UI1 = 17,
  1248. IL2CPP_VT_UI2 = 18,
  1249. IL2CPP_VT_UI4 = 19,
  1250. IL2CPP_VT_I8 = 20,
  1251. IL2CPP_VT_UI8 = 21,
  1252. IL2CPP_VT_INT = 22,
  1253. IL2CPP_VT_UINT = 23,
  1254. IL2CPP_VT_VOID = 24,
  1255. IL2CPP_VT_HRESULT = 25,
  1256. IL2CPP_VT_PTR = 26,
  1257. IL2CPP_VT_SAFEARRAY = 27,
  1258. IL2CPP_VT_CARRAY = 28,
  1259. IL2CPP_VT_USERDEFINED = 29,
  1260. IL2CPP_VT_LPSTR = 30,
  1261. IL2CPP_VT_LPWSTR = 31,
  1262. IL2CPP_VT_RECORD = 36,
  1263. IL2CPP_VT_INT_PTR = 37,
  1264. IL2CPP_VT_UINT_PTR = 38,
  1265. IL2CPP_VT_FILETIME = 64,
  1266. IL2CPP_VT_BLOB = 65,
  1267. IL2CPP_VT_STREAM = 66,
  1268. IL2CPP_VT_STORAGE = 67,
  1269. IL2CPP_VT_STREAMED_OBJECT = 68,
  1270. IL2CPP_VT_STORED_OBJECT = 69,
  1271. IL2CPP_VT_BLOB_OBJECT = 70,
  1272. IL2CPP_VT_CF = 71,
  1273. IL2CPP_VT_CLSID = 72,
  1274. IL2CPP_VT_VERSIONED_STREAM = 73,
  1275. IL2CPP_VT_BSTR_BLOB = 0xfff,
  1276. IL2CPP_VT_VECTOR = 0x1000,
  1277. IL2CPP_VT_ARRAY = 0x2000,
  1278. IL2CPP_VT_BYREF = 0x4000,
  1279. IL2CPP_VT_RESERVED = 0x8000,
  1280. IL2CPP_VT_ILLEGAL = 0xffff,
  1281. IL2CPP_VT_ILLEGALMASKED = 0xfff,
  1282. IL2CPP_VT_TYPEMASK = 0xfff,
  1283. };
  1284. struct Il2CppVariant
  1285. {
  1286. union
  1287. {
  1288. struct __tagVARIANT
  1289. {
  1290. uint16_t type;
  1291. uint16_t reserved1;
  1292. uint16_t reserved2;
  1293. uint16_t reserved3;
  1294. union
  1295. {
  1296. int64_t llVal;
  1297. int32_t lVal;
  1298. uint8_t bVal;
  1299. int16_t iVal;
  1300. float fltVal;
  1301. double dblVal;
  1302. IL2CPP_VARIANT_BOOL boolVal;
  1303. int32_t scode;
  1304. int64_t cyVal;
  1305. double date;
  1306. Il2CppChar* bstrVal;
  1307. Il2CppIUnknown* punkVal;
  1308. void* pdispVal;
  1309. Il2CppSafeArray* parray;
  1310. uint8_t* pbVal;
  1311. int16_t* piVal;
  1312. int32_t* plVal;
  1313. int64_t* pllVal;
  1314. float* pfltVal;
  1315. double* pdblVal;
  1316. IL2CPP_VARIANT_BOOL* pboolVal;
  1317. int32_t* pscode;
  1318. int64_t* pcyVal;
  1319. double* pdate;
  1320. Il2CppChar* pbstrVal;
  1321. Il2CppIUnknown** ppunkVal;
  1322. void** ppdispVal;
  1323. Il2CppSafeArray** pparray;
  1324. Il2CppVariant* pvarVal;
  1325. void* byref;
  1326. char cVal;
  1327. uint16_t uiVal;
  1328. uint32_t ulVal;
  1329. uint64_t ullVal;
  1330. int intVal;
  1331. unsigned int uintVal;
  1332. Il2CppWin32Decimal* pdecVal;
  1333. char* pcVal;
  1334. uint16_t* puiVal;
  1335. uint32_t* pulVal;
  1336. uint64_t* pullVal;
  1337. int* pintVal;
  1338. unsigned int* puintVal;
  1339. struct __tagBRECORD
  1340. {
  1341. void* pvRecord;
  1342. void* pRecInfo;
  1343. } n4;
  1344. } n3;
  1345. } n2;
  1346. Il2CppWin32Decimal decVal;
  1347. } n1;
  1348. };
  1349. struct Il2CppFileTime
  1350. {
  1351. uint32_t low;
  1352. uint32_t high;
  1353. };
  1354. struct Il2CppStatStg
  1355. {
  1356. Il2CppChar* name;
  1357. uint32_t type;
  1358. uint64_t size;
  1359. Il2CppFileTime mtime;
  1360. Il2CppFileTime ctime;
  1361. Il2CppFileTime atime;
  1362. uint32_t mode;
  1363. uint32_t locks;
  1364. Il2CppGuid clsid;
  1365. uint32_t state;
  1366. uint32_t reserved;
  1367. };
  1368. struct Il2CppHString__
  1369. {
  1370. int unused;
  1371. };
  1372. typedef Il2CppHString__* Il2CppHString;
  1373. struct Il2CppHStringHeader
  1374. {
  1375. union
  1376. {
  1377. void* Reserved1;
  1378. #if IL2CPP_SIZEOF_VOID_P == 8
  1379. char Reserved2[24];
  1380. #else
  1381. char Reserved2[20];
  1382. #endif
  1383. } Reserved;
  1384. };
  1385. struct LIBIL2CPP_CODEGEN_API NOVTABLE Il2CppIUnknown
  1386. {
  1387. static const Il2CppGuid IID;
  1388. virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) = 0;
  1389. virtual uint32_t STDCALL AddRef() = 0;
  1390. virtual uint32_t STDCALL Release() = 0;
  1391. };
  1392. struct NOVTABLE Il2CppISequentialStream : Il2CppIUnknown
  1393. {
  1394. static const LIBIL2CPP_CODEGEN_API Il2CppGuid IID;
  1395. virtual il2cpp_hresult_t STDCALL Read(void* buffer, uint32_t size, uint32_t* read) = 0;
  1396. virtual il2cpp_hresult_t STDCALL Write(const void* buffer, uint32_t size, uint32_t* written) = 0;
  1397. };
  1398. struct NOVTABLE Il2CppIStream : Il2CppISequentialStream
  1399. {
  1400. static const LIBIL2CPP_CODEGEN_API Il2CppGuid IID;
  1401. virtual il2cpp_hresult_t STDCALL Seek(int64_t move, uint32_t origin, uint64_t* position) = 0;
  1402. virtual il2cpp_hresult_t STDCALL SetSize(uint64_t size) = 0;
  1403. virtual il2cpp_hresult_t STDCALL CopyTo(Il2CppIStream* stream, uint64_t size, uint64_t* read, uint64_t* written) = 0;
  1404. virtual il2cpp_hresult_t STDCALL Commit(uint32_t flags) = 0;
  1405. virtual il2cpp_hresult_t STDCALL Revert() = 0;
  1406. virtual il2cpp_hresult_t STDCALL LockRegion(uint64_t offset, uint64_t size, uint32_t type) = 0;
  1407. virtual il2cpp_hresult_t STDCALL UnlockRegion(uint64_t offset, uint64_t size, uint32_t type) = 0;
  1408. virtual il2cpp_hresult_t STDCALL Stat(Il2CppStatStg* data, uint32_t flags) = 0;
  1409. virtual il2cpp_hresult_t STDCALL Clone(Il2CppIStream** stream) = 0;
  1410. };
  1411. struct LIBIL2CPP_CODEGEN_API NOVTABLE Il2CppIMarshal : Il2CppIUnknown
  1412. {
  1413. static const Il2CppGuid IID;
  1414. virtual il2cpp_hresult_t STDCALL GetUnmarshalClass(const Il2CppGuid& iid, void* object, uint32_t context, void* reserved, uint32_t flags, Il2CppGuid* clsid) = 0;
  1415. virtual il2cpp_hresult_t STDCALL GetMarshalSizeMax(const Il2CppGuid& iid, void* object, uint32_t context, void* reserved, uint32_t flags, uint32_t* size) = 0;
  1416. virtual il2cpp_hresult_t STDCALL MarshalInterface(Il2CppIStream* stream, const Il2CppGuid& iid, void* object, uint32_t context, void* reserved, uint32_t flags) = 0;
  1417. virtual il2cpp_hresult_t STDCALL UnmarshalInterface(Il2CppIStream* stream, const Il2CppGuid& iid, void** object) = 0;
  1418. virtual il2cpp_hresult_t STDCALL ReleaseMarshalData(Il2CppIStream* stream) = 0;
  1419. virtual il2cpp_hresult_t STDCALL DisconnectObject(uint32_t reserved) = 0;
  1420. };
  1421. struct NOVTABLE Il2CppIManagedObject : Il2CppIUnknown
  1422. {
  1423. static const LIBIL2CPP_CODEGEN_API Il2CppGuid IID;
  1424. virtual il2cpp_hresult_t STDCALL GetSerializedBuffer(Il2CppChar** bstr) = 0;
  1425. virtual il2cpp_hresult_t STDCALL GetObjectIdentity(Il2CppChar** bstr_guid, int32_t* app_domain_id, intptr_t* ccw) = 0;
  1426. };
  1427. struct LIBIL2CPP_CODEGEN_API NOVTABLE Il2CppIManagedObjectHolder : Il2CppIUnknown
  1428. {
  1429. static const Il2CppGuid IID;
  1430. virtual Il2CppObject* STDCALL GetManagedObject() = 0;
  1431. virtual void STDCALL Destroy() = 0;
  1432. };
  1433. struct LIBIL2CPP_CODEGEN_API NOVTABLE Il2CppIInspectable : Il2CppIUnknown
  1434. {
  1435. static const Il2CppGuid IID;
  1436. virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) = 0;
  1437. virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) = 0;
  1438. virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) = 0;
  1439. };
  1440. struct NOVTABLE Il2CppIActivationFactory : Il2CppIInspectable
  1441. {
  1442. static const LIBIL2CPP_CODEGEN_API Il2CppGuid IID;
  1443. virtual il2cpp_hresult_t STDCALL ActivateInstance(Il2CppIInspectable** instance) = 0;
  1444. };
  1445. struct NOVTABLE Il2CppIRestrictedErrorInfo : Il2CppIUnknown
  1446. {
  1447. static const LIBIL2CPP_CODEGEN_API Il2CppGuid IID;
  1448. virtual il2cpp_hresult_t STDCALL GetErrorDetails(Il2CppChar** bstrDescription, il2cpp_hresult_t* error, Il2CppChar** bstrRestrictedDescription, Il2CppChar** bstrCapabilitySid) = 0;
  1449. virtual il2cpp_hresult_t STDCALL GetReference(Il2CppChar** bstrReference) = 0;
  1450. };
  1451. struct NOVTABLE Il2CppILanguageExceptionErrorInfo : Il2CppIUnknown
  1452. {
  1453. static const LIBIL2CPP_CODEGEN_API Il2CppGuid IID;
  1454. virtual il2cpp_hresult_t STDCALL GetLanguageException(Il2CppIUnknown** languageException) = 0;
  1455. };
  1456. struct NOVTABLE Il2CppIAgileObject : Il2CppIUnknown
  1457. {
  1458. static const LIBIL2CPP_CODEGEN_API Il2CppGuid IID;
  1459. virtual il2cpp_hresult_t STDCALL GetLanguageException(Il2CppIUnknown** languageException) = 0;
  1460. };