davideuler / ontl

Automatically exported from code.google.com/p/ontl
1 stars 0 forks source link

pe::image::find_export and ordinals #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The pe::image class member function

    template<typename DllFinder>
    void * find_export(const char * exp, DllFinder find_dll) const

does not support exporting by ordinals because 
uint32_t ordinal(const image * pe, const char name[]) const 
is always called internally. (however this function was designed to 
support forward-export which was not an option for ordinals)

This is fixed in the x64 branch.

I guess the problem is not in this function itself but in abcence of 
another member overload:

      /// runtime-polymorphic version 
      __forceinline
      uint32_t ordinal(const image * pe, const void * ord) const
      {
        return uintptr_t(ord) <= 0xffff ?
          ordinal(pe, 
static_cast<uint16_t>(reinterpret_cast<uintptr_t>(ord))) :
          ordinal(pe, reinterpret_cast<const char*>(ord));
      }

So the solution for template<>find_export should be to change the first 
argument to const void *

Original issue reported on code.google.com by ntl.supp...@gmail.com on 13 May 2008 at 12:18

GoogleCodeExporter commented 9 years ago
at revision 144

Original comment by ntl.supp...@gmail.com on 18 May 2008 at 10:24

GoogleCodeExporter commented 9 years ago

Original comment by icestudent@gmail.com on 4 Mar 2009 at 3:24

GoogleCodeExporter commented 9 years ago
This still exists in x64 branch. This issue also gives few unnecessary ordinal()
overloads like template<> one and introduced in r631/r635

Original comment by ntl.supp...@gmail.com on 20 Oct 2009 at 11:46