/
githubmirror
/
PowerShell
Обзор
Документация
Войти
/
githubmirror
/
PowerShell
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/System.Management.Automation/engine/Interop/Windows/SHGetFileInfo.cs
38 строк
2 KB
Ilya
Replace `DllImport` with `LibraryImport` - 1 (#18603)
30 ноя 2022, 21:00
Не верифицирован
30 ноя 2022, 21:00
3dc95ce
Код
Авторство
О чём код?
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #nullable enable using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; internal static partial class Interop { [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1305:FieldNamesMustNotUseHungarianNotation", Justification = "Keep native struct names.")] [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter", Justification = "Keep native struct names.")] internal static partial class Windows { [StructLayout(LayoutKind.Sequential)] internal unsafe struct SHFILEINFO { internal nint hIcon; internal int iIcon; internal uint dwAttributes; internal fixed char szDisplayName[260]; internal fixed char szTypeName[80]; public static readonly uint s_Size = (uint)sizeof(SHFILEINFO); } [LibraryImport("shell32.dll", EntryPoint = "SHGetFileInfoW", StringMarshalling = StringMarshalling.Utf16)] internal static partial nint SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags); internal static int SHGetFileInfo(string pszPath) { // flag used to ask to return exe type const uint SHGFI_EXETYPE = 0x000002000; var shinfo = new SHFILEINFO(); return (int)SHGetFileInfo(pszPath, 0, ref shinfo, SHFILEINFO.s_Size, SHGFI_EXETYPE); } } }