_CorValidateImage Function

Notifies the loader when the managed module images are loaded.

In Windows XP, the operating system loader checks for managed modules by examining a bit in the common object file format (COFF) header. A set bit denotes a managed module. If the loader detects managed modules, it loads Mscoree.dll. _CorValidateImage notifies the loader when the managed module images are loaded, and _CorImageUnloading Function notifies the loader when the managed module images are unloaded. _CorValidateImage performs the following actions:

  1. Ensures that the code is valid managed code.

  2. Changes the entry point in the image to an entry point in the runtime.

For 64-bit versions of Windows, _CorValidateImage modifies the image that is in memory by transforming it from PE32 to PE32+ format.

STDAPI _CorValidateImage ( 
      PVOID* ImageBase,
      LPCWSTR FileName
);

Parameters

Parameter Description

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.

Return Value

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following values.

  • 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.

Requirements

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

Header: Cor.h

Library: Included as a resource in Mscoree.dll

.NET Framework Version: 2.0, 1.1, 1.0

See Also

Other Resources

Metadata Global Static Functions