LAOLA lclean, $Date: 1997/10/25 01:15:05 $

# lclean

## Documentation

#### Version 1.0

lclean is a program that allows you to detect, save and clean the trash sections of OLE style documents.

Note: This program changes your document! If you use lclean, please keep a backup of the treated files, until you are sure they did not take any harm!

Why lclean?

- Microsoft's first and still most spreaded OLE implementations had bugs. One caused that some sections of documents that actually should be filled with zero bytes contained more or less private data.

- Management of OLE documents is difficult and takes a little time. A way to fasten this up is not to care about the old data, but simply to add the new data to the document. Clean up could be done later when there was time. When switched on the "fast save" option, Microsoft Word uses this strategy. So, thus saved files contain the new and the old version of a document. The old data cannot be edited any more and stays invisible in the document.

- Some programs seem to use the Microsoft OLE library not properly. For example, the Star Office 3.1. programs create documents, that always contain 1024 bytes of trash.

- As far as I know, Microsoft offers a bugfix for 32 bit Windows systems, only.

The program "lclean" can access this kind of garbage in OLE documents. To do this it uses the laola_modify_trash function of the "laola.pm" library. This library decides between four different types of trash. To understand them fully, you will have to look at the source code. In short:

1. Unused "big blocks". These blocks are not used by the document. Each of these blocks is 512 bytes long.
2. Unused "small blocks". These blocks are not used by the document. Each of these blocks is 64 bytes long.
3. File end space. This refers to the "streams" of an OLE document. The space is made up of all the space between the end of a stream and the end of a block.
4. System space. These sections are required by file format, though they are not used by OLE system. Actually this data is no garbage.

You can do several things:

Get a trash report
  lclean -r {document}
  Gives a little report about the trash in the document(s).

Clean the trash
  lclean -c [-n] {document}
  The trash sections will be cleaned. Unused blocks are filled with null bytes. System data will be cleaned with 0xff bytes. File end trash (type 4) will be cleaned with random bytes. When using switch -n, file end trash will be filled also with zero bytes (faster on files with lots of embedded objects).

Save the trash to files
  lclean -s [-a] [-d] [-z] {document}
  The trash sections will be saved to own files. They will be stored to an directory in your current directory. Normally it will be the directory "doctrash". E.g., if there is the example file "legacy.doc" the trashfiles will be stored as: "doctrash/legacy.tr1", "doctrash/legacy.tr2", "doctrash/legacy.tr3" and "doctrash/legacy.tr4".

  - When using switch -a, all trash will be stored into one big file "doctrash/legacy.tra".

  - When using switch -d, the trash file(s) will not be stored into directory "doctrash", but into each an own directory. E.g. into directory "legacy/".

  - When using switch -z, zero length files will not be created.

  Example: lclean -cs {document}
  This would first save all trash chunks into separate files into directory "doctrash", then it would clean the document.

Insert a file into the document (hide it)
  lclean -i <file> [-a] {document}
  Instead of trash, some <file> can thus be stored into the document. This file cannot be seen by the documents application. The file may of course not be bigger, than the size of the trash in your documents (plus 20 bytes plus the size to store the filename). Normally, only trash types 1 and 2 will be used for this. If they offer not enough space, with switch -a trash type 4 and 8 will be used, too.

  Example: lclean -aci <file> {document}
  This would first clean the document, then insert the hidden file by using all trash types.

List if there is a file inserted into the documents trash
  lclean -l {document}

Extract the hidden file
  lclean -e [-f] [-z] {document}
  This makes a copy of the hidden file. If the file got corrupted by what reason ever, it will not be extracted. The file will get the date of its last modification. If the file already exists, you will be prompted to overwrite it with the new extracted file. With switch -f you will not be prompted, but the file will be overwritten. With switch -z, no zero length files will be created.

Back to Laola Homepage.