Windows-powershell / PowerShell-master /src /Microsoft.PowerShell.ConsoleHost /WindowsTaskbarJumpList /ComInterfaces.cs
| // Copyright (c) Microsoft Corporation. | |
| // Licensed under the MIT License. | |
| using System; | |
| using System.Runtime.InteropServices; | |
| using System.Text; | |
| namespace Microsoft.PowerShell | |
| { | |
| internal static class ComInterfaces | |
| { | |
| [] | |
| internal static extern void GetStartupInfo(out StartUpInfo lpStartupInfo); | |
| /// <remarks> | |
| /// IntPtr is being used for the string fields to make the marshaller faster and | |
| /// simpler. With IntPtr, all fields are blittable, and since we don't use the | |
| /// string fields at all, nothing is lost. | |
| /// </remarks> | |
| [] | |
| internal readonly struct StartUpInfo | |
| { | |
| public readonly uint cb; | |
| private readonly IntPtr lpReserved; | |
| public readonly IntPtr lpDesktop; | |
| public readonly IntPtr lpTitle; | |
| public readonly uint dwX; | |
| public readonly uint dwY; | |
| public readonly uint dwXSize; | |
| public readonly uint dwYSize; | |
| public readonly uint dwXCountChars; | |
| public readonly uint dwYCountChars; | |
| public readonly uint dwFillAttribute; | |
| public readonly uint dwFlags; | |
| public readonly ushort wShowWindow; | |
| private readonly ushort cbReserved2; | |
| private readonly IntPtr lpReserved2; | |
| public readonly IntPtr hStdInput; | |
| public readonly IntPtr hStdOutput; | |
| public readonly IntPtr hStdError; | |
| } | |
| [] | |
| [] | |
| [] | |
| internal class CShellLink { } | |
| [] | |
| [] | |
| [] | |
| internal interface IShellLinkW | |
| { | |
| void GetPath( | |
| [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, | |
| int cchMaxPath, | |
| IntPtr pfd, | |
| uint fFlags); | |
| void GetIDList(out IntPtr ppidl); | |
| void SetIDList(IntPtr pidl); | |
| void GetDescription( | |
| [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, | |
| int cchMaxName); | |
| void SetDescription( | |
| [MarshalAs(UnmanagedType.LPWStr)] string pszName); | |
| void GetWorkingDirectory( | |
| [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir, | |
| int cchMaxPath | |
| ); | |
| void SetWorkingDirectory( | |
| [MarshalAs(UnmanagedType.LPWStr)] string pszDir); | |
| void GetArguments( | |
| [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs, | |
| int cchMaxPath); | |
| void SetArguments( | |
| [MarshalAs(UnmanagedType.LPWStr)] string pszArgs); | |
| void GetHotKey(out short wHotKey); | |
| void SetHotKey(short wHotKey); | |
| void GetShowCmd(out uint iShowCmd); | |
| void SetShowCmd(uint iShowCmd); | |
| void GetIconLocation( | |
| [Out(), MarshalAs(UnmanagedType.LPWStr)] out StringBuilder pszIconPath, | |
| int cchIconPath, | |
| out int iIcon); | |
| void SetIconLocation( | |
| [MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, | |
| int iIcon); | |
| void SetRelativePath( | |
| [MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, | |
| uint dwReserved); | |
| void Resolve(IntPtr hwnd, uint fFlags); | |
| void SetPath( | |
| [MarshalAs(UnmanagedType.LPWStr)] string pszFile); | |
| } | |
| /// <summary> | |
| /// A property store. | |
| /// </summary> | |
| [] | |
| [] | |
| [] | |
| internal interface IPropertyStore | |
| { | |
| /// <summary> | |
| /// Gets the number of properties contained in the property store. | |
| /// </summary> | |
| /// <param name="propertyCount"></param> | |
| /// <returns></returns> | |
| [] | |
| HResult GetCount([Out] out uint propertyCount); | |
| /// <summary> | |
| /// Get a property key located at a specific index. | |
| /// </summary> | |
| /// <param name="propertyIndex"></param> | |
| /// <param name="key"></param> | |
| /// <returns></returns> | |
| [] | |
| HResult GetAt([In] uint propertyIndex, out PropertyKey key); | |
| /// <summary> | |
| /// Gets the value of a property from the store. | |
| /// </summary> | |
| /// <param name="key"></param> | |
| /// <param name="pv"></param> | |
| /// <returns></returns> | |
| [] | |
| HResult GetValue([In] in PropertyKey key, [Out] PropVariant pv); | |
| /// <summary> | |
| /// Sets the value of a property in the store. | |
| /// </summary> | |
| /// <param name="key"></param> | |
| /// <param name="pv"></param> | |
| /// <returns></returns> | |
| [] | |
| HResult SetValue([In] in PropertyKey key, [In] PropVariant pv); | |
| /// <summary> | |
| /// Commits the changes. | |
| /// </summary> | |
| /// <returns></returns> | |
| [] | |
| HResult Commit(); | |
| } | |
| [] | |
| [] | |
| [] | |
| internal interface ICustomDestinationList | |
| { | |
| void SetAppID( | |
| [MarshalAs(UnmanagedType.LPWStr)] string pszAppID); | |
| [] | |
| HResult BeginList( | |
| out uint cMaxSlots, | |
| ref Guid riid, | |
| [Out(), MarshalAs(UnmanagedType.Interface)] out object ppvObject); | |
| [] | |
| HResult AppendCategory( | |
| [MarshalAs(UnmanagedType.LPWStr)] string pszCategory, | |
| [MarshalAs(UnmanagedType.Interface)] IObjectArray poa); | |
| void AppendKnownCategory( | |
| [MarshalAs(UnmanagedType.I4)] KnownDestinationCategory category); | |
| [] | |
| HResult AddUserTasks( | |
| [MarshalAs(UnmanagedType.Interface)] IObjectArray poa); | |
| void CommitList(); | |
| void GetRemovedDestinations( | |
| ref Guid riid, | |
| [Out(), MarshalAs(UnmanagedType.Interface)] out object ppvObject); | |
| void DeleteList( | |
| [MarshalAs(UnmanagedType.LPWStr)] string pszAppID); | |
| void AbortList(); | |
| } | |
| internal enum KnownDestinationCategory | |
| { | |
| Frequent = 1, | |
| Recent | |
| } | |
| [] | |
| [] | |
| [] | |
| internal interface IObjectArray | |
| { | |
| void GetCount(out uint cObjects); | |
| void GetAt( | |
| uint iIndex, | |
| ref Guid riid, | |
| [Out(), MarshalAs(UnmanagedType.Interface)] out object ppvObject); | |
| } | |
| [] | |
| [] | |
| [] | |
| internal interface IObjectCollection | |
| { | |
| // IObjectArray | |
| void GetCount(out uint cObjects); | |
| void GetAt( | |
| uint iIndex, | |
| ref Guid riid, | |
| [Out(), MarshalAs(UnmanagedType.Interface)] out object ppvObject); | |
| // IObjectCollection | |
| void AddObject( | |
| [MarshalAs(UnmanagedType.Interface)] object pvObject); | |
| void AddFromArray( | |
| [MarshalAs(UnmanagedType.Interface)] IObjectArray poaSource); | |
| void RemoveObject(uint uiIndex); | |
| void Clear(); | |
| } | |
| [] | |
| [ | |
| ] | |
| internal interface IShellLinkDataListW | |
| { | |
| [] | |
| int AddDataBlock(IntPtr pDataBlock); | |
| [] | |
| int CopyDataBlock(uint dwSig, out IntPtr ppDataBlock); | |
| [] | |
| int RemoveDataBlock(uint dwSig); | |
| void GetFlags(out uint pdwFlags); | |
| void SetFlags(uint dwFlags); | |
| } | |
| [] | |
| internal static extern HResult CoCreateInstance(ref Guid clsid, | |
| [MarshalAs(UnmanagedType.IUnknown)] object inner, | |
| uint context, | |
| ref Guid uuid, | |
| [MarshalAs(UnmanagedType.IUnknown)] out object rReturnedComObject); | |
| } | |
| } | |