Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/combase/combase.c | 16 +++++++++++++ dlls/combase/combase.spec | 2 +- dlls/combase/combase_private.h | 42 ++++++++++++++++++++++++++++++++++ dlls/ole32/compobj_private.h | 11 ++++----- 4 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 dlls/combase/combase_private.h
diff --git a/dlls/combase/combase.c b/dlls/combase/combase.c index 8d8d83005bc..cceb36a5931 100644 --- a/dlls/combase/combase.c +++ b/dlls/combase/combase.c @@ -27,6 +27,8 @@ #include "oleauto.h" #include "winternl.h"
+#include "combase_private.h" + #include "wine/debug.h" #include "wine/heap.h"
@@ -223,6 +225,20 @@ static HRESULT open_key_for_clsid(REFCLSID clsid, const WCHAR *keyname, REGSAM a return S_OK; }
+/*********************************************************************** + * InternalTlsAllocData (combase.@) + */ +HRESULT WINAPI InternalTlsAllocData(struct tlsdata **data) +{ + if (!(*data = heap_alloc_zero(sizeof(**data)))) + return E_OUTOFMEMORY; + + list_init(&(*data)->spies); + NtCurrentTeb()->ReservedForOle = *data; + + return S_OK; +} + /*********************************************************************** * FreePropVariantArray (combase.@) */ diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index 0f34dc6918e..1298fedd9ec 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -274,7 +274,7 @@ @ stub InternalSetAptCallCtrlOnTlsIfRequired @ stub InternalSetOleThunkWowPtr @ stub InternalStubInvoke -@ stub InternalTlsAllocData +@ stdcall InternalTlsAllocData(ptr) @ stub InternalUnmarshalObjRef @ stub IsErrorPropagationEnabled @ stub NdrExtStubInitialize diff --git a/dlls/combase/combase_private.h b/dlls/combase/combase_private.h new file mode 100644 index 00000000000..5ba9c84650e --- /dev/null +++ b/dlls/combase/combase_private.h @@ -0,0 +1,42 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "wine/list.h" + +struct apartment; + +/* this is what is stored in TEB->ReservedForOle */ +struct tlsdata +{ + struct apartment *apt; + IErrorInfo *errorinfo; + DWORD thread_seqid;/* returned with CoGetCurrentProcess */ + DWORD apt_mask; /* apartment mask (+0Ch on x86) */ + 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 */ + LONG pending_call_count_client; /* number of client calls pending */ + LONG pending_call_count_server; /* number of server calls pending */ + DWORD unknown; + IObjContext *context_token; /* (+38h on x86) */ + IUnknown *call_state; /* current call context (+3Ch on x86) */ + DWORD unknown2[46]; + IUnknown *cancel_object; /* cancel object set by CoSetCancelObject (+F8h on x86) */ + IUnknown *state; /* see CoSetState */ + struct list spies; /* Spies installed with CoRegisterInitializeSpy */ + DWORD spies_lock; +}; diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h index b64dfbf4f4a..5d7bf50b73f 100644 --- a/dlls/ole32/compobj_private.h +++ b/dlls/ole32/compobj_private.h @@ -269,16 +269,15 @@ APARTMENT *apartment_get_current_or_mta(void) DECLSPEC_HIDDEN; * Per-thread values are stored in the TEB on offset 0xF80 */
+extern HRESULT WINAPI InternalTlsAllocData(struct oletls **tlsdata); + /* will create if necessary */ static inline struct oletls *COM_CurrentInfo(void) { + struct oletls *oletls; + if (!NtCurrentTeb()->ReservedForOle) - { - struct oletls *oletls = heap_alloc_zero(sizeof(*oletls)); - if (oletls) - list_init(&oletls->spies); - NtCurrentTeb()->ReservedForOle = oletls; - } + InternalTlsAllocData(&oletls);
return NtCurrentTeb()->ReservedForOle; }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/combase/combase.spec | 2 +- dlls/combase/combase_private.h | 10 ++++++++ dlls/combase/errorinfo.c | 30 ++++++++++++++++++++++++ dlls/ole32/errorinfo.c | 43 ---------------------------------- dlls/ole32/ole32.spec | 2 +- 5 files changed, 42 insertions(+), 45 deletions(-)
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index 1298fedd9ec..e5ffc214798 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -182,7 +182,7 @@ @ stdcall FreePropVariantArray(long ptr) @ stub FreePropVariantArrayWorker @ stub GetCatalogHelper -@ stdcall GetErrorInfo(long ptr) ole32.GetErrorInfo +@ stdcall GetErrorInfo(long ptr) @ stub GetFuncDescs @ stdcall GetHGlobalFromStream(ptr ptr) ole32.GetHGlobalFromStream @ stub GetHookInterface diff --git a/dlls/combase/combase_private.h b/dlls/combase/combase_private.h index 5ba9c84650e..bae57e89487 100644 --- a/dlls/combase/combase_private.h +++ b/dlls/combase/combase_private.h @@ -14,6 +14,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#include "winternl.h" + #include "wine/list.h"
struct apartment; @@ -40,3 +42,11 @@ struct tlsdata struct list spies; /* Spies installed with CoRegisterInitializeSpy */ DWORD spies_lock; }; + +extern HRESULT WINAPI InternalTlsAllocData(struct tlsdata **data); + +static inline HRESULT com_get_tlsdata(struct tlsdata **data) +{ + *data = NtCurrentTeb()->ReservedForOle; + return *data ? S_OK : InternalTlsAllocData(data); +} diff --git a/dlls/combase/errorinfo.c b/dlls/combase/errorinfo.c index 3fcc65a31e1..aac00fd4eb1 100644 --- a/dlls/combase/errorinfo.c +++ b/dlls/combase/errorinfo.c @@ -22,6 +22,8 @@
#include "oleauto.h"
+#include "combase_private.h" + #include "wine/debug.h" #include "wine/heap.h"
@@ -354,3 +356,31 @@ HRESULT WINAPI CreateErrorInfo(ICreateErrorInfo **ret)
return S_OK; } + +/*********************************************************************** + * GetErrorInfo (combase.@) + */ +HRESULT WINAPI GetErrorInfo(ULONG reserved, IErrorInfo **error_info) +{ + struct tlsdata *tlsdata; + HRESULT hr; + + TRACE("%u, %p\n", reserved, error_info); + + if (reserved || !error_info) + return E_INVALIDARG; + + if (FAILED(hr = com_get_tlsdata(&tlsdata))) + return hr; + + if (!tlsdata->errorinfo) + { + *error_info = NULL; + return S_FALSE; + } + + *error_info = tlsdata->errorinfo; + tlsdata->errorinfo = NULL; + + return S_OK; +} diff --git a/dlls/ole32/errorinfo.c b/dlls/ole32/errorinfo.c index 45591ba4a1f..d36c6c8c0f0 100644 --- a/dlls/ole32/errorinfo.c +++ b/dlls/ole32/errorinfo.c @@ -40,49 +40,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(ole);
-/*********************************************************************** - * GetErrorInfo (OLE32.@) - * - * Retrieves the error information object for the current thread. - * - * PARAMS - * dwReserved [I]. Reserved. Must be zero. - * pperrinfo [O]. Address where error information object will be stored on return. - * - * RETURNS - * Success: S_OK if an error information object was set for the current thread. - * S_FALSE if otherwise. - * Failure: E_INVALIDARG if dwReserved is not zero. - * - * NOTES - * This function causes the current error info object for the thread to be - * cleared if one was set beforehand. - */ -HRESULT WINAPI GetErrorInfo(ULONG dwReserved, IErrorInfo **pperrinfo) -{ - TRACE("(%d, %p, %p)\n", dwReserved, pperrinfo, COM_CurrentInfo()->errorinfo); - - if (dwReserved) - { - ERR("dwReserved (0x%x) != 0\n", dwReserved); - return E_INVALIDARG; - } - - if(!pperrinfo) return E_INVALIDARG; - - if (!COM_CurrentInfo()->errorinfo) - { - *pperrinfo = NULL; - return S_FALSE; - } - - *pperrinfo = COM_CurrentInfo()->errorinfo; - - /* clear thread error state */ - COM_CurrentInfo()->errorinfo = NULL; - return S_OK; -} - /*********************************************************************** * SetErrorInfo (OLE32.@) * diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec index 7b2c5836611..fb78ab8b6ff 100644 --- a/dlls/ole32/ole32.spec +++ b/dlls/ole32/ole32.spec @@ -118,7 +118,7 @@ @ stdcall GetClassFile(wstr ptr) @ stdcall GetConvertStg(ptr) @ stub GetDocumentBitStg -@ stdcall GetErrorInfo(long ptr) +@ stdcall GetErrorInfo(long ptr) combase.GetErrorInfo @ stdcall GetHGlobalFromILockBytes(ptr ptr) @ stdcall GetHGlobalFromStream(ptr ptr) @ stub GetHookInterface
Signed-off-by: Huw Davies huw@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/combase/combase.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index e5ffc214798..cd8ed1c6352 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -107,7 +107,7 @@ @ stdcall CoGetCurrentLogicalThreadId(ptr) ole32.CoGetCurrentLogicalThreadId @ stdcall CoGetCurrentProcess() ole32.CoGetCurrentProcess @ stdcall CoGetDefaultContext(long ptr ptr) -@ stub CoGetErrorInfo +@ stdcall CoGetErrorInfo(long ptr) GetErrorInfo @ stdcall CoGetInstanceFromFile(ptr ptr ptr long long wstr long ptr) @ stdcall CoGetInstanceFromIStorage(ptr ptr ptr long ptr long ptr) @ stdcall CoGetInterfaceAndReleaseStream(ptr ptr ptr)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=77232
Your paranoid android.
=== debiant (64 bit WoW report) ===
ole32: clipboard.c:1529: Test failed: gle 5 clipboard.c:1531: Test failed: gle 1418 clipboard.c:1533: Test failed: gle 1418 clipboard.c:1544: Test failed: got 00000000 clipboard.c:1585: Test failed: tymed 1 clipboard.c:1588: Test failed: got 00000001 clipboard.c:1589: Test failed: cf 0001 clipboard.c:1593: Test failed: tymed 1 clipboard.c:1596: Test failed: got 00000001 clipboard.c:1597: Test failed: cf 0001 clipboard.c:1601: Test failed: tymed 1 clipboard.c:1604: Test failed: got 00000001 clipboard.c:1605: Test failed: cf 0001 clipboard.c:1609: Test failed: tymed 1 clipboard.c:1612: Test failed: got 00000001 clipboard.c:1614: Test failed: cf 0001 clipboard.c:1621: Test failed: got 00000001 clipboard.c:1623: Test failed: cf 0001 clipboard.c:1627: Test failed: tymed 1 clipboard.c:1630: Test failed: got 00000001 clipboard.c:1631: Test failed: cf 0001 clipboard.c:1635: Test failed: tymed 1 clipboard.c:1638: Test failed: got 00000001 clipboard.c:1639: Test failed: cf 0001 clipboard.c:1643: Test failed: tymed 1 clipboard.c:1658: Test failed: got 80040069 clipboard.c:1659: Test failed: got 0
Signed-off-by: Huw Davies huw@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/combase/combase.spec | 2 +- dlls/combase/errorinfo.c | 26 +++++++++++++ dlls/ole32/Makefile.in | 1 - dlls/ole32/errorinfo.c | 77 --------------------------------------- dlls/ole32/ole32.spec | 2 +- 5 files changed, 28 insertions(+), 80 deletions(-) delete mode 100644 dlls/ole32/errorinfo.c
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index cd8ed1c6352..608fe84af8c 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -317,7 +317,7 @@ @ stdcall RoUninitialize() @ stub RoUnregisterForApartmentShutdown @ stub SetCleanupFlag -@ stdcall SetErrorInfo(long ptr) ole32.SetErrorInfo +@ stdcall SetErrorInfo(long ptr) @ stub SetRestrictedErrorInfo @ stdcall StringFromCLSID(ptr ptr) @ stdcall StringFromGUID2(ptr ptr long) diff --git a/dlls/combase/errorinfo.c b/dlls/combase/errorinfo.c index aac00fd4eb1..83e2f0b7103 100644 --- a/dlls/combase/errorinfo.c +++ b/dlls/combase/errorinfo.c @@ -384,3 +384,29 @@ HRESULT WINAPI GetErrorInfo(ULONG reserved, IErrorInfo **error_info)
return S_OK; } + +/*********************************************************************** + * SetErrorInfo (combase.@) + */ +HRESULT WINAPI SetErrorInfo(ULONG reserved, IErrorInfo *error_info) +{ + struct tlsdata *tlsdata; + HRESULT hr; + + TRACE("%u, %p\n", reserved, error_info); + + if (reserved) + return E_INVALIDARG; + + if (FAILED(hr = com_get_tlsdata(&tlsdata))) + return hr; + + if (tlsdata->errorinfo) + IErrorInfo_Release(tlsdata->errorinfo); + + tlsdata->errorinfo = error_info; + if (error_info) + IErrorInfo_AddRef(error_info); + + return S_OK; +} diff --git a/dlls/ole32/Makefile.in b/dlls/ole32/Makefile.in index 86f13e188cf..a113c7622b4 100644 --- a/dlls/ole32/Makefile.in +++ b/dlls/ole32/Makefile.in @@ -17,7 +17,6 @@ C_SRCS = \ datacache.c \ defaulthandler.c \ dictionary.c \ - errorinfo.c \ filelockbytes.c \ filemoniker.c \ ftmarshal.c \ diff --git a/dlls/ole32/errorinfo.c b/dlls/ole32/errorinfo.c deleted file mode 100644 index d36c6c8c0f0..00000000000 --- a/dlls/ole32/errorinfo.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * ErrorInfo API - * - * Copyright 2000 Patrik Stridvall, Juergen Schmied - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - * - * NOTES: - * - * The errorinfo is a per-thread object. The reference is stored in the - * TEB at offset 0xf80. - */ - -#include <stdarg.h> -#include <string.h> - -#define COBJMACROS - -#include "windef.h" -#include "winbase.h" -#include "objbase.h" -#include "oleauto.h" -#include "winerror.h" - -#include "compobj_private.h" - -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(ole); - -/*********************************************************************** - * SetErrorInfo (OLE32.@) - * - * Sets the error information object for the current thread. - * - * PARAMS - * dwReserved [I] Reserved. Must be zero. - * perrinfo [I] Error info object. - * - * RETURNS - * Success: S_OK. - * Failure: E_INVALIDARG if dwReserved is not zero. - */ -HRESULT WINAPI SetErrorInfo(ULONG dwReserved, IErrorInfo *perrinfo) -{ - IErrorInfo * pei; - - TRACE("(%d, %p)\n", dwReserved, perrinfo); - - if (dwReserved) - { - ERR("dwReserved (0x%x) != 0\n", dwReserved); - return E_INVALIDARG; - } - - /* release old errorinfo */ - pei = COM_CurrentInfo()->errorinfo; - if (pei) IErrorInfo_Release(pei); - - /* set to new value */ - COM_CurrentInfo()->errorinfo = perrinfo; - if (perrinfo) IErrorInfo_AddRef(perrinfo); - - return S_OK; -} diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec index fb78ab8b6ff..f21f6429ca5 100644 --- a/dlls/ole32/ole32.spec +++ b/dlls/ole32/ole32.spec @@ -262,7 +262,7 @@ @ stdcall STGMEDIUM_UserUnmarshal(ptr ptr ptr) @ stdcall SetConvertStg(ptr long) @ stub SetDocumentBitStg -@ stdcall SetErrorInfo(long ptr) +@ stdcall SetErrorInfo(long ptr) combase.SetErrorInfo @ stdcall StgConvertPropertyToVariant(ptr long ptr ptr) @ stdcall StgConvertVariantToProperty(ptr long ptr ptr long long ptr) @ stdcall StgCreateDocfile(wstr long long ptr)
Signed-off-by: Huw Davies huw@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/combase/combase.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec index 608fe84af8c..8a91088ca4e 100644 --- a/dlls/combase/combase.spec +++ b/dlls/combase/combase.spec @@ -155,7 +155,7 @@ @ stdcall CoRevokeInitializeSpy(int64) ole32.CoRevokeInitializeSpy @ stdcall CoRevokeMallocSpy() @ stub CoSetCancelObject -@ stub CoSetErrorInfo +@ stdcall CoSetErrorInfo(long ptr) SetErrorInfo @ stdcall CoSetProxyBlanket(ptr long long ptr long long ptr long) @ stdcall CoSuspendClassObjects() ole32.CoSuspendClassObjects @ stdcall CoSwitchCallContext(ptr ptr) ole32.CoSwitchCallContext
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=77234
Your paranoid android.
=== debiant (64 bit WoW report) ===
ole32: clipboard.c:1201: Test failed: got 800401d0 clipboard.c:1213: Test failed: got 80040064 clipboard.c:1214: Test failed: GetData not called clipboard.c:1217: Test failed: 1 1 clipboard.c:1223: Test failed: got 80040064 clipboard.c:1224: Test failed: GetData not called clipboard.c:1228: Test failed: 1
Signed-off-by: Huw Davies huw@codeweavers.com
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=77230
Your paranoid android.
=== debiant (64 bit WoW report) ===
ole32: clipboard.c:1159: Test failed: got 800401d0 clipboard.c:1175: Test failed: got 800401d0 clipboard.c:1182: Test failed: data objects match clipboard.c:1185: Test failed: Failed to clear clipboard, hr 0x800401d0. clipboard.c:1190: Test failed: data objects match clipboard.c:1191: Test failed: data objects match clipboard.c:1201: Test failed: got 800401d0 clipboard.c:1213: Test failed: got 800401d0 clipboard.c:1214: Test failed: GetData not called clipboard.c:1217: Test failed: 1 1 clipboard.c:1223: Test failed: got 800401d0 clipboard.c:1224: Test failed: GetData not called clipboard.c:1228: Test failed: 1 clipboard.c:1239: Test failed: got 800401d0 clipboard.c:1250: Test failed: got 800401d0 clipboard.c:1256: Test failed: got 800401d0 clipboard.c:1257: Test failed: GetData not called clipboard.c:1263: Test failed: 1 1 clipboard.c:1266: Test failed: Failed to clear clipboard, hr 0x800401d0. clipboard.c:1269: Test failed: 1 clipboard.c:1281: Test failed: Failed to clear clipboard, hr 0x800401d0. clipboard.c:1283: Test failed: 1 1 clipboard.c:1287: Test failed: 1