当前位置: 首页>>代码示例>>C#>>正文


C# IDebugProcess2.GetServer方法代码示例

本文整理汇总了C#中IDebugProcess2.GetServer方法的典型用法代码示例。如果您正苦于以下问题:C# IDebugProcess2.GetServer方法的具体用法?C# IDebugProcess2.GetServer怎么用?C# IDebugProcess2.GetServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDebugProcess2的用法示例。


在下文中一共展示了IDebugProcess2.GetServer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTargetFromProcess

        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;
        }
开发者ID:ticoaraujo,项目名称:ReAttach,代码行数:39,代码来源:ReAttachDebugger.cs

示例2: GetTargetFromProcess

        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);
        }
开发者ID:jijamw,项目名称:ReAttach,代码行数:25,代码来源:ReAttachDebugger.cs


注:本文中的IDebugProcess2.GetServer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。