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