getContentType method

PWSTR getContentType()

Retrieves the content type of the file.

Throws a WindowsException on failure.

To learn more, see learn.microsoft.com/windows/win32/api/appxpackaging/nf-appxpackaging-iappxfile-getcontenttype.

Implementation

PWSTR getContentType() {
  final contentType = adaptiveCalloc<Pointer<Utf16>>();
  final hr$ = HRESULT(_GetContentTypeFn(ptr, contentType));
  if (hr$.isError) {
    free(contentType);
    throw WindowsException(hr$);
  }
  final result$ = contentType.value;
  free(contentType);
  return .new(result$);
}