oledb32: IErrorInfo methods are stubs.

There's no way to set error info for this object

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-06-03 09:55:36 +03:00 committed by Alexandre Julliard
parent 2f7c316888
commit f5f6cfb0f7
2 changed files with 121 additions and 97 deletions

View File

@ -53,12 +53,6 @@ typedef struct ErrorInfoImpl
IErrorRecords IErrorRecords_iface;
LONG ref;
GUID m_Guid;
BSTR source;
BSTR description;
BSTR help_file;
DWORD help_context;
struct list errors;
} ErrorInfoImpl;
@ -115,10 +109,6 @@ static ULONG WINAPI IErrorInfoImpl_Release(IErrorInfo* iface)
if (!ref)
{
SysFreeString(This->source);
SysFreeString(This->description);
SysFreeString(This->help_file);
LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, &This->errors, struct ErrorEntry, entry)
{
list_remove(&cursor->entry);
@ -132,74 +122,74 @@ static ULONG WINAPI IErrorInfoImpl_Release(IErrorInfo* iface)
return ref;
}
static HRESULT WINAPI IErrorInfoImpl_GetGUID(IErrorInfo* iface, GUID * pGUID)
static HRESULT WINAPI IErrorInfoImpl_GetGUID(IErrorInfo* iface, GUID *guid)
{
ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
TRACE("(%p)\n",This);
TRACE("(%p)->(%p)\n", This, guid);
if(!pGUID )
if (!guid)
return E_INVALIDARG;
*pGUID = This->m_Guid;
*guid = GUID_NULL;
return S_OK;
}
static HRESULT WINAPI IErrorInfoImpl_GetSource(IErrorInfo* iface, BSTR *pBstrSource)
static HRESULT WINAPI IErrorInfoImpl_GetSource(IErrorInfo* iface, BSTR *source)
{
ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
TRACE("(%p)->(%p)\n",This, pBstrSource);
TRACE("(%p)->(%p)\n", This, source);
if (pBstrSource == NULL)
if (!source)
return E_INVALIDARG;
*pBstrSource = SysAllocString(This->source);
*source = NULL;
return S_OK;
return E_FAIL;
}
static HRESULT WINAPI IErrorInfoImpl_GetDescription(IErrorInfo* iface, BSTR *pBstrDescription)
static HRESULT WINAPI IErrorInfoImpl_GetDescription(IErrorInfo* iface, BSTR *description)
{
ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
TRACE("(%p)->(%p)\n",This, pBstrDescription);
TRACE("(%p)->(%p)\n", This, description);
if (pBstrDescription == NULL)
if (!description)
return E_INVALIDARG;
*pBstrDescription = SysAllocString(This->description);
*description = NULL;
return S_OK;
return E_FAIL;
}
static HRESULT WINAPI IErrorInfoImpl_GetHelpFile(IErrorInfo* iface, BSTR *pBstrHelpFile)
static HRESULT WINAPI IErrorInfoImpl_GetHelpFile(IErrorInfo* iface, BSTR *helpfile)
{
ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
TRACE("(%p)->(%p)\n",This, pBstrHelpFile);
TRACE("(%p)->(%p)\n", This, helpfile);
if (pBstrHelpFile == NULL)
if (!helpfile)
return E_INVALIDARG;
*pBstrHelpFile = SysAllocString(This->help_file);
*helpfile = NULL;
return S_OK;
return E_FAIL;
}
static HRESULT WINAPI IErrorInfoImpl_GetHelpContext(IErrorInfo* iface, DWORD *pdwHelpContext)
static HRESULT WINAPI IErrorInfoImpl_GetHelpContext(IErrorInfo* iface, DWORD *context)
{
ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
TRACE("(%p)->(%p)\n",This, pdwHelpContext);
TRACE("(%p)->(%p)\n", This, context);
if (pdwHelpContext == NULL)
if (!context)
return E_INVALIDARG;
*pdwHelpContext = This->help_context;
*context = 0;
return S_OK;
return E_FAIL;
}
static const IErrorInfoVtbl ErrorInfoVtbl =
@ -371,10 +361,6 @@ HRESULT create_error_info(IUnknown *outer, void **obj)
This->IErrorInfo_iface.lpVtbl = &ErrorInfoVtbl;
This->IErrorRecords_iface.lpVtbl = &ErrorRecordsVtbl;
This->ref = 1;
This->source = NULL;
This->description = NULL;
This->help_file = NULL;
This->help_context = 0;
list_init(&This->errors);

View File

