Module: wine Branch: master Commit: b3a08339728acb19fb86d860c9368e8e3beedb09 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b3a08339728acb19fb86d860c9...
Author: Alexandre Julliard julliard@winehq.org Date: Thu May 21 11:10:22 2009 +0200
widl: Add support for writing 64-bit format typelibs.
---
tools/widl/hash.c | 1 + tools/widl/hash.h | 6 ------ tools/widl/widl.c | 1 + tools/widl/widltypes.h | 8 ++++++++ tools/widl/write_msft.c | 10 ++++++---- 5 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/tools/widl/hash.c b/tools/widl/hash.c index e09848e..bd20995 100644 --- a/tools/widl/hash.c +++ b/tools/widl/hash.c @@ -25,6 +25,7 @@ #include "winbase.h" #include "winnls.h"
+#include "widltypes.h" #include "hash.h"
static const unsigned char Lookup_16[128 * 3] = { diff --git a/tools/widl/hash.h b/tools/widl/hash.h index d859eae..3c2fd29 100644 --- a/tools/widl/hash.h +++ b/tools/widl/hash.h @@ -22,12 +22,6 @@ #ifndef __WIDL_HASH_H #define __WIDL_HASH_H
-typedef enum tag_syskind_t { - SYS_WIN16 = 0, - SYS_WIN32, - SYS_MAC -} syskind_t; - extern unsigned int lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr);
#endif diff --git a/tools/widl/widl.c b/tools/widl/widl.c index cbc35b7..6ae8bae 100644 --- a/tools/widl/widl.c +++ b/tools/widl/widl.c @@ -135,6 +135,7 @@ FILE *header; FILE *idfile;
size_t pointer_size = 0; +syskind_t typelib_kind = sizeof(void*) == 8 ? SYS_WIN64 : SYS_WIN32;
time_t now;
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index 7a194f4..f5466bf 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -487,6 +487,14 @@ struct _statement_t { } u; };
+typedef enum { + SYS_WIN16, + SYS_WIN32, + SYS_MAC, + SYS_WIN64 +} syskind_t; + +extern syskind_t typelib_kind; extern user_type_list_t user_type_list; void check_for_additional_prototype_types(const var_list_t *list);
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c index 3506efe..bff61fd 100644 --- a/tools/widl/write_msft.c +++ b/tools/widl/write_msft.c @@ -45,7 +45,7 @@ #include "winbase.h" #include "winnls.h"
-#include "widltypes.h" +#include "widl.h" #include "typelib.h" #include "typelib_struct.h" #include "utils.h" @@ -1543,7 +1543,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
/* adjust size of VTBL */ if(funckind != 0x3 /* FUNC_STATIC */) - typeinfo->typeinfo->cbSizeVft += 4; + typeinfo->typeinfo->cbSizeVft += pointer_size;
/* Increment the number of function elements */ typeinfo->typeinfo->cElement += 1; @@ -2031,7 +2031,7 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface) } } msft_typeinfo->typeinfo->datatype2 = num_funcs << 16 | num_parents; - msft_typeinfo->typeinfo->cbSizeVft = num_funcs * 4; + msft_typeinfo->typeinfo->cbSizeVft = num_funcs * pointer_size;
STATEMENTS_FOR_EACH_FUNC( stmt_func, type_iface_get_stmts(interface) ) { var_t *func = stmt_func->u.var; @@ -2539,6 +2539,8 @@ int create_msft_typelib(typelib_t *typelib) GUID midl_time_guid = {0xde77ba63,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; GUID midl_version_guid = {0xde77ba64,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}};
+ pointer_size = (typelib_kind == SYS_WIN64) ? 8 : 4; + msft = xmalloc(sizeof(*msft)); memset(msft, 0, sizeof(*msft)); msft->typelib = typelib; @@ -2546,7 +2548,7 @@ int create_msft_typelib(typelib_t *typelib) ctl2_init_header(msft); ctl2_init_segdir(msft);
- msft->typelib_header.varflags |= SYS_WIN32; + msft->typelib_header.varflags |= typelib_kind;
/* * The following two calls return an offset or -1 if out of memory. We