本文整理汇总了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;
}
示例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);
}