7-Zip Editing & MoW

Published: 2022-07-09
Last Updated: 2022-07-09 08:42:28 UTC
by Didier Stevens (Version: 1)
0 comment(s)

While doing tests for my diary entries "7-Zip & MoW" and "7-Zip & MoW: "For Office files"", I observed that the MoW is removed when you edit a ZIP file with 7-Zip.

That's because 7-Zip creates a new file when editing a file, and then replaces the original file with the new file. Many programs that edit files do this.

So, I start with a folder with 2 text files and 1 ZIP file containing the first text file:

I add a Zone.Identifier ADS with my ZoneIdentifier.exe tool:

I check for the presence of the MoW:

I edit the ZIP file with 7-Zip:

To add the second text file:

And now the MoW is gone:

That's because a new ZIP file was created, and the previous one (with ADS) was deleted.

This can be observed with Process Monitor:

This is a method that many programs use: "save edited file as a new file, delete original file, rename new file to original file".

Office does this too. But Word will copy the ZoneIdentifier ADS over to the new file (at least, Word 2021 does):

To be clear: I'm not saying 7-Zip should be changed to keep the MoW when editing. But this is a good occasion to illustrate the fact that many eidting programs don't actualy modify the original file, but a "copy" of the original file.

This has impact on file permissions too, for example. Long time ago, I had a client that put a specific security descriptor on a Word document, but each time the file was edited, that specific SD was replaced by a default SD for the containing folder.

That's because each time the file was saved, Word would deleted the original file, and thus the SD with it.


Didier Stevens
Senior handler
Microsoft MVP

Keywords: 7zip editing mow
0 comment(s)


Diary Archives