2 * IatDirectory.h - Part of the PeLib library.
4 * Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com)
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
13 #ifndef IATDIRECTORY_H
14 #define IATDIRECTORY_H
20 /// Class that handles the Import Address Table (IAT)
22 * This class can read and modify the Import Address Table of a PE file.
27 std::vector
<dword
> m_vIat
; ///< Stores the individual IAT fields.
29 int read(InputBuffer
& inputBuffer
, unsigned int size
);
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
42 void clear(); // EXPORT
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