Nikolay Sivov : oledb32: IErrorRecords uses 0-based index to access record info.
Module: wine Branch: master Commit: 41984c62a608745e7fa149e949dd50da9a806afa URL: http://source.winehq.org/git/wine.git/?a=commit;h=41984c62a608745e7fa149e949... Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Nov 15 20:26:48 2016 +0300 oledb32: IErrorRecords uses 0-based index to access record info. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/oledb32/errorinfo.c | 26 ++++++++++++-------------- dlls/oledb32/tests/database.c | 21 +++++++++++++++++++-- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/dlls/oledb32/errorinfo.c b/dlls/oledb32/errorinfo.c index 0875d82..7a1eddf 100644 --- a/dlls/oledb32/errorinfo.c +++ b/dlls/oledb32/errorinfo.c @@ -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; diff --git a/dlls/oledb32/tests/database.c b/dlls/oledb32/tests/database.c index 217fb4a..68f9eac 100644 --- a/dlls/oledb32/tests/database.c +++ b/dlls/oledb32/tests/database.c @@ -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));
participants (1)
-
Alexandre Julliard