Esempio n. 1
0
        public void CanDecodePidl()
        {
            IntPtr pidl;

            Shell32.SHGetKnownFolderIDList(KnownFolders.FOLDERID_Cookies, KNOWN_FOLDER_FLAG.KF_NO_FLAGS, IntPtr.Zero, out pidl);
            var idList = PidlManager.Decode(pidl);

            Shell32.ILFree(pidl);
        }
Esempio n. 2
0
        public void CanDecodePidl()
        {
            IntPtr pidl = default(IntPtr);

            try
            {
                NativeMethods.SHGetKnownFolderIDList(KnownFolderGuids.FOLDERID_Cookies,
                                                     KNOWN_FOLDER_FLAG.KF_NO_FLAGS,
                                                     IntPtr.Zero, out pidl);

                var idList = PidlManager.Decode(pidl);
                Assert.IsTrue(idList != null);
            }
            finally
            {
                if (pidl != default(IntPtr))
                {
                    NativeMethods.ILFree(pidl);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Calls the GetIDList method in the wrapped IKnownFolder interface to retrieve the ItemIdList
        /// for this KnownFolderItem.
        /// </summary>
        /// <returns>Type: PIDLIST_ABSOLUTE*
        /// When this method returns, contains the address of an absolute PIDL
        /// in its equivalent ItemIdList form.</returns>
        public IdList KnownFolderToIdList()
        {
            if (Obj == null)
            {
                throw new System.ArgumentException("Native IKnownFolder cannot be null.");
            }

            IntPtr ptrFullPidl = default(IntPtr);

            try
            {
                ptrFullPidl = KnownFolderToPIDL();

                // Convert PIDL into list of shellids and remove last id
                var shellListIds = PidlManager.Decode(ptrFullPidl);

                return(IdList.Create(shellListIds));
            }
            finally
            {
                ptrFullPidl = PidlManager.ILFree(ptrFullPidl);
            }
        }