Page 1 of 1

Loaded Archive File Lists

Posted: Mon May 14, 2018 1:43 pm
by noretsar
Hi, I'm trying to customize my loaded archive, but I can only read the first file when I added some padding to my archive file. Is there a way to check what is loaded, debug or know what is happening when I load a zip archive?

Re: Loaded Archive File Lists

Posted: Mon May 14, 2018 7:47 pm
by CuteAlien
What is customizing a loaded archive? Do you mean stuff like adding files? I don't think that's possible. If you need that my way to do that would probably be to copy-paste the code of the archive-loader and then check how to modify that directly.

Re: Loaded Archive File Lists

Posted: Thu May 17, 2018 1:45 am
by noretsar
CuteAlien wrote:What is customizing a loaded archive? Do you mean stuff like adding files? I don't think that's possible. If you need that my way to do that would probably be to copy-paste the code of the archive-loader and then check how to modify that directly.
Hi! Yes, I was trying to use a custom zip/archive format by moving the signature offset and adding a few more bytes at the beginning. I modified a few sources which affects the archive reading and it works, but I can only read the first file, no idea where to get the current file pointer or how to track or fetch the rest of the files as I thought this was loaded to memory or something.

Re: Loaded Archive File Lists

Posted: Thu May 17, 2018 10:07 am
by CuteAlien
So you don't want to modify files but archive itself? I suppose you have to check source for that. For zip it's CZipReader.cpp

Re: Loaded Archive File Lists

Posted: Tue May 22, 2018 7:19 pm
by noretsar
CuteAlien wrote:So you don't want to modify files but archive itself? I suppose you have to check source for that. For zip it's CZipReader.cpp
Hey Cute Alien, I was trying to read a modified archive, it seems to be finding those file pointers reference is a bit confusing on the source. So my question is, how does Irrlicht read zip archives? Does it load an archive in memory? where do I keep track of the file pointer of a loaded archive? Is it really loaded?

As I have mentioned, I have attempted to modify that particular file as well as others that seems to be referencing those features, but so far I can only read the first file when I moved the archive signature a few more bytes.

Re: Loaded Archive File Lists

Posted: Tue May 22, 2018 8:49 pm
by MartinVee
Just to be sure I understand correctly. You modify (so essentially, you corrupt) an archive file, and then ask why the code can't read it?

Re: Loaded Archive File Lists

Posted: Tue May 22, 2018 11:44 pm
by CuteAlien
I didn't write that code, but from a quick read (very short, just browsing over it for a minute) it looks to me like it reads the zip-header into memory. And when requesting certain files inside the archive it depends if the archive is compressed or not. For uncompressed files it keeps them as files and just reads from the positions mentioned in the zip-header (using limit-read-file which allows a file to act as if it consists of several files by telling from where-to-where inside the real file any of those limit-read-files goes). For compressed files it decompressed the part of the zip file into memory and gives you a memory-read-file (which allows you to access memory like a file).