Add Atari ST resource file format.

This commit is contained in:
2018-02-26 23:24:56 +00:00
parent 7e3a0d65bb
commit 3dc43b8bc4
11 changed files with 754 additions and 25 deletions

View File

@@ -44,16 +44,14 @@ namespace exeinfo
return; return;
} }
FileStream exeFs = File.Open(args[0], FileMode.Open, FileAccess.Read);
bool recognized = false; bool recognized = false;
IExecutable mzExe = new MZ(exeFs); IExecutable mzExe = new MZ(args[0]);
IExecutable neExe = new NE(exeFs); IExecutable neExe = new NE(args[0]);
IExecutable stExe = new AtariST(exeFs); IExecutable stExe = new AtariST(args[0]);
IExecutable lxExe = new LX(exeFs); IExecutable lxExe = new LX(args[0]);
IExecutable coffExe = new COFF(exeFs); IExecutable coffExe = new COFF(args[0]);
IExecutable peExe = new PE(exeFs); IExecutable peExe = new PE(args[0]);
if(neExe.Recognized) if(neExe.Recognized)
{ {
@@ -144,6 +142,22 @@ namespace exeinfo
{ {
recognized = true; recognized = true;
Console.Write(stExe.Information); Console.Write(stExe.Information);
if(((AtariST)stExe).resourceStream != null ||
(((AtariST)stExe).Resource.rsh_vrsn != 0 && ((AtariST)stExe).Resource.rsh_vrsn != 1 &&
((AtariST)stExe).Resource.rsh_vrsn != 4 && ((AtariST)stExe).Resource.rsh_vrsn != 5))
{
Console.WriteLine("\tResources:");
Console.WriteLine("\t\t{0} OBJECTs start at {1}", ((AtariST)stExe).Resource.rsh_nobs, ((AtariST)stExe).Resource.rsh_object);
Console.WriteLine("\t\t{0} TEDINFOs start at {1}", ((AtariST)stExe).Resource.rsh_nted, ((AtariST)stExe).Resource.rsh_tedinfo);
Console.WriteLine("\t\t{0} ICONBLKs start at {1}", ((AtariST)stExe).Resource.rsh_nib, ((AtariST)stExe).Resource.rsh_iconblk);
Console.WriteLine("\t\t{0} BITBLKs start at {1}", ((AtariST)stExe).Resource.rsh_nbb, ((AtariST)stExe).Resource.rsh_bitblk);
Console.WriteLine("\t\t{0} object trees start at {1}", ((AtariST)stExe).Resource.rsh_ntree, ((AtariST)stExe).Resource.rsh_trindex);
Console.WriteLine("\t\t{0} free strings start at {1}", ((AtariST)stExe).Resource.rsh_nstring, ((AtariST)stExe).Resource.rsh_frstr);
Console.WriteLine("\t\t{0} free images start at {1}", ((AtariST)stExe).Resource.rsh_nimages, ((AtariST)stExe).Resource.rsh_frimg);
Console.WriteLine("\t\tString data starts at {0}", ((AtariST)stExe).Resource.rsh_string);
Console.WriteLine("\t\tImage data starts at {0}", ((AtariST)stExe).Resource.rsh_imdata);
Console.WriteLine("\t\tStandard resource data is {0} bytes", ((AtariST)stExe).Resource.rsh_rssize);
}
} }
if(coffExe.Recognized) if(coffExe.Recognized)

View File

@@ -63,14 +63,12 @@ namespace exeinfogui
txtFile.Text = dlgOpen.FileName; txtFile.Text = dlgOpen.FileName;
FileStream exeFs = File.Open(dlgOpen.FileName, FileMode.Open, FileAccess.Read); IExecutable mzExe = new MZ(dlgOpen.FileName);
IExecutable neExe = new NE(dlgOpen.FileName);
IExecutable mzExe = new MZ(exeFs); IExecutable stExe = new AtariST(dlgOpen.FileName);
IExecutable neExe = new NE(exeFs); IExecutable lxExe = new LX(dlgOpen.FileName);
IExecutable stExe = new AtariST(exeFs); IExecutable coffExe = new COFF(dlgOpen.FileName);
IExecutable lxExe = new LX(exeFs); IExecutable peExe = new PE(dlgOpen.FileName);
IExecutable coffExe = new COFF(exeFs);
IExecutable peExe = new PE(exeFs);
IExecutable recognizedExe = null; IExecutable recognizedExe = null;
if(mzExe.Recognized) recognizedExe = mzExe; if(mzExe.Recognized) recognizedExe = mzExe;
@@ -87,8 +85,6 @@ namespace exeinfogui
else else
txtType.Text = "Format not recognized"; txtType.Text = "Format not recognized";
exeFs.Close();
if(recognizedExe == null) return; if(recognizedExe == null) return;
txtType.Text = recognizedExe.Type; txtType.Text = recognizedExe.Type;

View File

@@ -41,7 +41,32 @@ namespace libexeinfo
/// <param name="path">Executable path.</param> /// <param name="path">Executable path.</param>
public AtariST(string path) public AtariST(string path)
{ {
BaseStream = File.Open(path, FileMode.Open, FileAccess.Read); BaseStream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
string pathDir = Path.GetDirectoryName(path);
string filename = Path.GetFileNameWithoutExtension(path);
string testPath = Path.Combine(pathDir, filename);
string resourceFilePath = null;
if(File.Exists(testPath + ".rsc"))
resourceFilePath = testPath + ".rsc";
else if(File.Exists(testPath + ".rsC"))
resourceFilePath = testPath + ".rsC";
else if(File.Exists(testPath + ".rSc"))
resourceFilePath = testPath + ".rSc";
else if(File.Exists(testPath + ".rSC"))
resourceFilePath = testPath + ".rSC";
else if(File.Exists(testPath + ".Rsc"))
resourceFilePath = testPath + ".Rsc";
else if(File.Exists(testPath + ".RsC"))
resourceFilePath = testPath + ".RsC";
else if(File.Exists(testPath + ".RSc"))
resourceFilePath = testPath + ".RSc";
else if(File.Exists(testPath + ".RSC"))
resourceFilePath = testPath + ".RSC";
if(resourceFilePath != null) resourceStream = File.Open(resourceFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
Initialize(); Initialize();
} }
@@ -76,6 +101,8 @@ namespace libexeinfo
public IEnumerable<Architecture> Architectures => new[] {Architecture.M68K}; public IEnumerable<Architecture> Architectures => new[] {Architecture.M68K};
public OperatingSystem RequiredOperatingSystem => public OperatingSystem RequiredOperatingSystem =>
new OperatingSystem {Name = Header.mint == MINT_SIGNATURE ? "MiNT" : "Atari TOS"}; new OperatingSystem {Name = Header.mint == MINT_SIGNATURE ? "MiNT" : "Atari TOS"};
public Stream resourceStream;
public AtariResource Resource;
void Initialize() void Initialize()
{ {
@@ -89,7 +116,16 @@ namespace libexeinfo
Header = BigEndianMarshal.ByteArrayToStructureBigEndian<AtariHeader>(buffer); Header = BigEndianMarshal.ByteArrayToStructureBigEndian<AtariHeader>(buffer);
Recognized = Header.signature == SIGNATURE; Recognized = Header.signature == SIGNATURE;
if(Recognized) Type = "Atari ST executable"; if(!Recognized) return;
Type = "Atari ST executable";
if(resourceStream == null) return;
buffer = new byte[Marshal.SizeOf(typeof(AtariResource))];
resourceStream.Position = 0;
resourceStream.Read(buffer, 0, buffer.Length);
Resource = BigEndianMarshal.ByteArrayToStructureBigEndian<AtariResource>(buffer);
} }
/// <summary> /// <summary>

239
libexeinfo/AtariST/Enums.cs Normal file
View File

@@ -0,0 +1,239 @@
//
// 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;
namespace libexeinfo
{
public partial class AtariST
{
public enum ObjectTypes : ushort
{
/// <summary>
/// A graphic box. Its <see cref="ObjectNode.ob_spec" /> contains the object's color word and thickness.
/// </summary>
G_BOX = 20,
/// <summary>
/// Graphic text. Its <see cref="ObjectNode.ob_spec" /> is a pointer to a <see cref="TedInfo" /> structure in which the
/// value of <see cref="TedInfo.te_ptext" /> points to the actual text string as displayed.
/// </summary>
G_TEXT = 21,
/// <summary>
/// A graphic box containing graphic text. Its <see cref="ObjectNode.ob_spec" /> is a pointer to a
/// <see cref="TedInfo" /> structure in which the value of <see cref="TedInfo.te_ptext" /> points to the actual text
/// string as displayed.
/// </summary>
G_BOXTEXT = 22,
/// <summary>
/// A graphic bit image. Its <see cref="ObjectNode.ob_spec" /> is a pointer to a <see cref="BitBlock" /> structure.
/// </summary>
G_IMAGE = 23,
/// <summary>
/// A programmed defined object. Its <see cref="ObjectNode.ob_spec" /> is a pointer to a <see cref="UserBlock" />
/// structure.
/// </summary>
G_USERDEF = 24,
/// <summary>
/// An invisible graphic box. Its <see cref="ObjectNode.ob_spec" /> contains the object's color word and thickness. It
/// has no fill pattern and no internal color. If its border has no thickness, it is truly invisible. If it does, it is
/// an outline.
/// </summary>
G_IBOX = 25,
/// <summary>
/// A graphic text object centered in a box. Its <see cref="ObjectNode.ob_spec" /> is a pointer to a null-terminated
/// text string.
/// </summary>
G_BUTTON = 26,
/// <summary>
/// A graphic box containing a single text character. Its <see cref="ObjectNode.ob_spec" /> contains the character,
/// plus the object's color word and thickness.
/// </summary>
G_BOXCHAR = 27,
/// <summary>
/// A graphic text object. Its <see cref="ObjectNode.ob_spec" /> is a pointer to a null terminated string.
/// </summary>
G_STRING = 28,
/// <summary>
/// Formatted graphic text. Its <see cref="ObjectNode.ob_spec" /> is a pointer to a <see cref="TedInfo" /> structure in
/// which the value of <see cref="TedInfo.te_ptext" /> points to a text string that is merged with the template pointed
/// by the <see cref="TedInfo.te_ptmplt" /> before it is displayed.
/// </summary>
G_FTEXT = 29,
/// <summary>
/// A graphic box containing formatted graphic text. Its <see cref="ObjectNode.ob_spec" /> is a pointer to a
/// <see cref="TedInfo" /> structure in which the value of <see cref="TedInfo.te_ptext" /> points to a text string that
/// is merged with the template pointed by the <see cref="TedInfo.te_ptmplt" /> before it is displayed.
/// </summary>
G_FBOXTEXT = 30,
/// <summary>
/// An object that describes an icon. Its <see cref="ObjectNode.ob_spec" /> is a pointer to an <see cref="IconBlock" />
/// structure.
/// </summary>
G_ICON = 31,
/// <summary>
/// A graphic text string used in menu titles. Its <see cref="ObjectNode.ob_spec" /> value is a pointer to a null
/// terminated text string.
/// </summary>
G_TITLE = 32,
/// <summary>
/// An object that describes a color icon. Its <see cref="ObjectNode.ob_spec" /> is a pointer to an <see cref="ColorIconBlock" />
/// structure.
/// </summary>
G_CICON = 31,
}
[Flags]
public enum ObjectFlags : ushort
{
/// <summary>
/// No flags
/// </summary>
None = 0x0000,
/// <summary>
/// Indicates that the user can select the object
/// </summary>
Selectable = 0x0001,
/// <summary>
/// Indicates that the Form Library will examine the object if the user enters a carriage return. No more than one object in a form can be flagged so.
/// </summary>
Default = 0x0002,
/// <summary>
/// Indicates that the Form Library will return control to the caller after the exit condition is satisfied. The condition is satisfied when the user clicks on the object.
/// </summary>
Exit = 0x0004,
/// <summary>
/// Indicates that an object is editable by the user in some way.
/// </summary>
Editable = 0x0008,
/// <summary>
/// An object called a radio button.
/// </summary>
Rbutton = 0x0010,
/// <summary>
/// Indicates that an object is the last in the tree
/// </summary>
Lastob = 0x0020,
/// <summary>
/// Inidicates that the Form Library will return control to the caller afeter the exit condition is satisfied. The condition is satisfied when the user clicks while the pointer is over the object.
/// </summary>
Touchexit = 0x0040,
/// <summary>
/// Makes a subtree invisible.
/// </summary>
Hidetree = 0x0080,
/// <summary>
/// Indicates that the value in <see cref="ObjectNode.ob_spec"/> is a pointer to the actual value.
/// </summary>
Indirect = 0x0100
}
[Flags]
public enum ObjectStates : ushort
{
/// <summary>
/// Indicates that the object is drawn in normal colors
/// </summary>
Normal = 0x0000,
/// <summary>
/// Indicates that the object is highlighted by being drawn with reversed colors
/// </summary>
Selected = 0x0001,
/// <summary>
/// Indicates that an 'X' is drawn in the object.
/// </summary>
Crossed = 0x0002,
/// <summary>
/// Indicates that the object is drawn with a check mark.
/// </summary>
Checked = 0x0004,
/// <summary>
/// Indicates that the object is drawn faintly.
/// </summary>
Disabled = 0x0008,
/// <summary>
/// Indicates that an outline appears around a box object. This state is used for dialog boxes.
/// </summary>
Outlined = 0x0010,
/// <summary>
/// Indicates that the object (usually a box) is drawn with a drop shadow
/// </summary>
Shadowed = 0x0020
}
public enum ObjectColors : byte
{
White = 0,
Black = 1,
Red = 2,
Green = 3,
Blue = 4,
Cyan = 5,
Yellow = 6,
Magenta = 7,
White2 = 8,
Black2 = 9,
LightRed = 10,
LightGreen = 11,
LightBlue = 12,
LightCyan = 13,
LightYellow = 14,
LightMagenta = 15
}
public enum ObjectFillPattern : byte
{
Hollow = 0,
Dither1 = 1,
Dither2 = 2,
Dither3 = 3,
Dither4 = 4,
Dither5 = 5,
Dither6 = 6,
Solid = 7,
}
/// <summary>
/// Mask for border <see cref="ObjectColors"/>
/// </summary>
const ushort BorderColorMask = 0xF000;
/// <summary>
/// Mask for text <see cref="ObjectColors"/>
/// </summary>
const ushort TextColorMask = 0x0F00;
/// <summary>
/// If set text is in transparent mode. Replace mode otherwise.
/// </summary>
const ushort TransparentColor = 0x0080;
/// <summary>
/// Mask for <see cref="ObjectFillPattern"/>
/// </summary>
const ushort FillPatternMask = 0x0070;
/// <summary>
/// Mask for inside <see cref="ObjectColors"/>
/// </summary>
const ushort InsideColorMask = 0x000F;
}
}

View File

@@ -42,5 +42,448 @@ namespace libexeinfo
public uint flags; public uint flags;
public ushort absflags; public ushort absflags;
} }
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct AtariResource
{
/// <summary>
/// Contains the version number of the resource file. This value is 0x0000 or 0x0001 in old format RSC files and has
/// the third bit set (i.e. 0x0004) in the new file format. If file is in the new format, it is appended at the end
/// with <see cref="AtariResourceExtension" />
/// </summary>
public ushort rsh_vrsn;
/// <summary>
/// Contains an offset from the beginning of the file to the OBJECT structures.
/// </summary>
public ushort rsh_object;
/// <summary>
/// Contains an offset from the beginning of the file to the TEDINFO structures.
/// </summary>
public ushort rsh_tedinfo;
/// <summary>
/// Contains an offset from the beginning of the file to the ICONBLK structures.
/// </summary>
public ushort rsh_iconblk;
/// <summary>
/// Contains an offset from the beginning of the file to the BITBLK structures.
/// </summary>
public ushort rsh_bitblk;
/// <summary>
/// Contains an offset from the beginning of the file to the string pointer table.
/// </summary>
public ushort rsh_frstr;
/// <summary>
/// Contains an offset from the beginning of the file to the string data.
/// </summary>
public ushort rsh_string;
/// <summary>
/// Contains an offset from the beginning of the file to the image data.
/// </summary>
public ushort rsh_imdata;
/// <summary>
/// Contains an offset from the beginning of the file to the image pointer table.
/// </summary>
public ushort rsh_frimg;
/// <summary>
/// Contains an offset from the beginning of the file to the tree pointer table.
/// </summary>
public ushort rsh_trindex;
/// <summary>
/// Number of OBJECTs in the file.
/// </summary>
public ushort rsh_nobs;
/// <summary>
/// Number of object trees in the file.
/// </summary>
public ushort rsh_ntree;
/// <summary>
/// Number of TEDINFOs in the file.
/// </summary>
public ushort rsh_nted;
/// <summary>
/// Number of ICONBLKs in the file.
/// </summary>
public ushort rsh_nib;
/// <summary>
/// Number of BITBLKs in the file.
/// </summary>
public ushort rsh_nbb;
/// <summary>
/// Number of free strings in the file.
/// </summary>
public ushort rsh_nstring;
/// <summary>
/// Number of free images in the file.
/// </summary>
public ushort rsh_nimages;
/// <summary>
/// Size of the resource file (in bytes). Note that this is the size of the old format resource file. If the newer
/// format file is being used then this value can be used as an offset to the extension array.
/// </summary>
public ushort rsh_rssize;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct AtariResourceExtension
{
/// <summary>
/// Size of the file
/// </summary>
public uint filesize;
/// <summary>
/// Slot for color icons containing an offset to <see cref="ColorIconBlock" /> table. The table is an array of
/// <see cref="int" /> offsets in file with -1 meaning table end.
/// </summary>
public uint color_ic;
/// <summary>
/// If not 0, it's an unknown extension, 0 means last extension
/// </summary>
public uint end_extensions;
}
/// <summary>
/// The OBJECT structure contains values that describe the object, its relationship to the other objects in the tree,
/// and its location relative to its parent or (in the case of the root object) the screen.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct ObjectNode
{
/// <summary>
/// A word containing the index of the object's next sibling in the object tree array
/// </summary>
public ushort ob_next;
/// <summary>
/// A word containing the index of the first child: the head of the list of the object's children in the object tree
/// array
/// </summary>
public ushort ob_head;
/// <summary>
/// A word contianing the index of the last child: the tail of the list of the object's children in the object tree
/// array
/// </summary>
public ushort ob_tail;
/// <summary>
/// A word containing the object type. GEM AES ignored the high byte of this word
/// </summary>
public ushort ob_type;
/// <summary>
/// A word containing the object flags
/// </summary>
public ushort ob_flags;
/// <summary>
/// A word containing the object state
/// </summary>
public ushort ob_state;
/// <summary>
/// A long value containing object specific data. Depending on the object's type, can be a pointer to any combination
/// of word and/or byte values that add up to 32 bits.
/// </summary>
public uint ob_spec;
/// <summary>
/// A word containing the X-coordinate of the object relative to its parent or (for the root object) the screen
/// </summary>
public ushort ob_x;
/// <summary>
/// A word containing the Y-coordinate of the object relative to its parent or (for the root object) the screen
/// </summary>
public ushort ob_y;
/// <summary>
/// A word containing the width of the object in pixels
/// </summary>
public ushort ob_width;
/// <summary>
/// A word containing the height of the object in pixels
/// </summary>
public ushort ob_height;
}
/// <summary>
/// The TEDINFO structure lets a user edit formatted text. The object types G_TEXT, G_BOXTEXT, G_FTEXT and G_FBOXTEXT
/// use their <see cref="ObjectNode.ob_spec" /> to point to TEDINFO structures.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct TedInfo
{
/// <summary>
/// A pointer to the actual text. If the first character is '@', the field is blank.
/// </summary>
public uint te_ptext;
/// <summary>
/// A pointer to a string template for any data entry. The editable portion is represented by underscores.
/// </summary>
public uint te_ptmplt;
/// <summary>
/// A pointer to a text string contianing characters tht validate any entered text
/// </summary>
public uint te_pvalid;
/// <summary>
/// A word identifying the font used to draw the text. 3 for system font, 5 for small font.
/// </summary>
public ushort te_font;
/// <summary>
/// Reserved for future use
/// </summary>
public ushort te_resvd1;
/// <summary>
/// A word identifying the type of text justification desired. 0 = left, 1 = right, 2 = center
/// </summary>
public ushort te_just;
/// <summary>
/// A word identifying the color and pattern of box-type objects
/// </summary>
public ushort te_color;
/// <summary>
/// Reserved for future use
/// </summary>
public ushort te_resvd2;
/// <summary>
/// A word containing the thickness in pixels of the border of the text box. 0 for none, positive for inside, negative
/// for outside
/// </summary>
public ushort te_thickness;
/// <summary>
/// A word containing the length of the string pointed by <see cref="te_ptext" />.
/// </summary>
public ushort te_txtlen;
/// <summary>
/// A word containing the length of the string pointed by <see cref="te_ptmplt" />.
/// </summary>
public ushort te_tmplen;
}
/// <summary>
/// The ICONBLK structure is used to hold the data that defines icons. The object type G_ICON points with its
/// <see cref="ObjectNode.ob_spec" /> pointer to an ICONBLK structure.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct IconBlock
{
/// <summary>
/// A pointer to an array of words representing the mask bit image of the icon
/// </summary>
public uint ib_pmask;
/// <summary>
/// A pointer to an array of words representing the data bit image of the icon
/// </summary>
public uint ib_pdata;
/// <summary>
/// A pointer to the icon's text
/// </summary>
public uint ib_ptext;
/// <summary>
/// A word containing a character to be drawn in the icon. The high byte contains the foreground color in the high
/// nibble and the background color in the low nibble.
/// </summary>
public ushort ib_char;
/// <summary>
/// A word containing the X-coordinate of <see cref="ib_char" />
/// </summary>
public ushort ib_xchar;
/// <summary>
/// A word containing the Y-coordinate of <see cref="ib_char" />
/// </summary>
public ushort ib_ychar;
/// <summary>
/// A word containing the X-coordinate of the icon
/// </summary>
public ushort ib_xicon;
/// <summary>
/// A word containing the Y-coordinate of the icon
/// </summary>
public ushort ib_yicon;
/// <summary>
/// A word containing the width of the icon in pixels. Must be divisible by 16.
/// </summary>
public ushort ib_wicon;
/// <summary>
/// A word containing the height of the icon in pixels
/// </summary>
public ushort ib_hicon;
/// <summary>
/// A word containing the X-coordinate of the icon's text
/// </summary>
public ushort ib_xtext;
/// <summary>
/// A word containing the Y-coordinate of the icon's text
/// </summary>
public ushort ib_ytext;
/// <summary>
/// A word containing the width of a rectangle in which the icon's text will be centered
/// </summary>
public ushort ib_wtext;
/// <summary>
/// A word containing the height of the icon's text in pixels
/// </summary>
public ushort ib_htext;
/// <summary>
/// Zeros
/// </summary>
public ushort empty;
}
/// <summary>
/// The object type G_IMAGE uses the BITBLK structure to draw bit images like cursor forms or icons
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct BitBlock
{
/// <summary>
/// A pointer to an array of words contianing the bit image
/// </summary>
public uint bi_pdata;
/// <summary>
/// A word containing the width of the <see cref="bi_pdata" /> array in bytes
/// </summary>
public ushort bi_wb;
/// <summary>
/// A word containing the height of the bit block in scan lines (pixels)
/// </summary>
public ushort bi_hl;
/// <summary>
/// A word containing the source X in bit form, relative to the <see cref="bi_pdata" /> array
/// </summary>
public ushort bi_x;
/// <summary>
/// A word containing the source Y in bit form, relative to the <see cref="bi_pdata" /> array
/// </summary>
public ushort bi_y;
/// <summary>
/// A word containing the color GEM AES uses when displaying the bit image.
/// </summary>
public ushort bi_color;
/// <summary>
/// Zeros
/// </summary>
public ushort empty;
}
/// <summary>
/// The USERBLK structure is used to locate and call an application-defined routine that will draw and/or change an
/// object. The object type G_UERDEF points with its <see cref="ObjectNode.ob_spec" /> pointer to an USERBLK structure.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct UserBlock
{
/// <summary>
/// A pointer to the routine for drawing and/or changing the object
/// </summary>
public uint ub_code;
/// <summary>
/// A long value (optionally provided by the application) passed as a parameter when calling the routine
/// </summary>
public uint ub_parm;
}
/// <summary>
/// The PARMBLK structure is used to store information relevant to the application's drawing or changing an object.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct ParameterBlock
{
/// <summary>
/// A pointer to the object tree that contains the application defined object
/// </summary>
public uint pb_tree;
/// <summary>
/// A word containing the object index of the application defined object
/// </summary>
public ushort pb_obj;
/// <summary>
/// A word containing the old state of an object to be changed
/// </summary>
public ushort pb_prevstate;
/// <summary>
/// A word containing the changed (new) state of an object
/// </summary>
public ushort pb_currstate;
/// <summary>
/// A word containing the X-coordinate of a rectangle defining the location of the object on the physical screen
/// </summary>
public ushort pb_x;
/// <summary>
/// A word containing the Y-coordinate of a rectangle defining the location of the object on the physical screen
/// </summary>
public ushort pb_y;
/// <summary>
/// A word containing the width in pixels of a rectanble defining the size of the object on the physical screen
/// </summary>
public ushort pb_w;
/// <summary>
/// A word containing the height in pixels of a rectanble defining the size of the object on the physical screen
/// </summary>
public ushort pb_h;
/// <summary>
/// A word containing the X-coordinate of the current clip rectangle on the physical screen
/// </summary>
public ushort pb_xc;
/// <summary>
/// A word containing the Y-coordinate of the current clip rectangle on the physical screen
/// </summary>
public ushort pb_yc;
/// <summary>
/// A word containing the width in pixels of the current clip rectnagle on the physical screen
/// </summary>
public ushort pb_wc;
/// <summary>
/// A word containing the heigth in pixels of the current clip rectnagle on the physical screen
/// </summary>
public ushort pb_hc;
/// <summary>
/// A long value, identical to <see cref="UserBlock.ub_parm" />, that is passed to the application when it is time for
/// the application to draw or change the object. Low word.
/// </summary>
public ushort pb_parm_low;
/// <summary>
/// A long value, identical to <see cref="UserBlock.ub_parm" />, that is passed to the application when it is time for
/// the application to draw or change the object. High word.
/// </summary>
public ushort pb_parm_high;
/// <summary>
/// Zeros
/// </summary>
public ushort empty;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct ColorIcon
{
/// <summary>
/// Number of planes in the following data
/// </summary>
public ushort num_planes;
/// <summary>
/// Pointer to color bitmap in standard form
/// </summary>
public uint col_data;
/// <summary>
/// Pointer to single plane mask of <see cref="col_data" />
/// </summary>
public uint col_mask;
/// <summary>
/// Pointer to color bitmap of selected icon
/// </summary>
public uint sel_data;
/// <summary>
/// Pointer to single plane mask of <see cref="sel_data" />
/// </summary>
public uint sel_mask;
/// <summary>
/// Pointer to next icon
/// </summary>
public uint next_res;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct ColorIconBlock
{
/// <summary>
/// Default monochrome icon
/// </summary>
IconBlock monoblk;
/// <summary>
/// List of color icons for diferent resolutions
/// </summary>
ColorIcon[] mainlist;
}
} }
} }

