/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v3.2.3
src/Files.App.Server/Helpers.cs
39 строк
883 B
Steve
Feature: Added an out-of-proc WinRT server for long-running background tasks (#14335)
31 дек 2023, 20:57
Не верифицирован
31 дек 2023, 20:57
62518f2
Код
Авторство
О чём код?
using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using WinRT; namespace Files.App.Server; unsafe partial class Helpers { [UnmanagedCallersOnly(CallConvs = [typeof(CallConvStdcall)])] public static int GetActivationFactory(void* activatableClassId, void** factory) { const int E_INVALIDARG = unchecked((int)0x80070057); const int CLASS_E_CLASSNOTAVAILABLE = unchecked((int)0x80040111); const int S_OK = 0; if (activatableClassId is null || factory is null) { return E_INVALIDARG; } try { IntPtr obj = Module.GetActivationFactory(MarshalString.FromAbi((IntPtr)activatableClassId)); if ((void*)obj is null) { return CLASS_E_CLASSNOTAVAILABLE; } *factory = (void*)obj; return S_OK; } catch (Exception e) { ExceptionHelpers.SetErrorInfo(e); return ExceptionHelpers.GetHRForException(e); } } }