Click here to Skip to main content
15,886,740 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have a problem where I think the MS StructuredStorage implementation is showing a really weird behaviour. I had this code working at some point, but I can't seem to find what's broken it...

I open a StructuredStorage, open some streams and write some stuff, then I want to temporarily close the file to rename the folder that contains the file. I do that by Release()ing all the IStorage pointers i have and looking at the memory that it points to I see that it is being overwritten (my debug heap does that when memory is freed).

Still the directory could not be renamed, so I looked in Process Explorer to see if the handle was closed and here is the beginning of the things I don't understand. Before I release the IStorage my process has a HANDLE to the file, but when the IStorage is deleted, the file still shows up if I search for handles, but now it is marked as a DLL! What does that mean? Is it mapped into the memory of my process in some way?

The next weird thing is that after I try to rename the folder (even though I failed) I try to re-open the file, which works fine although I always open the files with STGM_SHARE_EXCLUSIVE. Normally if I fail to release a file completely I cannot open it up again later but this works and looking in Process Explorer again a new handle has been opened, but the DLL is still there?

So I guess my first question is: What does it mean that it shows up as a DLL in process explorer? Maybe I can work my way from there...
Posted

1 solution

Ok, I just found out myself after hours of head-scratching. Turns out I opened a storage twice and the first pointer was overwritten. Releasing it first made everythnig work again. Seems like the storages are opened with some kind of file mapping into the process. Well well...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900