View File

@@ -42,7 +42,7 @@ namespace libexeinfo
/// <param name="path">Executable path.</param> /// <param name="path">Executable path.</param>
public COFF(string path) public COFF(string path)
{ {
BaseStream = File.Open(path, FileMode.Open, FileAccess.Read); BaseStream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
Initialize(); Initialize();
} }

View File

@@ -49,7 +49,7 @@ namespace libexeinfo
/// <param name="path">Executable path.</param> /// <param name="path">Executable path.</param>
public LX(string path) public LX(string path)
{ {
BaseStream = File.Open(path, FileMode.Open, FileAccess.Read); BaseStream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
Initialize(); Initialize();
} }

View File

@@ -47,7 +47,7 @@ namespace libexeinfo
/// <param name="path">Executable path.</param> /// <param name="path">Executable path.</param>
public MZ(string path) public MZ(string path)
{ {
BaseStream = File.Open(path, FileMode.Open, FileAccess.Read); BaseStream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
Initialize(); Initialize();
} }

View File

@@ -52,7 +52,7 @@ namespace libexeinfo
/// <param name="path">Executable path.</param> /// <param name="path">Executable path.</param>
public NE(string path) public NE(string path)
{ {
BaseStream = File.Open(path, FileMode.Open, FileAccess.Read); BaseStream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
Initialize(); Initialize();
} }

View File

@@ -49,7 +49,7 @@ namespace libexeinfo
/// <param name="path">Executable path.</param> /// <param name="path">Executable path.</param>
public PE(string path) public PE(string path)
{ {
BaseStream = File.Open(path, FileMode.Open, FileAccess.Read); BaseStream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
Initialize(); Initialize();
} }

View File

@@ -46,6 +46,7 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AtariST\Enums.cs" />
<Compile Include="Enums.cs" /> <Compile Include="Enums.cs" />
<Compile Include="IExecutable.cs" /> <Compile Include="IExecutable.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />