|
| 1 | +// Copyright (c) Files Community |
| 2 | +// Licensed under the MIT License. |
| 3 | + |
| 4 | +using System; |
| 5 | +using System.Runtime.CompilerServices; |
| 6 | +using System.Runtime.InteropServices; |
| 7 | +using Windows.Win32.Foundation; |
| 8 | +using Windows.Win32.UI.Shell; |
| 9 | + |
| 10 | +namespace Windows.Win32.System.Com |
| 11 | +{ |
| 12 | + /// <summary> |
| 13 | + /// Defines unmanaged raw vtable for the <see cref="IAutomaticDestinationList"/> interface. |
| 14 | + /// </summary> |
| 15 | + public unsafe partial struct IAutomaticDestinationList : IComIID |
| 16 | + { |
| 17 | +#pragma warning disable CS0649 // Field 'field' is never assigned to, and will always have its default value 'value' |
| 18 | + private void** lpVtbl; |
| 19 | +#pragma warning restore CS0649 // Field 'field' is never assigned to, and will always have its default value 'value' |
| 20 | + |
| 21 | + /// <summary> |
| 22 | + /// Initializes this instance of <see cref="IAutomaticDestinationList"/> with the specified Application User Model ID (AMUID). |
| 23 | + /// </summary> |
| 24 | + /// <param name="szAppId">The Application User Model ID to initialize this instance of <see cref="IAutomaticDestinationList"/> with.</param> |
| 25 | + /// <param name="a2">Unknown argument. Apparently this can be NULL.</param> |
| 26 | + /// <param name="a3">Unknown argument. Apparently this can be NULL.</param> |
| 27 | + /// <returns>Returns <see cref="HRESULT.S_OK"/> if successful, or an error value otherwise.</returns> |
| 28 | + [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| 29 | + public HRESULT Initialize(PCWSTR szAppId, PCWSTR a2, PCWSTR a3) |
| 30 | + => (HRESULT)((delegate* unmanaged[MemberFunction]<IAutomaticDestinationList*, PCWSTR, PCWSTR, PCWSTR, int>)lpVtbl[3]) |
| 31 | + ((IAutomaticDestinationList*)Unsafe.AsPointer(ref this), szAppId, a2, a3); |
| 32 | + |
| 33 | + /// <summary> |
| 34 | + /// Gets a value that determines whether this <see cref="IAutomaticDestinationList"/> has any list. |
| 35 | + /// </summary> |
| 36 | + /// <param name="pfHasList">A pointer to a <see cref="BOOL"/> that receives the result. <see cref="BOOL.TRUE"/> if there's any list; otherwise, <see cref="BOOL.FALSE"/>.</param> |
| 37 | + /// <returns>Returns <see cref="HRESULT.S_OK"/> if successful, or an error value otherwise.</returns> |
| 38 | + [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| 39 | + public HRESULT HasList(BOOL* pfHasList) |
| 40 | + => (HRESULT)((delegate* unmanaged[MemberFunction]<IAutomaticDestinationList*, BOOL*, int>)lpVtbl[4]) |
| 41 | + ((IAutomaticDestinationList*)Unsafe.AsPointer(ref this), pfHasList); |
| 42 | + |
| 43 | + /// <summary> |
| 44 | + /// Gets the list of automatic destinations of the specified type. |
| 45 | + /// </summary> |
| 46 | + /// <param name="type">The type to get the automatic destinations of.</param> |
| 47 | + /// <param name="maxCount">The max count to get the automatic destinations up to.</param> |
| 48 | + /// <param name="flags">The flags to filter up the queried destinations.</param> |
| 49 | + /// <param name="riid">A reference to the interface identifier (IID) of the interface being queried for.</param> |
| 50 | + /// <param name="ppvObject">The address of a pointer to an interface with the IID specified in the riid parameter.</param> |
| 51 | + /// <returns>Returns <see cref="HRESULT.S_OK"/> if successful, or an error value otherwise.</returns> |
| 52 | + [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| 53 | + public HRESULT GetList(DESTLISTTYPE type, int maxCount, GETDESTLISTFLAGS flags, Guid* riid, void** ppvObject) |
| 54 | + => (HRESULT)((delegate* unmanaged[MemberFunction]<IAutomaticDestinationList*, DESTLISTTYPE, int, GETDESTLISTFLAGS, Guid*, void**, int>)lpVtbl[5]) |
| 55 | + ((IAutomaticDestinationList*)Unsafe.AsPointer(ref this), type, maxCount, flags, riid, ppvObject); |
| 56 | + |
| 57 | + [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| 58 | + public HRESULT AddUsagePoint(IUnknown* pUnk) |
| 59 | + => (HRESULT)((delegate* unmanaged[MemberFunction]<IAutomaticDestinationList*, IUnknown*, int>)lpVtbl[6]) |
| 60 | + ((IAutomaticDestinationList*)Unsafe.AsPointer(ref this), pUnk); |
| 61 | + |
| 62 | + /// <summary> |
| 63 | + /// Pins an item to the list. |
| 64 | + /// </summary> |
| 65 | + /// <param name="pUnk">The native object to pin to the list.</param> |
| 66 | + /// <param name="index">-1 to pin to the last, -2 to unpin, zero or positive numbers (>= 0) indicate the index to pin to the list at. Passing the other numbers are *UB*.</param> |
| 67 | + /// <returns>Returns <see cref="HRESULT.S_OK"/> if successful, or an error value otherwise.</returns> |
| 68 | + [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| 69 | + public HRESULT PinItem(IUnknown* pUnk, int index) |
| 70 | + => (HRESULT)((delegate* unmanaged[MemberFunction]<IAutomaticDestinationList*, IUnknown*, int, int>)lpVtbl[7]) |
| 71 | + ((IAutomaticDestinationList*)Unsafe.AsPointer(ref this), pUnk, index); |
| 72 | + |
| 73 | + /// <summary> |
| 74 | + /// Gets the index of a pinned item in the Pinned list. |
| 75 | + /// </summary> |
| 76 | + /// <remarks> |
| 77 | + /// According to the debug symbols, this method is called "IsPinned" and other definitions out there also define so |
| 78 | + /// but it is inappropriate based on the fact it actually calls an internal method that gets the index of a pinned item |
| 79 | + /// and returns it in the second argument. If you want to check if an item is pinned, you should use IShellItem::Compare for IShellItem, |
| 80 | + /// or compare IShellLinkW::GetPath, IShellLinkW::GetArguments and PKEY_Title for IShellLinkW, which is actually done, at least, in Windows 7 era. |
| 81 | + /// </remarks> |
| 82 | + /// <param name="punk">The native object to get its index in the list.</param> |
| 83 | + /// <param name="piIndex">A pointer that points to an int value that takes the index of the item passed.</param> |
| 84 | + /// <returns>Returns <see cref="HRESULT.S_OK"/> if successful, or an error value otherwise. If the passed item doesn't belong to the <see cref="DESTLISTTYPE.PINNED"/> list, HRESULT.E_NOT_SET is returned.</returns> |
| 85 | + [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| 86 | + public HRESULT GetPinIndex(IUnknown* punk, int* piIndex) |
| 87 | + => (HRESULT)((delegate* unmanaged[MemberFunction]<IAutomaticDestinationList*, IUnknown*, int*, int>)lpVtbl[8]) |
| 88 | + ((IAutomaticDestinationList*)Unsafe.AsPointer(ref this), punk, piIndex); |
| 89 | + |
| 90 | + /// <summary> |
| 91 | + /// Removes a destination from the automatic destinations list. |
| 92 | + /// </summary> |
| 93 | + /// <param name="psi">The destination to remove from the automatic destinations list.</param> |
| 94 | + /// <returns>Returns <see cref="HRESULT.S_OK"/> if successful, or an error value otherwise. |
| 95 | + public HRESULT RemoveDestination(IUnknown* psi) |
| 96 | + => (HRESULT)((delegate* unmanaged[MemberFunction]<IAutomaticDestinationList*, IUnknown*, int>)lpVtbl[9]) |
| 97 | + ((IAutomaticDestinationList*)Unsafe.AsPointer(ref this), psi); |
| 98 | + |
| 99 | + public HRESULT SetUsageData(IUnknown* pItem, float* a2, long* pFileTime) |
| 100 | + => (HRESULT)((delegate* unmanaged[MemberFunction]<IAutomaticDestinationList*, IUnknown*, float*, long*, int>)lpVtbl[10]) |
| 101 | + ((IAutomaticDestinationList*)Unsafe.AsPointer(ref this), pItem, a2, pFileTime); |
| 102 | + |
| 103 | + public HRESULT GetUsageData(IUnknown* pItem, float* a2, long* pFileTime) |
| 104 | + => (HRESULT)((delegate* unmanaged[MemberFunction]<IAutomaticDestinationList*, IUnknown*, float*, long*, int>)lpVtbl[11]) |
| 105 | + ((IAutomaticDestinationList*)Unsafe.AsPointer(ref this), pItem, a2, pFileTime); |
| 106 | + |
| 107 | + public HRESULT ResolveDestination(HWND hWnd, int a2, IShellItem* pShellItem, Guid* riid, void** ppvObject) |
| 108 | + => (HRESULT)((delegate* unmanaged[MemberFunction]<IAutomaticDestinationList*, HWND, int, IShellItem*, Guid*, void**, int>)lpVtbl[12]) |
| 109 | + ((IAutomaticDestinationList*)Unsafe.AsPointer(ref this), hWnd, a2, pShellItem, riid, ppvObject); |
| 110 | + |
| 111 | + public HRESULT ClearList(BOOL clearPinsToo) |
| 112 | + => (HRESULT)((delegate* unmanaged[MemberFunction]<IAutomaticDestinationList*, BOOL, int>)lpVtbl[13]) |
| 113 | + ((IAutomaticDestinationList*)Unsafe.AsPointer(ref this), clearPinsToo); |
| 114 | + |
| 115 | + [GuidRVAGen.Guid("E9C5EF8D-FD41-4F72-BA87-EB03BAD5817C")] |
| 116 | + public static partial ref readonly Guid Guid { get; } |
| 117 | + |
| 118 | + internal static ref readonly Guid IID_Guid |
| 119 | + => ref MemoryMarshal.AsRef<Guid>([0xBF, 0xDE, 0x32, 0x63, 0xB5, 0x87, 0x70, 0x46, 0x90, 0xC0, 0x5E, 0x57, 0xB4, 0x08, 0xA4, 0x9E]); |
| 120 | + |
| 121 | + internal static Guid* IID_Guid2 |
| 122 | + => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in IID_Guid)); |
| 123 | + |
| 124 | + static ref readonly Guid IComIID.Guid => ref IID_Guid; |
| 125 | + } |
| 126 | + |
| 127 | + public enum DESTLISTTYPE : uint |
| 128 | + { |
| 129 | + PINNED, |
| 130 | + RECENT, |
| 131 | + FREQUENT, |
| 132 | + } |
| 133 | + |
| 134 | + public enum GETDESTLISTFLAGS : uint |
| 135 | + { |
| 136 | + NONE, |
| 137 | + EXCLUDE_UNNAMED_DESTINATIONS, |
| 138 | + } |
| 139 | +} |
0 commit comments