15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


COleDocuement::EnableCompoundFile()

Alexander Walsh -- sandy@andyne.com
Monday, November 25, 1996

Environment: VC 4.1, NT 3.51, Win 95

Hey! What's up with COleDocuement::EnableCompoundFile()?!

If I enable a document to use structured storage, then only one
application can open it at a time?!

If I create a file and place it on a file server, then one client opens
it with an MFC app that used COleDocuement::EnableCompoundFile(), then
no other instance of the app can access the file?!

It seems that the SHARE_EXCLUSIVE flag gets set and never reset. Perhaps
due to the IRootStorage that gets created?! Could it be?!

Dean? Mike? What's up with that?! More importantly, how can I fix it?!
-Sandy
-- 
----
Alexander (Sandy) Walsh      | I hope I die peacefully in my sleep
Project Lead - GQL Reports   | like my Dad ... and not screaming
Andyne Computing Ltd         | hysterically like his passengers.



Erik Funkenbusch -- chucks@isd.net
Tuesday, November 26, 1996

The problem here is that the current implementation of compound files does
not work very well in a multi-user environment. Trying to force MFC to use
it is probably a losing battle, you'd end up having to override a lot of
functionality in order to get it to work.

The inherant problem is that streams must be opened exclusively in OLE 2. 
You can open a storage in shared mode, but it will make a copy of the
storage (and all of it's substorages unless you do a lot of support work). 


Now, the big problem:  If two apps have the same storage open, and one
Commits a change, you have to completely read in that storage and reapply
any changes you have made to your copy of the storage even if the changes
are in seperate streams.  If you do not, you will overwrite all the changes
made by the first program with your copy of those streams.

Additionally, you should open the file in transacted mode and set the flags
that warn you if the stream has changed (i forget the exact details, i'm
trying to remember work I did 2 years ago).

It's really not a very pretty task, and takes a long time to debug. 
Additionally, we noticed some very strange stability problem when doing
this and had some strangely corrupted files when we didn't get the locking
right...

My suggestion is, if you can live without mult-user support do it.  If you
can't, use normal dos files instead.

----------
> From: Alexander Walsh 
> To: mfc-l@netcom.com
> Subject: COleDocuement::EnableCompoundFile()
> Date: Monday, November 25, 1996 4:18 PM
> 
> Environment: VC 4.1, NT 3.51, Win 95
> 
> Hey! What's up with COleDocuement::EnableCompoundFile()?!
> 
> If I enable a document to use structured storage, then only one
> application can open it at a time?!
> 
> If I create a file and place it on a file server, then one client opens
> it with an MFC app that used COleDocuement::EnableCompoundFile(), then
> no other instance of the app can access the file?!
> 
> It seems that the SHARE_EXCLUSIVE flag gets set and never reset. Perhaps
> due to the IRootStorage that gets created?! Could it be?!
> 
> Dean? Mike? What's up with that?! More importantly, how can I fix it?!
> -Sandy
> -- 
> ----
> Alexander (Sandy) Walsh      | I hope I die peacefully in my sleep
> Project Lead - GQL Reports   | like my Dad ... and not screaming
> Andyne Computing Ltd         | hysterically like his passengers.




| Вернуться в корень Архива |