Commit 826f24ce authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

combase: Move GetErrorInfo().

parent 6153eefc
...@@ -182,7 +182,7 @@ ...@@ -182,7 +182,7 @@
@ stdcall FreePropVariantArray(long ptr) @ stdcall FreePropVariantArray(long ptr)
@ stub FreePropVariantArrayWorker @ stub FreePropVariantArrayWorker
@ stub GetCatalogHelper @ stub GetCatalogHelper
@ stdcall GetErrorInfo(long ptr) ole32.GetErrorInfo @ stdcall GetErrorInfo(long ptr)
@ stub GetFuncDescs @ stub GetFuncDescs
@ stdcall GetHGlobalFromStream(ptr ptr) ole32.GetHGlobalFromStream @ stdcall GetHGlobalFromStream(ptr ptr) ole32.GetHGlobalFromStream
@ stub GetHookInterface @ stub GetHookInterface
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "winternl.h"
#include "wine/list.h" #include "wine/list.h"
struct apartment; struct apartment;
...@@ -40,3 +42,11 @@ struct tlsdata ...@@ -40,3 +42,11 @@ struct tlsdata
struct list spies; /* Spies installed with CoRegisterInitializeSpy */ struct list spies; /* Spies installed with CoRegisterInitializeSpy */
DWORD spies_lock; 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);
}
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include "oleauto.h" #include "oleauto.h"
#include "combase_private.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h" #include "wine/heap.h"
...@@ -354,3 +356,31 @@ HRESULT WINAPI CreateErrorInfo(ICreateErrorInfo **ret) ...@@ -354,3 +356,31 @@ HRESULT WINAPI CreateErrorInfo(ICreateErrorInfo **ret)
return S_OK; 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;
}
...@@ -41,49 +41,6 @@ ...@@ -41,49 +41,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(ole); 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.@) * SetErrorInfo (OLE32.@)
* *
* Sets the error information object for the current thread. * Sets the error information object for the current thread.
......
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
@ stdcall GetClassFile(wstr ptr) @ stdcall GetClassFile(wstr ptr)
@ stdcall GetConvertStg(ptr) @ stdcall GetConvertStg(ptr)
@ stub GetDocumentBitStg @ stub GetDocumentBitStg
@ stdcall GetErrorInfo(long ptr) @ stdcall GetErrorInfo(long ptr) combase.GetErrorInfo
@ stdcall GetHGlobalFromILockBytes(ptr ptr) @ stdcall GetHGlobalFromILockBytes(ptr ptr)
@ stdcall GetHGlobalFromStream(ptr ptr) @ stdcall GetHGlobalFromStream(ptr ptr)
@ stub GetHookInterface @ stub GetHookInterface
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment