Author: akhaldi Date: Sun Mar 5 21:03:00 2017 New Revision: 74094
URL: http://svn.reactos.org/svn/reactos?rev=74094&view=rev Log: [OLE32] Sync with Wine Staging 2.2. CORE-12823
23607d0 ole32: Implement returning a name in IEnumSTATPROPSTG. 5cf1db5 ole32: Support reading VT_BOOL, VT_R8 and VT_I8 into propery storage. 591c9c8 ole32: Correctly parse unicode property storage dictionaries. 93a8ede ole32: Add a __WINE_ALLOC_SIZE attribute to heap_alloc(). 182fad8 ole32: Call GetClipboardFormatName with the correct parameters. e31dd0f ole32: Use a HWND_MESSAGE window for the clipboard. c85eaae ole32: Only trace a clipboard format name if it has one. 77e566a ole32: Don't set zero-size clipboard data, this no longer works.
Modified: trunk/reactos/dll/win32/ole32/clipboard.c trunk/reactos/dll/win32/ole32/compobj_private.h trunk/reactos/dll/win32/ole32/enumx.c trunk/reactos/dll/win32/ole32/enumx.h trunk/reactos/dll/win32/ole32/ole32.spec trunk/reactos/dll/win32/ole32/stg_prop.c trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/ole32/clipboard.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/clipboard.c... ============================================================================== --- trunk/reactos/dll/win32/ole32/clipboard.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/clipboard.c [iso-8859-1] Sun Mar 5 21:03:00 2017 @@ -1094,7 +1094,7 @@
h = GetClipboardData(wine_marshal_clipboard_format); if(!h) return S_FALSE; - if(GlobalSize(h) == 0) return S_FALSE; + if(GlobalSize(h) <= 1) return S_FALSE; ptr = GlobalLock(h); if(!ptr) return S_FALSE;
@@ -1182,9 +1182,11 @@
for(cf = 0; (cf = EnumClipboardFormats(cf)) != 0; count++) { - char buf[100]; - GetClipboardFormatNameA(cf, buf, sizeof(buf)); - TRACE("cf %04x %s\n", cf, buf); + WCHAR buf[256]; + if (GetClipboardFormatNameW(cf, buf, sizeof(buf) / sizeof(WCHAR))) + TRACE("cf %04x %s\n", cf, debugstr_w(buf)); + else + TRACE("cf %04x\n", cf); } TRACE("count %d\n", count); size += count * sizeof(ret->entries[0]); @@ -1941,7 +1943,7 @@ dup_global_mem(h_stm, GMEM_DDESHARE|GMEM_MOVEABLE, &h); } else /* flushed */ - h = GlobalAlloc(GMEM_DDESHARE|GMEM_MOVEABLE, 0); + h = GlobalAlloc(GMEM_DDESHARE|GMEM_MOVEABLE, 1);
if(!h) return E_OUTOFMEMORY;
@@ -2084,8 +2086,7 @@ RegisterClassExW(&class);
return CreateWindowW(clipbrd_wndclass, title, WS_POPUP | WS_CLIPSIBLINGS | WS_OVERLAPPED, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, NULL, hinst, 0); + 0, 0, 0, 0, HWND_MESSAGE, NULL, hinst, 0); }
/*********************************************************************
Modified: trunk/reactos/dll/win32/ole32/compobj_private.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/compobj_pri... ============================================================================== --- trunk/reactos/dll/win32/ole32/compobj_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/compobj_private.h [iso-8859-1] Sun Mar 5 21:03:00 2017 @@ -309,7 +309,7 @@
extern const char *debugstr_formatetc(const FORMATETC *formatetc) DECLSPEC_HIDDEN;
-static inline void *heap_alloc(size_t len) +static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t len) { return HeapAlloc(GetProcessHeap(), 0, len); }
Modified: trunk/reactos/dll/win32/ole32/enumx.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/enumx.c?rev... ============================================================================== --- trunk/reactos/dll/win32/ole32/enumx.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/enumx.c [iso-8859-1] Sun Mar 5 21:03:00 2017 @@ -30,6 +30,8 @@ struct list *current; ULONG elem_size; GUID riid; + IUnknown *parent; + enumx_copy_cb copy_cb; };
/************************************************************************ @@ -80,6 +82,7 @@ list_remove(x); HeapFree(GetProcessHeap(), 0, x); } + IUnknown_Release(This->parent); HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -101,7 +104,10 @@ 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++; @@ -158,7 +164,8 @@ * * 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;
@@ -170,6 +177,11 @@ 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); }
Modified: trunk/reactos/dll/win32/ole32/enumx.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/enumx.h?rev... ============================================================================== --- trunk/reactos/dll/win32/ole32/enumx.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/enumx.h [iso-8859-1] Sun Mar 5 21:03:00 2017 @@ -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_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 /* __OLE_ENUM_H__ */
Modified: trunk/reactos/dll/win32/ole32/ole32.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32.spec?... ============================================================================== --- trunk/reactos/dll/win32/ole32/ole32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/ole32.spec [iso-8859-1] Sun Mar 5 21:03:00 2017 @@ -45,7 +45,7 @@ @ stdcall CoGetDefaultContext(long ptr ptr) @ stdcall CoGetInstanceFromFile(ptr ptr ptr long long wstr long ptr) @ stdcall CoGetInstanceFromIStorage(ptr ptr ptr long ptr long ptr) -# CoGetInterceptor +@ stdcall -stub CoGetInterceptor(ptr ptr ptr ptr) # CoGetInterceptorFromTypeInfo @ stdcall CoGetInterfaceAndReleaseStream(ptr ptr ptr) @ stdcall CoGetMalloc(long ptr)
Modified: trunk/reactos/dll/win32/ole32/stg_prop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/stg_prop.c?... ============================================================================== --- trunk/reactos/dll/win32/ole32/stg_prop.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/stg_prop.c [iso-8859-1] Sun Mar 5 21:03:00 2017 @@ -1004,15 +1004,18 @@ 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; } @@ -1052,6 +1055,10 @@ case VT_UI1: prop->u.bVal = *data; TRACE("Read byte 0x%x\n", prop->u.bVal); + break; + case VT_BOOL: + StorageUtl_ReadWord(data, 0, (WORD*)&prop->u.boolVal); + TRACE("Read bool %d\n", prop->u.boolVal); break; case VT_I2: StorageUtl_ReadWord(data, 0, (WORD*)&prop->u.iVal); @@ -1070,6 +1077,18 @@ case VT_UI4: StorageUtl_ReadDWord(data, 0, &prop->u.ulVal); TRACE("Read ulong %d\n", prop->u.ulVal); + break; + case VT_I8: + StorageUtl_ReadULargeInteger(data, 0, (ULARGE_INTEGER *)&prop->u.hVal); + TRACE("Read long long %s\n", wine_dbgstr_longlong(prop->u.hVal.QuadPart)); + break; + case VT_UI8: + StorageUtl_ReadULargeInteger(data, 0, &prop->u.uhVal); + TRACE("Read ulong long %s\n", wine_dbgstr_longlong(prop->u.uhVal.QuadPart)); + break; + case VT_R8: + memcpy(&prop->u.dblVal, data, sizeof(double)); + TRACE("Read double %f\n", prop->u.dblVal); break; case VT_LPSTR: { @@ -2364,7 +2383,9 @@
enumx = enumx_allocate(&IID_IEnumSTATPROPSETSTG, &IEnumSTATPROPSETSTG_Vtbl, - sizeof (STATPROPSETSTG)); + sizeof (STATPROPSETSTG), + (IUnknown*)&This->base.IStorage_iface, + NULL);
/* add all the property set elements into a list */ r = IStorage_EnumElements(stg, 0, NULL, 0, &penum); @@ -2457,6 +2478,27 @@ 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 = (strlenW(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; @@ -2483,7 +2525,9 @@
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);
Modified: trunk/reactos/media/doc/README.WINE URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=7... ============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Mar 5 21:03:00 2017 @@ -139,7 +139,7 @@ reactos/dll/win32/objsel # Synced to WineStaging-1.9.11 reactos/dll/win32/odbc32 # Synced to WineStaging-2.2. Depends on port of Linux ODBC. reactos/dll/win32/odbccp32 # Synced to WineStaging-1.9.11 -reactos/dll/win32/ole32 # Synced to WineStaging-1.9.23 +reactos/dll/win32/ole32 # Synced to WineStaging-2.2 reactos/dll/win32/oleacc # Synced to WineStaging-1.9.11 reactos/dll/win32/oleaut32 # Synced to WineStaging-1.9.23 reactos/dll/win32/olecli32 # Synced to WineStaging-1.9.11