From a32391ab6b8857215b8d0f8ca0392958f4a4e8bc Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 18 Jun 2013 10:22:57 +1000 Subject: [PATCH] oledb32: Add support for IErrorRecords. --- dlls/msdaps/usrmarshal.c | 183 +++++++++++++++++++++++++++++++++++++++ include/Makefile.in | 1 + include/errrec.idl | 78 +++++++++++++++++ include/oledb.idl | 1 + tools/make_makefiles | 1 + 5 files changed, 264 insertions(+) create mode 100644 include/errrec.idl diff --git a/dlls/msdaps/usrmarshal.c b/dlls/msdaps/usrmarshal.c index 7bbaa7b5811..b93340e6394 100644 --- a/dlls/msdaps/usrmarshal.c +++ b/dlls/msdaps/usrmarshal.c @@ -1096,3 +1096,186 @@ HRESULT __RPC_STUB ISourcesRowset_GetSourcesRowset_Stub(ISourcesRowset* This, IU return hr; } + +HRESULT CALLBACK IErrorRecords_GetRecordCount_Proxy(IErrorRecords* This, ULONG *records) +{ + HRESULT hr; + IErrorInfo *error; + + TRACE("(%p)->%p\n", This, records); + + hr = IErrorRecords_RemoteGetRecordCount_Proxy(This, records, &error); + if(error) + { + SetErrorInfo(0, error); + IErrorInfo_Release(error); + } + + return hr; +} + +HRESULT __RPC_STUB IErrorRecords_GetRecordCount_Stub(IErrorRecords* This, ULONG *pcRecords, IErrorInfo **ppErrorInfoRem) +{ + HRESULT hr; + + TRACE("(%p)->%p %p\n", This, pcRecords, ppErrorInfoRem); + + *ppErrorInfoRem = NULL; + hr = IErrorRecords_GetRecordCount(This, pcRecords); + if(FAILED(hr)) + GetErrorInfo(0, ppErrorInfoRem); + + return hr; +} + +HRESULT CALLBACK IErrorRecords_GetErrorParameters_Proxy(IErrorRecords* This, ULONG ulRecordNum, DISPPARAMS *pdispparams) +{ + HRESULT hr; + IErrorInfo *error; + + TRACE("(%p)->%d %p\n", This, ulRecordNum, pdispparams); + + hr = IErrorRecords_RemoteGetErrorParameters_Proxy(This, ulRecordNum, pdispparams, &error); + if(error) + { + SetErrorInfo(0, error); + IErrorInfo_Release(error); + } + + return hr; +} + +HRESULT __RPC_STUB IErrorRecords_GetErrorParameters_Stub(IErrorRecords* This, ULONG ulRecordNum, DISPPARAMS *pdispparams, + IErrorInfo **ppErrorInfoRem) +{ + HRESULT hr; + + TRACE("(%p)->%d %p %p\n", This, ulRecordNum, pdispparams, ppErrorInfoRem); + + *ppErrorInfoRem = NULL; + hr = IErrorRecords_GetErrorParameters(This, ulRecordNum, pdispparams); + if(FAILED(hr)) + GetErrorInfo(0, ppErrorInfoRem); + + return hr; +} + +HRESULT CALLBACK IErrorRecords_GetErrorInfo_Proxy(IErrorRecords* This, ULONG ulRecordNum, LCID lcid, IErrorInfo **ppErrorInfo) +{ + HRESULT hr; + IErrorInfo *error; + + TRACE("(%p)->%d %d %p\n", This, ulRecordNum, lcid, ppErrorInfo); + + hr = IErrorRecords_RemoteGetErrorInfo_Proxy(This, ulRecordNum, lcid, ppErrorInfo, &error); + if(error) + { + SetErrorInfo(0, error); + IErrorInfo_Release(error); + } + + return hr; +} + +HRESULT __RPC_STUB IErrorRecords_GetErrorInfo_Stub(IErrorRecords* This, ULONG ulRecordNum, LCID lcid, + IErrorInfo **ppErrorInfo, IErrorInfo **ppErrorInfoRem) +{ + HRESULT hr; + + TRACE("(%p)->%d %d %p %p\n", This, ulRecordNum, lcid, ppErrorInfo, ppErrorInfoRem); + + *ppErrorInfoRem = NULL; + hr = IErrorRecords_GetErrorInfo(This, ulRecordNum, lcid, ppErrorInfo); + if(FAILED(hr)) + GetErrorInfo(0, ppErrorInfoRem); + + return hr; +} + +HRESULT CALLBACK IErrorRecords_GetCustomErrorObject_Proxy(IErrorRecords* This, ULONG ulRecordNum, REFIID riid, + IUnknown **ppObject) +{ + HRESULT hr; + IErrorInfo *error; + + TRACE("(%p)->%d %s %p\n", This, ulRecordNum, debugstr_guid(riid), ppObject); + + hr = IErrorRecords_RemoteGetCustomErrorObject_Proxy(This, ulRecordNum, riid, ppObject, &error); + if(error) + { + SetErrorInfo(0, error); + IErrorInfo_Release(error); + } + return hr; +} + +HRESULT __RPC_STUB IErrorRecords_GetCustomErrorObject_Stub(IErrorRecords* This, ULONG ulRecordNum, REFIID riid, + IUnknown **ppObject, IErrorInfo **ppErrorInfoRem) +{ + HRESULT hr; + + TRACE("(%p)->%d %s %p %p\n", This, ulRecordNum, debugstr_guid(riid), ppObject, ppErrorInfoRem); + + *ppErrorInfoRem = NULL; + hr = IErrorRecords_GetCustomErrorObject(This, ulRecordNum, riid, ppObject); + if(FAILED(hr)) + GetErrorInfo(0, ppErrorInfoRem); + + return hr; +} + +HRESULT CALLBACK IErrorRecords_GetBasicErrorInfo_Proxy(IErrorRecords* This, ULONG ulRecordNum, ERRORINFO *pErrorInfo) +{ + TRACE("(%p)->%d %p\n", This, ulRecordNum, pErrorInfo); + + return IErrorRecords_GetBasicErrorInfo_Proxy(This, ulRecordNum, pErrorInfo); +} + +HRESULT __RPC_STUB IErrorRecords_GetBasicErrorInfo_Stub(IErrorRecords* This, ULONG ulRecordNum, ERRORINFO *pErrorInfo, + IErrorInfo **ppErrorInfoRem) +{ + HRESULT hr; + + TRACE("(%p)->%d %p %p\n", This, ulRecordNum, pErrorInfo, ppErrorInfoRem); + + *ppErrorInfoRem = NULL; + hr = IErrorRecords_GetBasicErrorInfo(This, ulRecordNum, pErrorInfo); + if(FAILED(hr)) + GetErrorInfo(0, ppErrorInfoRem); + + return hr; +} + +HRESULT CALLBACK IErrorRecords_AddErrorRecord_Proxy(IErrorRecords* This, ERRORINFO *pErrorInfo, DWORD dwLookupID, + DISPPARAMS *pdispparams, IUnknown *punkCustomError, DWORD dwDynamicErrorID) +{ + HRESULT hr; + IErrorInfo *error; + + TRACE("(%p)->%p %d %p %p %d\n", This, pErrorInfo, dwLookupID, pdispparams, punkCustomError, dwDynamicErrorID); + + hr = IErrorRecords_RemoteAddErrorRecord_Proxy(This, pErrorInfo, dwLookupID, pdispparams, punkCustomError, + dwDynamicErrorID, &error); + if(error) + { + SetErrorInfo(0, error); + IErrorInfo_Release(error); + } + return hr; +} + +HRESULT __RPC_STUB IErrorRecords_AddErrorRecord_Stub(IErrorRecords* This, ERRORINFO *pErrorInfo, DWORD dwLookupID, + DISPPARAMS *pdispparams, IUnknown *punkCustomError, DWORD dwDynamicErrorID, IErrorInfo **ppErrorInfoRem) +{ + HRESULT hr; + + TRACE("(%p)->%p %d %p %p %d %p\n", This, pErrorInfo, dwLookupID, pdispparams, punkCustomError, + dwDynamicErrorID, ppErrorInfoRem); + + *ppErrorInfoRem = NULL; + hr = IErrorRecords_AddErrorRecord(This, pErrorInfo, dwLookupID, pdispparams, punkCustomError, dwDynamicErrorID); + if(FAILED(hr)) + GetErrorInfo(0, ppErrorInfoRem); + + return hr; +} diff --git a/include/Makefile.in b/include/Makefile.in index 9a06ac68942..a56c6bdd673 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -288,6 +288,7 @@ SRCDIR_INCLUDES = \ dyngraph.idl \ errorrep.h \ errors.h \ + errrec.idl \ evcode.h \ evntprov.h \ evntrace.h \ diff --git a/include/errrec.idl b/include/errrec.idl new file mode 100644 index 00000000000..865b3f2b463 --- /dev/null +++ b/include/errrec.idl @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2013 Alistair Leslie-Hughes + * + * 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 + */ + +[ + object, + uuid(0c733a67-2a1c-11ce-ade5-00aa0044773d), + pointer_default(unique) +] +interface IErrorRecords : IUnknown +{ + +cpp_quote("#define IDENTIFIER_SDK_MASK 0xF0000000") +cpp_quote("#define IDENTIFIER_SDK_ERROR 0x10000000") + +typedef struct tagERRORINFO +{ + HRESULT hrError; + DWORD dwMinor; + CLSID clsid; + IID iid; + DISPID dispid; +} ERRORINFO; + + [local] + HRESULT AddErrorRecord([in] ERRORINFO * pErrorInfo, [in] DWORD dwLookupID, [in] DISPPARAMS * pdispparams, + [in] IUnknown * punkCustomError, [in] DWORD dwDynamicErrorID); + + [call_as(AddErrorRecord)] + HRESULT RemoteAddErrorRecord([in] ERRORINFO * pErrorInfo, [in] DWORD dwLookupID, [in] DISPPARAMS * pdispparams, + [in] IUnknown * punkCustomError, [in] DWORD dwDynamicErrorID, [out] IErrorInfo ** ppErrorInfoRem); + + [local] + HRESULT GetBasicErrorInfo([in] ULONG ulRecordNum, [out] ERRORINFO * pErrorInfo); + + [call_as(GetBasicErrorInfo)] + HRESULT RemoteGetBasicErrorInfo([in] ULONG ulRecordNum, [out] ERRORINFO * pErrorInfo, [out] IErrorInfo **ppErrorInfoRem); + + [local] + HRESULT GetCustomErrorObject([in] ULONG ulRecordNum, [in] REFIID riid, [out] IUnknown ** ppObject); + + [call_as(GetCustomErrorObject)] + HRESULT RemoteGetCustomErrorObject([in] ULONG ulRecordNum, [in] REFIID riid, [out] IUnknown ** ppObject, + [out] IErrorInfo **ppErrorInfoRem); + + [local] + HRESULT GetErrorInfo([in] ULONG ulRecordNum, [in] LCID lcid, [out] IErrorInfo **ppErrorInfo); + + [call_as(GetErrorInfo)] + HRESULT RemoteGetErrorInfo([in] ULONG ulRecordNum, [in] LCID lcid, [out] IErrorInfo **ppErrorInfo, + [out] IErrorInfo **ppErrorInfoRem); + + [local] + HRESULT GetErrorParameters([in] ULONG ulRecordNum, [out] DISPPARAMS * pdispparams); + + [call_as(GetErrorParameters)] + HRESULT RemoteGetErrorParameters([in] ULONG ulRecordNum, [out] DISPPARAMS * pdispparams, [out] IErrorInfo ** ppErrorInfoRem); + + [local] + HRESULT GetRecordCount([out] ULONG *records); + + [call_as(GetRecordCount)] + HRESULT RemoteGetRecordCount([out] ULONG * pcRecords, [out] IErrorInfo **ppErrorInfoRem); +} diff --git a/include/oledb.idl b/include/oledb.idl index 05809325c2d..5cd287fae07 100644 --- a/include/oledb.idl +++ b/include/oledb.idl @@ -66,6 +66,7 @@ typedef DWORD_PTR DBHASHVALUE; #include "rowchg.idl" #include "binres.idl" #include "crtrow.idl" +#include "errrec.idl" cpp_quote("#include ") diff --git a/tools/make_makefiles b/tools/make_makefiles index bfa904ebeb8..6d4e8a7f6ee 100755 --- a/tools/make_makefiles +++ b/tools/make_makefiles @@ -151,6 +151,7 @@ my %private_idl_headers = ( "dbs.idl" => 1, "devenum.idl" => 1, "dyngraph.idl" => 1, + "errrec.idl" => 1, "opnrst.idl" => 1, "row.idl" => 1, "rowchg.idl" => 1,