From c7d0621df458283df6bd325ee3e2da28a0182870 Mon Sep 17 00:00:00 2001 From: Dave Kerr Date: Wed, 29 Jan 2014 23:32:44 +0100 Subject: [PATCH] tried implementing ipersistidlist to no avail. --- .../SharpShell/Interop/CMINVOKECOMMANDINFO.cs | 2 +- .../SharpShell/Interop/IPersistIDList.cs | 32 ++++++++++++++++++ .../NativeBridge/SharpShellNativeBridge64.dll | Bin 37888 -> 37888 bytes .../SharpNamespaceExtension.cs | 14 ++++++++ .../ShellFolderProxy.cs | 18 ++++++++-- SharpShell/SharpShell/SharpShell.csproj | 1 + 6 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 SharpShell/SharpShell/Interop/IPersistIDList.cs diff --git a/SharpShell/SharpShell/Interop/CMINVOKECOMMANDINFO.cs b/SharpShell/SharpShell/Interop/CMINVOKECOMMANDINFO.cs index 84157993..1bb1352d 100644 --- a/SharpShell/SharpShell/Interop/CMINVOKECOMMANDINFO.cs +++ b/SharpShell/SharpShell/Interop/CMINVOKECOMMANDINFO.cs @@ -53,5 +53,5 @@ public struct CMINVOKECOMMANDINFO /// An icon to use for any application activated by the command. If the fMask member does not specify CMIC_MASK_ICON, this member is ignored. /// public IntPtr hIcon; - } + } } \ No newline at end of file diff --git a/SharpShell/SharpShell/Interop/IPersistIDList.cs b/SharpShell/SharpShell/Interop/IPersistIDList.cs new file mode 100644 index 00000000..afae4e1b --- /dev/null +++ b/SharpShell/SharpShell/Interop/IPersistIDList.cs @@ -0,0 +1,32 @@ +using System; +using System.Runtime.InteropServices; + +namespace SharpShell.Interop +{ + /// + /// Exposes methods that are used to persist item identifier lists. + /// + [ComImport, Guid("1079acfc-29bd-11d3-8e0d-00c04f6837d5"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + internal interface IPersistIDList : IPersist + { + #region Overriden IPersist Methods + + int GetClassID(out Guid pClassID); + + #endregion + + /// + /// Sets a persisted item identifier list. + /// + /// A pointer to the item identifier list to set. + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + int SetIDList([In] IntPtr pidl); + + /// + /// Gets an item identifier list. + /// + /// The address of a pointer to the item identifier list to get. + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + int GetIDList([Out] out IntPtr pidl); + } +} \ No newline at end of file diff --git a/SharpShell/SharpShell/NativeBridge/SharpShellNativeBridge64.dll b/SharpShell/SharpShell/NativeBridge/SharpShellNativeBridge64.dll index 095c0c6201d4c6c1edd13d56ab6e2dd0901598a4..35ce4f51d5794ec14149cb20cc0d61e2bb544bb4 100644 GIT binary patch delta 86 zcmZoz!PKyVX@dYGvtIhk&BBauoY9*fl1M6># e#o{Y{_hfiYvNd}zzu6{p1~0QNQ2KhArYr#I78#rX delta 86 zcmZoz!PKyVX@dYGGxPlyn}rzzBjtgNAO;{{0^$-N)+hzyOppiz14vPG)Ji@9%|oIb d?VoqKEm<pb diff --git a/SharpShell/SharpShell/SharpNamespaceExtension/SharpNamespaceExtension.cs b/SharpShell/SharpShell/SharpNamespaceExtension/SharpNamespaceExtension.cs index c3e8e680..76451d17 100644 --- a/SharpShell/SharpShell/SharpNamespaceExtension/SharpNamespaceExtension.cs +++ b/SharpShell/SharpShell/SharpNamespaceExtension/SharpNamespaceExtension.cs @@ -32,6 +32,7 @@ namespace SharpShell.SharpNamespaceExtension public abstract class SharpNamespaceExtension : SharpShellServer, IPersistFolder2, + IPersistIDList, IShellFolder2, IShellNamespaceFolder @@ -65,6 +66,7 @@ int IPersist.GetClassID(out Guid pClassID) } int IPersistFolder.GetClassID(out Guid pClassId) {return ((IPersist)this).GetClassID(out pClassId); } int IPersistFolder2.GetClassID(out Guid pClassId) { return ((IPersist)this).GetClassID(out pClassId); } + int IPersistIDList.GetClassID(out Guid pClassId) { return ((IPersist)this).GetClassID(out pClassId); } /// /// Instructs a Shell folder object to initialize itself based on the information passed. @@ -109,6 +111,18 @@ int IPersistFolder2.GetCurFolder(out IntPtr ppidl) ppidl = PidlManager.IdListToPidl(extensionAbsolutePidl); return WinError.S_OK; } + + + int IPersistIDList.SetIDList(IntPtr pidl) + { + return ((IPersistFolder2)this).Initialize(pidl); + } + + int IPersistIDList.GetIDList([Out] out IntPtr pidl) + { + return ((IPersistFolder2)this).GetCurFolder(out pidl); + } + #endregion diff --git a/SharpShell/SharpShell/SharpNamespaceExtension/ShellFolderProxy.cs b/SharpShell/SharpShell/SharpNamespaceExtension/ShellFolderProxy.cs index f404c281..db58cff4 100644 --- a/SharpShell/SharpShell/SharpNamespaceExtension/ShellFolderProxy.cs +++ b/SharpShell/SharpShell/SharpNamespaceExtension/ShellFolderProxy.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.InteropServices; using SharpShell.Interop; using SharpShell.Pidl; @@ -6,7 +7,7 @@ namespace SharpShell.SharpNamespaceExtension { // todo important we can merge this class an shellfolderimpl - internal class ShellFolderProxy : IShellFolder2, IPersistFolder2 + internal class ShellFolderProxy : IShellFolder2, IPersistFolder2, IPersistIDList { public ShellFolderProxy(IShellNamespaceFolder folder, Guid serverGuid, IdList idList) { @@ -303,7 +304,7 @@ int IShellFolder2.MapColumnToSCID(uint iColumn, out PROPERTYKEY pscid) #endregion - #region Implementation IPersist, IPersistFolder, IPersistFolder2 + #region Implementation IPersist, IPersistFolder, IPersistFolder2, IPersistIDList /// /// Gets the class identifier. @@ -318,6 +319,7 @@ int IPersist.GetClassID(out Guid pClassID) } int IPersistFolder.GetClassID(out Guid pClassID) { return ((IPersist)this).GetClassID(out pClassID); } int IPersistFolder2.GetClassID(out Guid pClassID) { return ((IPersist)this).GetClassID(out pClassID); } + int IPersistIDList.GetClassID(out Guid pClassID) {return ((IPersist)this).GetClassID(out pClassID); } int IPersistFolder.Initialize(IntPtr pidl) { @@ -337,13 +339,23 @@ int IPersistFolder.Initialize(IntPtr pidl) /// /// If the folder object has not been initialized, this method returns S_FALSE and ppidl is set to NULL. /// - public int GetCurFolder(out IntPtr ppidl) + int IPersistFolder2.GetCurFolder(out IntPtr ppidl) { // Return the pidl. ppidl = PidlManager.IdListToPidl(folderIdList); return WinError.S_OK; } + int IPersistIDList.SetIDList(IntPtr pidl) + { + return ((IPersistFolder2) this).Initialize(pidl); + } + + int IPersistIDList.GetIDList([Out] out IntPtr pidl) + { + return ((IPersistFolder2) this).GetCurFolder(out pidl); + } + #endregion private readonly IShellNamespaceFolder folder; diff --git a/SharpShell/SharpShell/SharpShell.csproj b/SharpShell/SharpShell/SharpShell.csproj index 027051cf..458571f0 100644 --- a/SharpShell/SharpShell/SharpShell.csproj +++ b/SharpShell/SharpShell/SharpShell.csproj @@ -91,6 +91,7 @@ +