diff options
Diffstat (limited to 'utils/zenutils/libraries/pelib-0.9/pelib/ExportDirectory.h')
-rwxr-xr-x | utils/zenutils/libraries/pelib-0.9/pelib/ExportDirectory.h | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/utils/zenutils/libraries/pelib-0.9/pelib/ExportDirectory.h b/utils/zenutils/libraries/pelib-0.9/pelib/ExportDirectory.h new file mode 100755 index 0000000000..17a7e57020 --- /dev/null +++ b/utils/zenutils/libraries/pelib-0.9/pelib/ExportDirectory.h | |||
@@ -0,0 +1,133 @@ | |||
1 | /* | ||
2 | * ExportDirectory.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 EXPORTDIRECTORY_H | ||
14 | #define EXPORTDIRECTORY_H | ||
15 | #include "PeHeader.h" | ||
16 | |||
17 | namespace PeLib | ||
18 | { | ||
19 | /// Class that handles the export directory. | ||
20 | /** | ||
21 | * This class handles the export directory. | ||
22 | * \todo getNameString | ||
23 | **/ | ||
24 | // template<int bits> | ||
25 | class ExportDirectory | ||
26 | { | ||
27 | private: | ||
28 | /// Used to store all necessary information about a file's exported functions. | ||
29 | PELIB_IMAGE_EXP_DIRECTORY m_ied; | ||
30 | |||
31 | public: | ||
32 | /// Add another function to be exported. | ||
33 | void addFunction(const std::string& strFuncname, dword dwFuncAddr); // EXPORT | ||
34 | unsigned int calcNumberOfFunctions() const; // EXPORT | ||
35 | void clear(); // EXPORT | ||
36 | /// Identifies a function through it's name. | ||
37 | int getFunctionIndex(const std::string& strFunctionName) const; // EXPORT | ||
38 | /// Read a file's export directory. | ||
39 | int read(const std::string& strFilename, unsigned int uiOffset, unsigned int uiSize, const PeHeader& pehHeader); // EXPORT | ||
40 | /// Rebuild the current export directory. | ||
41 | void rebuild(std::vector<byte>& vBuffer, dword dwRva) const; // EXPORT | ||
42 | void removeFunction(unsigned int index); // EXPORT | ||
43 | /// Returns the size of the current export directory. | ||
44 | unsigned int size() const; // EXPORT | ||
45 | /// Writes the current export directory to a file. | ||
46 | int write(const std::string& strFilename, unsigned int uiOffset, unsigned int uiRva) const; // EXPORT | ||
47 | |||
48 | /// Changes the name of the file (according to the export directory). | ||
49 | void setNameString(const std::string& strFilename); // EXPORT | ||
50 | std::string getNameString() const; // EXPORT | ||
51 | |||
52 | /// Get the name of an exported function. | ||
53 | std::string getFunctionName(unsigned int index) const; // EXPORT | ||
54 | /// Get the ordinal of an exported function. | ||
55 | word getFunctionOrdinal(unsigned int index) const; // EXPORT | ||
56 | /// Get the address of the name of an exported function. | ||
57 | dword getAddressOfName(unsigned int index) const; // EXPORT | ||
58 | /// Get the address of an exported function. | ||
59 | dword getAddressOfFunction(unsigned int index) const; // EXPORT | ||
60 | |||
61 | /// Change the name of an exported function. | ||
62 | void setFunctionName(unsigned int index, const std::string& strName); // EXPORT | ||
63 | /// Change the ordinal of an exported function. | ||
64 | void setFunctionOrdinal(unsigned int index, word wValue); // EXPORT | ||
65 | /// Change the address of the name of an exported function. | ||
66 | void setAddressOfName(unsigned int index, dword dwValue); // EXPORT | ||
67 | /// Change the address of an exported function. | ||
68 | void setAddressOfFunction(unsigned int index, dword dwValue); // EXPORT | ||
69 | |||
70 | /* | ||
71 | word getFunctionOrdinal(std::string strFuncname) const; | ||
72 | dword getAddressOfName(std::string strFuncname) const; | ||
73 | dword getAddressOfFunction(std::string strFuncname) const; | ||
74 | |||
75 | void setFunctionOrdinal(std::string strFuncname, word wValue); | ||
76 | void setAddressOfName(std::string strFuncname, dword dwValue); | ||
77 | void setAddressOfFunction(std::string strFuncname, dword dwValue); | ||
78 | */ | ||
79 | |||
80 | /// Return the Base value of the export directory. | ||
81 | dword getBase() const; // EXPORT | ||
82 | /// Return the Characteristics value of the export directory. | ||
83 | dword getCharacteristics() const; // EXPORT | ||
84 | /// Return the TimeDateStamp value of the export directory. | ||
85 | dword getTimeDateStamp() const; // EXPORT | ||
86 | /// Return the MajorVersion value of the export directory. | ||
87 | word getMajorVersion() const; // EXPORT | ||
88 | /// Return the MinorVersion value of the export directory. | ||
89 | word getMinorVersion() const; // EXPORT | ||
90 | /// Return the Name value of the export directory. | ||
91 | dword getName() const; // EXPORT | ||
92 | /// Return the NumberOfFunctions value of the export directory. | ||
93 | dword getNumberOfFunctions() const; // EXPORT | ||
94 | /// Return the NumberOfNames value of the export directory. | ||
95 | dword getNumberOfNames() const; // EXPORT | ||
96 | /// Return the AddressOfFunctions value of the export directory. | ||
97 | dword getAddressOfFunctions() const; // EXPORT | ||
98 | /// Return the AddressOfNames value of the export directory. | ||
99 | dword getAddressOfNames() const; // EXPORT | ||
100 | /// Returns the AddressOfNameOrdinals value. | ||
101 | dword getAddressOfNameOrdinals() const; // EXPORT | ||
102 | |||
103 | /* /// Returns the number of NameOrdinals. | ||
104 | dword getNumberOfNameOrdinals() const; // EXPORT | ||
105 | /// Returns the number of AddressOfFunctionNames values. | ||
106 | dword getNumberOfAddressOfFunctionNames() const; // EXPORT | ||
107 | /// Returns the number of AddressOfFunction values. | ||
108 | dword getNumberOfAddressOfFunctions() const; // EXPORT | ||
109 | */ | ||
110 | /// Set the Base value of the export directory. | ||
111 | void setBase(dword dwValue); // EXPORT | ||
112 | /// Set the Characteristics value of the export directory. | ||
113 | void setCharacteristics(dword dwValue); // EXPORT | ||
114 | /// Set the TimeDateStamp value of the export directory. | ||
115 | void setTimeDateStamp(dword dwValue); // EXPORT | ||
116 | /// Set the MajorVersion value of the export directory. | ||
117 | void setMajorVersion(word wValue); // EXPORT | ||
118 | /// Set the MinorVersion value of the export directory. | ||
119 | void setMinorVersion(word wValue); // EXPORT | ||
120 | /// Set the Name value of the export directory. | ||
121 | void setName(dword dwValue); // EXPORT | ||
122 | /// Set the NumberOfFunctions value of the export directory. | ||
123 | void setNumberOfFunctions(dword dwValue); // EXPORT | ||
124 | /// Set the NumberOfNames value of the export directory. | ||
125 | void setNumberOfNames(dword dwValue); // EXPORT | ||
126 | /// Set the AddressOfFunctions value of the export directory. | ||
127 | void setAddressOfFunctions(dword dwValue); // EXPORT | ||
128 | /// Set the AddressOfNames value of the export directory. | ||
129 | void setAddressOfNames(dword dwValue); // EXPORT | ||
130 | void setAddressOfNameOrdinals(dword value); // EXPORT | ||
131 | }; | ||
132 | } | ||
133 | #endif | ||