From 14c7f45cdae826f88dc539c8c38dd95caf305731 Mon Sep 17 00:00:00 2001 From: Maurus Cuelenaere Date: Fri, 11 Jul 2008 15:50:46 +0000 Subject: Add zook's ZenUtils to SVN git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18010 a1c6a512-1295-4272-9138-f99709370657 --- .../libraries/pelib-0.9/pelib/IatDirectory.h | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 utils/zenutils/libraries/pelib-0.9/pelib/IatDirectory.h (limited to 'utils/zenutils/libraries/pelib-0.9/pelib/IatDirectory.h') diff --git a/utils/zenutils/libraries/pelib-0.9/pelib/IatDirectory.h b/utils/zenutils/libraries/pelib-0.9/pelib/IatDirectory.h new file mode 100755 index 0000000000..81ef77ed6a --- /dev/null +++ b/utils/zenutils/libraries/pelib-0.9/pelib/IatDirectory.h @@ -0,0 +1,58 @@ +/* +* IatDirectory.h - Part of the PeLib library. +* +* Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com) +* All rights reserved. +* +* This software is licensed under the zlib/libpng License. +* For more details see http://www.opensource.org/licenses/zlib-license.php +* or the license information file (license.htm) in the root directory +* of PeLib. +*/ + +#ifndef IATDIRECTORY_H +#define IATDIRECTORY_H + +#include "PeLibInc.h" + +namespace PeLib +{ + /// Class that handles the Import Address Table (IAT) + /** + * This class can read and modify the Import Address Table of a PE file. + **/ + class IatDirectory + { + private: + std::vector m_vIat; ///< Stores the individual IAT fields. + + int read(InputBuffer& inputBuffer, unsigned int size); + + public: + /// Reads the Import Address Table from a PE file. + int read(const std::string& strFilename, unsigned int dwOffset, unsigned int dwSize); // EXPORT + int read(unsigned char* buffer, unsigned int buffersize); // EXPORT + /// Returns the number of fields in the IAT. + unsigned int calcNumberOfAddresses() const; // EXPORT + /// Adds another address to the IAT. + void addAddress(dword dwValue); // EXPORT + /// Removes an address from the IAT. + void removeAddress(unsigned int index); // EXPORT + /// Empties the IAT. + void clear(); // EXPORT + // Rebuilds the IAT. + void rebuild(std::vector& vBuffer) const; // EXPORT + /// Returns the size of the current IAT. + unsigned int size() const; // EXPORT + /// Writes the current IAT to a file. + int write(const std::string& strFilename, unsigned int uiOffset) const; // EXPORT + + /// Retrieve the value of a field in the IAT. + dword getAddress(unsigned int index) const; // EXPORT + /// Change the value of a field in the IAT. + void setAddress(dword dwAddrnr, dword dwValue); // EXPORT + }; +} + +#endif + -- cgit v1.2.3