diff --git a/libexeinfo/MZ/Consts.cs b/libexeinfo/MZ/Consts.cs
index 7e588eb..ff8f9e9 100644
--- a/libexeinfo/MZ/Consts.cs
+++ b/libexeinfo/MZ/Consts.cs
@@ -29,6 +29,9 @@ namespace libexeinfo
{
public partial class MZ
{
+ ///
+ /// MZ executable signature, "MZ"
+ ///
public const ushort Signature = 0x5A4D;
}
}
diff --git a/libexeinfo/MZ/Info.cs b/libexeinfo/MZ/Info.cs
index 357b39c..48f45d1 100644
--- a/libexeinfo/MZ/Info.cs
+++ b/libexeinfo/MZ/Info.cs
@@ -24,12 +24,17 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using System;
using System.Text;
+
namespace libexeinfo
{
- public partial class MZ
+ public partial class MZ
{
+ ///
+ /// Gets a string with human readable information for a given MZ header
+ ///
+ /// Human readable information for given MZ header.
+ /// MZ executable header.
public static string GetInfo(MZHeader header)
{
StringBuilder sb = new StringBuilder();
@@ -53,7 +58,11 @@ namespace libexeinfo
return sb.ToString();
}
- public string GetInfo()
+ ///
+ /// Gets a string with human readable information for the MZ executable represented by this instance
+ ///
+ /// Human readable information for this instance.
+ public string GetInfo()
{
return GetInfo(Header);
}
diff --git a/libexeinfo/MZ/MZ.cs b/libexeinfo/MZ/MZ.cs
index 07c98cc..89230bf 100644
--- a/libexeinfo/MZ/MZ.cs
+++ b/libexeinfo/MZ/MZ.cs
@@ -29,12 +29,28 @@ using System.Runtime.InteropServices;
namespace libexeinfo
{
+ ///
+ /// Represents a DOS relocatable executable
+ ///
public partial class MZ
{
+ ///
+ /// The that contains the executable represented by this instance
+ ///
public readonly FileStream BaseStream;
+ ///
+ /// Header for this executable
+ ///
public readonly MZHeader Header;
+ ///
+ /// If true this instance correctly represents a DOS relocatable executable
+ ///
public readonly bool IsMZ;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Executable path.
public MZ(string path)
{
byte[] buffer = new byte[Marshal.SizeOf(typeof(MZHeader))];
@@ -49,6 +65,10 @@ namespace libexeinfo
IsMZ = Header.signature == Signature;
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Stream containing the executable.
public MZ(FileStream stream)
{
byte[] buffer = new byte[Marshal.SizeOf(typeof(MZHeader))];
@@ -63,18 +83,23 @@ namespace libexeinfo
IsMZ = Header.signature == Signature;
}
- public bool Identify()
- {
- return IsMZ;
- }
-
+ ///
+ /// Identifies if the specified executable is a DOS relocatable executable
+ ///
+ /// true if the specified executable is a DOS relocatable executable, false otherwise.
+ /// Executable path.
public static bool Identify(string path)
{
FileStream exeFs = File.Open(path, FileMode.Open, FileAccess.Read);
return Identify(exeFs);
}
- public static bool Identify(FileStream stream)
+ ///
+ /// Identifies if the specified executable is a DOS relocatable executable
+ ///
+ /// true if the specified executable is a DOS relocatable executable, false otherwise.
+ /// Stream containing the executable.
+ public static bool Identify(FileStream stream)
{
byte[] buffer = new byte[Marshal.SizeOf(typeof(MZHeader))];
diff --git a/libexeinfo/MZ/Structs.cs b/libexeinfo/MZ/Structs.cs
index 32d712b..77defb5 100644
--- a/libexeinfo/MZ/Structs.cs
+++ b/libexeinfo/MZ/Structs.cs
@@ -30,6 +30,9 @@ namespace libexeinfo
{
public partial class MZ
{
+ ///
+ /// Header of a DOS relocatable executable
+ ///
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct MZHeader
{
@@ -56,6 +59,9 @@ namespace libexeinfo
public uint new_offset;
}
+ ///
+ /// Entry in the relocation table
+ ///
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct RelocationTableEntry
{
diff --git a/libexeinfo/NE/Consts.cs b/libexeinfo/NE/Consts.cs
index fd11888..1d18fda 100644
--- a/libexeinfo/NE/Consts.cs
+++ b/libexeinfo/NE/Consts.cs
@@ -30,11 +30,25 @@ namespace libexeinfo
{
public partial class NE
{
+ ///
+ /// New Executable signature, "NE"
+ ///
public const ushort Signature = 0x454E;
- public static readonly string FixedFileInfoSig = "VS_VERSION_INFO";
- public static readonly string StringFileInfo = "StringFileInfo";
+ ///
+ /// Signature for a
+ ///
+ public static readonly string FixedFileInfoSig = "VS_VERSION_INFO";
+ ///
+ /// Signature for list of name=value strings inside a version resource
+ ///
+ public static readonly string StringFileInfo = "StringFileInfo";
- public static string IdToName(ushort id)
+ ///
+ /// Gets the name of a resource type according to its identifier
+ ///
+ /// The resource type name.
+ /// Resource type identifier.
+ public static string ResourceIdToName(ushort id)
{
switch (id & 0x7FFF)
{
diff --git a/libexeinfo/NE/Enums.cs b/libexeinfo/NE/Enums.cs
index 298ff51..ae43a47 100644
--- a/libexeinfo/NE/Enums.cs
+++ b/libexeinfo/NE/Enums.cs
@@ -29,6 +29,9 @@ namespace libexeinfo
{
public partial class NE
{
+ ///
+ /// Program flags.
+ ///
[Flags]
public enum ProgramFlags : byte
{
@@ -43,6 +46,9 @@ namespace libexeinfo
i87 = 1 << 7
}
+ ///
+ /// Target operating system.
+ ///
public enum TargetOS : byte
{
Unknown = 0,
@@ -53,6 +59,9 @@ namespace libexeinfo
Borland = 5
}
+ ///
+ /// Application flags.
+ ///
[Flags]
public enum ApplicationFlags : byte
{
@@ -63,6 +72,9 @@ namespace libexeinfo
DLL = 1 << 7
}
+ ///
+ /// OS/2 flags.
+ ///
[Flags]
public enum OS2Flags : byte
{
@@ -72,6 +84,9 @@ namespace libexeinfo
GangloadArea = 1 << 3,
}
+ ///
+ /// Resource flags.
+ ///
[Flags]
public enum ResourceFlags : ushort
{
@@ -80,6 +95,9 @@ namespace libexeinfo
Preload = 0x40
}
+ ///
+ /// Resource types.
+ ///
public enum ResourceTypes : ushort
{
RT_ACCELERATOR = 9,
@@ -111,6 +129,9 @@ namespace libexeinfo
RT_NEW = 0x2000,
}
+ ///
+ /// Version file flags.
+ ///
[Flags]
public enum VersionFileFlags : uint
{
@@ -122,6 +143,9 @@ namespace libexeinfo
VS_FF_SPECIALBUILD = 0x00000020,
}
+ ///
+ /// Version file operating system.
+ ///
public enum VersionFileOS : uint
{
VOS_DOS = 0x00010000,
@@ -154,6 +178,9 @@ namespace libexeinfo
VOS_OS232_PM32 = 0x00030003,
}
+ ///
+ /// Version file type.
+ ///
public enum VersionFileType : uint
{
VFT_APP = 0x00000001,
@@ -165,6 +192,9 @@ namespace libexeinfo
VFT_VXD = 0x00000005,
}
+ ///
+ /// Version file subtype.
+ ///
public enum VersionFileSubtype : uint
{
VFT2_UNKNOWN = 0x00000000,
diff --git a/libexeinfo/NE/Info.cs b/libexeinfo/NE/Info.cs
index 7eda989..0bc3dbb 100644
--- a/libexeinfo/NE/Info.cs
+++ b/libexeinfo/NE/Info.cs
@@ -223,7 +223,7 @@ namespace libexeinfo
table.types[t].name = Encoding.ASCII.GetString(str);
}
else
- table.types[t].name = IdToName(table.types[t].id);
+ table.types[t].name = ResourceIdToName(table.types[t].id);
for (int r = 0; r < table.types[t].resources.Length; r++)
{
diff --git a/libexeinfo/NE/NE.cs b/libexeinfo/NE/NE.cs
index 9d92895..22ccb93 100644
--- a/libexeinfo/NE/NE.cs
+++ b/libexeinfo/NE/NE.cs
@@ -29,15 +29,31 @@ using System.Runtime.InteropServices;
namespace libexeinfo
{
- public partial class NE
+ ///
+ /// Represents a Microsoft New Executable
+ ///
+ public partial class NE
{
+ ///
+ /// The that contains the executable represented by this instance
+ ///
public readonly FileStream BaseStream;
+ ///
+ /// Header for this executable
+ ///
public readonly NEHeader Header;
+ ///
+ /// If true this instance correctly represents a Microsoft New Executable
+ ///
public readonly bool IsNE;
public readonly MZ BaseExecutable;
public readonly ResourceTable Resources;
public readonly Version[] Versions;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Executable path.
public NE(string path)
{
IsNE = false;
@@ -61,6 +77,10 @@ namespace libexeinfo
}
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Stream containing the executable.
public NE(FileStream stream)
{
IsNE = false;
@@ -84,12 +104,12 @@ namespace libexeinfo
}
}
- public bool Identify()
- {
- return IsNE;
- }
-
- public static bool Identify(string path)
+ ///
+ /// Identifies if the specified executable is a Microsoft New Executable
+ ///
+ /// true if the specified executable is a Microsoft New Executable, false otherwise.
+ /// Executable path.
+ public static bool Identify(string path)
{
FileStream BaseStream = File.Open(path, FileMode.Open, FileAccess.Read);
MZ BaseExecutable = new MZ(BaseStream);
@@ -110,8 +130,13 @@ namespace libexeinfo
return false;
}
-
- public static bool Identify(FileStream stream)
+
+ ///
+ /// Identifies if the specified executable is a Microsoft New Executable
+ ///
+ /// true if the specified executable is a Microsoft New Executable, false otherwise.
+ /// Stream containing the executable.
+ public static bool Identify(FileStream stream)
{
FileStream BaseStream = stream;
MZ BaseExecutable = new MZ(BaseStream);
diff --git a/libexeinfo/NE/Structs.cs b/libexeinfo/NE/Structs.cs
index 4df9307..c3d0249 100644
--- a/libexeinfo/NE/Structs.cs
+++ b/libexeinfo/NE/Structs.cs
@@ -31,6 +31,9 @@ namespace libexeinfo
{
public partial class NE
{
+ ///
+ /// Header for a Microsoft New Executable
+ ///
[StructLayout(LayoutKind.Sequential/*, Pack = 2*/)]
public struct NEHeader
{
@@ -68,12 +71,18 @@ namespace libexeinfo
public byte os_major;
}
+ ///
+ /// Resource table
+ ///
public struct ResourceTable
{
public ushort alignment_shift;
public ResourceType[] types;
}
+ ///
+ /// Resource type
+ ///
public struct ResourceType
{
public ushort id;
@@ -85,6 +94,9 @@ namespace libexeinfo
public string name;
}
+ ///
+ /// Resource
+ ///
public struct Resource
{
public ushort dataOffset;
@@ -98,6 +110,9 @@ namespace libexeinfo
public byte[] data;
}
+ ///
+ /// Node in a version resource
+ ///
class VersionNode
{
public ushort cbNode;
@@ -107,6 +122,9 @@ namespace libexeinfo
public VersionNode[] children;
}
+ ///
+ /// Fixed file version info
+ ///
[StructLayout(LayoutKind.Sequential)]
public class FixedFileInfo
{
diff --git a/libexeinfo/NE/Version.cs b/libexeinfo/NE/Version.cs
index 5d41d95..741ce7c 100644
--- a/libexeinfo/NE/Version.cs
+++ b/libexeinfo/NE/Version.cs
@@ -34,6 +34,10 @@ namespace libexeinfo
{
public partial class NE
{
+ ///
+ /// Gets all the version resources from this instance
+ ///
+ /// The decoded version resources.
public List GetVersions()
{
List versions = new List();
@@ -53,9 +57,16 @@ namespace libexeinfo
return versions;
}
+ ///
+ /// Represents a version ("RT_VERSION") resource
+ ///
public class Version
{
- public Dictionary> StringsByLanguage { get; }
+ ///
+ /// This contains a list of all name=value strings pairs sorted by language
+ ///
+ /// List of all name=value strings pairs sorted by language.
+ public Dictionary> StringsByLanguage { get; }
string fileVersion;
string productVersion;
@@ -66,6 +77,10 @@ namespace libexeinfo
DateTime fileDate;
string name;
+ ///
+ /// File version.
+ ///
+ /// The file version.
public string FileVersion
{
get
@@ -74,6 +89,10 @@ namespace libexeinfo
}
}
+ ///
+ /// Product version.
+ ///
+ /// The product version.
public string ProductVersion
{
get
@@ -82,6 +101,10 @@ namespace libexeinfo
}
}
+ ///
+ /// File flags.
+ ///
+ /// The file flags.
public VersionFileFlags FileFlags
{
get
@@ -90,6 +113,10 @@ namespace libexeinfo
}
}
+ ///
+ /// File operating system.
+ ///
+ /// The file operating system.
public VersionFileOS FileOS
{
get
@@ -98,6 +125,10 @@ namespace libexeinfo
}
}
+ ///
+ /// File type.
+ ///
+ /// The type of the file.
public VersionFileType FileType
{
get
@@ -106,6 +137,10 @@ namespace libexeinfo
}
}
+ ///
+ /// File subtype.
+ ///
+ /// The file subtype.
public VersionFileSubtype FileSubtype
{
get
@@ -114,6 +149,10 @@ namespace libexeinfo
}
}
+ ///
+ /// File date.
+ ///
+ /// The file date.
public DateTime FileDate
{
get
@@ -122,11 +161,20 @@ namespace libexeinfo
}
}
+ ///
+ /// Resource name
+ ///
+ /// The resource name.
public string Name
{
get { return name; }
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Resource data.
+ /// Resource name.
public Version(byte[] data, string resourceName = null)
{
if (data == null || data.Length < 5)
@@ -235,7 +283,12 @@ namespace libexeinfo
}
}
- public static string TypeToString(VersionFileType type)
+ ///
+ /// Converts a to string
+ ///
+ /// The string.
+ ///
+ public static string TypeToString(VersionFileType type)
{
switch (type)
{
@@ -258,7 +311,12 @@ namespace libexeinfo
}
}
- public static string DriverToString(VersionFileSubtype subtype)
+ ///
+ /// Converts a to string, considering file type to be a driver
+ ///
+ /// The string.
+ ///
+ public static string DriverToString(VersionFileSubtype subtype)
{
switch (subtype)
{
@@ -291,7 +349,12 @@ namespace libexeinfo
}
}
- public static string FontToString(VersionFileSubtype subtype)
+ ///
+ /// Converts a to string, considering file type to be a font
+ ///
+ /// The string.
+ ///
+ public static string FontToString(VersionFileSubtype subtype)
{
switch (subtype)
{
@@ -307,7 +370,13 @@ namespace libexeinfo
return string.Format("Unknown type code {0}", (uint)subtype);
}
}
- public static string OsToString(VersionFileOS os)
+
+ ///
+ /// Converts a to string
+ ///
+ /// The string.
+ ///
+ public static string OsToString(VersionFileOS os)
{
switch (os)
{