Microsoft's documentation for the "Entry Point RVA" field in the PE optional header standard fields (section 25.2.3.1) states the field should be:
RVA of entry point, needs to point to bytes 0xFF 0x25 followed by the RVA in a section marked execute/read for EXEs or 0 for DLLs
What does this mean? I have inspected a PE file produced by the c# compiler, and found an RVA pointing to the described bytes 0xFF 0x25, but the next four bytes are 0x00402000, outside the range of relative virtual memory, not a valid RVA as near as I can tell. I know there is a relocation (section 25.3.2) pointing to this value with type "IMAGE_REL_BASED_HIGHLOW", but I don't know what that means either. I also understand that it is supposed to invoke the "_CorExeMain" (I am working with an executable) of the mscoree.dll as described in section 25.3.1, but I don't understand how.
The 0xFF 0x25 bytes encode a jump dword ptr instruction. The 0x402000 value is (in this case) the offset into the import address table (IAT) of the one native function that any .NET exe imports, namely _CorExeMain from mscoree.dll. And of course, jumping to this address starts the CLR for the process.