microsoft/Windows-classic-samples

[Win7Sample.OleDb.RowsetViewer] SafeArrayToString does not append wEOL symbol.

dmitry-lipetsk opened this issue · 0 comments

When I was using the debug build of RowsetViewer I noticed that it displayed the strange data of Array column:

image

As I understand, SafeArrayToString must append wEOL symbol in result string but does not do it:

HRESULT SafeArrayToString(SAFEARRAY* pSafeArray, DBTYPE wType, WCHAR* pwszBuffer, DBLENGTH ulMaxSize)

This function is called from here:

else if(wSrcType & DBTYPE_ARRAY && wDstType == DBTYPE_WSTR)
{
hr = SafeArrayToString(*(SAFEARRAY**)pSrcValue, wSrcType, (WCHAR*)pDstValue, cbDstMaxLength/sizeof(WCHAR));
//LENGTH
if(pcbDstLength)
*pcbDstLength = wcslen((WCHAR*)pDstValue)*sizeof(WCHAR);
break;
}

If SafeArrayToString adds wEOL symbol in the result string, it works well:

image