zlib comes along with a simple example on how to deflate/inflate from file to file. I have translated the C source to Masm syntax, and the code does apparently compress files, but after a few hundred (625 ... 1725) correct characters the re-extracted file contains garbage.
Since I am a noob at C, there may be errors in my translation. Otherwise the zlib1.dll is buggy, or WinZip has problems with the format ...
Any ideas? Can somebody test the C version to see if it works correctly?
Quote from: jj2007 on November 29, 2010, 12:14:51 AM
zlib comes along with a simple example on how to deflate/inflate from file to file. I have translated the C source to Masm syntax, and the code does apparently compress files, but after a few hundred (625 ... 1725) correct characters the re-extracted file contains garbage.
Since I am a noob at C, there may be errors in my translation. Otherwise the zlib1.dll is buggy, or WinZip has problems with the format ...
Any ideas? Can somebody test the C version to see if it works correctly?
In all file-opening functions use "
x+b" where
x is
r or
w.
I.e.
invoke crt_fopen, chr$("windows.gz"), chr$("w+b")
Otherwice you write in text-mode, and LF was translated to CRLF, and tabs to spaces probably (depend on runtime).
Alex
The C source needs a #include "zlib.h" that is not included in your zip,
I can't compile it.
Quote from: Antariy on November 29, 2010, 12:19:58 AMIn all file-opening functions use "x+b" where x is r or w.
You are a genius, Alex :U
(and I finally know why I never used the sh*tty crt file io)
Quote from: jj2007 on November 29, 2010, 12:40:51 AM
(and I finally know why I never used the sh*tty crt file io)
I has not used zlib yet, too.
I wonder why (using code posted here (http://www.masm32.com/board/index.php?topic=15439.msg126628#msg126628)) the results obtained with the IIS and the zlib versions of gzip differ so dramatically, in terms of compression ratio (using \masm32\include\Windows.inc as source):
Quote163165 C:\WINDOWS\system32\inetsrv\gzip.dll with MichaelW's code
172001 zlib1.dll with my code, maximum compression level
What bothers me in both versions is that the gzip format (http://www.gzip.org/zlib/rfc-gzip.html#file-format) apparently does not allow to include a directory tree...
This one seem of real interest
http://www.xstandard.com/en/documentation/xzip/
include file for masm in the zip
Help files is in the typelib of the ocx and I have got something more
Those can be useful
Quote
sLIBID_XZip TEXTEQU <{07E380ED9h,0C7ECh,046F7h,{099h,071h,0CCh,012h,0EEh,0D1h,0F3h,07Fh}}>
sIID_IZip TEXTEQU <{00B2D411Bh,07A91h,0483Ah,{095h,0C4h,053h,0DDh,0C6h,0B1h,078h,095h}}>
sIID_IItems TEXTEQU <{01054B56Dh,0FB5Fh,04CA0h,{09Eh,066h,002h,074h,077h,017h,09Fh,0BBh}}>
sIID_IItem TEXTEQU <{00842A022h,02D96h,0470Dh,{084h,018h,020h,0E2h,083h,0EFh,017h,0DCh}}>
sCLSID_Zip TEXTEQU <{013D6BDE3h,046AAh,04FF2h,{0A6h,022h,0EBh,0C4h,031h,010h,0D9h,05Ch}}>
sCLSID_Items TEXTEQU <{012925CF7h,003E6h,04FFAh,{0ADh,08Ch,09Bh,0F6h,019h,055h,061h,04Fh}}>
sCLSID_Item TEXTEQU <{04379C5C3h,0D457h,04D61h,{086h,09Eh,0C2h,0E5h,0F8h,082h,099h,023h}}>
This one work well for me
Here is a sample who work with the windows.inc
I have not tested all the functions.
You need to modify the path in the source file
Not included:
E:\xzip\XZip.dll
You can have it at this link
http://www.xstandard.com/en/documentation/xzip/
It isn't mine.There is also sample of use in script on the site.Things are really well done.
To add a relative path added to the compress file (testb here)
Quote
invoke GetInterfaceFromProgId,SADR("XStandard.Zip"),addr IID_IZip
.if eax != 0
mov ppvIZip,eax
;IZip UnPack,SADR("E:\xzip\test.zip"),SADR("E:\xzip"),BSTR("chaineNull")
mov truc.n1.n2.vt,VT_BSTR ;<<<<<<<<<<<<<<<<
mov truc.n1.n2.n3.bstrVal,0 ;FUNC(CreateBstr,SADR("rien"))
invoke CreateBstr,SADR("E:\xzip\test\Xzip.IDL")
mov bstrfile,eax
invoke CreateBstr,SADR("E:\xzip\essai.zip")
mov bstrarch,eax
IZip Pack,bstrfile,bstrarch,addr truc,BSTR("testb"),6
IZip Release
invoke FreeBSTR
.endif
Xzip works but with 177,584 bytes for Windows.inc it is less efficient than gzip.dll (163,186). And MasmBasic will soon zip Windows.inc to a mere 133,149 bytes :bg
Just to throw a spanner in the works, JIBZ has released his aPlib as freeware last I heard and from memory it outperforms zip compression on most files.
:lol meh roll your own.... I only use these tools because it is a web standard.... If I need to compress something I prefer to do it properly :lol
As free compressor there is also the zipitfree who haven't advertisement as JIBZ.
What I search is just something that is compatible with others compressor and can be used by an another program.The xzip do that.To compress some source code it's largely enough.No need of big compression level.
Quote from: jj2007 on November 29, 2010, 08:43:01 PM
MasmBasic will soon zip Windows.inc to a mere 133,149 bytes :bg
It works (http://www.masm32.com/board/index.php?topic=12460) :bg
Quoteinclude \masm32\MasmBasic\MasmBasic.inc
Init[/color]
GetFiles "\Masm32\include\Windows.inc"
ZipFiles "WinInc"
Inkey Str$("%i files compressed, new size=", ZipFilesArchived), Str$(Lof("WinInc.arc"))
Exit
end start
QuoteFreeArc 0.666 creating archive: WinInc.arc
Compressed 1 file, 849,788 => 130,870 bytes. Ratio 15.4%
Compression time: cpu 1.16 secs, real 1.22 secs. Speed 697 kB/s
All OK
1 files compressed, new size=133117
Compliments Jochen :U
There is just to open a contest,The more little windows.inc possible. :P
I begin the contest 7zip, give a windows.inc at 137Ko can be better with gif and other files.
Can Use a command line and there is only to get the "Execute_Independant_Win" proc who is in this forum,to command it.There is a Help file for the syntax.
7zip is not so bad, I actually use it in another context. But FreeArc is slightly better at 133117 bytes.
Not to mention my other candidate: 121,910 :green
Quote7zip is not so bad
He is at the first place for mixed formats.
Quote from: ToutEnMasm on November 30, 2010, 05:20:45 PM
Quote7zip is not so bad
He is at the first place for mixed formats.
Strange, I thought it was on rank
52 for mixed formats (http://www.maximumcompression.com/data/summary_mf.php#data)...
First of free
http://rlwpx.free.fr/WPFF/comploc.htm
Seems there is much to discuss about this.
that tells you how much the method used may infuence the outcome of a study
we see it the politcal arena all the time :P
what is the best chocolate ?
well - if the study is conducted by a group that is funded by an individual that owns shares in Hershey.....
anyways - there are a lot of variables here
speed - both compress and decompress
compression ratio
then - different files will compress differently with different algos
careful selection of the test file mix can make one method look better than another
at the end of the study cited by Yves, i noticed he recommended 7Zip for GIF files
well - DUH! - they are already LZW compressed - lol
Im waiting to see when we will hear from Sergiu's and his 100-1 compresser (http://www.masm32.com/board/index.php?topic=13454.msg105090#msg105090) in relation to this topic :D
:bg
I think he may have kept that secret to himself. Some technology is worth hiding. :P
i figure he is still working out the bugs :P
once he gets it up and running, he'll be back
Quote from: dedndave on December 01, 2010, 10:47:19 PM
i figure he is still working out the bugs :P
once he gets it up and running, he'll be back
A Google search for
Sergiu shares did not reveal any exciting economic developments. But Urban Dictionary (http://www.urbandictionary.com/define.php?term=sergiu) know him :green2
the lasting effects of too much compression...
(http://img257.imageshack.us/img257/3711/sergiu.jpg)
I have a theory that he will return to the board in 8 years with the original data to claim his title.... Relative compression utilising Kryder's Law http://en.wikipedia.org/wiki/Mark_Kryder he was a physicist after all
For fun,the attached file divide the size of the compressor by 1000.
In fact,he use the IMakeCab interface.
Usage is very simple:
He ask for a directory and that all.
The compressed file is put in the upper directory and get the name of the compressed directory.
Relative path are added to the compressed files.
All *.asm files in \masm32\m32lib:
177,216 WinZip max portable
72,594 CabIt
53,773 MasmBasic ZipFiles
Not bad for such an old format... but WinZip's performance is a shame :red
Old things can surprise...
And it can be easily added to another program...
Source code can be found but only in french.
Quote from: ToutEnMasm on December 05, 2010, 01:26:22 PM
Source code can be found but only in french.
Uh oh :lol not French logic :bg
(http://img684.imageshack.us/img684/5320/heavenr.gif)
Quote from: ToutEnMasm on December 05, 2010, 01:26:22 PM
Old things can surprise...
And it can be easily added to another program...
Source code can be found but only in french.
Of course, that's woud be nice to see sources (if it is available).
Ok,here are the source code
There is two directory
First directory show how to translate a typelib for masm
-get a .idl file with Oleview
-Translate it for the C++ with midl (get .h and a .c)
-Translate .h .c for masm with the translator downloadable
in the masm32 forum,windows.inc subforum.
Second directory is the source code itself
The .asm show the needed loop for the Imakecab interface
The Interface use only VARIANT,and it's a good sample
for that.
The include files are all designed to work in various prog.
So there is some code not used.
Useful trick,rename the .cab in .zip,he can be unpack by other compressor,7zip made it.
The .zip is smaller like that (35%).
i've found the cabinet api reference, it looks like plain old C so it should be no problem to create .inc files.
http://msdn.microsoft.com/en-us/library/ff797923%28v=VS.85%29.aspx
also there is something called the CABSDK that may be worth a look although its no longer available to download from microsoft
The cab sdk couldn't be found now,it is part of the windows installer now who is part of the windows sdk.
There is two headers of interest,fci.h and fdi.h (compression and decompression) both are translate in the "ready to use sdk" in the masm32 forum,windows.inc subforum.
thanks, i actually have your translated sdk somewhere on my hdd. gonna have a look at that now :U
There appears to be a static library version of zlib included with the updatechecker addin source example for masm projects in KetilO's RadASM v3.x distribution.
i ran across this one....
it's open source (Pascal :P )
http://www.peazip.org/peazip-free-archiver.html
might find some useful info