[PATCH 4/5] combase: Move SetErrorInfo().

Nikolay Sivov nsivov at codeweavers.com
Mon Aug 17 02:20:52 CDT 2020


Signed-off-by: Nikolay Sivov <nsivov at 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)
-- 
2.28.0




More information about the wine-devel mailing list