1 /* 2 * fusion private definitions 3 * 4 * Copyright 2008 James Hawkins 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 */ 20 21 #ifndef __WINE_FUSION_PRIVATE__ 22 #define __WINE_FUSION_PRIVATE__ 23 24 #include <stdarg.h> 25 26 #include "windef.h" 27 #include "winbase.h" 28 #include "winuser.h" 29 #include "winver.h" 30 #include "wine/heap.h" 31 32 #ifdef __REACTOS__ 33 #include <objbase.h> 34 #include <fusion.h> 35 #endif 36 37 #include <pshpack1.h> 38 39 typedef struct 40 { 41 ULONG Signature; 42 USHORT MajorVersion; 43 USHORT MinorVersion; 44 ULONG Reserved; 45 ULONG VersionLength; 46 LPSTR Version; 47 BYTE Flags; 48 WORD Streams; 49 } METADATAHDR; 50 51 typedef struct 52 { 53 DWORD Offset; 54 DWORD Size; 55 } METADATASTREAMHDR; 56 57 typedef struct 58 { 59 DWORD Reserved1; 60 BYTE MajorVersion; 61 BYTE MinorVersion; 62 BYTE HeapOffsetSizes; 63 BYTE Reserved2; 64 LARGE_INTEGER MaskValid; 65 LARGE_INTEGER MaskSorted; 66 } METADATATABLESHDR; 67 68 typedef struct 69 { 70 WORD Generation; 71 WORD Name; 72 WORD Mvid; 73 WORD EncId; 74 WORD EncBaseId; 75 } MODULETABLE; 76 77 typedef struct 78 { 79 DWORD Flags; 80 WORD Name; 81 WORD Namespace; 82 WORD Extends; 83 WORD FieldList; 84 WORD MethodList; 85 } TYPEDEFTABLE; 86 87 typedef struct 88 { 89 WORD ResolutionScope; 90 WORD Name; 91 WORD Namespace; 92 } TYPEREFTABLE; 93 94 typedef struct 95 { 96 WORD Flags; 97 WORD Name; 98 WORD Signature; 99 } FIELDTABLE; 100 101 typedef struct 102 { 103 DWORD HashAlgId; 104 WORD MajorVersion; 105 WORD MinorVersion; 106 WORD BuildNumber; 107 WORD RevisionNumber; 108 DWORD Flags; 109 WORD PublicKey; 110 WORD Name; 111 WORD Culture; 112 } ASSEMBLYTABLE; 113 114 typedef struct 115 { 116 DWORD Offset; 117 DWORD Flags; 118 WORD Name; 119 WORD Implementation; 120 } MANIFESTRESTABLE; 121 122 typedef struct 123 { 124 DWORD RVA; 125 WORD ImplFlags; 126 WORD Flags; 127 WORD Name; 128 WORD Signature; 129 WORD ParamList; 130 } METHODDEFTABLE; 131 132 typedef struct 133 { 134 WORD Flags; 135 WORD Sequence; 136 WORD Name; 137 } PARAMTABLE; 138 139 typedef struct 140 { 141 WORD Class; 142 WORD Interface; 143 } INTERFACEIMPLTABLE; 144 145 typedef struct 146 { 147 WORD Class; 148 WORD Name; 149 WORD Signature; 150 } MEMBERREFTABLE; 151 152 typedef struct 153 { 154 BYTE Type; 155 BYTE Reserved; 156 WORD Parent; 157 WORD Value; 158 } CONSTANTTABLE; 159 160 typedef struct 161 { 162 WORD Parent; 163 WORD Type; 164 WORD Value; 165 } CUSTOMATTRIBUTETABLE; 166 167 typedef struct 168 { 169 WORD Parent; 170 WORD NativeType; 171 } FIELDMARSHALTABLE; 172 173 typedef struct 174 { 175 WORD Action; 176 WORD Parent; 177 WORD PermissionSet; 178 } DECLSECURITYTABLE; 179 180 typedef struct 181 { 182 WORD PackingSize; 183 DWORD ClassSize; 184 WORD Parent; 185 } CLASSLAYOUTTABLE; 186 187 typedef struct 188 { 189 DWORD Offset; 190 WORD Field; 191 } FIELDLAYOUTTABLE; 192 193 typedef struct 194 { 195 WORD Signature; 196 } STANDALONESIGTABLE; 197 198 typedef struct 199 { 200 WORD Parent; 201 WORD EventList; 202 } EVENTMAPTABLE; 203 204 typedef struct 205 { 206 WORD EventFlags; 207 WORD Name; 208 WORD EventType; 209 } EVENTTABLE; 210 211 typedef struct 212 { 213 WORD Parent; 214 WORD PropertyList; 215 } PROPERTYMAPTABLE; 216 217 typedef struct 218 { 219 WORD Flags; 220 WORD Name; 221 WORD Type; 222 } PROPERTYTABLE; 223 224 typedef struct 225 { 226 WORD Semantics; 227 WORD Method; 228 WORD Association; 229 } METHODSEMANTICSTABLE; 230 231 typedef struct 232 { 233 WORD Class; 234 WORD MethodBody; 235 WORD MethodDeclaration; 236 } METHODIMPLTABLE; 237 238 typedef struct 239 { 240 WORD Name; 241 } MODULEREFTABLE; 242 243 typedef struct 244 { 245 WORD Signature; 246 } TYPESPECTABLE; 247 248 typedef struct 249 { 250 WORD MappingFlags; 251 WORD MemberForwarded; 252 WORD ImportName; 253 WORD ImportScope; 254 } IMPLMAPTABLE; 255 256 typedef struct 257 { 258 DWORD RVA; 259 WORD Field; 260 } FIELDRVATABLE; 261 262 typedef struct 263 { 264 DWORD Processor; 265 } ASSEMBLYPROCESSORTABLE; 266 267 typedef struct 268 { 269 DWORD OSPlatformID; 270 DWORD OSMajorVersion; 271 DWORD OSMinorVersion; 272 } ASSEMBLYOSTABLE; 273 274 typedef struct 275 { 276 WORD MajorVersion; 277 WORD MinorVersion; 278 WORD BuildNumber; 279 WORD RevisionNumber; 280 DWORD Flags; 281 WORD PublickKeyOrToken; 282 WORD Name; 283 WORD Culture; 284 WORD HashValue; 285 } ASSEMBLYREFTABLE; 286 287 typedef struct 288 { 289 DWORD Processor; 290 WORD AssemblyRef; 291 } ASSEMBLYREFPROCESSORTABLE; 292 293 typedef struct 294 { 295 DWORD OSPlatformId; 296 DWORD OSMajorVersion; 297 DWORD OSMinorVersion; 298 WORD AssemblyRef; 299 } ASSEMBLYREFOSTABLE; 300 301 typedef struct 302 { 303 DWORD Flags; 304 WORD Name; 305 WORD HashValue; 306 } FILETABLE; 307 308 typedef struct 309 { 310 DWORD Flags; 311 DWORD TypeDefId; 312 WORD TypeName; 313 WORD TypeNameSpace; 314 WORD Implementation; 315 } EXPORTEDTYPETABLE; 316 317 typedef struct 318 { 319 WORD NestedClass; 320 WORD EnclosingClass; 321 } NESTEDCLASSTABLE; 322 323 typedef struct 324 { 325 WORD Number; 326 WORD Flags; 327 } GENERICPARAMTABLE; 328 329 typedef struct 330 { 331 WORD MethodDef; 332 WORD Instantiation; 333 } METHODSPECTABLE; 334 335 typedef struct 336 { 337 WORD Owner; 338 WORD Constraint; 339 } GENERICPARAMCONSTRAINTTABLE; 340 341 typedef struct 342 { 343 DWORD ImportLookupTable; 344 DWORD DateTimeStamp; 345 DWORD ForwarderChain; 346 DWORD Name; 347 DWORD ImportAddressTable; 348 BYTE pad[20]; 349 } IMPORTTABLE; 350 351 typedef struct 352 { 353 DWORD HintNameTableRVA; 354 BYTE pad[8]; 355 } IMPORTLOOKUPTABLE; 356 357 typedef struct 358 { 359 WORD Hint; 360 BYTE Name[12]; 361 BYTE Module[12]; 362 DWORD Reserved; 363 WORD EntryPoint; 364 DWORD RVA; 365 } HINTNAMETABLE; 366 367 typedef struct 368 { 369 DWORD PageRVA; 370 DWORD Size; 371 DWORD Relocation; 372 } RELOCATION; 373 374 typedef struct 375 { 376 WORD wLength; 377 WORD wValueLength; 378 WORD wType; 379 WCHAR szKey[17]; 380 VS_FIXEDFILEINFO Value; 381 } VS_VERSIONINFO; 382 383 typedef struct 384 { 385 WORD wLength; 386 WORD wValueLength; 387 WORD wType; 388 WCHAR szKey[13]; 389 } VARFILEINFO; 390 391 typedef struct 392 { 393 WORD wLength; 394 WORD wValueLength; 395 WORD wType; 396 WCHAR szKey[13]; 397 DWORD Value; 398 } VAR; 399 400 typedef struct 401 { 402 WORD wLength; 403 WORD wValueLength; 404 WORD wType; 405 WCHAR szKey[15]; 406 } STRINGFILEINFO; 407 408 typedef struct 409 { 410 WORD wLength; 411 WORD wValueLength; 412 WORD wType; 413 WCHAR szKey[9]; 414 } STRINGTABLE; 415 416 typedef struct 417 { 418 WORD wLength; 419 WORD wValueLength; 420 WORD wType; 421 } STRINGHDR; 422 423 typedef struct 424 { 425 DWORD Size; 426 DWORD Signature; 427 DWORD HeaderVersion; 428 DWORD SkipData; 429 BYTE Data[168]; 430 } RESOURCE; 431 432 #include <poppack.h> 433 434 struct tagASSEMBLY; 435 typedef struct tagASSEMBLY ASSEMBLY; 436 437 HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file) DECLSPEC_HIDDEN; 438 HRESULT assembly_release(ASSEMBLY *assembly) DECLSPEC_HIDDEN; 439 HRESULT assembly_get_name(ASSEMBLY *assembly, LPWSTR *name) DECLSPEC_HIDDEN; 440 HRESULT assembly_get_path(const ASSEMBLY *assembly, LPWSTR *path) DECLSPEC_HIDDEN; 441 HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version) DECLSPEC_HIDDEN; 442 PEKIND assembly_get_architecture(ASSEMBLY *assembly) DECLSPEC_HIDDEN; 443 HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token) DECLSPEC_HIDDEN; 444 HRESULT assembly_get_runtime_version(ASSEMBLY *assembly, LPSTR *version) DECLSPEC_HIDDEN; 445 HRESULT assembly_get_external_files(ASSEMBLY *assembly, LPWSTR **files, DWORD *count) DECLSPEC_HIDDEN; 446 447 extern HRESULT IAssemblyName_SetPath(IAssemblyName *iface, LPCWSTR path) DECLSPEC_HIDDEN; 448 extern HRESULT IAssemblyName_GetPath(IAssemblyName *iface, LPWSTR buf, ULONG *len) DECLSPEC_HIDDEN; 449 450 static inline LPWSTR strdupW(LPCWSTR src) 451 { 452 LPWSTR dest; 453 454 if (!src) 455 return NULL; 456 457 if ((dest = heap_alloc((lstrlenW(src) + 1) * sizeof(WCHAR)))) 458 lstrcpyW(dest, src); 459 460 return dest; 461 } 462 463 #define BYTES_PER_TOKEN 8 464 #define CHARS_PER_BYTE 2 465 #define TOKEN_LENGTH (BYTES_PER_TOKEN * CHARS_PER_BYTE + 1) 466 467 static inline void token_to_str(BYTE *bytes, LPWSTR str) 468 { 469 DWORD i; 470 471 static const WCHAR hexval[] = { 472 '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f' 473 }; 474 475 for(i = 0; i < BYTES_PER_TOKEN; i++) 476 { 477 str[i * 2] = hexval[((bytes[i] >> 4) & 0xF)]; 478 str[i * 2 + 1] = hexval[(bytes[i]) & 0x0F]; 479 } 480 str[i * 2] = 0; 481 } 482 483 #endif /* __WINE_FUSION_PRIVATE__ */ 484