mirror of
https://github.com/claunia/libexeinfo.git
synced 2025-12-16 11:04:25 +00:00
Separated common operating system structures from executable format to their own namespace.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
using Eto.Serialization.Xaml;
|
||||
using libexeinfo.Os2;
|
||||
using Bitmap = libexeinfo.Os2.Bitmap;
|
||||
|
||||
namespace exeinfogui.Os2
|
||||
@@ -25,7 +26,7 @@ namespace exeinfogui.Os2
|
||||
grdIcons.Columns.Add(new GridColumn
|
||||
{
|
||||
DataCell =
|
||||
new TextBoxCell {Binding = Binding.Property<Bitmap.DecodedBitmap, string>(b => $"{b.Type}")},
|
||||
new TextBoxCell {Binding = Binding.Property<DecodedBitmap, string>(b => $"{b.Type}")},
|
||||
HeaderText = "Command"
|
||||
});
|
||||
|
||||
@@ -33,7 +34,7 @@ namespace exeinfogui.Os2
|
||||
{
|
||||
DataCell = new TextBoxCell
|
||||
{
|
||||
Binding = Binding.Property<Bitmap.DecodedBitmap, string>(b => $"{b.Width}x{b.Height}")
|
||||
Binding = Binding.Property<DecodedBitmap, string>(b => $"{b.Width}x{b.Height}")
|
||||
},
|
||||
HeaderText = "Size"
|
||||
});
|
||||
@@ -42,7 +43,7 @@ namespace exeinfogui.Os2
|
||||
{
|
||||
DataCell = new TextBoxCell
|
||||
{
|
||||
Binding = Binding.Property<Bitmap.DecodedBitmap, string>(b => $"{1 << (int)b.BitsPerPixel}")
|
||||
Binding = Binding.Property<DecodedBitmap, string>(b => $"{1 << (int)b.BitsPerPixel}")
|
||||
},
|
||||
HeaderText = "Colors"
|
||||
});
|
||||
@@ -55,7 +56,7 @@ namespace exeinfogui.Os2
|
||||
|
||||
void GrdIconsOnSelectionChanged(object sender, EventArgs eventArgs)
|
||||
{
|
||||
if(!(grdIcons.SelectedItem is Bitmap.DecodedBitmap icon))
|
||||
if(!(grdIcons.SelectedItem is DecodedBitmap icon))
|
||||
{
|
||||
imgIcon.Image = null;
|
||||
return;
|
||||
@@ -84,12 +85,12 @@ namespace exeinfogui.Os2
|
||||
return;
|
||||
}
|
||||
|
||||
Bitmap.DecodedBitmap[] icons = Bitmap.DecodeBitmap(data);
|
||||
DecodedBitmap[] icons = Bitmap.DecodeBitmap(data);
|
||||
|
||||
if(icons == null || icons.Length == 0)
|
||||
try
|
||||
{
|
||||
libexeinfo.Windows.Bitmap.DecodedBitmap winIcon = null;
|
||||
libexeinfo.Windows.DecodedBitmap winIcon = null;
|
||||
|
||||
if(BitConverter.ToUInt32(data, 4) == 40)
|
||||
{
|
||||
@@ -103,7 +104,7 @@ namespace exeinfogui.Os2
|
||||
if(winIcon != null)
|
||||
icons = new[]
|
||||
{
|
||||
new Bitmap.DecodedBitmap
|
||||
new DecodedBitmap
|
||||
{
|
||||
BitsPerPixel = winIcon.BitsPerPixel,
|
||||
Height = winIcon.Height,
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace exeinfogui.Windows
|
||||
return;
|
||||
}
|
||||
|
||||
Bitmap.DecodedBitmap icon;
|
||||
libexeinfo.Windows.DecodedBitmap icon;
|
||||
|
||||
try { icon = Bitmap.DecodeIcon(data); }
|
||||
catch { icon = null; }
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.IO;
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
using Eto.Serialization.Xaml;
|
||||
using libexeinfo.Os2;
|
||||
using Bitmap = libexeinfo.Os2.Bitmap;
|
||||
|
||||
namespace iconviewer
|
||||
@@ -20,7 +21,7 @@ namespace iconviewer
|
||||
grdIcons.Columns.Add(new GridColumn
|
||||
{
|
||||
DataCell =
|
||||
new TextBoxCell {Binding = Binding.Property<Bitmap.DecodedBitmap, string>(b => $"{b.Type}")},
|
||||
new TextBoxCell {Binding = Binding.Property<DecodedBitmap, string>(b => $"{b.Type}")},
|
||||
HeaderText = "Command"
|
||||
});
|
||||
|
||||
@@ -28,7 +29,7 @@ namespace iconviewer
|
||||
{
|
||||
DataCell = new TextBoxCell
|
||||
{
|
||||
Binding = Binding.Property<Bitmap.DecodedBitmap, string>(b => $"{b.Width}x{b.Height}")
|
||||
Binding = Binding.Property<DecodedBitmap, string>(b => $"{b.Width}x{b.Height}")
|
||||
},
|
||||
HeaderText = "Size"
|
||||
});
|
||||
@@ -37,7 +38,7 @@ namespace iconviewer
|
||||
{
|
||||
DataCell = new TextBoxCell
|
||||
{
|
||||
Binding = Binding.Property<Bitmap.DecodedBitmap, string>(b => $"{1 << (int)b.BitsPerPixel}")
|
||||
Binding = Binding.Property<DecodedBitmap, string>(b => $"{1 << (int)b.BitsPerPixel}")
|
||||
},
|
||||
HeaderText = "Colors"
|
||||
});
|
||||
@@ -48,7 +49,7 @@ namespace iconviewer
|
||||
|
||||
void GrdIconsOnSelectionChanged(object sender, EventArgs eventArgs)
|
||||
{
|
||||
if(!(grdIcons.SelectedItem is Bitmap.DecodedBitmap icon))
|
||||
if(!(grdIcons.SelectedItem is DecodedBitmap icon))
|
||||
{
|
||||
imgIcon.Image = null;
|
||||
return;
|
||||
@@ -78,7 +79,7 @@ namespace iconviewer
|
||||
fstream.Read(data, 0, data.Length);
|
||||
fstream.Dispose();
|
||||
|
||||
Bitmap.DecodedBitmap[] icons = Bitmap.DecodeBitmap(data);
|
||||
DecodedBitmap[] icons = Bitmap.DecodeBitmap(data);
|
||||
imgIcon.Image = new Eto.Drawing.Bitmap((int)icons[0].Width, (int)icons[0].Height,
|
||||
PixelFormat.Format32bppRgba, icons[0].Pixels);
|
||||
grdIcons.DataStore = icons;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
// 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
|
||||
@@ -95,27 +97,27 @@ namespace libexeinfo
|
||||
{
|
||||
switch(id)
|
||||
{
|
||||
case (int)Os2ResourceTypes.RT_POINTER: return "RT_POINTER";
|
||||
case (int)Os2ResourceTypes.RT_BITMAP: return "RT_BITMAP";
|
||||
case (int)Os2ResourceTypes.RT_MENU: return "RT_MENU";
|
||||
case (int)Os2ResourceTypes.RT_DIALOG: return "RT_DIALOG";
|
||||
case (int)Os2ResourceTypes.RT_STRING: return "RT_STRING";
|
||||
case (int)Os2ResourceTypes.RT_FONTDIR: return "RT_FONTDIR";
|
||||
case (int)Os2ResourceTypes.RT_FONT: return "RT_FONT";
|
||||
case (int)Os2ResourceTypes.RT_ACCELTABLE: return "RT_ACCELTABLE";
|
||||
case (int)Os2ResourceTypes.RT_RCDATA: return "RT_RCDATA";
|
||||
case (int)Os2ResourceTypes.RT_MESSAGE: return "RT_MESSAGE";
|
||||
case (int)Os2ResourceTypes.RT_DLGINCLUDE: return "RT_DLGINCLUDE";
|
||||
case (int)Os2ResourceTypes.RT_VKEYTBL: return "RT_VKEYTBL";
|
||||
case (int)Os2ResourceTypes.RT_KEYTBL: return "RT_KEYTBL";
|
||||
case (int)Os2ResourceTypes.RT_CHARTBL: return "RT_CHARTBL";
|
||||
case (int)Os2ResourceTypes.RT_DISPLAYINFO: return "RT_DISPLAYINFO";
|
||||
case (int)Os2ResourceTypes.RT_FKASHORT: return "RT_FKASHORT";
|
||||
case (int)Os2ResourceTypes.RT_FKALONG: return "RT_FKALONG";
|
||||
case (int)Os2ResourceTypes.RT_HELPTABLE: return "RT_HELPTABLE";
|
||||
case (int)Os2ResourceTypes.RT_HELPSUBTABLE: return "RT_HELPSUBTABLE";
|
||||
case (int)Os2ResourceTypes.RT_FDDIR: return "RT_FDDIR";
|
||||
case (int)Os2ResourceTypes.RT_FD: return "RT_FD";
|
||||
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}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,104 +43,6 @@ namespace libexeinfo
|
||||
DLL = 1 << 7
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OS/2 flags.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum OS2Flags : byte
|
||||
{
|
||||
LongFilename = 1 << 0,
|
||||
ProtectedMode2 = 1 << 1,
|
||||
ProportionalFonts = 1 << 2,
|
||||
GangloadArea = 1 << 3
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum Os2MenuAttribute : ushort
|
||||
{
|
||||
MIA_FRAMED = 0x1000,
|
||||
MIA_CHECKED = 0x2000,
|
||||
MIA_DISABLED = 0x4000,
|
||||
MIA_HILITED = 0x8000
|
||||
}
|
||||
|
||||
public enum Os2MenuType : ushort
|
||||
{
|
||||
MIS_TEXT = 0x0001,
|
||||
MIS_BITMAP = 0x0002,
|
||||
MIS_SEPARATOR = 0x0004,
|
||||
MIS_OWNERDRAW = 0x0008,
|
||||
MIS_SUBMENU = 0x0010,
|
||||
/// <summary>
|
||||
/// multiple choice submenu
|
||||
/// </summary>
|
||||
MIS_MULTMENU = 0x0020,
|
||||
MIS_SYSCOMMAND = 0x0040,
|
||||
MIS_HELP = 0x0080,
|
||||
MIS_STATIC = 0x0100,
|
||||
MIS_BUTTONSEPARATOR = 0x0200,
|
||||
MIS_BREAK = 0x0400,
|
||||
MIS_BREAKSEPARATOR = 0x0800,
|
||||
/// <summary>
|
||||
/// multiple choice group start
|
||||
/// </summary>
|
||||
MIS_GROUP = 0x1000,
|
||||
/// <summary>
|
||||
/// In multiple choice submenus a style of 'single' denotes the item is a radiobutton. Absence of this style defaults
|
||||
/// the item to a checkbox.
|
||||
/// </summary>
|
||||
MIS_SINGLE = 0x2000
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resource types.
|
||||
/// </summary>
|
||||
public enum Os2ResourceTypes : ushort
|
||||
{
|
||||
/// <summary>mouse pointer shape</summary>
|
||||
RT_POINTER = 1,
|
||||
/// <summary>bitmap</summary>
|
||||
RT_BITMAP = 2,
|
||||
/// <summary>menu template</summary>
|
||||
RT_MENU = 3,
|
||||
/// <summary>dialog template</summary>
|
||||
RT_DIALOG = 4,
|
||||
/// <summary>string tables</summary>
|
||||
RT_STRING = 5,
|
||||
/// <summary>font directory</summary>
|
||||
RT_FONTDIR = 6,
|
||||
/// <summary>font</summary>
|
||||
RT_FONT = 7,
|
||||
/// <summary>accelerator tables</summary>
|
||||
RT_ACCELTABLE = 8,
|
||||
/// <summary>binary data</summary>
|
||||
RT_RCDATA = 9,
|
||||
/// <summary>error msg tables</summary>
|
||||
RT_MESSAGE = 10,
|
||||
/// <summary>dialog include file name</summary>
|
||||
RT_DLGINCLUDE = 11,
|
||||
/// <summary>key to vkey tables</summary>
|
||||
RT_VKEYTBL = 12,
|
||||
/// <summary>key to UGL tables</summary>
|
||||
RT_KEYTBL = 13,
|
||||
/// <summary>glyph to character tables</summary>
|
||||
RT_CHARTBL = 14,
|
||||
/// <summary>screen display information</summary>
|
||||
RT_DISPLAYINFO = 15,
|
||||
/// <summary>function key area short form</summary>
|
||||
RT_FKASHORT = 16,
|
||||
/// <summary>function key area long form</summary>
|
||||
RT_FKALONG = 17,
|
||||
/// <summary>Help table for IPFC</summary>
|
||||
RT_HELPTABLE = 18,
|
||||
/// <summary>Help subtable for IPFC</summary>
|
||||
RT_HELPSUBTABLE = 19,
|
||||
/// <summary>DBCS uniq/font driver directory</summary>
|
||||
RT_FDDIR = 20,
|
||||
/// <summary>DBCS uniq/font driver</summary>
|
||||
RT_FD = 21
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Program flags.
|
||||
/// </summary>
|
||||
|
||||
@@ -28,6 +28,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using libexeinfo.Os2;
|
||||
|
||||
namespace libexeinfo
|
||||
{
|
||||
@@ -87,13 +88,13 @@ namespace libexeinfo
|
||||
else if(Header.application_flags.HasFlag(ApplicationFlags.FullScreen) &&
|
||||
Header.application_flags.HasFlag(ApplicationFlags.GUICompatible))
|
||||
sb.AppendLine("\tApplication uses Presentation Manager");
|
||||
if(Header.os2_flags.HasFlag(OS2Flags.LongFilename))
|
||||
if(Header.ExecutableFlags.HasFlag(ExecutableFlags.LongFilename))
|
||||
sb.AppendLine("\tApplication supports long filenames");
|
||||
if(Header.os2_flags.HasFlag(OS2Flags.ProtectedMode2))
|
||||
if(Header.ExecutableFlags.HasFlag(ExecutableFlags.ProtectedMode2))
|
||||
sb.AppendLine("\tApplication uses OS/2 2.x protected mode");
|
||||
if(Header.os2_flags.HasFlag(OS2Flags.ProportionalFonts))
|
||||
if(Header.ExecutableFlags.HasFlag(ExecutableFlags.ProportionalFonts))
|
||||
sb.AppendLine("\tApplication uses OS/2 2.x proportional fonts");
|
||||
if(Header.os2_flags.HasFlag(OS2Flags.GangloadArea))
|
||||
if(Header.ExecutableFlags.HasFlag(ExecutableFlags.GangloadArea))
|
||||
sb.AppendFormat("\tGangload area starts at {0} an runs for {1} bytes",
|
||||
Header.return_thunks_offset, Header.segment_reference_thunks).AppendLine();
|
||||
else
|
||||
|
||||
@@ -30,6 +30,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using libexeinfo.Os2;
|
||||
|
||||
namespace libexeinfo
|
||||
{
|
||||
@@ -246,7 +247,7 @@ namespace libexeinfo
|
||||
BaseStream.Position = BaseExecutable.Header.new_offset + Header.resource_table_offset;
|
||||
buffer = new byte[Header.resource_entries * 4];
|
||||
BaseStream.Read(buffer, 0, buffer.Length);
|
||||
Os2ResourceTableEntry[] entries = new Os2ResourceTableEntry[Header.resource_entries];
|
||||
ResourceTableEntry[] entries = new ResourceTableEntry[Header.resource_entries];
|
||||
for(int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
entries[i].etype = BitConverter.ToUInt16(buffer, i * 4 + 0);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
using libexeinfo.Os2;
|
||||
|
||||
namespace libexeinfo
|
||||
{
|
||||
@@ -62,7 +63,7 @@ namespace libexeinfo
|
||||
public ushort alignment_shift;
|
||||
public ushort resource_entries;
|
||||
public TargetOS target_os;
|
||||
public OS2Flags os2_flags;
|
||||
public ExecutableFlags ExecutableFlags;
|
||||
public ushort return_thunks_offset;
|
||||
public ushort segment_reference_thunks;
|
||||
public ushort minimum_swap_area;
|
||||
@@ -167,7 +168,7 @@ namespace libexeinfo
|
||||
/// </summary>
|
||||
public ushort dwSegmentLength;
|
||||
/// <summary>
|
||||
/// Flag word, <see cref="SegmentResourceFlags" />, <see cref="SEGMENT_TYPE_MASK" />, <see cref="SEGMENT_FLAGS_MASK" />
|
||||
/// Flag word, <see cref="SegmentFlags" />, <see cref="SEGMENT_TYPE_MASK" />, <see cref="SEGMENT_FLAGS_MASK" />
|
||||
/// , <see cref="SEGMENT_DISCARD_MASK" />
|
||||
/// </summary>
|
||||
public ushort dwFlags;
|
||||
@@ -176,69 +177,5 @@ namespace libexeinfo
|
||||
/// </summary>
|
||||
public ushort dwMinimumAllocation;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Os2ResourceTableEntry
|
||||
{
|
||||
public ushort etype;
|
||||
public ushort ename;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Os2MenuHeader
|
||||
{
|
||||
public ushort cb;
|
||||
public ushort type;
|
||||
public ushort cp;
|
||||
public ushort offset;
|
||||
public ushort count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Followed by data, if <see cref="Os2MenuItem.style" /> is <see cref="Os2MenuType.MIS_TEXT" /> a null-terminated
|
||||
/// string follows, if <see cref="Os2MenuType.MIS_BITMAP" /> a resource ID follows and if
|
||||
/// <see cref="Os2MenuType.MIS_SUBMENU" /> another header follows.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Os2MenuItem
|
||||
{
|
||||
public Os2MenuType style;
|
||||
public Os2MenuAttribute attrib;
|
||||
public ushort id;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Os2DialogTemplateItem
|
||||
{
|
||||
public ushort fsItemStatus;
|
||||
public ushort cChildren;
|
||||
public ushort cchClassName;
|
||||
public ushort offClassName;
|
||||
public ushort cchText;
|
||||
public ushort offText;
|
||||
public uint flStyle;
|
||||
public short x;
|
||||
public short y;
|
||||
public short cx;
|
||||
public short cy;
|
||||
public ushort id;
|
||||
public ushort offPresParams;
|
||||
public ushort offCtlData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dialog template, followed by several <see cref="Os2DialogTemplateItem" />
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Os2DialogTemplate
|
||||
{
|
||||
public ushort cbTemplate;
|
||||
public ushort type;
|
||||
public ushort codepage;
|
||||
public ushort offadlgti;
|
||||
public ushort fsTemplateStatus;
|
||||
public ushort iItemFocus;
|
||||
public ushort coffPresParams;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace libexeinfo.Os2
|
||||
{
|
||||
public class Bitmap
|
||||
public static class Bitmap
|
||||
{
|
||||
/// <summary>
|
||||
/// 'IC', OS/2 only, icon
|
||||
@@ -69,13 +69,8 @@ namespace libexeinfo.Os2
|
||||
{
|
||||
long pos = 0;
|
||||
BitmapArrayHeader bitmapArrayHeader;
|
||||
BitmapInfoHeader bitmapFileHeader;
|
||||
byte[] buffer = new byte[Marshal.SizeOf(typeof(BitmapInfoHeader))];
|
||||
|
||||
Array.Copy(data, pos, buffer, 0, buffer.Length);
|
||||
bitmapArrayHeader = BigEndianMarshal.ByteArrayToStructureLittleEndian<BitmapArrayHeader>(buffer);
|
||||
bitmapFileHeader = BigEndianMarshal.ByteArrayToStructureLittleEndian<BitmapInfoHeader>(buffer);
|
||||
|
||||
List<DecodedBitmap> bitmaps = new List<DecodedBitmap>();
|
||||
|
||||
do
|
||||
@@ -100,7 +95,8 @@ namespace libexeinfo.Os2
|
||||
{
|
||||
buffer = new byte[Marshal.SizeOf(typeof(BitmapInfoHeader))];
|
||||
Array.Copy(data, pos, buffer, 0, buffer.Length);
|
||||
bitmapFileHeader = BigEndianMarshal.ByteArrayToStructureLittleEndian<BitmapInfoHeader>(buffer);
|
||||
BitmapInfoHeader bitmapFileHeader =
|
||||
BigEndianMarshal.ByteArrayToStructureLittleEndian<BitmapInfoHeader>(buffer);
|
||||
|
||||
// Stop at unknown header
|
||||
if(bitmapFileHeader.Fix != 12) break;
|
||||
@@ -110,13 +106,13 @@ namespace libexeinfo.Os2
|
||||
|
||||
// TODO: Non paletted?
|
||||
pos += Marshal.SizeOf(typeof(BitmapInfoHeader));
|
||||
RGB[] palette = new RGB[1 << bitmapFileHeader.BitsPerPlane];
|
||||
buffer = new byte[Marshal.SizeOf(typeof(RGB))];
|
||||
Rgb[] palette = new Rgb[1 << bitmapFileHeader.BitsPerPlane];
|
||||
buffer = new byte[Marshal.SizeOf(typeof(Rgb))];
|
||||
for(int i = 0; i < palette.Length; i++)
|
||||
{
|
||||
Array.Copy(data, pos, buffer, 0, buffer.Length);
|
||||
pos += buffer.Length;
|
||||
palette[i] = BigEndianMarshal.ByteArrayToStructureLittleEndian<RGB>(buffer);
|
||||
palette[i] = BigEndianMarshal.ByteArrayToStructureLittleEndian<Rgb>(buffer);
|
||||
}
|
||||
|
||||
remaining -= bitmapFileHeader.Fix;
|
||||
@@ -179,13 +175,13 @@ namespace libexeinfo.Os2
|
||||
|
||||
// TODO: Non paletted?
|
||||
pos += bitmapFileHeader.Size;
|
||||
palette = new RGB[1 << bitmapFileHeader.BitsPerPlane];
|
||||
buffer = new byte[Marshal.SizeOf(typeof(RGB))];
|
||||
palette = new Rgb[1 << bitmapFileHeader.BitsPerPlane];
|
||||
buffer = new byte[Marshal.SizeOf(typeof(Rgb))];
|
||||
for(int i = 0; i < palette.Length; i++)
|
||||
{
|
||||
Array.Copy(data, pos, buffer, 0, buffer.Length);
|
||||
pos += buffer.Length;
|
||||
palette[i] = BigEndianMarshal.ByteArrayToStructureLittleEndian<RGB>(buffer);
|
||||
palette[i] = BigEndianMarshal.ByteArrayToStructureLittleEndian<Rgb>(buffer);
|
||||
}
|
||||
|
||||
remaining -= bitmapFileHeader.Fix;
|
||||
@@ -242,7 +238,7 @@ namespace libexeinfo.Os2
|
||||
}
|
||||
|
||||
// TODO: Mask is not correctly decoded on XGA icons (20x20 and 40x40)...
|
||||
static DecodedBitmap DecodeBitmap(BitmapInfoHeader header, IList<RGB> palette, byte[] data)
|
||||
static DecodedBitmap DecodeBitmap(BitmapInfoHeader header, IList<Rgb> palette, byte[] data)
|
||||
{
|
||||
DecodedBitmap bitmap = new DecodedBitmap
|
||||
{
|
||||
@@ -303,49 +299,5 @@ namespace libexeinfo.Os2
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct BitmapArrayHeader
|
||||
{
|
||||
public ushort Type;
|
||||
public uint Size;
|
||||
public uint Next;
|
||||
public ushort XDisplay;
|
||||
public ushort YDisplay;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct BitmapInfoHeader
|
||||
{
|
||||
public ushort Type;
|
||||
public uint Size;
|
||||
public short XHotspot;
|
||||
public short YHostpot;
|
||||
public uint Offset;
|
||||
public uint Fix;
|
||||
public ushort X;
|
||||
public ushort Y;
|
||||
public ushort Planes;
|
||||
public ushort BitsPerPlane;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct RGB
|
||||
{
|
||||
public byte Blue;
|
||||
public byte Green;
|
||||
public byte Red;
|
||||
}
|
||||
|
||||
public class DecodedBitmap
|
||||
{
|
||||
public uint BitsPerPixel;
|
||||
public uint Height;
|
||||
public int[] Pixels;
|
||||
public string Type;
|
||||
public uint Width;
|
||||
public short XHotspot;
|
||||
public short YHostpot;
|
||||
}
|
||||
}
|
||||
}
|
||||
128
libexeinfo/Os2/Enums.cs
Normal file
128
libexeinfo/Os2/Enums.cs
Normal file
@@ -0,0 +1,128 @@
|
||||
//
|
||||
// Enums.cs
|
||||
//
|
||||
// Author:
|
||||
// Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Copyright (c) 2017 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;
|
||||
|
||||
namespace libexeinfo.Os2
|
||||
{
|
||||
/// <summary>
|
||||
/// OS/2 flags.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ExecutableFlags : byte
|
||||
{
|
||||
LongFilename = 1 << 0,
|
||||
ProtectedMode2 = 1 << 1,
|
||||
ProportionalFonts = 1 << 2,
|
||||
GangloadArea = 1 << 3
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum MenuAttribute : ushort
|
||||
{
|
||||
MIA_FRAMED = 0x1000,
|
||||
MIA_CHECKED = 0x2000,
|
||||
MIA_DISABLED = 0x4000,
|
||||
MIA_HILITED = 0x8000
|
||||
}
|
||||
|
||||
public enum MenuType : ushort
|
||||
{
|
||||
MIS_TEXT = 0x0001,
|
||||
MIS_BITMAP = 0x0002,
|
||||
MIS_SEPARATOR = 0x0004,
|
||||
MIS_OWNERDRAW = 0x0008,
|
||||
MIS_SUBMENU = 0x0010,
|
||||
/// <summary>
|
||||
/// multiple choice submenu
|
||||
/// </summary>
|
||||
MIS_MULTMENU = 0x0020,
|
||||
MIS_SYSCOMMAND = 0x0040,
|
||||
MIS_HELP = 0x0080,
|
||||
MIS_STATIC = 0x0100,
|
||||
MIS_BUTTONSEPARATOR = 0x0200,
|
||||
MIS_BREAK = 0x0400,
|
||||
MIS_BREAKSEPARATOR = 0x0800,
|
||||
/// <summary>
|
||||
/// multiple choice group start
|
||||
/// </summary>
|
||||
MIS_GROUP = 0x1000,
|
||||
/// <summary>
|
||||
/// In multiple choice submenus a style of 'single' denotes the item is a radiobutton. Absence of this style defaults
|
||||
/// the item to a checkbox.
|
||||
/// </summary>
|
||||
MIS_SINGLE = 0x2000
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resource types.
|
||||
/// </summary>
|
||||
public enum ResourceTypes : ushort
|
||||
{
|
||||
/// <summary>mouse pointer shape</summary>
|
||||
RT_POINTER = 1,
|
||||
/// <summary>bitmap</summary>
|
||||
RT_BITMAP = 2,
|
||||
/// <summary>menu template</summary>
|
||||
RT_MENU = 3,
|
||||
/// <summary>dialog template</summary>
|
||||
RT_DIALOG = 4,
|
||||
/// <summary>string tables</summary>
|
||||
RT_STRING = 5,
|
||||
/// <summary>font directory</summary>
|
||||
RT_FONTDIR = 6,
|
||||
/// <summary>font</summary>
|
||||
RT_FONT = 7,
|
||||
/// <summary>accelerator tables</summary>
|
||||
RT_ACCELTABLE = 8,
|
||||
/// <summary>binary data</summary>
|
||||
RT_RCDATA = 9,
|
||||
/// <summary>error msg tables</summary>
|
||||
RT_MESSAGE = 10,
|
||||
/// <summary>dialog include file name</summary>
|
||||
RT_DLGINCLUDE = 11,
|
||||
/// <summary>key to vkey tables</summary>
|
||||
RT_VKEYTBL = 12,
|
||||
/// <summary>key to UGL tables</summary>
|
||||
RT_KEYTBL = 13,
|
||||
/// <summary>glyph to character tables</summary>
|
||||
RT_CHARTBL = 14,
|
||||
/// <summary>screen display information</summary>
|
||||
RT_DISPLAYINFO = 15,
|
||||
/// <summary>function key area short form</summary>
|
||||
RT_FKASHORT = 16,
|
||||
/// <summary>function key area long form</summary>
|
||||
RT_FKALONG = 17,
|
||||
/// <summary>Help table for IPFC</summary>
|
||||
RT_HELPTABLE = 18,
|
||||
/// <summary>Help subtable for IPFC</summary>
|
||||
RT_HELPSUBTABLE = 19,
|
||||
/// <summary>DBCS uniq/font driver directory</summary>
|
||||
RT_FDDIR = 20,
|
||||
/// <summary>DBCS uniq/font driver</summary>
|
||||
RT_FD = 21
|
||||
}
|
||||
}
|
||||
138
libexeinfo/Os2/Structs.cs
Normal file
138
libexeinfo/Os2/Structs.cs
Normal file
@@ -0,0 +1,138 @@
|
||||
//
|
||||
// Structs.cs
|
||||
//
|
||||
// Author:
|
||||
// Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Copyright (c) 2017 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.Runtime.InteropServices;
|
||||
|
||||
namespace libexeinfo.Os2
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct ResourceTableEntry
|
||||
{
|
||||
public ushort etype;
|
||||
public ushort ename;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct MenuHeader
|
||||
{
|
||||
public ushort cb;
|
||||
public ushort type;
|
||||
public ushort cp;
|
||||
public ushort offset;
|
||||
public ushort count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Followed by data, if <see cref="MenuItem.style" /> is <see cref="MenuType.MIS_TEXT" /> a null-terminated
|
||||
/// string follows, if <see cref="MenuType.MIS_BITMAP" /> a resource ID follows and if
|
||||
/// <see cref="MenuType.MIS_SUBMENU" /> another header follows.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct MenuItem
|
||||
{
|
||||
public MenuType style;
|
||||
public MenuAttribute attrib;
|
||||
public ushort id;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct DialogTemplateItem
|
||||
{
|
||||
public ushort fsItemStatus;
|
||||
public ushort cChildren;
|
||||
public ushort cchClassName;
|
||||
public ushort offClassName;
|
||||
public ushort cchText;
|
||||
public ushort offText;
|
||||
public uint flStyle;
|
||||
public short x;
|
||||
public short y;
|
||||
public short cx;
|
||||
public short cy;
|
||||
public ushort id;
|
||||
public ushort offPresParams;
|
||||
public ushort offCtlData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dialog template, followed by several <see cref="DialogTemplateItem" />
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct DialogTemplate
|
||||
{
|
||||
public ushort cbTemplate;
|
||||
public ushort type;
|
||||
public ushort codepage;
|
||||
public ushort offadlgti;
|
||||
public ushort fsTemplateStatus;
|
||||
public ushort iItemFocus;
|
||||
public ushort coffPresParams;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct BitmapArrayHeader
|
||||
{
|
||||
public ushort Type;
|
||||
public uint Size;
|
||||
public uint Next;
|
||||
public ushort XDisplay;
|
||||
public ushort YDisplay;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct BitmapInfoHeader
|
||||
{
|
||||
public ushort Type;
|
||||
public uint Size;
|
||||
public short XHotspot;
|
||||
public short YHostpot;
|
||||
public uint Offset;
|
||||
public uint Fix;
|
||||
public ushort X;
|
||||
public ushort Y;
|
||||
public ushort Planes;
|
||||
public ushort BitsPerPlane;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct Rgb
|
||||
{
|
||||
public byte Blue;
|
||||
public byte Green;
|
||||
public byte Red;
|
||||
}
|
||||
|
||||
public class DecodedBitmap
|
||||
{
|
||||
public uint BitsPerPixel;
|
||||
public uint Height;
|
||||
public int[] Pixels;
|
||||
public string Type;
|
||||
public uint Width;
|
||||
public short XHotspot;
|
||||
public short YHostpot;
|
||||
}
|
||||
}
|
||||
@@ -31,22 +31,8 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace libexeinfo.Windows
|
||||
{
|
||||
public class Bitmap
|
||||
public static class Bitmap
|
||||
{
|
||||
public enum Compression : uint
|
||||
{
|
||||
None = 0,
|
||||
Rle8 = 1,
|
||||
Rle4 = 2,
|
||||
Bitfields = 3,
|
||||
Jpeg = 4,
|
||||
Png = 5,
|
||||
AlphaBitfields = 6,
|
||||
Cmyk = 11,
|
||||
CmykRle8 = 12,
|
||||
CmykRle4 = 13
|
||||
}
|
||||
|
||||
const int VISIBLE = -16777216;
|
||||
|
||||
/// <summary>
|
||||
@@ -70,13 +56,13 @@ namespace libexeinfo.Windows
|
||||
|
||||
// TODO: Non paletted?
|
||||
pos += bitmapFileHeader.HeaderSize;
|
||||
RGB[] palette = new RGB[1 << bitmapFileHeader.BitsPerPlane];
|
||||
buffer = new byte[Marshal.SizeOf(typeof(RGB))];
|
||||
Rgb[] palette = new Rgb[1 << bitmapFileHeader.BitsPerPlane];
|
||||
buffer = new byte[Marshal.SizeOf(typeof(Rgb))];
|
||||
for(int i = 0; i < palette.Length; i++)
|
||||
{
|
||||
Array.Copy(data, pos, buffer, 0, buffer.Length);
|
||||
pos += buffer.Length;
|
||||
palette[i] = BigEndianMarshal.ByteArrayToStructureLittleEndian<RGB>(buffer);
|
||||
palette[i] = BigEndianMarshal.ByteArrayToStructureLittleEndian<Rgb>(buffer);
|
||||
}
|
||||
|
||||
// First let's do the icon itself
|
||||
@@ -147,9 +133,9 @@ namespace libexeinfo.Windows
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
static DecodedBitmap DecodeBitmap(BitmapInfoHeader header, IList<RGB> palette, byte[] data)
|
||||
static DecodedBitmap DecodeBitmap(BitmapInfoHeader header, IList<Rgb> palette, byte[] data)
|
||||
{
|
||||
if(header.Compression != Compression.None) return null;
|
||||
if(header.BitmapCompression != BitmapCompression.None) return null;
|
||||
|
||||
DecodedBitmap bitmap = new DecodedBitmap
|
||||
{
|
||||
@@ -188,38 +174,5 @@ namespace libexeinfo.Windows
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct BitmapInfoHeader
|
||||
{
|
||||
public uint HeaderSize;
|
||||
public uint Width;
|
||||
public uint Height;
|
||||
public ushort Planes;
|
||||
public ushort BitsPerPlane;
|
||||
public Compression Compression;
|
||||
public uint ImageSize;
|
||||
public uint HorizontalResolution;
|
||||
public uint VerticalResolution;
|
||||
public uint ColorsInPalette;
|
||||
public uint ImportantColors;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct RGB
|
||||
{
|
||||
public byte Blue;
|
||||
public byte Green;
|
||||
public byte Red;
|
||||
public byte Reserved;
|
||||
}
|
||||
|
||||
public class DecodedBitmap
|
||||
{
|
||||
public uint BitsPerPixel;
|
||||
public uint Height;
|
||||
public int[] Pixels;
|
||||
public uint Width;
|
||||
}
|
||||
}
|
||||
}
|
||||
42
libexeinfo/Windows/Enums.cs
Normal file
42
libexeinfo/Windows/Enums.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// Enums.cs
|
||||
//
|
||||
// Author:
|
||||
// Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Copyright (c) 2017 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.Windows
|
||||
{
|
||||
public enum BitmapCompression : uint
|
||||
{
|
||||
None = 0,
|
||||
Rle8 = 1,
|
||||
Rle4 = 2,
|
||||
Bitfields = 3,
|
||||
Jpeg = 4,
|
||||
Png = 5,
|
||||
AlphaBitfields = 6,
|
||||
Cmyk = 11,
|
||||
CmykRle8 = 12,
|
||||
CmykRle4 = 13
|
||||
}
|
||||
}
|
||||
63
libexeinfo/Windows/Structs.cs
Normal file
63
libexeinfo/Windows/Structs.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// Structs.cs
|
||||
//
|
||||
// Author:
|
||||
// Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Copyright (c) 2017 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.Runtime.InteropServices;
|
||||
|
||||
namespace libexeinfo.Windows
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct BitmapInfoHeader
|
||||
{
|
||||
public uint HeaderSize;
|
||||
public uint Width;
|
||||
public uint Height;
|
||||
public ushort Planes;
|
||||
public ushort BitsPerPlane;
|
||||
public BitmapCompression BitmapCompression;
|
||||
public uint ImageSize;
|
||||
public uint HorizontalResolution;
|
||||
public uint VerticalResolution;
|
||||
public uint ColorsInPalette;
|
||||
public uint ImportantColors;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct Rgb
|
||||
{
|
||||
public byte Blue;
|
||||
public byte Green;
|
||||
public byte Red;
|
||||
public byte Reserved;
|
||||
}
|
||||
|
||||
public class DecodedBitmap
|
||||
{
|
||||
public uint BitsPerPixel;
|
||||
public uint Height;
|
||||
public int[] Pixels;
|
||||
public uint Width;
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,8 @@
|
||||
<Compile Include="NE\Accelerators.cs" />
|
||||
<Compile Include="NE\GetStrings.cs" />
|
||||
<Compile Include="Os2\Bitmap.cs" />
|
||||
<Compile Include="Os2\Enums.cs" />
|
||||
<Compile Include="Os2\Structs.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="MZ\Consts.cs" />
|
||||
<Compile Include="MZ\Info.cs" />
|
||||
@@ -96,6 +98,8 @@
|
||||
<Compile Include="Swapping.cs" />
|
||||
<Compile Include="PE\Subsystems.cs" />
|
||||
<Compile Include="Windows\Bitmap.cs" />
|
||||
<Compile Include="Windows\Enums.cs" />
|
||||
<Compile Include="Windows\Structs.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
||||
Reference in New Issue
Block a user