Donate Now Goal amount for this month: 95 USD, Received: 20 USD (21%)

+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 27

Thread: HadesMem - A Windows Memory Hacking Library for C++

  1. #1
    Join Date
    Jan 2008
    Location
    Kynox's sister's bedroom
    Posts
    772
    Thanks
    0
    Thanked 4 Times in 3 Posts
    Rep Power
    77

    HadesMem - A Windows Memory Hacking Library for C++

    Project:

    HadesMem

    Purpose:

    To provide a safe and generic C++-based memory hacking library for Windows based applications.

    Rationale:

    Previous implementations of similar libraries typically took one of either two paths:
    1. A safe explicit API. (i.e. ReadInt32, ReadFloat, ReadString, etc)
    2. An unsafe generic API. (i.e. Read<T>, where T is any type, with no restrictions.)

    The goal of this library is to combine the best of both worlds, by using templates to provide a generic and extendible API, whilst still retaining type safety.

    (Plus, I was bored and wanted a reason to play with the new C++0x type traits.)

    Example:

    Memory reads are performed using the 'Read' template member function of the 'Memory' class.

    The base definition is as follows:

    // Read memory (POD types)
    template <typename T>
    T Read(PVOID Address, typename boost::enable_if<std::is_pod<T>>::type*
    Dummy = 0) const;

    As you can see, the library makes use of type traits to ensure that any calls to this function will only succeed if 'T' is a POD type (which basically means it is safe to treat as just a 'blob of data').

    Overloads are then provided to facilitate the reading of a couple of common non-POD types:

    // Read memory (string types)
    template <typename T>
    T Read(PVOID Address, typename boost::enable_if<std::is_same<T,
    std::basic_string<typename T::value_type>>>::type* Dummy = 0) const;

    // Read memory (vector types)
    template <typename T>
    T Read(PVOID Address, typename std::vector<typename T::value_type>::
    size_type Size, typename boost::enable_if<std::is_same<T, std::vector<
    typename T::value_type>>>::type* Dummy = 0) const;

    The former template will be chosen if 'T' is a string type (std::string, std::wstring).

    The latter template will be chosen if 'T' is a vector type (std::vector<U>, where U is any arbitrary type);

    Type safety is still retained even in the latter template by passing the vector's value type to the 'Read' template.

    This means that the following code will compile and behave as expected:
    auto MyInts = MyMemory.Read<std::vector<int>>(Address, 10); // Read 10 ints from address
    auto MyStrings = MyMemory.Read<std::vector<std::string>>(Address, 10); // Read 10 null-terminated strings stored contiguously at address.
    struct SomePodType { float Blah; unsigned int Foo; char* Asdf; };
    auto MyPodType = MyMemory.Read<SomePodType>(Address); // Read a POD type from address

    And the following will fail to compile as expected:
    auto MyStreams = MyMemory.Read<std::vector<std::fstream>>(Address, 10); // Read 10 fstreams from address?? This makes no sense, and will not compile.

    One important thing to note is that whilst types like 'string' and 'vector' are used, it's assumed that the underlying type you are operating on is their low-level equivalent.

    Example, when you call read with a string template parameter, it's assuming you're trying to read a 'CharT*' (e.g. char* or wchar_t*), not an actual string object from the process.

    The same applies to vector, as it is assumed you are simply trying to read an array.

    This is done because even if you were trying to read a string object or a vector object out of memory, it would not be safe to do it using just Read<T> as non-POD types can not be safely copied in that manner. Hence, there will be no support for such dangerous operations.

    If you need to read and write complex objects then you should break them down into their lower level components and read/write those.

    The 'Write' collection of functions behave in the same manner.

    Notes:

    * HadesMem is currently a header-only library.
    * Both the interface and implementation of the library are under heavy development right now, so unfortunately breaking changes in new versions are inevitable.
    * There is currently very little documentation. Proper Doxygen based documentation will be provided eventually.
    * The current implementation is very basic as this was originally designed as a PoC which I then decided to expand upon. Regular improvements are being made though.
    * A sample application is provided, but it is quite messy as it's a heavy WIP. A proper implementation is on the way.
    * The only currently supported compiler is MSVC 10. An implementation that works with MSVC 9 is possible, however I currently have no interest in back-porting it.

    Release:

    HadesMem is released under the GPLv3* and the project is currently hosted at Google Code.

    hadesmem - Project Hosting on Google Code

    * Please note that this means it may NOT be used in any closed-source commercial applications (so if you're a cheat seller, too bad). I will re-license to you it upon request though if you have a good reason.

  2. The Following User Says Thank You to Chazwazza For This Useful Post:

    v3n0m4 (05-24-2010)

  3. #2
    Join Date
    Nov 2009
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    10

    Re: HadesMem - A Windows Memory Hacking Library for C++

    Pretty sick bro, I like the idea of using templates.

    Is it not released yet?

    Downloads page says:
    This project currently has no downloads.

  4. #3
    Join Date
    Sep 2008
    Location
    USA
    Posts
    516
    Thanks
    41
    Thanked 19 Times in 15 Posts
    Blog Entries
    1
    Rep Power
    41

    Re: HadesMem - A Windows Memory Hacking Library for C++

    Quote Originally Posted by Chazwazza View Post
    * HadesMem is currently a header-only library.
    WHEEEEEEE
    Quote Originally Posted by Chazwazza View Post
    HadesMem is released under the GPLv3* and the project is currently hosted at Google Code.
    WHEEEEEE

    I'm sure this is excellent. Thanks for releasing it under an acceptable license.
    how can i use this code? Will I must compiling it?

  5. #4
    Join Date
    Jan 2008
    Location
    Kynox's sister's bedroom
    Posts
    772
    Thanks
    0
    Thanked 4 Times in 3 Posts
    Rep Power
    77

    Re: HadesMem - A Windows Memory Hacking Library for C++

    Quote Originally Posted by ThaNatoS View Post
    Pretty sick bro, I like the idea of using templates.

    Is it not released yet?

    Downloads page says:
    I haven't pushed any official builds, you'll have to just download it from subversion. Click the 'Source' tab, it should give you the address.

  6. #5
    Join Date
    Nov 2009
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    10

    Re: HadesMem - A Windows Memory Hacking Library for C++

    oh its svn cool

  7. #6
    Join Date
    Jan 2008
    Location
    Kynox's sister's bedroom
    Posts
    772
    Thanks
    0
    Thanked 4 Times in 3 Posts
    Rep Power
    77

    Re: HadesMem - A Windows Memory Hacking Library for C++

    Basic module code and function calling code added.

  8. #7
    Join Date
    Jan 2008
    Location
    Kynox's sister's bedroom
    Posts
    772
    Thanks
    0
    Thanked 4 Times in 3 Posts
    Rep Power
    77

    Re: HadesMem - A Windows Memory Hacking Library for C++

    Basic remote disassembly support added (just a wrapper around BeaEngine).
    Bunch of improvements to everything else.

  9. #8
    Join Date
    Jan 2008
    Location
    Kynox's sister's bedroom
    Posts
    772
    Thanks
    0
    Thanked 4 Times in 3 Posts
    Rep Power
    77

    Re: HadesMem - A Windows Memory Hacking Library for C++

    Added pattern scanning library (including XML pattern file support)! (Modelled after Bobbysing's CFindPattern)
    Improved remote disassembly support (no longer relies on file mappings or relative offsets to the code section).
    Huge performance improvements to MemoryMgr::Read<T> when 'T' is a std::vector.
    Misc improvements to pretty much everything else (including quite a few bug fixes).

  10. #9
    Join Date
    Jan 2008
    Location
    Kynox's sister's bedroom
    Posts
    772
    Thanks
    0
    Thanked 4 Times in 3 Posts
    Rep Power
    77

    Re: HadesMem - A Windows Memory Hacking Library for C++

    Added DLL injection class.
    Minor misc bugfixes/changes.

  11. #10
    Join Date
    Jan 2008
    Location
    Kynox's sister's bedroom
    Posts
    772
    Thanks
    0
    Thanked 4 Times in 3 Posts
    Rep Power
    77

    Re: HadesMem - A Windows Memory Hacking Library for C++

    Started working on a manual mapper. Sigh, this is gonna be a sucky and tedious task....

  12. #11
    Join Date
    Nov 2009
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    10

    Re: HadesMem - A Windows Memory Hacking Library for C++

    Thanks for all the updates, keep it up

  13. #12
    Join Date
    Jan 2008
    Location
    Kynox's sister's bedroom
    Posts
    772
    Thanks
    0
    Thanked 4 Times in 3 Posts
    Rep Power
    77

    Re: HadesMem - A Windows Memory Hacking Library for C++

    Added basic memory scanning code.
    Fixed a bug in FindPattern (options should not be used when the initial pattern does not match).

  14. #13
    Join Date
    Jan 2008
    Location
    Kynox's sister's bedroom
    Posts
    772
    Thanks
    0
    Thanked 4 Times in 3 Posts
    Rep Power
    77

    Re: HadesMem - A Windows Memory Hacking Library for C++

    Improvements to memory scanning code (including support for scanning where T is a std::vector).
    Miscellaneous bug fixes and improvements.

  15. #14
    Join Date
    Oct 2009
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Re: HadesMem - A Windows Memory Hacking Library for C++

    this is really sweet stuff, I usually have all my different functions completely separated, not really bothering with class design or encapsulation, but I can see how this design has obvious advantages.
    And the way that this is going this looks like it could turn into a very awesome base

  16. #15
    Join Date
    Jan 2008
    Location
    Kynox's sister's bedroom
    Posts
    772
    Thanks
    0
    Thanked 4 Times in 3 Posts
    Rep Power
    77

    Re: HadesMem - A Windows Memory Hacking Library for C++

    Started adding scripting support (Lua).

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Windows Detours Library
    By Jedi_Pathetique in forum Intermediate
    Replies: 5
    Last Post: 03-31-2009, 07:37 AM
  2. Memory Hacking Software
    By L. Spiro in forum Tools
    Replies: 185
    Last Post: 12-21-2008, 03:40 AM
  3. Memory Hacking TUTZ
    By Matrix_NEO006 in forum Tutorial Requests
    Replies: 5
    Last Post: 03-11-2008, 10:13 PM
  4. memory hacking
    By jmorr212 in forum Tutorial Requests
    Replies: 6
    Last Post: 08-27-2007, 06:32 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts