News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Raymond Chen: Why is Zip folders support stuck at the turn of the Century?

Started by jj2007, April 25, 2023, 08:52:48 PM

Previous topic - Next topic

jj2007

Raymond Chen, May 15th, 2018:
QuoteOne of the terms of the license is that the compression and decompression code for Zip folders should be tied to UI actions and not be programmatically drivable

There is C:\Windows\System32\zipfldr.dll but it's not really usable. There are several threads on the VB6 forum dealing with zipping files without external DLLs; one day, I'll try to port it to Assembly.

This is Micros*t: no zipping and unzipping because, well, that was a third party thing - too complicated for Redmond. Essential but simple functions such as zipping or the RichEdit control suck because apparently all the M$ staff is busy adding another gigabyte of useless crap to the C:\Windows\winsxs folder :cool:

P.S. unzipping is easy, here is code to install UAsm on your machine:

include \masm32\MasmBasic\MasmBasic.inc
  Init
  UnzipInit "http://www.terraspace.co.uk/uasm256_x64.zip" ; UnzipInit expects a filename or URL, returns #files in edx
  lea ecx, [edx-1]
  .Repeat
.if Instr_(Files$(ecx), "uasm64.exe")
.if Exist("\Masm32\bin\uasm64.exe")
PrintLine "Old: ", GfDate$(-1), Spc2$, GfTime$(-1), CrLf$, "New: ", GfDate$(ecx), Spc2$, GfTime$(ecx)
MsgBox 0, "Overwrite existing Uasm64.exe?", "Hi", MB_YESNO
.endif
.Break .if eax==IDNO
UnzipFile(ecx, Cat$(Left$(MbExeFolder$)+":\Masm32\bin\"))
MsgBox 0, "UAsm successfully installed", "Hi", MB_OK
.Break
.endif
dec ecx
  .Until Sign?
  UnzipExit
EndOfCode

NoCforMe

Quote from: jj2007 on April 25, 2023, 08:52:48 PM
This is Micros*t: no zipping and unzipping because, well, that was a third party thing - too complicated for Redmond.

I hate to defend Micro$oft, I really do, but according to what I read on Ray Chen's blog, it's a matter of contractual limitations, not laziness on Redmond's part:

Quote
Bonus chatter: On of the terms of the license is that the compression and decompression code for Zip folders should be tied to UI actions and not be programmatically drivable. The main product for the company that provided the compression and decompression code is the compression and decompression code itself. If Windows allowed programs to compress and decompression files by driving the shell namespace directly, then that company would have given away their entire business!
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on April 26, 2023, 02:18:33 AMit's a matter of contractual limitations, not laziness on Redmond's part

It's laziness, because they should have done it in-house. Zipping is a pretty essential feature of an OS.

Vortex

QuoteIt's laziness, because they should have done it in-house. Zipping is a pretty essential feature of an OS.

I agree with Jochen. The command prompt of Linux, the Terminal is providing the zip and unzip tool since long time.

daydreamer

Quote from: Vortex on April 26, 2023, 04:58:52 AM
QuoteIt's laziness, because they should have done it in-house. Zipping is a pretty essential feature of an OS.
I agree with Jochen. The command prompt of Linux, the Terminal is providing the zip and unzip tool since long time.
Even my latest android tablet provide zip and unzip
Most programmable driven I seen long ago a library that let's you read directly from zip files
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jj2007


mineiro

Quote from: jj2007 on April 26, 2023, 03:58:37 AM
Zipping is a pretty essential feature of an OS.

I disagree.

There's tons of source codes in internet about data compression. Dictionaries (LZ family), transformers (BWT,FIB), encoding (AC,ANS,Huffman), PPM (predict partial match), joining A.I (slow processing) to this context mixing and entropy of target model is reach.

The entropy can be reached (arithmetic coding, asymmetric numeral system, and under some circumstances Huffman). The main problem until today is the used model. The best model (universal model) cannot be predicted.

So, the real question is:
Why should be ZIP?
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

TimoVJL

May the source be with you

jj2007

My favourite is tinf.lib, it weighs in at 3,662 bytes and can be asked from Assembly to extract a file:
include \masm32\MasmBasic\MasmBasic.inc
  Init
  UnzipInit "http://www.jj2007.eu/Bible.zip"
  UnzipFile(0, "C:\Masm32")     ; extract C:\Masm32\Bible.txt
EndOfCode


Unfortunately, it does only unzipping, but no compression. That's why I am looking for a tiny compression library.


Quote from: mineiro on April 26, 2023, 10:50:10 PMThere's tons of source codes in internet about data compression.

Great. Can you post Assembly code that compresses some files using one of these source codes?

mineiro

I prefer paq series.
https://mattmahoney.net/dc/paq.html

Z sound to be the default these days by big techs.
https://mattmahoney.net/dc/zpaq.html

Well, I know it's outside this scope, but look for big bang theory.
James Webb discovered some galaxies that should not exist following actual model (3.4 to 3.6 billions years). So, this means that to a galaxy be created it's necessary time and by discovering that galaxies means that model is wrong.
What scientists will do? Well, update forever the model at each new discoveries found. Or just throw away this model and select other.
That's the importance of model in science (also data compression).
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

mineiro

Quote from: jj2007 on April 26, 2023, 10:55:12 PM
Great. Can you post Assembly code that compresses some files using one of these source codes?
Oh, really sorry, I only read this now.
Yes, give to me 2 days and I can release. Well, I will release to linux, is this ok? (having in mind that will be translated to windows). I have some of these codes here, I only need find and polish.
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

mineiro

This is what I found in this pc, only 2 compression/decompression programs.
One is Arithmetic Coding model order 0, byte based chars
Other is Dynamic Markov Chain with Guazzo arithmetic coding, bit based char.

I have tried to clean and comment the most that I can but probably have variables not used in source code.
I used uasm version 255 in linux x86_64.

PS: If you try to compress a big file (above 100MB), have in mind that dmc can fail. I think that the reason is lost of SIMD (real4 or real8) accuracy. But you can divide that giant file in N byte blocks and compress each block as an alternative.
PS2: The most easy to play and change is ac. Try order 1 model (digraphs) or 3 (trigraphs) and compression will be better.  Actual compression result is not the best, but this example is the best to be changed.
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

jj2007

Great stuff, mineiro, but what I wanted is
a) a library that works under Windows
b) a library that understands invoke AddToZipArchive, pZipfile, pAddfile

Can you write a little wrapper, please?

I need it for zipping only; for unzipping, I have already UnzipFile:

include \masm32\MasmBasic\MasmBasic.inc
  Init
  UnzipInit "http://www.jj2007.eu/Bible.zip" ; file or URL
  UnzipFile(0, "C:\Masm32") ; extract C:\Masm32\Bible.txt
EndOfCode

mineiro

I'm not playing with Zip sir jj2007, I don't know how their header work, to me will be hard to create something and be compatible with zip standards.
I think I can't do this.
If I found some usable windows library (.dll) in internet and do some tests that work then I come back. But for a while, I can't.

I'd rather be this ambulant metamorphosis than to have that old opinion about everything

morgot

I also don't understand why winapi doesn't have any ZIP-archiving function. There is a lot of garbage like "infrared sockets", but this is not. There is rtldecopressbuffer api, which is absolutely stupid and incompatible with anything.
Sorry for the bad English