inline FARPROC GetProcAddressFromExport(Process const& process, Export const& e)
{
  if (e.IsForwarded())
  {
    std::string const forwarder_module_name{e.GetForwarderModule()};
    Module const forwarder_module{process,
                                  MultiByteToWideChar(forwarder_module_name)};
    if (e.IsForwardedByOrdinal())
    {
      return GetProcAddressInternal(
        process, forwarder_module.GetHandle(), e.GetForwarderOrdinal());
    }
    else
    {
      return GetProcAddressInternal(
        process, forwarder_module.GetHandle(), e.GetForwarderFunction());
    }
  }

  return AliasCast<FARPROC>(e.GetVa());
}
Beispiel #2
0
inline FARPROC
  FindProcedure(Process const& process, Module const& module, WORD ordinal)
{
  FARPROC const remote_func =
    detail::GetProcAddressInternal(process, module.GetHandle(), ordinal);
  if (!remote_func)
  {
    HADESMEM_DETAIL_THROW_EXCEPTION(
      Error{} << ErrorString{"GetProcAddressInternal failed."});
  }

  return remote_func;
}