combase: Move CreateErrorInfo() function.
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:
parent
4ae64d59de
commit
7f43de677a
|
@ -1,10 +1,12 @@
|
||||||
MODULE = combase.dll
|
MODULE = combase.dll
|
||||||
IMPORTLIB = combase
|
IMPORTLIB = combase
|
||||||
IMPORTS = advapi32 ole32 user32 gdi32 uuid
|
IMPORTS = advapi32 ole32 user32 gdi32 uuid
|
||||||
|
DELAYIMPORTS = oleaut32
|
||||||
|
|
||||||
EXTRADLLFLAGS = -mno-cygwin
|
EXTRADLLFLAGS = -mno-cygwin
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
|
errorinfo.c \
|
||||||
roapi.c \
|
roapi.c \
|
||||||
string.c \
|
string.c \
|
||||||
usrmarshal.c
|
usrmarshal.c
|
||||||
|
|
|
@ -170,7 +170,7 @@
|
||||||
@ stub CoVrfReleaseThreadState
|
@ stub CoVrfReleaseThreadState
|
||||||
@ stdcall CoWaitForMultipleHandles(long long long ptr ptr) ole32.CoWaitForMultipleHandles
|
@ stdcall CoWaitForMultipleHandles(long long long ptr ptr) ole32.CoWaitForMultipleHandles
|
||||||
@ stub CoWaitForMultipleObjects
|
@ stub CoWaitForMultipleObjects
|
||||||
@ stdcall CreateErrorInfo(ptr) ole32.CreateErrorInfo
|
@ stdcall CreateErrorInfo(ptr)
|
||||||
@ stdcall CreateStreamOnHGlobal(ptr long ptr) ole32.CreateStreamOnHGlobal
|
@ stdcall CreateStreamOnHGlobal(ptr long ptr) ole32.CreateStreamOnHGlobal
|
||||||
@ stub DcomChannelSetHResult
|
@ stub DcomChannelSetHResult
|
||||||
@ stdcall DllDebugObjectRPCHook(long ptr) ole32.DllDebugObjectRPCHook
|
@ stdcall DllDebugObjectRPCHook(long ptr) ole32.DllDebugObjectRPCHook
|
||||||
|
|
|
@ -0,0 +1,356 @@
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
|
||||||
|
#include "oleauto.h"
|
||||||
|
|
||||||
|
#include "wine/debug.h"
|
||||||
|
#include "wine/heap.h"
|
||||||
|
|
||||||
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||||
|
|
||||||
|
static WCHAR *heap_strdupW(const WCHAR *str)
|
||||||
|
{
|
||||||
|
WCHAR *ret = NULL;
|
||||||
|
|
||||||
|
if (str)
|
||||||
|
{
|
||||||
|
size_t size;
|
||||||
|
|
||||||
|
size = (lstrlenW(str)+1)*sizeof(WCHAR);
|
||||||
|
ret = heap_alloc(size);
|
||||||
|
if (ret)
|
||||||
|
memcpy(ret, str, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct error_info
|
||||||
|
{
|
||||||
|
IErrorInfo IErrorInfo_iface;
|
||||||
|
ICreateErrorInfo ICreateErrorInfo_iface;
|
||||||
|
ISupportErrorInfo ISupportErrorInfo_iface;
|
||||||
|
LONG refcount;
|
||||||
|
|
||||||
|
GUID guid;
|
||||||
|
WCHAR *source;
|
||||||
|
WCHAR *description;
|
||||||
|
WCHAR *help_file;
|
||||||
|
DWORD help_context;
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct error_info *impl_from_IErrorInfo(IErrorInfo *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, struct error_info, IErrorInfo_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct error_info *impl_from_ICreateErrorInfo(ICreateErrorInfo *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, struct error_info, ICreateErrorInfo_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct error_info *impl_from_ISupportErrorInfo(ISupportErrorInfo *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, struct error_info, ISupportErrorInfo_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI errorinfo_QueryInterface(IErrorInfo *iface, REFIID riid, void **obj)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_IErrorInfo(iface);
|
||||||
|
|
||||||
|
TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
|
||||||
|
|
||||||
|
*obj = NULL;
|
||||||
|
|
||||||
|
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IErrorInfo))
|
||||||
|
{
|
||||||
|
*obj = &error_info->IErrorInfo_iface;
|
||||||
|
}
|
||||||
|
else if (IsEqualIID(riid, &IID_ICreateErrorInfo))
|
||||||
|
{
|
||||||
|
*obj = &error_info->ICreateErrorInfo_iface;
|
||||||
|
}
|
||||||
|
else if (IsEqualIID(riid, &IID_ISupportErrorInfo))
|
||||||
|
{
|
||||||
|
*obj = &error_info->ISupportErrorInfo_iface;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*obj)
|
||||||
|
{
|
||||||
|
IUnknown_AddRef((IUnknown *)*obj);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
WARN("Unsupported interface %s.\n", debugstr_guid(riid));
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI errorinfo_AddRef(IErrorInfo *iface)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_IErrorInfo(iface);
|
||||||
|
ULONG refcount = InterlockedIncrement(&error_info->refcount);
|
||||||
|
|
||||||
|
TRACE("%p, refcount %u.\n", iface, refcount);
|
||||||
|
|
||||||
|
return refcount;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI errorinfo_Release(IErrorInfo *iface)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_IErrorInfo(iface);
|
||||||
|
ULONG refcount = InterlockedDecrement(&error_info->refcount);
|
||||||
|
|
||||||
|
TRACE("%p, refcount %u.\n", iface, refcount);
|
||||||
|
|
||||||
|
if (!refcount)
|
||||||
|
{
|
||||||
|
heap_free(error_info->source);
|
||||||
|
heap_free(error_info->description);
|
||||||
|
heap_free(error_info->help_file);
|
||||||
|
heap_free(error_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
return refcount;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI errorinfo_GetGUID(IErrorInfo *iface, GUID *guid)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_IErrorInfo(iface);
|
||||||
|
|
||||||
|
TRACE("%p, %p.\n", iface, guid);
|
||||||
|
|
||||||
|
if (!guid) return E_INVALIDARG;
|
||||||
|
*guid = error_info->guid;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI errorinfo_GetSource(IErrorInfo* iface, BSTR *source)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_IErrorInfo(iface);
|
||||||
|
|
||||||
|
TRACE("%p, %p.\n", iface, source);
|
||||||
|
|
||||||
|
if (!source)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
*source = SysAllocString(error_info->source);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI errorinfo_GetDescription(IErrorInfo *iface, BSTR *description)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_IErrorInfo(iface);
|
||||||
|
|
||||||
|
TRACE("%p, %p.\n", iface, description);
|
||||||
|
|
||||||
|
if (!description)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
*description = SysAllocString(error_info->description);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI errorinfo_GetHelpFile(IErrorInfo *iface, BSTR *helpfile)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_IErrorInfo(iface);
|
||||||
|
|
||||||
|
TRACE("%p, %p.\n", iface, helpfile);
|
||||||
|
|
||||||
|
if (!helpfile)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
*helpfile = SysAllocString(error_info->help_file);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI errorinfo_GetHelpContext(IErrorInfo *iface, DWORD *help_context)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_IErrorInfo(iface);
|
||||||
|
|
||||||
|
TRACE("%p, %p.\n", iface, help_context);
|
||||||
|
|
||||||
|
if (!help_context)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
*help_context = error_info->help_context;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const IErrorInfoVtbl errorinfo_vtbl =
|
||||||
|
{
|
||||||
|
errorinfo_QueryInterface,
|
||||||
|
errorinfo_AddRef,
|
||||||
|
errorinfo_Release,
|
||||||
|
errorinfo_GetGUID,
|
||||||
|
errorinfo_GetSource,
|
||||||
|
errorinfo_GetDescription,
|
||||||
|
errorinfo_GetHelpFile,
|
||||||
|
errorinfo_GetHelpContext
|
||||||
|
};
|
||||||
|
|
||||||
|
static HRESULT WINAPI create_errorinfo_QueryInterface(ICreateErrorInfo *iface, REFIID riid, void **obj)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_ICreateErrorInfo(iface);
|
||||||
|
return IErrorInfo_QueryInterface(&error_info->IErrorInfo_iface, riid, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI create_errorinfo_AddRef(ICreateErrorInfo *iface)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_ICreateErrorInfo(iface);
|
||||||
|
return IErrorInfo_AddRef(&error_info->IErrorInfo_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI create_errorinfo_Release(ICreateErrorInfo *iface)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_ICreateErrorInfo(iface);
|
||||||
|
return IErrorInfo_Release(&error_info->IErrorInfo_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI create_errorinfo_SetGUID(ICreateErrorInfo *iface, REFGUID guid)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_ICreateErrorInfo(iface);
|
||||||
|
|
||||||
|
TRACE("%p, %s.\n", iface, debugstr_guid(guid));
|
||||||
|
|
||||||
|
error_info->guid = *guid;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI create_errorinfo_SetSource(ICreateErrorInfo *iface, LPOLESTR source)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_ICreateErrorInfo(iface);
|
||||||
|
|
||||||
|
TRACE("%p, %s.\n", iface, debugstr_w(source));
|
||||||
|
|
||||||
|
heap_free(error_info->source);
|
||||||
|
error_info->source = heap_strdupW(source);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI create_errorinfo_SetDescription(ICreateErrorInfo *iface, LPOLESTR description)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_ICreateErrorInfo(iface);
|
||||||
|
|
||||||
|
TRACE("%p, %s.\n", iface, debugstr_w(description));
|
||||||
|
|
||||||
|
heap_free(error_info->description);
|
||||||
|
error_info->description = heap_strdupW(description);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI create_errorinfo_SetHelpFile(ICreateErrorInfo *iface, LPOLESTR helpfile)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_ICreateErrorInfo(iface);
|
||||||
|
|
||||||
|
TRACE("%p, %s.\n", iface, debugstr_w(helpfile));
|
||||||
|
|
||||||
|
heap_free(error_info->help_file);
|
||||||
|
error_info->help_file = heap_strdupW(helpfile);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI create_errorinfo_SetHelpContext(ICreateErrorInfo *iface, DWORD help_context)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_ICreateErrorInfo(iface);
|
||||||
|
|
||||||
|
TRACE("%p, %#x.\n", iface, help_context);
|
||||||
|
|
||||||
|
error_info->help_context = help_context;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const ICreateErrorInfoVtbl create_errorinfo_vtbl =
|
||||||
|
{
|
||||||
|
create_errorinfo_QueryInterface,
|
||||||
|
create_errorinfo_AddRef,
|
||||||
|
create_errorinfo_Release,
|
||||||
|
create_errorinfo_SetGUID,
|
||||||
|
create_errorinfo_SetSource,
|
||||||
|
create_errorinfo_SetDescription,
|
||||||
|
create_errorinfo_SetHelpFile,
|
||||||
|
create_errorinfo_SetHelpContext
|
||||||
|
};
|
||||||
|
|
||||||
|
static HRESULT WINAPI support_errorinfo_QueryInterface(ISupportErrorInfo *iface, REFIID riid, void **obj)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_ISupportErrorInfo(iface);
|
||||||
|
return IErrorInfo_QueryInterface(&error_info->IErrorInfo_iface, riid, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI support_errorinfo_AddRef(ISupportErrorInfo *iface)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_ISupportErrorInfo(iface);
|
||||||
|
return IErrorInfo_AddRef(&error_info->IErrorInfo_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI support_errorinfo_Release(ISupportErrorInfo *iface)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_ISupportErrorInfo(iface);
|
||||||
|
return IErrorInfo_Release(&error_info->IErrorInfo_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI support_errorinfo_InterfaceSupportsErrorInfo(ISupportErrorInfo *iface, REFIID riid)
|
||||||
|
{
|
||||||
|
struct error_info *error_info = impl_from_ISupportErrorInfo(iface);
|
||||||
|
|
||||||
|
TRACE("%p, %s.\n", iface, debugstr_guid(riid));
|
||||||
|
|
||||||
|
return IsEqualIID(riid, &error_info->guid) ? S_OK : S_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const ISupportErrorInfoVtbl support_errorinfo_vtbl =
|
||||||
|
{
|
||||||
|
support_errorinfo_QueryInterface,
|
||||||
|
support_errorinfo_AddRef,
|
||||||
|
support_errorinfo_Release,
|
||||||
|
support_errorinfo_InterfaceSupportsErrorInfo
|
||||||
|
};
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* CreateErrorInfo (combase.@)
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI CreateErrorInfo(ICreateErrorInfo **ret)
|
||||||
|
{
|
||||||
|
struct error_info *error_info;
|
||||||
|
|
||||||
|
TRACE("%p.\n", ret);
|
||||||
|
|
||||||
|
if (!ret) return E_INVALIDARG;
|
||||||
|
|
||||||
|
if (!(error_info = heap_alloc(sizeof(*error_info))))
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
error_info->IErrorInfo_iface.lpVtbl = &errorinfo_vtbl;
|
||||||
|
error_info->ICreateErrorInfo_iface.lpVtbl = &create_errorinfo_vtbl;
|
||||||
|
error_info->ISupportErrorInfo_iface.lpVtbl = &support_errorinfo_vtbl;
|
||||||
|
error_info->refcount = 1;
|
||||||
|
error_info->source = NULL;
|
||||||
|
error_info->description = NULL;
|
||||||
|
error_info->help_file = NULL;
|
||||||
|
error_info->help_context = 0;
|
||||||
|
|
||||||
|
*ret = &error_info->ICreateErrorInfo_iface;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
|
@ -40,362 +40,6 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||||
|
|
||||||
static inline WCHAR *heap_strdupW(const WCHAR *str)
|
|
||||||
{
|
|
||||||
WCHAR *ret = NULL;
|
|
||||||
|
|
||||||
if(str) {
|
|
||||||
size_t size;
|
|
||||||
|
|
||||||
size = (lstrlenW(str)+1)*sizeof(WCHAR);
|
|
||||||
ret = heap_alloc(size);
|
|
||||||
if(ret)
|
|
||||||
memcpy(ret, str, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct ErrorInfoImpl
|
|
||||||
{
|
|
||||||
IErrorInfo IErrorInfo_iface;
|
|
||||||
ICreateErrorInfo ICreateErrorInfo_iface;
|
|
||||||
ISupportErrorInfo ISupportErrorInfo_iface;
|
|
||||||
LONG ref;
|
|
||||||
|
|
||||||
GUID m_Guid;
|
|
||||||
WCHAR *source;
|
|
||||||
WCHAR *description;
|
|
||||||
WCHAR *help_file;
|
|
||||||
DWORD m_dwHelpContext;
|
|
||||||
} ErrorInfoImpl;
|
|
||||||
|
|
||||||
static inline ErrorInfoImpl *impl_from_IErrorInfo( IErrorInfo *iface )
|
|
||||||
{
|
|
||||||
return CONTAINING_RECORD(iface, ErrorInfoImpl, IErrorInfo_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline ErrorInfoImpl *impl_from_ICreateErrorInfo( ICreateErrorInfo *iface )
|
|
||||||
{
|
|
||||||
return CONTAINING_RECORD(iface, ErrorInfoImpl, ICreateErrorInfo_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline ErrorInfoImpl *impl_from_ISupportErrorInfo( ISupportErrorInfo *iface )
|
|
||||||
{
|
|
||||||
return CONTAINING_RECORD(iface, ErrorInfoImpl, ISupportErrorInfo_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IErrorInfoImpl_QueryInterface(
|
|
||||||
IErrorInfo* iface,
|
|
||||||
REFIID riid,
|
|
||||||
void** ppvoid)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
|
|
||||||
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid),ppvoid);
|
|
||||||
|
|
||||||
*ppvoid = NULL;
|
|
||||||
|
|
||||||
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IErrorInfo))
|
|
||||||
{
|
|
||||||
*ppvoid = &This->IErrorInfo_iface;
|
|
||||||
}
|
|
||||||
else if(IsEqualIID(riid, &IID_ICreateErrorInfo))
|
|
||||||
{
|
|
||||||
*ppvoid = &This->ICreateErrorInfo_iface;
|
|
||||||
}
|
|
||||||
else if(IsEqualIID(riid, &IID_ISupportErrorInfo))
|
|
||||||
{
|
|
||||||
*ppvoid = &This->ISupportErrorInfo_iface;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(*ppvoid)
|
|
||||||
{
|
|
||||||
IUnknown_AddRef( (IUnknown*)*ppvoid );
|
|
||||||
TRACE("-- Interface: (%p)->(%p)\n",ppvoid,*ppvoid);
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
TRACE("-- Interface: E_NOINTERFACE\n");
|
|
||||||
return E_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI IErrorInfoImpl_AddRef(
|
|
||||||
IErrorInfo* iface)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
|
|
||||||
TRACE("(%p)->(count=%u)\n",This,This->ref);
|
|
||||||
return InterlockedIncrement(&This->ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI IErrorInfoImpl_Release(
|
|
||||||
IErrorInfo* iface)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
|
|
||||||
ULONG ref = InterlockedDecrement(&This->ref);
|
|
||||||
|
|
||||||
TRACE("(%p)->(count=%u)\n",This,ref+1);
|
|
||||||
|
|
||||||
if (!ref)
|
|
||||||
{
|
|
||||||
TRACE("-- destroying IErrorInfo(%p)\n",This);
|
|
||||||
|
|
||||||
heap_free(This->source);
|
|
||||||
heap_free(This->description);
|
|
||||||
heap_free(This->help_file);
|
|
||||||
heap_free(This);
|
|
||||||
}
|
|
||||||
return ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IErrorInfoImpl_GetGUID(
|
|
||||||
IErrorInfo* iface,
|
|
||||||
GUID * pGUID)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
|
|
||||||
TRACE("(%p)->(count=%u)\n",This,This->ref);
|
|
||||||
if(!pGUID )return E_INVALIDARG;
|
|
||||||
*pGUID = This->m_Guid;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IErrorInfoImpl_GetSource(
|
|
||||||
IErrorInfo* iface,
|
|
||||||
BSTR *pBstrSource)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
|
|
||||||
TRACE("(%p)->(pBstrSource=%p)\n",This,pBstrSource);
|
|
||||||
if (pBstrSource == NULL)
|
|
||||||
return E_INVALIDARG;
|
|
||||||
*pBstrSource = SysAllocString(This->source);
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IErrorInfoImpl_GetDescription(
|
|
||||||
IErrorInfo* iface,
|
|
||||||
BSTR *pBstrDescription)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
|
|
||||||
|
|
||||||
TRACE("(%p)->(pBstrDescription=%p)\n",This,pBstrDescription);
|
|
||||||
if (pBstrDescription == NULL)
|
|
||||||
return E_INVALIDARG;
|
|
||||||
*pBstrDescription = SysAllocString(This->description);
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IErrorInfoImpl_GetHelpFile(
|
|
||||||
IErrorInfo* iface,
|
|
||||||
BSTR *pBstrHelpFile)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
|
|
||||||
|
|
||||||
TRACE("(%p)->(pBstrHelpFile=%p)\n",This, pBstrHelpFile);
|
|
||||||
if (pBstrHelpFile == NULL)
|
|
||||||
return E_INVALIDARG;
|
|
||||||
*pBstrHelpFile = SysAllocString(This->help_file);
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IErrorInfoImpl_GetHelpContext(
|
|
||||||
IErrorInfo* iface,
|
|
||||||
DWORD *pdwHelpContext)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
|
|
||||||
TRACE("(%p)->(pdwHelpContext=%p)\n",This, pdwHelpContext);
|
|
||||||
if (pdwHelpContext == NULL)
|
|
||||||
return E_INVALIDARG;
|
|
||||||
*pdwHelpContext = This->m_dwHelpContext;
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const IErrorInfoVtbl ErrorInfoVtbl =
|
|
||||||
{
|
|
||||||
IErrorInfoImpl_QueryInterface,
|
|
||||||
IErrorInfoImpl_AddRef,
|
|
||||||
IErrorInfoImpl_Release,
|
|
||||||
IErrorInfoImpl_GetGUID,
|
|
||||||
IErrorInfoImpl_GetSource,
|
|
||||||
IErrorInfoImpl_GetDescription,
|
|
||||||
IErrorInfoImpl_GetHelpFile,
|
|
||||||
IErrorInfoImpl_GetHelpContext
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static HRESULT WINAPI ICreateErrorInfoImpl_QueryInterface(
|
|
||||||
ICreateErrorInfo* iface,
|
|
||||||
REFIID riid,
|
|
||||||
VOID** ppvoid)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
|
|
||||||
return IErrorInfo_QueryInterface(&This->IErrorInfo_iface, riid, ppvoid);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI ICreateErrorInfoImpl_AddRef(
|
|
||||||
ICreateErrorInfo* iface)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
|
|
||||||
return IErrorInfo_AddRef(&This->IErrorInfo_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI ICreateErrorInfoImpl_Release(
|
|
||||||
ICreateErrorInfo* iface)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
|
|
||||||
return IErrorInfo_Release(&This->IErrorInfo_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static HRESULT WINAPI ICreateErrorInfoImpl_SetGUID(
|
|
||||||
ICreateErrorInfo* iface,
|
|
||||||
REFGUID rguid)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
|
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_guid(rguid));
|
|
||||||
This->m_Guid = *rguid;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI ICreateErrorInfoImpl_SetSource(
|
|
||||||
ICreateErrorInfo* iface,
|
|
||||||
LPOLESTR szSource)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
|
|
||||||
TRACE("(%p): %s\n",This, debugstr_w(szSource));
|
|
||||||
|
|
||||||
heap_free(This->source);
|
|
||||||
This->source = heap_strdupW(szSource);
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI ICreateErrorInfoImpl_SetDescription(
|
|
||||||
ICreateErrorInfo* iface,
|
|
||||||
LPOLESTR szDescription)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
|
|
||||||
TRACE("(%p): %s\n",This, debugstr_w(szDescription));
|
|
||||||
|
|
||||||
heap_free(This->description);
|
|
||||||
This->description = heap_strdupW(szDescription);
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI ICreateErrorInfoImpl_SetHelpFile(
|
|
||||||
ICreateErrorInfo* iface,
|
|
||||||
LPOLESTR szHelpFile)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
|
|
||||||
TRACE("(%p,%s)\n",This,debugstr_w(szHelpFile));
|
|
||||||
heap_free(This->help_file);
|
|
||||||
This->help_file = heap_strdupW(szHelpFile);
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI ICreateErrorInfoImpl_SetHelpContext(
|
|
||||||
ICreateErrorInfo* iface,
|
|
||||||
DWORD dwHelpContext)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
|
|
||||||
TRACE("(%p,%d)\n",This,dwHelpContext);
|
|
||||||
This->m_dwHelpContext = dwHelpContext;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const ICreateErrorInfoVtbl CreateErrorInfoVtbl =
|
|
||||||
{
|
|
||||||
ICreateErrorInfoImpl_QueryInterface,
|
|
||||||
ICreateErrorInfoImpl_AddRef,
|
|
||||||
ICreateErrorInfoImpl_Release,
|
|
||||||
ICreateErrorInfoImpl_SetGUID,
|
|
||||||
ICreateErrorInfoImpl_SetSource,
|
|
||||||
ICreateErrorInfoImpl_SetDescription,
|
|
||||||
ICreateErrorInfoImpl_SetHelpFile,
|
|
||||||
ICreateErrorInfoImpl_SetHelpContext
|
|
||||||
};
|
|
||||||
|
|
||||||
static HRESULT WINAPI ISupportErrorInfoImpl_QueryInterface(
|
|
||||||
ISupportErrorInfo* iface,
|
|
||||||
REFIID riid,
|
|
||||||
VOID** ppvoid)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_ISupportErrorInfo(iface);
|
|
||||||
return IErrorInfo_QueryInterface(&This->IErrorInfo_iface, riid, ppvoid);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI ISupportErrorInfoImpl_AddRef(ISupportErrorInfo* iface)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_ISupportErrorInfo(iface);
|
|
||||||
return IErrorInfo_AddRef(&This->IErrorInfo_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI ISupportErrorInfoImpl_Release(ISupportErrorInfo* iface)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_ISupportErrorInfo(iface);
|
|
||||||
return IErrorInfo_Release(&This->IErrorInfo_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI ISupportErrorInfoImpl_InterfaceSupportsErrorInfo(
|
|
||||||
ISupportErrorInfo* iface,
|
|
||||||
REFIID riid)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = impl_from_ISupportErrorInfo(iface);
|
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_guid(riid));
|
|
||||||
return (IsEqualIID(riid, &This->m_Guid)) ? S_OK : S_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const ISupportErrorInfoVtbl SupportErrorInfoVtbl =
|
|
||||||
{
|
|
||||||
ISupportErrorInfoImpl_QueryInterface,
|
|
||||||
ISupportErrorInfoImpl_AddRef,
|
|
||||||
ISupportErrorInfoImpl_Release,
|
|
||||||
ISupportErrorInfoImpl_InterfaceSupportsErrorInfo
|
|
||||||
};
|
|
||||||
|
|
||||||
static IErrorInfo* IErrorInfoImpl_Constructor(void)
|
|
||||||
{
|
|
||||||
ErrorInfoImpl *This = heap_alloc(sizeof(ErrorInfoImpl));
|
|
||||||
|
|
||||||
if (!This) return NULL;
|
|
||||||
|
|
||||||
This->IErrorInfo_iface.lpVtbl = &ErrorInfoVtbl;
|
|
||||||
This->ICreateErrorInfo_iface.lpVtbl = &CreateErrorInfoVtbl;
|
|
||||||
This->ISupportErrorInfo_iface.lpVtbl = &SupportErrorInfoVtbl;
|
|
||||||
This->ref = 1;
|
|
||||||
This->source = NULL;
|
|
||||||
This->description = NULL;
|
|
||||||
This->help_file = NULL;
|
|
||||||
This->m_dwHelpContext = 0;
|
|
||||||
|
|
||||||
return &This->IErrorInfo_iface;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* CreateErrorInfo (OLE32.@)
|
|
||||||
*
|
|
||||||
* Creates an object used to set details for an error info object.
|
|
||||||
*
|
|
||||||
* PARAMS
|
|
||||||
* pperrinfo [O]. Address where error info creation object will be stored.
|
|
||||||
*
|
|
||||||
* RETURNS
|
|
||||||
* Success: S_OK.
|
|
||||||
* Failure: HRESULT code.
|
|
||||||
*/
|
|
||||||
HRESULT WINAPI CreateErrorInfo(ICreateErrorInfo **pperrinfo)
|
|
||||||
{
|
|
||||||
IErrorInfo * pei;
|
|
||||||
HRESULT res;
|
|
||||||
TRACE("(%p)\n", pperrinfo);
|
|
||||||
if(! pperrinfo ) return E_INVALIDARG;
|
|
||||||
if(!(pei=IErrorInfoImpl_Constructor()))return E_OUTOFMEMORY;
|
|
||||||
|
|
||||||
res = IErrorInfo_QueryInterface(pei, &IID_ICreateErrorInfo, (LPVOID*)pperrinfo);
|
|
||||||
IErrorInfo_Release(pei);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GetErrorInfo (OLE32.@)
|
* GetErrorInfo (OLE32.@)
|
||||||
*
|
*
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
@ stdcall CreateClassMoniker(ptr ptr)
|
@ stdcall CreateClassMoniker(ptr ptr)
|
||||||
@ stdcall CreateDataAdviseHolder(ptr)
|
@ stdcall CreateDataAdviseHolder(ptr)
|
||||||
@ stdcall CreateDataCache(ptr ptr ptr ptr)
|
@ stdcall CreateDataCache(ptr ptr ptr ptr)
|
||||||
@ stdcall CreateErrorInfo(ptr)
|
@ stdcall CreateErrorInfo(ptr) combase.CreateErrorInfo
|
||||||
@ stdcall CreateFileMoniker(wstr ptr)
|
@ stdcall CreateFileMoniker(wstr ptr)
|
||||||
@ stdcall CreateGenericComposite(ptr ptr ptr)
|
@ stdcall CreateGenericComposite(ptr ptr ptr)
|
||||||
@ stdcall CreateILockBytesOnHGlobal(ptr long ptr)
|
@ stdcall CreateILockBytesOnHGlobal(ptr long ptr)
|
||||||
|
|
Loading…
Reference in New Issue