@ -312,71 +312,109 @@ static void test_database(void)
static void test_errorinfo(void)
{
HRESULT hr;
ICreateErrorInfo *createerror;
ERRORINFO info, info2, info3;
IErrorInfo *errorinfo;
IErrorRecords *errrecs;
IUnknown *unk = NULL;
DWORD context;
ULONG cnt = 0;
HRESULT hr;
GUID guid;
BSTR str;
hr = CoCreateInstance(&CSLID_MSDAER, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,(void**)&unk);
hr = CoCreateInstance(&CSLID_MSDAER, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&unk);
ok(hr == S_OK, "got %08x\n", hr);
hr = IUnknown_QueryInterface(unk, &IID_IErrorInfo, (void**)&errorinfo);
ok(hr == S_OK, "got %08x\n", hr);
hr = IErrorInfo_GetGUID(errorinfo, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IErrorInfo_GetSource(errorinfo, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IErrorInfo_GetDescription(errorinfo, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IErrorInfo_GetHelpFile(errorinfo, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IErrorInfo_GetHelpContext(errorinfo, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
memset(&guid, 0xac, sizeof(guid));
hr = IErrorInfo_GetGUID(errorinfo, &guid);
ok(hr == S_OK, "got %08x\n", hr);
ok(IsEqualGUID(&guid, &GUID_NULL), "got wrong guid\n");
str = (BSTR)0x1;
hr = IErrorInfo_GetSource(errorinfo, &str);
ok(hr == E_FAIL, "got %08x\n", hr);
ok(str == NULL, "got %s\n", wine_dbgstr_w(str));
str = (BSTR)0x1;
hr = IErrorInfo_GetDescription(errorinfo, &str);
ok(hr == E_FAIL, "got %08x\n", hr);
ok(str == NULL, "got %s\n", wine_dbgstr_w(str));
str = (BSTR)0x1;
hr = IErrorInfo_GetHelpFile(errorinfo, &str);
ok(hr == E_FAIL, "got %08x\n", hr);
ok(str == NULL, "got %s\n", wine_dbgstr_w(str));
context = 1;
hr = IErrorInfo_GetHelpContext(errorinfo, &context);
ok(hr == E_FAIL, "got %08x\n", hr);
ok(context == 0, "got %d\n", context);
IErrorInfo_Release(errorinfo);
hr = IErrorInfo_QueryInterface(errorinfo, &IID_ICreateErrorInfo, (void**)&createerror);
ok(hr == E_NOINTERFACE, "got %08x\n", hr);
hr = IUnknown_QueryInterface(unk, &IID_IErrorRecords, (void**)&errrecs);
ok(hr == S_OK, "got %08x\n", hr);
memset(&info, 0, sizeof(ERRORINFO));
info.dwMinor = 1;
memset(&info2, 0, sizeof(ERRORINFO));
info2.dwMinor = 2;
memset(&info3, 0, sizeof(ERRORINFO));
hr = IErrorRecords_AddErrorRecord(errrecs, NULL, 268435456, NULL, NULL, 0);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IErrorRecords_AddErrorRecord(errrecs, &info, 1, NULL, NULL, 0);
ok(hr == S_OK, "got %08x\n", hr);
hr = IErrorRecords_GetRecordCount(errrecs, &cnt);
ok(hr == S_OK, "got %08x\n", hr);
ok(cnt == 1, "expected 1 got %d\n", cnt);
hr = IErrorRecords_AddErrorRecord(errrecs, &info2, 2, NULL, NULL, 0);
ok(hr == S_OK, "got %08x\n", hr);
hr = IErrorRecords_GetRecordCount(errrecs, &cnt);
ok(hr == S_OK, "got %08x\n", hr);
ok(cnt == 2, "expected 2 got %d\n", cnt);
hr = IErrorRecords_GetBasicErrorInfo(errrecs, 0, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IErrorRecords_GetBasicErrorInfo(errrecs, 100, &info3);
ok(hr == DB_E_BADRECORDNUM, "got %08x\n", hr);
hr = IErrorRecords_GetBasicErrorInfo(errrecs, 0, &info3);
todo_wine ok(hr == S_OK, "got %08x\n", hr);
if(hr == S_OK)
{
IErrorInfo *errorinfo;
IErrorRecords *errrecs;
hr = IUnknown_QueryInterface(unk, &IID_IErrorInfo, (void**)&errorinfo);
ok(hr == S_OK, "got %08x\n", hr);
if(hr == S_OK)
{
IErrorInfo_Release(errorinfo);
}
hr = IUnknown_QueryInterface(unk, &IID_IErrorRecords, (void**)&errrecs);
ok(hr == S_OK, "got %08x\n", hr);
if(hr == S_OK)
{
ERRORINFO info, info2, info3;
ULONG cnt = 0;
memset(&info, 0, sizeof(ERRORINFO));
info.dwMinor = 1;
memset(&info2, 0, sizeof(ERRORINFO));
info2.dwMinor = 2;
memset(&info3, 0, sizeof(ERRORINFO));
hr = IErrorRecords_AddErrorRecord(errrecs, NULL, 268435456, NULL, NULL, 0);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IErrorRecords_AddErrorRecord(errrecs, &info, 1, NULL, NULL, 0);
ok(hr == S_OK, "got %08x\n", hr);
hr = IErrorRecords_GetRecordCount(errrecs, &cnt);
ok(hr == S_OK, "got %08x\n", hr);
ok(cnt == 1, "expected 1 got %d\n", cnt);
hr = IErrorRecords_AddErrorRecord(errrecs, &info2, 2, NULL, NULL, 0);
ok(hr == S_OK, "got %08x\n", hr);
hr = IErrorRecords_GetRecordCount(errrecs, &cnt);
ok(hr == S_OK, "got %08x\n", hr);
ok(cnt == 2, "expected 2 got %d\n", cnt);
hr = IErrorRecords_GetBasicErrorInfo(errrecs, 0, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IErrorRecords_GetBasicErrorInfo(errrecs, 100, &info3);
ok(hr == DB_E_BADRECORDNUM, "got %08x\n", hr);
hr = IErrorRecords_GetBasicErrorInfo(errrecs, 0, &info3);
todo_wine ok(hr == S_OK, "got %08x\n", hr);
if(hr == S_OK)
{
ok(info3.dwMinor == 2, "expected 2 got %d\n", info3.dwMinor);
}
IErrorRecords_Release(errrecs);
}
IUnknown_Release(unk);
ok(info3.dwMinor == 2, "expected 2 got %d\n", info3.dwMinor);
}
IErrorRecords_Release(errrecs);
IUnknown_Release(unk);
}
static void test_initializationstring(void)