From 9b0b61d4190f5450935ba51e772b93bf5c2f93db Mon Sep 17 00:00:00 2001 From: alcexhim Date: Mon, 11 May 2015 22:11:14 -0400 Subject: [PATCH] Actually write meaningful values after the DOS header --- .../Microsoft/MicrosoftExecutableDataFormat.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Executable/DataFormats/Executable/Microsoft/MicrosoftExecutableDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.Executable/DataFormats/Executable/Microsoft/MicrosoftExecutableDataFormat.cs index b59763c5..d29a799e 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.Executable/DataFormats/Executable/Microsoft/MicrosoftExecutableDataFormat.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.Executable/DataFormats/Executable/Microsoft/MicrosoftExecutableDataFormat.cs @@ -157,6 +157,7 @@ Watcom C++ 10.6 W?h$n(i)v W?h$n(ia)v W?h$n()v ushort e_oemid = br.ReadUInt16(); // OEM identifier (for e_oeminfo) ushort e_oeminfo = br.ReadUInt16(); // OEM information; e_oemid specific ushort[] e_res2 = br.ReadUInt16Array(10); // Reserved words + e_lfanew = br.ReadUInt32(); // File address of new exe header } #endregion @@ -463,9 +464,19 @@ Watcom C++ 10.6 W?h$n(i)v W?h$n(ia)v W?h$n()v bw.WriteUInt16(mvarDOSHeader.InitialValueRegisterCS); // Initial value of the CS register, relative to the segment the program was loaded at. bw.WriteUInt16(mvarDOSHeader.FirstRelocationItemOffset); // Offset of the first relocation item in the file. bw.WriteUInt16(mvarDOSHeader.OverlayNumber); // Overlay number. Normally zero, meaning that it's the main program. + + + ushort[] e_res = new ushort[4]; + bw.WriteUInt16Array(e_res); // Reserved words + ushort e_oemid = 0; + bw.WriteUInt16(e_oemid); // OEM identifier (for e_oeminfo) + ushort e_oeminfo = 0; // OEM information; e_oemid specific + bw.WriteUInt16(e_oeminfo); + ushort[] e_res2 = new ushort[10]; // Reserved words + bw.WriteUInt16Array(e_res2); + #endregion #region Portable Executable - bw.Accessor.Position = 0x3C; int e_lfanew = (int)(bw.Accessor.Position + 4); bw.WriteInt32(e_lfanew);