/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App.Server/Helpers.cs
33 строки
905 B
0x5bfa
Code Quality: Replace raw ABI pointers with ComObject instances for safer disposal (#18684)
16 июл 2026, 18:32
Не верифицирован
16 июл 2026, 18:32
93dfb04
Код
Авторство
О чём код?
// Copyright (c) Files Community // Licensed under the MIT License. using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Windows.Win32.Foundation; using Windows.Win32.System.WinRT; using WinRT; namespace Files.App.Server; unsafe partial class Helpers { [UnmanagedCallersOnly(CallConvs = [typeof(CallConvStdcall)])] public static HRESULT GetActivationFactory(HSTRING activatableClassId, IActivationFactory_unmanaged** factory) { if (activatableClassId.IsNull || factory is null) { return HRESULT.E_INVALIDARG; } try { *factory = (IActivationFactory_unmanaged*)Module.GetActivationFactory(MarshalString.FromAbi((IntPtr)activatableClassId)); return *factory is null ? HRESULT.CLASS_E_CLASSNOTAVAILABLE : HRESULT.S_OK; } catch (Exception e) { ExceptionHelpers.SetErrorInfo(e); return (HRESULT)ExceptionHelpers.GetHRForException(e); } } }