Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef PROCESSMODDER_H
- #define PROCESSMODDER_H
- #include <Windows.h>
- const DWORD PROCESS_ALL_LEGACY_ACCESS = PROCESS_CREATE_PROCESS|PROCESS_CREATE_THREAD|PROCESS_DUP_HANDLE|
- PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION|PROCESS_SET_QUOTA|
- PROCESS_SUSPEND_RESUME|PROCESS_TERMINATE|PROCESS_VM_OPERATION|
- PROCESS_VM_READ|PROCESS_VM_WRITE|SYNCHRONIZE;
- class ProcessModder
- {
- public:
- // Constructors / Destructors
- ProcessModder() : hookedProcess(NULL) { } // Default constructor
- ~ProcessModder() { close(); } // Destructor
- // Attempts to find and hook the process with the given information
- bool openWithProcessID(DWORD processID);
- bool openWithProcessName(const char* szProcessName);
- bool openWithWindowName(const char* szWindowName);
- bool openWithProcessHandle(HANDLE hProcess);
- // Returns true if a process has been hooked and remains open
- bool isOpen();
- // Cleans up process handles
- void close();
- // Replaces the item at address with 'value'
- template <typename valueType>
- bool writeMem(UINT address, valueType value);
- // Reads the item at address into 'value'
- template <typename valueType>
- bool readMem(UINT address, valueType &value);
- protected:
- // Hooks the process with the given process ID
- bool Hook(DWORD processID);
- /** Finds the process ID that corresponding to the name
- returns true and sets processID if successful */
- bool FindProcess(const char* szProcessName, DWORD &processID);
- private:
- HANDLE hookedProcess; // Handle to the currently hooked process
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement