Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

fixing p7zip 4.65 to make .ZIP use DOS, not Unix, as host OS (Announce)

posted by Rugxulo Homepage, Usono, 27.07.2010, 01:59

> Alright, I fixed my swap / memory error problems in 4.65 / 9.13 p7zip. The
> hint about CWSDPMI made me go check & I actually was running r5! A switch
> to r7 provided the fix, now I get all methods except -mx9 and md=64m to
> work in a 1 GB system. Of course I never run EMS memory, and the free XMS
> on this machine is ~850MB, and the files I was compressing were just under
> 100 MB total.

In other words, it should work but doesn't. Maybe DJGPP or p7zip is allocating extra RAM for just general use. I dunno. :-/

> Now another unrelated mystery comes up, only to be seen on the DOS compiles
> of p7zip. When creating a simple Deflate .ZIP file, the normal PKWARE
> PKUNZIP utility refuses to extract the .ZIP archives because they have been
> 'tagged' as created on a UNIX system (0x03 identifier the .ZIP file header,
> when it *should be* 0x00 for true DOS! Manually modifying the headers make
> them extract fine)

What version? That would be a bug on their end, IMHO. But obviously hacking every .ZIP created is less than ideal. And I guess suggesting you use a different unzipper (Info-Zip, djtar, Doszip, p7zip) is out too. However, I think BE has a good front-end to ZIP file viewing / hacking, if you're curious (even in DOS).

> So, the UNIX-y nature of the p7za compilations is somehow "embedded" in the
> ZIP files it creates. Is there any way short of a complete recompile to
> modify the 7za.exe binary to make it "know" that it is running on a true
> MS-DOS System? Somehow we must modify the HostOS flag in the binary, but
> WHERE is it located?

Impossible without exact same compiler setup or knowing intricately something which I don't (and GDB is a pain). So, long story short, yes, you'll probably have to recompile. Heck, I just did it (again) with p7zip 4.65, took approx. 12 mins. after making WATT-32 and using pre-built GNU pth 2.07 (/current/ only) on this lame P4 2.4 Ghz Celeron (128 MB RAM ftw!).


// inside \p7zip_4.65\CPP\7zip\Archive\Zip\ZipUpdate.cpp
// line 33
  #if defined(_WIN32) || defined(DJGPP) // was only #ifdef _WIN32
  NFileHeader::NHostOS::kFAT;
  #else
  NFileHeader::NHostOS::kUnix;
  #endif


First I built without that patch (using G++ 4.4.4, DJDEV 2.04). Then I patched it. I confirmed it works via "unzip -Zlv". So this hopefully fixes it for you (although other formats, e.g. Gzip, I didn't mess with, but PKZIP doesn't handle that does it??)


fc /b old7za.exe 7za.exe

Comparing files old7za.exe and 7ZA.EXE
0004C66B: 03 00
0004C679: 03 00


No guarantees (and I highly doubt it) that it matches your binary's offsets. But just FYI! If you really want, I'll upload a p7zip 4.65 build for you (is -mtune=i686 -Os okay or what would you prefer??). I could also (weakly) try again for 9.13 is you want. I can do all that later tonight.

But at the very least, this should let you (or someone) rebuild by themselves. Grab my 7zip465s.zip "stable" sources (still not on FreeDOS' iBiblio section, ugh, they never updated past 4.61 "beta").

 

Complete thread:

Back to the forum
Board view  Mix view
22632 Postings in 2109 Threads, 402 registered users, 387 users online (0 registered, 387 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum