Debugging Tools for Windows

GetCurrentProcessExecutableName

The GetCurrentProcessExecutableName and GetCurrentProcessExecutableNameWide methods return the name of executable file loaded in the current process.

HRESULT
  IDebugSystemObjects::GetCurrentProcessExecutableName(
    OUT OPTIONAL PSTR  Buffer,
    IN ULONG  BufferSize,
    OUT OPTIONAL PULONG  ExeSize
    );

HRESULT
  IDebugSystemObjects4::GetCurrentProcessExecutableNameWide(
    OUT OPTIONAL PWSTR  Buffer,
    IN ULONG  BufferSize,
    OUT OPTIONAL PULONG  ExeSize
    );

#ifdef UNICODE
#define GetCurrentProcessExecutableNameT GetCurrentProcessExecutableNameWide
#else
#define GetCurrentProcessExecutableNameT GetCurrentProcessExecutableName
#endif

Parameters

Buffer
Receives the name of the executable file. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size in characters of the buffer Buffer.
ExeSize
Receives the size in characters of the name of the executable file. If ExeSize is NULL, this information is not returned.

Return Value

S_OK
The method was successful.
S_FALSE
The method was successful. However, the buffer was not large enough to hold the name of the executable file and it was truncated.

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

Interface Version

GetCurrentProcessExecutableName is available in all versions of IDebugSystemObjects. GetCurrentProcessExecutableNameWide is available in IDebugSystemObjects4 and later versions.

Comments

These methods are only available in user-mode debugging.

If the engine cannot determine the name of the executable file, it writes the string "?NoImage?" to the buffer.

For more information about processes, see Threads and Processes.

Requirements

Headers: Defined in Dbgeng.h. Include Dbgeng.h.

Build machine: CAPEBUILD