Beispiel #1
0
        public static IDebugCoreServer2 GetServer(this IDebugProcess2 process)
        {
            Contract.Requires <ArgumentNullException>(process != null, "process");

            IDebugCoreServer2 server;

            ErrorHandler.ThrowOnFailure(process.GetServer(out server));
            return(server);
        }
Beispiel #2
0
        public ReAttachTarget GetTargetFromProcess(IDebugProcess2 debugProcess)
        {
            var process = (IDebugProcess3)debugProcess;
            var pid     = process.GetProcessId();
            var target  = _package.History.Items.Find(pid);

            if (target != null)
            {
                return(target);
            }


            var serverName = "";
            IDebugCoreServer2 server;

            if (debugProcess.GetServer(out server) == VSConstants.S_OK)
            {
                var server3 = server as IDebugCoreServer3;
                var tmp     = "";
                if (server3 != null && server3.QueryIsLocal() == VSConstants.S_FALSE &&
                    server3.GetServerFriendlyName(out tmp) == VSConstants.S_OK)
                {
                    serverName = tmp;
                }
            }

            var user = GetProcessUsername(pid);
            var path = process.GetFilename();

            target = new ReAttachTarget(pid, path, user, serverName);

            var rawEngines = new GUID_ARRAY[1];

            if (process.GetEngineFilter(rawEngines) == VSConstants.S_OK && rawEngines[0].dwCount > 0)
            {
                var pointer     = rawEngines[0].Members;
                var engineCount = rawEngines[0].dwCount;
                for (var i = 0; i < engineCount; i++)
                {
                    var engineId = (Guid)Marshal.PtrToStructure(pointer + (i * 16), typeof(Guid));
                    target.Engines.Add(engineId);
                }
            }
            return(target);
        }
        public ReAttachTarget GetTargetFromProcess(IDebugProcess2 debugProcess)
        {
            var process = (IDebugProcess3)debugProcess;
            var pid = process.GetProcessId();
            var target = _package.History.Items.Find(pid);
            if (target != null)
                return target;

            var serverName = "";
            IDebugCoreServer2 server;
            if (debugProcess.GetServer(out server) == VSConstants.S_OK)
            {
                var server3 = server as IDebugCoreServer3;
                var tmp = "";
                if (server3 != null && server3.QueryIsLocal() == VSConstants.S_FALSE &&
                    server3.GetServerFriendlyName(out tmp) == VSConstants.S_OK)
                {
                    serverName = tmp;
                }
            }

            var user = GetProcessUsername(pid);
            var path = process.GetFilename();
            target = new ReAttachTarget(pid, path, user, serverName);

            var rawEngines = new GUID_ARRAY[1];

            if (process.GetEngineFilter(rawEngines) == VSConstants.S_OK && rawEngines[0].dwCount > 0)
            {
                var pointer = rawEngines[0].Members;
                var engineCount = rawEngines[0].dwCount;
                for (var i = 0; i < engineCount; i++)
                {
                    var engineId = (Guid)Marshal.PtrToStructure(pointer + (i * 16), typeof(Guid));
                    target.Engines.Add(engineId);
                }
            }
            return target;
        }
Beispiel #4
0
        public ReAttachTarget GetTargetFromProcess(IDebugProcess2 debugProcess)
        {
            var process = (IDebugProcess3)debugProcess;
            var pid = process.GetProcessId();
            var target = _package.History.Items.Find(pid);
            if (target != null)
                return target;

            var serverName = "";
            IDebugCoreServer2 server;
            if (debugProcess.GetServer(out server) == VSConstants.S_OK)
            {
                var server3 = server as IDebugCoreServer3;
                var tmp = "";
                if (server3 != null && server3.QueryIsLocal() == VSConstants.S_FALSE &&
                    server3.GetServerFriendlyName(out tmp) == VSConstants.S_OK)
                {
                    serverName = tmp;
                }
            }

            var user = GetProcessUsername(pid);
            var path = process.GetFilename();
            return new ReAttachTarget(pid, path, user, serverName);
        }