Debugging Tools for Windows

GetNumberModules

The GetNumberModules method returns the number of modules in the current process's module list.

HRESULT
  IDebugSymbols::GetNumberModules(
    OUT PULONG  Loaded,
    OUT PULONG  Unloaded
    );

Parameters

Loaded
Receives the number of loaded modules in the current process's module list.
Unloaded
Receives the number of unloaded modules in the current process's module list. This number will be zero if the version of Microsoft® Windows® running on the target computer does not track unloaded modules.

Return Value

S_OK
The method was successful.

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

Interface Version

GetNumberModules is available in all versions of IDebugSymbols.

Comments

The list of loaded and unloaded modules is maintained by Windows. The engine caches a copy of this list, but it may become out of date. Reload can be used to synchronize the engine's copy of the list with the list maintained by Windows.

The unloaded modules are not tracked in all versions of Windows. Unloaded modules are tracked for user-mode targets in Microsoft Windows Server™ 2003 and later; for kernel-mode targets, the unloaded modules are tracked in earlier Windows versions as well. When they are tracked they are indexed after the loaded modules. Unloaded modules can be used to analyze failures caused by an attempt to call unloaded code.

For more information about modules, see Modules.

Requirements

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

See Also

GetModuleByIndex

Build machine: CAPEBUILD