getForUser method

UserDataPaths? getForUser(
  1. User? user
)

Implementation

UserDataPaths? getForUser(User? user) {
  final retValuePtr = calloc<COMObject>();

  final hr = ptr.ref.vtable
          .elementAt(6)
          .cast<
              Pointer<
                  NativeFunction<
                      HRESULT Function(Pointer, Pointer<COMObject> user,
                          Pointer<COMObject>)>>>()
          .value
          .asFunction<
              int Function(
                  Pointer, Pointer<COMObject> user, Pointer<COMObject>)>()(
      ptr.ref.lpVtbl,
      user == null ? nullptr : user.ptr.cast<Pointer<COMObject>>().value,
      retValuePtr);

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

  if (retValuePtr.ref.lpVtbl == nullptr) {
    free(retValuePtr);
    return null;
  }

  return UserDataPaths.fromRawPointer(retValuePtr);
}