using System; using System.Runtime.InteropServices; using System.Text; using static Vanara.PInvoke.PropSys; namespace Vanara.PInvoke { public static partial class Shell32 { /// The transfer state. One of the following values. [PInvokeData("shobjidl_core.h", MSDNShortId = "NF:shobjidl_core.ITransferAdviseSink.UpdateTransferState")] [Flags] public enum TRANSFER_ADVISE_STATE { /// No transfer is in progress. TS_NONE = 0x00000000, /// The transfer is being performed. TS_PERFORMING = 0x00000001, /// The transfer is preparing to begin. For example, this flag would be set when space requirements are being calculated. TS_PREPARING = 0x00000002, /// Length of the transfer is unknown. TS_INDETERMINATE = 0x00000004, } /// Exposes methods supporting status collection and failure information. // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-itransferadvisesink [ComImport, Guid("d594d0d8-8da7-457b-b3b4-ce5dbaac0b88"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITransferAdviseSink { /// Updates the transfer progress status in the UI. /// /// Type: ULONGLONG /// The number of bytes processed in the current operation. /// /// /// Type: ULONGLONG /// The total number of bytes in the current operation. /// /// /// Type: int /// The number of files processed in the current operation. /// /// /// Type: int /// /// The total number of files in the operation. Set to 0 to indicate that the value has not changed since the last call to this method. /// /// /// /// Type: int /// The number of folders processed in the current operation. /// /// /// Type: int /// /// The total number of folders in the operation. Set to 0 to indicate that the value has not changed since the last call to /// this method. /// /// /// /// /// Set ullSizeTotal, nFilesTotal, and nFoldersTotal all to 0 to indicate that the totals have not changed since the last call /// to this method. /// /// Set all six parameters to 0 to indicate that progress has not changed since the last call to this method. /// Note to Implementers /// /// Implementers of this function should return an erorr code when the operation needs to terminate before it is complete, such /// as when the user clicks the Cancel button. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransferadvisesink-updateprogress HRESULT // UpdateProgress( ULONGLONG ullSizeCurrent, ULONGLONG ullSizeTotal, int nFilesCurrent, int nFilesTotal, int nFoldersCurrent, // int nFoldersTotal ); [PreserveSig] HRESULT UpdateProgress(ulong ullSizeCurrent, ulong ullSizeTotal, int nFilesCurrent, int nFilesTotal, int nFoldersCurrent, int nFoldersTotal); /// Updates the transfer state. /// /// Type: TRANSFER_ADVISE_STATE /// The transfer state. One of the following values. /// TS_NONE (0x00000000) /// 0x00000000. No transfer is in progress. /// TS_PERFORMING (0x00000001) /// 0x00000001. The transfer is being performed. /// TS_PREPARING (0x00000002) /// /// 0x00000002. The transfer is preparing to begin. For example, this flag would be set when space requirements are being calculated. /// /// TS_INDETERMINATE (0x00000004) /// 0x00000004. Length of the transfer is unknown. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransferadvisesink-updatetransferstate // HRESULT UpdateTransferState( TRANSFER_ADVISE_STATE ts ); [PreserveSig] HRESULT UpdateTransferState(TRANSFER_ADVISE_STATE ts); /// Displays a message to the user confirming that overwriting existing items is acceptable. /// /// Type: IShellItem* /// A pointer to the source IShellItem . /// /// /// Type: IShellItem* /// A pointer to the destination parent folder IShellItem. /// /// /// Type: LPCWSTR /// /// A pointer to a wide-string containing the desired name of the item at the destination. If NULL, the name is the same /// as the Shell item pointed to by psiSource. /// /// /// /// Type: HRESULT /// /// The return values listed below are emitted specifically by this method to inform the calling process of how the operation /// ended. If other results or errors are emitted during the operation of this method, they should be returned to the calling process. /// /// /// /// Return code /// Description /// /// /// COPYENGINE_S_USER_IGNORED /// The user clicked Ignore. Allows the calling process to continue processing other files as appropriate. /// /// /// COPYENGINE_E_USER_CANCELLED /// The user clicked Cancel. Stops processing of the current document and ends the current process. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransferadvisesink-confirmoverwrite // HRESULT ConfirmOverwrite( IShellItem *psiSource, IShellItem *psiDestParent, LPCWSTR pszName ); [PreserveSig] HRESULT ConfirmOverwrite(IShellItem psiSource, IShellItem psiDestParent, [MarshalAs(UnmanagedType.LPWStr)] string pszName); /// Displays a message to the user confirming that loss of encryption is acceptable for this operation. /// /// Type: IShellItem* /// A pointer to an IShellItem of the file in which encryption information will be lost. /// /// /// Type: HRESULT /// Returns one of the following specific Shell codes, or a system error code. /// /// /// Return code /// Description /// /// /// COPYENGINE_S_YES /// User responded "Yes" to the dialog. Copy continues without encryption. /// /// /// COPYENGINE_S_USER_IGNORED /// User responded "No" to the dialog. /// /// /// COPYENGINE_S_PENDING /// Error has been queued and will display later. Operation on this file will be skipped. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransferadvisesink-confirmencryptionloss // HRESULT ConfirmEncryptionLoss( IShellItem *psiSource ); [PreserveSig] HRESULT ConfirmEncryptionLoss(IShellItem psiSource); /// Called when there is a failure and user interaction is needed. /// /// Type: IShellItem* /// The IShellItem on which the operation failed. /// /// /// Type: LPCWSTR /// /// Optional. A pointer to a null-terminated buffer that contains the name of the file. If this value is NULL, the name /// given by the psi parameter is used. /// /// /// /// Type: HRESULT /// The error code generated by the failure. This error must be handled by the copy engine. /// /// /// Type: LPWSTR /// /// Optional. When this method returns, contains a pointer to a null-terminated buffer that contains a new name for the file. /// The name cannot exceed length cchRename. If this parameter is NULL, no option to rename will be available. /// /// /// /// Type: ULONG /// The size of the pszRenamebuffer, in characters. /// /// /// Type: HRESULT /// /// Any other HRESULT should be returned to the calling process. If the failure is not handled, the return value should /// be hrError. /// /// /// /// Return code /// Description /// /// /// COPYENGINE_S_USER_RETRY /// The user clicked Retry. The handler should retry the file operation. /// /// /// COPYENGINE_E_USERCANCELLED /// /// The user clicked Cancel. The entire copy job is being terminated. The handler should return this code back to the copy engine. /// /// /// /// COPYENGINE_S_USER_IGNORED /// The user clicked Ignore. The handler should skip creating the item and return this code back to the copy engine. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransferadvisesink-filefailure HRESULT // FileFailure( IShellItem *psi, LPCWSTR pszItem, HRESULT hrError, LPWSTR pszRename, ULONG cchRename ); [PreserveSig] HRESULT FileFailure(IShellItem psi, [MarshalAs(UnmanagedType.LPWStr)] string pszItem, HRESULT hrError, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszRename, uint cchRename); /// Called when there is a failure that involves secondary streams and user interaction is needed. /// /// Type: IShellItem* /// A pointer to the IShellItem that caused the failure. /// /// /// Type: LPCWSTR /// The name of the data that will be lost in the operation. /// /// /// Type: HRESULT /// The error code that was generated. It must be handled by the copy engine. /// /// /// Type: HRESULT /// Any other HRESULT should be passed up. If the failure is not handled, the return value should be hrError. /// /// /// Return code /// Description /// /// /// COPYENGINE_S_USERRETRY /// The handler should retry the file operation. /// /// /// COPYENGINE_S_USERRETRYWITHNEWNAME /// The handler should retry the file operation using the name returned in the pszRename buffer. /// /// /// COPYENGINE_S_OVERWRITE /// The user has indicated that the handler should overwrite the existing file. /// /// /// COPYENGINE_S_RETRYWITHOUTSECURITY /// The user has indicated that the handler should try the operation again without the security descriptor. /// /// /// COPYENGINE_E_USERCANCELLED /// /// The user clicked Cancel. The entire copy job is being terminated. The handler should return this code back to the copy engine. /// /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransferadvisesink-substreamfailure // HRESULT SubStreamFailure( IShellItem *psi, LPCWSTR pszStreamName, HRESULT hrError ); [PreserveSig] HRESULT SubStreamFailure(IShellItem psi, [MarshalAs(UnmanagedType.LPWStr)] string pszStreamName, HRESULT hrError); /// Called when there is a failure that involves file properties and user interaction is needed. /// /// Type: IShellItem* /// A pointer to the IShellItem that caused the failure. /// /// /// Type: const PROPERTYKEY* /// /// A value that corresponds to the property that will be lost. A NULL value indicates that all properties were lost. /// /// /// /// Type: HRESULT /// The error code generated by the failure. It must be handled by the copy engine. /// /// /// Type: HRESULT /// Any other HRESULT should be passed up. If the failure is not handled, the return value should be hrError. /// /// /// Return code /// Description /// /// /// COPYENGINE_S_USERRETRY /// The handler should retry the file operation. /// /// /// COPYENGINE_S_USERRETRYWITHNEWNAME /// The handler should retry the file operation using the name returned in the pszRename buffer. /// /// /// COPYENGINE_S_OVERWRITE /// The user has indicated that the handler should overwrite the existing file. /// /// /// COPYENGINE_S_RETRYWITHOUTSECURITY /// The user has indicated that the handler should try the operation again without the security descriptor. /// /// /// COPYENGINE_E_USERCANCELLED /// /// The user clicked Cancel. The entire copy job is being terminated. The handler should return this code back to the copy engine. /// /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransferadvisesink-propertyfailure HRESULT // PropertyFailure( IShellItem *psi, const PROPERTYKEY *pkey, HRESULT hrError ); [PreserveSig] HRESULT PropertyFailure(IShellItem psi, [In, Optional] IntPtr pkey, HRESULT hrError); } /// /// Exposes methods that create a destination Shell item for a copy or move operation. This interface is provided to allow more /// control over file operations by providing an ITransferDestination::Advise method. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-itransferdestination [PInvokeData("shobjidl_core.h", MSDNShortId = "NN:shobjidl_core.ITransferDestination")] [ComImport, Guid("48addd32-3ca5-4124-abe3-b5a72531b207"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITransferDestination { /// Sets up an advisory connection for notifications on the status of file operations. /// /// Type: ITransferAdviseSink* /// /// A pointer to an ITransferAdviseSink notification interface to update the calling application using methods on this interface. /// /// /// /// Type: DWORD* /// /// A pointer to a returned token that uniquely identifies this connection. The calling application uses this token later to /// delete the connection by passing it to the ITransferDestination::Unadvise method. If the connection is not successfully /// established, this value is zero. /// /// /// /// Type: HRESULT /// Any HRESULTs other than listed indicate a failure. /// /// /// Return code /// Description /// /// /// S_OK /// The Interface successfully associated. /// /// /// E_UNEXPECTED /// The handler can only handle one sink interface. /// /// /// /// /// Call ITransferDestination::Advise before calling any other ITransferDestination methods so the handler can callback /// for any errors that might occur. If not set, the handler should consider it an indication that no feedback is available and /// do the "default" operation. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransferdestination-advise HRESULT Advise( // ITransferAdviseSink *psink, DWORD *pdwCookie ); [PreserveSig] HRESULT Advise([In] ITransferAdviseSink psink, out uint pdwCookie); /// Terminates an advisory connection. /// /// Type: DWORD /// A connection token previously returned from ITransferDestination::Advise. Identifies the connection to be terminated. /// /// /// Type: HRESULT /// Any HRESULTs other than those listed here indicate a failure. /// /// /// Return code /// Description /// /// /// S_OK /// The connection was successfully terminated. /// /// /// CONNECT_E_NOCONNECTION /// The value in dwCookie does not represent a valid connection. /// /// /// /// Terminates an advisory connection previously established through the ITransferDestination::Advise method. // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransferdestination-unadvise HRESULT // Unadvise( DWORD dwCookie ); [PreserveSig] HRESULT Unadvise(uint dwCookie); /// Creates the specified file. /// /// Type: LPCWSTR /// A pointer to a null-terminated buffer that contains the name of the file relative to the current directory. /// /// /// Type: DWORD /// /// One or more of the FILE_ATTRIBUTE flags defined in the BY_HANDLE_FILE_INFORMATION structure. The most significant value is /// FILE_ATTRIBUTE_DIRECTORY, which indicates that a folder should be created. /// /// /// /// Type: ULONGLONG /// The size, in bytes, of the file to create. This value can be 0 if the size is unknown. /// /// /// Type: TRANSFER_SOURCE_FLAGS /// Flags that control the file operation. One or more of the TRANSFER_SOURCE_FLAGS flags. /// /// /// Type: REFIID /// /// A reference to the IID of the interface to retrieve through ppvItem, typically IID_IShellItem or another interface that /// derives from it. /// /// /// /// Type: void** /// /// When this method returns, contains the interface pointer requested in riidItem. This is typically IShellItem or a derived interface. /// /// /// /// Type: REFIID /// /// A reference to the IID of the interface to retrieve through ppvResources, typically IID_IShellItemResources or another /// interface that derives from it. /// /// /// /// Type: void** /// /// When this method returns, contains the interface pointer requested in riidResources. This is typically IShellItemResources /// or a derived interface. /// /// /// /// Type: HRESULT /// Returns a success code if successful, or an error value otherwise. Success codes include: /// /// /// S_OK: The move succeeded and ppvItem and ppvResources both point to valid objects. /// /// /// /// COPYENGINE_S_USER_IGNORED: The destination item already exists and has not been overwritten. The values pointed to by /// ppvItem and ppvResources are NULL. If the caller is implementing a move as a copy and delete operation, the caller /// should complete the move by deleting the source item. /// /// /// /// /// /// /// This method may be used to create a Shell item object representing the destination folder for a copy or move operation. The /// ITransferSource interface provides methods to actually move objects of IShellItem to the destination. /// /// /// Call ITransferDestination::Advise before calling any other ITransferDestination methods so the handler can callback on any /// errors that might occur. If not set, the handler should consider it an indication that no feedback is available and to do /// the "default" operation. /// /// /// It is recommended that you use the IID_PPV_ARGS macro, defined in Objbase.h, to package the riidResources and /// ppvResources parameters. This macro provides the correct IID based on the interface pointed to by the value in ppvResources, /// which eliminates the possibility of a coding error. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransferdestination-createitem HRESULT // CreateItem( LPCWSTR pszName, DWORD dwAttributes, ULONGLONG ullSize, TRANSFER_SOURCE_FLAGS flags, REFIID riidItem, void // **ppvItem, REFIID riidResources, void **ppvResources ); [PreserveSig] HRESULT CreateItem([MarshalAs(UnmanagedType.LPWStr)] string pszName, FileFlagsAndAttributes dwAttributes, ulong ullSize, TRANSFER_SOURCE_FLAGS flags, in Guid riidItem, [MarshalAs(UnmanagedType.Interface, IidParameterIndex = 4)] out object ppvItem, in Guid riidResources, [MarshalAs(UnmanagedType.Interface, IidParameterIndex = 6)] out object ppvResources); } /// /// Exposes methods to manipulate IShellItem, including copy, move, recycle, and others. This interface is offered to provide more /// control over file operations by providing an ITransferSource::Advise method. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-itransfersource [ComImport, Guid("00adb003-bde9-45c6-8e29-d09f9353e108"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITransferSource { /// Sets up an advisory connection for notifications on the status of file operations. /// /// Type: ITransferAdviseSink* /// A pointer to notification interface ITransferAdviseSink to update the calling application using methods on this interface. /// /// /// Type: DWORD* /// /// A pointer to a returned token that uniquely identifies this connection. The calling application uses this token later to /// delete the connection by passing it to the ITransferSource::Unadvise method. If the connection was not successfully /// established, this value is zero. /// /// /// /// Type: HRESULT /// Any HRESULTs other than listed indicate a failure. /// /// /// Return code /// Description /// /// /// S_OK /// The Interface successfully associated. /// /// /// E_UNEXPECTED /// The handler can only handle one sink interface. /// /// /// /// /// Call ITransferSource::Advise before calling any other methods in this interface to enable an advisory session. If not /// set, the handler should consider it an indication that no feedback is available and to do the "default" operation without /// consulting the calling application. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransfersource-advise HRESULT Advise( // ITransferAdviseSink *psink, DWORD *pdwCookie ); [PreserveSig] HRESULT Advise([In] ITransferAdviseSink psink, out uint pdwCookie); /// Terminates an advisory connection. /// /// Type: DWORD /// The connection token previously returned from method ITransferSource::Advise. /// /// /// Type: HRESULT /// Any HRESULTs other than listed indicate a failure. /// /// /// Return code /// Description /// /// /// S_OK /// The connection was successfully terminated. /// /// /// CONNECT_E_NOCONNECTION /// The value in dwCookie does not represent a valid connection. /// /// /// /// /// Terminates an advisory connection previously established through method ITransferSource::Advise. The dwCookie parameter /// identifies the connection to terminate. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransfersource-unadvise HRESULT Unadvise( // DWORD dwCookie ); [PreserveSig] HRESULT Unadvise([In] uint dwCookie); /// Sets properties that should be applied to an item. /// /// Type: IPropertyChangeArray* /// An array of properties and their changed values. /// /// /// Type: HRESULT /// Any return value other than S_OK indicates a failure. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransfersource-setproperties HRESULT // SetProperties( IPropertyChangeArray *pproparray ); [PreserveSig] HRESULT SetProperties([In] IPropertyChangeArray pproparray); /// Opens the item for copying. Returns an object that can be enumerated for resources (IShellItemResources). /// /// Type: IShellItem* /// A pointer to the IShellItem to be opened. /// /// /// Type: TRANSFER_SOURCE_FLAGS /// The flags that control the file operation. One or more of the TRANSFER_SOURCE_FLAGS constants. /// /// /// Type: REFIID /// /// A reference to the IID (the interface ID or GUID) of the interface to return in ppv. This should be an IShellItemResources /// or an interface derived from IShellItemResources. /// /// /// /// Type: void** /// When this method returns, contains the address of a pointer to the interface specified by riid. /// /// /// Type: HRESULT /// Returns S_OK if successful, or one of the following specific Shell codes, or a system error code. /// /// /// Return code /// Description /// /// /// COPYENGINE_S_YES /// User responded "Yes" to the dialog. /// /// /// COPYENGINE_S_USER_RETRY /// User responded to retry the current action. /// /// /// COPYENGINE_S_USER_IGNORED /// User responded "No" to the dialog. /// /// /// COPYENGINE_S_MERGE /// User responded to merge folders. /// /// /// COPYENGINE_S_USER_RETRY_WITH_NEW_NAME /// User responded to retry the file with new name. /// /// /// COPYENGINE_S_DONT_PROCESS_CHILDREN /// Child items should not be processed. /// /// /// COPYENGINE_S_PENDING /// Error has been queued and will display later. /// /// /// COPYENGINE_E_USER_CANCELLED /// User canceled the current action. /// /// /// COPYENGINE_E_REQUIRES_ELEVATION /// Operation requires elevated privileges. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransfersource-openitem HRESULT OpenItem( // IShellItem *psi, TRANSFER_SOURCE_FLAGS flags, REFIID riid, void **ppv ); [PreserveSig] HRESULT OpenItem([In] IShellItem psi, [In] TRANSFER_SOURCE_FLAGS flags, in Guid riid, [MarshalAs(UnmanagedType.Interface, IidParameterIndex = 2)] out object ppv); /// Moves the item within the volume/namespace, returning the IShellItem in its new location. /// /// Type: IShellItem* /// A pointer to the IShellItem to be moved. /// /// /// Type: IShellItem* /// A pointer to the IShellItem that represents the new parent item at the destination. /// /// /// Type: LPCWSTR /// Pointer to a null-terminated buffer that contains the destination path. /// /// /// Type: TRANSFER_SOURCE_FLAGS /// Flags that control the file operation. One or more of the TRANSFER_SOURCE_FLAGS constants. /// /// /// Type: IShellItem** /// When this method returns successfully, contains an address of a pointer to the IShellItem in its new location. /// /// /// Type: HRESULT /// /// Returns S_OK if the move succeeded. In that case, ppsiNew points to the address of the new item. Other possible /// return values, both success and failure codes, include the following: /// /// /// /// Return code /// Description /// /// /// COPYENGINE_S_USER_IGNORED /// /// The destination item already exists and has not been overwritten. In this case, ppsiNew is NULL and the caller should delete /// the source item. /// /// /// /// COPYENGINE_S_MERGE /// /// The destination item already exists and the user has chosen to merge the source and destination folders. In this case, /// ppsiNew points to a NULL value and the caller should delete the source item. /// /// /// /// E_NOINTERFACE /// When the item being moved is a folder, the caller should convert a move operation into a copy and delete operation. /// /// /// ERROR_NOT_SAME_DEVICE /// The caller should convert a move operation into a copy and delete operation. This error is seen as . /// /// /// ERROR_FILE_EXISTS /// /// When moving a folder, the caller should convert the move operation into a copy and delete operation. The destination item /// must support ITransferDestination. This error is seen as . /// /// /// /// ERROR_ALREADY_EXISTS /// /// When moving a folder, the caller should convert the move operation into a copy and delete operation. The destination item /// must support ITransferDestination. This error is seen as . /// /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransfersource-moveitem HRESULT MoveItem( // IShellItem *psi, IShellItem *psiParentDst, LPCWSTR pszNameDst, TRANSFER_SOURCE_FLAGS flags, IShellItem **ppsiNew ); [PreserveSig] HRESULT MoveItem([In] IShellItem psi, [In] IShellItem psiParentDst, [In, MarshalAs(UnmanagedType.LPWStr)] string pszNameDst, TRANSFER_SOURCE_FLAGS flags, out IShellItem ppsiNew); /// Recycle the item into the provided recycle location and return the item in its new location. /// /// Type: IShellItem* /// A pointer to the IShellItem to be recycled. /// /// /// Type: IShellItem* /// A pointer to the IShellItem of the recycle location (the new parent of the item). /// /// /// Type: TRANSFER_SOURCE_FLAGS /// The flags that control the file operation. One or more of the TRANSFER_SOURCE_FLAGS constants. /// /// /// Type: IShellItem** /// When the method returns, contains the address of a pointer to the recycled IShellItem. /// /// /// Type: HRESULT /// Returns one of the following, or an error code. /// /// /// Return code /// Description /// /// /// COPYENGINE_S_YES /// User responded "Yes" to the dialog. /// /// /// COPYENGINE_S_USER_RETRY /// User responded to retry the current action. /// /// /// COPYENGINE_S_USER_IGNORED /// User responded "No" to the dialog. /// /// /// COPYENGINE_S_DONT_PROCESS_CHILDREN /// Children items should not be processed. /// /// /// COPYENGINE_S_PENDING /// Error has been queued and will display later. /// /// /// COPYENGINE_E_USER_CANCELLED /// User canceled the current action. /// /// /// COPYENGINE_E_REQUIRES_ELEVATION /// Operation requires elevated privileges. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransfersource-recycleitem HRESULT // RecycleItem( IShellItem *psiSource, IShellItem *psiParentDest, TRANSFER_SOURCE_FLAGS flags, IShellItem **ppsiNewDest ); [PreserveSig] HRESULT RecycleItem([In] IShellItem psiSource, [In] IShellItem psiParentDest, [In] TRANSFER_SOURCE_FLAGS flags, out IShellItem ppsiNewDest); /// Removes the item without moving the item to the Recycle Bin. /// /// Type: IShellItem* /// A pointer to the IShellItem to be removed. /// /// /// Type: TRANSFER_SOURCE_FLAGS /// Flags that control the file operation. One or more of the TRANSFER_SOURCE_FLAGS constants. /// /// /// Type: HRESULT /// Returns one of the following, or an error code. /// /// /// Return code /// Description /// /// /// COPYENGINE_S_YES /// User responded "Yes" to the dialog /// /// /// COPYENGINE_S_USER_RETRY /// User responded to retry the current action /// /// /// COPYENGINE_S_USER_IGNORED /// User responded "No" to the dialog. /// /// /// COPYENGINE_S_MERGE /// User responded to merge folders. /// /// /// COPYENGINE_S_USER_RETRY_WITH_NEW_NAME /// User responded to retry the file with new name. /// /// /// COPYENGINE_S_DONT_PROCESS_CHILDREN /// Child items should not be processed. /// /// /// COPYENGINE_S_PENDING /// Error has been queued and will display later. /// /// /// COPYENGINE_E_USER_CANCELLED /// User canceled the current action. /// /// /// COPYENGINE_E_REQUIRES_ELEVATION /// Operation requires elevated privileges. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransfersource-removeitem HRESULT // RemoveItem( IShellItem *psiSource, TRANSFER_SOURCE_FLAGS flags ); [PreserveSig] HRESULT RemoveItem([In] IShellItem psiSource, [In] TRANSFER_SOURCE_FLAGS flags); /// Changes the name of an item, returning the IShellItem with the new name. /// /// Type: IShellItem* /// A pointer to the IShellItem object to be renamed. /// /// /// Type: LPCWSTR /// A pointer to a null-terminated, Unicode string containing the new name. /// /// /// Type: TRANSFER_SOURCE_FLAGS /// Flags that control the file operation. One or more of the TRANSFER_SOURCE_FLAGS constants. /// /// /// Type: IShellItem** /// When this method returns, contains the address of a pointer to the IShellItem object. /// /// /// Type: HRESULT /// Returns one of the following, or an error code. /// /// /// Return code /// Description /// /// /// COPYENGINE_S_YES /// User responded "Yes" to the dialog. /// /// /// COPYENGINE_S_USER_RETRY /// User responded to retry the current action. /// /// /// COPYENGINE_S_USER_IGNORED /// User responded "No" to the dialog. /// /// /// COPYENGINE_S_MERGE /// User responded to merge folders. /// /// /// COPYENGINE_S_USER_RETRY_WITH_NEW_NAME /// User responded to retry the file with new name. /// /// /// COPYENGINE_S_DONT_PROCESS_CHILDREN /// Child items should not be processed. /// /// /// COPYENGINE_S_PENDING /// Error has been queued and will display later. /// /// /// COPYENGINE_E_USER_CANCELLED /// User canceled the current action. /// /// /// COPYENGINE_E_REQUIRES_ELEVATION /// Operation requires elevated privileges. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransfersource-renameitem HRESULT // RenameItem( IShellItem *psiSource, LPCWSTR pszNewName, TRANSFER_SOURCE_FLAGS flags, IShellItem **ppsiNewDest ); [PreserveSig] HRESULT RenameItem([In] IShellItem psiSource, [In, MarshalAs(UnmanagedType.LPWStr)] string pszNewName, [In] TRANSFER_SOURCE_FLAGS flags, out IShellItem ppsiNewDest); /// Not implemented. /// /// Type: IShellItem* /// A pointer to an IShellItem that represents the source item. /// /// /// Type: IShellItem* /// A pointer to the IShellItem as parent to link. /// /// /// Type: LPCWSTR /// A pointer to a null-terminated, Unicode string containing the name for the link. /// /// /// Type: DWORD /// The flags that control the file operation. Value is one or more of the TRANSFER_SOURCE_FLAGS constants. /// /// /// Type: IShellItem** /// When the method returns, contains the address of a pointer to the IShellItem of the link. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransfersource-linkitem HRESULT LinkItem( // IShellItem *psiSource, IShellItem *psiParentDest, LPCWSTR pszNewName, TRANSFER_SOURCE_FLAGS flags, IShellItem **ppsiNewDest ); [PreserveSig] HRESULT LinkItem([In] IShellItem psiSource, [In] IShellItem psiParentDest, [In, Optional, MarshalAs(UnmanagedType.LPWStr)] string pszNewName, [In] TRANSFER_SOURCE_FLAGS flags, out IShellItem ppsiNewDest); /// Apply a set of property changes to an item. /// /// Type: IShellItem* /// A pointer to the IShellItem to be altered. /// /// /// Type: IShellItem** /// When this method returns, contains the address of a pointer to the changed IShellItem. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransfersource-applypropertiestoitem // HRESULT ApplyPropertiesToItem( IShellItem *psiSource, IShellItem **ppsiNew ); [PreserveSig] HRESULT ApplyPropertiesToItem([In] IShellItem psiSource, out IShellItem ppsiNew); /// Gets the default name for a Shell item. /// /// Type: IShellItem* /// A pointer to the IShellItem. /// /// /// Type: IShellItem* /// A pointer to the parent IShellItem of the destination target of the file operation. /// /// /// Type: LPWSTR* /// When the method returns, contains a pointer to a null-terminated, Unicode string containing the default name. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// /// Gets the default name for a Shell item, if different than the item's parsing name. // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransfersource-getdefaultdestinationname // HRESULT GetDefaultDestinationName( IShellItem *psiSource, IShellItem *psiParentDest, LPWSTR *ppszDestinationName ); [PreserveSig] HRESULT GetDefaultDestinationName([In] IShellItem psiSource, [In] IShellItem psiParentDest, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDestinationName); /// Notifies that a folder is the destination of a file operation. /// /// Type: IShellItem* /// A pointer to the IShellItem destination folder. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// /// /// This method is called when beginning to process a folder or subfolder in a recursive operation. For instance, when a source /// folder is copied to a destination folder, method ITransferSource::EnterFolder should be called with /// psiChildFolderDest set to the destination folder. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransfersource-enterfolder HRESULT // EnterFolder( IShellItem *psiChildFolderDest ); [PreserveSig] HRESULT EnterFolder([In] IShellItem psiChildFolderDest); /// Sends notification that a folder is no longer the destination of a file operation. /// /// Type: IShellItem* /// A pointer to the IShellItem destination folder. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// /// This method is called at the end of recursive file operations on a destination folder. // https://docs.microsoft.com/zh-cn/windows/win32/api/shobjidl_core/nf-shobjidl_core-itransfersource-leavefolder HRESULT // LeaveFolder( IShellItem *psiChildFolderDest ); [PreserveSig] HRESULT LeaveFolder([In] IShellItem psiChildFolderDest); } } }