memory.hpp by Flyte

On lunes, 27 de diciembre de 2010 0 comentarios

memory.hpp by Flyte

This interesting post is for people that want to make a memory editor...

Quote:
I feel sorry for you, so:
To user that was lost (iPromise) by Flyte.....

Link: memory.hpp

Your missions, should you choose to accept them:

1. Write a CachedRemoteMemory class that extends RemoteMemory for faster scans.
2. Add a cache for the value that was found on the last scan, enabling scans such as 'incremented'.
3. Understand what is going on... shouldn't be hard for one who has mastered C++ (lol). No comments, since comments are ezmode.


(As noted in the file, largely untested so something is probably broken somewhere... I suppose that's what you get for a 1 hour hack job.)

Here is how to use (part of) it.

Code:
#include 
#include 
#include "memory.hpp"

void ExampleOne(int i) {
   std::list
items; Scanner scanner; std::cout << "Starting..." << std::endl; if(scanner.Scan(i, items)) { do { std::cout << "Scanning..." << std::endl; } while(scanner.ScanNext(++i, items) > 1); if(items.size() == 1) { std::cout << "Done." << std::endl; std::cout << "i = " << i << std::endl << "&i = " << &i << std::endl; Address addr = items.front(); std::cout << "addr = " << (int)addr << std::endl << "&addr = " << (void *)addr.Value() << std::endl; std::cout << "Setting addr = " << i + 42 << std::endl; addr = i + 42; std::cout << "i = " << i << std::endl; } else { std::cout << "Something broke. Go fix it." << std::endl; } } } bool GreaterThan(int a, int b) { return a > b; } bool LessThan(int a, int b) { return a < b; } void ExampleTwo(int i) { std::list
items; Scanner scanner; std::cout << "Starting..." << std::endl; if(scanner.Scan(i-10, items, GreaterThan)) { std::cout << items.size() << " items greater than " << i-10 << "." << std::endl; if(scanner.ScanNext(i+10, items, LessThan)) { std::cout << items.size() << " items also less than " << i+10 << "." << std::endl; if(scanner.ScanNext(i-2, items, GreaterThan)) { std::cout << items.size() << " items also greater than " << i-2 << "." << std::endl; if(scanner.ScanNext(i+2, items, LessThan)) { std::cout << items.size() << " items also less than " << i+2 << "." << std::endl; } } } } } void PrintTestHeader(int i) { std::cout << std::endl << "Test " << i << std::endl << "--------------" << std::endl; } int main() { // Fast PrintTestHeader(1); ExampleOne(3); // Slow - Will probably crash (bad_alloc) on a big process. You need to store results in a file for such a situation. PrintTestHeader(2); ExampleOne(0); // Same as above. PrintTestHeader(3); ExampleTwo(100); return 0; }
Post: Cheat Engine :: View topic - Random Access Violations

0 comentarios:

Publicar un comentario