Debugging Tools for Windows

GetModuleNameString

The GetModuleNameString and GetModuleNameStringWide methods return the name of the specified module.

HRESULT
  IDebugSymbols2::GetModuleNameString(
    IN ULONG  Which,
    IN ULONG  Index,
    IN ULONG64  Base,
    OUT OPTIONAL PSTR  Buffer,
    IN ULONG  BufferSize,
    OUT OPTIONAL PULONG  NameSize
    );

HRESULT
  IDebugSymbols3::GetModuleNameStringWide(
    IN ULONG  Which,
    IN ULONG  Index,
    IN ULONG64  Base,
    OUT OPTIONAL PWSTR  Buffer,
    IN ULONG  BufferSize,
    OUT OPTIONAL PULONG  NameSize
    );

#ifdef UNICODE
#define GetModuleNameStringT GetModuleNameStringWide
#else
#define GetModuleNameStringT GetModuleNameString
#endif

Parameters

Which
Specifies which of the module's names to return, possible values are:
Value Description
DEBUG_MODNAME_IMAGE The image name. This is the name of the executable file, including the extension. Typically, the full path is included in user mode but not in kernel mode.
DEBUG_MODNAME_MODULE The module name. This is usually just the file name without the extension. In a few cases, the module name differs significantly from the file name. For details, see Executable Image Path.
DEBUG_MODNAME_LOADED_IMAGE The loaded image name. Unless Microsoft® CodeView® symbols are present, this is the same as the image name.
DEBUG_MODNAME_SYMBOL_FILE The symbol file name. The path and name of the symbol file. If no symbols have been loaded, this is the name of the executable file instead.
DEBUG_MODNAME_MAPPED_IMAGE The mapped image name. In most cases, this is NULL. If the debugger is mapping an image file (for example, during minidump debugging), this is the name of the mapped image.

Index
Specifies the index of the module. If it is set to DEBUG_ANY_ID, the Base parameter is used to specify the location of the module instead.
Base
If Index is DEBUG_ANY_ID, specifies the location in the target's memory address space of the base of the module. Otherwise it is ignored.
Buffer
Receives the name of the module. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size in characters of the buffer Buffer.
NameSize
Receives the size in characters of the module's name. If NameSize is NULL, this information is not returned.

Return Value

S_OK
The method was successful.
S_FALSE
The method was successful. However, the size of the buffer was smaller than the size of the module's name so it was truncated to fit in the buffer.

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

Interface Version

GetModuleNameString is available in IDebugSymbols2 and later versions. GetModuleNameStringWide is available in IDebugSymbols3 and later versions.

Comments

For more information about modules, see Modules.

Requirements

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

See Also

GetModuleNames

Build machine: CAPEBUILD