description | title | ms.date | api_name | api_location | api_type | f1_keywords | helpviewer_keywords | ms.assetid | topic_type | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: _CorValidateImage Function |
_CorValidateImage Function |
03/30/2017 |
|
|
|
|
|
0117e080-05f9-4772-885d-e1847230947c |
|
Validates managed module images, and notifies the operating system loader after they have been loaded.
STDAPI _CorValidateImage (
[in] PVOID* ImageBase,
[in] LPCWSTR FileName
);
ImageBase
[in] A pointer to the starting location of the image to validate as managed code. The image must already be loaded into memory.
FileName
[in] The file name of the image.
This function returns the standard values E_INVALIDARG
, E_OUTOFMEMORY
, E_UNEXPECTED
, and E_FAIL
, as well as the following values.
Return value | Description |
---|---|
STATUS_INVALID_IMAGE_FORMAT |
The image is invalid. This value has the HRESULT 0xC000007BL. |
STATUS_SUCCESS |
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.
-
Begins execution.
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 System Requirements.
Header: Cor.h
Library: Included as a resource in MsCorEE.dll
.NET Framework Versions: [!INCLUDEnet_current_v10plus]