diff --git a/CollapseLauncher/Classes/CoCreateInstance.cs b/CollapseLauncher/Classes/CoCreateInstance.cs index 25712c42d..a182bccfa 100644 --- a/CollapseLauncher/Classes/CoCreateInstance.cs +++ b/CollapseLauncher/Classes/CoCreateInstance.cs @@ -151,7 +151,7 @@ internal static unsafe HRESULT CoCreateInstance(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(this TInterfaceFrom interfaceFrom, in Guid interfaceToGuid) + internal static unsafe TInterfaceTo? CastComInterfaceAs(this TInterfaceFrom interfaceFrom, in Guid interfaceToGuid) where TInterfaceFrom : class where TInterfaceTo : class { diff --git a/CollapseLauncher/Classes/ShellLinkCOM/ShellLink.cs b/CollapseLauncher/Classes/ShellLinkCOM/ShellLink.cs index ae1a44af7..593c94062 100644 --- a/CollapseLauncher/Classes/ShellLinkCOM/ShellLink.cs +++ b/CollapseLauncher/Classes/ShellLinkCOM/ShellLink.cs @@ -41,9 +41,9 @@ out IShellLinkW? shellLink ).ThrowOnFailure(); linkW = shellLink; - persistFileW = shellLink?.QueryInterfaceAs(in CLSIDGuid.IGuid_IPersistFile); - persistW = shellLink?.QueryInterfaceAs(in CLSIDGuid.IGuid_IPersist); - propertyStoreW = shellLink?.QueryInterfaceAs(in CLSIDGuid.IGuid_IPropertyStore); + persistFileW = shellLink?.CastComInterfaceAs(in CLSIDGuid.IGuid_IPersistFile); + persistW = shellLink?.CastComInterfaceAs(in CLSIDGuid.IGuid_IPersist); + propertyStoreW = shellLink?.CastComInterfaceAs(in CLSIDGuid.IGuid_IPropertyStore); } ///