Beispiel #1
0
        /// <summary>
        /// Creates a wrapper for the process debug manager. A return value indicates whether
        /// the creation succeeded.
        /// </summary>
        /// <param name="wrapper">Wrapper for process debug manager</param>
        /// <returns>true if the wrapper was created successfully; otherwise, false.</returns>
        public static bool TryCreate(out ProcessDebugManagerWrapper wrapper)
        {
            const string progId = "ProcessDebugManager";

            if (Utils.Is64BitProcess())
            {
                IProcessDebugManager64 processDebugManager64;
                if (ComHelpers.TryCreateComObject(progId, null, out processDebugManager64))
                {
                    wrapper = new ProcessDebugManagerWrapper(processDebugManager64);
                    return(true);
                }
            }
            else
            {
                IProcessDebugManager32 processDebugManager32;
                if (ComHelpers.TryCreateComObject(progId, null, out processDebugManager32))
                {
                    wrapper = new ProcessDebugManagerWrapper(processDebugManager32);
                    return(true);
                }
            }

            wrapper = null;
            return(false);
        }