[Forensics-changes] [yara] 83/407: Fix pe.h
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:28:12 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.3.0
in repository yara.
commit 4f3c9a0f40dd23d3eb6e37bdff93b716c22f345c
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Tue Oct 7 16:40:19 2014 +0200
Fix pe.h
---
libyara/include/yara/pe.h | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/libyara/include/yara/pe.h b/libyara/include/yara/pe.h
index b8572b1..5aca469 100644
--- a/libyara/include/yara/pe.h
+++ b/libyara/include/yara/pe.h
@@ -14,7 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-#ifndef _WIN32
+#pragma pack(push, 1)
+
+#ifdef _WIN32
+#include <windows.h>
+#else
#include <stdint.h>
#include <stdlib.h>
@@ -31,20 +35,14 @@ typedef uint64_t ULONGLONG;
#ifndef _MAC
-#pragma pack(push,4) // 4 byte packing is the default
-
#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ
#define IMAGE_OS2_SIGNATURE 0x454E // NE
#define IMAGE_OS2_SIGNATURE_LE 0x454C // LE
#define IMAGE_VXD_SIGNATURE 0x454C // LE
#define IMAGE_NT_SIGNATURE 0x00004550 // PE00
-#pragma pack(push,2) // 16 bit headers are 2 byte packed
-
#else
-#pragma pack(push,1)
-
#define IMAGE_DOS_SIGNATURE 0x4D5A // MZ
#define IMAGE_OS2_SIGNATURE 0x4E45 // NE
#define IMAGE_OS2_SIGNATURE_LE 0x4C45 // LE
@@ -52,6 +50,7 @@ typedef uint64_t ULONGLONG;
#endif
+#pragma pack(push, 2)
typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header
WORD e_magic; // Magic number
@@ -75,15 +74,14 @@ typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header
LONG e_lfanew; // File address of new exe header
} IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
-
-#ifndef _MAC
-#pragma pack(pop) // Back to 4 byte packing
-#endif
+#pragma pack(pop)
//
// File header format.
//
+#pragma pack(push,4)
+
typedef struct _IMAGE_FILE_HEADER {
WORD Machine;
WORD NumberOfSections;
@@ -372,11 +370,10 @@ typedef struct _IMAGE_RESOURCE_DIRECTORY {
IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[1];
} IMAGE_RESOURCE_DIRECTORY, *PIMAGE_RESOURCE_DIRECTORY;
+#pragma pack(pop)
#endif // _WIN32
-#include <windows.h>
-
typedef struct _VERSION_INFO {
WORD Length;
WORD ValueLength;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git
More information about the forensics-changes
mailing list