Rediģēt

Kopīgot, izmantojot


ICorProfilerInfo3::GetModuleInfo2 Method

Given a module ID, returns the file name of the module, the ID of the module's parent assembly, and a bitmask that describes the properties of the module.

Syntax

HRESULT GetModuleInfo2(  
    [in]  ModuleID   moduleId,  
    [out] LPCBYTE    *ppBaseLoadAddress,  
    [in]  ULONG      cchName,  
    [out] ULONG      *pcchName,  
    [out, annotation("__out_ecount_part(cchName, *pcchName)")]  
          WCHAR      szName[] ,  
    [out] AssemblyID *pAssemblyId);  
    [out] DWORD                 *pdwModuleFlags);  

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 method returns, this buffer contains the file name of the module.

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

pdwModuleFlags
[out] A bitmask of values from the COR_PRF_MODULE_FLAGS enumeration that specify the properties of the module.

Remarks

For dynamic modules, the szName parameter is the metadata name of the module, and the base address is 0 (zero). The metadata name is the value in the Name column from the Module table inside metadata. This is also exposed as the Module.ScopeName property to managed code, and as the szName parameter of the IMetaDataImport::GetScopeProps method to unmanaged metadata client code.

Although the GetModuleInfo2 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.

When GetModuleInfo2 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 GetModuleInfo2 again.

Alternatively, you can first call GetModuleInfo2 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 GetModuleInfo2 again.

Requirements

Platforms: See System Requirements.

Header: CorProf.idl, CorProf.h

Library: CorGuids.lib

.NET Framework Versions: Available since 4

See also