Commit f5f6cfb0 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

oledb32: IErrorInfo methods are stubs.

There's no way to set error info for this object Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 2f7c3168
...@@ -53,12 +53,6 @@ typedef struct ErrorInfoImpl ...@@ -53,12 +53,6 @@ typedef struct ErrorInfoImpl
IErrorRecords IErrorRecords_iface; IErrorRecords IErrorRecords_iface;
LONG ref; LONG ref;
GUID m_Guid;
BSTR source;
BSTR description;
BSTR help_file;
DWORD help_context;
struct list errors; struct list errors;
} ErrorInfoImpl; } ErrorInfoImpl;
...@@ -115,10 +109,6 @@ static ULONG WINAPI IErrorInfoImpl_Release(IErrorInfo* iface) ...@@ -115,10 +109,6 @@ static ULONG WINAPI IErrorInfoImpl_Release(IErrorInfo* iface)
if (!ref) 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_FOR_EACH_ENTRY_SAFE(cursor, cursor2, &This->errors, struct ErrorEntry, entry)
{ {
list_remove(&cursor->entry); list_remove(&cursor->entry);
...@@ -132,74 +122,74 @@ static ULONG WINAPI IErrorInfoImpl_Release(IErrorInfo* iface) ...@@ -132,74 +122,74 @@ static ULONG WINAPI IErrorInfoImpl_Release(IErrorInfo* iface)
return ref; 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); ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
TRACE("(%p)\n",This); TRACE("(%p)->(%p)\n", This, guid);
if(!pGUID ) if (!guid)
return E_INVALIDARG; return E_INVALIDARG;
*pGUID = This->m_Guid; *guid = GUID_NULL;
return S_OK; 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); 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; 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); 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; 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); 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; 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); 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; return E_INVALIDARG;
*pdwHelpContext = This->help_context; *context = 0;
return S_OK; return E_FAIL;
} }
static const IErrorInfoVtbl ErrorInfoVtbl = static const IErrorInfoVtbl ErrorInfoVtbl =
...@@ -371,10 +361,6 @@ HRESULT create_error_info(IUnknown *outer, void **obj) ...@@ -371,10 +361,6 @@ HRESULT create_error_info(IUnknown *outer, void **obj)
This->IErrorInfo_iface.lpVtbl = &ErrorInfoVtbl; This->IErrorInfo_iface.lpVtbl = &ErrorInfoVtbl;
This->IErrorRecords_iface.lpVtbl = &ErrorRecordsVtbl; This->IErrorRecords_iface.lpVtbl = &ErrorRecordsVtbl;
This->ref = 1; This->ref = 1;
This->source = NULL;
This->description = NULL;
This->help_file = NULL;
This->help_context = 0;
list_init(&This->errors); list_init(&This->errors);
......
...@@ -312,71 +312,109 @@ static void test_database(void) ...@@ -312,71 +312,109 @@ static void test_database(void)
static void test_errorinfo(void) static void test_errorinfo(void)
{ {
HRESULT hr; ICreateErrorInfo *createerror;
ERRORINFO info, info2, info3;
IErrorInfo *errorinfo;
IErrorRecords *errrecs;
IUnknown *unk = NULL; 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); ok(hr == S_OK, "got %08x\n", hr);
if(hr == S_OK)
{
IErrorInfo *errorinfo;
IErrorRecords *errrecs;
hr = IUnknown_QueryInterface(unk, &IID_IErrorInfo, (void**)&errorinfo); hr = IUnknown_QueryInterface(unk, &IID_IErrorInfo, (void**)&errorinfo);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "got %08x\n", hr);
if(hr == S_OK)
{
IErrorInfo_Release(errorinfo);
}
hr = IUnknown_QueryInterface(unk, &IID_IErrorRecords, (void**)&errrecs); hr = IErrorInfo_GetGUID(errorinfo, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == E_INVALIDARG, "got %08x\n", hr);
if(hr == S_OK)
{
ERRORINFO info, info2, info3;
ULONG cnt = 0;
memset(&info, 0, sizeof(ERRORINFO)); hr = IErrorInfo_GetSource(errorinfo, NULL);
info.dwMinor = 1; ok(hr == E_INVALIDARG, "got %08x\n", hr);
memset(&info2, 0, sizeof(ERRORINFO));
info2.dwMinor = 2;
memset(&info3, 0, sizeof(ERRORINFO));
hr = IErrorRecords_AddErrorRecord(errrecs, NULL, 268435456, NULL, NULL, 0); hr = IErrorInfo_GetDescription(errorinfo, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr); ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IErrorRecords_AddErrorRecord(errrecs, &info, 1, NULL, NULL, 0); hr = IErrorInfo_GetHelpFile(errorinfo, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = IErrorRecords_GetRecordCount(errrecs, &cnt); hr = IErrorInfo_GetHelpContext(errorinfo, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == E_INVALIDARG, "got %08x\n", hr);
ok(cnt == 1, "expected 1 got %d\n", cnt);
hr = IErrorRecords_AddErrorRecord(errrecs, &info2, 2, NULL, NULL, 0); memset(&guid, 0xac, sizeof(guid));
ok(hr == S_OK, "got %08x\n", hr); hr = IErrorInfo_GetGUID(errorinfo, &guid);
ok(hr == S_OK, "got %08x\n", hr);
ok(IsEqualGUID(&guid, &GUID_NULL), "got wrong guid\n");
hr = IErrorRecords_GetRecordCount(errrecs, &cnt); str = (BSTR)0x1;
ok(hr == S_OK, "got %08x\n", hr); hr = IErrorInfo_GetSource(errorinfo, &str);
ok(cnt == 2, "expected 2 got %d\n", cnt); ok(hr == E_FAIL, "got %08x\n", hr);
ok(str == NULL, "got %s\n", wine_dbgstr_w(str));
hr = IErrorRecords_GetBasicErrorInfo(errrecs, 0, NULL); str = (BSTR)0x1;
ok(hr == E_INVALIDARG, "got %08x\n", hr); hr = IErrorInfo_GetDescription(errorinfo, &str);
ok(hr == E_FAIL, "got %08x\n", hr);
ok(str == NULL, "got %s\n", wine_dbgstr_w(str));
hr = IErrorRecords_GetBasicErrorInfo(errrecs, 100, &info3); str = (BSTR)0x1;
ok(hr == DB_E_BADRECORDNUM, "got %08x\n", hr); hr = IErrorInfo_GetHelpFile(errorinfo, &str);
ok(hr == E_FAIL, "got %08x\n", hr);
ok(str == NULL, "got %s\n", wine_dbgstr_w(str));
hr = IErrorRecords_GetBasicErrorInfo(errrecs, 0, &info3); context = 1;
todo_wine ok(hr == S_OK, "got %08x\n", hr); hr = IErrorInfo_GetHelpContext(errorinfo, &context);
if(hr == S_OK) ok(hr == E_FAIL, "got %08x\n", hr);
{ ok(context == 0, "got %d\n", context);
ok(info3.dwMinor == 2, "expected 2 got %d\n", info3.dwMinor);
}
IErrorRecords_Release(errrecs); 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);
IUnknown_Release(unk); 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);
} }
static void test_initializationstring(void) static void test_initializationstring(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment