Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi

| Name | MIME | Path | Description |
|------|------|------|-------------|
| $I | | [`patterns/ifile.hexpat`](patterns/ifile.hexpat) | Windows Recycling Bin $I file |
| 3DS | | [`patterns/3ds.hexpat`](patterns/3ds.hexpat) | Autodesk 3DS Max Model file |
| 7Z | | [`patterns/7z.hexpat`](patterns/7z.hexpat) | 7z File Format |
| ADTFDAT | | [`patterns/adtfdat.hexpat`](patterns/adtfdat.hexpat) | [ADTFDAT files](https://digitalwerk.gitlab.io/solutions/adtf_content/adtf_base/adtf_file_library) |
Expand Down
36 changes: 36 additions & 0 deletions patterns/ifile.hexpat
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma author RedHare-Exe
#pragma description Windows Recycling Bin $I file
#pragma magic [ 02 00 00 00 00 00 00 00 ] @ 0x00

import std.time;
import type.time;
import std.string;

using NullString16 = std::string::NullString16;

struct DelTime {
u64 raw;
} [[format_read("parse_filetime")]];

fn parse_filetime(DelTime raw_ft) {
// Convert raw FILETIME to Unix time
u64 unix_time = type::impl::format_filetime_as_unix(raw_ft.raw);

// Convert Unix time to structured UTC time
std::time::Time ts = std::time::to_utc(unix_time);

// Format as string
str formatted = std::time::format(ts, "%Y-%m-%d %H:%M:%S");

return formatted;
};

struct IFile {
u64 Version;
u64 Size;
DelTime DelTime [[name("Deleted Time")]];
u32 NameSize [[name("Size of Path in Characters")]];
NullString16 Path;
};

IFile IFile @ 0x00;
Binary file added tests/patterns/test_data/ifile.hexpat
Binary file not shown.