getCLSID method

Pointer<GUID> getCLSID(
  1. Pointer<PROPERTYKEY> key
)

Gets the class identifier (CLSID) value of specified property key.

Throws a WindowsException on failure.

To learn more, see learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ishellitem2-getclsid.

Implementation

Pointer<GUID> getCLSID(Pointer<PROPERTYKEY> key) {
  final pclsid = adaptiveCalloc<GUID>();
  final hr$ = HRESULT(_GetCLSIDFn(ptr, key, pclsid));
  if (hr$.isError) {
    free(pclsid);
    throw WindowsException(hr$);
  }
  return pclsid;
}