/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Utils/Shell/ItemStreamHelper.cs
31 строка
701 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 Windows.Win32; using Windows.Win32.System.Com; using Windows.Win32.UI.Shell; namespace Files.App.Utils.Shell { public static class ItemStreamHelper { public static IShellItem? IShellItemFromPath(string path) { var hr = PInvoke.SHCreateItemFromParsingName(path, null!, out IShellItem psi); return hr.Failed ? null : psi; } public static IStream? IStreamFromPath(string path) { var hr = PInvoke.SHCreateStreamOnFileEx( path, (uint)(STGM.STGM_READ | STGM.STGM_FAILIFTHERE | STGM.STGM_SHARE_DENY_NONE), 0, false, null, out IStream pstm); return hr.Failed ? null : pstm; } } }