oledb32: IErrorRecords uses 0-based index to access record info.

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>
This commit is contained in:
Nikolay Sivov 2016-11-15 20:26:48 +03:00 committed by Alexandre Julliard
parent 4a3054e445
commit 41984c62a6
2 changed files with 31 additions and 16 deletions

View File

@ -267,67 +267,65 @@ static HRESULT WINAPI errorrec_AddErrorRecord(IErrorRecords *iface, ERRORINFO *p
return S_OK;
}
static HRESULT WINAPI errorrec_GetBasicErrorInfo(IErrorRecords *iface, ULONG ulRecordNum,
ERRORINFO *pErrorInfo)
static HRESULT WINAPI errorrec_GetBasicErrorInfo(IErrorRecords *iface, ULONG index, ERRORINFO *pErrorInfo)
{
ErrorInfoImpl *This = impl_from_IErrorRecords(iface);
FIXME("(%p)->(%d %p)\n", This, ulRecordNum, pErrorInfo);
FIXME("(%p)->(%u %p)\n", This, index, pErrorInfo);
if(!pErrorInfo)
return E_INVALIDARG;
if(ulRecordNum > This->count)
if (index >= This->count)
return DB_E_BADRECORDNUM;
return E_NOTIMPL;
}
static HRESULT WINAPI errorrec_GetCustomErrorObject(IErrorRecords *iface, ULONG ulRecordNum,
static HRESULT WINAPI errorrec_GetCustomErrorObject(IErrorRecords *iface, ULONG index,
REFIID riid, IUnknown **ppObject)
{
ErrorInfoImpl *This = impl_from_IErrorRecords(iface);
FIXME("(%p)->(%d %s, %p)\n", This, ulRecordNum, debugstr_guid(riid), ppObject);
FIXME("(%p)->(%u %s, %p)\n", This, index, debugstr_guid(riid), ppObject);
if (!ppObject)
return E_INVALIDARG;
*ppObject = NULL;
if(ulRecordNum > This->count)
if (index >= This->count)
return DB_E_BADRECORDNUM;
return E_NOTIMPL;
}
static HRESULT WINAPI errorrec_GetErrorInfo(IErrorRecords *iface, ULONG ulRecordNum,
static HRESULT WINAPI errorrec_GetErrorInfo(IErrorRecords *iface, ULONG index,
LCID lcid, IErrorInfo **ppErrorInfo)
{
ErrorInfoImpl *This = impl_from_IErrorRecords(iface);
FIXME("(%p)->(%d %d, %p)\n", This, ulRecordNum, lcid, ppErrorInfo);
FIXME("(%p)->(%u %d, %p)\n", This, index, lcid, ppErrorInfo);
if (!ppErrorInfo)
return E_INVALIDARG;
if(ulRecordNum > This->count)
if (index >= This->count)
return DB_E_BADRECORDNUM;
return E_NOTIMPL;
}
static HRESULT WINAPI errorrec_GetErrorParameters(IErrorRecords *iface, ULONG ulRecordNum,
DISPPARAMS *pdispparams)
static HRESULT WINAPI errorrec_GetErrorParameters(IErrorRecords *iface, ULONG index, DISPPARAMS *pdispparams)
{
ErrorInfoImpl *This = impl_from_IErrorRecords(iface);
FIXME("(%p)->(%d %p)\n", This, ulRecordNum, pdispparams);
FIXME("(%p)->(%u %p)\n", This, index, pdispparams);
if (!pdispparams)
return E_INVALIDARG;
if(ulRecordNum > This->count)
if (index >= This->count)
return DB_E_BADRECORDNUM;
return E_NOTIMPL;

View File

@ -318,9 +318,10 @@ static void test_errorinfo(void)
{
ICreateErrorInfo *createerror;
ERRORINFO info, info2, info3;
IErrorInfo *errorinfo;
IErrorInfo *errorinfo, *errorinfo2;
IErrorRecords *errrecs;
IUnknown *unk = NULL;
IUnknown *unk = NULL, *unk2;
DISPPARAMS dispparams;
DWORD context;
ULONG cnt = 0;
HRESULT hr;
@ -381,6 +382,22 @@ static void test_errorinfo(void)
hr = IUnknown_QueryInterface(unk, &IID_IErrorRecords, (void**)&errrecs);
ok(hr == S_OK, "got %08x\n", hr);
hr = IErrorRecords_GetRecordCount(errrecs, &cnt);
ok(hr == S_OK, "got %08x\n", hr);
ok(cnt == 0, "Got unexpected record count %u\n", cnt);
hr = IErrorRecords_GetBasicErrorInfo(errrecs, 0, &info3);
ok(hr == DB_E_BADRECORDNUM, "got %08x\n", hr);
hr = IErrorRecords_GetCustomErrorObject(errrecs, 0, &IID_IUnknown, &unk2);
ok(hr == DB_E_BADRECORDNUM, "got %08x\n", hr);
hr = IErrorRecords_GetErrorInfo(errrecs, 0, 0, &errorinfo2);
ok(hr == DB_E_BADRECORDNUM, "got %08x\n", hr);
hr = IErrorRecords_GetErrorParameters(errrecs, 0, &dispparams);
ok(hr == DB_E_BADRECORDNUM, "got %08x\n", hr);
memset(&info, 0, sizeof(ERRORINFO));
info.dwMinor = 1;
memset(&info2, 0, sizeof(ERRORINFO));