mirror of
https://github.com/claunia/libexeinfo.git
synced 2025-12-16 19:14:24 +00:00
Add GUI viewers for PE resources.
This commit is contained in:
@@ -30,6 +30,7 @@ using exeinfogui.GEM;
|
|||||||
using exeinfogui.LE;
|
using exeinfogui.LE;
|
||||||
using exeinfogui.LX;
|
using exeinfogui.LX;
|
||||||
using exeinfogui.NE;
|
using exeinfogui.NE;
|
||||||
|
using exeinfogui.PE;
|
||||||
using Eto.Forms;
|
using Eto.Forms;
|
||||||
using Eto.Serialization.Xaml;
|
using Eto.Serialization.Xaml;
|
||||||
using libexeinfo;
|
using libexeinfo;
|
||||||
@@ -42,8 +43,10 @@ namespace exeinfogui
|
|||||||
Label lblSubsystem;
|
Label lblSubsystem;
|
||||||
TabGemResources tabGemResources;
|
TabGemResources tabGemResources;
|
||||||
TabLeVxdVersion tabLeVxdVersion;
|
TabLeVxdVersion tabLeVxdVersion;
|
||||||
|
TabLxResources tabLxResources;
|
||||||
TabControl tabMain;
|
TabControl tabMain;
|
||||||
TabNeResources tabNeResources;
|
TabNeResources tabNeResources;
|
||||||
|
TabPeResources tabPeResources;
|
||||||
TabPageSegments tabSegments;
|
TabPageSegments tabSegments;
|
||||||
TabPageStrings tabStrings;
|
TabPageStrings tabStrings;
|
||||||
TextBox txtFile;
|
TextBox txtFile;
|
||||||
@@ -51,7 +54,6 @@ namespace exeinfogui
|
|||||||
TextBox txtOs;
|
TextBox txtOs;
|
||||||
TextBox txtSubsystem;
|
TextBox txtSubsystem;
|
||||||
TextBox txtType;
|
TextBox txtType;
|
||||||
TabLxResources tabLxResources;
|
|
||||||
|
|
||||||
public MainForm()
|
public MainForm()
|
||||||
{
|
{
|
||||||
@@ -62,13 +64,15 @@ namespace exeinfogui
|
|||||||
tabGemResources = new TabGemResources {Visible = false};
|
tabGemResources = new TabGemResources {Visible = false};
|
||||||
tabNeResources = new TabNeResources {Visible = false};
|
tabNeResources = new TabNeResources {Visible = false};
|
||||||
tabLeVxdVersion = new TabLeVxdVersion {Visible = false};
|
tabLeVxdVersion = new TabLeVxdVersion {Visible = false};
|
||||||
tabLxResources = new TabLxResources {Visible = false};
|
tabLxResources = new TabLxResources {Visible = false};
|
||||||
|
tabPeResources = new TabPeResources {Visible = false};
|
||||||
tabMain.Pages.Add(tabSegments);
|
tabMain.Pages.Add(tabSegments);
|
||||||
tabMain.Pages.Add(tabStrings);
|
tabMain.Pages.Add(tabStrings);
|
||||||
tabMain.Pages.Add(tabGemResources);
|
tabMain.Pages.Add(tabGemResources);
|
||||||
tabMain.Pages.Add(tabNeResources);
|
tabMain.Pages.Add(tabNeResources);
|
||||||
tabMain.Pages.Add(tabLeVxdVersion);
|
tabMain.Pages.Add(tabLeVxdVersion);
|
||||||
tabMain.Pages.Add(tabLxResources);
|
tabMain.Pages.Add(tabLxResources);
|
||||||
|
tabMain.Pages.Add(tabPeResources);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void OnBtnLoadClick(object sender, EventArgs e)
|
protected void OnBtnLoadClick(object sender, EventArgs e)
|
||||||
@@ -84,7 +88,8 @@ namespace exeinfogui
|
|||||||
tabSegments.Visible = false;
|
tabSegments.Visible = false;
|
||||||
tabNeResources.Visible = false;
|
tabNeResources.Visible = false;
|
||||||
tabLeVxdVersion.Visible = false;
|
tabLeVxdVersion.Visible = false;
|
||||||
tabLxResources.Visible = false;
|
tabLxResources.Visible = false;
|
||||||
|
tabPeResources.Visible = false;
|
||||||
|
|
||||||
OpenFileDialog dlgOpen = new OpenFileDialog {Title = "Choose executable file", MultiSelect = false};
|
OpenFileDialog dlgOpen = new OpenFileDialog {Title = "Choose executable file", MultiSelect = false};
|
||||||
|
|
||||||
@@ -101,7 +106,7 @@ namespace exeinfogui
|
|||||||
IExecutable stExe = new AtariST(dlgOpen.FileName);
|
IExecutable stExe = new AtariST(dlgOpen.FileName);
|
||||||
IExecutable lxExe = new libexeinfo.LX(dlgOpen.FileName);
|
IExecutable lxExe = new libexeinfo.LX(dlgOpen.FileName);
|
||||||
IExecutable coffExe = new COFF(dlgOpen.FileName);
|
IExecutable coffExe = new COFF(dlgOpen.FileName);
|
||||||
IExecutable peExe = new PE(dlgOpen.FileName);
|
IExecutable peExe = new libexeinfo.PE(dlgOpen.FileName);
|
||||||
IExecutable geosExe = new Geos(dlgOpen.FileName);
|
IExecutable geosExe = new Geos(dlgOpen.FileName);
|
||||||
IExecutable recognizedExe = null;
|
IExecutable recognizedExe = null;
|
||||||
|
|
||||||
@@ -133,13 +138,24 @@ namespace exeinfogui
|
|||||||
tabLeVxdVersion.Visible = true;
|
tabLeVxdVersion.Visible = true;
|
||||||
tabLeVxdVersion.Update(((libexeinfo.LX)lxExe).WinVersion);
|
tabLeVxdVersion.Update(((libexeinfo.LX)lxExe).WinVersion);
|
||||||
}
|
}
|
||||||
if(((libexeinfo.LX)lxExe).neFormatResourceTable.types != null && ((libexeinfo.LX)lxExe).neFormatResourceTable.types.Any())
|
|
||||||
|
if(((libexeinfo.LX)lxExe).neFormatResourceTable.types != null &&
|
||||||
|
((libexeinfo.LX)lxExe).neFormatResourceTable.types.Any())
|
||||||
{
|
{
|
||||||
tabLxResources.Update(((libexeinfo.LX)lxExe).neFormatResourceTable.types);
|
tabLxResources.Update(((libexeinfo.LX)lxExe).neFormatResourceTable.types);
|
||||||
tabLxResources.Visible = true;
|
tabLxResources.Visible = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(peExe.Recognized) recognizedExe = peExe;
|
else if(peExe.Recognized)
|
||||||
|
{
|
||||||
|
recognizedExe = peExe;
|
||||||
|
if(((libexeinfo.PE)peExe).WindowsResourcesRoot != null &&
|
||||||
|
((libexeinfo.PE)peExe).WindowsResourcesRoot.children != null)
|
||||||
|
{
|
||||||
|
tabPeResources.Update(((libexeinfo.PE)peExe).WindowsResourcesRoot);
|
||||||
|
tabPeResources.Visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(stExe.Recognized)
|
else if(stExe.Recognized)
|
||||||
{
|
{
|
||||||
recognizedExe = stExe;
|
recognizedExe = stExe;
|
||||||
|
|||||||
@@ -37,15 +37,14 @@ namespace exeinfogui.NE
|
|||||||
{
|
{
|
||||||
public class TabNeResources : TabPage
|
public class TabNeResources : TabPage
|
||||||
{
|
{
|
||||||
PanelHexDump panelHexDump;
|
PanelHexDump panelHexDump;
|
||||||
PanelNeAccelerators panelNeAccelerators;
|
PanelNeAccelerators panelNeAccelerators;
|
||||||
PanelNeStrings panelNeStrings;
|
PanelNeStrings panelNeStrings;
|
||||||
PanelOs2Bitmap panelOs2Bitmap;
|
PanelOs2Bitmap panelOs2Bitmap;
|
||||||
PanelWin16Version panelWin16Version;
|
PanelWin16Version panelWin16Version;
|
||||||
PanelWindowsIcon panelWindowsIcon;
|
PanelWindowsIcon panelWindowsIcon;
|
||||||
Panel pnlResource;
|
Panel pnlResource;
|
||||||
TreeGridItemCollection treeData;
|
TreeGridView treeResources;
|
||||||
TreeGridView treeResources;
|
|
||||||
|
|
||||||
public TabNeResources()
|
public TabNeResources()
|
||||||
{
|
{
|
||||||
@@ -68,7 +67,7 @@ namespace exeinfogui.NE
|
|||||||
|
|
||||||
public void Update(IEnumerable<libexeinfo.NE.ResourceType> resourceTypes, libexeinfo.NE.TargetOS os)
|
public void Update(IEnumerable<libexeinfo.NE.ResourceType> resourceTypes, libexeinfo.NE.TargetOS os)
|
||||||
{
|
{
|
||||||
treeData = new TreeGridItemCollection();
|
TreeGridItemCollection treeData = new TreeGridItemCollection();
|
||||||
|
|
||||||
foreach(libexeinfo.NE.ResourceType resourceType in resourceTypes.OrderBy(r => r.name))
|
foreach(libexeinfo.NE.ResourceType resourceType in resourceTypes.OrderBy(r => r.name))
|
||||||
{
|
{
|
||||||
|
|||||||
8
exeinfogui/PE/PanelPeStrings.xeto
Normal file
8
exeinfogui/PE/PanelPeStrings.xeto
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Panel xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<StackLayout Orientation="Vertical">
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
||||||
|
<GridView ID="treeStrings" ShowHeader="False"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
</Panel>
|
||||||
52
exeinfogui/PE/PanelPeStrings.xeto.cs
Normal file
52
exeinfogui/PE/PanelPeStrings.xeto.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
//
|
||||||
|
// PanelPeStrings.xeto.cs
|
||||||
|
//
|
||||||
|
// Author:
|
||||||
|
// Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
using Eto.Forms;
|
||||||
|
using Eto.Serialization.Xaml;
|
||||||
|
|
||||||
|
namespace exeinfogui.PE
|
||||||
|
{
|
||||||
|
public class PanelPeStrings : Panel
|
||||||
|
{
|
||||||
|
GridView treeStrings;
|
||||||
|
|
||||||
|
public PanelPeStrings()
|
||||||
|
{
|
||||||
|
XamlReader.Load(this);
|
||||||
|
|
||||||
|
treeStrings.Columns.Add(new GridColumn
|
||||||
|
{
|
||||||
|
DataCell = new TextBoxCell {Binding = Binding.Property<string, string>(r => r)},
|
||||||
|
HeaderText = "String"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(byte[] data)
|
||||||
|
{
|
||||||
|
treeStrings.DataStore = libexeinfo.PE.GetStrings(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
85
exeinfogui/PE/PanelPeVersion.xeto
Normal file
85
exeinfogui/PE/PanelPeVersion.xeto
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Panel xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Top">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<StackLayoutItem>
|
||||||
|
<Label ID="lblFileVersion">File version</Label>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||||
|
<TextBox ID="txtFileVersion" ReadOnly="True"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<StackLayoutItem>
|
||||||
|
<Label ID="lblProductVersion">Product version</Label>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||||
|
<TextBox ID="txtProductVersion" ReadOnly="True"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<StackLayoutItem>
|
||||||
|
<Label ID="lblFileType">File type</Label>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||||
|
<TextBox ID="txtFileType" ReadOnly="True"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<StackLayoutItem>
|
||||||
|
<Label ID="lblFileSubtype">File subtype</Label>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||||
|
<TextBox ID="txtFileSubtype" ReadOnly="True"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<StackLayoutItem>
|
||||||
|
<Label ID="lblFileFlags">File flags</Label>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||||
|
<TextBox ID="txtFileFlags" ReadOnly="True"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<StackLayoutItem>
|
||||||
|
<Label ID="lblFileOs">File OS</Label>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||||
|
<TextBox ID="txtFileOs" ReadOnly="True"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<StackLayoutItem>
|
||||||
|
<Label ID="lblFileDate">File date</Label>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||||
|
<TextBox ID="txtFileDate" ReadOnly="True"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||||
|
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
|
||||||
|
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
|
<StackLayout Orientation="Vertical">
|
||||||
|
<StackLayoutItem HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||||
|
<Label ID="lblLanguages">Language</Label>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
|
<GridView ID="treeLanguages" ShowHeader="False"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
|
<StackLayout Orientation="Vertical">
|
||||||
|
<StackLayoutItem HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||||
|
<Label ID="lblStrings">Strings</Label>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
|
<GridView ID="treeStrings"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
</Panel>
|
||||||
151
exeinfogui/PE/PanelPeVersion.xeto.cs
Normal file
151
exeinfogui/PE/PanelPeVersion.xeto.cs
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
//
|
||||||
|
// PanelPeVersion.xeto.cs
|
||||||
|
//
|
||||||
|
// Author:
|
||||||
|
// Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Text;
|
||||||
|
using Eto.Forms;
|
||||||
|
using Eto.Serialization.Xaml;
|
||||||
|
using libexeinfo.Windows;
|
||||||
|
using Version = libexeinfo.Windows.Version;
|
||||||
|
|
||||||
|
namespace exeinfogui.PE
|
||||||
|
{
|
||||||
|
public class PanelPeVersion : Panel
|
||||||
|
{
|
||||||
|
ObservableCollection<StrByLang> stringsByLanguage;
|
||||||
|
GridView treeLanguages;
|
||||||
|
GridView treeStrings;
|
||||||
|
TextBox txtFileDate;
|
||||||
|
TextBox txtFileFlags;
|
||||||
|
TextBox txtFileOs;
|
||||||
|
TextBox txtFileSubtype;
|
||||||
|
TextBox txtFileType;
|
||||||
|
TextBox txtFileVersion;
|
||||||
|
TextBox txtProductVersion;
|
||||||
|
|
||||||
|
public PanelPeVersion()
|
||||||
|
{
|
||||||
|
XamlReader.Load(this);
|
||||||
|
|
||||||
|
treeLanguages.Columns.Add(new GridColumn
|
||||||
|
{
|
||||||
|
DataCell = new TextBoxCell {Binding = Binding.Property<StrByLang, string>(r => r.Name)},
|
||||||
|
HeaderText = "Language (codepage)"
|
||||||
|
});
|
||||||
|
|
||||||
|
treeStrings.Columns.Add(new GridColumn
|
||||||
|
{
|
||||||
|
DataCell = new TextBoxCell {Binding = Binding.Property<Strings, string>(r => r.Key)},
|
||||||
|
HeaderText = "Key"
|
||||||
|
});
|
||||||
|
|
||||||
|
treeStrings.Columns.Add(new GridColumn
|
||||||
|
{
|
||||||
|
DataCell = new TextBoxCell {Binding = Binding.Property<Strings, string>(r => r.Value)},
|
||||||
|
HeaderText = "Value"
|
||||||
|
});
|
||||||
|
|
||||||
|
stringsByLanguage = new ObservableCollection<StrByLang>();
|
||||||
|
treeLanguages.SelectionChanged += TreeLanguagesOnSelectionChanged;
|
||||||
|
treeLanguages.AllowMultipleSelection = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TreeLanguagesOnSelectionChanged(object sender, EventArgs eventArgs)
|
||||||
|
{
|
||||||
|
treeStrings.DataStore = null;
|
||||||
|
if(!(treeLanguages.SelectedItem is StrByLang strs)) return;
|
||||||
|
|
||||||
|
List<Strings> strings = new List<Strings>();
|
||||||
|
foreach(KeyValuePair<string, string> kvp in strs.Strings)
|
||||||
|
strings.Add(new Strings {Key = kvp.Key, Value = kvp.Value});
|
||||||
|
|
||||||
|
treeStrings.DataStore = strings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(byte[] data)
|
||||||
|
{
|
||||||
|
Update(new libexeinfo.PE.Version(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(libexeinfo.PE.Version version)
|
||||||
|
{
|
||||||
|
txtFileDate.Text = version.FileDate != new DateTime(1601, 1, 1) ? $"{version.FileDate}" : "Not set";
|
||||||
|
txtFileFlags.Text = version.FileFlags == 0 ? "Normal" : $"{version.FileFlags}";
|
||||||
|
txtFileOs.Text = Version.OsToString(version.FileOs);
|
||||||
|
|
||||||
|
if(version.FileType == VersionFileType.VFT_DRV)
|
||||||
|
txtFileSubtype.Text = $"{Version.DriverToString(version.FileSubtype)} driver";
|
||||||
|
else if(version.FileType == VersionFileType.VFT_DRV)
|
||||||
|
txtFileSubtype.Text = $"{Version.FontToString(version.FileSubtype)} font";
|
||||||
|
else if(version.FileSubtype > 0) txtFileSubtype.Text = $"{(uint)version.FileSubtype}";
|
||||||
|
else txtFileSubtype.Text = "None";
|
||||||
|
|
||||||
|
txtFileType.Text = Version.TypeToString(version.FileType);
|
||||||
|
txtFileVersion.Text = $"{version.FileVersion}";
|
||||||
|
txtProductVersion.Text = $"{version.ProductVersion}";
|
||||||
|
|
||||||
|
stringsByLanguage.Clear();
|
||||||
|
|
||||||
|
foreach(KeyValuePair<string, Dictionary<string, string>> strByLang in version.StringsByLanguage)
|
||||||
|
{
|
||||||
|
string cultureName;
|
||||||
|
string encodingName;
|
||||||
|
|
||||||
|
try { cultureName = new CultureInfo(Convert.ToInt32(strByLang.Key.Substring(0, 4), 16)).DisplayName; }
|
||||||
|
catch { cultureName = $"0x{Convert.ToInt32(strByLang.Key.Substring(0, 4), 16):X4}"; }
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
encodingName = Encoding.GetEncoding(Convert.ToInt32(strByLang.Key.Substring(4), 16)).EncodingName;
|
||||||
|
}
|
||||||
|
catch { encodingName = $"0x{Convert.ToInt32(strByLang.Key.Substring(4), 16):X4}"; }
|
||||||
|
|
||||||
|
stringsByLanguage.Add(new StrByLang
|
||||||
|
{
|
||||||
|
Name = $"{cultureName} ({encodingName})",
|
||||||
|
Strings = strByLang.Value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
treeLanguages.DataStore = stringsByLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
|
class StrByLang
|
||||||
|
{
|
||||||
|
public Dictionary<string, string> Strings;
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
class Strings
|
||||||
|
{
|
||||||
|
public string Key { get; set; }
|
||||||
|
public string Value { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
exeinfogui/PE/TabPeResources.xeto
Normal file
15
exeinfogui/PE/TabPeResources.xeto
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<TabPage Text="PE Resources" xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<StackLayout Orientation="Vertical">
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
||||||
|
<TreeGridView ID="treeResources"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
||||||
|
<Panel ID="pnlResource"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
</TabPage>
|
||||||
121
exeinfogui/PE/TabPeResources.xeto.cs
Normal file
121
exeinfogui/PE/TabPeResources.xeto.cs
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
//
|
||||||
|
// TabPeResources.xeto.cs
|
||||||
|
//
|
||||||
|
// Author:
|
||||||
|
// Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using exeinfogui.Windows;
|
||||||
|
using Eto.Forms;
|
||||||
|
using Eto.Serialization.Xaml;
|
||||||
|
|
||||||
|
namespace exeinfogui.PE
|
||||||
|
{
|
||||||
|
public class TabPeResources : TabPage
|
||||||
|
{
|
||||||
|
PanelHexDump panelHexDump;
|
||||||
|
PanelPeStrings panelPeStrings;
|
||||||
|
PanelPeVersion panelPeVersion;
|
||||||
|
PanelText panelText;
|
||||||
|
PanelWindowsIcon panelWindowsIcon;
|
||||||
|
Panel pnlResource;
|
||||||
|
TreeGridView treeResources;
|
||||||
|
|
||||||
|
public TabPeResources()
|
||||||
|
{
|
||||||
|
XamlReader.Load(this);
|
||||||
|
|
||||||
|
treeResources.Columns.Add(new GridColumn {HeaderText = "Identifier", DataCell = new TextBoxCell(0)});
|
||||||
|
treeResources.Columns.Add(new GridColumn {HeaderText = "Size", DataCell = new TextBoxCell(1)});
|
||||||
|
|
||||||
|
treeResources.AllowMultipleSelection = false;
|
||||||
|
treeResources.SelectionChanged += TreeResourcesOnSelectionChanged;
|
||||||
|
|
||||||
|
panelPeVersion = new PanelPeVersion();
|
||||||
|
panelPeStrings = new PanelPeStrings();
|
||||||
|
panelHexDump = new PanelHexDump();
|
||||||
|
panelWindowsIcon = new PanelWindowsIcon();
|
||||||
|
panelText = new PanelText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(libexeinfo.PE.ResourceNode root)
|
||||||
|
{
|
||||||
|
TreeGridItemCollection treeData = new TreeGridItemCollection();
|
||||||
|
|
||||||
|
foreach(libexeinfo.PE.ResourceNode rootChild in root.children)
|
||||||
|
treeData.Add(GetChildren(rootChild, rootChild.name));
|
||||||
|
|
||||||
|
treeResources.DataStore = treeData;
|
||||||
|
}
|
||||||
|
|
||||||
|
static TreeGridItem GetChildren(libexeinfo.PE.ResourceNode node, string type)
|
||||||
|
{
|
||||||
|
string sizeStr = node.data == null ? null : $"{node.data.Length}";
|
||||||
|
|
||||||
|
TreeGridItem item = new TreeGridItem {Values = new object[] {$"{node.name}", sizeStr, type, node.data}};
|
||||||
|
|
||||||
|
if(node.children == null) return item;
|
||||||
|
|
||||||
|
foreach(libexeinfo.PE.ResourceNode child in node.children) item.Children.Add(GetChildren(child, type));
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TreeResourcesOnSelectionChanged(object sender, EventArgs eventArgs)
|
||||||
|
{
|
||||||
|
if(((TreeGridItem)treeResources.SelectedItem)?.Values[3] == null)
|
||||||
|
{
|
||||||
|
pnlResource.Content = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] data = ((TreeGridItem)treeResources.SelectedItem)?.Values[3] as byte[];
|
||||||
|
string type = ((TreeGridItem)treeResources.SelectedItem)?.Values[2] as string;
|
||||||
|
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case "RT_STRING":
|
||||||
|
pnlResource.Content = panelPeStrings;
|
||||||
|
panelPeStrings.Update(data);
|
||||||
|
break;
|
||||||
|
case "RT_ICON":
|
||||||
|
pnlResource.Content = panelWindowsIcon;
|
||||||
|
panelWindowsIcon.Update(data);
|
||||||
|
break;
|
||||||
|
case "RT_VERSION":
|
||||||
|
pnlResource.Content = panelPeVersion;
|
||||||
|
panelPeVersion.Update(data);
|
||||||
|
break;
|
||||||
|
case "RT_MANIFEST":
|
||||||
|
pnlResource.Content = panelText;
|
||||||
|
panelText.Update(data, Encoding.UTF8);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
pnlResource.Content = panelHexDump;
|
||||||
|
panelHexDump.Update(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
exeinfogui/PanelText.xeto
Normal file
11
exeinfogui/PanelText.xeto
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Panel xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<StackLayout Orientation="Vertical">
|
||||||
|
<StackLayoutItem HorizontalAlignment="Center">
|
||||||
|
<Label>Text</Label>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
|
<TextArea ID="txtText" ReadOnly="True" Wrap="True"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
</Panel>
|
||||||
47
exeinfogui/PanelText.xeto.cs
Normal file
47
exeinfogui/PanelText.xeto.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
//
|
||||||
|
// PanelText.xeto.cs
|
||||||
|
//
|
||||||
|
// Author:
|
||||||
|
// Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
using System.Text;
|
||||||
|
using Eto.Forms;
|
||||||
|
using Eto.Serialization.Xaml;
|
||||||
|
|
||||||
|
namespace exeinfogui
|
||||||
|
{
|
||||||
|
public class PanelText : Panel
|
||||||
|
{
|
||||||
|
TextArea txtText;
|
||||||
|
|
||||||
|
public PanelText()
|
||||||
|
{
|
||||||
|
XamlReader.Load(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(byte[] data, Encoding encoding)
|
||||||
|
{
|
||||||
|
txtText.Text = encoding.GetString(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,5 +27,6 @@
|
|||||||
<Folder Include="Windows\" />
|
<Folder Include="Windows\" />
|
||||||
<Folder Include="LE\" />
|
<Folder Include="LE\" />
|
||||||
<Folder Include="LX\" />
|
<Folder Include="LX\" />
|
||||||
|
<Folder Include="PE\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user