Fix yellow by making the ifdef hell slightly worse
[kugel-rb.git] / utils / zenutils / libraries / pelib-0.9 / pelib / IatDirectory.h
blob26c5d4009cec1063cd5dfad008ac9347ed349d0d
1 /*
2 * IatDirectory.h - Part of the PeLib library.
4 * Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com)
5 * All rights reserved.
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.
13 #ifndef IATDIRECTORY_H
14 #define IATDIRECTORY_H
16 #include "PeLibInc.h"
18 namespace PeLib
20 /// Class that handles the Import Address Table (IAT)
21 /**
22 * This class can read and modify the Import Address Table of a PE file.
23 **/
24 class IatDirectory
26 private:
27 std::vector<dword> m_vIat; ///< Stores the individual IAT fields.
29 int read(InputBuffer& inputBuffer, unsigned int size);
31 public:
32 /// Reads the Import Address Table from a PE file.
33 int read(const std::string& strFilename, unsigned int dwOffset, unsigned int dwSize); // EXPORT
34 int read(unsigned char* buffer, unsigned int buffersize); // EXPORT
35 /// Returns the number of fields in the IAT.
36 unsigned int calcNumberOfAddresses() const; // EXPORT
37 /// Adds another address to the IAT.
38 void addAddress(dword dwValue); // EXPORT
39 /// Removes an address from the IAT.
40 void removeAddress(unsigned int index); // EXPORT
41 /// Empties the IAT.
42 void clear(); // EXPORT
43 // Rebuilds the IAT.
44 void rebuild(std::vector<byte>& vBuffer) const; // EXPORT
45 /// Returns the size of the current IAT.
46 unsigned int size() const; // EXPORT
47 /// Writes the current IAT to a file.
48 int write(const std::string& strFilename, unsigned int uiOffset) const; // EXPORT
50 /// Retrieve the value of a field in the IAT.
51 dword getAddress(unsigned int index) const; // EXPORT
52 /// Change the value of a field in the IAT.
53 void setAddress(dword dwAddrnr, dword dwValue); // EXPORT
57 #endif