• R/O
  • SSH
  • HTTPS

peframework: Commit


Commit MetaInfo

Revision14 (tree)
Time2017-08-02 02:13:12
Authorquiret

Log Message

- added some more helper routines

Change Summary

Incremental Difference

--- include/peloader.h (revision 13)
+++ include/peloader.h (revision 14)
@@ -1420,13 +1420,46 @@
14201420 std::string name;
14211421 mutable PESectionAllocation nameAllocEntry;
14221422
1423+ inline bool operator < ( const std::string& right ) const
1424+ {
1425+ return ( this->name < right );
1426+ }
1427+
14231428 inline bool operator < ( const mappedName& right ) const
14241429 {
1425- return ( this->name < right.name );
1430+ return operator < ( right.name );
14261431 }
14271432 };
1428- std::map <mappedName, size_t> funcNameMap;
14291433
1434+ private:
1435+ struct _funcNameMapComparator
1436+ {
1437+ inline bool operator()( const mappedName& left, const mappedName& right ) const
1438+ {
1439+ return operator() ( left.name, right.name );
1440+ }
1441+
1442+ inline bool operator()( const mappedName& left, const std::string& right ) const
1443+ {
1444+ return operator() ( left.name, right );
1445+ }
1446+
1447+ inline bool operator()( const std::string& left, const mappedName& right ) const
1448+ {
1449+ return operator() ( left, right.name );
1450+ }
1451+
1452+ inline bool operator()( const std::string& left, const std::string& right ) const
1453+ {
1454+ return ( left < right );
1455+ }
1456+
1457+ typedef std::string is_transparent;
1458+ };
1459+
1460+ public:
1461+ std::map <mappedName, size_t, _funcNameMapComparator> funcNameMap;
1462+
14301463 // Helper API.
14311464 // (all ordinals have to be local to this image ordinal base)
14321465 std::uint32_t AddExport( func&& entryToTakeOver );
@@ -1696,6 +1729,20 @@
16961729 DIR64
16971730 };
16981731
1732+ static inline eRelocType GetRelocTypeForPointerSize( size_t pointerSize )
1733+ {
1734+ if ( pointerSize == 4 )
1735+ {
1736+ return eRelocType::HIGHLOW;
1737+ }
1738+ else if ( pointerSize == 8 )
1739+ {
1740+ return eRelocType::DIR64;
1741+ }
1742+
1743+ return eRelocType::ABSOLUTE;
1744+ }
1745+
16991746 struct item
17001747 {
17011748 std::uint16_t offset : 12;
Show on old repository browser