c++structured-storage

StgOpenStorageEx returns STG_E_FILEALREADYEXISTS


I was struggling attempting to find out why StgOpenStorageEx returns STG_E_FILEALREADYEXISTS on a compound document when opening it for readonly. It didn't make sense. The file was there and I wasn't trying to create anything. Just open it up. I couldn't find an answer online so I thought I would share the answer I found here.


Solution

  • StgOpenStorageEx returns STG_E_FILEALREADYEXISTS when the file is not a compound document.

    In my situation I was having a problem with encrypting and decrypting content so my compound document that I was creating was invalid. It wasn't a compound document at all.