Debugging Tools for Windows

GetModuleByModuleName2

The GetModuleByModuleName2 and GetModuleByModuleName2Wide methods search through the process's modules for one with the specified name.

HRESULT
  IDebugSymbols3::GetModuleByModuleName2(
    IN PCSTR  Name,
    IN ULONG  StartIndex,
    IN ULONG  Flags,
    OUT OPTIONAL PULONG  Index,
    OUT OPTIONAL PULONG64  Base
    );

HRESULT
  IDebugSymbols3::GetModuleByModuleName2Wide(
    IN PCWSTR  Name,
    IN ULONG  StartIndex,
    IN ULONG  Flags,
    OUT OPTIONAL PULONG  Index,
    OUT OPTIONAL PULONG64  Base
    );

#ifdef UNICODE
#define GetModuleByModuleName2T GetModuleByModuleName2Wide
#else
#define GetModuleByModuleName2T GetModuleByModuleName2
#endif

Parameters

Name
Specifies the name of the desired module.
StartIndex
Specifies the index to start searching from.
Flags
Specifies a bit-set containing options used when searching for the module with the specified name. Flags may contain the following bit-flags:
Flag Effect
DEBUG_GETMOD_NO_LOADED_MODULES Do not search the loaded modules.
DEBUG_GETMOD_NO_UNLOADED_MODULES Do not search the unloaded modules.

Index
Receives the index of the first module with the name Name. If Index is NULL, this information is not returned.
Base
Receives the location in the target's memory address space of the base of the module. If Base is NULL, this information is not returned.

Return Value

S_OK
The method was successful.
E_INVALIDARG
One of the arguments passed in was invalid.

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

Interface Version

GetModuleByModuleName2 and GetModuleByModuleName2Wide are available in IDebugSymbols3 and later versions.

Comments

Starting at the specified index, these methods return the first module they find with the specified name. If the target has more than one module with this name, then subsequent modules can be found by repeated calls to these methods with higher values of StartIndex.

For more information about modules, see Modules.

Requirements

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

See Also

GetModuleByModuleName

Build machine: CAPEBUILD