improve OleFileIO_PL to write OLE files

Issue #6 closed
Philippe Lagadec repo owner created an issue

It would be a great improvement if OleFileIO was able to write OLE files, in order to modify or create them.

But this would require a lot of changes in the code. The main issues are the management of free sectors, the use of small vs. large streams, and the use of red-black trees to keep the stream names sorted (see reference documents about the OLE format).

I think the best order to add write features would be:

  1. write a single FAT sector in the file. => done in v0.32 (commit 54c820c)
  2. write stream data for an existing stream in FAT, same size. => done in v0.32 (commit ef34c24)
  3. write a single MiniFAT sector in the file
  4. write stream data for an existing stream in MiniFAT, same size.
  5. write the header
  6. write the FAT (and DIFAT), same size
  7. write the MiniFAT, same size
  8. write the directory, same size
  9. rename a stream/storage (no change to red-black tree)
  10. release a sector as unused
  11. allocate a new sector, extending the OLE file size and/or the FAT/MiniFAT if necessary
  12. trim down the file, removing unused sectors at the end
  13. write stream data for an existing stream, changing its size
  14. delete a stream/storage (requires to update the red-black tree)
  15. add a new storage in the directory
  16. add a new stream
  17. create a new OLE file from scratch

Please vote for this issue if you want to give it more priority.

Comments (7)

  1. a.woflheart

    What should be done for the "write stream data for an existing stream, changing its size" feature? Can you please advice how to handle the scenario where the original stream is in FAT sectors and the new one requires DIFAT? I would like to try to implement it.

  2. Log in to comment