Debugging Tools for Windows

GetRunningProcessSystemIdByExecutableName

The GetRunningProcessSystemIdByExecutableName and GetRunningProcessSystemIdByExecutableNameWide methods search for a process with a given executable file name and return its process ID.

HRESULT
  IDebugClient::GetRunningProcessSystemIdByExecutableName(
    IN ULONG64  Server,
    IN PCSTR  ExeName,
    IN ULONG  Flags,
    OUT PULONG  Id
    );

HRESULT
  IDebugClient3::GetRunningProcessSystemIdByExecutableNameWide(
    IN ULONG64  Server,
    IN PCWSTR  ExeName,
    IN ULONG  Flags,
    OUT PULONG  Id
    );

#ifdef UNICODE
#define GetRunningProcessSystemIdByExecutableNameT GetRunningProcessSystemIdByExecutableNameWide
#else
#define GetRunningProcessSystemIdByExecutableNameT GetRunningProcessSystemIdByExecutableName
#endif

Parameters

Server
Specifies the process server to search for the executable name. If Server is zero, the engine will search for the executable name among the processes running on the local computer.
ExeName
Specifies the executable file name for which to search.
Flags
Specifies a bit-set that controls how the executable name is matched. The following flags may be present:
Flag Description
DEBUG_GET_PROC_FULL_MATCH ExeName specifies the full path name of the executable file name.

If this flag is not set, this method will not use path names when searching for the process.

DEBUG_GET_PROC_ONLY_MATCH Require that only one process match the executable file name ExeName.

Id
Receives the process ID of the first process to match ExeName.

Return Value

S_OK
The method was successful.
S_FALSE
More than one process matched the executable file name in ExeName, and DEBUG_GET_PROC_ONLY_MATCH was set in Flags.
E_NOINTERFACE
No process matched the executable file name in ExeName.

This method may also return error values. See Return Values for more details.

Interface Version

GetRunningProcessSystemIdByExecutableName is available in all versions of IDebugClient. GetRunningProcessSystemIdByExecutableNameWide is available in IDebugClient3 and later versions.

Comments

This method is available only for live user-mode debugging.

For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.

Requirements

Headers: Defined in dbgeng.h. Include dbgeng.h.

See Also

GetRunningProcessSystemIds, GetRunningProcessDescription, ConnectProcessServer, AttachProcess, CreateProcessAndAttach2

Build machine: CAPEBUILD