Created
February 21, 2011 02:20
-
-
Save tomprince/836586 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/library/DFProcess-linux-SHM.cpp b/library/DFProcess-linux-SHM.cpp | |
index 79cf17e..db161bc 100644 | |
--- a/library/DFProcess-linux-SHM.cpp | |
+++ b/library/DFProcess-linux-SHM.cpp | |
@@ -22,7 +22,7 @@ must not be misrepresented as being the original software. | |
distribution. | |
*/ | |
#include "Internal.h" | |
-#include "dfhack/DFProcess.h" | |
+#include "ProcessInternal.h" | |
#include "dfhack/VersionInfo.h" | |
#include "dfhack/DFError.h" | |
diff --git a/library/DFProcess-linux-wine.cpp b/library/DFProcess-linux-wine.cpp | |
index b918f57..e3b4050 100644 | |
--- a/library/DFProcess-linux-wine.cpp | |
+++ b/library/DFProcess-linux-wine.cpp | |
@@ -22,7 +22,7 @@ must not be misrepresented as being the original software. | |
distribution. | |
*/ | |
#include "Internal.h" | |
-#include "dfhack/DFProcess.h" | |
+#include "ProcessInternal.h" | |
#include "dfhack/VersionInfo.h" | |
#include "dfhack/DFError.h" | |
#include <errno.h> | |
diff --git a/library/DFProcess-linux.cpp b/library/DFProcess-linux.cpp | |
index 64980f6..860f4ee 100644 | |
--- a/library/DFProcess-linux.cpp | |
+++ b/library/DFProcess-linux.cpp | |
@@ -22,7 +22,7 @@ must not be misrepresented as being the original software. | |
distribution. | |
*/ | |
#include "Internal.h" | |
-#include "dfhack/DFProcess.h" | |
+#include "ProcessInternal.h" | |
#include "dfhack/VersionInfo.h" | |
#include "dfhack/DFError.h" | |
#include <errno.h> | |
diff --git a/library/DFProcess-windows-SHM.cpp b/library/DFProcess-windows-SHM.cpp | |
index c068bb8..d01de5c 100644 | |
--- a/library/DFProcess-windows-SHM.cpp | |
+++ b/library/DFProcess-windows-SHM.cpp | |
@@ -22,7 +22,7 @@ must not be misrepresented as being the original software. | |
distribution. | |
*/ | |
#include "Internal.h" | |
-#include "dfhack/DFProcess.h" | |
+#include "ProcessInternal.h" | |
#include "dfhack/VersionInfo.h" | |
#include "dfhack/DFError.h" | |
#include "shms.h" | |
diff --git a/library/DFProcess-windows.cpp b/library/DFProcess-windows.cpp | |
index 2d318dd..72940dd 100644 | |
--- a/library/DFProcess-windows.cpp | |
+++ b/library/DFProcess-windows.cpp | |
@@ -22,7 +22,7 @@ must not be misrepresented as being the original software. | |
distribution. | |
*/ | |
#include "Internal.h" | |
-#include "dfhack/DFProcess.h" | |
+#include "ProcessInternal.h" | |
#include "dfhack/VersionInfo.h" | |
#include "dfhack/DFError.h" | |
#include <string.h> | |
diff --git a/library/DFProcessEnumerator.cpp b/library/DFProcessEnumerator.cpp | |
index 5105be1..fdd96ec 100644 | |
--- a/library/DFProcessEnumerator.cpp | |
+++ b/library/DFProcessEnumerator.cpp | |
@@ -23,10 +23,10 @@ distribution. | |
*/ | |
#include "Internal.h" | |
+#include "ProcessInternal.h" | |
#include "dfhack/VersionInfoFactory.h" | |
#include "dfhack/DFProcessEnumerator.h" | |
-#include "dfhack/DFProcess.h" | |
#include "dfhack/VersionInfo.h" | |
diff --git a/library/include/dfhack/DFProcess.h b/library/include/dfhack/DFProcess.h | |
index 7044e80..d0159cc 100644 | |
--- a/library/include/dfhack/DFProcess.h | |
+++ b/library/include/dfhack/DFProcess.h | |
@@ -174,203 +174,5 @@ namespace DFHack | |
virtual bool SetAndWait (uint32_t state) = 0; | |
}; | |
- //////////////////////////////////////////////////////////////////////////// | |
- // Compiler appeasement area. Not worth a look really... // | |
- //////////////////////////////////////////////////////////////////////////// | |
- | |
- class DFHACK_EXPORT NormalProcess : virtual public Process | |
- { | |
- friend class ProcessEnumerator; | |
- class Private; | |
- private: | |
- Private * const d; | |
- public: | |
- NormalProcess(uint32_t pid, std::vector <VersionInfo *> & known_versions); | |
- ~NormalProcess(); | |
- bool attach(); | |
- bool detach(); | |
- | |
- bool suspend(); | |
- bool asyncSuspend(); | |
- bool resume(); | |
- bool forceresume(); | |
- | |
- uint64_t readQuad(const uint32_t address); | |
- void readQuad(const uint32_t address, uint64_t & value); | |
- void writeQuad(const uint32_t address, const uint64_t value); | |
- | |
- uint32_t readDWord(const uint32_t address); | |
- void readDWord(const uint32_t address, uint32_t & value); | |
- void writeDWord(const uint32_t address, const uint32_t value); | |
- | |
- float readFloat(const uint32_t address); | |
- void readFloat(const uint32_t address, float & value); | |
- | |
- uint16_t readWord(const uint32_t address); | |
- void readWord(const uint32_t address, uint16_t & value); | |
- void writeWord(const uint32_t address, const uint16_t value); | |
- | |
- uint8_t readByte(const uint32_t address); | |
- void readByte(const uint32_t address, uint8_t & value); | |
- void writeByte(const uint32_t address, const uint8_t value); | |
- | |
- void read( uint32_t address, uint32_t length, uint8_t* buffer); | |
- void write(uint32_t address, uint32_t length, uint8_t* buffer); | |
- | |
- const std::string readSTLString (uint32_t offset); | |
- size_t readSTLString (uint32_t offset, char * buffer, size_t bufcapacity); | |
- void writeSTLString(const uint32_t address, const std::string writeString){}; | |
- // get class name of an object with rtti/type info | |
- std::string readClassName(uint32_t vptr); | |
- | |
- const std::string readCString (uint32_t offset); | |
- | |
- bool isSuspended(); | |
- bool isAttached(); | |
- bool isIdentified(); | |
- | |
- bool getThreadIDs(std::vector<uint32_t> & threads ); | |
- void getMemRanges(std::vector<t_memrange> & ranges ); | |
- VersionInfo *getDescriptor(); | |
- int getPID(); | |
- std::string getPath(); | |
- // get module index by name and version. bool 1 = error | |
- bool getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT) { OUTPUT=0; return false;}; | |
- // get the SHM start if available | |
- char * getSHMStart (void){return 0;}; | |
- // set a SHM command and wait for a response | |
- bool SetAndWait (uint32_t state){return false;}; | |
- }; | |
- | |
- class DFHACK_EXPORT SHMProcess : virtual public Process | |
- { | |
- friend class ProcessEnumerator; | |
- class Private; | |
- private: | |
- Private * const d; | |
- | |
- public: | |
- SHMProcess(uint32_t PID, std::vector <VersionInfo *> & known_versions); | |
- ~SHMProcess(); | |
- // Set up stuff so we can read memory | |
- bool attach(); | |
- bool detach(); | |
- | |
- bool suspend(); | |
- bool asyncSuspend(); | |
- bool resume(); | |
- bool forceresume(); | |
- | |
- uint64_t readQuad(const uint32_t address); | |
- void readQuad(const uint32_t address, uint64_t & value); | |
- void writeQuad(const uint32_t address, const uint64_t value); | |
- | |
- uint32_t readDWord(const uint32_t address); | |
- void readDWord(const uint32_t address, uint32_t & value); | |
- void writeDWord(const uint32_t address, const uint32_t value); | |
- | |
- float readFloat(const uint32_t address); | |
- void readFloat(const uint32_t address, float & value); | |
- | |
- uint16_t readWord(const uint32_t address); | |
- void readWord(const uint32_t address, uint16_t & value); | |
- void writeWord(const uint32_t address, const uint16_t value); | |
- | |
- uint8_t readByte(const uint32_t address); | |
- void readByte(const uint32_t address, uint8_t & value); | |
- void writeByte(const uint32_t address, const uint8_t value); | |
- | |
- void read( uint32_t address, uint32_t length, uint8_t* buffer); | |
- void write(uint32_t address, uint32_t length, uint8_t* buffer); | |
- | |
- const std::string readSTLString (uint32_t offset); | |
- size_t readSTLString (uint32_t offset, char * buffer, size_t bufcapacity); | |
- void writeSTLString(const uint32_t address, const std::string writeString); | |
- // get class name of an object with rtti/type info | |
- std::string readClassName(uint32_t vptr); | |
- | |
- const std::string readCString (uint32_t offset); | |
- | |
- bool isSuspended(); | |
- bool isAttached(); | |
- bool isIdentified(); | |
- | |
- bool getThreadIDs(std::vector<uint32_t> & threads ); | |
- void getMemRanges(std::vector<t_memrange> & ranges ); | |
- VersionInfo *getDescriptor(); | |
- int getPID(); | |
- std::string getPath(); | |
- // get module index by name and version. bool 1 = error | |
- bool getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT); | |
- // get the SHM start if available | |
- char * getSHMStart (void); | |
- bool SetAndWait (uint32_t state); | |
- }; | |
- | |
-#ifdef LINUX_BUILD | |
- class DFHACK_EXPORT WineProcess : virtual public Process | |
- { | |
- friend class ProcessEnumerator; | |
- class Private; | |
- private: | |
- Private * const d; | |
- | |
- public: | |
- WineProcess(uint32_t pid, std::vector <VersionInfo *> & known_versions); | |
- ~WineProcess(); | |
- bool attach(); | |
- bool detach(); | |
- | |
- bool suspend(); | |
- bool asyncSuspend(); | |
- bool resume(); | |
- bool forceresume(); | |
- | |
- uint64_t readQuad(const uint32_t address); | |
- void readQuad(const uint32_t address, uint64_t & value); | |
- void writeQuad(const uint32_t address, const uint64_t value); | |
- | |
- uint32_t readDWord(const uint32_t address); | |
- void readDWord(const uint32_t address, uint32_t & value); | |
- void writeDWord(const uint32_t address, const uint32_t value); | |
- | |
- float readFloat(const uint32_t address); | |
- void readFloat(const uint32_t address, float & value); | |
- | |
- uint16_t readWord(const uint32_t address); | |
- void readWord(const uint32_t address, uint16_t & value); | |
- void writeWord(const uint32_t address, const uint16_t value); | |
- | |
- uint8_t readByte(const uint32_t address); | |
- void readByte(const uint32_t address, uint8_t & value); | |
- void writeByte(const uint32_t address, const uint8_t value); | |
- | |
- void read( uint32_t address, uint32_t length, uint8_t* buffer); | |
- void write(uint32_t address, uint32_t length, uint8_t* buffer); | |
- | |
- const std::string readSTLString (uint32_t offset); | |
- size_t readSTLString (uint32_t offset, char * buffer, size_t bufcapacity); | |
- void writeSTLString(const uint32_t address, const std::string writeString){}; | |
- // get class name of an object with rtti/type info | |
- std::string readClassName(uint32_t vptr); | |
- | |
- const std::string readCString (uint32_t offset); | |
- | |
- bool isSuspended(); | |
- bool isAttached(); | |
- bool isIdentified(); | |
- | |
- bool getThreadIDs(std::vector<uint32_t> & threads ); | |
- void getMemRanges(std::vector<t_memrange> & ranges ); | |
- VersionInfo *getDescriptor(); | |
- int getPID(); | |
- // get module index by name and version. bool 1 = error | |
- bool getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT) {OUTPUT=0; return false;}; | |
- // get the SHM start if available | |
- char * getSHMStart (void){return 0;}; | |
- bool SetAndWait (uint32_t state){return false;}; | |
- std::string getPath(); | |
- }; | |
-#endif | |
} | |
#endif | |
diff --git a/library/private/ProcessInternal.h b/library/private/ProcessInternal.h | |
new file mode 100644 | |
index 0000000..dccd409 | |
--- /dev/null | |
+++ b/library/private/ProcessInternal.h | |
@@ -0,0 +1,231 @@ | |
+/* | |
+www.sourceforge.net/projects/dfhack | |
+Copyright (c) 2009 Petr Mrázek (peterix), Kenneth Ferland (Impaler[WrG]), dorf | |
+ | |
+This software is provided 'as-is', without any express or implied | |
+warranty. In no event will the authors be held liable for any | |
+damages arising from the use of this software. | |
+ | |
+Permission is granted to anyone to use this software for any | |
+purpose, including commercial applications, and to alter it and | |
+redistribute it freely, subject to the following restrictions: | |
+ | |
+1. The origin of this software must not be misrepresented; you must | |
+not claim that you wrote the original software. If you use this | |
+software in a product, an acknowledgment in the product documentation | |
+would be appreciated but is not required. | |
+ | |
+2. Altered source versions must be plainly marked as such, and | |
+must not be misrepresented as being the original software. | |
+ | |
+3. This notice may not be removed or altered from any source | |
+distribution. | |
+*/ | |
+ | |
+#ifndef PROCESS_INTERNAL_H_INCLUDED | |
+#define PROCESS_INTERNAL_H_INCLUDED | |
+ | |
+#include "dfhack/DFProcess.h" | |
+ | |
+namespace DFHack | |
+{ | |
+ //////////////////////////////////////////////////////////////////////////// | |
+ // Compiler appeasement area. Not worth a look really... // | |
+ //////////////////////////////////////////////////////////////////////////// | |
+ | |
+ class DFHACK_EXPORT NormalProcess : public Process | |
+ { | |
+ friend class ProcessEnumerator; | |
+ class Private; | |
+ private: | |
+ Private * const d; | |
+ public: | |
+ NormalProcess(uint32_t pid, std::vector <VersionInfo *> & known_versions); | |
+ ~NormalProcess(); | |
+ bool attach(); | |
+ bool detach(); | |
+ | |
+ bool suspend(); | |
+ bool asyncSuspend(); | |
+ bool resume(); | |
+ bool forceresume(); | |
+ | |
+ uint64_t readQuad(const uint32_t address); | |
+ void readQuad(const uint32_t address, uint64_t & value); | |
+ void writeQuad(const uint32_t address, const uint64_t value); | |
+ | |
+ uint32_t readDWord(const uint32_t address); | |
+ void readDWord(const uint32_t address, uint32_t & value); | |
+ void writeDWord(const uint32_t address, const uint32_t value); | |
+ | |
+ float readFloat(const uint32_t address); | |
+ void readFloat(const uint32_t address, float & value); | |
+ | |
+ uint16_t readWord(const uint32_t address); | |
+ void readWord(const uint32_t address, uint16_t & value); | |
+ void writeWord(const uint32_t address, const uint16_t value); | |
+ | |
+ uint8_t readByte(const uint32_t address); | |
+ void readByte(const uint32_t address, uint8_t & value); | |
+ void writeByte(const uint32_t address, const uint8_t value); | |
+ | |
+ void read( uint32_t address, uint32_t length, uint8_t* buffer); | |
+ void write(uint32_t address, uint32_t length, uint8_t* buffer); | |
+ | |
+ const std::string readSTLString (uint32_t offset); | |
+ size_t readSTLString (uint32_t offset, char * buffer, size_t bufcapacity); | |
+ void writeSTLString(const uint32_t address, const std::string writeString){}; | |
+ // get class name of an object with rtti/type info | |
+ std::string readClassName(uint32_t vptr); | |
+ | |
+ const std::string readCString (uint32_t offset); | |
+ | |
+ bool isSuspended(); | |
+ bool isAttached(); | |
+ bool isIdentified(); | |
+ | |
+ bool getThreadIDs(std::vector<uint32_t> & threads ); | |
+ void getMemRanges(std::vector<t_memrange> & ranges ); | |
+ VersionInfo *getDescriptor(); | |
+ int getPID(); | |
+ std::string getPath(); | |
+ // get module index by name and version. bool 1 = error | |
+ bool getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT) { OUTPUT=0; return false;}; | |
+ // get the SHM start if available | |
+ char * getSHMStart (void){return 0;}; | |
+ // set a SHM command and wait for a response | |
+ bool SetAndWait (uint32_t state){return false;}; | |
+ }; | |
+ | |
+ class DFHACK_EXPORT SHMProcess : public Process | |
+ { | |
+ friend class ProcessEnumerator; | |
+ class Private; | |
+ private: | |
+ Private * const d; | |
+ | |
+ public: | |
+ SHMProcess(uint32_t PID, std::vector <VersionInfo *> & known_versions); | |
+ ~SHMProcess(); | |
+ // Set up stuff so we can read memory | |
+ bool attach(); | |
+ bool detach(); | |
+ | |
+ bool suspend(); | |
+ bool asyncSuspend(); | |
+ bool resume(); | |
+ bool forceresume(); | |
+ | |
+ uint64_t readQuad(const uint32_t address); | |
+ void readQuad(const uint32_t address, uint64_t & value); | |
+ void writeQuad(const uint32_t address, const uint64_t value); | |
+ | |
+ uint32_t readDWord(const uint32_t address); | |
+ void readDWord(const uint32_t address, uint32_t & value); | |
+ void writeDWord(const uint32_t address, const uint32_t value); | |
+ | |
+ float readFloat(const uint32_t address); | |
+ void readFloat(const uint32_t address, float & value); | |
+ | |
+ uint16_t readWord(const uint32_t address); | |
+ void readWord(const uint32_t address, uint16_t & value); | |
+ void writeWord(const uint32_t address, const uint16_t value); | |
+ | |
+ uint8_t readByte(const uint32_t address); | |
+ void readByte(const uint32_t address, uint8_t & value); | |
+ void writeByte(const uint32_t address, const uint8_t value); | |
+ | |
+ void read( uint32_t address, uint32_t length, uint8_t* buffer); | |
+ void write(uint32_t address, uint32_t length, uint8_t* buffer); | |
+ | |
+ const std::string readSTLString (uint32_t offset); | |
+ size_t readSTLString (uint32_t offset, char * buffer, size_t bufcapacity); | |
+ void writeSTLString(const uint32_t address, const std::string writeString); | |
+ // get class name of an object with rtti/type info | |
+ std::string readClassName(uint32_t vptr); | |
+ | |
+ const std::string readCString (uint32_t offset); | |
+ | |
+ bool isSuspended(); | |
+ bool isAttached(); | |
+ bool isIdentified(); | |
+ | |
+ bool getThreadIDs(std::vector<uint32_t> & threads ); | |
+ void getMemRanges(std::vector<t_memrange> & ranges ); | |
+ VersionInfo *getDescriptor(); | |
+ int getPID(); | |
+ std::string getPath(); | |
+ // get module index by name and version. bool 1 = error | |
+ bool getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT); | |
+ // get the SHM start if available | |
+ char * getSHMStart (void); | |
+ bool SetAndWait (uint32_t state); | |
+ }; | |
+ | |
+#ifdef LINUX_BUILD | |
+ class DFHACK_EXPORT WineProcess : public Process | |
+ { | |
+ friend class ProcessEnumerator; | |
+ class Private; | |
+ private: | |
+ Private * const d; | |
+ | |
+ public: | |
+ WineProcess(uint32_t pid, std::vector <VersionInfo *> & known_versions); | |
+ ~WineProcess(); | |
+ bool attach(); | |
+ bool detach(); | |
+ | |
+ bool suspend(); | |
+ bool asyncSuspend(); | |
+ bool resume(); | |
+ bool forceresume(); | |
+ | |
+ uint64_t readQuad(const uint32_t address); | |
+ void readQuad(const uint32_t address, uint64_t & value); | |
+ void writeQuad(const uint32_t address, const uint64_t value); | |
+ | |
+ uint32_t readDWord(const uint32_t address); | |
+ void readDWord(const uint32_t address, uint32_t & value); | |
+ void writeDWord(const uint32_t address, const uint32_t value); | |
+ | |
+ float readFloat(const uint32_t address); | |
+ void readFloat(const uint32_t address, float & value); | |
+ | |
+ uint16_t readWord(const uint32_t address); | |
+ void readWord(const uint32_t address, uint16_t & value); | |
+ void writeWord(const uint32_t address, const uint16_t value); | |
+ | |
+ uint8_t readByte(const uint32_t address); | |
+ void readByte(const uint32_t address, uint8_t & value); | |
+ void writeByte(const uint32_t address, const uint8_t value); | |
+ | |
+ void read( uint32_t address, uint32_t length, uint8_t* buffer); | |
+ void write(uint32_t address, uint32_t length, uint8_t* buffer); | |
+ | |
+ const std::string readSTLString (uint32_t offset); | |
+ size_t readSTLString (uint32_t offset, char * buffer, size_t bufcapacity); | |
+ void writeSTLString(const uint32_t address, const std::string writeString){}; | |
+ // get class name of an object with rtti/type info | |
+ std::string readClassName(uint32_t vptr); | |
+ | |
+ const std::string readCString (uint32_t offset); | |
+ | |
+ bool isSuspended(); | |
+ bool isAttached(); | |
+ bool isIdentified(); | |
+ | |
+ bool getThreadIDs(std::vector<uint32_t> & threads ); | |
+ void getMemRanges(std::vector<t_memrange> & ranges ); | |
+ VersionInfo *getDescriptor(); | |
+ int getPID(); | |
+ // get module index by name and version. bool 1 = error | |
+ bool getModuleIndex (const char * name, const uint32_t version, uint32_t & OUTPUT) {OUTPUT=0; return false;}; | |
+ // get the SHM start if available | |
+ char * getSHMStart (void){return 0;}; | |
+ bool SetAndWait (uint32_t state){return false;}; | |
+ std::string getPath(); | |
+ }; | |
+#endif | |
+} | |
+#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment