Rebase against d07019e4d174fd1b5d8b74ff2a36e900c07d96d7.

This commit is contained in:
Alistair Leslie-Hughes 2024-04-24 07:57:47 +10:00
parent 0c32c319e2
commit a9bf69097e
6 changed files with 5 additions and 393 deletions

View File

@ -1,4 +1,4 @@
From 683fab1d88342c11a52ac3b919964837e6f36823 Mon Sep 17 00:00:00 2001
From ef7171d2eb01b4b8aaf8c4c608ceebd698d96e3c Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 22 Mar 2016 21:54:26 +0100
Subject: [PATCH] d2d1: Avoid implicit cast of interface pointer.
@ -66,15 +66,15 @@ index 75cd72b5b9f..314123373b7 100644
static HRESULT STDMETHODCALLTYPE d2d_bitmap_brush_QueryInterface(ID2D1BitmapBrush1 *iface,
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index dced9847390..e86e1945bdd 100644
index c0ac5ba9a44..e171c1c6bd8 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -697,7 +697,7 @@ struct d2d_factory
static inline struct d2d_factory *unsafe_impl_from_ID2D1Factory(ID2D1Factory *iface)
{
- return CONTAINING_RECORD(iface, struct d2d_factory, ID2D1Factory3_iface);
+ return CONTAINING_RECORD((ID2D1Factory3*)iface, struct d2d_factory, ID2D1Factory3_iface);
- return CONTAINING_RECORD(iface, struct d2d_factory, ID2D1Factory7_iface);
+ return CONTAINING_RECORD((ID2D1Factory7*)iface, struct d2d_factory, ID2D1Factory7_iface);
}
void d2d_effects_init_builtins(struct d2d_factory *factory);

View File

@ -1,92 +0,0 @@
From 547416b9ea25c0aa2841b36ed0332304ac70d568 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 20 Jan 2016 11:04:00 +0800
Subject: widl: Make automatic dispid generation scheme better match what midl
does.
---
tools/widl/write_sltg.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/tools/widl/write_sltg.c b/tools/widl/write_sltg.c
index c8a8cfb..ffecb59 100644
--- a/tools/widl/write_sltg.c
+++ b/tools/widl/write_sltg.c
@@ -1087,11 +1087,9 @@ static importinfo_t *find_importinfo(typelib_t *typelib, const char *name)
static int get_func_flags(const var_t *func, int *dispid, int *invokekind, int *helpcontext, const char **helpstring)
{
- static int dispid_base = 0x60000000;
const attr_t *attr;
int flags;
- *dispid = dispid_base++;
*invokekind = 1 /* INVOKE_FUNC */;
*helpcontext = -2;
*helpstring = NULL;
@@ -1169,17 +1167,17 @@ static int get_func_flags(const var_t *func, int *dispid, int *invokekind, int *
}
static int add_func_desc(struct sltg_typelib *typelib, struct sltg_data *data, var_t *func,
- int idx, short base_offset, struct sltg_hrefmap *hrefmap)
+ int idx, int dispid, short base_offset, struct sltg_hrefmap *hrefmap)
{
struct sltg_data ret_data, *arg_data;
int arg_count = 0, arg_data_size, optional = 0, defaults = 0, old_size;
- int funcflags = 0, dispid, invokekind = 1 /* INVOKE_FUNC */, helpcontext;
+ int funcflags = 0, invokekind = 1 /* INVOKE_FUNC */, helpcontext;
const char *helpstring;
const var_t *arg;
short ret_desc_offset, *arg_desc_offset, arg_offset;
struct sltg_function func_desc;
- chat("add_func_desc: %s, idx %#x\n", func->name, idx);
+ chat("add_func_desc: %s, idx %#x, dispid %#x\n", func->name, idx, dispid);
old_size = data->size;
@@ -1360,6 +1358,7 @@ static void add_interface_typeinfo(struct sltg_typelib *typelib, type_t *iface)
struct sltg_tail tail;
int member_offset, base_offset, func_data_size, i;
int func_count, inherited_func_count = 0;
+ int dispid, inherit_level = 0;
if (iface->typelib_idx != -1) return;
@@ -1400,6 +1399,7 @@ static void add_interface_typeinfo(struct sltg_typelib *typelib, type_t *iface)
while (inherit)
{
+ inherit_level++;
inherited_func_count += list_count(type_iface_get_stmts(inherit));
inherit = type_iface_get_inherit(inherit);
}
@@ -1415,7 +1415,7 @@ static void add_interface_typeinfo(struct sltg_typelib *typelib, type_t *iface)
STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(iface))
{
- add_func_desc(typelib, &data, stmt_func->u.var, -1, -1, &hrefmap);
+ add_func_desc(typelib, &data, stmt_func->u.var, -1, -1, -1, &hrefmap);
}
func_data_size = data.size;
@@ -1450,13 +1450,15 @@ static void add_interface_typeinfo(struct sltg_typelib *typelib, type_t *iface)
write_impl_href(&data, inherit_href);
i = 0;
+ dispid = 0x60000000 | (inherit_level << 16);
STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(iface))
{
if (i == func_count - 1) i |= 0x80000000;
base_offset += add_func_desc(typelib, &data, stmt_func->u.var,
- inherited_func_count + i, base_offset, &hrefmap);
+ inherited_func_count + i,
+ dispid++, base_offset, &hrefmap);
i++;
}
--
2.6.4

