本文整理汇总了C#中IDebugProcess2.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# IDebugProcess2.GetName方法的具体用法?C# IDebugProcess2.GetName怎么用?C# IDebugProcess2.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDebugProcess2
的用法示例。
在下文中一共展示了IDebugProcess2.GetName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Event
public int Event(IDebugEngine2 engine, IDebugProcess2 process, IDebugProgram2 program,
IDebugThread2 thread, IDebugEvent2 debugEvent, ref Guid riidEvent, uint attributes)
{
if (!(debugEvent is IDebugProcessCreateEvent2) &&
!(debugEvent is IDebugProcessDestroyEvent2))
return VSConstants.S_OK;
var target = GetTargetFromProcess(process);
if (target == null)
{
_package.Reporter.ReportWarning("Can't find target from process {0} ({1}). Event: {2}.",
process.GetName(), process.GetProcessId(), TypeHelper.GetDebugEventTypeName(debugEvent));
return VSConstants.S_OK;
}
if (debugEvent is IDebugProcessCreateEvent2)
{
target.IsAttached = true;
_package.History.Items.AddFirst(target);
_package.Ui.Update();
}
else
{
target.IsAttached = false;
_package.Ui.Update();
}
return VSConstants.S_OK;
}
示例2: Event
public int Event(IDebugEngine2 engine, IDebugProcess2 process, IDebugProgram2 program,
IDebugThread2 thread, IDebugEvent2 debugEvent, ref Guid riidEvent, uint attributes)
{
if (process == null)
return VSConstants.S_OK;
string processName;
if (process.GetName((uint) enum_GETNAME_TYPE.GN_FILENAME, out processName) != VSConstants.S_OK)
return VSConstants.S_OK;
if (processName.EndsWith("vshost.exe"))
return VSConstants.S_OK;
var shortName = Path.GetFileName(processName);
if (debugEvent is IDebugProcessCreateEvent2)
{
Log.Instance.SetStatus("[attaching...] {0}", shortName);
Storage.Instance.SubscribeProcess(processName);
}
if (debugEvent is IDebugProcessDestroyEvent2)
{
Log.Instance.SetStatus("[detached] {0}", shortName);
Log.Instance.AppendLine("[detached] {0}", shortName);
}
if (debugEvent is IDebugLoadCompleteEvent2)
{
if (program != null)
{
string engineName;
Guid engineId;
if (program.GetEngineInfo(out engineName, out engineId) == VSConstants.S_OK)
{
var fields = new PROCESS_INFO[1];
if (process.GetInfo((uint)enum_PROCESS_INFO_FIELDS.PIF_PROCESS_ID, fields) != VSConstants.S_OK)
return VSConstants.S_OK;
Storage.Instance.SubscribeEngine(processName, engineId);
AttachCenter.Instance.Freeze();
Log.Instance.SetStatus("[attached] {0}", shortName);
Log.Instance.AppendLine("[attached] {0} ({1}) / {2}", shortName, fields[0].ProcessId.dwProcessId, engineName);
}
}
}
return VSConstants.S_OK;
}
示例3: Event
public int Event(IDebugEngine2 engine, IDebugProcess2 process, IDebugProgram2 program,
IDebugThread2 thread, IDebugEvent2 debugEvent, ref Guid riidEvent, uint attributes)
{
// Ignore a few events right away.
if (debugEvent is IDebugModuleLoadEvent2 ||
debugEvent is IDebugThreadCreateEvent2 ||
debugEvent is IDebugThreadDestroyEvent2)
return VSConstants.S_OK;
// Trace.WriteLine(TypeHelper.GetDebugEventTypeName(debugEvent)); // TODO: Remove me.
if (process == null)
return VSConstants.S_OK;
var target = GetTargetFromProcess(process);
if (target == null)
{
_package.Reporter.ReportWarning("Can't find target from process {0} ({1}). Event: {2}.",
process.GetName(), process.GetProcessId(), TypeHelper.GetDebugEventTypeName(debugEvent));
return VSConstants.S_OK;
}
if (debugEvent is IDebugProcessCreateEvent2)
{
target.IsAttached = true;
_package.History.Items.AddFirst(target);
_package.Ui.Update();
return VSConstants.S_OK;
}
if (debugEvent is IDebugProcessDestroyEvent2)
{
target.IsAttached = false;
_package.Ui.Update();
return VSConstants.S_OK;
}
return VSConstants.S_OK;
}
示例4: Event
public int Event(IDebugEngine2 engine, IDebugProcess2 process, IDebugProgram2 program,
IDebugThread2 thread, IDebugEvent2 debugEvent, ref Guid riidEvent, uint attributes)
{
// _package.Reporter.ReportTrace(TypeHelper.GetDebugEventTypeName(debugEvent));
if (!(debugEvent is IDebugProcessCreateEvent2) &&
!(debugEvent is IDebugProcessDestroyEvent2))
return VSConstants.S_OK;
var target = GetTargetFromProcess(process);
if (target == null)
{
_package.Reporter.ReportWarning("Can't find target from process {0} ({1}). Event: {2}.",
process.GetName(), process.GetProcessId(), TypeHelper.GetDebugEventTypeName(debugEvent));
return VSConstants.S_OK;
}
if (debugEvent is IDebugProcessCreateEvent2)
{
var engines = target.Engines.Where(e => _engines.ContainsKey(e)).Select(e => _engines[e]).ToArray();
var mode = new DBGMODE[1];
_debugger.GetMode(mode);
if (mode[0] == DBGMODE.DBGMODE_Design)
return VSConstants.S_OK;
target.IsAttached = true;
_package.History.Items.AddFirst(target);
_package.Ui.Update();
}
else
{
target.IsAttached = false;
_package.Ui.Update();
}
return VSConstants.S_OK;
}