Share via


ICorProfilerInfo::GetModuleInfo Method

Accepts an module ID. Returns the file name of the module and the ID of the module's parent assembly.

HRESULT GetModuleInfo(
    [in]  ModuleID   moduleId,
    [out] LPCBYTE    *ppBaseLoadAddress,
    [in]  ULONG      cchName,
    [out] ULONG      *pcchName,
    [out, size_is(cchName), length_is(*pcchName)]
          WCHAR      szName[] ,
    [out] AssemblyID *pAssemblyId);

Parameters

  • moduleId
    [in] The ID of the module for which information will be retrieved.

  • ppBaseLoadAddress
    [out] The base address at which the module is loaded.

  • cchName
    [in] The length, in characters, of the szName return buffer.

  • pcchName
    [out] A pointer to the total character length of the module's file name that is returned.

  • szName
    [out] A caller-provided wide character buffer. When the function returns, it will contain the file name of the module.

  • pAssemblyId
    [out] A pointer to the ID of the module's parent assembly.

Remarks

For dynamic modules, the szName parameter will be an empty string, and the base address will be 0 (zero).

Although the GetModuleInfo method may be called as soon as the module's ID exists, the ID of the parent assembly will not be available until the profiler receives the ICorProfilerCallback::ModuleAttachedToAssembly callback.

After GetModuleInfo returns, you must verify that the szName buffer was large enough to contain the full file name of the module. To do this, compare the value that pcchName points to with the value of the cchName parameter. If pcchName points to a value that is larger than cchName, allocate a larger szName buffer, update cchName with the new, larger size, and call GetModuleInfo again.

Alternatively, you can first call GetModuleInfo with a zero-length szName buffer to obtain the correct buffer size. You can then set the buffer size to the value returned in pcchName and call GetModuleInfo again.

For more information about these two approaches, see Caller-Allocated Buffers.

Requirements

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: CorProf.idl

Library: CorGuids.lib

.NET Framework Version: 2.0

See Also

Concepts

ICorProfilerInfo Interface

Profiling Interfaces

Profiling (Unmanaged API Reference)