Use GEOS character set.

This commit is contained in:
2018-03-07 20:12:19 +00:00
parent 7f5c4f87c5
commit 8a67fffbd2
7 changed files with 33 additions and 28 deletions

View File

@@ -30,8 +30,8 @@
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Claunia.Encoding, Version=1.4.6634.5461, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\Claunia.Encoding.1.5.0\lib\portable40-net40+sl5+win8+wp8\Claunia.Encoding.dll</HintPath>
<Reference Include="Claunia.Encoding, Version=1.6.1.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\Claunia.Encoding.1.6.1\lib\portable40-net40+sl5+win8+wp8\Claunia.Encoding.dll</HintPath>
</Reference>
<Reference Include="System" />
</ItemGroup>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Claunia.Encoding" version="1.5.0" targetFramework="net461" />
<package id="Claunia.Encoding" version="1.6.1" targetFramework="net461" />
</packages>

View File

@@ -8,7 +8,7 @@
<Description>Description of exeinfogui</Description>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Claunia.Encoding" Version="1.5.0" />
<PackageReference Include="Claunia.Encoding" Version="1.6.1" />
<PackageReference Include="Eto.Forms" Version="2.4.1" />
<PackageReference Include="Eto.Serialization.Xaml" Version="2.4.1" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" />

View File

