本文整理汇总了C#中AD_PROCESS_ID类的典型用法代码示例。如果您正苦于以下问题:C# AD_PROCESS_ID类的具体用法?C# AD_PROCESS_ID怎么用?C# AD_PROCESS_ID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AD_PROCESS_ID类属于命名空间,在下文中一共展示了AD_PROCESS_ID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetProviderProgramNode
public int GetProviderProgramNode(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId,
ref Guid guidEngine, ulong programId, out IDebugProgramNode2 ppProgramNode)
{
DebugHelper.TraceEnteringMethod();
ppProgramNode = null;
return VSConstants.S_OK;
}
示例2: GetHostPid
public int GetHostPid(AD_PROCESS_ID[] pHostProcessId)
{
DebugHelper.TraceEnteringMethod();
pHostProcessId[0].ProcessIdType = (uint)enum_AD_PROCESS_ID.AD_PROCESS_ID_GUID;
pHostProcessId[0].guidProcessId = _processId;
return VSConstants.S_OK;
}
示例3: typeof
// Obtains information about programs running, filtered in a variety of ways.
int IDebugProgramProvider2.GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] processArray) {
processArray[0] = new PROVIDER_PROCESS_DATA();
if (Flags.HasFlag(enum_PROVIDER_FLAGS.PFLAG_GET_PROGRAM_NODES)) {
// The debugger is asking the engine to return the program nodes it can debug. The
// sample engine claims that it can debug all processes, and returns exsactly one
// program node for each process. A full-featured debugger may wish to examine the
// target process and determine if it understands how to debug it.
var node = (IDebugProgramNode2)(new AD7ProgramNode(ProcessId.guidProcessId));
IntPtr[] programNodes = { Marshal.GetComInterfaceForObject(node, typeof(IDebugProgramNode2)) };
IntPtr destinationArray = Marshal.AllocCoTaskMem(IntPtr.Size * programNodes.Length);
Marshal.Copy(programNodes, 0, destinationArray, programNodes.Length);
processArray[0].Fields = enum_PROVIDER_FIELDS.PFIELD_PROGRAM_NODES;
processArray[0].ProgramNodes.Members = destinationArray;
processArray[0].ProgramNodes.dwCount = (uint)programNodes.Length;
return VSConstants.S_OK;
}
return VSConstants.S_FALSE;
}
示例4: GetProcess
public int GetProcess(AD_PROCESS_ID ProcessId, out IDebugProcess2 ppProcess) {
ppProcess = null;
if (ProcessId.ProcessIdType != (uint)enum_AD_PROCESS_ID.AD_PROCESS_ID_SYSTEM) {
return VSConstants.E_FAIL;
}
IEnumDebugProcesses2 processEnum;
int hr = EnumProcesses(out processEnum);
if (ErrorHandler.Failed(hr)) {
return hr;
}
var processes = new IDebugProcess2[1];
var pids = new AD_PROCESS_ID[1];
uint fetched = 0;
while (true) {
hr = processEnum.Next(1, processes, ref fetched);
if (ErrorHandler.Failed(hr)) {
return hr;
} else if (fetched == 0) {
return VSConstants.E_FAIL;
}
if (ErrorHandler.Succeeded(processes[0].GetPhysicalProcessId(pids)) && ProcessId.dwProcessId == pids[0].dwProcessId) {
ppProcess = processes[0];
return VSConstants.S_OK;
}
}
}
示例5: GetProviderProcessData
public int GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] pProcess)
{
Log.Debug("ProgramProvider: GetProviderProcessData");
if (Flags.HasFlag(enum_PROVIDER_FLAGS.PFLAG_GET_PROGRAM_NODES))
{
var process = Process.GetProcessById((int) ProcessId.dwProcessId);
foreach (ProcessModule module in process.Modules)
{
if (module.ModuleName.StartsWith("System.Management.Automation", StringComparison.OrdinalIgnoreCase))
{
var node = new ScriptProgramNode(new ScriptDebugProcess(pPort, ProcessId.dwProcessId));
var programNodes = new[] { Marshal.GetComInterfaceForObject(node, typeof(IDebugProgramNode2)) };
var destinationArray = Marshal.AllocCoTaskMem(IntPtr.Size * programNodes.Length);
Marshal.Copy(programNodes, 0, destinationArray, programNodes.Length);
pProcess[0].Fields = enum_PROVIDER_FIELDS.PFIELD_PROGRAM_NODES;
pProcess[0].ProgramNodes.Members = destinationArray;
pProcess[0].ProgramNodes.dwCount = (uint)programNodes.Length;
return VSConstants.S_OK;
}
}
}
return VSConstants.S_FALSE;
}
示例6:
// Gets the system process identifier for the process hosting a program.
int IDebugProgramNode2.GetHostPid(AD_PROCESS_ID[] pHostProcessId)
{
// Return the process id of the debugged process
pHostProcessId[0] = _processId;
return Constants.S_OK;
}
示例7:
// Gets the system process identifier for the process hosting a program.
int IDebugProgramNode2.GetHostPid(AD_PROCESS_ID[] pHostProcessId) {
// Return the process id of the debugged process
pHostProcessId[0].ProcessIdType = (uint)enum_AD_PROCESS_ID.AD_PROCESS_ID_GUID;
pHostProcessId[0].guidProcessId = mProcessID;
return VSConstants.S_OK;
}
示例8:
// Gets the system process identifier for the process hosting a program.
int IDebugProgramNode2.GetHostPid(AD_PROCESS_ID[] pHostProcessId) {
// Return the process id of the debugged process
pHostProcessId[0].ProcessIdType = (uint)enum_AD_PROCESS_ID.AD_PROCESS_ID_SYSTEM;
pHostProcessId[0].dwProcessId = (uint)m_processId;
return VSConstants.S_OK;
}
示例9: GetPhysicalProcessId
public static AD_PROCESS_ID GetPhysicalProcessId(this IDebugProcess2 process)
{
Contract.Requires<ArgumentNullException>(process != null, "process");
AD_PROCESS_ID[] processId = new AD_PROCESS_ID[1];
ErrorHandler.ThrowOnFailure(process.GetPhysicalProcessId(processId));
return processId[0];
}
示例10: GetHostPid
/// <summary>
/// Gets the system process identifier for the process hosting the program.
/// </summary>
/// <param name="pHostProcessId">Returns the system process identifier for the hosting process.</param>
/// <returns>
/// If successful, returns S_OK; otherwise, returns an error code.
/// </returns>
public override int GetHostPid( AD_PROCESS_ID[] pHostProcessId )
{
Logger.Debug( string.Empty );
pHostProcessId[0].ProcessIdType = (uint) enum_AD_PROCESS_ID.AD_PROCESS_ID_GUID;
pHostProcessId[0].guidProcessId = Process.Id;
return VSConstants.S_OK;
}
示例11: GetProcess
public static IDebugProcess2 GetProcess(this IDebugPort2 port, AD_PROCESS_ID processId)
{
Contract.Requires<ArgumentNullException>(port != null, "port");
IDebugProcess2 process;
ErrorHandler.ThrowOnFailure(port.GetProcess(processId, out process));
return process;
}
示例12: GetProviderProcessData
/// <summary>
/// Retrieves a list of running programs from a specified process.
/// </summary>
/// <param name="Flags">
/// A combination of flags from the PROVIDER_FLAGS enumeration. The following flags are typical for this call:
///
/// Flag Description
/// PFLAG_REMOTE_PORT Caller is running on remote machine.
/// PFLAG_DEBUGGEE Caller is currently being debugged (additional information about marshalling will be returned for each node).
/// PFLAG_ATTACHED_TO_DEBUGGEE Caller was attached to but not launched by the debugger.
/// PFLAG_GET_PROGRAM_NODES Caller is asking for a list of program nodes to be returned.
/// </param>
/// <param name="pPort">The port the calling process is running on.</param>
/// <param name="ProcessId">An AD_PROCESS_ID structure holding the ID of the process that contains the program in question.</param>
/// <param name="EngineFilter">An array of GUIDs for debug engines assigned to debug this process (these will be used to filter the programs that are actually returned based on what the supplied engines support; if no engines are specified, then all programs will be returned).</param>
/// <param name="pProcess">A PROVIDER_PROCESS_DATA structure that is filled in with the requested information.</param>
/// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
/// <remarks>This method is normally called by a process to obtain a list of programs running in that process. The returned information is a list of IDebugProgramNode2 objects.</remarks>
public virtual int GetProviderProcessData( enum_PROVIDER_FLAGS Flags,
IDebugDefaultPort2 pPort,
AD_PROCESS_ID ProcessId,
CONST_GUID_ARRAY EngineFilter,
PROVIDER_PROCESS_DATA[] pProcess)
{
Logger.Debug( string.Empty );
return VSConstants.E_NOTIMPL;
}
示例13:
// Gets the system process identifier for the process hosting a program.
int IDebugProgramNode2.GetHostPid(AD_PROCESS_ID[] pHostProcessId)
{
Log.Debug("ScriptProgramNode: Entering GetHostPid");
// Return the process id of the debugged process
pHostProcessId[0].ProcessIdType = (uint)enum_AD_PROCESS_ID.AD_PROCESS_ID_GUID;
pHostProcessId[0].guidProcessId = Process.Id;
return VSConstants.S_OK;
}
示例14: GetProcessId
public static int GetProcessId(this IDebugProcess2 process)
{
if (process == null)
return 0;
var id = new AD_PROCESS_ID[1];
if (process.GetPhysicalProcessId(id) != VSConstants.S_OK)
return 0;
return (int)id[0].dwProcessId;
}
示例15: GetProcess
public int GetProcess(AD_PROCESS_ID ProcessId, out IDebugProcess2 ppProcess) {
ppProcess = null;
if (ProcessId.ProcessIdType != (uint)enum_AD_PROCESS_ID.AD_PROCESS_ID_SYSTEM) {
return VSConstants.E_FAIL;
}
ppProcess = GetProcesses().FirstOrDefault(p => p.ProcessId == ProcessId.dwProcessId);
return ppProcess != null ? VSConstants.S_OK : VSConstants.E_FAIL;
}