diff options
Diffstat (limited to 'utils/zenutils/libraries/pelib-0.9/pelib/BoundImportDirectory.h')
-rwxr-xr-x | utils/zenutils/libraries/pelib-0.9/pelib/BoundImportDirectory.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/utils/zenutils/libraries/pelib-0.9/pelib/BoundImportDirectory.h b/utils/zenutils/libraries/pelib-0.9/pelib/BoundImportDirectory.h new file mode 100755 index 0000000000..fd2bab56fd --- /dev/null +++ b/utils/zenutils/libraries/pelib-0.9/pelib/BoundImportDirectory.h | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * BoundImportDirectory.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 BOUNDIMPORTDIRECTORY_H | ||
14 | #define BOUNDIMPORTDIRECTORY_H | ||
15 | |||
16 | #include "PeLibAux.h" | ||
17 | |||
18 | namespace PeLib | ||
19 | { | ||
20 | /// Class that handles the BoundImport directory. | ||
21 | /** | ||
22 | * This class can read and modify the BoundImport directory table of a PE file. | ||
23 | **/ | ||
24 | class BoundImportDirectory | ||
25 | { | ||
26 | private: | ||
27 | std::vector<PELIB_IMAGE_BOUND_DIRECTORY> m_vIbd; ///< Stores the individual BoundImport fields. | ||
28 | |||
29 | int read(InputBuffer& inpBuffer, unsigned char* data, unsigned int dwSize); | ||
30 | unsigned int totalModules() const; | ||
31 | public: | ||
32 | /// Adds another bound import. | ||
33 | int addBoundImport(const std::string& strModuleName, dword dwTds, word dwOmn, word wWfr); // EXPORT | ||
34 | /// Identifies a module through it's name. | ||
35 | int getModuleIndex(const std::string& strModuleName) const; // EXPORT | ||
36 | /// Returns the number of files in the BoundImport directory. | ||
37 | unsigned int calcNumberOfModules() const; // EXPORT | ||
38 | /// Reads the BoundImport directory table from a PE file. | ||
39 | int read(const std::string& strFileName, dword dwOffset, unsigned int uiSize); // EXPORT | ||
40 | int read(unsigned char* pcBuffer, unsigned int uiSize); // EXPORT | ||
41 | /// Rebuilds the BoundImport directory. | ||
42 | void rebuild(std::vector<byte>& vBuffer, bool fMakeValid = true) const; // EXPORT | ||
43 | /// Empties the BoundImport directory. | ||
44 | void clear(); // EXPORT | ||
45 | /// Removes a bound import. | ||
46 | void removeBoundImport(const std::string& strModuleName); // EXPORT | ||
47 | /// Returns the size of the BoundImport directory. | ||
48 | unsigned int size() const; // EXPORT | ||
49 | /// Writes the current bound import directory to a file. | ||
50 | int write(const std::string& strFilename, dword dwOffset, bool fMakeValid = true) const; // EXPORT | ||
51 | |||
52 | /// Retrieves the TimeDateStamp value of a bound import. | ||
53 | dword getTimeDateStamp(dword dwBidnr) const; // EXPORT | ||
54 | /// Retrieves the OffsetModuleName value of a bound import. | ||
55 | word getOffsetModuleName(dword dwBidnr) const; // EXPORT | ||
56 | /// Retrieves the NumberOfModuleForwarderRefs value of a bound import. | ||
57 | word getNumberOfModuleForwarderRefs(dword dwBidnr) const; // EXPORT | ||
58 | /// Retrieves the ModuleName value of a bound import. | ||
59 | std::string getModuleName(dword dwBidnr) const; // EXPORT | ||
60 | |||
61 | /// Updates the TimeDateStamp value of a bound import. | ||
62 | void setTimeDateStamp(dword dwBidnr, dword dwTds); // EXPORT | ||
63 | /// Updates the OffsetModuleName value of a bound import. | ||
64 | void setOffsetModuleName(dword dwBidnr, word wOmn); // EXPORT | ||
65 | /// Updates the NumberOfModuleForwarderRefs value of a bound import. | ||
66 | void setNumberOfModuleForwarderRefs(dword dwBidnr, word wMfr); // EXPORT | ||
67 | /// Updates the ModuleName value of a bound import. | ||
68 | void setModuleName(dword dwBidnr, const std::string& strModuleName); // EXPORT | ||
69 | |||
70 | dword getTimeDateStamp(dword dwBidnr, dword forwardedModule) const; // EXPORT _module | ||
71 | word getOffsetModuleName(dword dwBidnr, dword forwardedModule) const; // EXPORT _module | ||
72 | word getNumberOfModuleForwarderRefs(dword dwBidnr, dword forwardedModule) const; // EXPORT _module | ||
73 | std::string getModuleName(dword dwBidnr, dword forwardedModule) const; // EXPORT _module | ||
74 | |||
75 | void setTimeDateStamp(dword dwBidnr, dword forwardedModule, dword dwTds); // EXPORT _module | ||
76 | void setOffsetModuleName(dword dwBidnr, dword forwardedModule, word wOmn); // EXPORT _module | ||
77 | void setNumberOfModuleForwarderRefs(dword dwBidnr, dword forwardedModule, word wMfr); // EXPORT _module | ||
78 | void setModuleName(dword dwBidnr, dword forwardedModule, const std::string& strModuleName); // EXPORT _module | ||
79 | |||
80 | word calcNumberOfModuleForwarderRefs(dword dwBidnr) const; // EXPORT | ||
81 | void addForwardedModule(dword dwBidnr, const std::string& name, dword timeStamp = 0, word offsetModuleName = 0, word forwardedModules = 0); // EXPORT | ||
82 | void removeForwardedModule(dword dwBidnr, word forwardedModule); // EXPORT | ||
83 | }; | ||
84 | } | ||
85 | |||
86 | |||
87 | #endif | ||