diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-07-11 15:50:46 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-07-11 15:50:46 +0000 |
commit | 14c7f45cdae826f88dc539c8c38dd95caf305731 (patch) | |
tree | 832da054b7cfb2dc6fd63339af736625f31d21aa /utils/zenutils/libraries/pelib-0.9/pelib/PeHeader.cpp | |
parent | 7c84ede3781c27db73403bd6302f320c76a58c8c (diff) | |
download | rockbox-14c7f45cdae826f88dc539c8c38dd95caf305731.tar.gz rockbox-14c7f45cdae826f88dc539c8c38dd95caf305731.zip |
Add zook's ZenUtils to SVN
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18010 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/zenutils/libraries/pelib-0.9/pelib/PeHeader.cpp')
-rwxr-xr-x | utils/zenutils/libraries/pelib-0.9/pelib/PeHeader.cpp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/utils/zenutils/libraries/pelib-0.9/pelib/PeHeader.cpp b/utils/zenutils/libraries/pelib-0.9/pelib/PeHeader.cpp new file mode 100755 index 0000000000..fe7011072c --- /dev/null +++ b/utils/zenutils/libraries/pelib-0.9/pelib/PeHeader.cpp | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | * PeHeader.cpp - 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 | #include "PeLibInc.h" | ||
14 | #include "PeHeader.h" | ||
15 | |||
16 | namespace PeLib | ||
17 | { | ||
18 | template<> | ||
19 | void PeHeaderT<32>::readBaseOfData(InputBuffer& ibBuffer, PELIB_IMAGE_NT_HEADERS<32>& header) const | ||
20 | { | ||
21 | ibBuffer >> header.OptionalHeader.BaseOfData; | ||
22 | } | ||
23 | |||
24 | template<> | ||
25 | void PeHeaderT<64>::readBaseOfData(InputBuffer&, PELIB_IMAGE_NT_HEADERS<64>&) const | ||
26 | { | ||
27 | } | ||
28 | |||
29 | template<> | ||
30 | void PeHeaderT<32>::rebuildBaseOfData(OutputBuffer& obBuffer) const | ||
31 | { | ||
32 | obBuffer << m_inthHeader.OptionalHeader.BaseOfData; | ||
33 | } | ||
34 | |||
35 | template<> | ||
36 | void PeHeaderT<64>::rebuildBaseOfData(OutputBuffer&) const | ||
37 | { | ||
38 | } | ||
39 | |||
40 | template<> | ||
41 | bool PeHeaderT<32>::isValid() const | ||
42 | { | ||
43 | return true; | ||
44 | } | ||
45 | |||
46 | template<> | ||
47 | bool PeHeaderT<64>::isValid() const | ||
48 | { | ||
49 | return true; | ||
50 | } | ||
51 | |||
52 | template<> | ||
53 | bool PeHeaderT<32>::isValid(unsigned int pehf) const | ||
54 | { | ||
55 | /* | ||
56 | if (pehf == NtSignature) | ||
57 | { | ||
58 | return m_inthHeader.Signature == IMAGE_NT_SIGNATURE; | ||
59 | } | ||
60 | else if (pehf == NumberOfSections) | ||
61 | { | ||
62 | return getNumberOfSections() == calcNumberOfSections(); | ||
63 | } */ | ||
64 | return false; | ||
65 | } | ||
66 | |||
67 | template<> | ||
68 | bool PeHeaderT<64>::isValid(unsigned int pehf) const | ||
69 | { | ||
70 | return false; | ||
71 | } | ||
72 | |||
73 | /** | ||
74 | * @return The BaseOfData value from the PE header. | ||
75 | **/ | ||
76 | dword PeHeader32::getBaseOfData() const | ||
77 | { | ||
78 | return m_inthHeader.OptionalHeader.BaseOfData; | ||
79 | } | ||
80 | |||
81 | /** | ||
82 | * Changes the file's BaseOfData. | ||
83 | * @param dwValue New value. | ||
84 | **/ | ||
85 | void PeHeader32::setBaseOfData(dword dwValue) | ||
86 | { | ||
87 | m_inthHeader.OptionalHeader.BaseOfData = dwValue; | ||
88 | } | ||
89 | |||
90 | } | ||