VarBstrCat function oleaut32

BSTR VarBstrCat(
  1. BSTR bstrLeft,
  2. BSTR bstrRight
)

Concatenates two variants of type BSTR and returns the resulting BSTR.

Throws a WindowsException on failure.

To learn more, see learn.microsoft.com/windows/win32/api/oleauto/nf-oleauto-varbstrcat.

Implementation

BSTR VarBstrCat(BSTR bstrLeft, BSTR bstrRight) {
  final pbstrResult = adaptiveCalloc<Pointer<Utf16>>();
  final hr$ = HRESULT(_VarBstrCat(bstrLeft, bstrRight, pbstrResult));
  if (hr$.isError) {
    free(pbstrResult);
    throw WindowsException(hr$);
  }
  final result$ = pbstrResult.value;
  free(pbstrResult);
  return .new(result$);
}