getPackageId method

IAppxManifestPackageId? getPackageId()

Gets the package identifier defined in the manifest.

Throws a WindowsException on failure.

To learn more, see learn.microsoft.com/windows/win32/api/appxpackaging/nf-appxpackaging-iappxmanifestreader-getpackageid.

Implementation

IAppxManifestPackageId? getPackageId() {
  final packageId = adaptiveCalloc<VTablePointer>();
  final hr$ = HRESULT(_GetPackageIdFn(ptr, packageId));
  if (hr$.isError) {
    free(packageId);
    throw WindowsException(hr$);
  }
  final result$ = packageId.value;
  free(packageId);
  if (result$.isNull) return null;
  return .new(result$);
}