106 Commits
1.5.8 ... 1.7.2

Author SHA1 Message Date
Matt Nadareski
0130a9caee Bump version 2025-09-22 17:26:04 -04:00
Matt Nadareski
da204f129f Remove unnecessary NoWarn 2025-09-22 17:22:32 -04:00
Matt Nadareski
945a62d1f2 Add COFF constants 2025-09-22 15:57:16 -04:00
Matt Nadareski
8ab5088607 Simplify naming in comments 2025-09-22 12:58:02 -04:00
Matt Nadareski
9e9fcac654 Move delay load table because it was missed 2025-09-22 12:39:44 -04:00
Matt Nadareski
76dac1025c Move TODO more out of the way 2025-09-22 12:38:03 -04:00
Matt Nadareski
0ec1cac7cf Remove TODO that was done 2025-09-22 12:36:01 -04:00
Matt Nadareski
6a0b97fdcd Remove meta-tables 2025-09-22 12:34:26 -04:00
Matt Nadareski
66f7adc49a Slightly change description on optional header 2025-09-22 12:19:06 -04:00
Matt Nadareski
4bc685ba23 Move TLS 2025-09-22 12:17:29 -04:00
Matt Nadareski
89ef827251 Move resource 2025-09-22 12:16:47 -04:00
Matt Nadareski
beb42b7e35 Move load configuration 2025-09-22 12:13:08 -04:00
Matt Nadareski
0502808962 This goes in resource entries 2025-09-22 12:07:26 -04:00
Matt Nadareski
e3411d3984 This is also import-related 2025-09-22 12:06:46 -04:00
Matt Nadareski
9d13cb01e3 Move import table 2025-09-22 12:06:05 -04:00
Matt Nadareski
649ea98a52 Move export table 2025-09-22 12:04:06 -04:00
Matt Nadareski
b90d7c5e9a Move debug data table 2025-09-22 12:01:12 -04:00
Matt Nadareski
9def156302 Move delay load directory table 2025-09-22 11:56:11 -04:00
Matt Nadareski
e1db4fc17b Move attribute certificate table 2025-09-22 11:52:28 -04:00
Matt Nadareski
ae4ad5c272 Optional header is partially COFF 2025-09-22 11:38:24 -04:00
Matt Nadareski
5bda523aec Sections are COFF, who knew? 2025-09-22 11:29:39 -04:00
Matt Nadareski
eda099d44e Separate out COFF stuff maybe for later? 2025-09-22 11:26:08 -04:00
Matt Nadareski
b5ac9304a4 Move base relocation to new namespace 2025-09-22 11:14:27 -04:00
Matt Nadareski
b40f84dd4b Move more things to resource entries namespace 2025-09-22 11:09:58 -04:00
Matt Nadareski
4a276fb65e Move MoPaQ encryption constants to IO 2025-09-22 10:37:40 -04:00
Matt Nadareski
973a94b340 Move LZX models to IO 2025-09-22 10:33:33 -04:00
Matt Nadareski
c6062f71eb Move Quantum compression models to IO 2025-09-22 10:29:29 -04:00
Matt Nadareski
fd7746fae3 Move MSZIP "model" to IO 2025-09-22 10:22:38 -04:00
Matt Nadareski
d3c6bdf23f Update Newtonsoft 2025-09-22 09:46:23 -04:00
Matt Nadareski
605a3bf30d Add a bunch of useful constants 2025-09-22 09:35:00 -04:00
Matt Nadareski
710ddc912d Add and update models needed for BOS 2025-09-22 09:06:33 -04:00
HeroponRikiBestest
2f94464b7d Small matroschka model update (#14)
* Small model updates, mainly documentation. Not essential.

* wrong branch lol
2025-09-19 12:09:16 -04:00
Matt Nadareski
b3d9bd3d6b Add some more hashes for fun 2025-09-19 08:29:49 -04:00
Matt Nadareski
c51c16ed2d Add RA extensions to Logiqx (fixes #13) 2025-09-17 09:29:29 -04:00
HeroponRikiBestest
978b6904db Add fileData variable to MatroshkaEntry.cs model (#12)
* Add fileData variable to MatroshkaEntry.cs model

This will be necessary to handle parsing properly in serialization.

* Use PascalCase
2025-09-16 15:30:47 -04:00
Matt Nadareski
d62bd2f60c Cleanup from last PR 2025-09-12 12:54:22 -04:00
Deterous
26f7f4d7da AACS2 support (#11)
* AACS2 support

* Better names

* libaacs links
2025-09-12 12:50:32 -04:00
Matt Nadareski
50a6f9ba89 There 2025-09-10 21:52:09 -04:00
Matt Nadareski
f07c11fb47 Simplify TLS directory 2025-09-09 13:54:19 -04:00
Matt Nadareski
dc47f64ee6 Sync a few notes from Serialization 2025-09-09 13:52:48 -04:00
Matt Nadareski
69006247a9 One more potential constant 2025-09-09 12:32:11 -04:00
Matt Nadareski
9c43b80502 Rename to be more accurate 2025-09-09 12:29:26 -04:00
Matt Nadareski
cbb7563724 Add missing symbol types, make a flag 2025-09-09 11:07:51 -04:00
Matt Nadareski
c7530884b3 Add constant notes 2025-09-09 09:42:55 -04:00
Matt Nadareski
e59c9205d4 Make OptionalHeader a bit more correct 2025-09-09 09:30:43 -04:00
Matt Nadareski
f5859638c2 Move these 2025-09-08 21:09:54 -04:00
Matt Nadareski
84d3740e73 Yeah 2025-09-08 21:07:25 -04:00
Matt Nadareski
517324ab58 Bump version 2025-09-05 09:10:29 -04:00
Matt Nadareski
a02c037995 Remind myself of this 2025-09-02 19:20:59 -04:00
Matt Nadareski
a1890e1fe6 I messed this up too 2025-09-01 16:17:02 -04:00
Matt Nadareski
32c6633788 Fix this naming for later 2025-09-01 15:52:50 -04:00
Matt Nadareski
81b53c9785 Bump version 2025-09-01 15:05:53 -04:00
Matt Nadareski
54c05f2746 Sync changes from downstream 2025-09-01 15:05:15 -04:00
Matt Nadareski
4a4d7ceddf Make this more clear 2025-08-28 23:37:18 -04:00
Matt Nadareski
0f029c5979 Fix one 2025-08-28 21:29:23 -04:00
Matt Nadareski
bb4fee91d9 Sort some things around PE 2025-08-28 21:18:39 -04:00
Matt Nadareski
ed56e2543d Convert this to an array 2025-08-28 12:12:04 -04:00
Matt Nadareski
d675673e50 More descriptive names 2025-08-28 09:47:01 -04:00
Matt Nadareski
ebee967c7f Clean up gzip and tar a bit 2025-08-28 09:27:08 -04:00
Matt Nadareski
f5da54eaac Fix some tar model issues 2025-08-28 08:56:11 -04:00
Matt Nadareski
2350c1af27 Add placeholder models 2025-08-28 07:46:23 -04:00
Matt Nadareski
454d507b41 Source my sources 2025-08-28 07:40:09 -04:00
Matt Nadareski
10de4acbb9 File ending thing for PKZIP 2025-08-28 07:38:11 -04:00
Matt Nadareski
8ec91d8d04 Add a couple missing extra field structures 2025-08-27 22:28:06 -04:00
Matt Nadareski
1d62d69a53 Interleaved types don't need to be here 2025-08-27 22:09:28 -04:00
Matt Nadareski
5b5fed8932 Rename a few things 2025-08-27 21:09:30 -04:00
Matt Nadareski
32123d4b80 Fix one more PKZIP extra field 2025-08-27 20:40:32 -04:00
Matt Nadareski
f5717c3929 Forgot to sync change here 2025-08-27 19:19:36 -04:00
Matt Nadareski
e8db261d73 Start making some fixes to PKZIP 2025-08-27 19:14:31 -04:00
Matt Nadareski
9557f43dab Add placeholder extras field 2025-08-27 18:43:26 -04:00
Matt Nadareski
51b9c1a016 Make PKZIP models a bit easier to follow 2025-08-27 12:51:57 -04:00
Matt Nadareski
bb3cd54865 Remove now-useless note 2025-08-15 10:13:31 -04:00
Matt Nadareski
0c6060a901 Clickable sources, archive links for dead pages 2025-08-15 10:09:43 -04:00
Matt Nadareski
c18770f627 Upstream changes from WiseUnpacker 2025-08-15 08:59:29 -04:00
Matt Nadareski
c2a5d6770c Upstream changes from WiseUnpacker 2025-08-13 12:22:11 -04:00
Matt Nadareski
4ef79ccdca Upstream changes from WiseUnpacker 2025-08-10 21:44:23 -04:00
Matt Nadareski
cf5135f330 Slight NE cleanup 2025-08-10 20:36:53 -04:00
Matt Nadareski
6d989209db Update NE notes and structure a bit more 2025-08-10 20:15:49 -04:00
Matt Nadareski
cc48593646 Upstream changes from WiseUnpacker 2025-08-09 10:26:37 -04:00
Matt Nadareski
415d571b65 Upstream changes from WiseUnpacker 2025-08-06 09:33:51 -04:00
Matt Nadareski
4a6e244b38 Upstream changes from WiseUnpacker 2025-08-04 12:16:34 -04:00
Matt Nadareski
771a39517f Upstream changes from WiseUnpacker 2025-08-01 16:06:32 -04:00
Matt Nadareski
b072a3809c Fix enum 2025-08-01 10:32:17 -04:00
Matt Nadareski
341585206a Add Wise Installer models from REWise
All credit to CYBERDEV for their work in documenting these structures in the first place
2025-07-31 22:35:04 -04:00
Matt Nadareski
2dc2ab5dd1 Add OLE models 2025-07-30 22:46:37 -04:00
Matt Nadareski
144a3ce52b Fix CFB comments 2025-07-29 22:45:15 -04:00
Matt Nadareski
85199789f7 Add new Matroshka package comment 2025-07-28 07:54:29 -04:00
Matt Nadareski
fb39216c82 Bump verison 2025-07-24 09:11:34 -04:00
Matt Nadareski
1a2de39868 Fix Dir serialization issue 2025-07-24 09:11:10 -04:00
Matt Nadareski
f18b6c8850 Bump version 2025-07-23 09:48:18 -04:00
Matt Nadareski
8f1e49e464 Add .NET Standard 2.0 and 2.1 2025-07-23 09:43:12 -04:00
Matt Nadareski
6547242f93 Clean up more Matroskha comments 2025-07-21 11:27:20 -04:00
Matt Nadareski
edf00f3ab2 Add analysis block comment 2025-07-21 11:25:18 -04:00
Matt Nadareski
bce4736037 Clean up more Matroskha comments 2025-07-21 11:23:25 -04:00
Matt Nadareski
81f28974c0 More remark corrections based on more samples 2025-07-21 11:10:35 -04:00
Matt Nadareski
30ebe84af4 Remove disproven theory 2025-07-21 11:08:01 -04:00
Matt Nadareski
b07fbdedd6 Add secondary length note 2025-07-21 09:39:31 -04:00
Matt Nadareski
cd8fff4a86 Slight tweaks to Matroska entry notes 2025-07-21 09:21:56 -04:00
Matt Nadareski
3d3275e3cb Add SecuROM Matroshka models
All research thanks to HeroponRikiBestest
2025-07-21 09:11:37 -04:00
Matt Nadareski
4c76ce1230 Add SecuROM DFA models
All research thanks to HeroponRikiBestest
2025-07-21 08:10:25 -04:00
Matt Nadareski
0c4e3b4bf2 Dirs can be nested 2025-06-24 12:32:14 -04:00
Matt Nadareski
e8f4386199 Add mess alternative ListXML model 2025-05-28 09:53:05 -04:00
Matt Nadareski
ab66ccf3c5 Update copyright 2024-12-30 21:19:05 -05:00
Matt Nadareski
cc60d54a33 Remove unnecessary action step 2024-12-30 21:18:59 -05:00
Matt Nadareski
e805f4cb9a Ensure .NET versions are installed for testing 2024-12-19 10:50:01 -05:00
Matt Nadareski
328c893a38 Ensure .NET versions are installed for testing 2024-12-19 10:45:08 -05:00
316 changed files with 8561 additions and 3587 deletions

View File

@@ -16,7 +16,10 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Run tests
run: dotnet test
@@ -24,12 +27,6 @@ jobs:
- name: Run publish script
run: ./publish-nix.sh
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: 'Nuget Package'
path: "*.nupkg,*.snupkg"
- name: Upload to rolling
uses: ncipollo/release-action@v1.14.0
with:

View File

@@ -11,7 +11,10 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Build
run: dotnet build

7
LICENSE Normal file
View File

@@ -0,0 +1,7 @@
Copyright (c) 2018-2025 Matt Nadareski
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 (including the next paragraph) 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.

View File

@@ -12,10 +12,53 @@ For the most recent stable build, download the latest release here: [Releases Pa
For the latest WIP build here: [Rolling Release](https://github.com/SabreTools/SabreTools.Models/releases/rolling)
## Missing Metadata Models
## Notable Information Sources
The following metadata file formats do not have models included in this library yet and, as such, do not have serializers:
Not all of this information was able to be gathered directly from the files in question, so here is a non-exhaustive list of sites and projects that allow this project to exist. Most of the models also have direct links to specific pages or code snippets, where available.
- Missfile
- SabreJSON
- SabreDAT XML
| Site/Project | Models Directory |
| --- | --- |
| [3DBrew](https://www.3dbrew.org/wiki/Main_Page) | N3DS |
| [Aaru Data Preservation Suite](https://github.com/aaru-dps) | PIC |
| [Advanced Access Content System Licensing Administrator (AACS LA)](https://aacsla.com/) | AACS |
| [BYTE*](https://web.archive.org/web/20240703222951/https://bytepointer.com/index.htm) | NewExecutable |
| [cabextract/libmspack](https://www.cabextract.org.uk/) | LZ |
| [DBox](https://dbox.tools/) | Xbox |
| [DebugInfo.com](https://www.debuginfo.com/index.html) | PortableExecutable |
| [Devilsclaw](https://devilsclaws.net/) | PFF |
| [DSiBrew](https://dsibrew.org/wiki/Main_Page) | Nitro |
| [DVD Resources for Open Source Development](https://dvd.sourceforge.net/) | DVD |
| [EDM/2](https://www.edm2.com/index.php/Main_Page) | LinearExecutable |
| [faydoc.tripod.com](https://faydoc.tripod.com/formats/) | LinearExecutable |
| [GuitarGame_ChartFormats](https://github.com/TheNathannator/GuitarGame_ChartFormats/) | Charts |
| [HandWiki](https://handwiki.org/wiki/Start) | Quantum |
| [HLLib](https://github.com/RavuAlHemio/hllib/) | BSP, GCF, NCF, PAK, SGA, VPK, WAD3, XZP |
| [IBM Documentation](https://www.ibm.com/docs/en) | TAR |
| [IETF](https://www.ietf.org/) | GZIP |
| [Independent Commodore Library](https://petlibrary.tripod.com/) | PKZIP |
| [Ladislav Zezula](http://zezula.net/en/tools/main.html) | MoPaQ |
| [libaacs](https://code.videolan.org/videolan/libaacs/) | AACS |
| [libbdplus](https://github.com/mwgoldsmith/bdplus) | BD+ |
| [libexe](https://github.com/libyal/libexe/) | NewExecutable |
| [MAME](https://github.com/mamedev/mame/) | CHD |
| [Matthew Russotto](http://www.russotto.net/quantumcomp.html) | Compression/Quantum |
| [Microsoft Learn](https://learn.microsoft.com/en-us/) | BMP, CFB, Compression/LZX, Compression/MSZIP, MicrosoftCabinet, OLE, PortableExecutable, SecuROM, WiseInstaller |
| [msitools](https://github.com/GNOME/msitools/) | CFB |
| [OSDev.org](https://wiki.osdev.org/Expanded_Main_Page) | MSDOS, NewExecutable |
| [PInvoke.net](http://www.pinvoke.net/index.aspx) | MSDOS |
| [PKWARE(?)](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT) | PKZIP |
| [PS3 Developer Wiki](https://www.psdevwiki.com/ps3/) | IRD, PlayStation3 |
| [RanseiLink](https://github.com/Deijin27/RanseiLink) | Nitro |
| [Reverse Engineering Wise](https://codeberg.org/CYBERDEV/REWise) | WiseInstaller |
| [SharpCompress](https://github.com/adamhathcock/sharpcompress) | PKZIP |
| [Source SDK 2013](https://github.com/ValveSoftware/source-sdk-2013) | BSP |
| [Technical Committee T10](https://www.t10.org/) | PIC |
| [The Go tools for Windows + Assembler](https://www.godevtool.com/) | PortableExecutable |
| [The Whole Half-Life](https://twhl.info/wiki/page/Specification:_WAD3) | WAD3 |
| [Unshield](https://github.com/twogood/unshield) | InstallShieldCabinet |
| [unshieldv3](https://github.com/wfr/unshieldv3) | InstallShieldArchiveV3 |
| [Valve Developer Community](https://developer.valvesoftware.com/wiki/Main_Page) | BSP, VPK |
| [w4kfu's bl0g](https://web.archive.org/web/20250206143756/http://blog.w4kfu.com/) | SafeDisc |
| [Wine](https://github.com/wine-mirror/wine/) | LZ |
| [XboxDevWiki.net](https://xboxdevwiki.net/Main_Page) | Xbox |
| [XeNTaX Game Research Forum](http://web.archive.org/web/20231031162306/https://forum.xentax.com/) | SFFS |

View File

@@ -27,6 +27,20 @@ namespace SabreTools.Models.AACS
/// Section 3.2.5.2, which are only processed by Class II Licensed Products.
/// </summary>
Type10 = 0x000A1003,
/// <summary>
/// Type 2.0 Category C.
/// This is the Media Key Block Type found on "UHD" media (AACS v2.0)
/// </summary>
/// <see href="https://code.videolan.org/videolan/libaacs/-/blob/master/src/libaacs/mkb.h"/>
Type20 = 0x48141003,
/// <summary>
/// Type 2.1 Category C.
/// This is the Media Key Block Type found on "UHD" media (AACS v2.1)
/// </summary>
/// <see href="https://code.videolan.org/videolan/libaacs/-/blob/master/src/libaacs/mkb.h"/>
Type21 = 0x48151003,
}
public enum RecordType : byte
@@ -35,6 +49,7 @@ namespace SabreTools.Models.AACS
ExplicitSubsetDifference = 0x04,
MediaKeyData = 0x05,
SubsetDifferenceIndex = 0x07,
MediaKeyVariantData = 0x0C,
TypeAndVersion = 0x10,
DriveRevocationList = 0x20,
HostRevocationList = 0x21,
@@ -42,5 +57,13 @@ namespace SabreTools.Models.AACS
// Not documented
Copyright = 0x7F,
// Record types only found in UHD media (AACS v2)
// <see href="https://code.videolan.org/videolan/libaacs/-/blob/master/src/devtools/mkb_dump.c"/>
Unknown0x28_AACS2 = 0x28,
DriveRevocationList_AACS2 = 0x30,
HostRevocationList_AACS2 = 0x31,
VerifyMediaKey_AACS2 = 0x86,
EmptyRecord0xF8_AACS2 = 0xF8,
}
}

View File

@@ -0,0 +1,13 @@
namespace SabreTools.Models.AACS
{
/// <summary>
/// This represents any record that does not have a concrete model yet
/// </summary>
public sealed class GenericRecord : Record
{
/// <summary>
/// Unparsed data comprising the record after the header
/// </summary>
public byte[]? Data { get; set; }
}
}

View File

@@ -2,6 +2,8 @@ namespace SabreTools.Models.BDPlus
{
public static class Constants
{
public static readonly byte[] SignatureBytes = [0x42, 0x44, 0x53, 0x56, 0x4D, 0x5F, 0x43, 0x43];
public const string SignatureString = "BDSVM_CC";
}
}

View File

@@ -0,0 +1,10 @@
namespace SabreTools.Models.BZip2
{
/// <summary>
/// This is a placeholder model for future work
/// </summary>
public class Archive
{
}
}

View File

@@ -0,0 +1,9 @@
namespace SabreTools.Models.BZip2
{
public static class Constants
{
public static readonly byte[] SignatureBytes = [0x42, 0x52, 0x68];
public const string SignatureString = "BRh";
}
}

View File

@@ -22,18 +22,18 @@ namespace SabreTools.Models.CFB
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string? Name;
/// <summary>
/// This field MUST be 0x00, 0x01, 0x02, or 0x05, depending on the
/// actual type of object. All other values are not valid.
/// </summary>
public ushort NameLength;
/// <summary>
/// This field MUST match the length of the Directory Entry Name Unicode
/// string in bytes. The length MUST be a multiple of 2 and include the
/// terminating null character in the count. This length MUST NOT exceed 64,
/// the maximum size of the Directory Entry Name field.
/// </summary>
public ushort NameLength;
/// <summary>
/// This field MUST be 0x00, 0x01, 0x02, or 0x05, depending on the
/// actual type of object. All other values are not valid.
/// </summary>
[MarshalAs(UnmanagedType.U1)]
public ObjectType ObjectType;

View File

@@ -2,6 +2,8 @@ namespace SabreTools.Models.CHD
{
public static class Constants
{
public static readonly byte[] SignatureBytes = [0x4D, 0x43, 0x6F, 0x6D, 0x70, 0x72, 0x48, 0x44];
public const string SignatureString = "MComprHD";
#region Header Sizes

View File

@@ -0,0 +1,20 @@
namespace SabreTools.Models.COFF
{
public static class Constants
{
/// <summary>
/// Fixed size of <see cref="FileHeader"/>
/// </summary>
public const int FileHeaderSize = 20;
/// <summary>
/// Fixed size of <see cref="SectionHeader"/>
/// </summary>
public const int SectionHeaderSize = 40;
/// <summary>
/// Fixed size of <see cref="SymbolTableEntries.BaseEntry"/>
/// </summary>
public const int SymbolTableEntrySize = 18;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.COFF
{
/// <summary>
/// At the beginning of an object file, or immediately after the signature
@@ -9,7 +9,7 @@ namespace SabreTools.Models.PortableExecutable
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class COFFFileHeader
public sealed class FileHeader
{
/// <summary>
/// The number that identifies the type of target machine.

View File

@@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.COFF
{
/// <summary>
/// COFF line numbers are no longer produced and, in the future, will
@@ -17,7 +17,7 @@ namespace SabreTools.Models.PortableExecutable
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Explicit)]
public sealed class COFFLineNumber
public sealed class LineNumber
{
/// <summary>
/// Used when Linenumber is zero: index to symbol table entry for a function.

View File

@@ -0,0 +1,88 @@
namespace SabreTools.Models.COFF
{
/// <summary>
/// Every image file has an optional header that provides information to the loader.
/// This header is optional in the sense that some files (specifically, object files)
/// do not have it. For image files, this header is required. An object file can have
/// an optional header, but generally this header has no function in an object file
/// except to increase its size.
///
/// Note that the size of the optional header is not fixed. The SizeOfOptionalHeader
/// field in the COFF header must be used to validate that a probe into the file for
/// a particular data directory does not go beyond SizeOfOptionalHeader.
///
/// The NumberOfRvaAndSizes field of the optional header should also be used to ensure
/// that no probe for a particular data directory entry goes beyond the optional header.
/// In addition, it is important to validate the optional header magic number for format
/// compatibility.
///
/// The optional header magic number determines whether an image is a PE32 or
/// PE32+ executable.
///
/// PE32+ images allow for a 64-bit address space while limiting the image size to
/// 2 gigabytes. Other PE32+ modifications are addressed in their respective sections.
///
/// The first eight fields of the optional header are standard fields that are defined
/// for every implementation of COFF. These fields contain general information that is
/// useful for loading and running an executable file. They are unchanged for the
/// PE32+ format.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
public class OptionalHeader
{
/// <summary>
/// The unsigned integer that identifies the state of the image file. The most
/// common number is 0x10B, which identifies it as a normal executable file.
/// 0x107 identifies it as a ROM image, and 0x20B identifies it as a PE32+ executable.
/// </summary>
public OptionalHeaderMagicNumber Magic { get; set; }
/// <summary>
/// The linker major version number.
/// </summary>
public byte MajorLinkerVersion { get; set; }
/// <summary>
/// The linker minor version number.
/// </summary>
public byte MinorLinkerVersion { get; set; }
/// <summary>
/// The size of the code (text) section, or the sum of all code sections if there
/// are multiple sections.
/// </summary>
public uint SizeOfCode { get; set; }
/// <summary>
/// The size of the initialized data section, or the sum of all such sections if
/// there are multiple data sections.
/// </summary>
public uint SizeOfInitializedData { get; set; }
/// <summary>
/// The size of the uninitialized data section (BSS), or the sum of all such sections
/// if there are multiple BSS sections.
/// </summary>
public uint SizeOfUninitializedData { get; set; }
/// <summary>
/// The address of the entry point relative to the image base when the executable file
/// is loaded into memory. For program images, this is the starting address. For
/// device drivers, this is the address of the initialization function. An entry point
/// is optional for DLLs. When no entry point is present, this field must be zero.
/// </summary>
public uint AddressOfEntryPoint { get; set; }
/// <summary>
/// The address that is relative to the image base of the beginning-of-code section when
/// it is loaded into memory.
/// </summary>
public uint BaseOfCode { get; set; }
/// <summary>
/// The address that is relative to the image base of the beginning-of-data section when
/// it is loaded into memory.
/// </summary>
public uint BaseOfData { get; set; }
}
}

View File

@@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.COFF
{
/// <summary>
/// Object files contain COFF relocations, which specify how the section data
@@ -18,7 +18,7 @@ namespace SabreTools.Models.PortableExecutable
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class COFFRelocation
public sealed class Relocation
{
/// <summary>
/// The address of the item to which relocation is applied. This is the

View File

@@ -1,4 +1,4 @@
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.COFF
{
/// <summary>
/// Each row of the section table is, in effect, a section header. This table
@@ -29,7 +29,8 @@
/// characters. Long names in object files are truncated if they are emitted
/// to an executable file.
/// </summary>
public byte[]? Name { get; set; } = new byte[8];
/// <remarks>8 bytes</remarks>
public byte[]? Name { get; set; }
/// <summary>
/// The total size of the section when loaded into memory. If this value is
@@ -100,11 +101,11 @@
/// <summary>
/// COFF Relocations (Object Only)
/// </summary>
public COFFRelocation[]? COFFRelocations { get; set; }
public Relocation[]? COFFRelocations { get; set; }
/// <summary>
/// COFF Line Numbers (Deprecated)
/// </summary>
public COFFLineNumber[]? COFFLineNumbers { get; set; }
public LineNumber[]? COFFLineNumbers { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
namespace SabreTools.Models.PortableExecutable
namespace SabreTools.Models.COFF
{
/// <summary>
/// Immediately following the COFF symbol table is the COFF string table. The
@@ -6,7 +6,7 @@
/// COFF header and adding the number of symbols multiplied by the size of a symbol.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
public sealed class COFFStringTable
public sealed class StringTable
{
/// <summary>
/// At the beginning of the COFF string table are 4 bytes that contain the

View File

@@ -0,0 +1,32 @@
namespace SabreTools.Models.COFF.SymbolTableEntries
{
/// <summary>
/// The symbol table in this section is inherited from the traditional
/// COFF format. It is distinct from Microsoft Visual C++ debug information.
/// A file can contain both a COFF symbol table and Visual C++ debug
/// information, and the two are kept separate. Some Microsoft tools use
/// the symbol table for limited but important purposes, such as
/// communicating COMDAT information to the linker. Section names and file
/// names, as well as code and data symbols, are listed in the symbol table.
///
/// The location of the symbol table is indicated in the COFF header.
///
/// The symbol table is an array of records, each 18 bytes long. Each record
/// is either a standard or auxiliary symbol-table record. A standard record
/// defines a symbol or name.
///
/// Auxiliary symbol table records always follow, and apply to, some standard
/// symbol table record. An auxiliary record can have any format that the tools
/// can recognize, but 18 bytes must be allocated for them so that symbol table
/// is maintained as an array of regular size. Currently, Microsoft tools
/// recognize auxiliary formats for the following kinds of records: function
/// definitions, function begin and end symbols (.bf and .ef), weak externals,
/// file names, and section definitions.
///
/// The traditional COFF design also includes auxiliary-record formats for arrays
/// and structures.Microsoft tools do not use these, but instead place that
/// symbolic information in Visual C++ debug format in the debug sections.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
public abstract class BaseEntry { }
}

View File

@@ -0,0 +1,33 @@
namespace SabreTools.Models.COFF.SymbolTableEntries
{
/// <summary>
/// Auxiliary Format 6: CLR Token Definition (Object Only)
///
/// This auxiliary symbol generally follows the IMAGE_SYM_CLASS_CLR_TOKEN. It is
/// used to associate a token with the COFF symbol table's namespace.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
public class CLRTokenDefinition : BaseEntry
{
/// <summary>
/// Must be IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF (1).
/// </summary>
public byte AuxType { get; set; }
/// <summary>
/// Reserved, must be zero.
/// </summary>
public byte Reserved1 { get; set; }
/// <summary>
/// The symbol index of the COFF symbol to which this CLR token definition refers.
/// </summary>
public uint SymbolTableIndex { get; set; }
/// <summary>
/// Reserved, must be zero.
/// </summary>
/// <remarks>12 bytes</remarks>
public byte[]? Reserved2 { get; set; }
}
}

View File

@@ -0,0 +1,53 @@
namespace SabreTools.Models.COFF.SymbolTableEntries
{
/// <summary>
/// Auxiliary Format 2: .bf and .ef Symbols
///
/// For each function definition in the symbol table, three items describe
/// the beginning, ending, and number of lines. Each of these symbols has
/// storage class FUNCTION (101):
///
/// A symbol record named .bf (begin function). The Value field is unused.
///
/// A symbol record named .lf (lines in function). The Value field gives the
/// number of lines in the function.
///
/// A symbol record named .ef (end of function). The Value field has the same
/// number as the Total Size field in the function-definition symbol record.
///
// The .bf and .ef symbol records (but not .lf records) are followed by an
// auxiliary record with the following format:
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
public class Descriptor : BaseEntry
{
/// <summary>
/// Unused
/// </summary>
public uint Unused1 { get; set; }
/// <summary>
/// The actual ordinal line number (1, 2, 3, and so on) within the source file,
/// corresponding to the .bf or .ef record.
/// </summary>
public ushort Linenumber { get; set; }
/// <summary>
/// Unused
/// </summary>
/// <remarks>6 bytes</remarks>
public byte[]? Unused2 { get; set; }
/// <summary>
/// The symbol-table index of the next .bf symbol record. If the function is the
/// last in the symbol table, this field is set to zero. It is not used for
/// .ef records.
/// </summary>
public uint PointerToNextFunction { get; set; }
/// <summary>
/// Unused
/// </summary>
public ushort Unused3 { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
namespace SabreTools.Models.COFF.SymbolTableEntries
{
/// <summary>
/// Auxiliary Format 4: Files
///
/// This format follows a symbol-table record with storage class FILE (103).
/// The symbol name itself should be .file, and the auxiliary record that
/// follows it gives the name of a source-code file.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
public class FileRecord : BaseEntry
{
/// <summary>
/// An ANSI string that gives the name of the source file. This is padded
/// with nulls if it is less than the maximum length.
/// </summary>
/// <remarks>18 bytes</remarks>
public byte[]? FileName { get; set; }
}
}

View File

@@ -0,0 +1,47 @@
namespace SabreTools.Models.COFF.SymbolTableEntries
{
/// <summary>
/// Auxiliary Format 1: Function Definitions
///
/// A symbol table record marks the beginning of a function definition if it
/// has all of the following: a storage class of EXTERNAL (2), a Type value
/// that indicates it is a function (0x20), and a section number that is
/// greater than zero. Note that a symbol table record that has a section
/// number of UNDEFINED (0) does not define the function and does not have
/// an auxiliary record. Function-definition symbol records are followed by
/// an auxiliary record in the format described below:
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
public class FunctionDefinition : BaseEntry
{
/// <summary>
/// The symbol-table index of the corresponding .bf (begin function)
/// symbol record.
/// </summary>
public uint TagIndex { get; set; }
/// <summary>
/// The size of the executable code for the function itself. If the function
/// is in its own section, the SizeOfRawData in the section header is greater
/// or equal to this field, depending on alignment considerations.
/// </summary>
public uint TotalSize { get; set; }
/// <summary>
/// The file offset of the first COFF line-number entry for the function, or
/// zero if none exists.
/// </summary>
public uint PointerToLinenumber { get; set; }
/// <summary>
/// The symbol-table index of the record for the next function. If the function
/// is the last in the symbol table, this field is set to zero.
/// </summary>
public uint PointerToNextFunction { get; set; }
/// <summary>
/// Unused
/// </summary>
public ushort Unused { get; set; }
}
}

View File

@@ -0,0 +1,54 @@
namespace SabreTools.Models.COFF.SymbolTableEntries
{
/// <summary>
/// Auxiliary Format 5: Section Definitions
///
/// This format follows a symbol-table record that defines a section. Such a
/// record has a symbol name that is the name of a section (such as .text or
/// .drectve) and has storage class STATIC (3). The auxiliary record provides
/// information about the section to which it refers. Thus, it duplicates some
/// of the information in the section header.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
public class SectionDefinition : BaseEntry
{
/// <summary>
/// The size of section data; the same as SizeOfRawData in the section header.
/// </summary>
public uint Length { get; set; }
/// <summary>
/// The number of relocation entries for the section.
/// </summary>
public ushort NumberOfRelocations { get; set; }
/// <summary>
/// The number of line-number entries for the section.
/// </summary>
public ushort NumberOfLinenumbers { get; set; }
/// <summary>
/// The checksum for communal data. It is applicable if the IMAGE_SCN_LNK_COMDAT
/// flag is set in the section header.
/// </summary>
public uint CheckSum { get; set; }
/// <summary>
/// One-based index into the section table for the associated section. This is
/// used when the COMDAT selection setting is 5.
/// </summary>
public ushort Number { get; set; }
/// <summary>
/// The COMDAT selection number. This is applicable if the section is a
/// COMDAT section.
/// </summary>
public byte Selection { get; set; }
/// <summary>
/// Unused
/// </summary>
/// <remarks>3 bytes</remarks>
public byte[]? Unused { get; set; }
}
}

View File

@@ -0,0 +1,58 @@
namespace SabreTools.Models.COFF.SymbolTableEntries
{
/// <summary>
/// A standard record defines a symbol or name.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
public class StandardRecord : BaseEntry
{
#region Symbol Name
/// <summary>
/// An array of 8 bytes. This array is padded with nulls on the right if
/// the name is less than 8 bytes long.
/// </summary>
public byte[]? ShortName { get; set; } = new byte[8];
/// <summary>
/// A field that is set to all zeros if the name is longer than 8 bytes.
/// </summary>
public uint Zeroes { get; set; }
/// <summary>
/// An offset into the string table.
/// </summary>
public uint Offset { get; set; }
#endregion
/// <summary>
/// The value that is associated with the symbol. The interpretation of this
/// field depends on SectionNumber and StorageClass. A typical meaning is the
/// relocatable address.
/// </summary>
public uint Value { get; set; }
/// <summary>
/// The signed integer that identifies the section, using a one-based index
/// into the section table. Some values have special meaning.
/// </summary>
public SectionNumber SectionNumber { get; set; }
/// <summary>
/// A number that represents type. Microsoft tools set this field to 0x20
/// (function) or 0x0 (not a function).
/// </summary>
public SymbolType SymbolType { get; set; }
/// <summary>
/// An enumerated value that represents storage class.
/// </summary>
public StorageClass StorageClass { get; set; }
/// <summary>
/// The number of auxiliary symbol table entries that follow this record.
/// </summary>
public byte NumberOfAuxSymbols { get; set; }
}
}

View File

@@ -0,0 +1,45 @@
namespace SabreTools.Models.COFF.SymbolTableEntries
{
/// <summary>
/// Auxiliary Format 3: Weak Externals
///
/// "Weak externals" are a mechanism for object files that allows flexibility at
/// link time. A module can contain an unresolved external symbol (sym1), but it
/// can also include an auxiliary record that indicates that if sym1 is not
/// present at link time, another external symbol (sym2) is used to resolve
/// references instead.
///
/// If a definition of sym1 is linked, then an external reference to the symbol
/// is resolved normally. If a definition of sym1 is not linked, then all references
/// to the weak external for sym1 refer to sym2 instead. The external symbol, sym2,
/// must always be linked; typically, it is defined in the module that contains
/// the weak reference to sym1.
///
/// Weak externals are represented by a symbol table record with EXTERNAL storage
/// class, UNDEF section number, and a value of zero. The weak-external symbol
/// record is followed by an auxiliary record with the following format:
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
public class WeakExternal : BaseEntry
{
/// <summary>
/// The symbol-table index of sym2, the symbol to be linked if sym1 is not found.
/// </summary>
public uint TagIndex { get; set; }
/// <summary>
/// A value of IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY indicates that no library search
/// for sym1 should be performed.
/// A value of IMAGE_WEAK_EXTERN_SEARCH_LIBRARY indicates that a library search for
/// sym1 should be performed.
/// A value of IMAGE_WEAK_EXTERN_SEARCH_ALIAS indicates that sym1 is an alias for sym2.
/// </summary>
public uint Characteristics { get; set; }
/// <summary>
/// Unused
/// </summary>
/// <remarks>10 bytes</remarks>
public byte[]? Unused { get; set; }
}
}

View File

@@ -34,6 +34,18 @@ namespace SabreTools.Models.ClrMamePro
#region Hash Extensions
/// <remarks>md2; Appears after CRC</remarks>
public string? MD2 { get; set; }
/// <remarks>md4; Appears after MD2</remarks>
public string? MD4 { get; set; }
/// <remarks>ripemd128; Appears after MD5</remarks>
public string? RIPEMD128 { get; set; }
/// <remarks>ripemd160; Appears after RIPEMD128</remarks>
public string? RIPEMD160 { get; set; }
/// <remarks>sha256; Also in No-Intro spec; Appears after SHA1</remarks>
public string? SHA256 { get; set; }

View File

@@ -1,58 +0,0 @@
namespace SabreTools.Models.Compression.LZX
{
/// <summary>
/// An aligned offset block is identical to the verbatim block except for the presence of the aligned offset
/// tree preceding the other trees.
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
public class AlignedOffsetBlockData : BlockData
{
/// <summary>
/// Aligned offset tree
/// </summary>
/// <remarks>8 elements, 3 bits each</remarks>
public byte[]? AlignedOffsetTree { get; set; }
/// <summary>
/// Pretree for first 256 elements of main tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
public byte[]? PretreeFirst256 { get; set; }
/// <summary>
/// Path lengths of first 256 elements of main tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
public int[]? PathLengthsFirst256 { get; set; }
/// <summary>
/// Pretree for remainder of main tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
public byte[]? PretreeRemainder { get; set; }
/// <summary>
/// Path lengths of remaining elements of main tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
public int[]? PathLengthsRemainder { get; set; }
/// <summary>
/// Pretree for length tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
public byte[]? PretreeLengthTree { get; set; }
/// <summary>
/// Path lengths of elements in length tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
public int[]? PathLengthsLengthTree { get; set; }
/// <summary>
/// Token sequence (matches and literals)
/// </summary>
/// <remarks>Variable</remarks>
public byte[]? TokenSequence { get; set; }
}
}

View File

@@ -1,24 +0,0 @@
namespace SabreTools.Models.Compression.LZX
{
/// <summary>
/// An LZXD block represents a sequence of compressed data that is encoded with the same set of
/// Huffman trees, or a sequence of uncompressed data. There can be one or more LZXD blocks in a
/// compressed stream, each with its own set of Huffman trees. Blocks do not have to start or end on a
/// chunk boundary; blocks can span multiple chunks, or a single chunk can contain multiple blocks. The
/// number of chunks is related to the size of the data being compressed, while the number of blocks is
/// related to how well the data is compressed.
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
public class Block
{
/// <summary>
/// Block header
/// </summary>
public BlockHeader? Header { get; set; }
/// <summary>
/// Block data
/// </summary>
public BlockData? BlockData { get; set; }
}
}

View File

@@ -1,8 +0,0 @@
namespace SabreTools.Models.Compression.LZX
{
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
public abstract class BlockData
{
// No common fields between all block data
}
}

View File

@@ -1,33 +0,0 @@
namespace SabreTools.Models.Compression.LZX
{
/// <summary>
/// The Block Type field, as specified in section 2.3.1.1, indicates which type of block follows,
/// and the Block Size field, as specified in section 2.3.1.2, indicates the number of
/// uncompressed bytes represented by the block. Following the generic block
/// header is a type-specific header that describes the remainder of the block.
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
public class BlockHeader
{
/// <remarks>3 bits</remarks>
public BlockType BlockType { get; set; }
/// <summary>
/// Block size is the high 8 bits of 24
/// </summary>
/// <remarks>8 bits</remarks>
public byte BlockSizeMSB { get; set; }
/// <summary>
/// Block size is the middle 8 bits of 24
/// </summary>
/// <remarks>8 bits</remarks>
public byte BlockSizeByte2 { get; set; }
/// <summary>
/// Block size is the low 8 bits of 24
/// </summary>
/// <remarks>8 bits</remarks>
public byte BlocksizeLSB { get; set; }
}
}

View File

@@ -1,25 +0,0 @@
namespace SabreTools.Models.Compression.LZX
{
/// <summary>
/// The LZXD compressor emits chunks of compressed data. A chunk represents exactly 32 KB of
/// uncompressed data until the last chunk in the stream, which can represent less than 32 KB. To
/// ensure that an exact number of input bytes represent an exact number of output bytes for each
/// chunk, after each 32 KB of uncompressed data is represented in the output compressed bitstream, the
/// output bitstream is padded with up to 15 bits of zeros to realign the bitstream on a 16-bit boundary
/// (even byte boundary) for the next 32 KB of data. This results in a compressed chunk of a byte-aligned
/// size. The compressed chunk could be smaller than 32 KB or larger than 32 KB if the data is
/// incompressible when the chunk is not the last one.
/// </summary>
public class Chunk
{
/// <summary>
/// Chunk header
/// </summary>
public ChunkHeader? Header { get; set; }
/// <summary>
/// Block headers and data
/// </summary>
public Block[]? Blocks { get; set; }
}
}

View File

@@ -1,46 +0,0 @@
namespace SabreTools.Models.Compression.LZX
{
/// <summary>
/// The LZXD compressor emits chunks of compressed data. A chunk represents exactly 32 KB of
/// uncompressed data until the last chunk in the stream, which can represent less than 32 KB. To
/// ensure that an exact number of input bytes represent an exact number of output bytes for each
/// chunk, after each 32 KB of uncompressed data is represented in the output compressed bitstream, the
/// output bitstream is padded with up to 15 bits of zeros to realign the bitstream on a 16-bit boundary
/// (even byte boundary) for the next 32 KB of data. This results in a compressed chunk of a byte-aligned
/// size. The compressed chunk could be smaller than 32 KB or larger than 32 KB if the data is
/// incompressible when the chunk is not the last one.
/// </summary>
public class ChunkHeader
{
/// <summary>
/// The LZXD engine encodes a compressed, chunk-size prefix field preceding each compressed chunk in
/// the compressed byte stream. The compressed, chunk-size prefix field is a byte aligned, little-endian,
/// 16-bit field. The chunk prefix chain could be followed in the compressed stream without
/// decompressing any data. The next chunk prefix is at a location computed by the absolute byte offset
/// location of this chunk prefix plus 2 (for the size of the chunk-size prefix field) plus the current chunk
/// size.
/// </summary>
public ushort ChunkSize { get; set; }
/// <summary>
/// The first bit in the first chunk in the LZXD bitstream (following the 2-byte, chunk-size prefix described
/// in section 2.2.1) indicates the presence or absence of two 16-bit fields immediately following the
/// single bit. If the bit is set, E8 translation is enabled for all the following chunks in the stream using the
/// 32-bit value derived from the two 16-bit fields as the E8_file_size provided to the compressor when E8
/// translation was enabled. Note that E8_file_size is completely independent of the length of the
/// uncompressed data. E8 call translation is disabled after the 32,768th chunk (after 1 gigabyte (GB) of
/// uncompressed data).
/// </summary>
public byte E8Translation { get; set; }
/// <summary>
/// E8 translation size, high WORD
/// </summary>
public ushort? TranslationSizeHighWord { get; set; }
/// <summary>
/// E8 translation size, low WORD
/// </summary>
public ushort? TranslationSizeLowWord { get; set; }
}
}

View File

@@ -1,38 +0,0 @@
namespace SabreTools.Models.Compression.LZX
{
public static class Constants
{
/* some constants defined by the LZX specification */
public const int LZX_MIN_MATCH = 2;
public const int LZX_MAX_MATCH = 257;
public const int LZX_NUM_CHARS = 256;
public const int LZX_PRETREE_NUM_ELEMENTS = 20;
/// <summary>
/// aligned offset tree #elements
/// </summary>
public const int LZX_ALIGNED_NUM_ELEMENTS = 8;
/// <summary>
/// this one missing from spec!
/// </summary>
public const int LZX_NUM_PRIMARY_LENGTHS = 7;
/// <summary>
/// length tree #elements
/// </summary>
public const int LZX_NUM_SECONDARY_LENGTHS = 249;
/* LZX huffman defines: tweak tablebits as desired */
public const int LZX_PRETREE_MAXSYMBOLS = LZX_PRETREE_NUM_ELEMENTS;
public const int LZX_PRETREE_TABLEBITS = 6;
public const int LZX_MAINTREE_MAXSYMBOLS = LZX_NUM_CHARS + 50 * 8;
public const int LZX_MAINTREE_TABLEBITS = 12;
public const int LZX_LENGTH_MAXSYMBOLS = LZX_NUM_SECONDARY_LENGTHS + 1;
public const int LZX_LENGTH_TABLEBITS = 12;
public const int LZX_ALIGNED_MAXSYMBOLS = LZX_ALIGNED_NUM_ELEMENTS;
public const int LZX_ALIGNED_TABLEBITS = 7;
public const int LZX_LENTABLE_SAFETY = 64; /* we allow length table decoding overruns */
}
}

View File

@@ -1,48 +0,0 @@
namespace SabreTools.Models.Compression.LZX
{
/// <summary>
/// 3-bit block type
/// </summary>
public enum BlockType : byte
{
/// <summary>
/// Not valid
/// </summary>
INVALID_0 = 0b000,
/// <summary>
/// Verbatim block
/// </summary>
Verbatim = 0b001,
/// <summary>
/// Aligned offset block
/// </summary>
AlignedOffset = 0b010,
/// <summary>
/// Uncompressed block
/// </summary>
Uncompressed = 0b011,
/// <summary>
/// Not valid
/// </summary>
INVALID_4 = 0b100,
/// <summary>
/// Not valid
/// </summary>
INVALID_5 = 0b101,
/// <summary>
/// Not valid
/// </summary>
INVALID_6 = 0b110,
/// <summary>
/// Not valid
/// </summary>
INVALID_7 = 0b111,
}
}

View File

@@ -1,54 +0,0 @@
namespace SabreTools.Models.Compression.LZX
{
/// <summary>
/// Following the generic block header, an uncompressed block begins with 1 to 16 bits of zero padding
/// to align the bit buffer on a 16-bit boundary. At this point, the bitstream ends and a byte stream
/// begins. Following the zero padding, new 32-bit values for R0, R1, and R2 are output in little-endian
/// form, followed by the uncompressed data bytes themselves. Finally, if the uncompressed data length
/// is odd, one extra byte of zero padding is encoded to realign the following bitstream.
///
/// Then the bitstream of byte-swapped 16-bit integers resumes for the next Block Type field (if there
/// are subsequent blocks).
///
/// The decoded R0, R1, and R2 values are used as initial repeated offset values to decode the
/// subsequent compressed block if present.
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
public class UncompressedBlockData : BlockData
{
/// <summary>
/// Padding to align following field on 16-bit boundary
/// </summary>
/// <remarks>Bits have a value of zero</remarks>
public ushort PaddingBits { get; set; }
/// <summary>
/// Least significant to most significant byte (little-endian DWORD ([MS-DTYP]))
/// </summary>
/// <remarks>Encoded directly in the byte stream, not in the bitstream of byte-swapped 16-bit words</remarks>
public uint R0 { get; set; }
/// <summary>
/// Least significant to most significant byte (little-endian DWORD)
/// </summary>
/// <remarks>Encoded directly in the byte stream, not in the bitstream of byte-swapped 16-bit words</remarks>
public uint R1 { get; set; }
/// <summary>
/// Least significant to most significant byte (little-endian DWORD)
/// </summary>
/// <remarks>Encoded directly in the byte stream, not in the bitstream of byte-swapped 16-bit words</remarks>
public uint R2 { get; set; }
/// <summary>
/// Can use the direct memcpy function, as specified in [IEEE1003.1]
/// </summary>
/// <remarks>Encoded directly in the byte stream, not in the bitstream of byte-swapped 16-bit words</remarks>
public byte[]? RawDataBytes { get; set; }
/// <summary>
/// Only if uncompressed size is odd
/// </summary>
public byte AlignmentByte { get; set; }
}
}

View File

@@ -1,51 +0,0 @@
namespace SabreTools.Models.Compression.LZX
{
/// <summary>
/// The fields of a verbatim block that follow the generic block header
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
public class VerbatimBlockData : BlockData
{
/// <summary>
/// Pretree for first 256 elements of main tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
public byte[]? PretreeFirst256 { get; set; }
/// <summary>
/// Path lengths of first 256 elements of main tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
public int[]? PathLengthsFirst256 { get; set; }
/// <summary>
/// Pretree for remainder of main tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
public byte[]? PretreeRemainder { get; set; }
/// <summary>
/// Path lengths of remaining elements of main tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
public int[]? PathLengthsRemainder { get; set; }
/// <summary>
/// Pretree for length tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
public byte[]? PretreeLengthTree { get; set; }
/// <summary>
/// Path lengths of elements in length tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
public int[]? PathLengthsLengthTree { get; set; }
/// <summary>
/// Token sequence (matches and literals)
/// </summary>
/// <remarks>Variable</remarks>
public byte[]? TokenSequence { get; set; }
}
}

View File

@@ -1,28 +0,0 @@
namespace SabreTools.Models.Compression.MSZIP
{
/// <summary>
/// Each MSZIP block MUST consist of a 2-byte MSZIP signature and one or more RFC 1951 blocks. The
/// 2-byte MSZIP signature MUST consist of the bytes 0x43 and 0x4B. The MSZIP signature MUST be
/// the first 2 bytes in the MSZIP block. The MSZIP signature is shown in the following packet diagram.
///
/// Each MSZIP block is the result of a single deflate compression operation, as defined in [RFC1951].
/// The compressor that performs the compression operation MUST generate one or more RFC 1951
/// blocks, as defined in [RFC1951]. The number, deflation mode, and type of RFC 1951 blocks in each
/// MSZIP block is determined by the compressor, as defined in [RFC1951]. The last RFC 1951 block in
/// each MSZIP block MUST be marked as the "end" of the stream(1), as defined by [RFC1951]
/// section 3.2.3. Decoding trees MUST be discarded after each RFC 1951 block, but the history buffer
/// MUST be maintained.Each MSZIP block MUST represent no more than 32 KB of uncompressed data.
///
/// The maximum compressed size of each MSZIP block is 32 KB + 12 bytes. This enables the MSZIP
/// block to contain 32 KB of data split between two noncompressed RFC 1951 blocks, each of which
/// has a value of BTYPE = 00.
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-MCI/%5bMS-MCI%5d.pdf"/>
public class BlockHeader
{
/// <summary>
/// 'CK'
/// </summary>
public ushort Signature { get; set; }
}
}

View File

@@ -1,50 +0,0 @@
namespace SabreTools.Models.Compression.Quantum
{
/// <see href="www.russotto.net/quantumcomp.html"/>
public static class Constants
{
public static readonly int[] PositionSlot =
[
0x00000, 0x00001, 0x00002, 0x00003, 0x00004, 0x00006, 0x00008, 0x0000c,
0x00010, 0x00018, 0x00020, 0x00030, 0x00040, 0x00060, 0x00080, 0x000c0,
0x00100, 0x00180, 0x00200, 0x00300, 0x00400, 0x00600, 0x00800, 0x00c00,
0x01000, 0x01800, 0x02000, 0x03000, 0x04000, 0x06000, 0x08000, 0x0c000,
0x10000, 0x18000, 0x20000, 0x30000, 0x40000, 0x60000, 0x80000, 0xc0000,
0x100000, 0x180000
];
public static readonly int[] PositionExtraBits =
[
0, 0, 0, 0, 1, 1, 2, 2,
3, 3, 4, 4, 5, 5, 6, 6,
7, 7, 8, 8, 9, 9, 10, 10,
11, 11, 12, 12, 13, 13, 14, 14,
15, 15, 16, 16, 17, 17, 18, 18,
19, 19
];
public static readonly int[] LengthSlot =
[
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x08,
0x0a, 0x0c, 0x0e, 0x12, 0x16, 0x1a, 0x1e, 0x26,
0x2e, 0x36, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, 0x9e,
0xbe, 0xde, 0xfe
];
public static readonly int[] LengthExtraBits =
[
0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 2, 2, 2, 2, 3, 3,
3, 3, 4, 4, 4, 4, 5, 5,
5, 5, 0
];
/// <summary>
/// Number of position slots for (tsize - 10)
/// </summary>
public static readonly int[] NumPositionSlots =
[
20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42
];
}
}

View File

@@ -1,45 +0,0 @@
namespace SabreTools.Models.Compression.Quantum
{
public enum SelectorModel
{
/// <summary>
/// Literal model, 64 entries, start at symbol 0
/// </summary>
SELECTOR_0 = 0,
/// <summary>
/// Literal model, 64 entries, start at symbol 64
/// </summary>
SELECTOR_1 = 1,
/// <summary>
/// Literal model, 64 entries, start at symbol 128
/// </summary>
SELECTOR_2 = 2,
/// <summary>
/// Literal model, 64 entries, start at symbol 192
/// </summary>
SELECTOR_3 = 3,
/// <summary>
/// LZ model, 3 character matches, max 24 entries, start at symbol 0
/// </summary>
SELECTOR_4 = 4,
/// <summary>
/// LZ model, 4 character matches, max 36 entries, start at symbol 0
/// </summary>
SELECTOR_5 = 5,
/// <summary>
/// LZ model, 5+ character matches, max 42 entries, start at symbol 0
/// </summary>
SELECTOR_6_POSITION = 6,
/// <summary>
/// LZ model, 5+ character matches, 27 entries, start at symbol 0
/// </summary>
SELECTOR_6_LENGTH = 7,
}
}

View File

@@ -1,24 +0,0 @@
namespace SabreTools.Models.Compression.Quantum
{
/// <see href="http://www.russotto.net/quantumcomp.html"/>
public sealed class Model
{
public int Entries { get; set; }
/// <remarks>
/// All the models are initialized with the symbols in symbol
/// order in the table, and with every symbol in the table
/// having a frequency of 1
/// </remarks>
public ModelSymbol[]? Symbols { get; set; }
/// <remarks>
/// The initial total frequency is equal to the number of entries
/// in the table
/// </remarks>
public int TotalFrequency { get; set; }
/// <remarks>The initial time_to_reorder value is 4</remarks>
public int TimeToReorder { get; set; }
}
}

View File

@@ -1,15 +0,0 @@
namespace SabreTools.Models.Compression.Quantum
{
/// <see href="http://www.russotto.net/quantumcomp.html"/>
public sealed class ModelSymbol
{
public ushort Symbol { get; set; }
/// <summary>
/// The cumulative frequency is the frequency of all the symbols
/// which are at a higher index in the table than that symbol —
/// thus the last entry in the table has a cumulative frequency of 0.
/// </summary>
public ushort CumulativeFrequency { get; set; }
}
}

View File

@@ -6,13 +6,13 @@ namespace SabreTools.Models.GZIP
/// <summary>
/// Header including optional fields
/// </summary>
public Header? Header;
public Header? Header { get; set; }
// Compressed blocks live here
/// <summary>
/// Trailer
/// </summary>
public Trailer? Trailer;
public Trailer? Trailer { get; set; }
}
}

View File

@@ -7,20 +7,20 @@ namespace SabreTools.Models.GZIP
/// SI1 and SI2 provide a subfield ID, typically two ASCII letters
/// with some mnemonic value.
/// </summary>
public byte SI1;
public byte SubfieldID1 { get; set; }
/// <summary>
/// SI1 and SI2 provide a subfield ID, typically two ASCII letters
/// with some mnemonic value.
/// </summary>
public byte SI2;
public byte SubfieldID2 { get; set; }
/// <summary>
/// LEN gives the length of the subfield data, excluding the 4
/// initial bytes.
/// </summary>
public ushort LEN;
public ushort Length { get; set; }
public byte[]? Data;
public byte[]? Data { get; set; }
}
}

View File

@@ -6,22 +6,22 @@ namespace SabreTools.Models.GZIP
/// <summary>
/// IDentification 1 (0x1F)
/// </summary>
public byte ID1;
public byte ID1 { get; set; }
/// <summary>
/// IDentification 2 (0x8B)
/// </summary>
public byte ID2;
public byte ID2 { get; set; }
/// <summary>
/// Compression Method
/// </summary>
public CompressionMethod CM;
public CompressionMethod CompressionMethod { get; set; }
/// <summary>
/// FLaGs
/// </summary>
public Flags FLG;
public Flags Flags { get; set; }
/// <summary>
/// Modification TIME
@@ -35,12 +35,12 @@ namespace SabreTools.Models.GZIP
/// compression started. MTIME = 0 means no time stamp is
/// available.
/// </summary>
public uint MTIME;
public uint LastModifiedTime { get; set; }
/// <summary>
/// eXtra FLags
/// </summary>
public ExtraFlags XFL;
public ExtraFlags ExtraFlags { get; set; }
/// <summary>
/// Operating System
@@ -49,7 +49,7 @@ namespace SabreTools.Models.GZIP
/// took place. This may be useful in determining end-of-line
/// convention for text files.
/// </summary>
public OperatingSystem OS;
public OperatingSystem OperatingSystem { get; set; }
/// <summary>
/// eXtra LENgth
@@ -57,7 +57,7 @@ namespace SabreTools.Models.GZIP
/// If FLG.FEXTRA is set, this gives the length of the optional
/// extra field.
/// </summary>
public ushort XLEN;
public ushort ExtraLength { get; set; }
/// <summary>
/// Extra field
@@ -66,23 +66,23 @@ namespace SabreTools.Models.GZIP
/// the header, with total length XLEN bytes. It consists of a
/// series of subfields, each of the form <see cref="ExtraFieldData"/>.
/// </summary>
public ExtraFieldData[]? ExtraField;
public ExtraFieldData[]? ExtraField { get; set; }
/// <summary>
/// Original filename before compression, zero-terminated
/// Original filename before compression, null-terminated
/// </summary>
public string? OriginalFileName;
public string? OriginalFileName { get; set; }
/// <summary>
/// File comment, zero terminated
/// File comment, null terminated
/// </summary>
public string? FileComment;
public string? FileComment { get; set; }
/// <summary>
/// The CRC16 consists of the two least significant bytes of the
/// CRC32 for all bytes of the gzip header up to and not including
/// the CRC16.
/// </summary>
public ushort? CRC16;
public ushort? CRC16 { get; set; }
}
}

View File

@@ -13,7 +13,7 @@ namespace SabreTools.Models.GZIP
/// ordering ISO documents. See gopher://info.itu.ch for an
/// online version of ITU-T V.42.)
/// </summary>
public uint CRC32;
public uint CRC32 { get; set; }
/// <summary>
/// Input SIZE
@@ -21,6 +21,6 @@ namespace SabreTools.Models.GZIP
/// This contains the size of the original (uncompressed) input
/// data modulo 2^32.
/// </summary>
public uint ISIZE;
public uint InputSize { get; set; }
}
}

View File

@@ -11,6 +11,10 @@ namespace SabreTools.Models.Hashfile
public MD5[]? MD5 { get; set; }
public RIPEMD128[]? RIPEMD128 { get; set; }
public RIPEMD160[]? RIPEMD160 { get; set; }
public SHA1[]? SHA1 { get; set; }
public SHA256[]? SHA256 { get; set; }

View File

@@ -0,0 +1,14 @@
namespace SabreTools.Models.Hashfile
{
/// <summary>
/// RIPEMD128 File
/// </summary>
public class RIPEMD128
{
[Required]
public string? Hash { get; set; }
[Required]
public string? File { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
namespace SabreTools.Models.Hashfile
{
/// <summary>
/// RIPEMD160 File
/// </summary>
public class RIPEMD160
{
[Required]
public string? Hash { get; set; }
[Required]
public string? File { get; set; }
}
}

View File

@@ -3,5 +3,7 @@ namespace SabreTools.Models.InstallShieldArchiveV3
public static class Constants
{
public const uint HeaderSignature = 0x8C655D13;
public static readonly byte[] HeaderSignatureBytes = [0x13, 0x5D, 0x65, 0x8C];
}
}

View File

@@ -0,0 +1,9 @@
namespace SabreTools.Models.LDSCRYPT
{
public static class Constants
{
public static readonly byte[] SignatureBytes = [0x4C, 0x44, 0x53, 0x43, 0x52, 0x59, 0x50, 0x54];
public const string SignatureString = "LDSCRYPT";
}
}

View File

@@ -0,0 +1,10 @@
namespace SabreTools.Models.LDSCRYPT
{
/// <summary>
/// This is a placeholder model for future work
/// </summary>
public class EncryptedFile
{
}
}

View File

@@ -0,0 +1,16 @@
using System.Xml;
using System.Xml.Serialization;
namespace SabreTools.Models.Listxml
{
[XmlRoot("mess")]
public class Mess
{
[XmlAttribute("version")]
public string? Version { get; set; }
[XmlElement("machine", typeof(Machine))]
[XmlElement("game", typeof(Game))]
public GameBase[]? Game { get; set; }
}
}

View File

@@ -10,6 +10,9 @@ namespace SabreTools.Models.Logiqx
[XmlAttribute("name")]
public string? Name { get; set; }
[XmlElement("dir", typeof(Dir))]
public Dir[]? Subdir { get; set; }
[XmlElement("game", typeof(Game))]
[XmlElement("machine", typeof(Machine))]
public GameBase[]? Game { get; set; }

View File

@@ -111,5 +111,13 @@ namespace SabreTools.Models.Logiqx
/// <remarks>MAME extension</remarks>
[XmlElement("softwarelist")]
public SoftwareList[]? SoftwareList { get; set; }
/// <remarks>RetroAchievements extension</remarks>
[XmlAttribute("url")]
public string? Url { get; set; }
/// <remarks>RetroAchievements extension</remarks>
[XmlAttribute("hash")]
public string? Hash { get; set; }
}
}

View File

@@ -17,9 +17,25 @@ namespace SabreTools.Models.Logiqx
[XmlAttribute("crc")]
public string? CRC { get; set; }
/// <remarks>Hash extension</remarks>
[XmlAttribute("md2")]
public string? MD2 { get; set; }
/// <remarks>Hash extension</remarks>
[XmlAttribute("md4")]
public string? MD4 { get; set; }
[XmlAttribute("md5")]
public string? MD5 { get; set; }
/// <remarks>Hash extension</remarks>
[XmlAttribute("ripemd128")]
public string? RIPEMD128 { get; set; }
/// <remarks>Hash extension</remarks>
[XmlAttribute("ripemd160")]
public string? RIPEMD160 { get; set; }
[XmlAttribute("sha1")]
public string? SHA1 { get; set; }

View File

@@ -100,7 +100,7 @@ namespace SabreTools.Models.Metadata
string[]? asArray = Read<string[]>(key);
if (asArray != null)
#if NETFRAMEWORK
#if NETFRAMEWORK || NETSTANDARD2_0
return string.Join(",", asArray);
#else
return string.Join(',', asArray);

View File

@@ -113,6 +113,9 @@ namespace SabreTools.Models.Metadata
/// <remarks>string</remarks>
public const string GenMSXIDKey = "genmsxid";
/// <remarks>string</remarks>
public const string HashKey = "hash";
/// <remarks>string</remarks>
public const string HistoryKey = "history";
@@ -260,6 +263,9 @@ namespace SabreTools.Models.Metadata
[NoFilter]
public const string TruripKey = "trurip";
/// <remarks>string</remarks>
public const string UrlKey = "url";
/// <remarks>Video[]</remarks>
[NoFilter]
public const string VideoKey = "video";

View File

@@ -182,6 +182,12 @@ namespace SabreTools.Models.Metadata
/// <remarks>string; OpenMSX.RomBase</remarks>
public const string RemarkKey = "remark";
/// <remarks>string</remarks>
public const string RIPEMD128Key = "ripemd128";
/// <remarks>string</remarks>
public const string RIPEMD160Key = "ripemd160";
/// <remarks>string, possibly long; ArchiveDotOrg.File</remarks>
public const string RotationKey = "rotation";

View File

@@ -128,7 +128,7 @@
/// <summary>
/// Compressed size of the BET block
/// </summary>
public ulong BetTablesize { get; set; }
public ulong BetTableSize { get; set; }
/// <summary>
/// Size of raw data chunk to calculate MD5.

View File

@@ -68,8 +68,6 @@ namespace SabreTools.Models.MoPaQ
#region Encryption
public const uint MPQ_HASH_KEY2_MIX = 0x400;
/// <summary>
/// Obtained by HashString("(block table)", MPQ_HASH_FILE_KEY)
/// </summary>
@@ -80,8 +78,6 @@ namespace SabreTools.Models.MoPaQ
/// </summary>
public const uint MPQ_KEY_HASH_TABLE = 0xC3AF3770;
public const uint STORM_BUFFER_SIZE = 0x500;
#endregion
}
}

View File

@@ -18,7 +18,7 @@
/// entry points within this bundle by their ordinal number. The following
/// describes the format of the entry table bundles.
/// </remarks>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
public sealed class EntryTableBundle
{
/// <summary>

View File

@@ -148,6 +148,7 @@ namespace SabreTools.Models.NewExecutable
public enum OperatingSystem : byte
{
Unknown = 0x00,
OS2 = 0x01,
WINDOWS = 0x02,
EU_MSDOS4 = 0x03,

View File

@@ -10,7 +10,8 @@ namespace SabreTools.Models.NewExecutable
/// internal data used by the loader to manage the loaded executable
/// modules in the system and to support dynamic linking.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://wiki.osdev.org/NE"/>
public sealed class Executable
{
/// <summary>
@@ -57,5 +58,10 @@ namespace SabreTools.Models.NewExecutable
/// Nonresident-Name table
/// </summary>
public NonResidentNameTableEntry[]? NonResidentNameTable { get; set; }
/// <summary>
/// Segment relocation data
/// </summary>
public PerSegmentData[]? SegmentRelocationData { get; set; }
}
}

View File

@@ -6,15 +6,14 @@ namespace SabreTools.Models.NewExecutable
/// The NE header is a relatively large structure with multiple characteristics.
/// Because of the age of the format some items are unclear in meaning.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://github.com/libyal/libexe/blob/main/documentation/Executable%20(EXE)%20file%20format.asciidoc#24-ne-extended-header"/>
/// <see href="https://wiki.osdev.org/NE"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class ExecutableHeader
{
/// <summary>
/// Signature word.
/// "N" is low-order byte.
/// "E" is high-order byte.
/// "NE"
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)]
public string? Magic;
@@ -22,20 +21,22 @@ namespace SabreTools.Models.NewExecutable
/// <summary>
/// Version number of the linker.
/// </summary>
/// <remarks>Also known as the major linker version</remarks>
public byte LinkerVersion;
/// <summary>
/// Revision number of the linker.
/// </summary>
/// <remarks>Also known as the minor linker version</remarks>
public byte LinkerRevision;
/// <summary>
/// Entry Table file offset, relative to the beginning of the segmented EXE header.
/// </summary>
public ushort EntryTableOffset;
/// <summary>
/// Number of bytes in the entry table.
/// Length of entry table in bytes
/// </summary>
public ushort EntryTableSize;
@@ -81,12 +82,15 @@ namespace SabreTools.Models.NewExecutable
/// <summary>
/// Segment number:offset of CS:IP.
/// </summary>
/// <remarks>CS:IP entry point, CS is index into segment table</remarks>
public uint InitialCSIPSetting;
/// <summary>
/// Segment number:offset of SS:SP.
/// </summary>
/// <remarks>
/// SS:SP initial stack pointer, SS is index into segment table
///
/// If SS equals the automatic data segment and SP equals
/// zero, the stack pointer is set to the top of the
/// automatic data segment just below the additional heap
@@ -105,7 +109,7 @@ namespace SabreTools.Models.NewExecutable
public ushort ModuleReferenceTableSize;
/// <summary>
/// Number of bytes in the Non-Resident Name Table.
/// Size of non-resident names table in bytes
/// </summary>
public ushort NonResidentNameTableSize;
@@ -166,18 +170,20 @@ namespace SabreTools.Models.NewExecutable
/// </summary>
[MarshalAs(UnmanagedType.U1)]
public OperatingSystem TargetOperatingSystem;
#region OS/2 Specific
/// <summary>
/// Other OS/2 flags
/// </summary>
[MarshalAs(UnmanagedType.U1)]
public OS2Flag AdditionalFlags;
/// <summary>
/// Offset to return thunks or start of gangload area
/// </summary>
public ushort ReturnThunkOffset;
/// <summary>
/// Offset to segment reference thunks or size of gangload area
/// </summary>
@@ -187,15 +193,17 @@ namespace SabreTools.Models.NewExecutable
/// Minimum code swap area size
/// </summary>
public ushort MinCodeSwapAreaSize;
/// <summary>
/// Windows SDK revison number
/// </summary>
public byte WindowsSDKRevision;
/// <summary>
/// Windows SDK version number
/// </summary>
public byte WindowsSDKVersion;
#endregion
}
}

View File

@@ -2,7 +2,7 @@
namespace SabreTools.Models.NewExecutable
{
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ImportNameRelocationRecord
{

View File

@@ -2,7 +2,7 @@
namespace SabreTools.Models.NewExecutable
{
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ImportOrdinalRelocationRecord
{

View File

@@ -8,7 +8,7 @@
/// characters. The strings are not null-terminated and are case
/// sensitive.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
public sealed class ImportedNameTableEntry
{
/// <summary>

View File

@@ -2,7 +2,7 @@
namespace SabreTools.Models.NewExecutable
{
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class InternalRefRelocationRecord
{
@@ -13,7 +13,7 @@ namespace SabreTools.Models.NewExecutable
public byte SegmentNumber;
/// <summary>
/// 0
/// Always 0
/// </summary>
public byte Reserved;

View File

@@ -7,7 +7,7 @@ namespace SabreTools.Models.NewExecutable
/// contains an offset for the module-name string within the imported-
/// names table; each entry is 2 bytes long.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ModuleReferenceTableEntry
{

View File

@@ -8,7 +8,7 @@
/// strings follow the same format as those defined in the resident name
/// table.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
public sealed class NonResidentNameTableEntry
{
/// <summary>

View File

@@ -2,7 +2,7 @@
namespace SabreTools.Models.NewExecutable
{
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class OSFixupRelocationRecord
{

View File

@@ -7,7 +7,14 @@
/// follow the segment data in the file. The relocation fixup information
/// is defined as follows:
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <remarks>
/// To find the relocation data for a segment, seek to:
/// <see cref="SegmentTableEntry.Offset"/>
/// * (1 << <see cref="ExecutableHeader.SegmentAlignmentShiftCount"/>)
/// + <see cref="SegmentTableEntry.Length"/>
/// </remarks>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://wiki.osdev.org/NE"/>
public sealed class PerSegmentData
{
/// <summary>

View File

@@ -4,7 +4,7 @@
/// A table of relocation records follows. The following is the format
/// of each relocation record.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
public sealed class RelocationRecord
{
/// <summary>
@@ -33,25 +33,25 @@
/// <summary>
/// INTERNALREF
/// </summary>
/// <remarks>Must be <c>NULL</c> if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.INTERNALREF"/></remarks>
/// <remarks>Must be null if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.INTERNALREF"/></remarks>
public InternalRefRelocationRecord? InternalRefRelocationRecord { get; set; }
/// <summary>
/// IMPORTNAME
/// </summary>
/// <remarks>Must be <c>NULL</c> if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.IMPORTNAME"/></remarks>
/// <remarks>Must be null if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.IMPORTNAME"/></remarks>
public ImportNameRelocationRecord? ImportNameRelocationRecord { get; set; }
/// <summary>
/// IMPORTORDINAL
/// </summary>
/// <remarks>Must be <c>NULL</c> if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.IMPORTORDINAL"/></remarks>
/// <remarks>Must be null if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.IMPORTORDINAL"/></remarks>
public ImportOrdinalRelocationRecord? ImportOrdinalRelocationRecord { get; set; }
/// <summary>
/// IMPORTORDINAL
/// </summary>
/// <remarks>Must be <c>NULL</c> if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.OSFIXUP"/></remarks>
/// <remarks>Must be null if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.OSFIXUP"/></remarks>
public OSFixupRelocationRecord? OSFixupRelocationRecord { get; set; }
}
}

View File

@@ -7,7 +7,7 @@
/// are case-sensitive and are not null-terminated. The following
/// describes the format of the name strings:
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
public sealed class ResidentNameTableEntry
{
/// <summary>

View File

@@ -12,7 +12,7 @@ namespace SabreTools.Models.NewExecutable
/// resource. It also defines the location and size of the resource. The
/// following describes the contents of each of these structures:
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
public sealed class ResourceTable
{
/// <summary>

View File

@@ -5,7 +5,7 @@
/// resource table. Note that these strings are NOT null terminated and
/// are case sensitive.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
public sealed class ResourceTypeAndNameString
{
/// <summary>

View File

@@ -4,7 +4,7 @@
/// A table of resource type information blocks follows. The following
/// is the format of each type information block:
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
public sealed class ResourceTypeInformationEntry
{
/// <summary>

View File

@@ -6,7 +6,8 @@ namespace SabreTools.Models.NewExecutable
/// A table of resources for this type follows. The following is
/// the format of each resource (8 bytes each):
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://wiki.osdev.org/NE"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class ResourceTypeResourceEntry
{
@@ -16,11 +17,13 @@ namespace SabreTools.Models.NewExecutable
/// of the alignment shift count value specified at
/// beginning of the resource table.
/// </summary>
/// <remarks>Byte offset is: Offset * (1 << <see cref="ResourceTable.AlignmentShiftCount"/>)</remarks>
public ushort Offset;
/// <summary>
/// Length of the resource in the file (in bytes).
/// </summary>
/// <remarks>Byte length is: Length * (1 << <see cref="ResourceTable.AlignmentShiftCount"/>)</remarks>
public ushort Length;
/// <summary>

View File

@@ -8,7 +8,8 @@ namespace SabreTools.Models.NewExecutable
/// EXE header. The first entry in the segment table is segment number 1.
/// The following is the structure of a segment table entry.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://web.archive.org/web/20240422070115/http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
/// <see href="https://wiki.osdev.org/NE"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class SegmentTableEntry
{
@@ -17,12 +18,13 @@ namespace SabreTools.Models.NewExecutable
/// data, relative to the beginning of the file. Zero means no
/// file data.
/// </summary>
public ushort Offset;
/// <remarks>Byte offset is: Offset * (1 << <see cref="ExecutableHeader.SegmentAlignmentShiftCount"/>)</remarks>
public ushort Offset { get; set; }
/// <summary>
/// Length of the segment in the file, in bytes. Zero means 64K.
/// </summary>
public ushort Length;
public ushort Length { get; set; }
/// <summary>
/// Flag word.
@@ -34,6 +36,25 @@ namespace SabreTools.Models.NewExecutable
/// Minimum allocation size of the segment, in bytes. Total size
/// of the segment. Zero means 64K.
/// </summary>
public ushort MinimumAllocationSize;
public ushort MinimumAllocationSize { get; set; }
/// <summary>
/// Segment data
/// </summary>
/// <remarks>
/// Data is not sequential to the entry header. It lives at
/// the <see cref="Offset"/> and has a size of <see cref="Length"/>
/// </remarks>
public byte[]? Data { get; set; }
/// <summary>
/// Per-segment data
/// </summary>
/// <remarks>
/// This only exists if <see cref="FlagWord"/> has a flag value
/// of <see cref="SegmentTableEntryFlag.RELOCINFO"/>. It immediately
/// follows <see cref="Data"/>.
/// </remarks>
public PerSegmentData? PerSegmentData { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The ArrayDimension packet represents the size and index offset of a dimension of an array
/// property type.
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class ArrayDimension
{
/// <summary>
/// An unsigned integer representing the size of the dimension.
/// </summary>
public uint Size { get; set; }
/// <summary>
/// A signed integer representing the index offset of the dimension. For
/// example, an array dimension that is to be accessed with a 0-based index would have the value
/// zero, whereas an array dimension that is to be accessed with a 1-based index would have the
/// value 0x00000001.
/// </summary>
public int Value { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The ArrayHeader packet represents the type and dimensions of an array property type.
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class ArrayHeader
{
/// <summary>
/// MUST be set to the value obtained by clearing the VT_ARRAY (0x2000) bit of
/// this array property's PropertyType value.
/// </summary>
public PropertyType Type { get; set; }
/// <summary>
/// An unsigned integer representing the number of dimensions in the array
/// property. MUST be at least 1 and at most 31.
/// </summary>
public uint NumDimensions { get; set; }
/// <summary>
/// MUST be a sequence of ArrayDimension packets
///
/// The number of scalar values in an array property can be calculated from the ArrayHeader packet
/// as the product of the Size fields of each of the ArrayDimension packets.
/// </summary>
public ArrayDimension[]? Dimensions { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The BLOB packet represents binary data
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class BLOB
{
/// <summary>
/// The size in bytes of the <see cref="Bytes"> field, not including padding (if any)
/// </summary>
public uint Size { get; set; }
/// <summary>
/// MUST be an array of bytes, followed by zero padding to a multiple of 4 bytes.
/// </summary>
public byte[]? Bytes { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The CURRENCY (Packet Version) packet represents a CURRENCY as specified in [MS-OAUT]
/// section 2.2.24.
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class CURRENCY
{
/// <summary>
/// The value of the int64 field specified in [MS-OAUT] section 2.2.24.
/// </summary>
public ulong Value { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The ClipboardData packet represents clipboard data
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class ClipboardData
{
/// <summary>
/// The total size in bytes of the <see cref="Format"> and <see cref="Data"> fields,
/// not including padding (if any).
/// </summary>
public uint Size { get; set; }
/// <summary>
/// An application-specific identifier for the format of the data in the
/// <see cref="Data"> field.
/// </summary>
public uint Format { get; set; }
/// <summary>
/// MUST be an array of bytes, followed by zero padding to a multiple of 4 bytes
/// </summary>
public byte[]? Data { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The CodePageString packet represents a string whose encoding depends on the
/// value of the property set's CodePage property.
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class CodePageString
{
/// <summary>
/// The size in bytes of the <see cref="Characters"/> field, including the null terminator,
/// but not including padding (if any). If the property set's CodePage property
/// has the value CP_WINUNICODE (0x04B0), then the value MUST be a multiple of 2
/// </summary>
public uint Size { get; set; }
/// <summary>
/// If <see cref="Size"/> is zero, this field MUST be zero bytes in length. If <see cref="Size"/>
/// is nonzero and the CodePage property set's CodePage property has the value CP_WINUNICODE (0x04B0),
/// then the value MUST be a null-terminated array of 16-bit Unicode characters, followed by zero
/// padding to a multiple of 4 bytes. If <see cref="Size"/> is nonzero and the property set's CodePage
/// property has any other value, it MUST be a null-terminated array of 8-bit characters from the code
/// page identified by the CodePage property, followed by zero padding to a multiple of 4 bytes. The
/// string represented by this field MAY contain embedded or additional trailing null characters and
/// an OLEPS implementation MUST be able to handle such strings. However, the manner in which
/// strings with embedded or additional trailing null characters are presented by the implementation
/// to an application is implementation-specific. For maximum interoperability, an OLEPS
/// implementation SHOULD NOT write strings with embedded or trailing null characters unless
/// specifically requested to do so by an application.
/// </summary>
public string? Characters { get; set; }
}
}

View File

@@ -0,0 +1,90 @@
namespace SabreTools.Models.OLE
{
public static class Constants
{
#region Format IDs
public const string SummaryInformationFMTIDString = "F29F85E0-4FF9-1068-AB91-08002B27B3D9";
public static readonly GUID SummaryInformationFMTIDGUID = new()
{
Data1 = 0xF29F85E0,
Data2 = 0x4FF9,
Data3 = 0x1068,
Data4 = [0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9],
};
public const string DocSummaryInformationFMTIDString = "D5CDD502-2E9C-101B-9397-08002B2CF9AE";
public static readonly GUID DocSummaryInformationFMTIDGUID = new()
{
Data1 = 0xD5CDD502,
Data2 = 0x2E9C,
Data3 = 0x101B,
Data4 = [0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE],
};
public const string UserDefinedPropertiesFMTIDString = "D5CDD502-2E9C-101B-9397-08002B2CF9AE";
public static readonly GUID UserDefinedPropertiesFMTIDGUID = new()
{
Data1 = 0xD5CDD502,
Data2 = 0x2E9C,
Data3 = 0x101B,
Data4 = [0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE],
};
public const string GlobalInfoFMTIDString = "56616F00-C154-11CE-8553-00AA00A1F95B";
public static readonly GUID GlobalInfoFMTIDGUID = new()
{
Data1 = 0x56616F00,
Data2 = 0xC154,
Data3 = 0x11CE,
Data4 = [0x85, 0x53, 0x00, 0xAA, 0x00, 0xA1, 0xF9, 0x5B],
};
public const string ImageContentsFMTIDString = "556616400-C154-11CE-8553-00AA00A1F95B";
public static readonly GUID ImageContentsFMTIDGUID = new()
{
Data1 = 0x56616F00,
Data2 = 0xC154,
Data3 = 0x11CE,
Data4 = [0x85, 0x53, 0x00, 0xAA, 0x00, 0xA1, 0xF9, 0x5B],
};
public const string ImageInfoFMTIDString = "556616400-C154-11CE-8553-00AA00A1F95B";
public static readonly GUID ImageInfoFMTIDGUID = new()
{
Data1 = 0x56616F00,
Data2 = 0xC154,
Data3 = 0x11CE,
Data4 = [0x85, 0x53, 0x00, 0xAA, 0x00, 0xA1, 0xF9, 0x5B],
};
public const string PropertyBagFMTIDString = "20001801-5DE6-11D1-8E38-00C04FB9386D";
public static readonly GUID PropertyBagFMTIDGUID = new()
{
Data1 = 0x20001801,
Data2 = 0x5DE6,
Data3 = 0x11D1,
Data4 = [0x8E, 0x38, 0x00, 0xC0, 0x4F, 0xB9, 0x38, 0x6D],
};
#endregion
#region Stream or Storage Names
public static readonly string SummaryInformationName = (byte)0x05 + "SummaryInformation";
public static readonly string DocSummaryInformationName = (byte)0x05 + "DocumentSummaryInformation";
public static readonly string UserDefinedPropertiesName = (byte)0x05 + "DocumentSummaryInformation";
public static readonly string GlobalInfoName = (byte)0x05 + "GlobalInfo";
public static readonly string ImageContentsName = (byte)0x05 + "ImageContents";
public static readonly string ImageInfoName = (byte)0x05 + "ImageInfo";
public const string ControlStreamName = "{4c8cc155-6c1e-11d1-8e41-00c04fb9386d}";
#endregion
}
}

View File

@@ -0,0 +1,35 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// A file that has one or more property sets associated with it through the alternate
/// stream binding MUST have a control stream, which is an alternate stream with the name
/// "{4c8cc155-6c1e-11d1-8e41-00c04fb9386d}". This stream MUST contain the following packet.
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class ControlStream
{
/// <summary>
/// MUST be set to zero, and nonzero values MUST be rejected.
/// </summary>
public ushort Reserved1 { get; set; }
/// <summary>
/// MUST be set to zero, and MUST be ignored.
/// </summary>
public ushort Reserved2 { get; set; }
/// <summary>
/// An application-provided value that MUST NOT be interpreted by the
/// OLEPS implementation. If the application did not provide a value,
/// it SHOULD be set to zero.
/// </summary>
public uint ApplicationState { get; set; }
/// <summary>
/// An application-provided value that MUST NOT be interpreted by the
/// OLEPS implementation. If the application did not provide a value,
/// it SHOULD be absent.
/// </summary>
public GUID? CLSID { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The DATE (Packet Version) packet represents a DATE as specified in [MS-OAUT]
/// section 2.2.25
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class DATE
{
/// <summary>
/// The value of the DATE is an 8-byte IEEE floating-point number, as specified in
/// [MS-OAUT] section 2.2.25.
/// </summary>
public ulong Value { get; set; }
}
}

View File

@@ -0,0 +1,35 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The DECIMAL (Packet Version) packet represents a DECIMAL as specified in [MS-OAUT] section
/// 2.2.26
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class DECIMAL
{
/// <summary>
/// MUST be set to zero and MUST be ignored
/// </summary>
public ushort Reserved { get; set; }
/// <summary>
/// The value of the scale field specified in [MS-OAUT] section 2.2.26
/// </summary>
public byte Scale { get; set; }
/// <summary>
/// The value of the sign field specified in [MS-OAUT] section 2.2.26
/// </summary>
public byte Sign { get; set; }
/// <summary>
/// The value of the Hi32 field specified in [MS-OAUT] section 2.2.26
/// </summary>
public uint Hi32 { get; set; }
/// <summary>
/// The value of the Lo64 field specified in [MS-OAUT] section 2.2.26
/// </summary>
public ulong Lo64 { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The Dictionary packet represents all mappings between property identifiers and
/// property names in a property set
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class Dictionary
{
/// <summary>
/// n unsigned integer representing the number of entries in the Dictionary
/// </summary>
public uint NumEntries { get; set; }
/// <summary>
/// All Entry fields MUST be a sequence of DictionaryEntry packets. Entries are
/// not required to appear in any particular order.
/// </summary>
public DictionaryEntry[]? Entries { get; set; }
// Padding (variable): Padding, if necessary, to a total length that is a multiple of 4 bytes.
// Padding would be after each dictionary entry
}
}

View File

@@ -0,0 +1,35 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The DictionaryEntry packet represents a mapping between a property identifier and a
/// property name
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class DictionaryEntry
{
/// <summary>
/// An unsigned integer representing a property identifier. MUST be a valid
/// PropertyIdentifier value in the range 0x00000002 to 0x7FFFFFFF, inclusive
/// (this specifically excludes the property identifiers for any of the special
/// properties specified in section 2.18).
/// </summary>
public PropertyIdentifier PropertyIdentifier { get; set; }
/// <summary>
/// If the property set's CodePage property has the value CP_WINUNICODE (0x04B0),
/// MUST be the length of the Name field in 16-bit Unicode characters, including
/// the null terminator but not including padding (if any). Otherwise, MUST be the
/// length of the Name field in 8-bit characters, including the null terminator.
/// </summary>
public uint Length { get; set; }
/// <summary>
/// If the property set's CodePage property has the value CP_WINUNICODE (0x04B0),
/// MUST be a null-terminated array of 16-bit Unicode characters, followed by zero
/// padding to a multiple of 4 bytes. Otherwise, MUST be a null-terminated array of
/// 8-bit characters from the code page identified by the CodePage property and MUST
/// NOT be padded.
/// </summary>
public string? Name { get; set; }
}
}

View File

@@ -0,0 +1,503 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The PropertyIdentifier data type represents the property identifier of a property in a property set
/// </summary>
/// <remarks>
/// The SummaryInformation property set format, identified by FMTID_SummaryInformation
/// ({F29F85E0-4FF9-1068-AB91-08002B27B3D9}), represents generic properties of a document. The properties
/// specific to the SummaryInformation property set are specified in the following table. Except where
/// otherwise stated, a SummaryInformation property set SHOULD have all of these properties, and SHOULD
/// NOT have any other properties, except for the special properties specified in section 2.18.
/// </remarks>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public enum PropertyIdentifier : uint
{
/// <summary>
/// Property identifier for the Dictionary property
/// </summary>
DICTIONARY_PROPERTY_IDENTIFIER = 0x00000000,
/// <summary>
/// Property identifier for the CodePage property
/// </summary>
CODEPAGE_PROPERTY_IDENTIFIER = 0x00000001,
/// <summary>
/// Property identifier for the Locale property
/// </summary>
LOCALE_PROPERTY_IDENTIFIER = 0x80000000,
/// <summary>
/// Property identifier for the Behavior property
/// </summary>
BEHAVIOR_PROPERTY_IDENTIFIER = 0x80000003,
#region SummaryInformation
/// <summary>
/// The title of the document.
/// </summary>
/// <remarks>VT_LPSTR</remarks>
PIDSI_TITLE = 0x00000002,
/// <summary>
/// The subject of the document.
/// </summary>
/// <remarks>VT_LPSTR</remarks>
PIDSI_SUBJECT = 0x00000003,
/// <summary>
/// The author of the document.
/// </summary>
/// <remarks>VT_LPSTR</remarks>
PIDSI_AUTHOR = 0x00000004,
/// <summary>
/// Keywords related to the document.
/// </summary>
/// <remarks>VT_LPSTR</remarks>
PIDSI_KEYWORDS = 0x00000005,
/// <summary>
/// Comments related the document.
/// </summary>
/// <remarks>VT_LPSTR</remarks>
PIDSI_COMMENTS = 0x00000006,
/// <summary>
/// The application-specific template from which the document was created.
/// </summary>
/// <remarks>VT_LPSTR</remarks>
PIDSI_TEMPLATE = 0x00000007,
/// <summary>
/// The last author of the document.
/// </summary>
/// <remarks>VT_LPSTR</remarks>
PIDSI_LASTAUTHOR = 0x00000008,
/// <summary>
/// An application-specific revision number for this version of the document.
/// </summary>
/// <remarks>VT_LPSTR</remarks>
PIDSI_REVNUMBER = 0x00000009,
/// <summary>
/// A 64-bit unsigned integer indicating the total amount of time that
/// has been spent editing the document in 100-nanosecond
/// increments. MUST be encoded as a FILETIME by setting the
/// dwLowDataTime field to the low 32-bits and the dwHighDateTime
/// field to the high 32-bits.
/// </summary>
/// <remarks>VT_FILETIME</remarks>
PIDSI_EDITTIME = 0x0000000A,
/// <summary>
/// The most recent time that the document was printed.
/// </summary>
/// <remarks>VT_FILETIME</remarks>
PIDSI_LASTPRINTED = 0x0000000B,
/// <summary>
/// The time that the document was created.
/// </summary>
/// <remarks>VT_FILETIME</remarks>
PIDSI_CREATE_DTM = 0x0000000C,
/// <summary>
/// The most recent time that the document was saved.
/// </summary>
/// <remarks>VT_FILETIME</remarks>
PIDSI_LASTSAVE_DTM = 0x0000000D,
/// <summary>
/// The total number of pages in the document.
/// </summary>
/// <remarks>VT_I4</remarks>
PIDSI_PAGECOUNT = 0x0000000E,
/// <summary>
/// The total number of words in the document.
/// </summary>
/// <remarks>VT_I4</remarks>
PIDSI_WORDCOUNT = 0x0000000F,
/// <summary>
/// The total number of characters in the document.
/// </summary>
/// <remarks>VT_I4</remarks>
PIDSI_CHARCOUNT = 0x00000010,
/// <summary>
/// Application-specific clipboard data containing a thumbnail
/// representing the document's contents. MAY be absent.
/// </summary>
/// <remarks>VT_CF</remarks>
PIDSI_THUMBNAIL = 0x00000011,
/// <summary>
/// The name of the application that was used to create the document.
/// </summary>
/// <remarks>VT_LPSTR</remarks>
PIDSI_APPNAME = 0x00000012,
/// <summary>
/// A 32-bit signed integer representing a set of application-suggested
/// access control flags with the following values:
/// - 0x00000001: Password protected
/// - 0x00000002: Read-only recommended
/// - 0x00000004: Read-only enforced
/// - 0x00000008: Locked for annotations
/// </summary>
/// <remarks>VT_I4</remarks>
PIDSI_DOC_SECURITY = 0x00000013,
#endregion
}
/// <summary>
/// The PropertyType enumeration represents the type of a property in a property set. The set of types
/// supported depends on the version of the property set, which is indicated by the Version field of the
/// PropertySetStream packet. In addition, the property types not supported in simple property sets
/// are specified as such. PropertyType is an enumeration, which MUST be one of the following values
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public enum PropertyType : ushort
{
/// <summary>
/// Type is undefined, and the minimum property set version is 0
/// </summary>
VT_EMPTY = 0x0000,
/// <summary>
/// Type is null, and the minimum property set version is 0
/// </summary>
VT_NULL = 0x0001,
/// <summary>
/// Type is 16-bit signed integer, and the minimum property set version is 0
/// </summary>
VT_I2 = 0x0002,
/// <summary>
/// Type is 32-bit signed integer, and the minimum property set version is 0.
/// </summary>
VT_I4 = 0x0003,
/// <summary>
/// Type is 4-byte (single-precision) IEEE floating-point number, and the
/// minimum property set version is 0.
/// </summary>
VT_R4 = 0x0004,
/// <summary>
/// Type is 8-byte (double-precision) IEEE floating-point number, and the
/// minimum property set version is 0.
/// </summary>
VT_R8 = 0x0005,
/// <summary>
/// Type is CURRENCY, and the minimum property set version is 0.
/// </summary>
VT_CY = 0x0006,
/// <summary>
/// Type is DATE, and the minimum property set version is 0.
/// </summary>
VT_DATE = 0x0007,
/// <summary>
/// Type is CodePageString, and the minimum property set version is 0.
/// </summary>
VT_BSTR = 0x0008,
/// <summary>
/// Type is HRESULT, and the minimum property set version is 0.
/// </summary>
VT_ERROR = 0x000A,
/// <summary>
/// Type is VARIANT_BOOL, and the minimum property set version is 0.
/// </summary>
VT_BOOL = 0x000B,
/// <summary>
/// Type is DECIMAL, and the minimum property set version is 0.
/// </summary>
VT_DECIMAL = 0x000E,
/// <summary>
/// Type is 1-byte signed integer, and the minimum property set version
/// is 1.
/// </summary>
VT_I1 = 0x0010,
/// <summary>
/// Type is 1-byte unsigned integer, and the minimum property set version
/// is 0.
/// </summary>
VT_UI1 = 0x0011,
/// <summary>
/// Type is 2-byte unsigned integer, and the minimum property set version
/// is 0.
/// </summary>
VT_UI2 = 0x0012,
/// <summary>
/// Type is 4-byte unsigned integer, and the minimum property set version
/// is 0.
/// </summary>
VT_UI4 = 0x0013,
/// <summary>
/// Type is 8-byte signed integer, and the minimum property set version
/// is 0.
/// </summary>
VT_I8 = 0x0014,
/// <summary>
/// Type is 8-byte unsigned integer, and the minimum property set version
/// is 0.
/// </summary>
VT_UI8 = 0x0015,
/// <summary>
/// Type is 4-byte signed integer, and the minimum property set version
/// is 1.
/// </summary>
VT_INT = 0x0016,
/// <summary>
/// Type is 4-byte unsigned integer, and the minimum property set version
/// is 1.
/// </summary>
VT_UINT = 0x0017,
/// <summary>
/// Type is CodePageString, and the minimum property set version is 0.
/// </summary>
VT_LPSTR = 0x001E,
/// <summary>
/// Type is UnicodeString, and the minimum property set version is 0.
/// </summary>
VT_LPWSTR = 0x001F,
/// <summary>
/// Type is FILETIME, and the minimum property set version is 0.
/// </summary>
VT_FILETIME = 0x0040,
/// <summary>
/// Type is binary large object (BLOB), and the minimum property set
/// version is 0.
/// </summary>
VT_BLOB = 0x0041,
/// <summary>
/// Type is Stream, and the minimum property set version is 0. VT_STREAM
/// is not allowed in a simple property set.
/// </summary>
VT_STREAM = 0x0042,
/// <summary>
/// Type is Storage, and the minimum property set version is 0. VT_STORAGE
/// is not allowed in a simple property set.
/// </summary>
VT_STORAGE = 0x0043,
/// <summary>
/// Type is Stream representing an Object in an application-specific manner,
/// and the minimum property set version is 0. VT_STREAMED_Object is not
/// allowed in a simple property set.
/// </summary>
VT_STREAMED_Object = 0x0044,
/// <summary>
/// Type is Storage representing an Object in an application-specific manner,
/// and the minimum property set version is 0. VT_STORED_Object is not
/// allowed in a simple property set.
/// </summary>
VT_STORED_Object = 0x0045,
/// <summary>
/// Type is BLOB representing an object in an application-specific manner.
/// The minimum property set version is 0.
/// </summary>
VT_BLOB_Object = 0x0046,
/// <summary>
/// Type is PropertyIdentifier, and the minimum property set version is 0.
/// </summary>
VT_CF = 0x0047,
/// <summary>
/// Type is CLSID, and the minimum property set version is 0.
/// </summary>
VT_CLSID = 0x0048,
/// <summary>
/// Type is Stream with application-specific version GUID (VersionedStream).
/// The minimum property set version is 0. VT_VERSIONED_STREAM is not allowed
/// in a simple property set.
/// </summary>
VT_VERSIONED_STREAM = 0x0049,
/// <summary>
/// Type is Vector, and the minimum property set version is 0
/// </summary>
VT_VECTOR = 0x1000,
/// <summary>
/// Type is Vector of 1-byte unsigned integers, and the minimum property set version
/// is 0.
/// </summary>
VT_VECTOR_UI1 = 0x1011,
/// <summary>
/// Type is Vector of 2-byte unsigned integers, and the minimum property set version
/// is 0.
/// </summary>
VT_VECTOR_UI2 = 0x1012,
/// <summary>
/// Type is Vector of 4-byte unsigned integers, and the minimum property set version
/// is 0.
/// </summary>
VT_VECTOR_UI4 = 0x1013,
/// <summary>
/// Type is Vector of 8-byte signed integers, and the minimum property set version
/// is 0.
/// </summary>
VT_VECTOR_I8 = 0x1014,
/// <summary>
/// Type is Vector of 8-byte unsigned integers and the minimum property set version
/// is 0.
/// </summary>
VT_VECTOR_UI8 = 0x1015,
/// <summary>
/// Type is Vector of CodePageString, and the minimum property set version is 0.
/// </summary>
VT_VECTOR_LPSTR = 0x101E,
/// <summary>
/// Type is Vector of UnicodeString, and the minimum property set version is 0.
/// </summary>
VT_VECTOR_LPWSTR = 0x101F,
/// <summary>
/// Type is Vector of FILETIME, and the minimum property set version is 0.
/// </summary>
VT_VECTOR_FILETIME = 0x1040,
/// <summary>
/// Type is Vector of PropertyIdentifier, and the minimum property set version is 0.
/// </summary>
VT_VECTOR_CF = 0x1047,
/// <summary>
/// Type is Vector of CLSID, and the minimum property set version is 0.
/// </summary>
VT_VECTOR_CLSID = 0x1048,
/// <summary>
/// Type is Array of 16-bit signed integers, and the minimum property set version
/// is 1.
/// </summary>
VT_ARRAY_I2 = 0x2002,
/// <summary>
/// Type is Array of 32-bit signed integers, and the minimum property set version
/// is 1.
/// </summary>
VT_ARRAY_I4 = 0x2003,
/// <summary>
/// Type is Array of 4-byte (single-precision) IEEE floating-point numbers, and the
/// minimum property set version is 1.
/// </summary>
VT_ARRAY_R4 = 0x2004,
/// <summary>
/// Type is IEEE floating-point numbers, and the minimum property set version is 1.
/// </summary>
VT_ARRAY_R8 = 0x2005,
/// <summary>
/// Type is Array of CURRENCY, and the minimum property set version is 1.
/// </summary>
VT_ARRAY_CY = 0x2006,
/// <summary>
/// Type is Array of DATE, and the minimum property set version is 1.
/// </summary>
VT_ARRAY_DATE = 0x2007,
/// <summary>
/// Type is Array of CodePageString, and the minimum property set version is 1.
/// </summary>
VT_ARRAY_BSTR = 0x2008,
/// <summary>
/// Type is Array of HRESULT, and the minimum property set version is 1.
/// </summary>
VT_ARRAY_ERROR = 0x200A,
/// <summary>
/// Type is Array of VARIANT_BOOL, and the minimum property set version is 1.
/// </summary>
VT_ARRAY_BOOL = 0x200B,
/// <summary>
/// Type is Array of variable-typed properties, and the minimum property set
/// version is 1
/// </summary>
VT_ARRAY_VARIANT = 0x200C,
/// <summary>
/// Type is Array of DECIMAL, and the minimum property set version is 1
/// </summary>
VT_ARRAY_DECIMAL = 0x200E,
/// <summary>
/// Type is Array of 1-byte signed integers, and the minimum property set
/// version is 1
/// </summary>
VT_ARRAY_I1 = 0x2010,
/// <summary>
/// Type is Array of 1-byte unsigned integers, and the minimum property set
/// version is 1
/// </summary>
VT_ARRAY_UI1 = 0x2011,
/// <summary>
/// Type is Array of 2-byte unsigned integers, and the minimum property set
/// version is 1.
/// </summary>
VT_ARRAY_UI2 = 0x2012,
/// <summary>
/// Type is Array of 4-byte unsigned integers, and the minimum property set
/// version is 1.
/// </summary>
VT_ARRAY_UI4 = 0x2013,
/// <summary>
/// Type is Array of 4-byte signed integers, and the minimum property set version
/// is 1.
/// </summary>
VT_ARRAY_INT = 0x2016,
/// <summary>
/// Type is Array of 4-byte unsigned integers, and the minimum property set version
/// is 1.
/// </summary>
VT_ARRAY_UINT = 0x2017,
}
}

View File

@@ -0,0 +1,19 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The FILETIME (Packet Version) packet represents a FILETIME structure ([MS-DTYP] section 2.3.3
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class FILETIME
{
/// <summary>
/// The value of the dwLowDateTime field specified in [MS-DTYP] section 2.3.3.
/// </summary>
public uint LowDateTime { get; set; }
/// <summary>
/// The value of the dwHighDateTime field specified in [MS-DTYP] section 2.3.3.
/// </summary>
public uint HighDateTime { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The GUID (Packet Version) packet represents a GUID
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class GUID
{
/// <summary>
/// The value of the Data1 field specified in [MS-DTYP] section 2.3.4
/// </summary>
public uint Data1 { get; set; }
/// <summary>
/// The value of the Data2 field specified in [MS-DTYP] section 2.3.4
/// </summary>
public ushort Data2 { get; set; }
/// <summary>
/// The value of the Data3 field specified in [MS-DTYP] section 2.3.4
/// </summary>
public ushort Data3 { get; set; }
/// <summary>
/// The value of the Data4 field specified in [MS-DTYP] section 2.3.4
/// </summary>
public byte[]? Data4 { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The IndirectPropertyName packet represents the name of a stream or storage as used in the
/// representation of the following property types in a non-simple property set: VT_STREAM (0x0042),
/// VT_STORAGE (0x0043), VT_STREAMED_OBJECT (0x0044), VT_STORED_OBJECT (0x0044), and
/// VT_VERSIONED_STREAM (0x0049). It MUST be represented as a CodePageString, and its value MUST
/// be derived from the property identifier of the property represented according to the following
/// Augmented BackusNaur Form (ABNF) [RFC4234] syntax.
///
/// Indirectproperty = "prop" propertyIdentifier
///
/// Where PropertyIdentifier is the decimal string representation of the property identifier. This property
/// identifier MUST be a valid PropertyIdentifier value and MUST NOT be the property identifier for any of
/// the special properties specified in section 2.18.
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class IndirectPropertyName : CodePageString { }
}

View File

@@ -0,0 +1,23 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The PropertyIdentifierAndOffset packet is used in the PropertySet packet to represent a
/// property identifier and the byte offset of the property in the PropertySet packet
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class PropertyIdentifierAndOffset
{
/// <summary>
/// An unsigned integer representing the property identifier of a property
/// in the property set. MUST be a valid PropertyIdentifier value.
/// </summary>
public PropertyIdentifier PropertyIdentifier { get; set; }
/// <summary>
/// An unsigned integer representing the offset in bytes from the beginning
/// of the PropertySet packet to the beginning of the Property field for the
/// property represented. MUST be a multiple of 4 bytes.
/// </summary>
public uint Offset { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The PropertySet packet represents a property set.
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class PropertySet
{
/// <summary>
/// MUST be the total size in bytes of the PropertySet packet
/// </summary>
public uint Size { get; set; }
/// <summary>
/// An unsigned integer representing the number of properties in the
/// property set.
/// </summary>
public uint NumProperties { get; set; }
/// <summary>
/// All PropertyIdentifierAndOffset fields MUST be a sequence of
/// PropertyIdentifierAndOffset packets. The sequence MUST be in order of
/// increasing value of the Offset field. Packets are not required to be
/// in any particular order with regard to the value of the PropertyIdentifier
/// field.
/// </summary>
public PropertyIdentifierAndOffset[]? PropertyIdentifierAndOffsets { get; set; }
/// <summary>
/// Each Property field is a sequence of property values, each of which MUST
/// be represented by a TypedPropertyValue packet or a Dictionary packet in
/// the special case of the Dictionary property.
/// </summary>
public object[]? Properties { get; set; }
}
}

View File

@@ -0,0 +1,106 @@
namespace SabreTools.Models.OLE
{
/// <summary>
/// The PropertySetStream packet specifies the stream format for simple property
/// sets and the stream format for the CONTENTS stream in the Non-Simple Property
/// Set Storage Format. A simple property set MUST be represented by a stream
/// containing a PropertySetStream packet.
///
/// The PropertySetStream packet usually represents exactly one property set, but
/// for historical reasons, the DocumentSummaryInfo and UserDefinedProperties
/// property sets are represented in the same stream.In this special case, a
/// PropertySetStream might represent two property sets.
///
/// An implementation SHOULD enforce a limit on the total size of a PropertySetStream
/// packet. This limit MUST be at least 262,144 bytes, and for maximum interoperability
/// SHOULD be 2,097,152 bytes.
/// </summary>
/// <see href="https://winprotocoldoc.z19.web.core.windows.net/MS-OLEPS/%5bMS-OLEPS%5d.pdf"/>
public class PropertySetStream
{
/// <summary>
/// MUST be set to 0xFFFE
/// </summary>
public ushort ByteOrder { get; set; }
/// <summary>
/// An unsigned integer indicating the version number of the property set (or
/// property sets). MUST be 0x0000 or 0x0001. An OLEPS implementation MUST
/// accept version 0 property sets and SHOULD<5> also accept version 1 property
/// sets. This field MUST be set to 0x0001 if the property set or property sets
/// use any of the following features not supported by version 0 property sets:
/// - Property types not supported for version 0 property sets, as specified in
/// the PropertyType enumeration.
/// - The Behavior property.
///
/// If the property set does not use any of these features, this field SHOULD be
/// set to 0x0000 for maximum interoperability.
/// </summary>
public ushort Version { get; set; }
/// <summary>
/// An implementation-specific value that SHOULD be ignored, except possibly to
/// report this value to applications. It SHOULD NOT be interpreted by the
/// OLEPS implementation.
/// </summary>
public uint SystemIdentifier { get; set; }
/// <summary>
/// MUST be a GUID (Packet Version) packet representing the associated CLSID of
/// the property set (or property sets). If no CLSID is provided by the
/// application, it SHOULD be set to GUID_NULL by default.
/// </summary>
public GUID? CLSID { get; set; }
/// <summary>
/// An unsigned integer indicating the number of property sets represented by
/// this PropertySetStream structure. MUST be either 0x00000001 or 0x00000002.
///
/// - 0x00000001: This structure contains one property set
/// - 0x00000002: This structure contains two property sets.
/// The optional fields for PropertySet 1 are present.
/// </summary>
public uint NumPropertySets { get; set; }
/// <summary>
/// A GUID that MUST be set to the FMTID of the property set represented by the
/// field PropertySet 0. If NumPropertySets has the value 0x00000002, then this
/// GUID MUST be set to FMTID_DocSummaryInformation
/// ({D5CDD502-2E9C-101B-9397-08002B2CF9AE}).
/// </summary>
public GUID? FMTID0 { get; set; }
/// <summary>
/// An unsigned integer that MUST be set to the offset in bytes from the beginning
/// of this PropertySetStream structure to the beginning of the field PropertySet 0.
/// </summary>
public uint Offset0 { get; set; }
/// <summary>
/// If NumPropertySets has the value 0x00000002, it MUST be set to FMTID_UserDefinedProperties
/// ({D5CDD505-2E9C-101B-9397-08002B2CF9AE}). Otherwise, it MUST be absent.
/// </summary>
public GUID? FMTID1 { get; set; }
/// <summary>
/// If NumPropertySets has the value 0x00000002, it MUST be set to the offset in bytes
/// from the beginning of this PropertySetStream structure to the beginning of the
/// field PropertySet 1. Otherwise, it MUST be absent.
/// </summary>
public uint? Offset1 { get; set; }
/// <summary>
/// MUST be a PropertySet packet
/// </summary>
public PropertySet? PropertySet0 { get; set; }
/// <summary>
/// If NumPropertySets has the value 0x00000002, it MUST be a PropertySet packet.
/// Otherwise, it MUST be absent.
/// </summary>
public PropertySet? PropertySet1 { get; set; }
// Padding (variable): Contains additional padding added by the implementation.
// If present, padding MUST be zeroes and MUST be ignored.
}
}

Some files were not shown because too many files have changed in this diff Show More