diff --git a/exeinfogui/BeOS/PanelBeVersion.xeto b/exeinfogui/BeOS/PanelBeVersion.xeto
new file mode 100644
index 0000000..0b3edae
--- /dev/null
+++ b/exeinfogui/BeOS/PanelBeVersion.xeto
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/exeinfogui/BeOS/PanelBeVersion.xeto.cs b/exeinfogui/BeOS/PanelBeVersion.xeto.cs
new file mode 100644
index 0000000..40b3f70
--- /dev/null
+++ b/exeinfogui/BeOS/PanelBeVersion.xeto.cs
@@ -0,0 +1,39 @@
+using System.Text;
+using Eto.Forms;
+using Eto.Serialization.Xaml;
+using libexeinfo;
+using libexeinfo.BeOS;
+
+namespace exeinfogui.BeOS
+{
+ public class PanelBeVersion : Panel
+ {
+ TextBox txtInternal;
+ TextArea txtLongInfo;
+ TextBox txtMajorVersion;
+ TextBox txtMiddleVersion;
+ TextBox txtMinorVersion;
+ TextBox txtShortInfo;
+ TextBox txtVariety;
+
+ public PanelBeVersion()
+ {
+ XamlReader.Load(this);
+ }
+
+ public void Update(byte[] data, bool bigEndian)
+ {
+ VersionInfo versionInfo = bigEndian
+ ? BigEndianMarshal.ByteArrayToStructureBigEndian(data)
+ : BigEndianMarshal.ByteArrayToStructureLittleEndian(data);
+
+ txtMajorVersion.Text = $"{versionInfo.major}";
+ txtMiddleVersion.Text = $"{versionInfo.middle}";
+ txtMinorVersion.Text = $"{versionInfo.minor}";
+ txtVariety.Text = $"{versionInfo.variety}";
+ txtInternal.Text = $"{versionInfo.interna1}";
+ txtShortInfo.Text = StringHandlers.CToString(versionInfo.short_info, Encoding.UTF8);
+ txtLongInfo.Text = StringHandlers.CToString(versionInfo.long_info, Encoding.UTF8);
+ }
+ }
+}
\ No newline at end of file
diff --git a/exeinfogui/BeOS/TabBeResources.xeto.cs b/exeinfogui/BeOS/TabBeResources.xeto.cs
index a53d723..19ebab1 100644
--- a/exeinfogui/BeOS/TabBeResources.xeto.cs
+++ b/exeinfogui/BeOS/TabBeResources.xeto.cs
@@ -36,11 +36,13 @@ namespace exeinfogui.BeOS
{
public class TabBeResources : TabPage
{
- PanelHexDump panelHexDump;
- PanelText panelText;
- Panel pnlResource;
- TreeGridView treeResources;
- PanelBeIcon panelBeIcon;
+ bool bigEndian;
+ PanelBeIcon panelBeIcon;
+ PanelBeVersion panelBeVersion;
+ PanelHexDump panelHexDump;
+ PanelText panelText;
+ Panel pnlResource;
+ TreeGridView treeResources;
public TabBeResources()
{
@@ -53,12 +55,13 @@ namespace exeinfogui.BeOS
treeResources.AllowMultipleSelection = false;
treeResources.SelectionChanged += TreeResourcesOnSelectionChanged;
- panelHexDump = new PanelHexDump();
- panelText = new PanelText();
- panelBeIcon = new PanelBeIcon();
+ panelHexDump = new PanelHexDump();
+ panelText = new PanelText();
+ panelBeIcon = new PanelBeIcon();
+ panelBeVersion = new PanelBeVersion();
}
- public void Update(IEnumerable resources)
+ public void Update(IEnumerable resources, bool bigEndian)
{
TreeGridItemCollection treeData = new TreeGridItemCollection();
@@ -84,6 +87,7 @@ namespace exeinfogui.BeOS
}
treeResources.DataStore = treeData;
+ this.bigEndian = bigEndian;
}
void TreeResourcesOnSelectionChanged(object sender, EventArgs eventArgs)
@@ -108,6 +112,10 @@ namespace exeinfogui.BeOS
pnlResource.Content = panelBeIcon;
panelBeIcon.Update(data, type);
break;
+ case Consts.B_VERSION_INFO_TYPE:
+ pnlResource.Content = panelBeVersion;
+ panelBeVersion.Update(data, bigEndian);
+ break;
default:
pnlResource.Content = panelHexDump;
panelHexDump.Update(data);
diff --git a/exeinfogui/MainForm.xeto.cs b/exeinfogui/MainForm.xeto.cs
index 90ea323..8f44ec3 100644
--- a/exeinfogui/MainForm.xeto.cs
+++ b/exeinfogui/MainForm.xeto.cs
@@ -162,7 +162,7 @@ namespace exeinfogui
if(((libexeinfo.PE)peExe).BeosResources != null)
{
- tabBeResources.Update(((libexeinfo.PE)peExe).BeosResources);
+ tabBeResources.Update(((libexeinfo.PE)peExe).BeosResources, peExe.IsBigEndian);
tabBeResources.Visible = true;
}
}
diff --git a/libexeinfo/BeOS/Consts.cs b/libexeinfo/BeOS/Consts.cs
index a2dabcf..b90a7d3 100644
--- a/libexeinfo/BeOS/Consts.cs
+++ b/libexeinfo/BeOS/Consts.cs
@@ -26,6 +26,7 @@
namespace libexeinfo.BeOS
{
+ // TODO: Find examples of 'CSTR', 'TEXT', and 'MMSG' with data
public static class Consts
{
internal const int RESOURCES_HEADER_MAGIC = 0x444F1000;
diff --git a/libexeinfo/BeOS/Enums.cs b/libexeinfo/BeOS/Enums.cs
new file mode 100644
index 0000000..b1d0d38
--- /dev/null
+++ b/libexeinfo/BeOS/Enums.cs
@@ -0,0 +1,38 @@
+//
+// Enums.cs
+//
+// Author:
+// Natalia Portillo
+//
+// Copyright (c) 2017-2018 Copyright © Claunia.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+namespace libexeinfo.BeOS
+{
+ public enum InfoVariety : uint
+ {
+ B_DEVELOPMENT_VERSION = 0,
+ B_ALPHA_VERSION,
+ B_BETA_VERSION,
+ B_GAMMA_VERSION,
+ B_GOLDEN_MASTER_VERSION,
+ B_FINAL_VERSION
+ }
+}
\ No newline at end of file
diff --git a/libexeinfo/BeOS/Structs.cs b/libexeinfo/BeOS/Structs.cs
index ade27f3..a7e3eb2 100644
--- a/libexeinfo/BeOS/Structs.cs
+++ b/libexeinfo/BeOS/Structs.cs
@@ -202,4 +202,18 @@ namespace libexeinfo.BeOS
public int index;
public string name;
}
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct VersionInfo
+ {
+ public uint major;
+ public uint middle;
+ public uint minor;
+ public InfoVariety variety;
+ public uint interna1;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
+ public byte[] short_info;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
+ public byte[] long_info;
+ }
}
\ No newline at end of file
diff --git a/libexeinfo/PE/PE.cs b/libexeinfo/PE/PE.cs
index 1aa100c..a028b0b 100644
--- a/libexeinfo/PE/PE.cs
+++ b/libexeinfo/PE/PE.cs
@@ -31,7 +31,7 @@ using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
-using libexeinfo.Windows;
+using libexeinfo.BeOS;
namespace libexeinfo
{
@@ -40,10 +40,11 @@ namespace libexeinfo
///
public partial class PE : IExecutable
{
- MZ baseExecutable;
- DebugDirectory debugDirectory;
- ImageDataDirectory[] directoryEntries;
- string[] exportedNames;
+ MZ baseExecutable;
+ public ResourceTypeBlock[] BeosResources;
+ DebugDirectory debugDirectory;
+ ImageDataDirectory[] directoryEntries;
+ string[] exportedNames;
///
/// Header for this executable
///
@@ -54,7 +55,6 @@ namespace libexeinfo
public Version[] Versions;
public ResourceNode WindowsResourcesRoot;
WindowsHeader64 winHeader;
- public BeOS.ResourceTypeBlock[] BeosResources;
///
/// Initializes a new instance of the class.
@@ -386,10 +386,18 @@ namespace libexeinfo
rsrc.virtualSize = rsrc.sizeOfRawData;
newSectionHeaders.Add(".rsrc", rsrc);
- buffer = new byte[rsrc.sizeOfRawData];
+ buffer = new byte[rsrc.sizeOfRawData];
BaseStream.Position = rsrc.pointerToRawData;
BaseStream.Read(buffer, 0, buffer.Length);
- BeosResources = BeOS.Resources.Decode(buffer);
+ BeosResources = Resources.Decode(buffer);
+
+ strings.AddRange(from type in BeosResources
+ where type.type == Consts.B_VERSION_INFO_TYPE
+ from resource in type.resources
+ select BigEndianMarshal
+ .ByteArrayToStructureLittleEndian(resource.data)
+ into versionInfo
+ select StringHandlers.CToString(versionInfo.long_info));
}
else
{
@@ -427,7 +435,7 @@ namespace libexeinfo
ResourceNode thisNode = new ResourceNode {name = name, id = id, level = level};
if(thisNode.name == null)
- thisNode.name = level == 1 ? Resources.IdToName((ushort)thisNode.id) : $"{thisNode.id}";
+ thisNode.name = level == 1 ? Windows.Resources.IdToName((ushort)thisNode.id) : $"{thisNode.id}";
stream.Position = position;
byte[] buffer = new byte[Marshal.SizeOf(typeof(ResourceDirectoryTable))];
diff --git a/libexeinfo/libexeinfo.csproj b/libexeinfo/libexeinfo.csproj
index 931afcb..c78c93f 100644
--- a/libexeinfo/libexeinfo.csproj
+++ b/libexeinfo/libexeinfo.csproj
@@ -51,6 +51,7 @@
+