Added new Win10 constants

pull/119/head
dahall 2020-04-23 16:52:31 -06:00
parent 02def4f774
commit c973a8ec77
3 changed files with 301 additions and 150 deletions

View File

@ -1365,6 +1365,15 @@ namespace Vanara.PInvoke
public static PROPERTYKEY Subject public static PROPERTYKEY Subject
=> new PROPERTYKEY(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 3); => new PROPERTYKEY(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 3);
/// <summary>
/// <para>Name: System.SyncTransferStatus -- PKEY_SyncTransferStatus</para>
/// <para>Description:</para>
/// <para>Type: UInt32 -- VT_UI4</para>
/// <para>FormatID: {FCEFF153-E839-4CF3-A9E7-EA22832094B8}, 103</para>
/// </summary>
public static PROPERTYKEY SyncTransferStatus
=> new PROPERTYKEY(new Guid(0xFCEFF153, 0xE839, 0x4CF3, 0xA9, 0xE7, 0xEA, 0x22, 0x83, 0x20, 0x94, 0xB8), 103);
/// <summary> /// <summary>
/// <para>Name: System.ThumbnailCacheId -- PKEY_ThumbnailCacheId</para> /// <para>Name: System.ThumbnailCacheId -- PKEY_ThumbnailCacheId</para>
/// <para> /// <para>

View File

