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