mirror of
https://github.com/claunia/libexeinfo.git
synced 2025-12-16 19:14:24 +00:00
Refactor class names.
This commit is contained in:
@@ -33,10 +33,10 @@ namespace exeinfo
|
|||||||
mzHdr = (libexeinfo.MZ.Header)Marshal.PtrToStructure(hdrPtr, typeof(libexeinfo.MZ.Header));
|
mzHdr = (libexeinfo.MZ.Header)Marshal.PtrToStructure(hdrPtr, typeof(libexeinfo.MZ.Header));
|
||||||
Marshal.FreeHGlobal(hdrPtr);
|
Marshal.FreeHGlobal(hdrPtr);
|
||||||
|
|
||||||
if(mzHdr.signature == libexeinfo.MZ.Consts.Signature)
|
if(mzHdr.signature == libexeinfo.MZ.Signature)
|
||||||
{
|
{
|
||||||
recognized = true;
|
recognized = true;
|
||||||
libexeinfo.MZ.Info.PrintInfo(mzHdr);
|
libexeinfo.MZ.PrintInfo(mzHdr);
|
||||||
|
|
||||||
if (mzHdr.new_offset < exeFs.Length)
|
if (mzHdr.new_offset < exeFs.Length)
|
||||||
{
|
{
|
||||||
@@ -49,10 +49,10 @@ namespace exeinfo
|
|||||||
neHdr = (libexeinfo.NE.Header)Marshal.PtrToStructure(hdrPtr, typeof(libexeinfo.NE.Header));
|
neHdr = (libexeinfo.NE.Header)Marshal.PtrToStructure(hdrPtr, typeof(libexeinfo.NE.Header));
|
||||||
Marshal.FreeHGlobal(hdrPtr);
|
Marshal.FreeHGlobal(hdrPtr);
|
||||||
|
|
||||||
if (neHdr.signature == libexeinfo.NE.Consts.Signature)
|
if (neHdr.signature == libexeinfo.NE.Signature)
|
||||||
{
|
{
|
||||||
libexeinfo.NE.Info.PrintInfo(neHdr);
|
libexeinfo.NE.PrintInfo(neHdr);
|
||||||
libexeinfo.NE.ResourceTable resources = libexeinfo.NE.Info.GetResources(exeFs, mzHdr.new_offset, neHdr.resource_table_offset);
|
libexeinfo.NE.ResourceTable resources = libexeinfo.NE.GetResources(exeFs, mzHdr.new_offset, neHdr.resource_table_offset);
|
||||||
foreach(libexeinfo.NE.ResourceType type in resources.types)
|
foreach(libexeinfo.NE.ResourceType type in resources.types)
|
||||||
{
|
{
|
||||||
if((type.id & 0x7FFF) == (int)libexeinfo.NE.ResourceTypes.RT_VERSION)
|
if((type.id & 0x7FFF) == (int)libexeinfo.NE.ResourceTypes.RT_VERSION)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
namespace libexeinfo.MZ
|
namespace libexeinfo
|
||||||
{
|
{
|
||||||
public class Consts
|
public partial class MZ
|
||||||
{
|
{
|
||||||
public const ushort Signature = 0x5A4D;
|
public const ushort Signature = 0x5A4D;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
namespace libexeinfo.MZ
|
namespace libexeinfo
|
||||||
{
|
{
|
||||||
public class Info
|
public partial class MZ
|
||||||
{
|
{
|
||||||
public static void PrintInfo(Header header)
|
public static void PrintInfo(Header header)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace libexeinfo.MZ
|
namespace libexeinfo
|
||||||
|
{
|
||||||
|
public partial class MZ
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
public struct Header
|
public struct Header
|
||||||
@@ -29,9 +31,10 @@ namespace libexeinfo.MZ
|
|||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
struct RelocationTableEntry
|
public struct RelocationTableEntry
|
||||||
{
|
{
|
||||||
public ushort offset;
|
public ushort offset;
|
||||||
public ushort segment;
|
public ushort segment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
namespace libexeinfo.NE
|
namespace libexeinfo
|
||||||
{
|
{
|
||||||
public static class Consts
|
public partial class NE
|
||||||
{
|
{
|
||||||
public const ushort Signature = 0x454E;
|
public const ushort Signature = 0x454E;
|
||||||
public static readonly string FixedFileInfo = "VS_VERSION_INFO";
|
public static readonly string FixedFileInfoSig = "VS_VERSION_INFO";
|
||||||
public static readonly string StringFileInfo = "StringFileInfo";
|
public static readonly string StringFileInfo = "StringFileInfo";
|
||||||
|
|
||||||
public static string IdToName(ushort id)
|
public static string IdToName(ushort id)
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
namespace libexeinfo.NE
|
namespace libexeinfo
|
||||||
|
{
|
||||||
|
public partial class NE
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum ProgramFlags : byte
|
public enum ProgramFlags : byte
|
||||||
@@ -158,3 +160,4 @@ namespace libexeinfo.NE
|
|||||||
VFT2_FONT_VECTOR = 0x00000002,
|
VFT2_FONT_VECTOR = 0x00000002,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace libexeinfo.NE
|
namespace libexeinfo
|
||||||
{
|
{
|
||||||
public class Info
|
public partial class NE
|
||||||
{
|
{
|
||||||
public static void PrintInfo(Header header)
|
public static void PrintInfo(Header header)
|
||||||
{
|
{
|
||||||
@@ -190,7 +190,7 @@ namespace libexeinfo.NE
|
|||||||
table.types[t].name = Encoding.ASCII.GetString(str);
|
table.types[t].name = Encoding.ASCII.GetString(str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
table.types[t].name = Consts.IdToName(table.types[t].id);
|
table.types[t].name = IdToName(table.types[t].id);
|
||||||
|
|
||||||
for (int r = 0; r < table.types[t].resources.Length; r++)
|
for (int r = 0; r < table.types[t].resources.Length; r++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace libexeinfo.NE
|
namespace libexeinfo
|
||||||
|
{
|
||||||
|
public partial class NE
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential/*, Pack = 2*/)]
|
[StructLayout(LayoutKind.Sequential/*, Pack = 2*/)]
|
||||||
public struct Header
|
public struct Header
|
||||||
@@ -97,3 +99,4 @@ namespace libexeinfo.NE
|
|||||||
public uint dwFileDateLS;
|
public uint dwFileDateLS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,9 @@ using System.IO;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace libexeinfo.NE
|
namespace libexeinfo
|
||||||
|
{
|
||||||
|
public partial class NE
|
||||||
{
|
{
|
||||||
public class Version
|
public class Version
|
||||||
{
|
{
|
||||||
@@ -130,7 +132,7 @@ namespace libexeinfo.NE
|
|||||||
|
|
||||||
void DecodeNode(VersionNode node, string parent, string grandparent)
|
void DecodeNode(VersionNode node, string parent, string grandparent)
|
||||||
{
|
{
|
||||||
if (node.szName == Consts.FixedFileInfo)
|
if (node.szName == FixedFileInfoSig)
|
||||||
{
|
{
|
||||||
IntPtr infoPtr = Marshal.AllocHGlobal(node.cbData);
|
IntPtr infoPtr = Marshal.AllocHGlobal(node.cbData);
|
||||||
Marshal.Copy(node.rgbData, 0, infoPtr, node.cbData);
|
Marshal.Copy(node.rgbData, 0, infoPtr, node.cbData);
|
||||||
@@ -148,13 +150,13 @@ namespace libexeinfo.NE
|
|||||||
fileDate = DateTime.FromFileTime(info.dwFileDateMS * 0x100000000 + info.dwFileDateLS);
|
fileDate = DateTime.FromFileTime(info.dwFileDateMS * 0x100000000 + info.dwFileDateLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent == Consts.StringFileInfo)
|
if (parent == StringFileInfo)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> strings = new Dictionary<string, string>();
|
Dictionary<string, string> strings = new Dictionary<string, string>();
|
||||||
StringsByLanguage.Add(node.szName, strings);
|
StringsByLanguage.Add(node.szName, strings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grandparent == Consts.StringFileInfo)
|
if (grandparent == StringFileInfo)
|
||||||
{
|
{
|
||||||
if (StringsByLanguage.TryGetValue(parent, out Dictionary<string, string> strings))
|
if (StringsByLanguage.TryGetValue(parent, out Dictionary<string, string> strings))
|
||||||
{
|
{
|
||||||
@@ -314,3 +316,4 @@ namespace libexeinfo.NE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user