From 0f5d91b750c854d34f69af03faab0209fcb152ee Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 10 Nov 2019 14:10:55 +0100 Subject: [PATCH] [OLE32] Sync with Wine Staging 4.18. CORE-16441 --- dll/win32/ole32/bindctx.c | 2 +- dll/win32/ole32/classmoniker.c | 5 +- dll/win32/ole32/clipboard.c | 4 +- dll/win32/ole32/comcat.c | 9 +- dll/win32/ole32/compobj.c | 209 ++++++++++++++++++++++------- dll/win32/ole32/compobj_private.h | 18 ++- dll/win32/ole32/compositemoniker.c | 19 ++- dll/win32/ole32/datacache.c | 3 +- dll/win32/ole32/defaulthandler.c | 5 +- dll/win32/ole32/errorinfo.c | 3 +- dll/win32/ole32/filelockbytes.c | 5 +- dll/win32/ole32/filemoniker.c | 49 ++++--- dll/win32/ole32/ftmarshal.c | 2 - dll/win32/ole32/hglobalstream.c | 2 - dll/win32/ole32/ifs.c | 2 - dll/win32/ole32/itemmoniker.c | 9 +- dll/win32/ole32/marshal.c | 1 - dll/win32/ole32/memlockbytes.c | 2 - dll/win32/ole32/moniker.c | 12 +- dll/win32/ole32/ole2.c | 47 +++++-- dll/win32/ole32/ole2stubs.c | 2 - dll/win32/ole32/ole32.spec | 4 +- dll/win32/ole32/ole32_main.c | 3 - dll/win32/ole32/oleobj.c | 7 +- dll/win32/ole32/oleproxy.c | 2 - dll/win32/ole32/precomp.h | 3 - dll/win32/ole32/rpc.c | 8 +- dll/win32/ole32/stg_prop.c | 15 +-- dll/win32/ole32/storage32.c | 17 ++- dll/win32/ole32/usrmarshal.c | 11 +- media/doc/README.WINE | 2 +- 31 files changed, 295 insertions(+), 187 deletions(-) diff --git a/dll/win32/ole32/bindctx.c b/dll/win32/ole32/bindctx.c index 8be88a64c0d..1951100b0bb 100644 --- a/dll/win32/ole32/bindctx.c +++ b/dll/win32/ole32/bindctx.c @@ -446,7 +446,7 @@ static HRESULT BindCtxImpl_GetObjectIndex(BindCtxImpl* This, if ( ( (This->bindCtxTable[i].pkeyObj==NULL) && (pszkey==NULL) ) || ( (This->bindCtxTable[i].pkeyObj!=NULL) && (pszkey!=NULL) && - (lstrcmpW(This->bindCtxTable[i].pkeyObj,pszkey)==0) + (wcscmp(This->bindCtxTable[i].pkeyObj,pszkey)==0) ) ) diff --git a/dll/win32/ole32/classmoniker.c b/dll/win32/ole32/classmoniker.c index 30a24d23e5e..3837a1f74c1 100644 --- a/dll/win32/ole32/classmoniker.c +++ b/dll/win32/ole32/classmoniker.c @@ -31,7 +31,6 @@ #include "winuser.h" #include "wine/debug.h" #include "ole2.h" -#include "wine/unicode.h" #include "moniker.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -402,7 +401,7 @@ static HRESULT WINAPI ClassMoniker_IsEqual(IMoniker* iface,IMoniker* pmkOtherMon if(SUCCEEDED ((res = CreateBindCtx(0,&bind)))) { if(SUCCEEDED (IMoniker_GetDisplayName(iface,bind,NULL,&dispName1))) { if(SUCCEEDED (IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&dispName2))) { - if(lstrcmpW(dispName1,dispName2)==0) res = S_OK; + if(wcscmp(dispName1,dispName2)==0) res = S_OK; CoTaskMemFree(dispName2); } CoTaskMemFree(dispName1); @@ -727,7 +726,7 @@ HRESULT ClassMoniker_CreateFromDisplayName(LPBC pbc, LPCOLESTR szDisplayName, LP IMoniker **ppmk) { HRESULT hr; - LPCWSTR s = strchrW(szDisplayName, ':'); + LPCWSTR s = wcschr(szDisplayName, ':'); LPCWSTR end; CLSID clsid; BYTE table[256]; diff --git a/dll/win32/ole32/clipboard.c b/dll/win32/ole32/clipboard.c index f3e9a6bc56a..a43f104ba80 100644 --- a/dll/win32/ole32/clipboard.c +++ b/dll/win32/ole32/clipboard.c @@ -1363,7 +1363,7 @@ static inline BOOL string_off_equal(const DVTARGETDEVICE *t1, WORD off1, const D str1 = (const WCHAR*)((const char*)t1 + off1); str2 = (const WCHAR*)((const char*)t2 + off2); - return !lstrcmpW(str1, str2); + return !wcscmp(str1, str2); } static inline BOOL td_equal(const DVTARGETDEVICE *t1, const DVTARGETDEVICE *t2) @@ -1602,7 +1602,7 @@ end: */ static HRESULT WINAPI snapshot_QueryGetData(IDataObject *iface, FORMATETC *fmt) { - FIXME("(%p, %p {%s})\n", iface, fmt, dump_fmtetc(fmt)); + TRACE("(%p, %p {%s})\n", iface, fmt, dump_fmtetc(fmt)); if (!fmt) return E_INVALIDARG; diff --git a/dll/win32/ole32/comcat.c b/dll/win32/ole32/comcat.c index d43c3afc0d4..467724c5ba3 100644 --- a/dll/win32/ole32/comcat.c +++ b/dll/win32/ole32/comcat.c @@ -33,7 +33,6 @@ #include "comcat.h" #include "compobj_private.h" -#include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -267,7 +266,7 @@ static HRESULT COMCAT_IsClassOfCategories( if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) break; if (size != CHARS_IN_GUID-1) continue; /* bogus catid in registry */ for (string = req_strings; *string; string += CHARS_IN_GUID) - if (!strcmpiW(string, keyname)) break; + if (!wcsicmp(string, keyname)) break; if (!*string) { RegCloseKey(subkey); return S_FALSE; @@ -1279,9 +1278,9 @@ static HRESULT CATIDEnumGUID_Construct(REFCLSID rclsid, LPCWSTR postfix, IEnumGU This->IEnumGUID_iface.lpVtbl = &CATIDEnumGUIDVtbl; This->ref = 1; - strcpyW(keyname, prefixW); - strcatW(keyname, clsidW); - strcatW(keyname, postfix); + lstrcpyW(keyname, prefixW); + lstrcatW(keyname, clsidW); + lstrcatW(keyname, postfix); open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &This->key); diff --git a/dll/win32/ole32/compobj.c b/dll/win32/ole32/compobj.c index eae39335fbb..e0c1b0b745f 100644 --- a/dll/win32/ole32/compobj.c +++ b/dll/win32/ole32/compobj.c @@ -36,8 +36,6 @@ * */ -#include "config.h" - #include #include #include @@ -67,7 +65,6 @@ #include "compobj_private.h" #include "moniker.h" -#include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -496,7 +493,7 @@ static OpenDll *COMPOBJ_DllList_Get(LPCWSTR library_name) EnterCriticalSection(&csOpenDllList); LIST_FOR_EACH_ENTRY(ptr, &openDllList, OpenDll, entry) { - if (!strcmpiW(library_name, ptr->library_name) && + if (!wcsicmp(library_name, ptr->library_name) && (InterlockedIncrement(&ptr->refs) != 1) /* entry is being destroy if == 1 */) { ret = ptr; @@ -554,7 +551,7 @@ static HRESULT COMPOBJ_DllList_Add(LPCWSTR library_name, OpenDll **ret) } else { - len = strlenW(library_name); + len = lstrlenW(library_name); entry = HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll)); if (entry) entry->library_name = HeapAlloc(GetProcessHeap(), 0, (len + 1)*sizeof(WCHAR)); @@ -1349,7 +1346,7 @@ static HRESULT apartment_getclassobject(struct apartment *apt, LPCWSTR dllpath, BOOL found = FALSE; struct apartment_loaded_dll *apartment_loaded_dll; - if (!strcmpiW(dllpath, wszOle32)) + if (!wcsicmp(dllpath, wszOle32)) { /* we don't need to control the lifetime of this dll, so use the local * implementation of DllGetClassObject directly */ @@ -1365,7 +1362,7 @@ static HRESULT apartment_getclassobject(struct apartment *apt, LPCWSTR dllpath, EnterCriticalSection(&apt->cs); LIST_FOR_EACH_ENTRY(apartment_loaded_dll, &apt->loaded_dlls, struct apartment_loaded_dll, entry) - if (!strcmpiW(dllpath, apartment_loaded_dll->dll->library_name)) + if (!wcsicmp(dllpath, apartment_loaded_dll->dll->library_name)) { TRACE("found %s already loaded\n", debugstr_w(dllpath)); found = TRUE; @@ -1428,9 +1425,9 @@ static BOOL get_object_dll_path(const struct class_reg_data *regdata, WCHAR *dst if (dstlen <= ExpandEnvironmentStringsW(src, dst, dstlen)) ret = ERROR_MORE_DATA; } else { const WCHAR *quote_start; - quote_start = strchrW(src, '\"'); + quote_start = wcschr(src, '\"'); if (quote_start) { - const WCHAR *quote_end = strchrW(quote_start + 1, '\"'); + const WCHAR *quote_end = wcschr(quote_start + 1, '\"'); if (quote_end) { memmove(src, quote_start + 1, (quote_end - quote_start - 1) * sizeof(WCHAR)); @@ -1744,11 +1741,21 @@ static void COM_TlsDestroy(void) struct oletls *info = NtCurrentTeb()->ReservedForOle; if (info) { + struct init_spy *cursor, *cursor2; + if (info->apt) apartment_release(info->apt); if (info->errorinfo) IErrorInfo_Release(info->errorinfo); if (info->state) IUnknown_Release(info->state); - if (info->spy) IInitializeSpy_Release(info->spy); + + LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, &info->spies, struct init_spy, entry) + { + list_remove(&cursor->entry); + if (cursor->spy) IInitializeSpy_Release(cursor->spy); + heap_free(cursor); + } + if (info->context_token) IObjContext_Release(info->context_token); + HeapFree(GetProcessHeap(), 0, info); NtCurrentTeb()->ReservedForOle = NULL; } @@ -1770,6 +1777,42 @@ DWORD WINAPI CoBuildVersion(void) return (rmm<<16)+rup; } +static struct init_spy *get_spy_entry(struct oletls *info, unsigned int id) +{ + struct init_spy *spy; + + LIST_FOR_EACH_ENTRY(spy, &info->spies, struct init_spy, entry) + { + if (id == spy->id && spy->spy) + return spy; + } + + return NULL; +} + +/* + * When locked, don't modify list (unless we add a new head), so that it's + * safe to iterate it. Freeing of list entries is delayed and done on unlock. + */ +static inline void lock_init_spies(struct oletls *info) +{ + info->spies_lock++; +} + +static void unlock_init_spies(struct oletls *info) +{ + struct init_spy *spy, *next; + + if (--info->spies_lock) return; + + LIST_FOR_EACH_ENTRY_SAFE(spy, next, &info->spies, struct init_spy, entry) + { + if (spy->spy) continue; + list_remove(&spy->entry); + heap_free(spy); + } +} + /****************************************************************************** * CoRegisterInitializeSpy [OLE32.@] * @@ -1789,6 +1832,8 @@ DWORD WINAPI CoBuildVersion(void) HRESULT WINAPI CoRegisterInitializeSpy(IInitializeSpy *spy, ULARGE_INTEGER *cookie) { struct oletls *info = COM_CurrentInfo(); + struct init_spy *entry; + unsigned int id; HRESULT hr; TRACE("(%p, %p)\n", spy, cookie); @@ -1800,19 +1845,32 @@ HRESULT WINAPI CoRegisterInitializeSpy(IInitializeSpy *spy, ULARGE_INTEGER *cook return E_INVALIDARG; } - if (info->spy) + hr = IInitializeSpy_QueryInterface(spy, &IID_IInitializeSpy, (void **)&spy); + if (FAILED(hr)) + return hr; + + entry = heap_alloc(sizeof(*entry)); + if (!entry) { - FIXME("Already registered?\n"); - return E_UNEXPECTED; + IInitializeSpy_Release(spy); + return E_OUTOFMEMORY; } - hr = IInitializeSpy_QueryInterface(spy, &IID_IInitializeSpy, (void **) &info->spy); - if (SUCCEEDED(hr)) + entry->spy = spy; + + id = 0; + while (get_spy_entry(info, id) != NULL) { - cookie->QuadPart = (DWORD_PTR)spy; - return S_OK; + id++; } - return hr; + + entry->id = id; + list_add_head(&info->spies, &entry->entry); + + cookie->s.HighPart = GetCurrentThreadId(); + cookie->s.LowPart = entry->id; + + return S_OK; } /****************************************************************************** @@ -1833,13 +1891,22 @@ HRESULT WINAPI CoRegisterInitializeSpy(IInitializeSpy *spy, ULARGE_INTEGER *cook HRESULT WINAPI CoRevokeInitializeSpy(ULARGE_INTEGER cookie) { struct oletls *info = COM_CurrentInfo(); + struct init_spy *spy; + TRACE("(%s)\n", wine_dbgstr_longlong(cookie.QuadPart)); - if (!info || !info->spy || cookie.QuadPart != (DWORD_PTR)info->spy) + if (!info || cookie.s.HighPart != GetCurrentThreadId()) return E_INVALIDARG; - IInitializeSpy_Release(info->spy); - info->spy = NULL; + if (!(spy = get_spy_entry(info, cookie.s.LowPart))) return E_INVALIDARG; + + IInitializeSpy_Release(spy->spy); + spy->spy = NULL; + if (!info->spies_lock) + { + list_remove(&spy->entry); + heap_free(spy); + } return S_OK; } @@ -1935,6 +2002,7 @@ HRESULT WINAPI CoInitialize(LPVOID lpReserved) HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit) { struct oletls *info = COM_CurrentInfo(); + struct init_spy *cursor; HRESULT hr; TRACE("(%p, %x)\n", lpReserved, (int)dwCoInit); @@ -1961,13 +2029,21 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoIni RunningObjectTableImpl_Initialize(); } - if (info->spy) - IInitializeSpy_PreInitialize(info->spy, dwCoInit, info->inits); + lock_init_spies(info); + LIST_FOR_EACH_ENTRY(cursor, &info->spies, struct init_spy, entry) + { + if (cursor->spy) IInitializeSpy_PreInitialize(cursor->spy, dwCoInit, info->inits); + } + unlock_init_spies(info); hr = enter_apartment( info, dwCoInit ); - if (info->spy) - IInitializeSpy_PostInitialize(info->spy, hr, dwCoInit, info->inits); + lock_init_spies(info); + LIST_FOR_EACH_ENTRY(cursor, &info->spies, struct init_spy, entry) + { + if (cursor->spy) hr = IInitializeSpy_PostInitialize(cursor->spy, hr, dwCoInit, info->inits); + } + unlock_init_spies(info); return hr; } @@ -1991,6 +2067,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoIni void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void) { struct oletls * info = COM_CurrentInfo(); + struct init_spy *cursor, *next; LONG lCOMRefCnt; TRACE("()\n"); @@ -1998,17 +2075,26 @@ void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void) /* will only happen on OOM */ if (!info) return; - if (info->spy) - IInitializeSpy_PreUninitialize(info->spy, info->inits); + lock_init_spies(info); + LIST_FOR_EACH_ENTRY_SAFE(cursor, next, &info->spies, struct init_spy, entry) + { + if (cursor->spy) IInitializeSpy_PreUninitialize(cursor->spy, info->inits); + } + unlock_init_spies(info); /* sanity check */ if (!info->inits) { - ERR("Mismatched CoUninitialize\n"); + ERR("Mismatched CoUninitialize\n"); - if (info->spy) - IInitializeSpy_PostUninitialize(info->spy, info->inits); - return; + lock_init_spies(info); + LIST_FOR_EACH_ENTRY_SAFE(cursor, next, &info->spies, struct init_spy, entry) + { + if (cursor->spy) IInitializeSpy_PostUninitialize(cursor->spy, info->inits); + } + unlock_init_spies(info); + + return; } leave_apartment( info ); @@ -2030,8 +2116,13 @@ void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void) ERR( "CoUninitialize() - not CoInitialized.\n" ); InterlockedExchangeAdd(&s_COMLockCount,1); /* restore the lock count. */ } - if (info->spy) - IInitializeSpy_PostUninitialize(info->spy, info->inits); + + lock_init_spies(info); + LIST_FOR_EACH_ENTRY(cursor, &info->spies, struct init_spy, entry) + { + if (cursor->spy) IInitializeSpy_PostUninitialize(cursor->spy, info->inits); + } + unlock_init_spies(info); } /****************************************************************************** @@ -2205,10 +2296,10 @@ static HRESULT clsid_from_string_reg(LPCOLESTR progid, CLSID *clsid) WCHAR *buf; memset(clsid, 0, sizeof(*clsid)); - buf = HeapAlloc( GetProcessHeap(),0,(strlenW(progid)+8) * sizeof(WCHAR) ); + buf = HeapAlloc( GetProcessHeap(),0,(lstrlenW(progid)+8) * sizeof(WCHAR) ); if (!buf) return E_OUTOFMEMORY; - strcpyW( buf, progid ); - strcatW( buf, clsidW ); + lstrcpyW( buf, progid ); + lstrcatW( buf, clsidW ); if (open_classes_key(HKEY_CLASSES_ROOT, buf, MAXIMUM_ALLOWED, &xhkey)) { HeapFree(GetProcessHeap(),0,buf); @@ -2291,7 +2382,7 @@ HRESULT WINAPI IIDFromString(LPCOLESTR s, IID *iid) } /* length mismatch is a special case */ - if (strlenW(s) + 1 != CHARS_IN_GUID) + if (lstrlenW(s) + 1 != CHARS_IN_GUID) return E_INVALIDARG; if (s[0] != '{') @@ -2347,7 +2438,7 @@ INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax) '%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X', '%','0','2','X','%','0','2','X','}',0 }; if (!id || cmax < CHARS_IN_GUID) return 0; - sprintfW( str, formatW, id->Data1, id->Data2, id->Data3, + swprintf( str, formatW, id->Data1, id->Data2, id->Data3, id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3], id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] ); return CHARS_IN_GUID; @@ -2361,8 +2452,8 @@ HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY LONG res; HKEY key; - strcpyW(path, wszCLSIDSlash); - StringFromGUID2(clsid, path + strlenW(wszCLSIDSlash), CHARS_IN_GUID); + lstrcpyW(path, wszCLSIDSlash); + StringFromGUID2(clsid, path + lstrlenW(wszCLSIDSlash), CHARS_IN_GUID); res = open_classes_key(HKEY_CLASSES_ROOT, path, keyname ? KEY_READ : access, &key); if (res == ERROR_FILE_NOT_FOUND) return REGDB_E_CLASSNOTREG; @@ -2411,8 +2502,8 @@ HRESULT COM_OpenKeyForAppIdFromCLSID(REFCLSID clsid, REGSAM access, HKEY *subkey else if (res != ERROR_SUCCESS || type!=REG_SZ) return REGDB_E_READREGDB; - strcpyW(keyname, szAppIdKey); - strcatW(keyname, buf); + lstrcpyW(keyname, szAppIdKey); + lstrcatW(keyname, buf); res = open_classes_key(HKEY_CLASSES_ROOT, keyname, access, subkey); if (res == ERROR_FILE_NOT_FOUND) return REGDB_E_KEYMISSING; @@ -2642,9 +2733,9 @@ HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid) } /* Interface\\{string form of riid}\\ProxyStubClsid32 */ - strcpyW(path, wszInterface); + lstrcpyW(path, wszInterface); StringFromGUID2(riid, path + ARRAY_SIZE(wszInterface) - 1, CHARS_IN_GUID); - strcpyW(path + ARRAY_SIZE(wszInterface) - 1 + CHARS_IN_GUID - 1, wszPSC); + lstrcpyW(path + ARRAY_SIZE(wszInterface) - 1 + CHARS_IN_GUID - 1, wszPSC); hr = get_ps_clsid_from_registry(path, 0, pclsid); if (FAILED(hr) && (opposite == KEY_WOW64_32KEY || @@ -2911,7 +3002,7 @@ static enum comclass_threadingmodel get_threading_model(const struct class_reg_d static const WCHAR wszApartment[] = {'A','p','a','r','t','m','e','n','t',0}; static const WCHAR wszFree[] = {'F','r','e','e',0}; static const WCHAR wszBoth[] = {'B','o','t','h',0}; - WCHAR threading_model[10 /* strlenW(L"apartment")+1 */]; + WCHAR threading_model[10 /* lstrlenW(L"apartment")+1 */]; DWORD dwLength = sizeof(threading_model); DWORD keytype; DWORD ret; @@ -2920,9 +3011,9 @@ static enum comclass_threadingmodel get_threading_model(const struct class_reg_d if ((ret != ERROR_SUCCESS) || (keytype != REG_SZ)) threading_model[0] = '\0'; - if (!strcmpiW(threading_model, wszApartment)) return ThreadingModel_Apartment; - if (!strcmpiW(threading_model, wszFree)) return ThreadingModel_Free; - if (!strcmpiW(threading_model, wszBoth)) return ThreadingModel_Both; + if (!wcsicmp(threading_model, wszApartment)) return ThreadingModel_Apartment; + if (!wcsicmp(threading_model, wszFree)) return ThreadingModel_Free; + if (!wcsicmp(threading_model, wszBoth)) return ThreadingModel_Both; /* there's not specific handling for this case */ if (threading_model[0]) return ThreadingModel_Neutral; @@ -5091,7 +5182,7 @@ HRESULT Handler_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) if (get_object_dll_path(®data, dllpath, ARRAY_SIZE(dllpath))) { static const WCHAR wszOle32[] = {'o','l','e','3','2','.','d','l','l',0}; - if (!strcmpiW(dllpath, wszOle32)) + if (!wcsicmp(dllpath, wszOle32)) { RegCloseKey(hkey); return HandlerCF_Create(rclsid, riid, ppv); @@ -5142,6 +5233,26 @@ HRESULT WINAPI CoGetApartmentType(APTTYPE *type, APTTYPEQUALIFIER *qualifier) return info->apt ? S_OK : CO_E_NOTINITIALIZED; } +/*********************************************************************** + * CoDisableCallCancellation [OLE32.@] + */ +HRESULT WINAPI CoDisableCallCancellation(void *reserved) +{ + FIXME("(%p): stub\n", reserved); + + return E_NOTIMPL; +} + +/*********************************************************************** + * CoEnableCallCancellation [OLE32.@] + */ +HRESULT WINAPI CoEnableCallCancellation(void *reserved) +{ + FIXME("(%p): stub\n", reserved); + + return E_NOTIMPL; +} + /*********************************************************************** * CoRegisterSurrogate [OLE32.@] */ diff --git a/dll/win32/ole32/compobj_private.h b/dll/win32/ole32/compobj_private.h index 1e564a3de11..bda1c6bff2a 100644 --- a/dll/win32/ole32/compobj_private.h +++ b/dll/win32/ole32/compobj_private.h @@ -153,6 +153,13 @@ struct apartment BOOL main; /* is this a main-threaded-apartment? (RO) */ }; +struct init_spy +{ + struct list entry; + IInitializeSpy *spy; + unsigned int id; +}; + /* this is what is stored in TEB->ReservedForOle */ struct oletls { @@ -160,7 +167,7 @@ struct oletls IErrorInfo *errorinfo; /* see errorinfo.c */ IUnknown *state; /* see CoSetState */ DWORD apt_mask; /* apartment mask (+0Ch on x86) */ - IInitializeSpy *spy; /* The "SPY" from CoInitializeSpy */ + void *unknown0; DWORD inits; /* number of times CoInitializeEx called */ DWORD ole_inits; /* number of times OleInitialize called */ GUID causality_id; /* unique identifier for each COM call */ @@ -171,6 +178,8 @@ struct oletls IUnknown *call_state; /* current call context (+3Ch on x86) */ DWORD unknown2[46]; IUnknown *cancel_object; /* cancel object set by CoSetCancelObject (+F8h on x86) */ + struct list spies; /* Spies installed with CoRegisterInitializeSpy */ + DWORD spies_lock; }; @@ -262,7 +271,12 @@ APARTMENT *apartment_get_current_or_mta(void) DECLSPEC_HIDDEN; static inline struct oletls *COM_CurrentInfo(void) { if (!NtCurrentTeb()->ReservedForOle) - NtCurrentTeb()->ReservedForOle = heap_alloc_zero(sizeof(struct oletls)); + { + struct oletls *oletls = heap_alloc_zero(sizeof(*oletls)); + if (oletls) + list_init(&oletls->spies); + NtCurrentTeb()->ReservedForOle = oletls; + } return NtCurrentTeb()->ReservedForOle; } diff --git a/dll/win32/ole32/compositemoniker.c b/dll/win32/ole32/compositemoniker.c index 75d97fa7e30..5f5c8c7deb1 100644 --- a/dll/win32/ole32/compositemoniker.c +++ b/dll/win32/ole32/compositemoniker.c @@ -29,7 +29,6 @@ #include "winuser.h" #include "winerror.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "ole2.h" #include "moniker.h" @@ -433,6 +432,7 @@ static HRESULT WINAPI CompositeMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar, IMoniker** ppmkToLeft, IMoniker** ppmkReduced) { + HRESULT res; IMoniker *tempMk,*antiMk,*rightMostMk,*leftReducedComposedMk,*rightMostReducedMk; IEnumMoniker *enumMoniker; @@ -453,7 +453,11 @@ CompositeMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar IMoniker_ComposeWith(iface,antiMk,0,&tempMk); IMoniker_Release(antiMk); - return IMoniker_Reduce(rightMostMk,pbc,dwReduceHowFar,&tempMk, ppmkReduced); + res = IMoniker_Reduce(rightMostMk,pbc,dwReduceHowFar,&tempMk, ppmkReduced); + IMoniker_Release(tempMk); + IMoniker_Release(rightMostMk); + + return res; } else if (*ppmkToLeft==NULL) @@ -473,13 +477,16 @@ CompositeMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar /* If any of the components reduces itself, the method returns S_OK and passes back a composite */ /* of the reduced components */ if (IMoniker_Reduce(rightMostMk,pbc,dwReduceHowFar,NULL,&rightMostReducedMk) && - IMoniker_Reduce(rightMostMk,pbc,dwReduceHowFar,&tempMk,&leftReducedComposedMk) - ) + IMoniker_Reduce(rightMostMk,pbc,dwReduceHowFar,&tempMk,&leftReducedComposedMk) ){ + IMoniker_Release(tempMk); + IMoniker_Release(rightMostMk); return CreateGenericComposite(leftReducedComposedMk,rightMostReducedMk,ppmkReduced); - + } else{ /* If no reduction occurred, the method passes back the same moniker and returns MK_S_REDUCED_TO_SELF.*/ + IMoniker_Release(tempMk); + IMoniker_Release(rightMostMk); IMoniker_AddRef(iface); @@ -1133,7 +1140,7 @@ CompositeMonikerImpl_GetDisplayName(IMoniker* iface, IBindCtx* pbc, if (*ppszDisplayName==NULL) return E_OUTOFMEMORY; - strcatW(*ppszDisplayName,tempStr); + lstrcatW(*ppszDisplayName,tempStr); CoTaskMemFree(tempStr); IMoniker_Release(tempMk); diff --git a/dll/win32/ole32/datacache.c b/dll/win32/ole32/datacache.c index 3eff56908d5..4e4f264860a 100644 --- a/dll/win32/ole32/datacache.c +++ b/dll/win32/ole32/datacache.c @@ -57,7 +57,6 @@ #include "winerror.h" #include "ole2.h" #include "compobj_private.h" -#include "wine/unicode.h" #include "wine/list.h" #include "wine/debug.h" @@ -1003,7 +1002,7 @@ static HRESULT save_mfpict(DataCacheEntry *entry, BOOL contents, IStream *stream meta_place_rec.bounding_box[3] = (LONGLONG)mfpict->yExt * meta_place_rec.inch / 2540; GlobalUnlock(entry->stgmedium.u.hMetaFilePict); - for (check = (WORD *)&meta_place_rec; check != (WORD *)&meta_place_rec.checksum; check++) + for (check = (WORD *)&meta_place_rec; check != &meta_place_rec.checksum; check++) meta_place_rec.checksum ^= *check; hr = IStream_Write(stream, &meta_place_rec, sizeof(struct meta_placeable), NULL); if (hr == S_OK && data_size) diff --git a/dll/win32/ole32/defaulthandler.c b/dll/win32/ole32/defaulthandler.c index e6c52cd0933..c1045c15466 100644 --- a/dll/win32/ole32/defaulthandler.c +++ b/dll/win32/ole32/defaulthandler.c @@ -60,7 +60,6 @@ #include "compobj_private.h" #include "storage32.h" -#include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -449,14 +448,14 @@ static HRESULT WINAPI DefaultHandler_SetHostNames( { if ((This->containerApp = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(szContainerApp) + 1) * sizeof(WCHAR) ))) - strcpyW( This->containerApp, szContainerApp ); + lstrcpyW( This->containerApp, szContainerApp ); } if (szContainerObj) { if ((This->containerObj = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(szContainerObj) + 1) * sizeof(WCHAR) ))) - strcpyW( This->containerObj, szContainerObj ); + lstrcpyW( This->containerObj, szContainerObj ); } return S_OK; } diff --git a/dll/win32/ole32/errorinfo.c b/dll/win32/ole32/errorinfo.c index d5ec17207af..6aa3a336b8d 100644 --- a/dll/win32/ole32/errorinfo.c +++ b/dll/win32/ole32/errorinfo.c @@ -34,7 +34,6 @@ #include "oleauto.h" #include "winerror.h" -#include "wine/unicode.h" #include "compobj_private.h" #include "wine/debug.h" @@ -48,7 +47,7 @@ static inline WCHAR *heap_strdupW(const WCHAR *str) if(str) { size_t size; - size = (strlenW(str)+1)*sizeof(WCHAR); + size = (lstrlenW(str)+1)*sizeof(WCHAR); ret = heap_alloc(size); if(ret) memcpy(ret, str, size); diff --git a/dll/win32/ole32/filelockbytes.c b/dll/win32/ole32/filelockbytes.c index c5cb45f77fc..e9699c01650 100644 --- a/dll/win32/ole32/filelockbytes.c +++ b/dll/win32/ole32/filelockbytes.c @@ -41,7 +41,6 @@ #include "storage32.h" #include "wine/debug.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(storage); @@ -117,7 +116,7 @@ HRESULT FileLockBytesImpl_Construct(HANDLE hFile, DWORD openFlags, LPCWSTR pwcsN HeapFree(GetProcessHeap(), 0, This); return E_OUTOFMEMORY; } - strcpyW(This->pwcsName, fullpath); + lstrcpyW(This->pwcsName, fullpath); } else This->pwcsName = NULL; @@ -376,7 +375,7 @@ static HRESULT WINAPI FileLockBytesImpl_Stat(ILockBytes* iface, pstatstg->pwcsName = CoTaskMemAlloc((lstrlenW(This->pwcsName)+1)*sizeof(WCHAR)); - strcpyW(pstatstg->pwcsName, This->pwcsName); + lstrcpyW(pstatstg->pwcsName, This->pwcsName); } else pstatstg->pwcsName = NULL; diff --git a/dll/win32/ole32/filemoniker.c b/dll/win32/ole32/filemoniker.c index 271e5bb8a8b..1e945f9a5f5 100644 --- a/dll/win32/ole32/filemoniker.c +++ b/dll/win32/ole32/filemoniker.c @@ -30,7 +30,6 @@ #include "winbase.h" #include "winerror.h" #include "winnls.h" -#include "wine/unicode.h" #include "wine/debug.h" #include "objbase.h" #include "moniker.h" @@ -693,14 +692,14 @@ FileMonikerImpl_ComposeWith(IMoniker* iface, IMoniker* pmkRight, lastIdx1=FileMonikerImpl_DecomposePath(str1,&strDec1)-1; lastIdx2=FileMonikerImpl_DecomposePath(str2,&strDec2)-1; - if ((lastIdx1==-1 && lastIdx2>-1)||(lastIdx1==1 && lstrcmpW(strDec1[0],twoPoint)==0)) + if ((lastIdx1==-1 && lastIdx2>-1)||(lastIdx1==1 && wcscmp(strDec1[0],twoPoint)==0)) res = MK_E_SYNTAX; else{ - if(lstrcmpW(strDec1[lastIdx1],bkSlash)==0) + if(wcscmp(strDec1[lastIdx1],bkSlash)==0) lastIdx1--; /* for each "..\" in the left of str2 remove the right element from str1 */ - for(i=0; ( (lastIdx1>=0) && (strDec2[i]!=NULL) && (lstrcmpW(strDec2[i],twoPoint)==0) ); i+=2){ + for(i=0; ( (lastIdx1>=0) && (strDec2[i]!=NULL) && (wcscmp(strDec2[i],twoPoint)==0) ); i+=2){ lastIdx1-=2; } @@ -711,13 +710,13 @@ FileMonikerImpl_ComposeWith(IMoniker* iface, IMoniker* pmkRight, if (newStr){ /* new path is the concatenation of the rest of str1 and str2 */ for(*newStr=0,j=0;j<=lastIdx1;j++) - strcatW(newStr,strDec1[j]); + lstrcatW(newStr,strDec1[j]); - if ((strDec2[i]==NULL && lastIdx1>-1 && lastIdx2>-1) || lstrcmpW(strDec2[i],bkSlash)!=0) - strcatW(newStr,bkSlash); + if ((strDec2[i]==NULL && lastIdx1>-1 && lastIdx2>-1) || wcscmp(strDec2[i],bkSlash)!=0) + lstrcatW(newStr,bkSlash); for(j=i;j<=lastIdx2;j++) - strcatW(newStr,strDec2[j]); + lstrcatW(newStr,strDec2[j]); /* create a new moniker with the new string */ res=CreateFileMoniker(newStr,ppmkComposite); @@ -1003,7 +1002,7 @@ FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** p else { for (i = 0; i < sameIdx; i++) - strcatW(commonPath,stringTable1[i]); + lstrcatW(commonPath,stringTable1[i]); ret = CreateFileMoniker(commonPath, ppmkPrefix); } @@ -1057,7 +1056,7 @@ int FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable) goto lend; } - strcpyW(strgtable[tabIndex++],bSlash); + lstrcpyW(strgtable[tabIndex++],bSlash); i++; @@ -1077,7 +1076,7 @@ int FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable) goto lend; } - strcpyW(strgtable[tabIndex++],word); + lstrcpyW(strgtable[tabIndex++],word); } } strgtable[tabIndex]=NULL; @@ -1157,11 +1156,11 @@ FileMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppm if (len2>0 && !(len1==1 && len2==1 && sameIdx==0)) for(j=sameIdx;(tabStr1[j] != NULL); j++) if (*tabStr1[j]!='\\') - strcatW(relPath,back); + lstrcatW(relPath,back); /* add items of the second path (similar items with the first path are not included) to the relativePath */ for(j=sameIdx;tabStr2[j]!=NULL;j++) - strcatW(relPath,tabStr2[j]); + lstrcatW(relPath,tabStr2[j]); res=CreateFileMoniker(relPath,ppmkRelPath); @@ -1199,7 +1198,7 @@ FileMonikerImpl_GetDisplayName(IMoniker* iface, IBindCtx* pbc, if (*ppszDisplayName==NULL) return E_OUTOFMEMORY; - strcpyW(*ppszDisplayName,This->filePathName); + lstrcpyW(*ppszDisplayName,This->filePathName); TRACE("-- %s\n", debugstr_w(*ppszDisplayName)); @@ -1281,7 +1280,7 @@ FileMonikerROTDataImpl_GetComparisonData(IROTData* iface, BYTE* pbData, ULONG cbMax, ULONG* pcbData) { FileMonikerImpl *This = impl_from_IROTData(iface); - int len = strlenW(This->filePathName)+1; + int len = lstrlenW(This->filePathName)+1; int i; LPWSTR pszFileName; @@ -1294,7 +1293,7 @@ FileMonikerROTDataImpl_GetComparisonData(IROTData* iface, BYTE* pbData, memcpy(pbData, &CLSID_FileMoniker, sizeof(CLSID)); pszFileName = (LPWSTR)(pbData+sizeof(CLSID)); for (i = 0; i < len; i++) - pszFileName[i] = toupperW(This->filePathName[i]); + pszFileName[i] = towupper(This->filePathName[i]); return S_OK; } @@ -1364,25 +1363,25 @@ static HRESULT FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPa if (This->filePathName==NULL) return E_OUTOFMEMORY; - strcpyW(This->filePathName,lpszPathName); + lstrcpyW(This->filePathName,lpszPathName); nb=FileMonikerImpl_DecomposePath(This->filePathName,&tabStr); if (nb > 0 ){ addBkSlash = TRUE; - if (lstrcmpW(tabStr[0],twoPoint)!=0) + if (wcscmp(tabStr[0],twoPoint)!=0) addBkSlash = FALSE; else for(i=0;ifilePathName=HeapReAlloc(GetProcessHeap(),0,This->filePathName,(sizeStr+1)*sizeof(WCHAR)); @@ -1398,10 +1397,10 @@ static HRESULT FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPa *This->filePathName=0; for(i=0;tabStr[i]!=NULL;i++) - strcatW(This->filePathName,tabStr[i]); + lstrcatW(This->filePathName,tabStr[i]); if (addBkSlash) - strcatW(This->filePathName,bkSlash); + lstrcatW(This->filePathName,bkSlash); } free_stringtable(tabStr); @@ -1446,7 +1445,7 @@ HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, IMoniker **ppmk) static inline WCHAR *memrpbrkW(const WCHAR *ptr, size_t n, const WCHAR *accept) { const WCHAR *end, *ret = NULL; - for (end = ptr + n; ptr < end; ptr++) if (strchrW(accept, *ptr)) ret = ptr; + for (end = ptr + n; ptr < end; ptr++) if (wcschr(accept, *ptr)) ret = ptr; return (WCHAR *)ret; } @@ -1456,7 +1455,7 @@ HRESULT FileMoniker_CreateFromDisplayName(LPBC pbc, LPCOLESTR szDisplayName, LPCWSTR end; static const WCHAR wszSeparators[] = {':','\\','/','!',0}; - for (end = szDisplayName + strlenW(szDisplayName); + for (end = szDisplayName + lstrlenW(szDisplayName); end && (end != szDisplayName); end = memrpbrkW(szDisplayName, end - szDisplayName, wszSeparators)) { diff --git a/dll/win32/ole32/ftmarshal.c b/dll/win32/ole32/ftmarshal.c index c36f5f61697..851810df42a 100644 --- a/dll/win32/ole32/ftmarshal.c +++ b/dll/win32/ole32/ftmarshal.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include #include diff --git a/dll/win32/ole32/hglobalstream.c b/dll/win32/ole32/hglobalstream.c index 2c08710b054..c9ec529d52f 100644 --- a/dll/win32/ole32/hglobalstream.c +++ b/dll/win32/ole32/hglobalstream.c @@ -22,8 +22,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include #include diff --git a/dll/win32/ole32/ifs.c b/dll/win32/ole32/ifs.c index c9e5625e910..ea03e9b0a28 100644 --- a/dll/win32/ole32/ifs.c +++ b/dll/win32/ole32/ifs.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include #include diff --git a/dll/win32/ole32/itemmoniker.c b/dll/win32/ole32/itemmoniker.c index 14beadadee4..3bf12013629 100644 --- a/dll/win32/ole32/itemmoniker.c +++ b/dll/win32/ole32/itemmoniker.c @@ -32,7 +32,6 @@ #include "winnls.h" #include "wine/debug.h" #include "ole2.h" -#include "wine/unicode.h" #include "moniker.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -487,7 +486,7 @@ static HRESULT WINAPI ItemMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOther if(SUCCEEDED ((res = CreateBindCtx(0,&bind)))) { if(SUCCEEDED (IMoniker_GetDisplayName(iface,bind,NULL,&dispName1))) { if(SUCCEEDED (IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&dispName2))) { - if(lstrcmpW(dispName1,dispName2)==0) res = S_OK; + if(wcscmp(dispName1,dispName2)==0) res = S_OK; CoTaskMemFree(dispName2); } CoTaskMemFree(dispName1); @@ -514,7 +513,7 @@ static HRESULT WINAPI ItemMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash) len = lstrlenW(val); for (i = len ; i > 0; i--) - h = (h * 3) ^ toupperW(val[off++]); + h = (h * 3) ^ towupper(val[off++]); *pdwHash=h; @@ -813,7 +812,7 @@ static HRESULT WINAPI ItemMonikerROTDataImpl_GetComparisonData(IROTData* iface, ULONG* pcbData) { ItemMonikerImpl *This = impl_from_IROTData(iface); - int len = (strlenW(This->itemName)+1); + int len = (lstrlenW(This->itemName)+1); int i; LPWSTR pszItemName; LPWSTR pszItemDelimiter; @@ -832,7 +831,7 @@ static HRESULT WINAPI ItemMonikerROTDataImpl_GetComparisonData(IROTData* iface, /* write name */ pszItemName = pszItemDelimiter + 1; for (i = 0; i < len; i++) - pszItemName[i] = toupperW(This->itemName[i]); + pszItemName[i] = towupper(This->itemName[i]); return S_OK; } diff --git a/dll/win32/ole32/marshal.c b/dll/win32/ole32/marshal.c index b12082cc9fe..4b8945db6f9 100644 --- a/dll/win32/ole32/marshal.c +++ b/dll/win32/ole32/marshal.c @@ -32,7 +32,6 @@ #include "objbase.h" #include "ole2.h" #include "winerror.h" -#include "wine/unicode.h" #include "compobj_private.h" diff --git a/dll/win32/ole32/memlockbytes.c b/dll/win32/ole32/memlockbytes.c index b2fc5b4f4db..2d7d4572584 100644 --- a/dll/win32/ole32/memlockbytes.c +++ b/dll/win32/ole32/memlockbytes.c @@ -19,8 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include #include diff --git a/dll/win32/ole32/moniker.c b/dll/win32/ole32/moniker.c index c1312d1e1e3..23ce0326d66 100644 --- a/dll/win32/ole32/moniker.c +++ b/dll/win32/ole32/moniker.c @@ -21,9 +21,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include @@ -39,7 +36,6 @@ #include "wine/list.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "wine/exception.h" #include "compobj_private.h" @@ -282,7 +278,7 @@ static HRESULT get_moniker_comparison_data(IMoniker *pMoniker, MonikerComparison return hr; } - len = strlenW(pszDisplayName); + len = lstrlenW(pszDisplayName); *moniker_data = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(MonikerComparisonData, abData[sizeof(CLSID) + (len+1)*sizeof(WCHAR)])); if (!*moniker_data) @@ -1152,7 +1148,7 @@ HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szDisplayName, *pchEaten = 0; *ppmk = NULL; - if (!strncmpiW(szDisplayName, wszClsidColon, ARRAY_SIZE(wszClsidColon))) + if (!_wcsnicmp(szDisplayName, wszClsidColon, ARRAY_SIZE(wszClsidColon))) { hr = ClassMoniker_CreateFromDisplayName(pbc, szDisplayName, &chEaten, &moniker); if (FAILED(hr) && (hr != MK_E_SYNTAX)) @@ -1269,7 +1265,7 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid) absFile=pathDec[nbElm-1]; /* failed if the path represents a directory and not an absolute file name*/ - if (!lstrcmpW(absFile, bkslashW)) { + if (!wcscmp(absFile, bkslashW)) { CoTaskMemFree(pathDec); return MK_E_INVALIDEXTENSION; } @@ -1280,7 +1276,7 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid) for(i = length-1; (i >= 0) && *(extension = &absFile[i]) != '.'; i--) /* nothing */; - if (!extension || !lstrcmpW(extension, dotW)) { + if (!extension || !wcscmp(extension, dotW)) { CoTaskMemFree(pathDec); return MK_E_INVALIDEXTENSION; } diff --git a/dll/win32/ole32/ole2.c b/dll/win32/ole32/ole2.c index f1459829951..0ab5f37df5d 100644 --- a/dll/win32/ole32/ole2.c +++ b/dll/win32/ole32/ole2.c @@ -23,8 +23,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include #include @@ -44,7 +42,6 @@ #include "ole2.h" #include "ole2ver.h" -#include "wine/unicode.h" #include "compobj_private.h" #include "olestd.h" #include "wine/list.h" @@ -706,7 +703,7 @@ HRESULT WINAPI OleRegGetUserType(REFCLSID clsid, DWORD form, LPOLESTR *usertype) { HKEY auxkey; - sprintfW(auxkeynameW, auxusertypeW, form); + swprintf(auxkeynameW, auxusertypeW, form); if (COM_OpenKeyForCLSID(clsid, auxkeynameW, KEY_READ, &auxkey) == S_OK) { if (!RegQueryValueExW(auxkey, emptyW, NULL, &valuetype, NULL, &valuelen) && valuelen) @@ -895,7 +892,7 @@ HRESULT WINAPI OleRegGetMiscStatus( /* * Open the key specific to the requested aspect. */ - sprintfW(keyName, dfmtW, dwAspect); + swprintf(keyName, dfmtW, dwAspect); result = open_classes_key(miscStatusKey, keyName, KEY_READ, &aspectKey); if (result == ERROR_SUCCESS) @@ -1014,7 +1011,7 @@ static HRESULT WINAPI EnumOLEVERB_Next( } TRACE("verb string: %s\n", debugstr_w(pwszOLEVERB)); - pwszMenuFlags = strchrW(pwszOLEVERB, ','); + pwszMenuFlags = wcschr(pwszOLEVERB, ','); if (!pwszMenuFlags) { hr = OLEOBJ_E_INVALIDVERB; @@ -1024,7 +1021,7 @@ static HRESULT WINAPI EnumOLEVERB_Next( /* nul terminate the name string and advance to first character */ *pwszMenuFlags = '\0'; pwszMenuFlags++; - pwszAttribs = strchrW(pwszMenuFlags, ','); + pwszAttribs = wcschr(pwszMenuFlags, ','); if (!pwszAttribs) { hr = OLEOBJ_E_INVALIDVERB; @@ -1036,10 +1033,10 @@ static HRESULT WINAPI EnumOLEVERB_Next( pwszAttribs++; /* fill out structure for this verb */ - rgelt->lVerb = atolW(wszSubKey); + rgelt->lVerb = wcstol(wszSubKey, NULL, 10); rgelt->lpszVerbName = pwszOLEVERB; /* user should free */ - rgelt->fuFlags = atolW(pwszMenuFlags); - rgelt->grfAttribs = atolW(pwszAttribs); + rgelt->fuFlags = wcstol(pwszMenuFlags, NULL, 10); + rgelt->grfAttribs = wcstol(pwszAttribs, NULL, 10); if (pceltFetched) (*pceltFetched)++; @@ -2552,7 +2549,7 @@ static void OLEUTL_ReadRegistryDWORDValue( case REG_EXPAND_SZ: case REG_MULTI_SZ: case REG_SZ: - *pdwValue = (DWORD)strtoulW(buffer, NULL, 10); + *pdwValue = wcstoul(buffer, NULL, 10); break; } } @@ -2744,7 +2741,7 @@ HRESULT WINAPI OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew) if (FAILED(res)) goto done; StringFromGUID2(clsidNew, szClsidNew, CHARS_IN_GUID); - if (RegSetValueW(hkey, wszAutoConvertTo, REG_SZ, szClsidNew, (strlenW(szClsidNew)+1) * sizeof(WCHAR))) + if (RegSetValueW(hkey, wszAutoConvertTo, REG_SZ, szClsidNew, (lstrlenW(szClsidNew)+1) * sizeof(WCHAR))) { res = REGDB_E_WRITEREGDB; goto done; @@ -2940,6 +2937,25 @@ static inline HRESULT PROPVARIANT_ValidateType(VARTYPE vt) case VT_FILETIME|VT_VECTOR: case VT_CF|VT_VECTOR: case VT_CLSID|VT_VECTOR: + case VT_ARRAY|VT_I1: + case VT_ARRAY|VT_UI1: + case VT_ARRAY|VT_I2: + case VT_ARRAY|VT_UI2: + case VT_ARRAY|VT_I4: + case VT_ARRAY|VT_UI4: + case VT_ARRAY|VT_INT: + case VT_ARRAY|VT_UINT: + case VT_ARRAY|VT_R4: + case VT_ARRAY|VT_R8: + case VT_ARRAY|VT_CY: + case VT_ARRAY|VT_DATE: + case VT_ARRAY|VT_BSTR: + case VT_ARRAY|VT_BOOL: + case VT_ARRAY|VT_DECIMAL: + case VT_ARRAY|VT_DISPATCH: + case VT_ARRAY|VT_UNKNOWN: + case VT_ARRAY|VT_ERROR: + case VT_ARRAY|VT_VARIANT: return S_OK; } WARN("Bad type %d\n", vt); @@ -3051,6 +3067,8 @@ HRESULT WINAPI PropVariantClear(PROPVARIANT * pvar) /* [in/out] */ CoTaskMemFree(pvar->u.capropvar.pElems); } } + else if (pvar->vt & VT_ARRAY) + hr = SafeArrayDestroy(pvar->u.parray); else { WARN("Invalid/unsupported type %d\n", pvar->vt); @@ -3231,6 +3249,11 @@ HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, /* [out] */ else CopyMemory(pvarDest->u.capropvar.pElems, pvarSrc->u.capropvar.pElems, len * elemSize); } + else if (pvarSrc->vt & VT_ARRAY) + { + pvarDest->u.uhVal.QuadPart = 0; + return SafeArrayCopy(pvarSrc->u.parray, &pvarDest->u.parray); + } else WARN("Invalid/unsupported type %d\n", pvarSrc->vt); } diff --git a/dll/win32/ole32/ole2stubs.c b/dll/win32/ole32/ole2stubs.c index d7fd58c5264..49130c51584 100644 --- a/dll/win32/ole32/ole2stubs.c +++ b/dll/win32/ole32/ole2stubs.c @@ -19,8 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include "windef.h" diff --git a/dll/win32/ole32/ole32.spec b/dll/win32/ole32/ole32.spec index 97667918e9e..b56b01d84c6 100644 --- a/dll/win32/ole32/ole32.spec +++ b/dll/win32/ole32/ole32.spec @@ -22,11 +22,11 @@ @ stdcall CoCreateInstanceEx(ptr ptr long ptr long ptr) # CoCreateObjectInContext # CoDeactivateObject -@ stdcall -stub CoDisableCallCancellation(ptr) +@ stdcall CoDisableCallCancellation(ptr) @ stdcall -stub -version=0x600+ CoDisconnectContext(long) @ stdcall CoDisconnectObject(ptr long) @ stdcall CoDosDateTimeToFileTime(long long ptr) kernel32.DosDateTimeToFileTime -@ stdcall -stub CoEnableCallCancellation(ptr) +@ stdcall CoEnableCallCancellation(ptr) @ stdcall CoFileTimeNow(ptr) @ stdcall CoFileTimeToDosDateTime(ptr ptr ptr) kernel32.FileTimeToDosDateTime @ stdcall CoFreeAllLibraries() diff --git a/dll/win32/ole32/ole32_main.c b/dll/win32/ole32/ole32_main.c index 7c12f1ce33a..c38c525d5a6 100644 --- a/dll/win32/ole32/ole32_main.c +++ b/dll/win32/ole32/ole32_main.c @@ -18,9 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include diff --git a/dll/win32/ole32/oleobj.c b/dll/win32/ole32/oleobj.c index 44e15e551f5..13a873655f5 100644 --- a/dll/win32/ole32/oleobj.c +++ b/dll/win32/ole32/oleobj.c @@ -41,11 +41,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); static void release_statdata(STATDATA *data) { - if(data->formatetc.ptd) - { - CoTaskMemFree(data->formatetc.ptd); - data->formatetc.ptd = NULL; - } + CoTaskMemFree(data->formatetc.ptd); + data->formatetc.ptd = NULL; if(data->pAdvSink) { diff --git a/dll/win32/ole32/oleproxy.c b/dll/win32/ole32/oleproxy.c index a7b8e395104..b5c08ff1c5b 100644 --- a/dll/win32/ole32/oleproxy.c +++ b/dll/win32/ole32/oleproxy.c @@ -19,8 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include #include diff --git a/dll/win32/ole32/precomp.h b/dll/win32/ole32/precomp.h index c9ea8458419..634e3238ae8 100644 --- a/dll/win32/ole32/precomp.h +++ b/dll/win32/ole32/precomp.h @@ -2,8 +2,6 @@ #ifndef _OLE32_PCH_ #define _OLE32_PCH_ -#include - #include #include #include @@ -30,7 +28,6 @@ #include #include -#include #include "compobj_private.h" #include "dictionary.h" diff --git a/dll/win32/ole32/rpc.c b/dll/win32/ole32/rpc.c index bd4611d7d5f..895aa4010cd 100644 --- a/dll/win32/ole32/rpc.c +++ b/dll/win32/ole32/rpc.c @@ -20,9 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include @@ -39,7 +36,6 @@ #include "winerror.h" #include "winreg.h" #include "servprov.h" -#include "wine/unicode.h" #include "compobj_private.h" @@ -1684,7 +1680,7 @@ static HRESULT create_server(REFCLSID rclsid, HANDLE *process) /* EXE servers are started with the -Embedding switch. */ - strcatW(command, embedding); + lstrcatW(command, embedding); TRACE("activating local server %s for %s\n", debugstr_w(command), debugstr_guid(rclsid)); @@ -1800,7 +1796,7 @@ static HRESULT create_local_service(REFCLSID rclsid) static void get_localserver_pipe_name(WCHAR *pipefn, REFCLSID rclsid) { static const WCHAR wszPipeRef[] = {'\\','\\','.','\\','p','i','p','e','\\',0}; - strcpyW(pipefn, wszPipeRef); + lstrcpyW(pipefn, wszPipeRef); StringFromGUID2(rclsid, pipefn + ARRAY_SIZE(wszPipeRef) - 1, CHARS_IN_GUID); } diff --git a/dll/win32/ole32/stg_prop.c b/dll/win32/ole32/stg_prop.c index 4b968d6e9cc..d2e66a15c1e 100644 --- a/dll/win32/ole32/stg_prop.c +++ b/dll/win32/ole32/stg_prop.c @@ -36,9 +36,6 @@ * PropertyStorage_ReadFromStream */ -#include "config.h" -#include "wine/port.h" - #include #include #include @@ -52,7 +49,7 @@ #include "winbase.h" #include "winnls.h" #include "winuser.h" -#include "wine/unicode.h" +#include "wine/asm.h" #include "wine/debug.h" #include "dictionary.h" #include "storage32.h" @@ -61,10 +58,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(storage); -#ifdef _MSC_VER -#define __ASM_STDCALL_FUNC(name,args,code) -#endif - static inline StorageImpl *impl_from_IPropertySetStorage( IPropertySetStorage *iface ) { return CONTAINING_RECORD(iface, StorageImpl, base.IPropertySetStorage_iface); @@ -375,7 +368,7 @@ static HRESULT PropertyStorage_StringCopy(LPCSTR src, LCID srcCP, LPSTR *dst, size_t len; if (dstCP == CP_UNICODE) - len = (strlenW((LPCWSTR)src) + 1) * sizeof(WCHAR); + len = (lstrlenW((LPCWSTR)src) + 1) * sizeof(WCHAR); else len = strlen(src) + 1; *dst = CoTaskMemAlloc(len * sizeof(WCHAR)); @@ -943,7 +936,7 @@ static int PropertyStorage_PropNameCompare(const void *a, const void *b, { TRACE("(%s, %s)\n", debugstr_w(a), debugstr_w(b)); if (This->grfFlags & PROPSETFLAG_CASE_SENSITIVE) - return lstrcmpW(a, b); + return wcscmp(a, b); else return lstrcmpiW(a, b); } @@ -2513,7 +2506,7 @@ static void prop_enum_copy_cb(IUnknown *parent, void *orig, void *dest) if (dictionary_find(storage->propid_to_name, UlongToPtr(src_prop->propid), (void**)&name)) { - DWORD size = (strlenW(name) + 1) * sizeof(WCHAR); + DWORD size = (lstrlenW(name) + 1) * sizeof(WCHAR); dest_prop->lpwstrName = CoTaskMemAlloc(size); if (!dest_prop->lpwstrName) return; diff --git a/dll/win32/ole32/storage32.c b/dll/win32/ole32/storage32.c index a8bbd407dd7..fa3872dad07 100644 --- a/dll/win32/ole32/storage32.c +++ b/dll/win32/ole32/storage32.c @@ -43,7 +43,6 @@ #include "winbase.h" #include "winnls.h" #include "winuser.h" -#include "wine/unicode.h" #include "wine/debug.h" #include "storage32.h" @@ -519,7 +518,7 @@ static LONG entryNameCmp( /* * We compare the string themselves only when they are of the same length */ - diff = toupperW(*name1++) - toupperW(*name2++); + diff = towupper(*name1++) - towupper(*name2++); } return diff; @@ -1347,7 +1346,7 @@ static HRESULT StorageBaseImpl_CopyChildEntryTo(StorageBaseImpl *This, while ( *snb != NULL && !skip ) { - if ( lstrcmpW(data.name, *snb) == 0 ) + if ( wcscmp(data.name, *snb) == 0 ) skip = TRUE; ++snb; } @@ -1891,7 +1890,7 @@ static HRESULT WINAPI StorageBaseImpl_RenameElement( currentEntryRef); /* Change the name of the element */ - strcpyW(currentEntry.name, pwcsNewName); + lstrcpyW(currentEntry.name, pwcsNewName); /* Delete any sibling links */ currentEntry.leftChild = DIRENTRY_NULL; @@ -2013,7 +2012,7 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream( if (newStreamEntry.sizeOfNameString > DIRENTRY_NAME_BUFFER_LEN) return STG_E_INVALIDNAME; - strcpyW(newStreamEntry.name, pwcsName); + lstrcpyW(newStreamEntry.name, pwcsName); newStreamEntry.stgType = STGTY_STREAM; newStreamEntry.startingBlock = BLOCK_END_OF_CHAIN; @@ -2209,7 +2208,7 @@ static HRESULT WINAPI StorageBaseImpl_CreateStorage( return STG_E_INVALIDNAME; } - strcpyW(newEntry.name, pwcsName); + lstrcpyW(newEntry.name, pwcsName); newEntry.stgType = STGTY_STORAGE; newEntry.startingBlock = BLOCK_END_OF_CHAIN; @@ -2357,7 +2356,7 @@ static HRESULT WINAPI StorageBaseImpl_CopyTo( while ( *snb != NULL && fail ) { - if ( lstrcmpW(data.name, *snb) == 0 ) + if ( wcscmp(data.name, *snb) == 0 ) fail = FALSE; ++snb; } @@ -4768,7 +4767,7 @@ static HRESULT StorageImpl_Refresh(StorageImpl *This, BOOL new_object, BOOL crea * Initialize the directory table */ memset(&rootEntry, 0, sizeof(rootEntry)); - strcpyW(rootEntry.name, rootentryW); + lstrcpyW(rootEntry.name, rootentryW); rootEntry.sizeOfNameString = sizeof(rootentryW); rootEntry.stgType = STGTY_ROOT; rootEntry.leftChild = DIRENTRY_NULL; @@ -7040,7 +7039,7 @@ void StorageUtl_CopyDirEntryToSTATSTG( destination->pwcsName = CoTaskMemAlloc((lstrlenW(source->name)+1)*sizeof(WCHAR)); - strcpyW(destination->pwcsName, source->name); + lstrcpyW(destination->pwcsName, source->name); } switch (source->stgType) diff --git a/dll/win32/ole32/usrmarshal.c b/dll/win32/ole32/usrmarshal.c index 9f19b66d635..ba318c66b62 100644 --- a/dll/win32/ole32/usrmarshal.c +++ b/dll/win32/ole32/usrmarshal.c @@ -35,7 +35,6 @@ #include "oleauto.h" #include "rpcproxy.h" -#include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -1716,7 +1715,7 @@ ULONG __RPC_USER STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, STGMEDIUM { TRACE("file name is %s\n", debugstr_w(pStgMedium->u.lpszFileName)); size += 3 * sizeof(DWORD) + - (strlenW(pStgMedium->u.lpszFileName) + 1) * sizeof(WCHAR); + (lstrlenW(pStgMedium->u.lpszFileName) + 1) * sizeof(WCHAR); } break; case TYMED_ISTREAM: @@ -1814,7 +1813,7 @@ unsigned char * __RPC_USER STGMEDIUM_UserMarshal(ULONG *pFlags, unsigned char *p if (pStgMedium->u.lpszFileName) { DWORD len; - len = strlenW(pStgMedium->u.lpszFileName); + len = lstrlenW(pStgMedium->u.lpszFileName); /* conformance */ *(DWORD *)pBuffer = len + 1; pBuffer += sizeof(DWORD); @@ -2126,7 +2125,7 @@ ULONG __RPC_USER SNB_UserSize(ULONG *pFlags, ULONG StartingSize, SNB *pSnb) while (*ptrW) { - size += (strlenW(*ptrW) + 1)*sizeof(WCHAR); + size += (lstrlenW(*ptrW) + 1)*sizeof(WCHAR); ptrW++; } } @@ -2161,7 +2160,7 @@ unsigned char * __RPC_USER SNB_UserMarshal(ULONG *pFlags, unsigned char *pBuffer while (*ptrW) { - ULONG len = strlenW(*ptrW) + 1; + ULONG len = lstrlenW(*ptrW) + 1; wire->strcnt++; wire->charcnt += len; @@ -2202,7 +2201,7 @@ unsigned char * __RPC_USER SNB_UserUnmarshal(ULONG *pFlags, unsigned char *pBuff for (i = 0; i < wire->strcnt; i++) { - ULONG len = strlenW(src); + ULONG len = lstrlenW(src); memcpy(dest, src, (len + 1)*sizeof(WCHAR)); *ptrW = dest; src += len + 1; diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 352ad732cf6..2376a96c5ae 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -140,7 +140,7 @@ dll/win32/ntdsapi # Synced to WineStaging-4.18 dll/win32/objsel # Synced to WineStaging-4.18 dll/win32/odbc32 # Synced to WineStaging-4.18. Depends on port of Linux ODBC. dll/win32/odbccp32 # Synced to WineStaging-4.18 -dll/win32/ole32 # Synced to WineStaging-4.0 +dll/win32/ole32 # Synced to WineStaging-4.18 dll/win32/oleacc # Synced to WineStaging-4.0 dll/win32/oleaut32 # Synced to WineStaging-4.0 dll/win32/olecli32 # Synced to WineStaging-3.3