Commit d1f4e6a1 authored by Alex Villacís Lasso's avatar Alex Villacís Lasso Committed by Alexandre Julliard

oledb32: Implement conversion from DBTYPE_GUID to DBTYPE_STR/DBTYPE_WSTR/DBTYPE_BSTR.

parent 75c053aa
......@@ -336,6 +336,22 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
case DBTYPE_UI4: hr = VarBstrFromUI4(*(DWORD*)src, LOCALE_USER_DEFAULT, 0, d); break;
case DBTYPE_I8: hr = VarBstrFromI8(*(LONGLONG*)src, LOCALE_USER_DEFAULT, 0, d); break;
case DBTYPE_UI8: hr = VarBstrFromUI8(*(ULONGLONG*)src, LOCALE_USER_DEFAULT, 0, d); break;
case DBTYPE_GUID:
{
WCHAR szBuff[39];
const GUID *id = (const GUID *)src;
WCHAR format[] = {
'{','%','0','8','X','-','%','0','4','X','-','%','0','4','X','-',
'%','0','2','X','%','0','2','X','-',
'%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','}',0};
wsprintfW(szBuff, format,
id->Data1, id->Data2, id->Data3,
id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
*d = SysAllocString(szBuff);
hr = *d ? S_OK : E_OUTOFMEMORY;
}
break;
default: FIXME("Unimplemented conversion %04x -> BSTR\n", src_type); return E_NOTIMPL;
}
break;
......
......@@ -1240,12 +1240,11 @@ static void test_converttowstr(void)
memcpy(src, &IID_IDataConvert, sizeof(GUID));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_GUID, DBTYPE_WSTR, 0, &dst_len, src, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
ok(dst_len == 76, "got %d\n", dst_len);
ok(!lstrcmpW(dst, guid_str), "got %s\n", wine_dbgstr_w(dst));
}
b = SysAllocString(ten);
......@@ -1605,12 +1604,11 @@ static void test_converttostr(void)
memcpy(src, &IID_IDataConvert, sizeof(GUID));
memset(dst, 0xcc, sizeof(dst));
hr = IDataConvert_DataConvert(convert, DBTYPE_GUID, DBTYPE_STR, 0, &dst_len, src, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
ok(dst_len == 38, "got %d\n", dst_len);
ok(!lstrcmpA(dst, guid_str), "got %s\n", dst);
}
b = SysAllocString(ten);
......
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