diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-07-11 15:50:46 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-07-11 15:50:46 +0000 |
commit | 14c7f45cdae826f88dc539c8c38dd95caf305731 (patch) | |
tree | 832da054b7cfb2dc6fd63339af736625f31d21aa /utils/zenutils/libraries/pelib-0.9/pelib/RelocationsDirectory.h | |
parent | 7c84ede3781c27db73403bd6302f320c76a58c8c (diff) | |
download | rockbox-14c7f45cdae826f88dc539c8c38dd95caf305731.tar.gz rockbox-14c7f45cdae826f88dc539c8c38dd95caf305731.zip |
Add zook's ZenUtils to SVN
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18010 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/zenutils/libraries/pelib-0.9/pelib/RelocationsDirectory.h')
-rwxr-xr-x | utils/zenutils/libraries/pelib-0.9/pelib/RelocationsDirectory.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/utils/zenutils/libraries/pelib-0.9/pelib/RelocationsDirectory.h b/utils/zenutils/libraries/pelib-0.9/pelib/RelocationsDirectory.h new file mode 100755 index 0000000000..60383381a3 --- /dev/null +++ b/utils/zenutils/libraries/pelib-0.9/pelib/RelocationsDirectory.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * Relocations.h - Part of the PeLib library. | ||
3 | * | ||
4 | * Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com) | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This software is licensed under the zlib/libpng License. | ||
8 | * For more details see http://www.opensource.org/licenses/zlib-license.php | ||
9 | * or the license information file (license.htm) in the root directory | ||
10 | * of PeLib. | ||
11 | */ | ||
12 | |||
13 | #ifndef RELOCATIONSDIRECTORY_H | ||
14 | #define RELOCATIONSDIRECTORY_H | ||
15 | |||
16 | namespace PeLib | ||
17 | { | ||
18 | /// Class that handles the relocations directory. | ||
19 | /** | ||
20 | * This class handles the relocations directory. | ||
21 | **/ | ||
22 | class RelocationsDirectory | ||
23 | { | ||
24 | private: | ||
25 | std::vector<IMG_BASE_RELOC> m_vRelocations; ///< Used to store the relocation data. | ||
26 | |||
27 | void read(InputBuffer& inputbuffer, unsigned int uiSize); | ||
28 | |||
29 | public: | ||
30 | /// Returns the number of relocations in the relocations directory. | ||
31 | unsigned int calcNumberOfRelocations() const; // EXPORT | ||
32 | /// Returns the number of relocation data entries of a specific relocation. | ||
33 | unsigned int calcNumberOfRelocationData(unsigned int ulRelocation) const; // EXPORT | ||
34 | |||
35 | /// Read a file's relocations directory. | ||
36 | int read(const std::string& strFilename, unsigned int uiOffset, unsigned int uiSize); // EXPORT | ||
37 | int read(const unsigned char* buffer, unsigned int buffersize); // EXPORT | ||
38 | /// Rebuilds the relocations directory. | ||
39 | void rebuild(std::vector<byte>& vBuffer) const; // EXPORT | ||
40 | /// Returns the size of the relocations directory. | ||
41 | unsigned int size() const; // EXPORT | ||
42 | /// Writes the relocations directory to a file. | ||
43 | int write(const std::string& strFilename, unsigned int dwOffset) const; // EXPORT | ||
44 | |||
45 | /// Returns the VA of a relocation. | ||
46 | dword getVirtualAddress(unsigned int ulRelocation) const; // EXPORT | ||
47 | /// Returns the SizeOfBlock value of a relocation. | ||
48 | dword getSizeOfBlock(unsigned int ulRelocation) const; // EXPORT | ||
49 | /// Returns the RelocationData of a relocation. | ||
50 | word getRelocationData(unsigned int ulRelocation, unsigned int ulDataNumber) const; // EXPORT | ||
51 | |||
52 | /// Changes the relocation data of a relocation. | ||
53 | void setRelocationData(unsigned int ulRelocation, unsigned int ulDataNumber, word wData); // EXPORT | ||
54 | |||
55 | /// Changes the VirtualAddress of a relocation. | ||
56 | void setVirtualAddress(unsigned int ulRelocation, dword dwValue); // EXPORT | ||
57 | /// Changes the SizeOfBlock of a relocation. | ||
58 | void setSizeOfBlock(unsigned int ulRelocation, dword dwValue); // EXPORT | ||
59 | |||
60 | void addRelocation(); // EXPORT | ||
61 | /// Adds new data to a relocation. | ||
62 | void addRelocationData(unsigned int ulRelocation, word wValue); // EXPORT | ||
63 | /// Removes data from a relocation. | ||
64 | // void removeRelocationData(unsigned int ulRelocation, word wValue); // EXPORT | ||
65 | void removeRelocation(unsigned int index); // EXPORT | ||
66 | void removeRelocationData(unsigned int relocindex, unsigned int dataindex); // EXPORT | ||
67 | }; | ||
68 | } | ||
69 | |||
70 | #endif | ||