Updated: July 2009
Validates managed module images, and notifies the operating system loader after they have been loaded.
This function returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following values.
The image is invalid. This value has the HRESULT 0xC000007BL.
The image is valid. This value has the HRESULT 0x00000000L.
In Windows XP and later versions, the operating system loader checks for managed modules by examining the COM Descriptor Directory bit in the common object file format (COFF) header. A set bit indicates a managed module. If the loader detects a managed module, it loads MsCorEE.dll and calls _CorValidateImage, which performs the following actions:
Confirms that the image is a valid managed module.
Changes the entry point in the image to an entry point in the common language runtime (CLR).
For 64-bit versions of Windows, modifies the image that is in memory by transforming it from PE32 to PE32+ format.
Returns to the loader when the managed module images are loaded.
For executable images, the operating system loader then calls the _CorExeMain function, regardless of the entry point specified in the executable. For DLL assembly images, the loader calls the _CorDllMain function.
_CorExeMain or _CorDllMain performs the following actions:
Initializes the CLR.
Locates the managed entry point from the assembly's CLR header.
The loader calls the _CorImageUnloading function when managed module images are unloaded. However, this function does not perform any action; it just returns.
Platforms: See .NET Framework System Requirements.
Library: Included 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