Rebase against 292b728908563952f56b0585d072f3d7a08e93b2.

This commit is contained in:
Zebediah Figura
2019-11-12 19:56:51 -06:00
parent 8148194353
commit ef0e88407e
10 changed files with 181 additions and 404 deletions

View File

@@ -1,37 +0,0 @@
From 9a73838c005c3bdb74a449bb7afb269112d6ae34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 20 Jan 2017 01:35:05 +0100
Subject: ole32: Correctly parse unicode property storage dictionaries.
---
dlls/ole32/stg_prop.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c
index a2598832bf1..f952704c7cd 100644
--- a/dlls/ole32/stg_prop.c
+++ b/dlls/ole32/stg_prop.c
@@ -1020,15 +1020,18 @@ static HRESULT PropertyStorage_ReadDictionary(PropertyStorage_impl *This,
if (This->codePage != CP_UNICODE)
ptr[cbEntry - 1] = '\0';
else
- *((LPWSTR)ptr + cbEntry / sizeof(WCHAR)) = '\0';
+ ((LPWSTR)ptr)[cbEntry - 1] = 0;
hr = PropertyStorage_StoreNameWithId(This, (char*)ptr, This->codePage, propid);
if (This->codePage == CP_UNICODE)
{
+ /* cbEntry is the number of characters */
+ cbEntry *= 2;
+
/* Unicode entries are padded to DWORD boundaries */
if (cbEntry % sizeof(DWORD))
ptr += sizeof(DWORD) - (cbEntry % sizeof(DWORD));
}
- ptr += sizeof(DWORD) + cbEntry;
+ ptr += cbEntry;
}
return hr;
}
--
2.11.0

View File

