Esempio n. 1
0
        private static JumpItem GetJumpItemForShellObject(object shellObject)
        {
            int num;

            Standard.IShellItem2 item = shellObject as Standard.IShellItem2;
            Standard.IShellLinkW kw   = shellObject as Standard.IShellLinkW;
            if (item != null)
            {
                return(new JumpPath {
                    Path = item.GetDisplayName(unchecked ((Standard.SIGDN)(-2147319808)))
                });
            }
            if (kw == null)
            {
                return(null);
            }
            StringBuilder pszFile = new StringBuilder(260);

            kw.GetPath(pszFile, pszFile.Capacity, null, Standard.SLGP.RAWPATH);
            StringBuilder pszArgs = new StringBuilder(0x400);

            kw.GetArguments(pszArgs, pszArgs.Capacity);
            StringBuilder builder3 = new StringBuilder(0x400);

            kw.GetDescription(builder3, builder3.Capacity);
            StringBuilder pszIconPath = new StringBuilder(260);

            kw.GetIconLocation(pszIconPath, pszIconPath.Capacity, out num);
            StringBuilder pszDir = new StringBuilder(260);

            kw.GetWorkingDirectory(pszDir, pszDir.Capacity);
            JumpTask task = new JumpTask {
                ApplicationPath   = pszFile.ToString(),
                Arguments         = pszArgs.ToString(),
                Description       = builder3.ToString(),
                IconResourceIndex = num,
                IconResourcePath  = pszIconPath.ToString(),
                WorkingDirectory  = pszDir.ToString()
            };

            using (PROPVARIANT propvariant = new PROPVARIANT())
            {
                Standard.IPropertyStore store = (Standard.IPropertyStore)kw;
                Standard.PKEY           title = Standard.PKEY.Title;
                store.GetValue(ref title, propvariant);
                task.Title = propvariant.GetValue() ?? "";
            }
            return(task);
        }
Esempio n. 2
0
        private static string ShellLinkToString(Standard.IShellLinkW shellLink)
        {
            StringBuilder pszFile = new StringBuilder(260);

            shellLink.GetPath(pszFile, pszFile.Capacity, null, Standard.SLGP.RAWPATH);
            string str = null;

            using (PROPVARIANT propvariant = new PROPVARIANT())
            {
                Standard.IPropertyStore store = (Standard.IPropertyStore)shellLink;
                Standard.PKEY           title = Standard.PKEY.Title;
                store.GetValue(ref title, propvariant);
                str = propvariant.GetValue() ?? "";
            }
            StringBuilder pszArgs = new StringBuilder(0x400);

            shellLink.GetArguments(pszArgs, pszArgs.Capacity);
            return(pszFile.ToString().ToUpperInvariant() + str.ToUpperInvariant() + pszArgs.ToString());
        }