Module: wine Branch: master Commit: 333039f318168a7c40c20d6357a4f69899146399 URL: http://source.winehq.org/git/wine.git/?a=commit;h=333039f318168a7c40c20d6357...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Tue Nov 15 20:26:49 2016 +0300
oledb32: Implement GetCustomErrorObject().
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/oledb32/errorinfo.c | 26 +++++++++++++++----------- dlls/oledb32/tests/database.c | 6 ++++++ 2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/dlls/oledb32/errorinfo.c b/dlls/oledb32/errorinfo.c index 7a1eddf..48db723 100644 --- a/dlls/oledb32/errorinfo.c +++ b/dlls/oledb32/errorinfo.c @@ -42,7 +42,7 @@ struct ErrorEntry { ERRORINFO info; DISPPARAMS dispparams; - IUnknown *unknown; + IUnknown *custom_error; DWORD lookupID; };
@@ -113,8 +113,8 @@ static ULONG WINAPI IErrorInfoImpl_Release(IErrorInfo* iface)
for (i = 0; i < This->count; i++) { - if (This->records[i].unknown) - IUnknown_Release(This->records[i].unknown); + if (This->records[i].custom_error) + IUnknown_Release(This->records[i].custom_error); } heap_free(This->records); heap_free(This); @@ -257,9 +257,9 @@ static HRESULT WINAPI errorrec_AddErrorRecord(IErrorRecords *iface, ERRORINFO *p entry->info = *pErrorInfo; if(pdispparams) entry->dispparams = *pdispparams; - entry->unknown = punkCustomError; - if(entry->unknown) - IUnknown_AddRef(entry->unknown); + entry->custom_error = punkCustomError; + if (entry->custom_error) + IUnknown_AddRef(entry->custom_error); entry->lookupID = dwDynamicErrorID;
This->count++; @@ -283,21 +283,25 @@ static HRESULT WINAPI errorrec_GetBasicErrorInfo(IErrorRecords *iface, ULONG ind }
static HRESULT WINAPI errorrec_GetCustomErrorObject(IErrorRecords *iface, ULONG index, - REFIID riid, IUnknown **ppObject) + REFIID riid, IUnknown **object) { ErrorInfoImpl *This = impl_from_IErrorRecords(iface);
- FIXME("(%p)->(%u %s, %p)\n", This, index, debugstr_guid(riid), ppObject); + TRACE("(%p)->(%u %s %p)\n", This, index, debugstr_guid(riid), object);
- if (!ppObject) + if (!object) return E_INVALIDARG;
- *ppObject = NULL; + *object = NULL;
if (index >= This->count) return DB_E_BADRECORDNUM;
- return E_NOTIMPL; + index = This->count - index - 1; + if (This->records[index].custom_error) + return IUnknown_QueryInterface(This->records[index].custom_error, riid, (void **)object); + else + return S_OK; }
static HRESULT WINAPI errorrec_GetErrorInfo(IErrorRecords *iface, ULONG index, diff --git a/dlls/oledb32/tests/database.c b/dlls/oledb32/tests/database.c index 68f9eac..980dacd 100644 --- a/dlls/oledb32/tests/database.c +++ b/dlls/oledb32/tests/database.c @@ -414,6 +414,12 @@ static void test_errorinfo(void) ok(hr == S_OK, "got %08x\n", hr); ok(cnt == 1, "expected 1 got %d\n", cnt);
+ /* Record does not contain custom error object. */ + unk2 = (void*)0xdeadbeef; + hr = IErrorRecords_GetCustomErrorObject(errrecs, 0, &IID_IUnknown, &unk2); + ok(hr == S_OK, "got %08x\n", hr); + ok(unk2 == NULL, "Got custom object %p.\n", unk2); + hr = IErrorRecords_AddErrorRecord(errrecs, &info2, 2, NULL, NULL, 0); ok(hr == S_OK, "got %08x\n", hr);