How to read a password protected zip file

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

How to read a password protected zip file

Post by dehseth »

Hi everybody,

As you can see in topic I would like to know about reading a zip file, especially with password protected ones. I tried to search on forums but whenever I write "zip" as keyword it returns all topics which included zip file links. :)
Murloc992
Posts: 272
Joined: Mon Apr 13, 2009 2:45 pm
Location: Utena,Lithuania

Post by Murloc992 »

Code: Select all

virtual bool addFileArchive(const path& filename, bool ignoreCase=true,
			bool ignorePaths=true,
			E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN,
			const core::stringc& password="") =0;
as found in irr::io::IFileSystem :>
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

Post by dehseth »

I have added a zip file into working directory but file system does not see my files.

Code: Select all

if (!g_fileSystem->addFileArchive("resources.zip", true, false, io::E_FILE_ARCHIVE_TYPE::EFAT_ZIP, "anka"))
{
	DebugBreak();
}
I have a folder named "enviroments" and a file in this folder named "enviroment1.X". And I tried to load this x file as:

Code: Select all

scene::IAnimatedMesh* mesh = g_smgr->getMesh("enviroments\\enviroment1.x");
Am I doing smt wrong?
Murloc992
Posts: 272
Joined: Mon Apr 13, 2009 2:45 pm
Location: Utena,Lithuania

Post by Murloc992 »

Gonna try to do it myself and post the code in a short time :)
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

Post by dehseth »

If I do not put a password it works.. But with password zip file does not work. I compressed zip file in max compression. This may be a bug in Irrlicht, I may open a new topic under bug section after inspecting this error carefully.

And yet I got another problem :D getSceneCollisionManager()->getSceneNodeAndCollisionPointFromRay method started to return an error Access violation reading location 0x00000000.
Why this happens :?:
Murloc992
Posts: 272
Joined: Mon Apr 13, 2009 2:45 pm
Location: Utena,Lithuania

Post by Murloc992 »

Code: Select all

if(!iDVC->getFileSystem()->addFileArchive("resources.zip",true,false,irr::io::EFAT_ZIP,"murloc992"))
		return;
Works perfectly, but you must put .ZIP archive on Normal compression, not Storing, or Maximum :)
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

Post by dehseth »

isn't that a bug?
Murloc992
Posts: 272
Joined: Mon Apr 13, 2009 2:45 pm
Location: Utena,Lithuania

Post by Murloc992 »

Damn it's kinda random, now it's not working.. what the hell.. :shock:
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Post by 3DModelerMan »

I noticed there were two backslashes \\ in the file path. Shouldn't they be forward // so that they don't get mistaken for an escape sequence?
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

Post by dehseth »

password protected zip files does not work... I am opening a bug topic about this...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

A double backslash is the non-portable version of the path separator. It's much better to always use / (note, only one slash!) as all platforms support it.
link3rn3l
Posts: 81
Joined: Wed Nov 15, 2006 5:51 pm

Post by link3rn3l »

use 7zip to compress ZIP files...

and in options please set AES-256 encription in 7zip
http://www.7-zip.org/

other encrypt algorithm not work ..!!!!

irrlicht compiled with dx8,dx9 and zip encrypted ...
in bullet animator - binaries:
http://irrlicht.sourceforge.net/phpBB2/ ... t+animator





Yes, long live to Irrlicht !!!!!!
....
Bennu (Best 2d and 3D dev-tool)
http://bennupack.blogspot.com

Pixtudio (Best 2D development tool)
http://pixtudiopack.blogspot.com

Bennu3D(3D Libs for bennu)
http://3dm8ee.blogspot.com/

Colombian Developers - Blog:
http://coldev.blogspot.com/
DtD
Posts: 264
Joined: Mon Aug 11, 2008 7:05 am
Location: Kansas
Contact:

Post by DtD »

3DModelerMan wrote:I noticed there were two backslashes \\ in the file path. Shouldn't they be forward // so that they don't get mistaken for an escape sequence?
\\ would be an escape sequence for just one \


However it is generally a good habbit to use / instead to maintain Linux and OSX compatibility in the future.

~DtD
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

Post by dehseth »

thanks.. I used win-zip and select AES encryption it worked :!:
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

A strongly related thing: You can use the more advanced compression methods of winzip/7zip, namely bzip2 and lzma to compress files with higher ratios.
Post Reply