@@ -1,135 +0,0 @@
From d56a94164cbe82bd3760a921e6eff029b62af63e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 20 Jan 2017 01:42:07 +0100
Subject: [PATCH] ole32: Implement returning a name in IEnumSTATPROPSTG.
---
dlls/ole32/enumx.c | 16 ++++++++++++++--
dlls/ole32/enumx.h | 5 ++++-
dlls/ole32/stg_prop.c | 25 ++++++++++++++++++++++++-
3 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/dlls/ole32/enumx.c b/dlls/ole32/enumx.c
index 4279ca81fa9..2b53810dad9 100644
--- a/dlls/ole32/enumx.c
+++ b/dlls/ole32/enumx.c
@@ -41,6 +41,8 @@ struct tagEnumSTATPROPSETSTG_impl
struct list *current;
ULONG elem_size;
GUID riid;
+ IUnknown *parent;
+ enumx_copy_cb copy_cb;
};
/************************************************************************
@@ -91,6 +93,7 @@ ULONG WINAPI enumx_Release(enumx_impl *This)
list_remove(x);
HeapFree(GetProcessHeap(), 0, x);
}
+ IUnknown_Release(This->parent);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
@@ -112,7 +115,10 @@ HRESULT WINAPI enumx_Next(enumx_impl *This, ULONG celt,
p = rgelt;
while (count < celt && This->current && This->current != &This->elements)
{
- memcpy(p, &This->current[1], This->elem_size);
+ if (This->copy_cb)
+ This->copy_cb(This->parent, &This->current[1], p);
+ else
+ memcpy(p, &This->current[1], This->elem_size);
p += This->elem_size;
This->current = This->current->next;
count++;
@@ -169,7 +175,8 @@ HRESULT WINAPI enumx_Clone(
*
* Allocate a generic enumerator
*/
-enumx_impl *enumx_allocate(REFIID riid, const void *vtbl, ULONG elem_size)
+enumx_impl *enumx_allocate(REFIID riid, const void *vtbl, ULONG elem_size,
+ IUnknown *parent, enumx_copy_cb copy_cb)
{
enumx_impl *enumx;
@@ -181,6 +188,11 @@ enumx_impl *enumx_allocate(REFIID riid, const void *vtbl, ULONG elem_size)
enumx->current = NULL;
enumx->elem_size = elem_size;
enumx->riid = *riid;
+ enumx->parent = parent;
+ enumx->copy_cb = copy_cb;
+
+ IUnknown_AddRef(parent);
+
list_init(&enumx->elements);
}
diff --git a/dlls/ole32/enumx.h b/dlls/ole32/enumx.h
index da76e13769b..8a2a2b354d8 100644
--- a/dlls/ole32/enumx.h
+++ b/dlls/ole32/enumx.h
@@ -21,6 +21,8 @@
typedef struct tagEnumSTATPROPSETSTG_impl enumx_impl;
+typedef void (*enumx_copy_cb)(IUnknown *parent, void *orig, void *dest);
+
extern HRESULT WINAPI enumx_QueryInterface(enumx_impl *, REFIID, void**) DECLSPEC_HIDDEN;
extern ULONG WINAPI enumx_AddRef(enumx_impl *) DECLSPEC_HIDDEN;
extern ULONG WINAPI enumx_Release(enumx_impl *) DECLSPEC_HIDDEN;
@@ -28,7 +30,8 @@ extern HRESULT WINAPI enumx_Next(enumx_impl *, ULONG, void *, ULONG *) DECLSPEC_
extern HRESULT WINAPI enumx_Skip(enumx_impl *, ULONG) DECLSPEC_HIDDEN;
extern HRESULT WINAPI enumx_Reset(enumx_impl *) DECLSPEC_HIDDEN;
extern HRESULT WINAPI enumx_Clone(enumx_impl *, enumx_impl **) DECLSPEC_HIDDEN;
-extern enumx_impl *enumx_allocate(REFIID, const void *, ULONG) DECLSPEC_HIDDEN;
+extern enumx_impl *enumx_allocate(REFIID, const void *, ULONG,
+ IUnknown *, enumx_copy_cb) DECLSPEC_HIDDEN;
extern void *enumx_add_element(enumx_impl *, const void *) DECLSPEC_HIDDEN;
#endif
diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c
index 989e68b830d..eb98a7d2516 100644
--- a/dlls/ole32/stg_prop.c
+++ b/dlls/ole32/stg_prop.c
@@ -2571,6 +2571,27 @@ static HRESULT WINAPI IEnumSTATPROPSTG_fnClone(
return enumx_Clone((enumx_impl*)iface, (enumx_impl**)ppenum);
}
+static void prop_enum_copy_cb(IUnknown *parent, void *orig, void *dest)
+{
+ PropertyStorage_impl *storage = impl_from_IPropertyStorage((IPropertyStorage*)parent);
+ STATPROPSTG *src_prop = orig;
+ STATPROPSTG *dest_prop = dest;
+ LPWSTR name;
+
+ dest_prop->propid = src_prop->propid;
+ dest_prop->vt = src_prop->vt;
+ dest_prop->lpwstrName = NULL;
+
+ if (dictionary_find(storage->propid_to_name, UlongToPtr(src_prop->propid), (void**)&name))
+ {
+ DWORD size = (lstrlenW(name) + 1) * sizeof(WCHAR);
+
+ dest_prop->lpwstrName = CoTaskMemAlloc(size);
+ if (!dest_prop->lpwstrName) return;
+ memcpy(dest_prop->lpwstrName, name, size);
+ }
+}
+
static BOOL prop_enum_stat(const void *k, const void *v, void *extra, void *arg)
{
enumx_impl *enumx = arg;
@@ -2597,7 +2618,9 @@ static HRESULT create_EnumSTATPROPSTG(
enumx = enumx_allocate(&IID_IEnumSTATPROPSTG,
&IEnumSTATPROPSTG_Vtbl,
- sizeof (STATPROPSTG));
+ sizeof (STATPROPSTG),
+ (IUnknown*)&This->IPropertyStorage_iface,
+ prop_enum_copy_cb);
dictionary_enumerate(This->propid_to_prop, prop_enum_stat, enumx);
--
2.24.0.rc1

View File

@@ -1,2 +0,0 @@
Fixes: [42046] Multiple fixes for ole32 property storage
Disabled: true