mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-28 07:47:02 -05:00
* Use spaces instead of tabs in zip.hexpat * patterns: minor cleanup to ZIP pattern - Remove empty and unused CentralDirectoryEntry struct. - Shorten the comment of CentralDirectoryFileHeader.fileOffset. It was so long that the tooltip overflowed my screen, and didn't really add much information. - Small whitespace changes.
43 lines
2.2 KiB
Rust
43 lines
2.2 KiB
Rust
#pragma MIME application/zip
|
|
|
|
#include <std/mem.pat>
|
|
|
|
struct EndOfCentralDirectory {
|
|
u32 headerSignature [[color("00000000")]];
|
|
u16 diskNum [[comment("Number of this disk "), name("Disk Number")]];
|
|
u16 diskStart [[comment("Disk where central directory starts "), name("Central Directory Disk Number")]];
|
|
u16 CDRCount [[comment("Number of central directory records on this disk"), name("Central Directory Entries")]];
|
|
u16 CentralDirectoryRecordCount [[comment("Total number of entries in the central directory"), name("Total Central Directory Entries")]];
|
|
u32 CDSize [[comment("Size of central directory (bytes)"), name("Central Directory Size")]];
|
|
u32 CDOffset [[comment("Offset of start of central directory, relative to start of archive"), name("Central Directory Offset")]];
|
|
u16 commentLength [[color("00000000")]];
|
|
char coment[commentLength] [[name("Comment")]];
|
|
};
|
|
|
|
EndOfCentralDirectory fileInfo @ std::mem::find_sequence(0,0x50,0x4B,0x05,0x06) [[name("End of Central Directory Record")]];
|
|
|
|
struct CentralDirectoryFileHeader {
|
|
u32 headerSignature [[color("00000000")]];
|
|
u16 versionMade [[comment("Version file made by")]];
|
|
u16 versionExtract [[comment("Minimum version needed to extract")]];
|
|
u16 generalFlag [[comment("General purpose bit flag"), color("00000000")]];
|
|
u16 compressionMethod;
|
|
u16 fileLastModifyTime [[comment("File last modification time")]];
|
|
u16 fileLastModifyDate [[comment("File last modification date")]];
|
|
u32 crc32 [[comment("CRC-32 of uncompressed data"), color("00000000")]];
|
|
u32 compressedSize;
|
|
u32 uncompressedSize;
|
|
u16 fileNameLength [[color("00000000")]];
|
|
u16 extraFieldLength [[color("00000000")]];
|
|
u16 fileCommentLength [[color("00000000")]];
|
|
u16 diskNumber [[comment("Disk number where file starts")]];
|
|
u16 internalFileAttributes;
|
|
u32 externalFileAttributes;
|
|
u32 fileOffset [[comment("Offset of local file header, relative to the start of the first disk on which the file occurs.")]];
|
|
char fileName[fileNameLength];
|
|
u8 extraField[extraFieldLength];
|
|
char comment[fileCommentLength];
|
|
};
|
|
|
|
CentralDirectoryFileHeader centralDirHeaders[fileInfo.CDRCount] @ (fileInfo.CDOffset) [[name("Files")]];
|