summaryrefslogtreecommitdiff
path: root/utils/zenutils/libraries/pelib-0.9/pelib/MzHeader.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/zenutils/libraries/pelib-0.9/pelib/MzHeader.h')
-rw-r--r--[-rwxr-xr-x]utils/zenutils/libraries/pelib-0.9/pelib/MzHeader.h296
1 files changed, 148 insertions, 148 deletions
diff --git a/utils/zenutils/libraries/pelib-0.9/pelib/MzHeader.h b/utils/zenutils/libraries/pelib-0.9/pelib/MzHeader.h
index 5aca6bfe59..4acb819727 100755..100644
--- a/utils/zenutils/libraries/pelib-0.9/pelib/MzHeader.h
+++ b/utils/zenutils/libraries/pelib-0.9/pelib/MzHeader.h
@@ -1,148 +1,148 @@
1/* 1/*
2* MzHeader.h - Part of the PeLib library. 2* MzHeader.h - Part of the PeLib library.
3* 3*
4* Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com) 4* Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com)
5* All rights reserved. 5* All rights reserved.
6* 6*
7* This software is licensed under the zlib/libpng License. 7* This software is licensed under the zlib/libpng License.
8* For more details see http://www.opensource.org/licenses/zlib-license.php 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 9* or the license information file (license.htm) in the root directory
10* of PeLib. 10* of PeLib.
11*/ 11*/
12 12
13#ifndef MZHEADER_H 13#ifndef MZHEADER_H
14#define MZHEADER_H 14#define MZHEADER_H
15 15
16#include "PeLibInc.h" 16#include "PeLibInc.h"
17 17
18namespace PeLib 18namespace PeLib
19{ 19{
20 /// Class that handles the MZ header of files. 20 /// Class that handles the MZ header of files.
21 /** 21 /**
22 * This class can read and modify MZ headers. It provides set- and get functions to access 22 * This class can read and modify MZ headers. It provides set- and get functions to access
23 * all individual members of a MZ header. Furthermore it's possible to validate and rebuild 23 * all individual members of a MZ header. Furthermore it's possible to validate and rebuild
24 * MZ headers. 24 * MZ headers.
25 **/ 25 **/
26 class MzHeader 26 class MzHeader
27 { 27 {
28 private: 28 private:
29 PELIB_IMAGE_DOS_HEADER m_idhHeader; ///< Stores all MZ header information. 29 PELIB_IMAGE_DOS_HEADER m_idhHeader; ///< Stores all MZ header information.
30 30
31 /// Reads data from an InputBuffer into a MZ header struct. 31 /// Reads data from an InputBuffer into a MZ header struct.
32 void read(InputBuffer& ibBuffer); 32 void read(InputBuffer& ibBuffer);
33 33
34 /// Offset of the MZ header in the original file. 34 /// Offset of the MZ header in the original file.
35 unsigned int originalOffset; 35 unsigned int originalOffset;
36 36
37 public: 37 public:
38 38
39 enum Field {e_magic, e_cblp, e_cp, e_crlc, e_cparhdr, e_minalloc, e_maxalloc, 39 enum Field {e_magic, e_cblp, e_cp, e_crlc, e_cparhdr, e_minalloc, e_maxalloc,
40 e_ss, e_sp, e_csum, e_ip, e_cs, e_lfarlc, e_ovno, e_res, e_oemid, 40 e_ss, e_sp, e_csum, e_ip, e_cs, e_lfarlc, e_ovno, e_res, e_oemid,
41 e_oeminfo, e_res2, e_lfanew}; 41 e_oeminfo, e_res2, e_lfanew};
42 42
43 /// Checks if the current MZ header is valid. 43 /// Checks if the current MZ header is valid.
44 bool isValid() const; // EXPORT 44 bool isValid() const; // EXPORT
45 45
46 bool isValid(Field field) const; // EXPORT _field 46 bool isValid(Field field) const; // EXPORT _field
47 47
48 /// Corrects the current MZ header. 48 /// Corrects the current MZ header.
49 void makeValid(); // EXPORT 49 void makeValid(); // EXPORT
50 50
51 void makeValid(Field field); // EXPORT _field 51 void makeValid(Field field); // EXPORT _field
52 52
53 /// Reads the MZ header of a file. 53 /// Reads the MZ header of a file.
54 int read(const std::string& strFilename); // EXPORT 54 int read(const std::string& strFilename); // EXPORT
55 55
56 /// Reads the MZ header from a memory location. 56 /// Reads the MZ header from a memory location.
57 int read(unsigned char* pcBuffer, unsigned int uiSize, unsigned int originalOffs = 0); // EXPORT _fromMemory 57 int read(unsigned char* pcBuffer, unsigned int uiSize, unsigned int originalOffs = 0); // EXPORT _fromMemory
58 58
59 /// Rebuild the MZ header. 59 /// Rebuild the MZ header.
60 void rebuild(std::vector<byte>& vBuffer) const; // EXPORT 60 void rebuild(std::vector<byte>& vBuffer) const; // EXPORT
61 61
62 /// Returns the size of the current MZ header. 62 /// Returns the size of the current MZ header.
63 unsigned int size() const; // EXPORT 63 unsigned int size() const; // EXPORT
64 64
65 /// Writes the current MZ header to offset 0 of a file. 65 /// Writes the current MZ header to offset 0 of a file.
66 int write(const std::string& strFilename, dword dwOffset) const; // EXPORT 66 int write(const std::string& strFilename, dword dwOffset) const; // EXPORT
67 67
68 /// Gets the e_magic value of the MZ header. 68 /// Gets the e_magic value of the MZ header.
69 word getMagicNumber() const; // EXPORT 69 word getMagicNumber() const; // EXPORT
70 /// Gets the e_cblp value of the MZ header. 70 /// Gets the e_cblp value of the MZ header.
71 word getBytesOnLastPage() const; // EXPORT 71 word getBytesOnLastPage() const; // EXPORT
72 /// Gets the e_cp value of the MZ header. 72 /// Gets the e_cp value of the MZ header.
73 word getPagesInFile() const; // EXPORT 73 word getPagesInFile() const; // EXPORT
74 /// Gets the e_crlc value of the MZ header. 74 /// Gets the e_crlc value of the MZ header.
75 word getRelocations() const; // EXPORT 75 word getRelocations() const; // EXPORT
76 /// Gets the e_cparhdr value of the MZ header. 76 /// Gets the e_cparhdr value of the MZ header.
77 word getSizeOfHeader() const; // EXPORT 77 word getSizeOfHeader() const; // EXPORT
78 /// Gets the e_minalloc value of the MZ header. 78 /// Gets the e_minalloc value of the MZ header.
79 word getMinExtraParagraphs() const; // EXPORT 79 word getMinExtraParagraphs() const; // EXPORT
80 /// Gets the e_maxalloc value of the MZ header. 80 /// Gets the e_maxalloc value of the MZ header.
81 word getMaxExtraParagraphs() const; // EXPORT 81 word getMaxExtraParagraphs() const; // EXPORT
82 /// Gets the e_ss value of the MZ header. 82 /// Gets the e_ss value of the MZ header.
83 word getSsValue() const; // EXPORT 83 word getSsValue() const; // EXPORT
84 /// Gets the e_sp value of the MZ header. 84 /// Gets the e_sp value of the MZ header.
85 word getSpValue() const; // EXPORT 85 word getSpValue() const; // EXPORT
86 /// Gets the e_csum value of the MZ header. 86 /// Gets the e_csum value of the MZ header.
87 word getChecksum() const; // EXPORT 87 word getChecksum() const; // EXPORT
88 /// Gets the e_ip value of the MZ header. 88 /// Gets the e_ip value of the MZ header.
89 word getIpValue() const; // EXPORT 89 word getIpValue() const; // EXPORT
90 /// Gets the e_cs value of the MZ header. 90 /// Gets the e_cs value of the MZ header.
91 word getCsValue() const; // EXPORT 91 word getCsValue() const; // EXPORT
92 /// Gets the e_lfarlc value of the MZ header. 92 /// Gets the e_lfarlc value of the MZ header.
93 word getAddrOfRelocationTable() const; // EXPORT 93 word getAddrOfRelocationTable() const; // EXPORT
94 /// Gets the e_ovnovalue of the MZ header. 94 /// Gets the e_ovnovalue of the MZ header.
95 word getOverlayNumber() const; // EXPORT 95 word getOverlayNumber() const; // EXPORT
96 /// Gets the e_oemid value of the MZ header. 96 /// Gets the e_oemid value of the MZ header.
97 word getOemIdentifier() const; // EXPORT 97 word getOemIdentifier() const; // EXPORT
98 /// Gets the e_oeminfo value of the MZ header. 98 /// Gets the e_oeminfo value of the MZ header.
99 word getOemInformation() const; // EXPORT 99 word getOemInformation() const; // EXPORT
100 /// Gets the e_lfanew value of the MZ header. 100 /// Gets the e_lfanew value of the MZ header.
101 dword getAddressOfPeHeader() const; // EXPORT 101 dword getAddressOfPeHeader() const; // EXPORT
102 /// Gets the e_res of the MZ header. 102 /// Gets the e_res of the MZ header.
103 word getReservedWords1(unsigned int uiNr) const; // EXPORT 103 word getReservedWords1(unsigned int uiNr) const; // EXPORT
104 /// Gets the e_res2 of the MZ header. 104 /// Gets the e_res2 of the MZ header.
105 word getReservedWords2(unsigned int uiNr) const; // EXPORT 105 word getReservedWords2(unsigned int uiNr) const; // EXPORT
106 106
107 /// Sets the e_magic value of the MZ header. 107 /// Sets the e_magic value of the MZ header.
108 void setMagicNumber(word wValue); // EXPORT 108 void setMagicNumber(word wValue); // EXPORT
109 /// Sets the e_cblp value of the MZ header. 109 /// Sets the e_cblp value of the MZ header.
110 void setBytesOnLastPage(word wValue); // EXPORT 110 void setBytesOnLastPage(word wValue); // EXPORT
111 /// Sets the e_cp value of the MZ header. 111 /// Sets the e_cp value of the MZ header.
112 void setPagesInFile(word wValue); // EXPORT 112 void setPagesInFile(word wValue); // EXPORT
113 /// Sets the e_crlc value of the MZ header. 113 /// Sets the e_crlc value of the MZ header.
114 void setRelocations(word wValue); // EXPORT 114 void setRelocations(word wValue); // EXPORT
115 /// Sets the e_cparhdr value of the MZ header. 115 /// Sets the e_cparhdr value of the MZ header.
116 void setSizeOfHeader(word wValue); // EXPORT 116 void setSizeOfHeader(word wValue); // EXPORT
117 /// Sets the e_minalloc value of the MZ header. 117 /// Sets the e_minalloc value of the MZ header.
118 void setMinExtraParagraphs(word wValue); // EXPORT 118 void setMinExtraParagraphs(word wValue); // EXPORT
119 /// Sets the e_maxalloc value of the MZ header. 119 /// Sets the e_maxalloc value of the MZ header.
120 void setMaxExtraParagraphs(word wValue); // EXPORT 120 void setMaxExtraParagraphs(word wValue); // EXPORT
121 /// Sets the e_ss value of the MZ header. 121 /// Sets the e_ss value of the MZ header.
122 void setSsValue(word wValue); // EXPORT 122 void setSsValue(word wValue); // EXPORT
123 /// Sets the e_sp value of the MZ header. 123 /// Sets the e_sp value of the MZ header.
124 void setSpValue(word wValue); // EXPORT 124 void setSpValue(word wValue); // EXPORT
125 /// Sets the e_csum value of the MZ header. 125 /// Sets the e_csum value of the MZ header.
126 void setChecksum(word wValue); // EXPORT 126 void setChecksum(word wValue); // EXPORT
127 /// Sets the e_ip value of the MZ header. 127 /// Sets the e_ip value of the MZ header.
128 void setIpValue(word wValue); // EXPORT 128 void setIpValue(word wValue); // EXPORT
129 /// Sets the e_cs value of the MZ header. 129 /// Sets the e_cs value of the MZ header.
130 void setCsValue(word wValue); // EXPORT 130 void setCsValue(word wValue); // EXPORT
131 /// Sets the e_lfarlc value of the MZ header. 131 /// Sets the e_lfarlc value of the MZ header.
132 void setAddrOfRelocationTable(word wValue); // EXPORT 132 void setAddrOfRelocationTable(word wValue); // EXPORT
133 /// Sets the e_ovno value of the MZ header. 133 /// Sets the e_ovno value of the MZ header.
134 void setOverlayNumber(word wValue); // EXPORT 134 void setOverlayNumber(word wValue); // EXPORT
135 /// Sets the e_oemid value of the MZ header. 135 /// Sets the e_oemid value of the MZ header.
136 void setOemIdentifier(word wValue); // EXPORT 136 void setOemIdentifier(word wValue); // EXPORT
137 /// Sets the e_oeminfo value of the MZ header. 137 /// Sets the e_oeminfo value of the MZ header.
138 void setOemInformation(word wValue); // EXPORT 138 void setOemInformation(word wValue); // EXPORT
139 /// Sets the e_lfanew value of the MZ header. 139 /// Sets the e_lfanew value of the MZ header.
140 void setAddressOfPeHeader(dword dwValue); // EXPORT 140 void setAddressOfPeHeader(dword dwValue); // EXPORT
141 /// Sets the e_res value of the MZ header. 141 /// Sets the e_res value of the MZ header.
142 void setReservedWords1(unsigned int uiNr, word wValue); // EXPORT 142 void setReservedWords1(unsigned int uiNr, word wValue); // EXPORT
143 /// Sets the e_res2 value of the MZ header. 143 /// Sets the e_res2 value of the MZ header.
144 void setReservedWords2(unsigned int uiNr, word wValue); // EXPORT 144 void setReservedWords2(unsigned int uiNr, word wValue); // EXPORT
145 }; 145 };
146} 146}
147 147
148#endif 148#endif