Partager via


IHostAssemblyStore::ProvideModule Method

Resolves a module within an assembly or a linked (but not an embedded) resource file.

HRESULT ProvideModule (
    [in]  ModuleBindInfo *pBindInfo,
    [out] DWORD          *pdwModuleId,
    [out] IStream        **ppStmModuleImage,
    [out] IStream        **ppStmPDB
);

Parameters

  • pdwModuleId
    [out] A pointer to a unique identifier for the IStream containing the loaded module.
  • ppStmModuleImage
    [out] A pointer to the address of an IStream object, which contains the portable executable (PE) image to be loaded, or null if the module could not be found.
  • ppStmPDB
    [out] A pointer to the address of an IStream object, which contains the program debug (PDB) information for the requested module, or null if the .pdb file could not be found.

Return Value

HRESULT Description

S_OK

ProvideModule returned successfully.

HOST_E_CLRNOTAVAILABLE

The common language runtime (CLR) has not been loaded into a process, or the CLR is in a state in which it cannot run managed code or process the call successfully.

HOST_E_TIMEOUT

The call timed out.

HOST_E_NOT_OWNER

The caller does not own the lock.

HOST_E_ABANDONED

An event was canceled while a blocked thread or fiber was waiting on it.

E_FAIL

An unknown catastrophic failure occurred. When a method returns E_FAIL, the CLR is no longer usable within the process. Subsequent calls to hosting methods return HOST_E_CLRNOTAVAILABLE.

ERROR_FILE_NOT_FOUND

The requested assembly or linked resource could not be located.

ERROR_INSUFFICIENT_BUFFER

pdwModuleId is not large enough to contain the identifier that the host wants to return.

Remarks

The identity value returned for pdwModuleId is specified by the host. Identifiers must be unique within the lifetime of a process. The CLR uses this value as the unique identifier for the associated stream. It checks each value against the values for pAssemblyId returned by calls to IHostAssemblyStore::ProvideAssembly Method and against the values for pdwModuleId returned by other calls to ProvideModule. If the host returns the same identifier value for another IStream, the CLR checks whether the contents of that stream have already been mapped. If so, the CLR loads the existing copy of the image instead of mapping a new one. Therefore, the identifier must also not overlap with the assembly identifiers returned from ProvideAssembly.

Requirements

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

Header: MSCorEE.idl

Library: Included as a resource in MSCorEE.dll

.NET Framework Version: 2.0

See Also

Reference

ICLRAssemblyReferenceList Interface
IHostAssemblyManager Interface
IHostAssemblyStore Interface