Skip to content

Commit

Permalink
QueryInterfaceAs -> CastComInterfaceAs
Browse files Browse the repository at this point in the history
  • Loading branch information
neon-nyan committed Nov 9, 2024
1 parent b123ef7 commit e1766a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CollapseLauncher/Classes/CoCreateInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ internal static unsafe HRESULT CoCreateInstance<T>(Guid rclsid, nint pUnkOuter,
public static unsafe extern HRESULT CoCreateInstance(in Guid rclsid, IntPtr pUnkOuter, CLSCTX dwClsContext, in Guid riid, out void* ppObj);

[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe TInterfaceTo? QueryInterfaceAs<TInterfaceFrom, TInterfaceTo>(this TInterfaceFrom interfaceFrom, in Guid interfaceToGuid)
internal static unsafe TInterfaceTo? CastComInterfaceAs<TInterfaceFrom, TInterfaceTo>(this TInterfaceFrom interfaceFrom, in Guid interfaceToGuid)
where TInterfaceFrom : class
where TInterfaceTo : class
{
Expand Down
6 changes: 3 additions & 3 deletions CollapseLauncher/Classes/ShellLinkCOM/ShellLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ out IShellLinkW? shellLink
).ThrowOnFailure();

linkW = shellLink;
persistFileW = shellLink?.QueryInterfaceAs<IShellLinkW, IPersistFile>(in CLSIDGuid.IGuid_IPersistFile);
persistW = shellLink?.QueryInterfaceAs<IShellLinkW, IPersist>(in CLSIDGuid.IGuid_IPersist);
propertyStoreW = shellLink?.QueryInterfaceAs<IShellLinkW, IPropertyStore>(in CLSIDGuid.IGuid_IPropertyStore);
persistFileW = shellLink?.CastComInterfaceAs<IShellLinkW, IPersistFile>(in CLSIDGuid.IGuid_IPersistFile);
persistW = shellLink?.CastComInterfaceAs<IShellLinkW, IPersist>(in CLSIDGuid.IGuid_IPersist);
propertyStoreW = shellLink?.CastComInterfaceAs<IShellLinkW, IPropertyStore>(in CLSIDGuid.IGuid_IPropertyStore);
}

/// <summary>
Expand Down

0 comments on commit e1766a2

Please sign in to comment.