Update zip structs

This commit is contained in:
atxr 2024-02-06 20:13:10 +01:00
parent 4c6972b961
commit 8bb984e61a

View file

@ -1,9 +1,12 @@
#ifndef LIBMINEZIPER_ZIP_H #ifndef LIBMINEZIPER_ZIP_H
#define LIBMINEZIPER_ZIP_H #define LIBMINEZIPER_ZIP_H
#define START_CDH_SEARCH 22 #pragma pack(1)
#define CDH_MB "PK\05\06"
#define LFH_MB "PK\03\04" #define START_EOCD_SEARCH 22
#define EOCD_SIG "PK\05\06"
#define LFH_SIG "PK\03\04"
#define CDH_SIG "PK\01\02"
typedef struct raw typedef struct raw
{ {
@ -13,26 +16,56 @@ typedef struct raw
typedef struct LFH typedef struct LFH
{ {
char mb[4]; // CDH_MB "PK\03\04" int sig; // LFH_SIG "PK\03\04"
void* crc32; // TODO TYPE? short version;
int size_compressed_data; short f;
int size_uncompressed_data; short compression_method;
void* filename; // TODO TYPE? short last_mod_time;
void* data; short last_mod_date;
int crc32;
int compressed_size;
int uncompressed_size;
short filename_length;
short extra_field_length;
char* filename;
} LFH; } LFH;
typedef struct CDH typedef struct CDH
{ {
char mb[4]; // CDH_MB "PK\05\06" int sig; // CDH_SIG "PK\01\02"
void* crc32; // TODO TYPE? short v1;
LFH* lfh; short v2;
void* filename; // TODO TYPE? short f;
short compression_method;
short last_mod_time;
short last_mod_date;
int crc32;
int compressed_size;
int uncompressed_size;
short filename_length;
short extra_field_length;
short file_comment_length;
short disk_number_start;
short internal_file_attributes;
int external_file_attributes;
int off_lfh;
} CDH; } CDH;
typedef struct EOCD
{
int sig; // CDH_SIG "PK\05\06"
char d[6];
short number_of_entries;
int size_cdh;
int off_cdh;
} EOCD;
typedef struct zip typedef struct zip
{ {
// compression type // compression type
CDH* cd; char* cd;
CDH** cdh;
EOCD* eocd;
} zip; } zip;
void find_cdh(raw* raw, zip* out); void find_cdh(raw* raw, zip* out);