renameAsyncOverloadDefaultOptions method

Pointer<COMObject> renameAsyncOverloadDefaultOptions(
  1. String desiredName
)

Implementation

Pointer<COMObject> renameAsyncOverloadDefaultOptions(String desiredName) {
  final retValuePtr = calloc<COMObject>();
  final desiredNameHstring = convertToHString(desiredName);
  final hr = ptr.ref.vtable
          .elementAt(6)
          .cast<
              Pointer<
                  NativeFunction<
                      HRESULT Function(Pointer, IntPtr desiredName,
                          Pointer<COMObject>)>>>()
          .value
          .asFunction<
              int Function(Pointer, int desiredName, Pointer<COMObject>)>()(
      ptr.ref.lpVtbl, desiredNameHstring, retValuePtr);

  if (FAILED(hr)) {
    free(retValuePtr);
    throw WindowsException(hr);
  }
  WindowsDeleteString(desiredNameHstring);
  return retValuePtr;
}