combase: Move GetErrorInfo().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-08-17 10:20:50 +03:00 committed by Alexandre Julliard
parent 6153eefcba
commit 826f24cefd
5 changed files with 42 additions and 45 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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.@)
*

View File

@ -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