Greetings,

I'm writing an application that uses the Profiler API and the unmanaged
metadata API to obtain metadata for modules from the
ICorProfilerCallback::ModuleLoadFinished() event as well as for executables
that I map into memory myself. In both cases I'm able to obtain the
IModuleInfo iface and enumerate the methods.

I've noticed that the method RVA returned by GetMethodProps() is sometimes a
real RVA and sometimes an offset. This causes havok because I'm trying to
access the method's bytecode in memory. If its an RVA I have to call
ImageRvaToVa(), otherwise I just have to add it to the base load address.

It seems to be treated as an offset if the CLR has loaded the module and as
a RVA if the file was manually mapped into memory. Is this true? Strangely,
Rotor always treats it as an RVA. If you look at CorMap::ReadHeaders() in
cormap.cpp in Rotor you'll see a magic flag called bDataMap that proves that
RVAs have a dual nature.

Right now I have a kludge that calls ImageRvaToVa() and examines the first
byte of the returned ptr. If its not TinyFormat or FatFormat then I treat
the RVA as an offset. Is there a way, given a module's base load address, or
perhaps a flag in the MethodProps, to determine if its RVAs are really RVAs
or if they are offsets?

Thanks!

\\Marc