Пример #1
0
 /// <summary>
 ///     Create an empty shell link object
 /// </summary>
 public ShellLink()
 {
     theShellLinkObject = new ShellLinkCoClass();
     shellLink          = (IShellLink)theShellLinkObject;
     dataList           = (IShellLinkDataList)theShellLinkObject;
     consoleProperties  = new ConsoleProperties(this);
 }
Пример #2
0
 /// <summary>
 ///   Create an empty shell link object
 /// </summary>
 public ShellLink()
 {
     theShellLinkObject = new ShellLinkCoClass();
     shellLink = (IShellLink) theShellLinkObject;
     dataList = (IShellLinkDataList) theShellLinkObject;
     consoleProperties = new ConsoleProperties(this);
 }
Пример #3
0
        internal static bool IsMarkedRunAs(string shortcutFile)
        {
            Type         shellLinkType = Type.GetTypeFromCLSID(new Guid(ShellIIDGuid.CShellLink), true);
            IPersistFile shellFile     = Activator.CreateInstance(shellLinkType) as IPersistFile;

            if (shellFile != null)
            {
                shellFile.Load(shortcutFile, (int)AccessModes.Read);
                IShellLinkDataList shellLink = (IShellLinkDataList)shellFile;
                int flags;
                shellLink.GetFlags(out flags);

                return((flags & Convert.ToInt32(ShellLinkDataFlags.RunAs)) != 0);
            }

            return(false);
        }
Пример #4
0
        public void Dispose()
        {
            GC.SuppressFinalize(this);

            if (dataList != null)
            {
                Marshal.ReleaseComObject(dataList);
                dataList = null;
            }

            if (shellLink != null)
            {
                Marshal.ReleaseComObject(shellLink);
                shellLink = null;
            }

            if (theShellLinkObject != null)
            {
                Marshal.ReleaseComObject(theShellLinkObject);
                theShellLinkObject = null;
            }
        }
Пример #5
0
        public void Dispose() {
            GC.SuppressFinalize(this);

            if (dataList != null) {
                Marshal.ReleaseComObject(dataList);
                dataList = null;
            }

            if (shellLink != null) {
                Marshal.ReleaseComObject(shellLink);
                shellLink = null;
            }

            if (theShellLinkObject != null) {
                Marshal.ReleaseComObject(theShellLinkObject);
                theShellLinkObject = null;
            }
        }