@ -97,9 +97,34 @@ namespace Vanara.PInvoke
/// </summary> /// </summary>
FILE_ATTRIBUTE_NO_SCRUB_DATA = 0x00020000, FILE_ATTRIBUTE_NO_SCRUB_DATA = 0x00020000,
/// <summary>The file attribute ea</summary> /// <summary/>
FILE_ATTRIBUTE_EA = 0x00040000, FILE_ATTRIBUTE_EA = 0x00040000,
/// <summary>Used to prevent the file from being purged from local storage when running low on disk space.</summary>
FILE_ATTRIBUTE_PINNED = 0x00080000,
/// <summary>Indicate that the file is not stored locally.</summary>
FILE_ATTRIBUTE_UNPINNED = 0x00100000,
/// <summary>
/// This attribute only appears in directory enumeration classes (FILE_DIRECTORY_INFORMATION, FILE_BOTH_DIR_INFORMATION, etc.). When
/// this attribute is set, it means that the file or directory has no physical representation on the local system; the item is
/// virtual. Opening the item will be more expensive than normal, e.g. it will cause at least some of it to be fetched from a remote store.
/// </summary>
FILE_ATTRIBUTE_RECALL_ON_OPEN = 0x00040000,
/// <summary>
/// When this attribute is set, it means that the file or directory is not fully present locally. For a file that means that not all
/// of its data is on local storage (e.g. it may be sparse with some data still in remote storage). For a directory it means that
/// some of the directory contents are being virtualized from another location. Reading the file / enumerating the directory will be
/// more expensive than normal, e.g. it will cause at least some of the file/directory content to be fetched from a remote store.
/// Only kernel-mode callers can set this bit.
/// </summary>
FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS = 0x00400000,
/// <summary/>
FILE_ATTRIBUTE_STRICTLY_SEQUENTIAL = 0x20000000,
/// <summary> /// <summary>
/// Write operations will not go through any intermediate cache, they will go directly to disk. /// Write operations will not go through any intermediate cache, they will go directly to disk.
/// <para>For additional information, see the Caching Behavior section of this topic.</para> /// <para>For additional information, see the Caching Behavior section of this topic.</para>

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes; using System.Runtime.InteropServices.ComTypes;
@ -29,8 +28,8 @@ namespace Vanara.PInvoke
public const string STR_AVOID_DRIVE_RESTRICTION_POLICY = "Avoid Drive Restriction Policy"; public const string STR_AVOID_DRIVE_RESTRICTION_POLICY = "Avoid Drive Restriction Policy";
/// <summary> /// <summary>
/// Introduced in Windows Vista. Specify this bind context to cause the IShellFolder::BindToObject method to use the object specified /// Introduced in Windows Vista. Specify this bind context to cause the IShellFolder::BindToObject method to use the object
/// by the pbc parameter to create the target object; in this case, the object specified by the punk parameter in the /// specified by the pbc parameter to create the target object; in this case, the object specified by the punk parameter in the
/// IBindCtx::RegisterObjectParam call must implement the ICreateObject interface. /// IBindCtx::RegisterObjectParam call must implement the ICreateObject interface.
/// <para>Used with IShellFolder::BindToObject or IShellItem::BindToHandler.</para> /// <para>Used with IShellFolder::BindToObject or IShellItem::BindToHandler.</para>
/// </summary> /// </summary>
@ -44,8 +43,8 @@ namespace Vanara.PInvoke
/// of items. /// of items.
/// </para> /// </para>
/// <para> /// <para>
/// If an item doesn't support the enumeration mode (because it isn't a folder or it doesn't provide the enumeration mode) then it is /// If an item doesn't support the enumeration mode (because it isn't a folder or it doesn't provide the enumeration mode) then it
/// created in the default enumeration mode. /// is created in the default enumeration mode.
/// </para> /// </para>
/// </summary> /// </summary>
public const string STR_BIND_FOLDER_ENUM_MODE = "Folder Enum Mode"; public const string STR_BIND_FOLDER_ENUM_MODE = "Folder Enum Mode";
@ -72,8 +71,8 @@ namespace Vanara.PInvoke
public const string STR_BIND_FORCE_FOLDER_SHORTCUT_RESOLVE = "Force Folder Shortcut Resolve"; public const string STR_BIND_FORCE_FOLDER_SHORTCUT_RESOLVE = "Force Folder Shortcut Resolve";
/// <summary> /// <summary>
/// Introduced in Windows XP. Specify this bind context to prevent a call to the IShellFolder::ParseDisplayName method on the Desktop /// Introduced in Windows XP. Specify this bind context to prevent a call to the IShellFolder::ParseDisplayName method on the
/// folder from treating relative paths as relative to the desktop; in such a case, parsing fails when this bind context is specified. /// Desktop folder from treating relative paths as relative to the desktop; in such a case, parsing fails when this bind context is specified.
/// </summary> /// </summary>
public const string STR_DONT_PARSE_RELATIVE = "Don't Parse Relative"; public const string STR_DONT_PARSE_RELATIVE = "Don't Parse Relative";
@ -165,17 +164,18 @@ namespace Vanara.PInvoke
public const string STR_INTERNAL_NAVIGATE = "Internal Navigation"; public const string STR_INTERNAL_NAVIGATE = "Internal Navigation";
/// <summary> /// <summary>
/// Introduced in Windows 7. Specify this bind context with STR_PARSE_PREFER_FOLDER_BROWSING when the client wants the Internet Shell /// Introduced in Windows 7. Specify this bind context with STR_PARSE_PREFER_FOLDER_BROWSING when the client wants the Internet
/// folder handlers to generate an IDList for any valid URL if a DAV-type folder cannot be created for that URL. The URL is not /// Shell folder handlers to generate an IDList for any valid URL if a DAV-type folder cannot be created for that URL. The URL is
/// verified to exist; only its syntax is checked and that it has a registered protocol handler. /// not verified to exist; only its syntax is checked and that it has a registered protocol handler.
/// </summary> /// </summary>
public const string STR_INTERNETFOLDER_PARSE_ONLY_URLMON_BINDABLE = "Validate URL"; public const string STR_INTERNETFOLDER_PARSE_ONLY_URLMON_BINDABLE = "Validate URL";
/// <summary> /// <summary>
/// Introduced in Windows 7. Specify this bind context to instruct implementations of IShellFolder::ParseDisplayName and /// Introduced in Windows 7. Specify this bind context to instruct implementations of IShellFolder::ParseDisplayName and
/// IPersistFolder3::InitializeEx to cache memory-intensive helper objects that can exist across instantiations of Shell items /// IPersistFolder3::InitializeEx to cache memory-intensive helper objects that can exist across instantiations of Shell items
/// instead of recreating these objects each time that a Shell item is created. The associated object is another bind context object, /// instead of recreating these objects each time that a Shell item is created. The associated object is another bind context
/// initially empty. This should result in a separate bind context object, which is accessed through IBindCtx::GetObjectParam or IBindCtx::Register.ObjectParam. /// object, initially empty. This should result in a separate bind context object, which is accessed through
/// IBindCtx::GetObjectParam or IBindCtx::Register.ObjectParam.
/// <para> /// <para>
/// A caller must opt into this behavior by providing this bind context parameter when calling SHCreateItemFromParsingName. By doing /// A caller must opt into this behavior by providing this bind context parameter when calling SHCreateItemFromParsingName. By doing
/// so, you optimize the behavior of binding to multiple parsing names in succession.The lifetime of the bind context object should /// so, you optimize the behavior of binding to multiple parsing names in succession.The lifetime of the bind context object should
@ -185,9 +185,9 @@ namespace Vanara.PInvoke
public const string STR_ITEM_CACHE_CONTEXT = "ItemCacheContext"; public const string STR_ITEM_CACHE_CONTEXT = "ItemCacheContext";
/// <summary> /// <summary>
/// Introduced in Windows Vista. Specify this bind context to allow invalid file name characters to appear in file names. By default, /// Introduced in Windows Vista. Specify this bind context to allow invalid file name characters to appear in file names. By
/// a call to the IShellFolder::ParseDisplayName method rejects characters that are illegal in file names. This bind context is /// default, a call to the IShellFolder::ParseDisplayName method rejects characters that are illegal in file names. This bind
/// meaningful only in conjunction with the STR_FILE_SYS_FIND_DATA bind context. /// context is meaningful only in conjunction with the STR_FILE_SYS_FIND_DATA bind context.
/// </summary> /// </summary>
public const string STR_NO_VALIDATE_FILENAME_CHARS = "NoValidateFilenameChars"; public const string STR_NO_VALIDATE_FILENAME_CHARS = "NoValidateFilenameChars";
@ -202,8 +202,8 @@ namespace Vanara.PInvoke
/// to optimize the behavior of SHCreateItemFromParsingName. /// to optimize the behavior of SHCreateItemFromParsingName.
/// <para> /// <para>
/// Normally, SHCreateItemFromParsingName performs two binding operations on the name to be parsed: one through and one to /// Normally, SHCreateItemFromParsingName performs two binding operations on the name to be parsed: one through and one to
/// IShellFolder::ParseDisplayName and one to create the Shell item.When the STR_PARSE_AND_CREATE_ITEM bind context is supported, the /// IShellFolder::ParseDisplayName and one to create the Shell item.When the STR_PARSE_AND_CREATE_ITEM bind context is supported,
/// second bind is avoided by creating the Shell item during the IShellFolder::ParseDisplayName bind and storing the Shell item /// the second bind is avoided by creating the Shell item during the IShellFolder::ParseDisplayName bind and storing the Shell item
/// through IParseAndCreateItem::SetItem.SHCreateItemFromParsingName then uses the stored Shell item rather than creating one. /// through IParseAndCreateItem::SetItem.SHCreateItemFromParsingName then uses the stored Shell item rather than creating one.
/// </para> /// </para>
/// <para> /// <para>
@ -221,18 +221,18 @@ namespace Vanara.PInvoke
public const string STR_PARSE_DONT_REQUIRE_VALIDATED_URLS = "Do not require validated URLs"; public const string STR_PARSE_DONT_REQUIRE_VALIDATED_URLS = "Do not require validated URLs";
/// <summary> /// <summary>
/// Introduced in Windows 7. The IShellFolder::ParseDisplayName method sets this property to tell the caller that the returned IDList /// Introduced in Windows 7. The IShellFolder::ParseDisplayName method sets this property to tell the caller that the returned
/// was bound to the ProgID specified with STR_PARSE_WITH_EXPLICIT_PROGID or the application specified with /// IDList was bound to the ProgID specified with STR_PARSE_WITH_EXPLICIT_PROGID or the application specified with
/// STR_PARSE_WITH_EXPLICIT_ASSOCAPP. When STR_PARSE_EXPLICIT_ASSOCIATION_SUCCESSFUL is absent, the ProgID or application was not /// STR_PARSE_WITH_EXPLICIT_ASSOCAPP. When STR_PARSE_EXPLICIT_ASSOCIATION_SUCCESSFUL is absent, the ProgID or application was not
/// bound into the IDList. /// bound into the IDList.
/// </summary> /// </summary>
public const string STR_PARSE_EXPLICIT_ASSOCIATION_SUCCESSFUL = "ExplicitAssociationSuccessful"; public const string STR_PARSE_EXPLICIT_ASSOCIATION_SUCCESSFUL = "ExplicitAssociationSuccessful";
/// <summary> /// <summary>
/// Introduced in Windows Vista. Specify this bind context to pass the original item that is being re-parsed when that item is stored /// Introduced in Windows Vista. Specify this bind context to pass the original item that is being re-parsed when that item is
/// as a IShellItem object that also implements the IParentAndItem interface. Before Windows 7 this value was not defined in a header /// stored as a IShellItem object that also implements the IParentAndItem interface. Before Windows 7 this value was not defined in
/// file. It could be defined by the caller or passed as its string value of L"ParseOriginalItem". As of Windows 7, the value is /// a header file. It could be defined by the caller or passed as its string value of L"ParseOriginalItem". As of Windows 7, the
/// defined in Shlobj.h. Note that this is a different header than the other STR constants. /// value is defined in Shlobj.h. Note that this is a different header than the other STR constants.
/// </summary> /// </summary>
public const string STR_PARSE_PARTIAL_IDLIST = "ParseOriginalItem"; public const string STR_PARSE_PARTIAL_IDLIST = "ParseOriginalItem";
@ -297,8 +297,8 @@ namespace Vanara.PInvoke
/// <para> /// <para>
/// DBFolder is a Shell data source that represents items in search results and query-based views.DBFolder retrieves these items by /// DBFolder is a Shell data source that represents items in search results and query-based views.DBFolder retrieves these items by
/// querying the Windows Search system.Items in the search results are identified through a protocol scheme, for example "file:" or /// querying the Windows Search system.Items in the search results are identified through a protocol scheme, for example "file:" or
/// "mapi:". DBFolder provides the behavior for these items by delegating to Shell data sources that are created for these protocols. /// "mapi:". DBFolder provides the behavior for these items by delegating to Shell data sources that are created for these
/// See Developing Protocol Handler Add-ins for more information. /// protocols. See Developing Protocol Handler Add-ins for more information.
/// </para> /// </para>
/// <para> /// <para>
/// When DBFolder delegates its parsing operation to the Shell data sources that support Windows Search protocols, this bind context /// When DBFolder delegates its parsing operation to the Shell data sources that support Windows Search protocols, this bind context
@ -319,8 +319,8 @@ namespace Vanara.PInvoke
/// </item> /// </item>
/// </list> /// </list>
/// <para> /// <para>
/// This bind context can also be used to parse a DBFolder item if a client has a set of properties that define the item.In this case /// This bind context can also be used to parse a DBFolder item if a client has a set of properties that define the item.In this
/// an empty name should be passed to IShellFolder::ParseDisplayName. /// case an empty name should be passed to IShellFolder::ParseDisplayName.
/// </para> /// </para>
/// <para> /// <para>
/// Before Windows 7, this value was not defined in a header file.It could be defined by the caller or passed as its string value: /// Before Windows 7, this value was not defined in a header file.It could be defined by the caller or passed as its string value:
@ -474,8 +474,8 @@ namespace Vanara.PInvoke
/// IApplicationAssociationRegistration interface. /// IApplicationAssociationRegistration interface.
/// </para> /// </para>
/// </summary> /// </summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/ne-shobjidl_core-associationlevel typedef enum ASSOCIATIONLEVEL // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/ne-shobjidl_core-associationlevel typedef enum
// { AL_MACHINE , AL_EFFECTIVE , AL_USER } ; // ASSOCIATIONLEVEL { AL_MACHINE , AL_EFFECTIVE , AL_USER } ;
[PInvokeData("shobjidl_core.h", MSDNShortId = "846ce9f4-092a-420d-be73-0951efc4368f")] [PInvokeData("shobjidl_core.h", MSDNShortId = "846ce9f4-092a-420d-be73-0951efc4368f")]
public enum ASSOCIATIONLEVEL public enum ASSOCIATIONLEVEL
{ {
@ -552,8 +552,8 @@ namespace Vanara.PInvoke
/// would refer to a media file while "editing" can refer to any file being altered in an application. However, the application /// would refer to a media file while "editing" can refer to any file being altered in an application. However, the application
/// itself best knows how to map these terms to its actions. /// itself best knows how to map these terms to its actions.
/// </remarks> /// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/ne-shobjidl_core-file_usage_type // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/ne-shobjidl_core-file_usage_type typedef enum FILE_USAGE_TYPE
// typedef enum FILE_USAGE_TYPE { FUT_PLAYING, FUT_EDITING, FUT_GENERIC } ; // { FUT_PLAYING, FUT_EDITING, FUT_GENERIC } ;
[PInvokeData("shobjidl_core.h", MSDNShortId = "32b0e148-499a-401d-837c-8cea74cf9cac")] [PInvokeData("shobjidl_core.h", MSDNShortId = "32b0e148-499a-401d-837c-8cea74cf9cac")]
public enum FILE_USAGE_TYPE public enum FILE_USAGE_TYPE
{ {
@ -563,7 +563,9 @@ namespace Vanara.PInvoke
/// <summary>The file is being edited by the process that has it open.</summary> /// <summary>The file is being edited by the process that has it open.</summary>
FUT_EDITING, FUT_EDITING,
/// <summary>The file is open in the process for an unspecified action or an action that does not readily fit into the other two categories.</summary> /// <summary>
/// The file is open in the process for an unspecified action or an action that does not readily fit into the other two categories.
/// </summary>
FUT_GENERIC, FUT_GENERIC,
} }
@ -590,6 +592,63 @@ namespace Vanara.PInvoke
OF_CAP_CANCLOSE = 0x0002 OF_CAP_CANCLOSE = 0x0002
} }
/// <summary>Provides operation status flags.</summary>
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-pdopstatus typedef enum PDOPSTATUS {
// PDOPS_RUNNING, PDOPS_PAUSED, PDOPS_CANCELLED, PDOPS_STOPPED, PDOPS_ERRORS } ;
[PInvokeData("shobjidl_core.h", MSDNShortId = "f9fd5cbe-2cb7-4ae7-9cf2-f8545095eec8")]
public enum PDOPSTATUS
{
/// <summary>Operation is running, no user intervention.</summary>
PDOPS_RUNNING = 1,
/// <summary>Operation has been paused by the user.</summary>
PDOPS_PAUSED,
/// <summary>Operation has been canceled by the user - now go undo.</summary>
PDOPS_CANCELLED,
/// <summary>Operation has been stopped by the user - terminate completely.</summary>
PDOPS_STOPPED,
/// <summary>Operation has gone as far as it can go without throwing error dialogs.</summary>
PDOPS_ERRORS,
}
/// <summary>
/// Specifies the states that a placeholder file can have. Retrieve this value through the System.FilePlaceholderStatus
/// (PKEY_FilePlaceholderStatus) property.
/// </summary>
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-placeholder_states typedef enum
// PLACEHOLDER_STATES { PS_NONE, PS_MARKED_FOR_OFFLINE_AVAILABILITY, PS_FULL_PRIMARY_STREAM_AVAILABLE, PS_CREATE_FILE_ACCESSIBLE,
// PS_CLOUDFILE_PLACEHOLDER, PS_DEFAULT, PS_ALL } ;
[PInvokeData("shobjidl_core.h", MSDNShortId = "BF4E0A9F-CD78-4D29-AD0C-7DF14AE88447")]
[Flags]
public enum PLACEHOLDER_STATES
{
/// <summary>None of the other states apply at this time.</summary>
PS_NONE = 0,
/// <summary>May already be or eventually will be available offline.</summary>
PS_MARKED_FOR_OFFLINE_AVAILABILITY = 0x1,
/// <summary>The primary stream has been made fully available.</summary>
PS_FULL_PRIMARY_STREAM_AVAILABLE = 0x2,
/// <summary>
/// The file is accessible through a call to the CreateFile function, without requesting the opening of reparse points.
/// </summary>
PS_CREATE_FILE_ACCESSIBLE = 0x4,
/// <summary/>
PS_CLOUDFILE_PLACEHOLDER = 0x8,
/// <summary/>
PS_DEFAULT = PS_MARKED_FOR_OFFLINE_AVAILABILITY | PS_FULL_PRIMARY_STREAM_AVAILABLE | PS_CREATE_FILE_ACCESSIBLE,
/// <summary>A bitmask value for all valid PLACEHOLDER_STATES flags.</summary>
PS_ALL = PS_MARKED_FOR_OFFLINE_AVAILABILITY | PS_FULL_PRIMARY_STREAM_AVAILABLE | PS_CREATE_FILE_ACCESSIBLE | PS_CLOUDFILE_PLACEHOLDER,
}
/// <summary> /// <summary>
/// Flags that specify the type of path information to retrieve. This parameter can be a combination of the following values. /// Flags that specify the type of path information to retrieve. This parameter can be a combination of the following values.
/// </summary> /// </summary>
@ -651,6 +710,51 @@ namespace Vanara.PInvoke
SVGIO_FLAG_VIEWORDER = 0x80000000, SVGIO_FLAG_VIEWORDER = 0x80000000,
} }
/// <summary>Specifies possible status values used in the System.SyncTransferStatus property.</summary>
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-sync_transfer_status typedef enum
// SYNC_TRANSFER_STATUS { STS_NONE, STS_NEEDSUPLOAD, STS_NEEDSDOWNLOAD, STS_TRANSFERRING, STS_PAUSED, STS_HASERROR,
// STS_FETCHING_METADATA, STS_USER_REQUESTED_REFRESH, STS_HASWARNING, STS_EXCLUDED, STS_INCOMPLETE, STS_PLACEHOLDER_IFEMPTY } ;
[PInvokeData("shobjidl_core.h", MSDNShortId = "B772BF05-0E82-48E6-9A0B-A3C53FBC5F60")]
[Flags]
public enum SYNC_TRANSFER_STATUS : uint
{
/// <summary>There is no current sync activity.</summary>
STS_NONE = 0,
/// <summary>The file is pending upload.</summary>
STS_NEEDSUPLOAD = 0x1,
/// <summary>The file is pending download.</summary>
STS_NEEDSDOWNLOAD = 0x2,
/// <summary>The file is currently being uploaded or downloaded.</summary>
STS_TRANSFERRING = 0x4,
/// <summary>The current transfer is paused.</summary>
STS_PAUSED = 0x8,
/// <summary>An error was encountered during the last sync operation.</summary>
STS_HASERROR = 0x10,
/// <summary>The sync engine is retrieving metadata from the cloud.</summary>
STS_FETCHING_METADATA = 0x20,
/// <summary/>
STS_USER_REQUESTED_REFRESH = 0x40,
/// <summary/>
STS_HASWARNING = 0x80,
/// <summary/>
STS_EXCLUDED = 0x100,
/// <summary/>
STS_INCOMPLETE = 0x200,
/// <summary/>
STS_PLACEHOLDER_IFEMPTY = 0x400
}
/// <summary> /// <summary>
/// <para> /// <para>
/// Exposes methods that query and set default applications for specific file Association Type, and protocols at a specific /// Exposes methods that query and set default applications for specific file Association Type, and protocols at a specific
@ -876,7 +980,8 @@ namespace Vanara.PInvoke
void SetAppID([MarshalAs(UnmanagedType.LPWStr)] string pszAppID); void SetAppID([MarshalAs(UnmanagedType.LPWStr)] string pszAppID);
/// <summary> /// <summary>
/// Retrieve an IEnumObjects or IObjectArray for IShellItems and/or IShellLinks. Items may appear in both the frequent and recent lists. /// Retrieve an IEnumObjects or IObjectArray for IShellItems and/or IShellLinks. Items may appear in both the frequent and
/// recent lists.
/// </summary> /// </summary>
/// <param name="listtype">Which of the known list types to retrieve</param> /// <param name="listtype">Which of the known list types to retrieve</param>
/// <param name="cItemsDesired">The number of items desired.</param> /// <param name="cItemsDesired">The number of items desired.</param>
@ -949,9 +1054,9 @@ namespace Vanara.PInvoke
} }
/// <summary> /// <summary>
/// Exposes a standard set of methods used to enumerate the pointers to item identifier lists (PIDLs) of the items in a Shell folder. /// Exposes a standard set of methods used to enumerate the pointers to item identifier lists (PIDLs) of the items in a Shell
/// When a folder's IShellFolder::EnumObjects method is called, it creates an enumeration object and passes a pointer to the object's /// folder. When a folder's IShellFolder::EnumObjects method is called, it creates an enumeration object and passes a pointer to the
/// IEnumIDList interface back to the calling application. /// object's IEnumIDList interface back to the calling application.
/// </summary> /// </summary>
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("000214F2-0000-0000-C000-000000000046")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("000214F2-0000-0000-C000-000000000046")]
@ -965,8 +1070,8 @@ namespace Vanara.PInvoke
/// <param name="celt">The number of elements in the array referenced by the rgelt parameter.</param> /// <param name="celt">The number of elements in the array referenced by the rgelt parameter.</param>
/// <param name="rgelt"> /// <param name="rgelt">
/// The address of a pointer to an array of ITEMIDLIST pointers that receive the item identifiers. The implementation must /// The address of a pointer to an array of ITEMIDLIST pointers that receive the item identifiers. The implementation must
/// allocate these item identifiers using CoTaskMemAlloc. The calling application is responsible for freeing the item identifiers /// allocate these item identifiers using CoTaskMemAlloc. The calling application is responsible for freeing the item
/// using CoTaskMemFree. /// identifiers using CoTaskMemFree.
/// </param> /// </param>
/// <param name="pceltFetched"> /// <param name="pceltFetched">
/// A pointer to a value that receives a count of the item identifiers actually returned in rgelt. The count can be smaller than /// A pointer to a value that receives a count of the item identifiers actually returned in rgelt. The count can be smaller than
@ -998,27 +1103,6 @@ namespace Vanara.PInvoke
IEnumIDList Clone(); IEnumIDList Clone();
} }
/// <summary>Enumerates the specified <see cref="IEnumIDList"/> instance with an optional fetch size.</summary>
/// <param name="idList">The identifier list to enumerate. If this value is <see langword="null"/>, this will return an empty set.</param>
/// <param name="fetchSize">Size of the block of PIDL instances to fetch with a single call.</param>
/// <returns>A sequence of <see cref="PIDL"/> instances from <paramref name="idList"/>.</returns>
/// <exception cref="ArgumentOutOfRangeException">fetchSize - You must specify a number greater than or equal to 1.</exception>
public static IEnumerable<PIDL> Enumerate(this IEnumIDList idList, int fetchSize = 1)
{
if (fetchSize < 1) throw new ArgumentOutOfRangeException(nameof(fetchSize), "You must specify a number greater than or equal to 1.");
if (idList is null) yield break;
var pidls = new IntPtr[fetchSize];
HRESULT hr;
while ((hr = idList.Next((uint)pidls.Length, pidls, out var cnt)).Succeeded && cnt > 0)
{
for (int i = 0; i < cnt; i++)
yield return new PIDL(pidls[i]);
if (hr == HRESULT.S_FALSE)
yield break;
}
hr.ThrowIfFailed();
}
/// <summary> /// <summary>
/// Exposes methods that can be called to get information on or close a file that is in use by another application. When an /// Exposes methods that can be called to get information on or close a file that is in use by another application. When an
/// application attempts to access a file and finds that file already in use, it can use the methods of this interface to gather /// application attempts to access a file and finds that file already in use, it can use the methods of this interface to gather
@ -1035,10 +1119,10 @@ namespace Vanara.PInvoke
/// <para>The Running Object Table</para> /// <para>The Running Object Table</para>
/// <para> /// <para>
/// When an application opens a file, that application registers the file by inserting the instantiated <c>IFileIsInUse</c> object /// When an application opens a file, that application registers the file by inserting the instantiated <c>IFileIsInUse</c> object
/// into the running object table (ROT). The ROT is a globally accessible lookup table that keeps track of currently running objects. /// into the running object table (ROT). The ROT is a globally accessible lookup table that keeps track of currently running
/// These objects can be identified by a moniker. When a client attempts to bind a moniker to an object, the moniker checks the ROT /// objects. These objects can be identified by a moniker. When a client attempts to bind a moniker to an object, the moniker checks
/// to determine whether the object is already running. This allows the moniker to bind to the current instance rather than loading a /// the ROT to determine whether the object is already running. This allows the moniker to bind to the current instance rather than
/// new instance. /// loading a new instance.
/// </para> /// </para>
/// <para>Perform these steps to add a file to the ROT:</para> /// <para>Perform these steps to add a file to the ROT:</para>
/// <list type="number"> /// <list type="number">
@ -1069,9 +1153,9 @@ namespace Vanara.PInvoke
/// </para> /// </para>
/// <para>When to Implement</para> /// <para>When to Implement</para>
/// <para> /// <para>
/// Applications that open file types that can be opened by other applications should implement <c>IFileIsInUse</c>. An application's /// Applications that open file types that can be opened by other applications should implement <c>IFileIsInUse</c>. An
/// implementation of this interface enables Windows Explorer to discover the source of sharing errors, which enables users to /// application's implementation of this interface enables Windows Explorer to discover the source of sharing errors, which enables
/// address and retry operations that fail due to those errors. /// users to address and retry operations that fail due to those errors.
/// </para> /// </para>
/// <para>When to Use</para> /// <para>When to Use</para>
/// <para> /// <para>
@ -1105,8 +1189,8 @@ namespace Vanara.PInvoke
/// This information can be passed to the user in a dialog box so that the user knows the source of the conflict and can act /// This information can be passed to the user in a dialog box so that the user knows the source of the conflict and can act
/// accordingly. For instance "File.txt is in use by Litware." /// accordingly. For instance "File.txt is in use by Litware."
/// </remarks> /// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifileisinuse-getappname // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifileisinuse-getappname HRESULT
// HRESULT GetAppName( LPWSTR *ppszName ); // GetAppName( LPWSTR *ppszName );
[PreserveSig] [PreserveSig]
HRESULT GetAppName([MarshalAs(UnmanagedType.LPWStr)] out string ppszName); HRESULT GetAppName([MarshalAs(UnmanagedType.LPWStr)] out string ppszName);
@ -1119,19 +1203,20 @@ namespace Vanara.PInvoke
/// <para>Type: <c>HRESULT</c></para> /// <para>Type: <c>HRESULT</c></para>
/// <para>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para> /// <para>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para>
/// </returns> /// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifileisinuse-getusage // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifileisinuse-getusage HRESULT GetUsage(
// HRESULT GetUsage( FILE_USAGE_TYPE *pfut ); // FILE_USAGE_TYPE *pfut );
[PreserveSig] [PreserveSig]
HRESULT GetUsage(out FILE_USAGE_TYPE pfut); HRESULT GetUsage(out FILE_USAGE_TYPE pfut);
/// <summary> /// <summary>
/// Determines whether the file can be closed and whether the UI is capable of switching to the window of the application that is /// Determines whether the file can be closed and whether the UI is capable of switching to the window of the application that
/// using the file. /// is using the file.
/// </summary> /// </summary>
/// <param name="pdwCapFlags"> /// <param name="pdwCapFlags">
/// <para>Type: <c>DWORD*</c></para> /// <para>Type: <c>DWORD*</c></para>
/// <para> /// <para>
/// A pointer to a value that, when this method returns successfully, receives the capability flags. One or both of the following values: /// A pointer to a value that, when this method returns successfully, receives the capability flags. One or both of the
/// following values:
/// </para> /// </para>
/// <para>OF_CAP_CANSWITCHTO (0x0001)</para> /// <para>OF_CAP_CANSWITCHTO (0x0001)</para>
/// <para>0x0001. The UI can switch to the top-level window of the application that is using the file.</para> /// <para>0x0001. The UI can switch to the top-level window of the application that is using the file.</para>
@ -1149,8 +1234,8 @@ namespace Vanara.PInvoke
/// IFileIsInUse::GetSwitchToHWND) so that the user can address the situation as they see fit. If the OF_CAP_CANCLOSE flag is /// IFileIsInUse::GetSwitchToHWND) so that the user can address the situation as they see fit. If the OF_CAP_CANCLOSE flag is
/// retrieved, the dialog box can present a <c>Close</c> button that calls the CloseFile method. /// retrieved, the dialog box can present a <c>Close</c> button that calls the CloseFile method.
/// </remarks> /// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifileisinuse-getcapabilities // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifileisinuse-getcapabilities HRESULT
// HRESULT GetCapabilities( DWORD *pdwCapFlags ); // GetCapabilities( DWORD *pdwCapFlags );
[PreserveSig] [PreserveSig]
HRESULT GetCapabilities(out OF_CAP pdwCapFlags); HRESULT GetCapabilities(out OF_CAP pdwCapFlags);
@ -1164,8 +1249,8 @@ namespace Vanara.PInvoke
/// <para>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para> /// <para>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para>
/// </returns> /// </returns>
/// <remarks>Only files that return the capability flag OF_CAP_CANSWITCHTO can be switched to.</remarks> /// <remarks>Only files that return the capability flag OF_CAP_CANSWITCHTO can be switched to.</remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifileisinuse-getswitchtohwnd // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifileisinuse-getswitchtohwnd HRESULT
// HRESULT GetSwitchToHWND( HWND *phwnd ); // GetSwitchToHWND( HWND *phwnd );
[PreserveSig] [PreserveSig]
HRESULT GetSwitchToHWND(out HWND phwnd); HRESULT GetSwitchToHWND(out HWND phwnd);
@ -1178,8 +1263,7 @@ namespace Vanara.PInvoke
/// Only files that return the capability flag OF_CAP_CANCLOSE can be closed by this method. If that flag is returned, the user /// Only files that return the capability flag OF_CAP_CANCLOSE can be closed by this method. If that flag is returned, the user
/// can be presented with a dialog box that includes a <c>Close</c> option that calls this method. /// can be presented with a dialog box that includes a <c>Close</c> option that calls this method.
/// </remarks> /// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifileisinuse-closefile // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifileisinuse-closefile HRESULT CloseFile( );
// HRESULT CloseFile( );
[PreserveSig] [PreserveSig]
HRESULT CloseFile(); HRESULT CloseFile();
} }
@ -1229,11 +1313,11 @@ namespace Vanara.PInvoke
/// <para>Always returns <c>S_OK</c>.</para> /// <para>Always returns <c>S_OK</c>.</para>
/// </returns> /// </returns>
/// <remarks> /// <remarks>
/// After the client stores the file information, the instance of the object itself must be stored in a bind context by using the /// After the client stores the file information, the instance of the object itself must be stored in a bind context by using
/// IBindCtx::RegisterObjectParam method with the pszKey parameter set to . /// the IBindCtx::RegisterObjectParam method with the pszKey parameter set to .
/// </remarks> /// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifilesystembinddata-setfinddata // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifilesystembinddata-setfinddata HRESULT
// HRESULT SetFindData( const WIN32_FIND_DATAW *pfd ); // SetFindData( const WIN32_FIND_DATAW *pfd );
[PreserveSig] [PreserveSig]
HRESULT SetFindData(in WIN32_FIND_DATA pfd); HRESULT SetFindData(in WIN32_FIND_DATA pfd);
@ -1250,8 +1334,8 @@ namespace Vanara.PInvoke
/// This method provides bind context information to IShellFolder::ParseDisplayName. The client accesses the object by calling /// This method provides bind context information to IShellFolder::ParseDisplayName. The client accesses the object by calling
/// IBindCtx::GetObjectParam with the pszKey parameter set to the string "File System Bind Data". /// IBindCtx::GetObjectParam with the pszKey parameter set to the string "File System Bind Data".
/// </remarks> /// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifilesystembinddata-getfinddata // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifilesystembinddata-getfinddata HRESULT
// HRESULT GetFindData( WIN32_FIND_DATAW *pfd ); // GetFindData( WIN32_FIND_DATAW *pfd );
[PreserveSig] [PreserveSig]
HRESULT GetFindData(out WIN32_FIND_DATA pfd); HRESULT GetFindData(out WIN32_FIND_DATA pfd);
} }
@ -1285,11 +1369,11 @@ namespace Vanara.PInvoke
/// <para>Always returns <c>S_OK</c>.</para> /// <para>Always returns <c>S_OK</c>.</para>
/// </returns> /// </returns>
/// <remarks> /// <remarks>
/// After the client stores the file information, the instance of the object itself must be stored in a bind context by using the /// After the client stores the file information, the instance of the object itself must be stored in a bind context by using
/// IBindCtx::RegisterObjectParam method with the pszKey parameter set to . /// the IBindCtx::RegisterObjectParam method with the pszKey parameter set to .
/// </remarks> /// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifilesystembinddata-setfinddata // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifilesystembinddata-setfinddata HRESULT
// HRESULT SetFindData( const WIN32_FIND_DATAW *pfd ); // SetFindData( const WIN32_FIND_DATAW *pfd );
[PreserveSig] [PreserveSig]
new HRESULT SetFindData(in WIN32_FIND_DATA pfd); new HRESULT SetFindData(in WIN32_FIND_DATA pfd);
@ -1306,8 +1390,8 @@ namespace Vanara.PInvoke
/// This method provides bind context information to IShellFolder::ParseDisplayName. The client accesses the object by calling /// This method provides bind context information to IShellFolder::ParseDisplayName. The client accesses the object by calling
/// IBindCtx::GetObjectParam with the pszKey parameter set to the string "File System Bind Data". /// IBindCtx::GetObjectParam with the pszKey parameter set to the string "File System Bind Data".
/// </remarks> /// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifilesystembinddata-getfinddata // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifilesystembinddata-getfinddata HRESULT
// HRESULT GetFindData( WIN32_FIND_DATAW *pfd ); // GetFindData( WIN32_FIND_DATAW *pfd );
[PreserveSig] [PreserveSig]
new HRESULT GetFindData(out WIN32_FIND_DATA pfd); new HRESULT GetFindData(out WIN32_FIND_DATA pfd);
@ -1323,8 +1407,8 @@ namespace Vanara.PInvoke
/// <para>Type: <c>HRESULT</c></para> /// <para>Type: <c>HRESULT</c></para>
/// <para>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para> /// <para>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para>
/// </returns> /// </returns>
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifilesystembinddata2-setfileid // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifilesystembinddata2-setfileid HRESULT
// HRESULT SetFileID( LARGE_INTEGER liFileID ); // SetFileID( LARGE_INTEGER liFileID );
[PreserveSig] [PreserveSig]
HRESULT SetFileID(long liFileID); HRESULT SetFileID(long liFileID);
@ -1340,8 +1424,8 @@ namespace Vanara.PInvoke
/// <para>Type: <c>HRESULT</c></para> /// <para>Type: <c>HRESULT</c></para>
/// <para>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para> /// <para>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para>
/// </returns> /// </returns>
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifilesystembinddata2-getfileid // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifilesystembinddata2-getfileid HRESULT
// HRESULT GetFileID( LARGE_INTEGER *pliFileID ); // GetFileID( LARGE_INTEGER *pliFileID );
[PreserveSig] [PreserveSig]
HRESULT GetFileID(out long pliFileID); HRESULT GetFileID(out long pliFileID);
@ -1408,6 +1492,27 @@ namespace Vanara.PInvoke
uint GetInfoFlags(); uint GetInfoFlags();
} }
/// <summary>Enumerates the specified <see cref="IEnumIDList"/> instance with an optional fetch size.</summary>
/// <param name="idList">The identifier list to enumerate. If this value is <see langword="null"/>, this will return an empty set.</param>
/// <param name="fetchSize">Size of the block of PIDL instances to fetch with a single call.</param>
/// <returns>A sequence of <see cref="PIDL"/> instances from <paramref name="idList"/>.</returns>
/// <exception cref="ArgumentOutOfRangeException">fetchSize - You must specify a number greater than or equal to 1.</exception>
public static IEnumerable<PIDL> Enumerate(this IEnumIDList idList, int fetchSize = 1)
{
if (fetchSize < 1) throw new ArgumentOutOfRangeException(nameof(fetchSize), "You must specify a number greater than or equal to 1.");
if (idList is null) yield break;
var pidls = new IntPtr[fetchSize];
HRESULT hr;
while ((hr = idList.Next((uint)pidls.Length, pidls, out var cnt)).Succeeded && cnt > 0)
{
for (int i = 0; i < cnt; i++)
yield return new PIDL(pidls[i]);
if (hr == HRESULT.S_FALSE)
yield break;
}
hr.ThrowIfFailed();
}
/// <summary>Retrieves the User Model AppID that has been explicitly set for the current process via SetCurrentProcessExplicitAppUserModelID</summary> /// <summary>Retrieves the User Model AppID that has been explicitly set for the current process via SetCurrentProcessExplicitAppUserModelID</summary>
/// <param name="AppID">The application identifier.</param> /// <param name="AppID">The application identifier.</param>
/// <returns></returns> /// <returns></returns>
@ -1641,10 +1746,12 @@ namespace Vanara.PInvoke
/// <summary>Gets an enumeration interface that provides access to handlers associated with a given protocol.</summary> /// <summary>Gets an enumeration interface that provides access to handlers associated with a given protocol.</summary>
/// <typeparam name="TIntf">The type of the interface to retrieve, typically IID_IEnumAssocHandlers.</typeparam> /// <typeparam name="TIntf">The type of the interface to retrieve, typically IID_IEnumAssocHandlers.</typeparam>
/// <param name="protocol"><para>Type: <c>PCWSTR</c></para> /// <param name="protocol">
/// <para>Pointer to a string that specifies the protocol.</para></param> /// <para>Type: <c>PCWSTR</c></para>
/// <para>Pointer to a string that specifies the protocol.</para>
/// </param>
/// <returns> /// <returns>
/// When this method returns, contains the interface pointer requested in <typeparamref name="TIntf" />. This is typically IEnumAssocHandlers. /// When this method returns, contains the interface pointer requested in <typeparamref name="TIntf"/>. This is typically IEnumAssocHandlers.
/// </returns> /// </returns>
/// <remarks> /// <remarks>
/// It is recommended that you use the <c>IID_PPV_ARGS</c> macro, defined in Objbase.h, to package the and parameters. This macro /// It is recommended that you use the <c>IID_PPV_ARGS</c> macro, defined in Objbase.h, to package the and parameters. This macro
@ -1657,10 +1764,14 @@ namespace Vanara.PInvoke
/// <summary> /// <summary>
/// Creates an IApplicationAssociationRegistration object based on the stock implementation of the interface provided by Windows. /// Creates an IApplicationAssociationRegistration object based on the stock implementation of the interface provided by Windows.
/// </summary> /// </summary>
/// <param name="riid"><para>Type: <c>REFIID</c></para> /// <param name="riid">
/// <para>A reference to the IID of the requested interface.</para></param> /// <para>Type: <c>REFIID</c></para>
/// <param name="ppv"><para>Type: <c>void**</c></para> /// <para>A reference to the IID of the requested interface.</para>
/// <para>When this function returns, contains the address of a pointer to the IApplicationAssociationRegistration object.</para></param> /// </param>
/// <param name="ppv">
/// <para>Type: <c>void**</c></para>
/// <para>When this function returns, contains the address of a pointer to the IApplicationAssociationRegistration object.</para>
/// </param>
/// <returns> /// <returns>
/// <para>Type: <c>HRESULT</c></para> /// <para>Type: <c>HRESULT</c></para>
/// <para>If this function succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para> /// <para>If this function succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para>
@ -1674,9 +1785,7 @@ namespace Vanara.PInvoke
/// <summary> /// <summary>
/// Creates an IApplicationAssociationRegistration object based on the stock implementation of the interface provided by Windows. /// Creates an IApplicationAssociationRegistration object based on the stock implementation of the interface provided by Windows.
/// </summary> /// </summary>
/// <returns> /// <returns>When this function returns, contains the address of a pointer to the IApplicationAssociationRegistration object.</returns>
/// When this function returns, contains the address of a pointer to the IApplicationAssociationRegistration object.
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-shcreateassociationregistration SHSTDAPI // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-shcreateassociationregistration SHSTDAPI
// SHCreateAssociationRegistration( REFIID riid, void **ppv ); // SHCreateAssociationRegistration( REFIID riid, void **ppv );
[PInvokeData("shobjidl_core.h", MSDNShortId = "7998f49d-2515-4c77-991e-62c0fefa43df")] [PInvokeData("shobjidl_core.h", MSDNShortId = "7998f49d-2515-4c77-991e-62c0fefa43df")]
@ -1728,10 +1837,10 @@ namespace Vanara.PInvoke
/// <remarks> /// <remarks>
/// <para> /// <para>
/// The list of properties to set a default value comes from the <c>SetDefaultsFor</c> registry entry under the ProgID for the file /// The list of properties to set a default value comes from the <c>SetDefaultsFor</c> registry entry under the ProgID for the file
/// association of the item. The list is prefixed by and contains the canonical names of the properties to set the default value, for /// association of the item. The list is prefixed by and contains the canonical names of the properties to set the default value,
/// example, . The possible properties for this list are System.Author, System.Document.DateCreated, and System.Photo.DateTaken. If /// for example, . The possible properties for this list are System.Author, System.Document.DateCreated, and System.Photo.DateTaken.
/// the <c>SetDefaultsFor</c> entry does not exist on the ProgID, this function uses the default found on the <c>SetDefaultsFor</c> /// If the <c>SetDefaultsFor</c> entry does not exist on the ProgID, this function uses the default found on the
/// entry of <c>HKEY_CLASSES_ROOT</c>&lt;b&gt;*. /// <c>SetDefaultsFor</c> entry of <c>HKEY_CLASSES_ROOT</c>&lt;b&gt;*.
/// </para> /// </para>
/// </remarks> /// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl/nf-shobjidl-shcreatedefaultpropertiesop SHSTDAPI // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl/nf-shobjidl-shcreatedefaultpropertiesop SHSTDAPI
@ -1760,9 +1869,7 @@ namespace Vanara.PInvoke
/// </summary> /// </summary>
/// <typeparam name="TIntf">The type of the requested interface. This will typically be IShellItem or IShellItem2.</typeparam> /// <typeparam name="TIntf">The type of the requested interface. This will typically be IShellItem or IShellItem2.</typeparam>
/// <param name="pidl">The source PIDL.</param> /// <param name="pidl">The source PIDL.</param>
/// <returns> /// <returns>When this function returns, contains the interface pointer requested.</returns>
/// When this function returns, contains the interface pointer requested.
/// </returns>
[PInvokeData("Shobjidl.h", MSDNShortId = "bb762133")] [PInvokeData("Shobjidl.h", MSDNShortId = "bb762133")]
public static TIntf SHCreateItemFromIDList<TIntf>(PIDL pidl) where TIntf : class => public static TIntf SHCreateItemFromIDList<TIntf>(PIDL pidl) where TIntf : class =>
IidGetObj<TIntf>((in Guid g, out object o) => SHCreateItemFromIDList(pidl, g, out o)); IidGetObj<TIntf>((in Guid g, out object o) => SHCreateItemFromIDList(pidl, g, out o));
@ -1808,7 +1915,8 @@ namespace Vanara.PInvoke
/// <para>If no data is being passed to or received from the parsing function, this value can be NULL.</para> /// <para>If no data is being passed to or received from the parsing function, this value can be NULL.</para>
/// </param> /// </param>
/// <returns> /// <returns>
/// When this method returns successfully, contains the interface pointer requested in <typeparamref name="T"/>. This is typically IShellItem or IShellItem2. /// When this method returns successfully, contains the interface pointer requested in <typeparamref name="T"/>. This is typically
/// IShellItem or IShellItem2.
/// </returns> /// </returns>
[PInvokeData("Shlobjidl.h", MSDNShortId = "bb762134")] [PInvokeData("Shlobjidl.h", MSDNShortId = "bb762134")]
public static T SHCreateItemFromParsingName<T>(string pszPath, IBindCtx pbc = null) where T : class => public static T SHCreateItemFromParsingName<T>(string pszPath, IBindCtx pbc = null) where T : class =>
@ -1851,8 +1959,8 @@ namespace Vanara.PInvoke
/// Flags that specify special options in the object retrieval. This value can be 0; otherwise, one or more of the KNOWN_FOLDER_FLAG values. /// Flags that specify special options in the object retrieval. This value can be 0; otherwise, one or more of the KNOWN_FOLDER_FLAG values.
/// </param> /// </param>
/// <param name="pszItem"> /// <param name="pszItem">
/// A pointer to a null-terminated buffer that contains the file name of the new item as a Unicode string. This parameter can also be /// A pointer to a null-terminated buffer that contains the file name of the new item as a Unicode string. This parameter can also
/// NULL. In this case, an IShellItem that represents the known folder itself is created. /// be NULL. In this case, an IShellItem that represents the known folder itself is created.
/// </param> /// </param>
/// <param name="riid">A reference to an interface ID.</param> /// <param name="riid">A reference to an interface ID.</param>
/// <param name="ppv"> /// <param name="ppv">
@ -1871,8 +1979,8 @@ namespace Vanara.PInvoke
/// Flags that specify special options in the object retrieval. This value can be 0; otherwise, one or more of the KNOWN_FOLDER_FLAG values. /// Flags that specify special options in the object retrieval. This value can be 0; otherwise, one or more of the KNOWN_FOLDER_FLAG values.
/// </param> /// </param>
/// <param name="pszItem"> /// <param name="pszItem">
/// A pointer to a null-terminated buffer that contains the file name of the new item as a Unicode string. This parameter can also be /// A pointer to a null-terminated buffer that contains the file name of the new item as a Unicode string. This parameter can also
/// NULL. In this case, an IShellItem that represents the known folder itself is created. /// be NULL. In this case, an IShellItem that represents the known folder itself is created.
/// </param> /// </param>
/// <returns> /// <returns>
/// When this function returns, contains the interface pointer requested in riid. This will usually be IShellItem or IShellItem2. /// When this function returns, contains the interface pointer requested in riid. This will usually be IShellItem or IShellItem2.
@ -1934,15 +2042,15 @@ namespace Vanara.PInvoke
/// <param name="pidlParent"> /// <param name="pidlParent">
/// <para>Type: <c>PCIDLIST_ABSOLUTE</c></para> /// <para>Type: <c>PCIDLIST_ABSOLUTE</c></para>
/// <para> /// <para>
/// The ID list of the parent folder of the items specified in ppidl. If psf is specified, this parameter can be <c>NULL</c>. If this /// The ID list of the parent folder of the items specified in ppidl. If psf is specified, this parameter can be <c>NULL</c>. If
/// pidlParent is not specified, it is computed from the psf parameter using IPersistFolder2. /// this pidlParent is not specified, it is computed from the psf parameter using IPersistFolder2.
/// </para> /// </para>
/// </param> /// </param>
/// <param name="psf"> /// <param name="psf">
/// <para>Type: <c>IShellFolder*</c></para> /// <para>Type: <c>IShellFolder*</c></para>
/// <para> /// <para>
/// The Shell data source object that is the parent of the child items specified in ppidl. If pidlParent is specified, this parameter /// The Shell data source object that is the parent of the child items specified in ppidl. If pidlParent is specified, this
/// can be <c>NULL</c>. /// parameter can be <c>NULL</c>.
/// </para> /// </para>
/// </param> /// </param>
/// <param name="cidl"> /// <param name="cidl">
@ -1961,8 +2069,9 @@ namespace Vanara.PInvoke
/// <para>Type: <c>HRESULT</c></para> /// <para>Type: <c>HRESULT</c></para>
/// <para>If this function succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para> /// <para>If this function succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para>
/// </returns> /// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-shcreateshellitemarray // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-shcreateshellitemarray SHSTDAPI
// SHSTDAPI SHCreateShellItemArray( PCIDLIST_ABSOLUTE pidlParent, IShellFolder *psf, UINT cidl, PCUITEMID_CHILD_ARRAY ppidl, IShellItemArray **ppsiItemArray ); // SHCreateShellItemArray( PCIDLIST_ABSOLUTE pidlParent, IShellFolder *psf, UINT cidl, PCUITEMID_CHILD_ARRAY ppidl, IShellItemArray
// **ppsiItemArray );
[DllImport(Lib.Shell32, SetLastError = false, ExactSpelling = true)] [DllImport(Lib.Shell32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("shobjidl_core.h", MSDNShortId = "024ccbc7-97f1-4cb5-8588-9c9b1f747336")] [PInvokeData("shobjidl_core.h", MSDNShortId = "024ccbc7-97f1-4cb5-8588-9c9b1f747336")]
public static extern HRESULT SHCreateShellItemArray([In, Optional] PIDL pidlParent, [In, MarshalAs(UnmanagedType.Interface), Optional] IShellFolder psf, public static extern HRESULT SHCreateShellItemArray([In, Optional] PIDL pidlParent, [In, MarshalAs(UnmanagedType.Interface), Optional] IShellFolder psf,
@ -1994,12 +2103,12 @@ namespace Vanara.PInvoke
/// </para> /// </para>
/// <para> /// <para>
/// This API lets you convert the data object into a Shell item that the handler can consume. It is recommend that handlers use a /// This API lets you convert the data object into a Shell item that the handler can consume. It is recommend that handlers use a
/// Shell item array rather than clipboard formats like <c>CF_HDROP</c> and <c>CFSTR_SHELLIDLIST</c> (also known as HIDA) as it leads /// Shell item array rather than clipboard formats like <c>CF_HDROP</c> and <c>CFSTR_SHELLIDLIST</c> (also known as HIDA) as it
/// to simpler code and allows some performance improvements. /// leads to simpler code and allows some performance improvements.
/// </para> /// </para>
/// <para> /// <para>
/// The resulting shell item array holds a reference to the source data object. Therefore, that data object must remain valid for the /// The resulting shell item array holds a reference to the source data object. Therefore, that data object must remain valid for
/// lifetime of the shell item array. Notably, the data objects passed to IDropTarget methods are no longer valid after the drop /// the lifetime of the shell item array. Notably, the data objects passed to IDropTarget methods are no longer valid after the drop
/// operation completes. /// operation completes.
/// </para> /// </para>
/// </remarks> /// </remarks>
@ -2010,11 +2119,11 @@ namespace Vanara.PInvoke
public static extern HRESULT SHCreateShellItemArrayFromDataObject(IDataObject pdo, in Guid riid, out IShellItemArray ppv); public static extern HRESULT SHCreateShellItemArrayFromDataObject(IDataObject pdo, in Guid riid, out IShellItemArray ppv);
/// <summary>Creates a Shell item array object from a data object.</summary> /// <summary>Creates a Shell item array object from a data object.</summary>
/// <param name="pdo"><para>Type: <c>IDataObject*</c></para> /// <param name="pdo">
/// <para>A pointer to IDataObject interface.</para></param> /// <para>Type: <c>IDataObject*</c></para>
/// <returns> /// <para>A pointer to IDataObject interface.</para>
/// When this method returns, contains the interface pointer requested. This is typically IShellItemArray. /// </param>
/// </returns> /// <returns>When this method returns, contains the interface pointer requested. This is typically IShellItemArray.</returns>
/// <remarks> /// <remarks>
/// <para> /// <para>
/// This function is useful for Shell extensions that implement IShellExtInit and are passed a data object to the /// This function is useful for Shell extensions that implement IShellExtInit and are passed a data object to the
@ -2022,12 +2131,12 @@ namespace Vanara.PInvoke
/// </para> /// </para>
/// <para> /// <para>
/// This API lets you convert the data object into a Shell item that the handler can consume. It is recommend that handlers use a /// This API lets you convert the data object into a Shell item that the handler can consume. It is recommend that handlers use a
/// Shell item array rather than clipboard formats like <c>CF_HDROP</c> and <c>CFSTR_SHELLIDLIST</c> (also known as HIDA) as it leads /// Shell item array rather than clipboard formats like <c>CF_HDROP</c> and <c>CFSTR_SHELLIDLIST</c> (also known as HIDA) as it
/// to simpler code and allows some performance improvements. /// leads to simpler code and allows some performance improvements.
/// </para> /// </para>
/// <para> /// <para>
/// The resulting shell item array holds a reference to the source data object. Therefore, that data object must remain valid for the /// The resulting shell item array holds a reference to the source data object. Therefore, that data object must remain valid for
/// lifetime of the shell item array. Notably, the data objects passed to IDropTarget methods are no longer valid after the drop /// the lifetime of the shell item array. Notably, the data objects passed to IDropTarget methods are no longer valid after the drop
/// operation completes. /// operation completes.
/// </para> /// </para>
/// </remarks> /// </remarks>
@ -2116,12 +2225,16 @@ namespace Vanara.PInvoke
/// <summary>Creates an IShellItem or related object based on an item specified by an IDataObject.</summary> /// <summary>Creates an IShellItem or related object based on an item specified by an IDataObject.</summary>
/// <typeparam name="TIntf">The type of the requested interface. This will typically be IShellItem or IShellItem2.</typeparam> /// <typeparam name="TIntf">The type of the requested interface. This will typically be IShellItem or IShellItem2.</typeparam>
/// <param name="pdtobj"><para>Type: <c>IDataObject*</c></para> /// <param name="pdtobj">
/// <para>A pointer to the source IDataObject instance.</para></param> /// <para>Type: <c>IDataObject*</c></para>
/// <param name="dwFlags"><para>Type: <c>DATAOBJ_GET_ITEM_FLAGS</c></para> /// <para>A pointer to the source IDataObject instance.</para>
/// </param>
/// <param name="dwFlags">
/// <para>Type: <c>DATAOBJ_GET_ITEM_FLAGS</c></para>
/// <para> /// <para>
/// One or more values from the DATAOBJ_GET_ITEM_FLAGS enumeration to specify options regarding the target object. This value can be 0. /// One or more values from the DATAOBJ_GET_ITEM_FLAGS enumeration to specify options regarding the target object. This value can be 0.
/// </para></param> /// </para>
/// </param>
/// <returns>When this method returns, contains the interface pointer requested. This is typically IShellItem.</returns> /// <returns>When this method returns, contains the interface pointer requested. This is typically IShellItem.</returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-shgetitemfromdataobject HRESULT // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-shgetitemfromdataobject HRESULT
// SHGetItemFromDataObject( IDataObject *pdtobj, DATAOBJ_GET_ITEM_FLAGS dwFlags, REFIID riid, void **ppv ); // SHGetItemFromDataObject( IDataObject *pdtobj, DATAOBJ_GET_ITEM_FLAGS dwFlags, REFIID riid, void **ppv );
@ -2162,11 +2275,11 @@ namespace Vanara.PInvoke
/// <summary>Retrieves an IShellItem for an object.</summary> /// <summary>Retrieves an IShellItem for an object.</summary>
/// <typeparam name="TIntf">The type of the requested interface. This is typically IShellItem or a related interface.</typeparam> /// <typeparam name="TIntf">The type of the requested interface. This is typically IShellItem or a related interface.</typeparam>
/// <param name="punk"><para>Type: <c>IUnknown*</c></para> /// <param name="punk">
/// <para>A pointer to the IUnknown of the object.</para></param> /// <para>Type: <c>IUnknown*</c></para>
/// <returns> /// <para>A pointer to the IUnknown of the object.</para>
/// When this method returns, contains the interface pointer requested. This is typically IShellItem or a related interface. /// </param>
/// </returns> /// <returns>When this method returns, contains the interface pointer requested. This is typically IShellItem or a related interface.</returns>
/// <remarks> /// <remarks>
/// From the standpoint of performance, this method is preferred to SHGetIDListFromObject in those cases where the IDList is already /// From the standpoint of performance, this method is preferred to SHGetIDListFromObject in those cases where the IDList is already
/// bound to a folder. /// bound to a folder.
@ -2211,10 +2324,14 @@ namespace Vanara.PInvoke
/// Retrieves an object that supports IPropertyStore or related interfaces from a pointer to an item identifier list (PIDL). /// Retrieves an object that supports IPropertyStore or related interfaces from a pointer to an item identifier list (PIDL).
/// </summary> /// </summary>
/// <typeparam name="TIntf">The type of the requested interface. This is typically IPropertyStore or a related interface.</typeparam> /// <typeparam name="TIntf">The type of the requested interface. This is typically IPropertyStore or a related interface.</typeparam>
/// <param name="pidl"><para>Type: <c>PCIDLIST_ABSOLUTE</c></para> /// <param name="pidl">
/// <para>A pointer to an item ID list.</para></param> /// <para>Type: <c>PCIDLIST_ABSOLUTE</c></para>
/// <param name="flags"><para>Type: <c>GETPROPERTYSTOREFLAGS</c></para> /// <para>A pointer to an item ID list.</para>
/// <para>One or more values from the GETPROPERTYSTOREFLAGS constants. This parameter can also be <c>NULL</c>.</para></param> /// </param>
/// <param name="flags">
/// <para>Type: <c>GETPROPERTYSTOREFLAGS</c></para>
/// <para>One or more values from the GETPROPERTYSTOREFLAGS constants. This parameter can also be <c>NULL</c>.</para>
/// </param>
/// <returns> /// <returns>
/// When this function returns, contains the interface pointer requested. This is typically IPropertyStore or a related interface. /// When this function returns, contains the interface pointer requested. This is typically IPropertyStore or a related interface.
/// </returns> /// </returns>