fusionpriv.h 8.14 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/*
 * fusion private definitions
 *
 * Copyright 2008 James Hawkins
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#ifndef __WINE_FUSION_PRIVATE__
#define __WINE_FUSION_PRIVATE__

#include <stdarg.h>

#include "windef.h"
#include "winbase.h"
#include "winuser.h"
29
#include "winver.h"
30

31 32
#include <pshpack1.h>

33 34 35 36 37 38 39
typedef struct
{
    ULONG Signature;
    USHORT MajorVersion;
    USHORT MinorVersion;
    ULONG Reserved;
    ULONG VersionLength;
40
    LPSTR Version;
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
    BYTE Flags;
    WORD Streams;
} METADATAHDR;

typedef struct
{
    DWORD Offset;
    DWORD Size;
} METADATASTREAMHDR;

typedef struct
{
    DWORD Reserved1;
    BYTE MajorVersion;
    BYTE MinorVersion;
    BYTE HeapOffsetSizes;
    BYTE Reserved2;
    LARGE_INTEGER MaskValid;
    LARGE_INTEGER MaskSorted;
} METADATATABLESHDR;

typedef struct
{
    WORD Generation;
    WORD Name;
    WORD Mvid;
    WORD EncId;
    WORD EncBaseId;
} MODULETABLE;

typedef struct
{
    DWORD Flags;
    WORD Name;
    WORD Namespace;
    WORD Extends;
    WORD FieldList;
    WORD MethodList;
} TYPEDEFTABLE;

typedef struct
{
83
    WORD ResolutionScope;
84 85 86 87
    WORD Name;
    WORD Namespace;
} TYPEREFTABLE;

88 89 90 91 92 93 94
typedef struct
{
    WORD Flags;
    WORD Name;
    WORD Signature;
} FIELDTABLE;

95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
typedef struct
{
    DWORD HashAlgId;
    WORD MajorVersion;
    WORD MinorVersion;
    WORD BuildNumber;
    WORD RevisionNumber;
    DWORD Flags;
    WORD PublicKey;
    WORD Name;
    WORD Culture;
} ASSEMBLYTABLE;

typedef struct
{
    DWORD Offset;
    DWORD Flags;
    WORD Name;
    WORD Implementation;
} MANIFESTRESTABLE;

116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334
typedef struct
{
    DWORD RVA;
    WORD ImplFlags;
    WORD Flags;
    WORD Name;
    WORD Signature;
    WORD ParamList;
} METHODDEFTABLE;

typedef struct
{
    WORD Flags;
    WORD Sequence;
    WORD Name;
} PARAMTABLE;

typedef struct
{
    WORD Class;
    WORD Interface;
} INTERFACEIMPLTABLE;

typedef struct
{
    WORD Class;
    WORD Name;
    WORD Signature;
} MEMBERREFTABLE;

typedef struct
{
    BYTE Type;
    BYTE Reserved;
    WORD Parent;
    WORD Value;
} CONSTANTTABLE;

typedef struct
{
    WORD Parent;
    WORD Type;
    WORD Value;
} CUSTOMATTRIBUTETABLE;

typedef struct
{
    WORD Parent;
    WORD NativeType;
} FIELDMARSHALTABLE;

typedef struct
{
    WORD Action;
    WORD Parent;
    WORD PermissionSet;
} DECLSECURITYTABLE;

typedef struct
{
    WORD PackingSize;
    DWORD ClassSize;
    WORD Parent;
} CLASSLAYOUTTABLE;

typedef struct
{
    DWORD Offset;
    WORD Field;
} FIELDLAYOUTTABLE;

typedef struct
{
    WORD Signature;
} STANDALONESIGTABLE;

typedef struct
{
    WORD Parent;
    WORD EventList;
} EVENTMAPTABLE;

typedef struct
{
    WORD EventFlags;
    WORD Name;
    WORD EventType;
} EVENTTABLE;

typedef struct
{
    WORD Parent;
    WORD PropertyList;
} PROPERTYMAPTABLE;

typedef struct
{
    WORD Flags;
    WORD Name;
    WORD Type;
} PROPERTYTABLE;

typedef struct
{
    WORD Semantics;
    WORD Method;
    WORD Association;
} METHODSEMANTICSTABLE;

typedef struct
{
    WORD Class;
    WORD MethodBody;
    WORD MethodDeclaration;
} METHODIMPLTABLE;

typedef struct
{
    WORD Name;
} MODULEREFTABLE;

typedef struct
{
    WORD Signature;
} TYPESPECTABLE;

typedef struct
{
    WORD MappingFlags;
    WORD MemberForwarded;
    WORD ImportName;
    WORD ImportScope;
} IMPLMAPTABLE;

typedef struct
{
    DWORD RVA;
    WORD Field;
} FIELDRVATABLE;

typedef struct
{
    DWORD Processor;
} ASSEMBLYPROCESSORTABLE;

typedef struct
{
    DWORD OSPlatformID;
    DWORD OSMajorVersion;
    DWORD OSMinorVersion;
} ASSEMBLYOSTABLE;

typedef struct
{
    WORD MajorVersion;
    WORD MinorVersion;
    WORD BuildNumber;
    WORD RevisionNumber;
    DWORD Flags;
    WORD PublickKeyOrToken;
    WORD Name;
    WORD Culture;
    WORD HashValue;
} ASSEMBLYREFTABLE;

typedef struct
{
    DWORD Processor;
    WORD AssemblyRef;
} ASSEMBLYREFPROCESSORTABLE;

typedef struct
{
    DWORD OSPlatformId;
    DWORD OSMajorVersion;
    DWORD OSMinorVersion;
    WORD AssemblyRef;
} ASSEMBLYREFOSTABLE;

typedef struct
{
    DWORD Flags;
    WORD Name;
    WORD HashValue;
} FILETABLE;

typedef struct
{
    DWORD Flags;
    DWORD TypeDefId;
    WORD TypeName;
    WORD TypeNameSpace;
    WORD Implementation;
} EXPORTEDTYPETABLE;

typedef struct
{
    WORD NestedClass;
    WORD EnclosingClass;
} NESTEDCLASSTABLE;

typedef struct
{
    WORD Number;
    WORD Flags;
} GENERICPARAMTABLE;

typedef struct
{
    WORD MethodDef;
    WORD Instantiation;
} METHODSPECTABLE;

typedef struct
{
    WORD Owner;
    WORD Constraint;
} GENERICPARAMCONSTRAINTTABLE;

335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430
typedef struct
{
    DWORD ImportLookupTable;
    DWORD DateTimeStamp;
    DWORD ForwarderChain;
    DWORD Name;
    DWORD ImportAddressTable;
    BYTE pad[20];
} IMPORTTABLE;

typedef struct
{
    DWORD HintNameTableRVA;
    BYTE pad[8];
} IMPORTLOOKUPTABLE;

typedef struct
{
    WORD Hint;
    BYTE Name[12];
    BYTE Module[12];
    DWORD Reserved;
    WORD EntryPoint;
    DWORD RVA;
} HINTNAMETABLE;

typedef struct
{
    DWORD PageRVA;
    DWORD Size;
    DWORD Relocation;
} RELOCATION;

typedef struct
{
    WORD wLength;
    WORD wValueLength;
    WORD wType;
    WCHAR szKey[17];
    VS_FIXEDFILEINFO Value;
} VS_VERSIONINFO;

typedef struct
{
    WORD wLength;
    WORD wValueLength;
    WORD wType;
    WCHAR szKey[13];
} VARFILEINFO;

typedef struct
{
    WORD wLength;
    WORD wValueLength;
    WORD wType;
    WCHAR szKey[13];
    DWORD Value;
} VAR;

typedef struct
{
    WORD wLength;
    WORD wValueLength;
    WORD wType;
    WCHAR szKey[15];
} STRINGFILEINFO;

typedef struct
{
    WORD wLength;
    WORD wValueLength;
    WORD wType;
    WCHAR szKey[9];
} STRINGTABLE;

typedef struct
{
    WORD wLength;
    WORD wValueLength;
    WORD wType;
} STRINGHDR;

typedef struct
{
    DWORD Size;
    DWORD Signature;
    DWORD HeaderVersion;
    DWORD SkipData;
    BYTE Data[168];
} RESOURCE;

#include <poppack.h>

struct tagASSEMBLY;
typedef struct tagASSEMBLY ASSEMBLY;

431 432 433 434 435
HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file) DECLSPEC_HIDDEN;
HRESULT assembly_release(ASSEMBLY *assembly) DECLSPEC_HIDDEN;
HRESULT assembly_get_name(ASSEMBLY *assembly, LPWSTR *name) DECLSPEC_HIDDEN;
HRESULT assembly_get_path(const ASSEMBLY *assembly, LPWSTR *path) DECLSPEC_HIDDEN;
HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version) DECLSPEC_HIDDEN;
436
PEKIND assembly_get_architecture(ASSEMBLY *assembly) DECLSPEC_HIDDEN;
437
HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token) DECLSPEC_HIDDEN;
438
HRESULT assembly_get_runtime_version(ASSEMBLY *assembly, LPSTR *version) DECLSPEC_HIDDEN;
439
HRESULT assembly_get_external_files(ASSEMBLY *assembly, LPWSTR **files, DWORD *count) DECLSPEC_HIDDEN;
440 441 442

extern HRESULT IAssemblyName_SetPath(IAssemblyName *iface, LPCWSTR path) DECLSPEC_HIDDEN;
extern HRESULT IAssemblyName_GetPath(IAssemblyName *iface, LPWSTR buf, ULONG *len) DECLSPEC_HIDDEN;
443

444 445 446 447 448 449 450 451 452 453 454 455 456 457
static inline LPWSTR strdupW(LPCWSTR src)
{
    LPWSTR dest;

    if (!src)
        return NULL;

    dest = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(src) + 1) * sizeof(WCHAR));
    if (dest)
        lstrcpyW(dest, src);

    return dest;
}

458 459 460 461 462 463 464 465
#define BYTES_PER_TOKEN 8
#define CHARS_PER_BYTE  2
#define TOKEN_LENGTH    (BYTES_PER_TOKEN * CHARS_PER_BYTE + 1)

static inline void token_to_str(BYTE *bytes, LPWSTR str)
{
    DWORD i;

466
    static const WCHAR hexval[] = {
467 468 469 470 471 472 473 474 475 476 477
        '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'
    };

    for(i = 0; i < BYTES_PER_TOKEN; i++)
    {
        str[i * 2] = hexval[((bytes[i] >> 4) & 0xF)];
        str[i * 2 + 1] = hexval[(bytes[i]) & 0x0F];
    }
    str[i * 2] = 0;
}

478
#endif /* __WINE_FUSION_PRIVATE__ */