@@ -28,6 +28,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace libexeinfo
{
@@ -36,6 +37,7 @@ namespace libexeinfo
ApplicationHeader applicationHeader;
ApplicationHeaderV2 applicationHeader2;
Export[] exports;
Encoding geosEncoding = Claunia.Encoding.Encoding.GeosEncoding;
GeodeHeader header;
GeodeHeaderV2 header2;
Import[] imports;
@@ -82,7 +84,6 @@ namespace libexeinfo
public IEnumerable<string> Strings { get; private set; }
public IEnumerable<Segment> Segments { get; private set; }
// TODO: GEOS character set
void Initialize()
{
Recognized = false;
@@ -104,9 +105,9 @@ namespace libexeinfo
List<string> strings = new List<string>
{
StringHandlers.CToString(isNewHeader ? header2.name : header.name),
StringHandlers.CToString(isNewHeader ? header2.copyright : header.copyright),
StringHandlers.CToString(isNewHeader ? header2.info : header.info)
StringHandlers.CToString(isNewHeader ? header2.name : header.name, geosEncoding),
StringHandlers.CToString(isNewHeader ? header2.copyright : header.copyright, geosEncoding),
StringHandlers.CToString(isNewHeader ? header2.info : header.info, geosEncoding)
};
uint segmentBase = 0;
@@ -121,7 +122,7 @@ namespace libexeinfo
imports = new Import[applicationHeader2.imports];
exports = new Export[applicationHeader2.exports];
segments = new SegmentDescriptor[applicationHeader2.segments];
strings.Add($"{StringHandlers.CToString(applicationHeader2.name).Trim()}.{StringHandlers.CToString(applicationHeader2.extension).Trim()}");
strings.Add($"{StringHandlers.CToString(applicationHeader2.name, geosEncoding).Trim()}.{StringHandlers.CToString(applicationHeader2.extension, geosEncoding).Trim()}");
}
else
{
@@ -132,7 +133,7 @@ namespace libexeinfo
imports = new Import[applicationHeader.imports];
exports = new Export[applicationHeader.exports];
segments = new SegmentDescriptor[applicationHeader.segments];
strings.Add($"{StringHandlers.CToString(applicationHeader.name).Trim()}.{StringHandlers.CToString(applicationHeader.extension).Trim()}");
strings.Add($"{StringHandlers.CToString(applicationHeader.name, geosEncoding).Trim()}.{StringHandlers.CToString(applicationHeader.extension, geosEncoding).Trim()}");
}
buffer = new byte[Marshal.SizeOf(typeof(Import))];
@@ -140,7 +141,7 @@ namespace libexeinfo
{
BaseStream.Read(buffer, 0, buffer.Length);
imports[i] = BigEndianMarshal.ByteArrayToStructureLittleEndian<Import>(buffer);
strings.Add(StringHandlers.CToString(imports[i].name).Trim());
strings.Add(StringHandlers.CToString(imports[i].name, geosEncoding).Trim());
}
buffer = new byte[Marshal.SizeOf(typeof(Export))];

View File

@@ -43,39 +43,42 @@ namespace libexeinfo
sb.AppendFormat("\tAttributes: {0}",
isNewHeader ? applicationHeader2.attributes : applicationHeader.attributes)
.AppendLine();
sb.AppendFormat("\tName: {0}", StringHandlers.CToString(isNewHeader ? header2.name : header.name))
sb.AppendFormat("\tName: {0}",
StringHandlers.CToString(isNewHeader ? header2.name : header.name, geosEncoding))
.AppendLine();
sb.AppendFormat("\tInternal name: \"{0}.{1}\"",
isNewHeader
? StringHandlers.CToString(applicationHeader2.name).Trim()
: StringHandlers.CToString(applicationHeader.name).Trim(),
? StringHandlers.CToString(applicationHeader2.name, geosEncoding).Trim()
: StringHandlers.CToString(applicationHeader.name, geosEncoding).Trim(),
isNewHeader
? StringHandlers.CToString(applicationHeader2.extension).Trim()
: StringHandlers.CToString(applicationHeader.extension).Trim()).AppendLine();
? StringHandlers.CToString(applicationHeader2.extension, geosEncoding).Trim()
: StringHandlers.CToString(applicationHeader.extension, geosEncoding).Trim())
.AppendLine();
sb.AppendFormat("\tVersion: {0}",
isNewHeader
? $"{header2.release.major}.{header2.release.minor} {header2.release.change}-{header2.release.engineering}"
: $"{header.release.major}.{header.release.minor} {header.release.change}-{header.release.engineering}")
.AppendLine();
sb.AppendFormat("\tCopyright string: {0}",
StringHandlers.CToString(isNewHeader ? header2.copyright : header.copyright))
.AppendLine();
StringHandlers.CToString(isNewHeader ? header2.copyright : header.copyright,
geosEncoding)).AppendLine();
sb.AppendFormat("\tInformational string: {0}",
StringHandlers.CToString(isNewHeader ? header2.info : header.info)).AppendLine();
StringHandlers.CToString(isNewHeader ? header2.info : header.info, geosEncoding))
.AppendLine();
sb.AppendFormat("\tProtocol: {0}",
isNewHeader
? $"{header2.protocol.major}.{header2.protocol.minor}"
: $"{header.protocol.major}.{header.protocol.minor}").AppendLine();
sb.AppendFormat("\tApplication token: \"{0}\" id {1}",
isNewHeader
? StringHandlers.CToString(header2.application.str)
: StringHandlers.CToString(header.creator.str),
? StringHandlers.CToString(header2.application.str, geosEncoding)
: StringHandlers.CToString(header.creator.str, geosEncoding),
isNewHeader ? header2.application.manufacturer : header.creator.manufacturer)
.AppendLine();
sb.AppendFormat("\tToken: \"{0}\" id {1}",
isNewHeader
? StringHandlers.CToString(header2.token.str)
: StringHandlers.CToString(header.token.str),
? StringHandlers.CToString(header2.token.str, geosEncoding)
: StringHandlers.CToString(header.token.str, geosEncoding),
isNewHeader ? header2.token.manufacturer : header.token.manufacturer).AppendLine();
sb.AppendFormat("\tSegments: {0}",
@@ -88,8 +91,9 @@ namespace libexeinfo
sb.AppendFormat("\t{0} imports:", imports.Length).AppendLine();
for(int i = 0; i < imports.Length; i++)
sb.AppendFormat("\t\tImport \"{0}\", attributes {1}, protocol {2}.{3}",
StringHandlers.CToString(imports[i].name).Trim(), imports[i].attributes,
imports[i].protocol.major, imports[i].protocol.minor).AppendLine();
StringHandlers.CToString(imports[i].name, geosEncoding).Trim(),
imports[i].attributes, imports[i].protocol.major, imports[i].protocol.minor)
.AppendLine();
sb.AppendFormat("\t{0} exports:", exports.Length).AppendLine();
for(int i = 0; i < exports.Length; i++)

View File

@@ -40,8 +40,8 @@
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="Claunia.Encoding, Version=1.4.6634.5461, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\Claunia.Encoding.1.5.0\lib\portable40-net40+sl5+win8+wp8\Claunia.Encoding.dll</HintPath>
<Reference Include="Claunia.Encoding, Version=1.6.1.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\Claunia.Encoding.1.6.1\lib\portable40-net40+sl5+win8+wp8\Claunia.Encoding.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Claunia.Encoding" version="1.5.0" targetFramework="net46" />
<package id="Claunia.Encoding" version="1.6.1" targetFramework="net46" />
<package id="NuGet.Build.Packaging" version="0.1.276" targetFramework="net46" developmentDependency="true" />
<package id="System.ValueTuple" version="4.4.0" targetFramework="net46" />
</packages>