mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-31 13:25:58 -05:00
Compare commits
11 Commits
ImHex-v1.3
...
ImHex-v1.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0549e62a14 | ||
|
|
b4bf2b946f | ||
|
|
5e82bfadac | ||
|
|
a5c9f3b18a | ||
|
|
38262e6bb9 | ||
|
|
0a37b60d70 | ||
|
|
345e264ff8 | ||
|
|
ba2c396534 | ||
|
|
439f04e19b | ||
|
|
eaeea8d093 | ||
|
|
9af8d7e693 |
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -1,2 +1,4 @@
|
||||
*.pat linguist-language=Rust
|
||||
*.hexpat linguist-language=Rust
|
||||
|
||||
tests/patterns/test_data/* binary
|
||||
|
||||
@@ -78,6 +78,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
|
||||
| NBT | | [`patterns/nbt.hexpat`](patterns/nbt.hexpat) | Minecraft NBT format |
|
||||
| NE | | [`patterns/ne.hexpat`](patterns/ne.hexpat) | NE header and Standard NE fields |
|
||||
| nes | | [`patterns/nes.hexpat`](patterns/nes.hexpat) | .nes file format |
|
||||
| NotepadWindowState | | [`patterns/notepad-windowstate.hexpat`](patterns/notepad-windowstate.hexpat) | Windows 11 Notepad - Window State .bin file |
|
||||
| NRO | | [`patterns/nro.hexpat`](patterns/nro.hexpat) | Nintendo Switch NRO files |
|
||||
| NTAG | | [`patterns/ntag.hexpat`](patterns/ntag.hexpat) | NTAG213/NTAG215/NTAG216, NFC Forum Type 2 Tag compliant IC |
|
||||
| OGG | `audio/ogg` | [`patterns/ogg.hexpat`](patterns/ogg.hexpat) | OGG Audio format |
|
||||
@@ -95,6 +96,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
|
||||
| QBCL | | [`patterns/qbcl.hexpat`](patterns/qbcl.hexpat) | Qubicle voxel scene project file |
|
||||
| QOI | `image/qoi` | [`patterns/qoi.hexpat`](patterns/qoi.hexpat) | QOI image files |
|
||||
| RAS | `image/x-sun-raster` | [`patterns/ras.hexpat`](patterns/ras.hexpat) | RAS image files |
|
||||
| ReFS | | [`patterns/refs.hexpat`](patterns/refs.hexpat) | Microsoft Resilient File System |
|
||||
| Shell Link | `application/x-ms-shortcut` | [`patterns/lnk.hexpat`](patterns/lnk.hexpat) | Windows Shell Link file format |
|
||||
| shp | | [`patterns/shp.hexpat`](patterns/shp.hexpat) | ESRI shape file |
|
||||
| shx | | [`patterns/shx.hexpat`](patterns/shx.hexpat) | ESRI index file |
|
||||
|
||||
@@ -38,12 +38,20 @@ namespace auto std::core {
|
||||
};
|
||||
|
||||
/**
|
||||
Returns the first parameter of the attribute of a pattern if it has one
|
||||
Returns the nth parameter of the attribute of a pattern if it has one
|
||||
@param pattern The pattern to check
|
||||
@param attribute The attribute's name to query
|
||||
@param [index] The parameter index of the attribute to return. Defaults to 0
|
||||
*/
|
||||
fn get_attribute_argument(ref auto pattern, str attribute, u32 index = 0) {
|
||||
return builtin::std::core::get_attribute_argument(pattern, attribute, index);
|
||||
};
|
||||
|
||||
/**
|
||||
@warning Removed in 1.27.0
|
||||
*/
|
||||
fn get_attribute_value(ref auto pattern, str attribute) {
|
||||
return builtin::std::core::get_attribute_value(pattern, attribute);
|
||||
builtin::std::error("`std::core::get_attribute_value(pattern, attribute)` has been removed.\nUse `std::core::get_attribute_argument(pattern, attribute, [index])` instead.");
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -328,9 +328,9 @@ namespace auto std::math {
|
||||
@param start Start address
|
||||
@param end End address
|
||||
@param valueSize Size of each value in bytes
|
||||
@param section Section to use
|
||||
@param operation Operation to use
|
||||
@param endian Endianness to use
|
||||
@param [section] Section to use
|
||||
@param [operation] Operation to use. Defaults to addition
|
||||
@param [endian] Endianness to use. Defaults to native
|
||||
@return Sum of all values in the specified memory range
|
||||
*/
|
||||
fn accumulate(u128 start, u128 end, u128 valueSize, std::mem::Section section = 0, AccumulateOperation operation = AccumulateOperation::Add, std::mem::Endian endian = std::mem::Endian::Native) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
/*!
|
||||
Library for doing raw memory accesses and other low-level operations.
|
||||
*/
|
||||
@@ -102,7 +104,7 @@ namespace auto std::mem {
|
||||
Reads a unsigned value from the memory
|
||||
@param address The address to read from
|
||||
@param size The size of the value to read
|
||||
@param endian The endianess of the value to read
|
||||
@param [endian] The endianess of the value to read. Defaults to native
|
||||
@return The value read
|
||||
*/
|
||||
fn read_unsigned(u128 address, u8 size, Endian endian = Endian::Native) {
|
||||
@@ -113,7 +115,7 @@ namespace auto std::mem {
|
||||
Reads a signed value from the memory
|
||||
@param address The address to read from
|
||||
@param size The size of the value to read
|
||||
@param endian The endianess of the value to read
|
||||
@param [endian] The endianess of the value to read. Defaults to native
|
||||
@return The value read
|
||||
*/
|
||||
fn read_signed(u128 address, u8 size, Endian endian = Endian::Native) {
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace auto std::random {
|
||||
> - `Poisson(mean) -> i128`
|
||||
|
||||
@param distribution Distribution to use
|
||||
@param param1 This parameter depends on the type of distribution used.
|
||||
@param param2 This parameter depends on the type of distribution used.
|
||||
@param [param1] This parameter depends on the type of distribution used. Defaults to 0
|
||||
@param [param2] This parameter depends on the type of distribution used. Defaults to 0
|
||||
*/
|
||||
fn generate_using(Distribution distribution, auto param1 = 0, auto param2 = 0) {
|
||||
return builtin::std::random::generate(u32(distribution), param1, param2);
|
||||
@@ -71,8 +71,8 @@ namespace auto std::random {
|
||||
|
||||
/**
|
||||
Generates a uniformly distributed random number between `min` and `max`
|
||||
@param min Minimum number
|
||||
@param max Maximum number
|
||||
@param [min] Minimum number. Defaults to 0
|
||||
@param [max] Maximum number. Defaults to `u64_max`
|
||||
*/
|
||||
fn generate(u64 min = std::limits::u64_min(), u64 max = std::limits::u64_max()) {
|
||||
return std::random::generate_using(Distribution::Uniform, min, max);
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace auto std::time {
|
||||
|
||||
/**
|
||||
Queries the current time in the specified time zone.
|
||||
@param time_zone The time zone to query.
|
||||
@param [time_zone] The time zone to query. Defaults to local.
|
||||
@return The current time in the specified time zone.
|
||||
*/
|
||||
fn now(TimeZone time_zone = TimeZone::Local) {
|
||||
@@ -167,7 +167,7 @@ namespace auto std::time {
|
||||
/**
|
||||
Formats a time according to the specified format string.
|
||||
@param time The time to format.
|
||||
@param format_string The format string to use.
|
||||
@param [format_string] The format string to use. Defaults to "%c".
|
||||
@return The formatted time.
|
||||
*/
|
||||
fn format(Time time, str format_string = "%c") {
|
||||
@@ -180,7 +180,7 @@ namespace auto std::time {
|
||||
/**
|
||||
Formats a DOS date according to the specified format string.
|
||||
@param date The DOS date to format.
|
||||
@param format_string The format string to use.
|
||||
@param [format_string] The format string to use. Defaults to "{}/{}/{}".
|
||||
@return The formatted DOS date.
|
||||
*/
|
||||
fn format_dos_date(DOSDate date, str format_string = "{}/{}/{}") {
|
||||
@@ -190,7 +190,7 @@ namespace auto std::time {
|
||||
/**
|
||||
Formats a DOS time according to the specified format string.
|
||||
@param time The DOS time to format.
|
||||
@param format_string The format string to use.
|
||||
@param [format_string] The format string to use. Defaults to "{:02}:{:02}:{:02}".
|
||||
@return The formatted DOS time.
|
||||
*/
|
||||
fn format_dos_time(DOSTime time, str format_string = "{:02}:{:02}:{:02}") {
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace auto type
|
||||
{
|
||||
fn format_magic(ref auto magic)
|
||||
{
|
||||
return fm(magic.value);
|
||||
return type::fm(magic.value);
|
||||
};
|
||||
}
|
||||
}
|
||||
198
patterns/adts.hexpat
Normal file
198
patterns/adts.hexpat
Normal file
@@ -0,0 +1,198 @@
|
||||
#pragma authors: zhoubo
|
||||
#pragma version: 0.4
|
||||
#pragma description: Parse AAC's ADTS(Audio Data Transport Stream) audio files.
|
||||
#pragma category: Audio
|
||||
#pragma filemask: *.aac
|
||||
#pragma IDBytes: FF F //ADTS Syncword
|
||||
#pragma history:
|
||||
#pragma 0.4 2024-02-12 zhoubo: Porting from 010 Editor Templates.
|
||||
#pragma 0.3 2024-02-09 zhoubo: use BitfieldDisablePadding(Unpadded Bitfields) for odd header bytes(7,9 bytes) color, and remove FSeek.
|
||||
#pragma 0.2 2024-02-05 zhoubo: fix some comment & color.
|
||||
#pragma 0.1 2022-06-13 zhoubo: Init release. only ADTS, not support ADIF,LATM.
|
||||
|
||||
// More information available at:
|
||||
// 1. https://wiki.multimedia.cx/index.php?title=ADTS
|
||||
// 2. https://en.wikipedia.org/wiki/Advanced_Audio_Coding
|
||||
// 3. https://en.wikipedia.org/wiki/AAC
|
||||
// 4. https://juejin.cn/post/7032170229732442148
|
||||
|
||||
#pragma endian big
|
||||
|
||||
#include <std/sys.pat>
|
||||
#include <std/core.pat>
|
||||
|
||||
fn GetMPEGVersionComment(auto MPEG_Version)
|
||||
{
|
||||
str comment = "";
|
||||
match (MPEG_Version)
|
||||
{
|
||||
(0): comment = "MPEG-4";
|
||||
(1): comment = "MPEG-2";
|
||||
}
|
||||
return comment;
|
||||
};
|
||||
|
||||
fn GetProtectionAbsentComment(auto Protection_absence)
|
||||
{
|
||||
str comment = "";
|
||||
match (Protection_absence)
|
||||
{
|
||||
(0): comment = "ADTS has 9 bytes with CRC";
|
||||
(1): comment = "ADTS has 7 bytes without CRC";
|
||||
}
|
||||
return comment;
|
||||
};
|
||||
|
||||
fn GetProfileComment(auto Profile)
|
||||
{
|
||||
str comment = "";
|
||||
match (Profile)
|
||||
{
|
||||
(0x00): comment = "AAC Main";
|
||||
(0x01): comment = "AAC LC (Low Complexity)";
|
||||
(0x10): comment = "AAC SSR (Scalable Sample Rate)";
|
||||
(0x11): comment = "AAC LTP (Long Term Prediction)";
|
||||
}
|
||||
return comment;
|
||||
};
|
||||
|
||||
fn GetSamplingFrequencyIndexComment(auto Sampling_frequency_index)
|
||||
{
|
||||
str comment = "";
|
||||
match (Sampling_frequency_index)
|
||||
{
|
||||
(0x0): comment = "96000Hz";
|
||||
(0x1): comment = "88200Hz";
|
||||
(0x2): comment = "64000Hz";
|
||||
(0x3): comment = "48000Hz";
|
||||
(0x4): comment = "44100Hz";
|
||||
(0x5): comment = "32000Hz";
|
||||
(0x6): comment = "24000Hz";
|
||||
(0x7): comment = "22050Hz";
|
||||
(0x8): comment = "16000Hz";
|
||||
(0x9): comment = "12000Hz";
|
||||
(0xa): comment = "11025Hz";
|
||||
(0xb): comment = "8000Hz";
|
||||
(0xc): comment = "7350Hz";
|
||||
(0xd): comment = "Reserved";
|
||||
(0xe): comment = "Reserved";
|
||||
(0xf): comment = "FORBIDDEN (malformed)";
|
||||
}
|
||||
return comment;
|
||||
};
|
||||
|
||||
fn GetChannelConfigurationComment(auto Channel_configuration)
|
||||
{
|
||||
str comment = "";
|
||||
match (Channel_configuration)
|
||||
{
|
||||
(0): comment = "Defined in AOT Specifc Config";
|
||||
(1): comment = "1 channel: front-center";
|
||||
(2): comment = "2 channels: front-left, front-right";
|
||||
(3): comment = "3 channels: front-center, front-left, front-right";
|
||||
(4): comment = "4 channels: front-center, front-left, front-right, back-center";
|
||||
(5): comment = "5 channels: front-center, front-left, front-right, back-left, back-right";
|
||||
(6): comment = "6 channels: front-center, front-left, front-right, back-left, back-right, LFE-channel";
|
||||
(7): comment = "8 channels: front-center, front-left, front-right, side-left, side-right, back-left, back-right, LFE-channel";
|
||||
}
|
||||
return comment;
|
||||
};
|
||||
|
||||
fn GetBufferFullnessComment(auto ADTS_buffer_fullness)
|
||||
{
|
||||
str comment = "";
|
||||
match (ADTS_buffer_fullness)
|
||||
{
|
||||
(0x7FF): comment = "VBR (most software ignore this field)";
|
||||
(_): comment = "rate..?? (most software ignore this field)";
|
||||
}
|
||||
return comment;
|
||||
};
|
||||
|
||||
fn GetRawDataBlockComment(auto Number_of_AAC_frames_minus_1)
|
||||
{
|
||||
str comment = "";
|
||||
match (Number_of_AAC_frames_minus_1)
|
||||
{
|
||||
(0x0): comment = "has 1 AAC data block";
|
||||
(_): comment = "data block number + 1";
|
||||
}
|
||||
return comment;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------
|
||||
// Define structures used in AAC files
|
||||
//
|
||||
// [1.adts_fixed_header information]
|
||||
// Syncword: 12bits, sync header, always 0xFFF。
|
||||
// MPEG_Version: 1bit, 0 means MPGE-4, 1 means MPGE-2
|
||||
// Layer: 2bits, alwayas ”00”
|
||||
// Protection_absence: 1bit, 0 means ADTS Header 9 bytes; 1 means ADTS Header 7 bytes
|
||||
// Profile: 2bit, AAC level : Main,LC,SSR,LTP
|
||||
// Sampling_frequency_index: 4bits, Sampling Frequencies
|
||||
// Private_bit: 1bit
|
||||
// Channel_configuration: 3bits, channel number...
|
||||
// Originality: 1bit
|
||||
// Home: 1bit
|
||||
//
|
||||
// [2.adts_variable_header information]
|
||||
// Copyright_id_bit: 1bit
|
||||
// Copyright_id_start: 1bit
|
||||
// AAC_frame_length: 13bits, AAC frame length : ADTS Header(7 or 9 bytes) + sizeof(AAC Frame)
|
||||
// ADTS_buffer_fullness: 11bits, 0x7FF means VBR
|
||||
// Number_of_AAC_frames_minus_1: 2bits, ADTS Frame numbers : Number_of_AAC_frames_minus_1 + 1
|
||||
//
|
||||
// [3.CRC information]
|
||||
// CRC16: 16bits, when Protection_absence=0
|
||||
|
||||
bitfield ADTS_HEADER
|
||||
{
|
||||
// ADTS_FIXED_HEADER
|
||||
Syncword : 12 [[color("00FF00"), comment("always 0xFFF")]];
|
||||
MPEG_Version : 1 [[color("00FF00"), comment(GetMPEGVersionComment(this))]];
|
||||
Layer : 2 [[color("00FF00"), comment("always 0")]];
|
||||
Protection_absence : 1 [[color("00FF00"), comment(GetProtectionAbsentComment(this))]];
|
||||
|
||||
Profile : 2 [[color("0000FF"), comment(GetProfileComment(this))]];
|
||||
Sampling_frequency_index : 4 [[color("0000FF"), comment(GetSamplingFrequencyIndexComment(this))]];
|
||||
Private_bit : 1 [[color("0000FF")]];
|
||||
Channel_configuration : 3 [[color("0000FF"), comment(GetChannelConfigurationComment(this))]];
|
||||
Originality : 1 [[color("0000FF")]];
|
||||
Home : 1 [[color("0000FF")]];
|
||||
|
||||
// ADTS_VARIABLE_HEADER
|
||||
Copyright_id_bit : 1 [[color("0000FF")]];
|
||||
Copyright_id_start : 1 [[color("0000FF")]];
|
||||
AAC_frame_length : 13 [[color("0000FF")]];
|
||||
ADTS_buffer_fullness : 11 [[color("0000FF"), comment(GetBufferFullnessComment(this))]];
|
||||
Number_of_AAC_frames_minus_1 : 2 [[color("0000FF"), comment(GetRawDataBlockComment(this))]];
|
||||
|
||||
// ADTS_CRC_HEADER
|
||||
if (0 == Protection_absence) // Header with CRC
|
||||
{
|
||||
u16 CRC16 [[color("FFFF00")]];
|
||||
}
|
||||
else // Header without CRC
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct ADTS_FRAME
|
||||
{
|
||||
ADTS_HEADER Header;
|
||||
|
||||
if (0 == Header.Protection_absence) // Header with CRC 2 bytes
|
||||
{
|
||||
u8 Data[Header.AAC_frame_length - 9] [[color("000000")]];
|
||||
}
|
||||
else // Header without CRC
|
||||
{
|
||||
u8 Data[Header.AAC_frame_length - 7] [[color("000000")]];
|
||||
}
|
||||
};
|
||||
|
||||
//---------------------------------------------
|
||||
|
||||
ADTS_FRAME adtsFrame[while(!std::mem::eof())] @ 0x00;
|
||||
80
patterns/bgcode.hexpat
Normal file
80
patterns/bgcode.hexpat
Normal file
@@ -0,0 +1,80 @@
|
||||
#pragma author Shadlock0133 (aka Aurora)
|
||||
#pragma description Binary G-Code from Prusa
|
||||
|
||||
#include <type/magic.pat>
|
||||
#include <std/mem.pat>
|
||||
|
||||
enum ChecksumType : u16 {
|
||||
None,
|
||||
CRC32,
|
||||
};
|
||||
|
||||
enum BlockType : u16 {
|
||||
FileMetadata,
|
||||
GCode,
|
||||
SlicerMetadata,
|
||||
PrinterMetadata,
|
||||
PrintMetadata,
|
||||
Thumbnail,
|
||||
};
|
||||
|
||||
enum Compression : u16 {
|
||||
None,
|
||||
Deflate,
|
||||
Heatshrink11_4,
|
||||
Heatshrink12_4,
|
||||
};
|
||||
|
||||
enum Encoding : u16 {
|
||||
Ini,
|
||||
};
|
||||
|
||||
enum ImageFormat : u16 {
|
||||
Png,
|
||||
Jpg,
|
||||
Qoi,
|
||||
};
|
||||
|
||||
struct Header {
|
||||
type::Magic<"GCDE"> magic;
|
||||
u32 version;
|
||||
ChecksumType checksum_type;
|
||||
};
|
||||
|
||||
Header header @ 0;
|
||||
std::assert(header.version == 1, "only version 1 supported");
|
||||
|
||||
struct Block {
|
||||
BlockType type;
|
||||
Compression compression;
|
||||
u32 uncompressed_size;
|
||||
auto size = uncompressed_size;
|
||||
if (compression != Compression::None) {
|
||||
u32 compressed_size;
|
||||
size = compressed_size;
|
||||
}
|
||||
match (type) {
|
||||
(BlockType::FileMetadata
|
||||
| BlockType::PrinterMetadata
|
||||
| BlockType::PrintMetadata
|
||||
| BlockType::SlicerMetadata): {
|
||||
Encoding encoding;
|
||||
}
|
||||
(BlockType::Thumbnail): {
|
||||
ImageFormat image_format;
|
||||
u16 width;
|
||||
u16 height;
|
||||
}
|
||||
(BlockType::GCode): {
|
||||
u16;
|
||||
}
|
||||
(_): { std::assert(false, "unknown type"); }
|
||||
}
|
||||
u8 data[size];
|
||||
match (header.checksum_type) {
|
||||
(ChecksumType::None): {}
|
||||
(ChecksumType::CRC32): { u32 checksum; }
|
||||
}
|
||||
};
|
||||
|
||||
Block blocks[while(!std::mem::eof())] @ $;
|
||||
50
patterns/notepadwindowstate.hexpat
Normal file
50
patterns/notepadwindowstate.hexpat
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma author ogmini https://github.com/ogmini
|
||||
#pragma description Windows 11 Notepad Window State file %localappdata%\Packages\Microsoft.WindowsNotepad_8wekyb3d8bbwe\LocalState\WindowState
|
||||
|
||||
#include <std/string.pat>
|
||||
#include <type/leb128.pat>
|
||||
#include <std/time.pat>
|
||||
#include <std/core.pat>
|
||||
|
||||
using ul = type::uLEB128;
|
||||
using int = u32;
|
||||
|
||||
struct Tab
|
||||
{
|
||||
u128 GUID;
|
||||
};
|
||||
|
||||
struct WindowState
|
||||
{
|
||||
char HeaderIdentifier[2]; // NP
|
||||
ul SequenceNumber;
|
||||
ul BytesToCRC32;
|
||||
u8 Delim[1];
|
||||
ul NumberTabs;
|
||||
|
||||
Tab Tabs[NumberTabs];
|
||||
|
||||
ul ActiveTab;
|
||||
|
||||
int CoordTopLeftX;
|
||||
int CoordTopLeftY;
|
||||
|
||||
int CoordBottomRightX;
|
||||
int CoordBottomRightY;
|
||||
|
||||
int WindowSizeWidth;
|
||||
int WindowSizeHeight;
|
||||
|
||||
u8 Delim2[1];
|
||||
|
||||
int CRC32;
|
||||
|
||||
u8 SlackSpace[while(!std::mem::eof())];
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// -- Declaration --
|
||||
|
||||
WindowState state @ 0x0;
|
||||
162
patterns/refs.hexpat
Normal file
162
patterns/refs.hexpat
Normal file
@@ -0,0 +1,162 @@
|
||||
#pragma author 5h4rrK
|
||||
#pragma description ReFS-File-System
|
||||
|
||||
import type.types.win32;
|
||||
import type.guid;
|
||||
import std.mem;
|
||||
|
||||
enum FILESYSTEM : u64 {
|
||||
ReFS = 0x53466552
|
||||
};
|
||||
|
||||
struct ReFS_Version {
|
||||
u8 Major;
|
||||
u8 Minor;
|
||||
};
|
||||
|
||||
struct CheckPoint_REFS_Version {
|
||||
u16 Major;
|
||||
u16 Minor;
|
||||
};
|
||||
|
||||
enum BLOCK : u32 {
|
||||
SuperBlock = 0x42505553,
|
||||
CheckPoint = 0x504b4843,
|
||||
MSBPlus = 0x2b42534d
|
||||
};
|
||||
|
||||
struct META_HEADERS {
|
||||
BLOCK Signature[[comment("Block Signature"), name("BlockSignature")]];
|
||||
u32 unk[[comment("Fixed Value 0x02"), name("Unknown")]];
|
||||
$ = $ + (0x8 + 0x10);
|
||||
u64 LCN1[[comment("MetaPage 1st LogicalClusterNumber"), name("FirstLCN")]];
|
||||
u64 LCN2[[comment("MetaPage 2nd LogicalClusterNumber"), name("SecondLCN")]];
|
||||
u64 LCN3[[comment("MetaPage 3rd LogicalClusterNumber"), name("ThirdLCN")]];
|
||||
u64 LCN4[[comment("MetaPage 4th LogicalClusterNumber"), name("FourthLCN")]];
|
||||
u64 _Objid;
|
||||
u64 ObjId;
|
||||
|
||||
};
|
||||
|
||||
struct ATTRIBUTE {
|
||||
u64 LCN1[[name("FirstLCN")]];
|
||||
u64 LCN2[[name("SecondLCN")]];
|
||||
u64 LCN3[[name("ThirdLCN")]];
|
||||
u64 LCN4[[name("FourthLCN")]];
|
||||
u32 Unk1[[comment("UnknownField"), name("Unknown1")]];
|
||||
u32 Unk2[[comment("UnknownField"), name("Unknown2")]];
|
||||
u64 checksum[[name("CheckSum")]];
|
||||
BYTE ZeroPadding[56][[name("Padding")]];
|
||||
};
|
||||
|
||||
u32 keeptrack = 0;
|
||||
|
||||
struct EntryArray {
|
||||
u32 AttrOffsetEntry;
|
||||
u32 prev = $;
|
||||
$ = (0x1000 * ($ / 0x1000));
|
||||
$ = $ + AttrOffsetEntry;
|
||||
keeptrack += 1;
|
||||
if (keeptrack == 1) {
|
||||
ATTRIBUTE ObjectTable;
|
||||
}
|
||||
else if (keeptrack == 2) {
|
||||
ATTRIBUTE UNKNOWN1;
|
||||
}
|
||||
else if (keeptrack == 3) {
|
||||
ATTRIBUTE UNKNOWN2;
|
||||
}
|
||||
else if (keeptrack == 4) {
|
||||
ATTRIBUTE AttributeList;
|
||||
}
|
||||
else if (keeptrack == 5) {
|
||||
ATTRIBUTE DirectoryTree;
|
||||
}
|
||||
else if (keeptrack == 6) {
|
||||
ATTRIBUTE UNKNOWN3;
|
||||
}
|
||||
else if (keeptrack == 7) {
|
||||
ATTRIBUTE UNKNOWN4;
|
||||
}
|
||||
else if (keeptrack == 8) {
|
||||
ATTRIBUTE ContainerTable;
|
||||
}
|
||||
else if (keeptrack == 9) {
|
||||
ATTRIBUTE ContainerTableDup;
|
||||
}
|
||||
else if (keeptrack == 10) {
|
||||
ATTRIBUTE UNKNOWN5;
|
||||
}
|
||||
else if (keeptrack == 11) {
|
||||
ATTRIBUTE AllocatorLarge;
|
||||
}
|
||||
else if (keeptrack == 12) {
|
||||
ATTRIBUTE UNKNOWN6;
|
||||
}
|
||||
else if (keeptrack == 13) {
|
||||
ATTRIBUTE UNKNOWN7;
|
||||
}
|
||||
$ = prev;
|
||||
};
|
||||
|
||||
struct CHECKPOINT {
|
||||
META_HEADERS CheckPointMetaHeader[[name("FSPageMetaHeader")]];
|
||||
$ += (0x04);
|
||||
CheckPoint_REFS_Version ReFSVersion;
|
||||
u32 EntryOffset;
|
||||
u32 EntrySz[[name("EntrySize")]];
|
||||
u64 blockno[[name("BlockNumber")]];
|
||||
$ += (0x28);
|
||||
u32 NumOfEntries;
|
||||
EntryArray AttributeEntries[NumOfEntries];
|
||||
$ += (0x08);
|
||||
u64 LCN1dup[[comment("Duplicate LCN of MetaPage of this block"), name("DupFirstLCN")]];
|
||||
u64 LCN2dup[[comment("Duplicate LCN of MetaPage of this block"), name("DupSecondLCN")]];
|
||||
u64 LCN3dup[[comment("Duplicate LCN of MetaPage of this block"), name("DupThirdLCN")]];
|
||||
u64 LCN4dup[[comment("Duplicate LCN of MetaPage of this block"), name("DupFourthLCN")]];;
|
||||
};
|
||||
|
||||
struct SUPERBLOCK {
|
||||
META_HEADERS SuperBlockMetaHeader[[name("FSPageMetaHeader")]];
|
||||
type::GUID GUID;
|
||||
$ = $ + (0x10 * 0x06);
|
||||
u64 primarychekpoint[[name("PrimaryCheckPoint")]];
|
||||
u64 secondaychekpoint[[name("SecondaryCheckPoint")]];
|
||||
u64 LCN1dup[[name("DupFirstLCN")]];
|
||||
u64 LCN2dup[[name("DupSecondtLCN")]];
|
||||
u64 LCN3dup[[name("DupThirdLCN")]];
|
||||
u64 LCN4dup[[name("DupFourthLCN")]];
|
||||
};
|
||||
|
||||
struct VOLUME_BOOT_RECORD {
|
||||
BYTE jmpInstruction[3] [[comment("Jump Instruction"), name("JumpInstruction")]];;
|
||||
FILESYSTEM FileSystem[[comment("FileSystemName"), name("FileSystem")]];
|
||||
BYTE UnKnown[5];
|
||||
char Identifier[4][[comment("File System Recognition Structure, allows OS to recognise the structure"), name("FSRSIdentifier")]];
|
||||
u16 Length[[comment("Size of VBR"), name("Length") ]];
|
||||
u16 Checksum[[comment("Computed FileSystem Information Checksum"), name("CheckSum")]];
|
||||
u64 TotalNoOfSectors;
|
||||
u32 BytesPerSec[[comment("Bytes Per Sector"), name("BytesPerSector")]];
|
||||
u32 SectorPerCluster[[comment("Sector Per Cluster"), name("SectorPerCluster")]];
|
||||
ReFS_Version ReFSVersion;
|
||||
BYTE UnknownBuff[0x0e][[name("Unknown")]];
|
||||
u64 SerialNo[[name("SerialNumber")]];
|
||||
|
||||
};
|
||||
struct REFS_FILE_SYSTEM {
|
||||
u64 checkVal = std::mem::read_unsigned($+3, 8);
|
||||
$ = 0;
|
||||
if(checkVal == FILESYSTEM::ReFS){
|
||||
VOLUME_BOOT_RECORD vbr @ 0x00[[name("VolumeBootRecord")]];
|
||||
SUPERBLOCK SuperBlock @ (0x1e * 0x1000);
|
||||
|
||||
CHECKPOINT PrimaryCheckPoint @(SuperBlock.primarychekpoint * 0x1000);
|
||||
keeptrack = 0;
|
||||
CHECKPOINT SecondaryCheckPoint @(SuperBlock.secondaychekpoint * 0x1000);
|
||||
}
|
||||
else{
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
REFS_FILE_SYSTEM ReFSFileSystem @0x00;
|
||||
@@ -41,7 +41,7 @@ struct posix_header {
|
||||
char name[100] [[name("file name")]];
|
||||
char mode[8] [[name("file mode")]];
|
||||
char uid[8] [[name("user id of the file")]];
|
||||
char gid[8] [[name("group if of the file")]];
|
||||
char gid[8] [[name("group id of the file")]];
|
||||
char size[12] [[name("size of the file in octal")]];
|
||||
char mtime[12] [[name("modified time of file in epoch time")]];
|
||||
char chksum[8] [[name("checksum")]];
|
||||
|
||||
BIN
tests/patterns/test_data/16b-2ch-44100hz.aac
Normal file
BIN
tests/patterns/test_data/16b-2ch-44100hz.aac
Normal file
Binary file not shown.
BIN
tests/patterns/test_data/notepad-windowstate.hexpat.bin
Normal file
BIN
tests/patterns/test_data/notepad-windowstate.hexpat.bin
Normal file
Binary file not shown.
Reference in New Issue
Block a user