Opens an existing, on-disk file and maps its metadata into memory.
HRESULT OpenScope ( [in] LPCWSTR szScope, [in] DWORD dwOpenFlags, [in] REFIID riid, [out] IUnknown **ppIUnk );
[in] The name of the file to be opened. The file must contain common language runtime (CLR) metadata.
[in] A value of the CorOpenFlags enumeration to specify the mode (read, write, and so on) for opening.
[in] The IID of the desired metadata interface to be returned; the caller will use the interface to import (read) or emit (write) metadata.
The value of riid must specify one of the "import" or "emit" interfaces. Valid values are IID_IMetaDataEmit, IID_IMetaDataImport, IID_IMetaDataAssemblyEmit, IID_IMetaDataAssemblyImport, IID_IMetaDataEmit2, or IID_IMetaDataImport2.
[out] The pointer to the returned interface.
The in-memory copy of the metadata can be queried using methods from one of the "import" interfaces, or added to using methods from the one of the "emit" interfaces.
If the target file does not contain CLR metadata, the OpenScope method will fail.
In the .NET Framework version 1.0 and version 1.1, if a scope is opened with dwOpenFlags set to ofRead, it is eligible for sharing. That is, if subsequent calls to OpenScope pass in the name of a file that was previously opened, the existing scope is reused and a new set of data structures is not created. However, problems can arise due to this sharing.
In the .NET Framework version 2.0, scopes opened with dwOpenFlags set to ofRead are no longer shared. Use the ofReadOnly value to allow the scope to be shared. When a scope is shared, queries that use "read/write" metadata interfaces will fail.
Platforms: See .NET Framework System Requirements.
Library: Used as a resource in MsCorEE.dll
.NET Framework Versions: 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0, 1.1, 1.0