diff --git a/PInvoke/Shell32/ShObjIdl.IPersistFolder.cs b/PInvoke/Shell32/ShObjIdl.IPersistFolder.cs index 6ba729adb..233e2d3ae 100644 --- a/PInvoke/Shell32/ShObjIdl.IPersistFolder.cs +++ b/PInvoke/Shell32/ShObjIdl.IPersistFolder.cs @@ -1,6 +1,7 @@ using System; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; +using Vanara.InteropServices; using static Vanara.PInvoke.Ole32; namespace Vanara.PInvoke @@ -300,8 +301,8 @@ public interface IPersistFolder3 : IPersistFolder2 new HRESULT GetCurFolder(ref PIDL ppidl); /// - /// Initializes a folder and specifies its location in the namespace. If the folder is a shortcut, this method also specifies - /// the location of the target folder. + /// Initializes a folder and specifies its location in the namespace. If the folder is a shortcut, this method also specifies the + /// location of the target folder. /// /// /// Type: IBindCtx* @@ -315,8 +316,10 @@ public interface IPersistFolder3 : IPersistFolder2 /// /// /// - /// Type: const PERSIST_FOLDER_TARGET_INFO* - /// A pointer to a PERSIST_FOLDER_TARGET_INFO structure that specifies the location of the target folder and its attributes. + /// Type: const * + /// + /// A pointer to a structure that specifies the location of the target folder and its attributes. + /// /// If ppfti points to a valid structure, pidlRoot represents a folder shortcut. /// /// If ppfti is set to NULL, pidlRoot represents a normal folder. In that case, InitializeEx should behave as if @@ -333,7 +336,7 @@ public interface IPersistFolder3 : IPersistFolder2 /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ipersistfolder3-initializeex HRESULT // InitializeEx( IBindCtx *pbc, PCIDLIST_ABSOLUTE pidlRoot, const PERSIST_FOLDER_TARGET_INFO *ppfti ); - void InitializeEx([In] IBindCtx pbc, [In] PIDL pidlRoot, in PERSIST_FOLDER_TARGET_INFO ppfti); + void InitializeEx([In, Optional] IBindCtx pbc, [In] PIDL pidlRoot, [In, Optional] IntPtr ppfti); /// Provides the location and attributes of a folder shortcut's target folder. /// @@ -349,6 +352,36 @@ public interface IPersistFolder3 : IPersistFolder2 PERSIST_FOLDER_TARGET_INFO GetFolderTargetInfo(); } + /// + /// Initializes a folder and specifies its location in the namespace. If the folder is a shortcut, this method also specifies the + /// location of the target folder. + /// + /// The IPersistFolder3 instance. + /// + /// Type: IBindCtx* + /// A pointer to an IBindCtx object that provides the bind context. This parameter can be NULL. + /// + /// + /// Type: LPCITEMIDLIST + /// + /// A pointer to a fully qualified PIDL that specifies the absolute location of a folder or folder shortcut. The calling application + /// is responsible for allocating and freeing this PIDL. + /// + /// + /// + /// A structure that specifies the location of the target folder and its attributes. + /// If ppfti points to a valid structure, pidlRoot represents a folder shortcut. + /// + /// + /// This function is an extended version of IPersistFolder::Initialize. It allows the Shell to initialize folder shortcuts as well as + /// normal folders. + /// + public static void InitializeEx(this IPersistFolder3 pf3, [In, Optional] IBindCtx pbc, [In] PIDL pidlRoot, in PERSIST_FOLDER_TARGET_INFO pfti) + { + using SafeCoTaskMemStruct ppfti = new(pfti); + pf3.InitializeEx(pbc, pidlRoot, ppfti); + } + /// /// Specifies a folder shortcut's target folder and its attributes. This structure is used by IPersistFolder3::GetFolderTargetInfo /// and IPersistFolder3::InitializeEx.