SafeArrayGetVartype function oleaut32

VARENUM SafeArrayGetVartype(
  1. Pointer<SAFEARRAY> psa
)

Gets the VARTYPE stored in the specified safe array.

Throws a WindowsException on failure.

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

Implementation

VARENUM SafeArrayGetVartype(Pointer<SAFEARRAY> psa) {
  final pvt = adaptiveCalloc<Uint16>();
  final hr$ = HRESULT(_SafeArrayGetVartype(psa, pvt));
  if (hr$.isError) {
    free(pvt);
    throw WindowsException(hr$);
  }
  final result$ = pvt.value;
  free(pvt);
  return .new(result$);
}