transfer file from one zip to another, WIP (z64 broken)

This commit is contained in:
Jean-Marie Mineau 2024-01-17 17:21:08 +01:00
parent 8157325a02
commit 26b18bab76
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
4 changed files with 19 additions and 4 deletions

View file

@ -9,6 +9,7 @@ use crate::{
};
use androscalpel_serializer::Serializable;
#[derive(Debug, PartialEq, Eq)]
pub struct ZipFileReader<T: Read + Seek> {
pub end_of_central_directory: EndCentralDirectory,
pub zip64_end_of_central_directory: Option<Zip64EndCentralDirectory>,
@ -44,6 +45,7 @@ impl<T: Read + Seek> ZipFileReader<T> {
} else {
None
};
//println!("{:#?}", end_of_central_directory);
// At this point python's ziplib recompute the location of the central directory from the
// location of the end of central directory in case the zip was concanated after a file.
@ -64,6 +66,7 @@ impl<T: Read + Seek> ZipFileReader<T> {
let cd_size = zip_file.get_cd_size();
while size_read < cd_size {
let header = FileHeader::deserialize(&mut zip_file.data).unwrap();
//println!("{:#?}", header);
size_read += header.size() as u64;
let pos_in_dir = zip_file.data.stream_position().unwrap();
if header.general_purpose_flags & general_purpose_flags::MASK_ENCRYPTED_CENTRAL_DIR != 0