mirror of
https://github.com/claunia/libexeinfo.git
synced 2025-12-16 19:14:24 +00:00
Split resource types and id-to-name converters from NE to Windows/OS2 classes as they are used also by LX and PE formats.
This commit is contained in:
@@ -367,7 +367,7 @@ namespace libexeinfo
|
||||
{
|
||||
neFormatResourceTable.types[counter].count = (ushort)kvp.Value.Count;
|
||||
neFormatResourceTable.types[counter].id = (ushort)kvp.Key;
|
||||
neFormatResourceTable.types[counter].name = NE.ResourceIdToNameOs2((ushort)kvp.Key);
|
||||
neFormatResourceTable.types[counter].name = Resources.IdToName((ushort)kvp.Key);
|
||||
neFormatResourceTable.types[counter].resources = kvp.Value.OrderBy(r => r.id).ToArray();
|
||||
counter++;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using libexeinfo.Os2;
|
||||
|
||||
namespace libexeinfo
|
||||
{
|
||||
public partial class NE
|
||||
@@ -48,78 +46,5 @@ namespace libexeinfo
|
||||
const ushort SEGMENT_DISCARD_MASK = 0xF000;
|
||||
const ushort SEGMENT_IOPRVL_MASK = 0xC00;
|
||||
public const ushort KNOWN_RSRC_FLAGS = 0x1070;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of a resource type according to its identifier
|
||||
/// </summary>
|
||||
/// <returns>The resource type name.</returns>
|
||||
/// <param name="id">Resource type identifier.</param>
|
||||
public static string ResourceIdToName(ushort id)
|
||||
{
|
||||
switch(id & 0x7FFF)
|
||||
{
|
||||
case (int)ResourceTypes.RT_ACCELERATOR: return "RT_ACCELERATOR";
|
||||
case (int)ResourceTypes.RT_ANICURSOR: return "RT_ANICURSOR";
|
||||
case (int)ResourceTypes.RT_ANIICON: return "RT_ANIICON";
|
||||
case (int)ResourceTypes.RT_BITMAP: return "RT_BITMAP";
|
||||
case (int)ResourceTypes.RT_CURSOR: return "RT_CURSOR";
|
||||
case (int)ResourceTypes.RT_DIALOG: return "RT_DIALOG";
|
||||
case (int)ResourceTypes.RT_DIALOGEX: return "RT_DIALOGEX";
|
||||
case (int)ResourceTypes.RT_DLGINCLUDE: return "RT_DLGINCLUDE";
|
||||
case (int)ResourceTypes.RT_DLGINIT: return "RT_DLGINIT";
|
||||
case (int)ResourceTypes.RT_FONT: return "RT_FONT";
|
||||
case (int)ResourceTypes.RT_FONTDIR: return "RT_FONTDIR";
|
||||
case (int)ResourceTypes.RT_GROUP_CURSOR: return "RT_GROUP_CURSOR";
|
||||
case (int)ResourceTypes.RT_GROUP_ICON: return "RT_GROUP_ICON";
|
||||
case (int)ResourceTypes.RT_HTML: return "RT_HTML";
|
||||
case (int)ResourceTypes.RT_ICON: return "RT_ICON";
|
||||
case (int)ResourceTypes.RT_MANIFEST: return "RT_MANIFEST";
|
||||
case (int)ResourceTypes.RT_MENU: return "RT_MENU";
|
||||
case (int)ResourceTypes.RT_MENUEX: return "RT_MENUEX";
|
||||
case (int)ResourceTypes.RT_MESSAGETABLE: return "RT_MESSAGETABLE";
|
||||
case (int)ResourceTypes.RT_NEWBITMAP: return "RT_NEWBITMAP";
|
||||
case (int)ResourceTypes.RT_PLUGPLAY: return "RT_PLUGPLAY";
|
||||
case (int)ResourceTypes.RT_RCDATA: return "RT_RCDATA";
|
||||
case (int)ResourceTypes.RT_STRING: return "RT_STRING";
|
||||
case (int)ResourceTypes.RT_TOOLBAR: return "RT_TOOLBAR";
|
||||
case (int)ResourceTypes.RT_VERSION: return "RT_VERSION";
|
||||
case (int)ResourceTypes.RT_VXD: return "RT_VXD";
|
||||
default: return $"{id & 0x7FFF}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of a resource type according to its identifier
|
||||
/// </summary>
|
||||
/// <returns>The resource type name.</returns>
|
||||
/// <param name="id">Resource type identifier.</param>
|
||||
public static string ResourceIdToNameOs2(ushort id)
|
||||
{
|
||||
switch(id)
|
||||
{
|
||||
case (int)Os2.ResourceTypes.RT_POINTER: return "RT_POINTER";
|
||||
case (int)Os2.ResourceTypes.RT_BITMAP: return "RT_BITMAP";
|
||||
case (int)Os2.ResourceTypes.RT_MENU: return "RT_MENU";
|
||||
case (int)Os2.ResourceTypes.RT_DIALOG: return "RT_DIALOG";
|
||||
case (int)Os2.ResourceTypes.RT_STRING: return "RT_STRING";
|
||||
case (int)Os2.ResourceTypes.RT_FONTDIR: return "RT_FONTDIR";
|
||||
case (int)Os2.ResourceTypes.RT_FONT: return "RT_FONT";
|
||||
case (int)Os2.ResourceTypes.RT_ACCELTABLE: return "RT_ACCELTABLE";
|
||||
case (int)Os2.ResourceTypes.RT_RCDATA: return "RT_RCDATA";
|
||||
case (int)Os2.ResourceTypes.RT_MESSAGE: return "RT_MESSAGE";
|
||||
case (int)Os2.ResourceTypes.RT_DLGINCLUDE: return "RT_DLGINCLUDE";
|
||||
case (int)Os2.ResourceTypes.RT_VKEYTBL: return "RT_VKEYTBL";
|
||||
case (int)Os2.ResourceTypes.RT_KEYTBL: return "RT_KEYTBL";
|
||||
case (int)Os2.ResourceTypes.RT_CHARTBL: return "RT_CHARTBL";
|
||||
case (int)Os2.ResourceTypes.RT_DISPLAYINFO: return "RT_DISPLAYINFO";
|
||||
case (int)Os2.ResourceTypes.RT_FKASHORT: return "RT_FKASHORT";
|
||||
case (int)Os2.ResourceTypes.RT_FKALONG: return "RT_FKALONG";
|
||||
case (int)Os2.ResourceTypes.RT_HELPTABLE: return "RT_HELPTABLE";
|
||||
case (int)Os2.ResourceTypes.RT_HELPSUBTABLE: return "RT_HELPSUBTABLE";
|
||||
case (int)Os2.ResourceTypes.RT_FDDIR: return "RT_FDDIR";
|
||||
case (int)Os2.ResourceTypes.RT_FD: return "RT_FD";
|
||||
default: return $"{id}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,40 +73,6 @@ namespace libexeinfo
|
||||
SegmentAligned = 0x8000
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resource types.
|
||||
/// </summary>
|
||||
public enum ResourceTypes : ushort
|
||||
{
|
||||
RT_ACCELERATOR = 9,
|
||||
RT_ANICURSOR = 21,
|
||||
RT_ANIICON = 22,
|
||||
RT_BITMAP = 2,
|
||||
RT_CURSOR = 1,
|
||||
RT_DIALOG = 5,
|
||||
RT_DIALOGEX = 18,
|
||||
RT_DLGINCLUDE = 17,
|
||||
RT_DLGINIT = 240,
|
||||
RT_FONT = 8,
|
||||
RT_FONTDIR = 7,
|
||||
RT_GROUP_CURSOR = 12,
|
||||
RT_GROUP_ICON = 14,
|
||||
RT_HTML = 23,
|
||||
RT_ICON = 3,
|
||||
RT_MANIFEST = 24,
|
||||
RT_MENU = 4,
|
||||
RT_MENUEX = 15,
|
||||
RT_MESSAGETABLE = 11,
|
||||
RT_NEWBITMAP = RT_NEW | RT_BITMAP,
|
||||
RT_PLUGPLAY = 19,
|
||||
RT_RCDATA = 10,
|
||||
RT_STRING = 6,
|
||||
RT_TOOLBAR = 241,
|
||||
RT_VERSION = 16,
|
||||
RT_VXD = 20,
|
||||
RT_NEW = 0x2000
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum SegmentFlags : ushort
|
||||
{
|
||||
|
||||
@@ -99,8 +99,7 @@ namespace libexeinfo
|
||||
Header.return_thunks_offset, Header.segment_reference_thunks).AppendLine();
|
||||
else
|
||||
{
|
||||
sb.AppendFormat("\tReturn thunks are at: {0}", Header.return_thunks_offset)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("\tReturn thunks are at: {0}", Header.return_thunks_offset).AppendLine();
|
||||
sb.AppendFormat("\tSegment reference thunks are at: {0}", Header.segment_reference_thunks)
|
||||
.AppendLine();
|
||||
}
|
||||
@@ -142,8 +141,7 @@ namespace libexeinfo
|
||||
else if(Header.application_flags.HasFlag(ApplicationFlags.FullScreen) &&
|
||||
Header.application_flags.HasFlag(ApplicationFlags.GUICompatible))
|
||||
sb.AppendLine("\tApplication uses Windows");
|
||||
sb.AppendFormat("\tReturn thunks are at: {0}", Header.return_thunks_offset)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("\tReturn thunks are at: {0}", Header.return_thunks_offset).AppendLine();
|
||||
sb.AppendFormat("\tSegment reference thunks are at: {0}", Header.segment_reference_thunks)
|
||||
.AppendLine();
|
||||
break;
|
||||
@@ -160,8 +158,7 @@ namespace libexeinfo
|
||||
else if(Header.application_flags.HasFlag(ApplicationFlags.FullScreen) &&
|
||||
Header.application_flags.HasFlag(ApplicationFlags.GUICompatible))
|
||||
sb.AppendLine("\tApplication uses Windows");
|
||||
sb.AppendFormat("\tReturn thunks are at: {0}", Header.return_thunks_offset)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("\tReturn thunks are at: {0}", Header.return_thunks_offset).AppendLine();
|
||||
sb.AppendFormat("\tSegment reference thunks are at: {0}", Header.segment_reference_thunks)
|
||||
.AppendLine();
|
||||
break;
|
||||
@@ -178,18 +175,15 @@ namespace libexeinfo
|
||||
else if(Header.application_flags.HasFlag(ApplicationFlags.FullScreen) &&
|
||||
Header.application_flags.HasFlag(ApplicationFlags.GUICompatible))
|
||||
sb.AppendLine("\tApplication uses Windows");
|
||||
sb.AppendFormat("\tReturn thunks are at: {0}", Header.return_thunks_offset)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("\tReturn thunks are at: {0}", Header.return_thunks_offset).AppendLine();
|
||||
sb.AppendFormat("\tSegment reference thunks are at: {0}", Header.segment_reference_thunks)
|
||||
.AppendLine();
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("\tApplication for unknown OS {0}", (byte)Header.target_os)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("\tApplication for unknown OS {0}", (byte)Header.target_os).AppendLine();
|
||||
sb.AppendFormat("\tApplication requires OS {0}.{1} to run", Header.os_major, Header.os_minor)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("\tReturn thunks are at: {0}", Header.return_thunks_offset)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("\tReturn thunks are at: {0}", Header.return_thunks_offset).AppendLine();
|
||||
sb.AppendFormat("\tSegment reference thunks are at: {0}", Header.segment_reference_thunks)
|
||||
.AppendLine();
|
||||
break;
|
||||
@@ -379,7 +373,7 @@ namespace libexeinfo
|
||||
stream.Read(str, 0, len);
|
||||
table.types[t].name = Encoding.ASCII.GetString(str);
|
||||
}
|
||||
else table.types[t].name = ResourceIdToName(table.types[t].id);
|
||||
else table.types[t].name = Windows.Resources.IdToName(table.types[t].id);
|
||||
|
||||
for(int r = 0; r < table.types[t].resources.Length; r++)
|
||||
{
|
||||
|
||||
@@ -279,10 +279,8 @@ namespace libexeinfo
|
||||
length = resourceSegments[i].dwSegmentLength
|
||||
};
|
||||
|
||||
if(thisResource.length == 0)
|
||||
thisResource.length = 65536;
|
||||
if(thisResource.dataOffset == 0)
|
||||
thisResource.dataOffset = 65536;
|
||||
if(thisResource.length == 0) thisResource.length = 65536;
|
||||
if(thisResource.dataOffset == 0) thisResource.dataOffset = 65536;
|
||||
if((resourceSegments[i].dwFlags & (ushort)SegmentFlags.Huge) == (ushort)SegmentFlags.Huge)
|
||||
thisResource.length <<= Header.alignment_shift;
|
||||
thisResource.data = new byte[thisResource.length];
|
||||
@@ -303,7 +301,7 @@ namespace libexeinfo
|
||||
{
|
||||
Resources.types[counter].count = (ushort)kvp.Value.Count;
|
||||
Resources.types[counter].id = kvp.Key;
|
||||
Resources.types[counter].name = ResourceIdToNameOs2(kvp.Key);
|
||||
Resources.types[counter].name = Os2.Resources.IdToName(kvp.Key);
|
||||
Resources.types[counter].resources = kvp.Value.OrderBy(r => r.id).ToArray();
|
||||
counter++;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using libexeinfo.Windows;
|
||||
|
||||
namespace libexeinfo
|
||||
{
|
||||
@@ -177,8 +178,7 @@ namespace libexeinfo
|
||||
$"{(info.dwFileVersionMS & 0xFFFF0000) >> 16}.{info.dwFileVersionMS & 0xFFFF:D2}.{(info.dwFileVersionLS & 0xFFFF0000) >> 16}.{info.dwFileVersionLS & 0xFFFF}";
|
||||
ProductVersion =
|
||||
$"{(info.dwProductVersionMS & 0xFFFF0000) >> 16}.{info.dwProductVersionMS & 0xFFFF:D2}.{(info.dwProductVersionLS & 0xFFFF0000) >> 16}.{info.dwProductVersionLS & 0xFFFF}";
|
||||
FileFlags =
|
||||
(VersionFileFlags)(info.dwFileFlags & info.dwFileFlagsMask);
|
||||
FileFlags = (VersionFileFlags)(info.dwFileFlags & info.dwFileFlagsMask);
|
||||
FileOS = (VersionFileOS)info.dwFileOS;
|
||||
FileType = (VersionFileType)info.dwFileType;
|
||||
FileSubtype = (VersionFileSubtype)info.dwFileSubtype;
|
||||
@@ -252,8 +252,7 @@ namespace libexeinfo
|
||||
case VersionFileSubtype.VFT2_DRV_SYSTEM: return "System";
|
||||
case VersionFileSubtype.VFT2_DRV_VERSIONED_PRINTER: return "Versioned";
|
||||
case VersionFileSubtype.VFT2_UNKNOWN: return "Unknown";
|
||||
default:
|
||||
return $"Unknown type code {(uint)subtype}";
|
||||
default: return $"Unknown type code {(uint)subtype}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,8 +271,7 @@ namespace libexeinfo
|
||||
case VersionFileSubtype.VFT2_FONT_TRUETYPE: return "TrueType";
|
||||
case VersionFileSubtype.VFT2_FONT_VECTOR: return "Vector";
|
||||
case VersionFileSubtype.VFT2_UNKNOWN: return "Unknown";
|
||||
default:
|
||||
return $"Unknown type code {(uint)subtype}";
|
||||
default: return $"Unknown type code {(uint)subtype}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
65
libexeinfo/Os2/Resources.cs
Normal file
65
libexeinfo/Os2/Resources.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// Resources.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,
|
||||
// FITPESS 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 CONPECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
namespace libexeinfo.Os2
|
||||
{
|
||||
public static class Resources
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name of a resource type according to its identifier
|
||||
/// </summary>
|
||||
/// <returns>The resource type name.</returns>
|
||||
/// <param name="id">Resource type identifier.</param>
|
||||
public static string IdToName(ushort id)
|
||||
{
|
||||
switch(id)
|
||||
{
|
||||
case (int)ResourceTypes.RT_POINTER: return "RT_POINTER";
|
||||
case (int)ResourceTypes.RT_BITMAP: return "RT_BITMAP";
|
||||
case (int)ResourceTypes.RT_MENU: return "RT_MENU";
|
||||
case (int)ResourceTypes.RT_DIALOG: return "RT_DIALOG";
|
||||
case (int)ResourceTypes.RT_STRING: return "RT_STRING";
|
||||
case (int)ResourceTypes.RT_FONTDIR: return "RT_FONTDIR";
|
||||
case (int)ResourceTypes.RT_FONT: return "RT_FONT";
|
||||
case (int)ResourceTypes.RT_ACCELTABLE: return "RT_ACCELTABLE";
|
||||
case (int)ResourceTypes.RT_RCDATA: return "RT_RCDATA";
|
||||
case (int)ResourceTypes.RT_MESSAGE: return "RT_MESSAGE";
|
||||
case (int)ResourceTypes.RT_DLGINCLUDE: return "RT_DLGINCLUDE";
|
||||
case (int)ResourceTypes.RT_VKEYTBL: return "RT_VKEYTBL";
|
||||
case (int)ResourceTypes.RT_KEYTBL: return "RT_KEYTBL";
|
||||
case (int)ResourceTypes.RT_CHARTBL: return "RT_CHARTBL";
|
||||
case (int)ResourceTypes.RT_DISPLAYINFO: return "RT_DISPLAYINFO";
|
||||
case (int)ResourceTypes.RT_FKASHORT: return "RT_FKASHORT";
|
||||
case (int)ResourceTypes.RT_FKALONG: return "RT_FKALONG";
|
||||
case (int)ResourceTypes.RT_HELPTABLE: return "RT_HELPTABLE";
|
||||
case (int)ResourceTypes.RT_HELPSUBTABLE: return "RT_HELPSUBTABLE";
|
||||
case (int)ResourceTypes.RT_FDDIR: return "RT_FDDIR";
|
||||
case (int)ResourceTypes.RT_FD: return "RT_FD";
|
||||
default: return $"{id}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,40 @@
|
||||
|
||||
namespace libexeinfo.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// Resource types.
|
||||
/// </summary>
|
||||
public enum ResourceTypes : ushort
|
||||
{
|
||||
RT_ACCELERATOR = 9,
|
||||
RT_ANICURSOR = 21,
|
||||
RT_ANIICON = 22,
|
||||
RT_BITMAP = 2,
|
||||
RT_CURSOR = 1,
|
||||
RT_DIALOG = 5,
|
||||
RT_DIALOGEX = 18,
|
||||
RT_DLGINCLUDE = 17,
|
||||
RT_DLGINIT = 240,
|
||||
RT_FONT = 8,
|
||||
RT_FONTDIR = 7,
|
||||
RT_GROUP_CURSOR = 12,
|
||||
RT_GROUP_ICON = 14,
|
||||
RT_HTML = 23,
|
||||
RT_ICON = 3,
|
||||
RT_MANIFEST = 24,
|
||||
RT_MENU = 4,
|
||||
RT_MENUEX = 15,
|
||||
RT_MESSAGETABLE = 11,
|
||||
RT_NEWBITMAP = RT_NEW | RT_BITMAP,
|
||||
RT_PLUGPLAY = 19,
|
||||
RT_RCDATA = 10,
|
||||
RT_STRING = 6,
|
||||
RT_TOOLBAR = 241,
|
||||
RT_VERSION = 16,
|
||||
RT_VXD = 20,
|
||||
RT_NEW = 0x2000
|
||||
}
|
||||
|
||||
public enum BitmapCompression : uint
|
||||
{
|
||||
None = 0,
|
||||
|
||||
70
libexeinfo/Windows/Resources.cs
Normal file
70
libexeinfo/Windows/Resources.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// Resources.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,
|
||||
// FITPESS 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 CONPECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
namespace libexeinfo.Windows
|
||||
{
|
||||
public static class Resources
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name of a resource type according to its identifier
|
||||
/// </summary>
|
||||
/// <returns>The resource type name.</returns>
|
||||
/// <param name="id">Resource type identifier.</param>
|
||||
public static string IdToName(ushort id)
|
||||
{
|
||||
switch(id & 0x7FFF)
|
||||
{
|
||||
case (int)ResourceTypes.RT_ACCELERATOR: return "RT_ACCELERATOR";
|
||||
case (int)ResourceTypes.RT_ANICURSOR: return "RT_ANICURSOR";
|
||||
case (int)ResourceTypes.RT_ANIICON: return "RT_ANIICON";
|
||||
case (int)ResourceTypes.RT_BITMAP: return "RT_BITMAP";
|
||||
case (int)ResourceTypes.RT_CURSOR: return "RT_CURSOR";
|
||||
case (int)ResourceTypes.RT_DIALOG: return "RT_DIALOG";
|
||||
case (int)ResourceTypes.RT_DIALOGEX: return "RT_DIALOGEX";
|
||||
case (int)ResourceTypes.RT_DLGINCLUDE: return "RT_DLGINCLUDE";
|
||||
case (int)ResourceTypes.RT_DLGINIT: return "RT_DLGINIT";
|
||||
case (int)ResourceTypes.RT_FONT: return "RT_FONT";
|
||||
case (int)ResourceTypes.RT_FONTDIR: return "RT_FONTDIR";
|
||||
case (int)ResourceTypes.RT_GROUP_CURSOR: return "RT_GROUP_CURSOR";
|
||||
case (int)ResourceTypes.RT_GROUP_ICON: return "RT_GROUP_ICON";
|
||||
case (int)ResourceTypes.RT_HTML: return "RT_HTML";
|
||||
case (int)ResourceTypes.RT_ICON: return "RT_ICON";
|
||||
case (int)ResourceTypes.RT_MANIFEST: return "RT_MANIFEST";
|
||||
case (int)ResourceTypes.RT_MENU: return "RT_MENU";
|
||||
case (int)ResourceTypes.RT_MENUEX: return "RT_MENUEX";
|
||||
case (int)ResourceTypes.RT_MESSAGETABLE: return "RT_MESSAGETABLE";
|
||||
case (int)ResourceTypes.RT_NEWBITMAP: return "RT_NEWBITMAP";
|
||||
case (int)ResourceTypes.RT_PLUGPLAY: return "RT_PLUGPLAY";
|
||||
case (int)ResourceTypes.RT_RCDATA: return "RT_RCDATA";
|
||||
case (int)ResourceTypes.RT_STRING: return "RT_STRING";
|
||||
case (int)ResourceTypes.RT_TOOLBAR: return "RT_TOOLBAR";
|
||||
case (int)ResourceTypes.RT_VERSION: return "RT_VERSION";
|
||||
case (int)ResourceTypes.RT_VXD: return "RT_VXD";
|
||||
default: return $"{id & 0x7FFF}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,7 @@
|
||||
<Compile Include="NE\GetStrings.cs" />
|
||||
<Compile Include="Os2\Bitmap.cs" />
|
||||
<Compile Include="Os2\Enums.cs" />
|
||||
<Compile Include="Os2\Resources.cs" />
|
||||
<Compile Include="Os2\Structs.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="MZ\Consts.cs" />
|
||||
@@ -104,6 +105,7 @@
|
||||
<Compile Include="PE\Subsystems.cs" />
|
||||
<Compile Include="Windows\Bitmap.cs" />
|
||||
<Compile Include="Windows\Enums.cs" />
|
||||
<Compile Include="Windows\Resources.cs" />
|
||||
<Compile Include="Windows\Structs.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user