Module: wine Branch: master Commit: 3a1f5224fb92913f1789970a755e9bc4e00ceac0 URL: https://gitlab.winehq.org/wine/wine/-/commit/3a1f5224fb92913f1789970a755e9bc...
Author: Alistair Leslie-Hughes leslie_alistair@hotmail.com Date: Tue Mar 28 14:06:45 2023 +1100
msado15: Handle DBTYPE_STR type when loading recordset data.
---
dlls/msado15/recordset.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c index 13807aa1c5a..0f4acda0156 100644 --- a/dlls/msado15/recordset.c +++ b/dlls/msado15/recordset.c @@ -970,6 +970,22 @@ static HRESULT map_index( struct fields *fields, VARIANT *index, ULONG *ret ) return MAKE_ADO_HRESULT(adErrItemNotFound); }
+static inline WCHAR *heap_strdupAtoW(const char *str) +{ + LPWSTR ret = NULL; + + if(str) { + DWORD len; + + len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); + ret = malloc(len*sizeof(WCHAR)); + if(ret) + MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); + } + + return ret; +} + static HRESULT WINAPI fields_get_Item( Fields *iface, VARIANT index, Field **obj ) { struct fields *fields = impl_from_Fields( iface ); @@ -1948,6 +1964,15 @@ static HRESULT load_all_recordset_data(struct recordset *recordset, IUnknown *ro case DBTYPE_I4: V_I4(©) = *(LONG*)(data + bindings[datacol].obValue); break; + case DBTYPE_STR: + { + WCHAR *str = heap_strdupAtoW( (char*)(data + bindings[datacol].obValue) ); + + V_VT(©) = VT_BSTR; + V_BSTR(©) = SysAllocString(str); + free(str); + break; + } case DBTYPE_WSTR: { V_VT(©) = VT_BSTR;