View File

@ -1,105 +0,0 @@
From 0a528bf3c1c5b19f497e1a9f0848b6e191394a88 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 20 Jan 2016 13:26:49 +0800
Subject: widl: Create library block index right after the CompObj one.
Otherwise Wine's oleaut32 refuses to load a typelib.
---
tools/widl/write_sltg.c | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/tools/widl/write_sltg.c b/tools/widl/write_sltg.c
index 79c0f0ee..650fdfa7 100644
--- a/tools/widl/write_sltg.c
+++ b/tools/widl/write_sltg.c
@@ -374,15 +374,13 @@ static void init_library(struct sltg_typelib *sltg)
}
}
-static void add_block(struct sltg_typelib *sltg, void *data, int size, const char *name)
+static void add_block_index(struct sltg_typelib *sltg, void *data, int size, int index)
{
struct sltg_block *block = xmalloc(sizeof(*block));
- chat("add_block: %p,%d,\"%s\"\n", data, size, name);
-
block->length = size;
block->data = data;
- block->index_string = add_index(&sltg->index, name);
+ block->index_string = index;
block->next = NULL;
if (sltg->blocks)
@@ -400,17 +398,28 @@ static void add_block(struct sltg_typelib *sltg, void *data, int size, const cha
sltg->n_file_blocks++;
}
-static void add_library_block(struct sltg_typelib *typelib)
+static void add_block(struct sltg_typelib *sltg, void *data, int size, const char *name)
+{
+ struct sltg_block *block = xmalloc(sizeof(*block));
+ int index;
+
+ chat("add_block: %p,%d,\"%s\"\n", data, size, name);
+
+ index = add_index(&sltg->index, name);
+
+ add_block_index(sltg, data, size, index);
+}
+
+static void *create_library_block(struct sltg_typelib *typelib, int *size, int *index)
{
void *block;
short *p;
- int size;
- size = sizeof(short) * 9 + sizeof(int) * 3 + sizeof(GUID);
- if (typelib->library.helpstring) size += strlen(typelib->library.helpstring);
- if (typelib->library.helpfile) size += strlen(typelib->library.helpfile);
+ *size = sizeof(short) * 9 + sizeof(int) * 3 + sizeof(GUID);
+ if (typelib->library.helpstring) *size += strlen(typelib->library.helpstring);
+ if (typelib->library.helpfile) *size += strlen(typelib->library.helpfile);
- block = xmalloc(size);
+ block = xmalloc(*size);
p = block;
*p++ = 0x51cc; /* magic */
*p++ = 3; /* res02 */
@@ -443,7 +452,9 @@ static void add_library_block(struct sltg_typelib *typelib)
p += 2;
*(GUID *)p = typelib->library.uuid;
- add_block(typelib, block, size, "dir");
+ *index = add_index(&typelib->index, "dir");
+
+ return block;
}
static const char *new_index_name(void)
@@ -1763,6 +1774,8 @@ int create_sltg_typelib(typelib_t *typelib)
{
struct sltg_typelib sltg;
const statement_t *stmt;
+ void *library_block;
+ int library_block_size, library_block_index;
sltg.typelib = typelib;
sltg.typeinfo_count = 0;
@@ -1776,11 +1789,13 @@ int create_sltg_typelib(typelib_t *typelib)
init_name_table(&sltg);
init_library(&sltg);
+ library_block = create_library_block(&sltg, &library_block_size, &library_block_index);
+
if (typelib->stmts)
LIST_FOR_EACH_ENTRY(stmt, typelib->stmts, const statement_t, entry)
add_statement(&sltg, stmt);
- add_library_block(&sltg);
+ add_block_index(&sltg, library_block, library_block_size, library_block_index);
save_all_changes(&sltg);
--
2.19.1

View File

@ -1,45 +0,0 @@
From f52df44c1930e62fa9096f24ba8b1b84765c0e34 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Mon, 25 Jan 2016 15:05:03 +0800
Subject: widl: Set the lowest bit in the param name to indicate whether type
description follows the name.
It looks like the lowest bit in the param name offset actually indicates
whether type description follows the name, and since the name offsets are
always aligned that makes sense.
This makes oleview.exe from PSDK running under Windows7 correctly show mix
of different very complex and relatively simple type descriptions generated
by widl's SLTG generator.
---
tools/widl/write_sltg.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/widl/write_sltg.c b/tools/widl/write_sltg.c
index acfc039..2ec1770 100644
--- a/tools/widl/write_sltg.c
+++ b/tools/widl/write_sltg.c
@@ -1307,7 +1307,6 @@ static int add_func_desc(struct sltg_typelib *typelib, struct sltg_data *data, v
short name, type_offset;
name = base_offset != -1 ? add_name(typelib, arg->name) : -1;
- append_data(data, &name, sizeof(name));
if (arg_data[i].size > sizeof(short))
{
@@ -1315,8 +1314,12 @@ static int add_func_desc(struct sltg_typelib *typelib, struct sltg_data *data, v
arg_offset += arg_data[i].size;
}
else
+ {
+ name |= 1;
type_offset = *(short *)arg_data[i].data;
+ }
+ append_data(data, &name, sizeof(name));
append_data(data, &type_offset, sizeof(type_offset));
if (base_offset != -1)
--
2.6.4

View File

@ -1,146 +0,0 @@
From b8438563c713d08601c86895f12e8a40e3f2f54d Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Mon, 25 Jan 2016 15:26:12 +0800
Subject: [PATCH] widl: Add support for function parameter flags to SLTG
typelib generator.
This makes stdole32.tlb generated by widl have proper [in,out,retval]
parameter flags.
---
tools/widl/write_sltg.c | 71 +++++++++++++++++++++++++++++++++++------
1 file changed, 61 insertions(+), 10 deletions(-)
diff --git a/tools/widl/write_sltg.c b/tools/widl/write_sltg.c
index 68d1241d61c..b122e0dc389 100644
--- a/tools/widl/write_sltg.c
+++ b/tools/widl/write_sltg.c
@@ -794,8 +794,8 @@ static int local_href(struct sltg_hrefmap *hrefmap, int typelib_href)
return href << 2;
}
-static short write_var_desc(struct sltg_typelib *typelib, struct sltg_data *data, type_t *type, short flags,
- short base_offset, int *size_instance, struct sltg_hrefmap *hrefmap)
+static short write_var_desc(struct sltg_typelib *typelib, struct sltg_data *data, type_t *type, short param_flags,
+ short flags, short base_offset, int *size_instance, struct sltg_hrefmap *hrefmap)
{
short vt, vt_flags, desc_offset;
@@ -887,19 +887,20 @@ static short write_var_desc(struct sltg_typelib *typelib, struct sltg_data *data
if (is_ptr(ref))
{
- chat("write_var_desc: vt VT_PTR | 0x0400\n");
- vt = VT_PTR | 0x0400;
+ chat("write_var_desc: vt VT_PTR | 0x0400 | %04x\n", param_flags);
+ vt = VT_PTR | 0x0400 | param_flags;
+ param_flags = 0;
append_data(data, &vt, sizeof(vt));
- write_var_desc(typelib, data, ref, 0, base_offset, size_instance, hrefmap);
+ write_var_desc(typelib, data, ref, param_flags, 0, base_offset, size_instance, hrefmap);
}
else
- write_var_desc(typelib, data, ref, 0x0e00, base_offset, size_instance, hrefmap);
+ write_var_desc(typelib, data, ref, param_flags, 0x0e00, base_offset, size_instance, hrefmap);
return desc_offset;
}
chat("write_var_desc: vt %d, flags %04x\n", vt, flags);
- vt_flags = vt | flags;
+ vt_flags = vt | flags | param_flags;
append_data(data, &vt_flags, sizeof(vt_flags));
if (vt == VT_USERDEFINED)
@@ -994,7 +995,8 @@ static void add_structure_typeinfo(struct sltg_typelib *typelib, type_t *type)
init_sltg_data(&var_data[i]);
base_offset = var_data_size + (i + 1) * sizeof(struct sltg_variable);
- type_desc_offset[i] = write_var_desc(typelib, &var_data[i], var->declspec.type, 0, base_offset, &size_instance, &hrefmap);
+ type_desc_offset[i] = write_var_desc(typelib, &var_data[i], var->declspec.type, 0, 0,
+ base_offset, &size_instance, &hrefmap);
dump_var_desc(var_data[i].data, var_data[i].size);
if (var_data[i].size > sizeof(short))
@@ -1177,6 +1179,52 @@ static int get_func_flags(const var_t *func, int *dispid, int *invokekind, int *
return flags;
}
+static int get_param_flags(const var_t *param)
+{
+ const attr_t *attr;
+ int flags, in, out;
+
+ if (!param->attrs) return 0;
+
+ flags = 0;
+ in = out = 0;
+
+ LIST_FOR_EACH_ENTRY(attr, param->attrs, const attr_t, entry)
+ {
+ switch(attr->type)
+ {
+ case ATTR_IN:
+ in++;
+ break;
+ case ATTR_OUT:
+ out++;
+ break;
+ case ATTR_PARAMLCID:
+ flags |= 0x2000;
+ break;
+ case ATTR_RETVAL:
+ flags |= 0x80;
+ break;
+ default:
+ chat("unhandled param attr %d\n", attr->type);
+ break;
+ }
+ }
+
+ if (out)
+ {
+ if (in)
+ flags |= 0x8000;
+ else
+ flags |= 0x4000;
+ }
+ else if (!in)
+ flags |= 0xc000;
+
+ return flags;
+}
+
+
static int add_func_desc(struct sltg_typelib *typelib, struct sltg_data *data, var_t *func,
int idx, int dispid, short base_offset, struct sltg_hrefmap *hrefmap)
{
@@ -1194,7 +1242,7 @@ static int add_func_desc(struct sltg_typelib *typelib, struct sltg_data *data, v
init_sltg_data(&ret_data);
ret_desc_offset = write_var_desc(typelib, &ret_data, type_function_get_rettype(func->declspec.type),
- 0, base_offset, NULL, hrefmap);
+ 0, 0, base_offset, NULL, hrefmap);
dump_var_desc(ret_data.data, ret_data.size);
arg_data_size = 0;
@@ -1220,13 +1268,16 @@ static int add_func_desc(struct sltg_typelib *typelib, struct sltg_data *data, v
LIST_FOR_EACH_ENTRY(arg, type_function_get_args(func->declspec.type), const var_t, entry)
{
const attr_t *attr;
+ short param_flags = get_param_flags(arg);
chat("add_func_desc: arg[%d] %p (%s), type %p (%s)\n",
i, arg, arg->name, arg->declspec.type, arg->declspec.type->name);
init_sltg_data(&arg_data[i]);
- arg_desc_offset[i] = write_var_desc(typelib, &arg_data[i], arg->declspec.type, 0, arg_offset, NULL, hrefmap);
+
+ arg_desc_offset[i] = write_var_desc(typelib, &arg_data[i], arg->declspec.type, param_flags, 0,
+ arg_offset, NULL, hrefmap);
dump_var_desc(arg_data[i].data, arg_data[i].size);
if (arg_data[i].size > sizeof(short))
--
2.17.1

View File

@ -1 +1 @@
166895ae3ad3890ad946a309d0fd85e89ea3630e
d07019e4d174fd1b5d8b74ff2a36e900c07d96d7