> > The image flags I meant were CorLoadOSMap, CorLoadOSImage, and > > CorLoadDataMap (as opposed to CorLoadImageMap), which causes the bug to > > occur. Because only when a module has one of these flags, the > > Cor_RtlImageRvaToOffset method is called. I was just interested in what > > these flags actually mean. > > I don't know what they mean exactly, either. But I think "all" code > assemblies have 1 of these 3 flags. mscorlib has CorLoadOSImage, user > assembly with main method has CorLoadDataMap (due to earlier PE file > load for verification) and all other assemblies have CorLoadOSMap.
These flags describe how the PE file was loaded into memory. There are two basic ways how to load the PE file into memory. (1) Load it as flat file. The memory will look exactly like the content of the file. (2) Map it into memory the PE file way. The PE file is composed from sections. These sections are without holes between them in the file, but they are mapped with holes between them into memory. Use Google to find about the PE file format if you want to know details or understand why. In the .NET Framework on Windows, (2) has variants depending on whether the LoadLibrary call mapped the PE file into the memory or whether the mapping into memory was done by hand. Also, the relocations can be applied optionally. The CorLoadXXX flags identify the various flavors of loading PE files into memory. Rotor can't ever call LoadLibrary to load managed PE file because of it is not portable. Thus, we have twisted the meaning of these flags to avoid the LoadLibrary codepath, but we unfortunately managed to break the profiler along the way. I won't try to describe the meaning of the flags in Rotor since it is twisted and you will easily find counter example to my explanation. The good news is that this code was radically cleaned up in the live Microsoft source code. It is pleasure to read and understand now, and it is guaranteed to work correctly for Rotor. The bad news is that the cleaned up version is unlikely to be published anytime soon since it is work in progress. -Jan This posting is provided "AS IS" with no warranties, and confers no rights.