Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/cecil.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Boemer <sbomer@gmail.com>2017-05-05 01:52:26 +0300
committerSven Boemer <sbomer@gmail.com>2017-05-05 01:58:27 +0300
commit3050a6174a1bf9a86618808ad23aca4e19f22553 (patch)
tree5ffc84e3b43cdadf5b83c633cae716e299c5e1ae
parent007b6dcaaf5c52bb5b3efa658ba63b2aa5de2d2d (diff)
Use TargetArchitecture enum values when writing images
-rw-r--r--Mono.Cecil.PE/ImageWriter.cs18
1 files changed, 1 insertions, 17 deletions
diff --git a/Mono.Cecil.PE/ImageWriter.cs b/Mono.Cecil.PE/ImageWriter.cs
index e85bcf6..3fc689d 100644
--- a/Mono.Cecil.PE/ImageWriter.cs
+++ b/Mono.Cecil.PE/ImageWriter.cs
@@ -197,7 +197,7 @@ namespace Mono.Cecil.PE {
void WritePEFileHeader ()
{
WriteUInt32 (0x00004550); // Magic
- WriteUInt16 (GetMachine ()); // Machine
+ WriteUInt16 ((ushort) module.Architecture); // Machine
WriteUInt16 (sections); // NumberOfSections
WriteUInt32 (metadata.timestamp);
WriteUInt32 (0); // PointerToSymbolTable
@@ -211,22 +211,6 @@ namespace Mono.Cecil.PE {
WriteUInt16 (characteristics); // Characteristics
}
- ushort GetMachine ()
- {
- switch (module.Architecture) {
- case TargetArchitecture.I386:
- return 0x014c;
- case TargetArchitecture.AMD64:
- return 0x8664;
- case TargetArchitecture.IA64:
- return 0x0200;
- case TargetArchitecture.ARMv7:
- return 0x01c4;
- }
-
- throw new NotSupportedException ();
- }
-
Section LastSection ()
{
if (reloc != null)