getCurrent method

Gets the <MainPackageDependency> element at the current position of the enumerator.

Throws a WindowsException on failure.

To learn more, see learn.microsoft.com/windows/win32/api/appxpackaging/nf-appxpackaging-iappxmanifestmainpackagedependenciesenumerator-getcurrent.

Implementation

IAppxManifestMainPackageDependency? getCurrent() {
  final mainPackageDependency = adaptiveCalloc<VTablePointer>();
  final hr$ = HRESULT(_GetCurrentFn(ptr, mainPackageDependency));
  if (hr$.isError) {
    free(mainPackageDependency);
    throw WindowsException(hr$);
  }
  final result$ = mainPackageDependency.value;
  free(mainPackageDependency);
  if (result$.isNull) return null;
  return .new(result$);
}