[Starkit] corruption of starkits by double access
Pat Thoyts
patthoyts at users.sourceforge.net
Mon Feb 27 11:21:48 CET 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Steve Landers wrote:
>
> On 27/02/2006, at 6:23 PM, Steve Blinkhorn wrote:
>
>> How can I prevent write-enabled starkits from being corrupted by being
>> accessed a second time whilst already being accessed? We are seeing
>> this as an occasional problem on Windows, where a user "loses" an open
>> window behind another application, and blithely double-clicks again.
>>
You can rewrite the bottom-most part of metakit and re-implement the
c4_FileStrategy. Doing this lets you gain full control of the win32 file
handle and you can then manage the locking via win32 with pretty fine
control. We have done this to use exclusive access on SMB shares as we
had occasional problem with memory mapping over the shared filesystems.
Roughly we now do:
HANDLE hFile = CreateFile(various win32 access options etc...);
c4_Win32FileStrategy *pStrategy = new c4_Win32FileStrategy(hFile);
c4_Storage *pStorage = new c4_Sorage(*pStrategy, false,
c4_View view = pStorage->GetAs(....);
we can then use choose the locking scheme in the CreateFile() call and
use LockFile later on. I can give you some code if it helps.
Pat Thoyts
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
iQCVAwUBRALgzGB90JXwhOSJAQifnQP7BmR8wCOXyODZNZjbzpYnN/gf+cb2zexb
4bDeaB9blTCGyiG+Uq8vqBHcSp259g+/NJWVfpaMFdGU1tRJZ6HmRIZ+EySxtN7X
bUxVJKahYve9n9k6xeI48QfPEbz1IL3uZs7/bgYGq8cVS+ctQ/rLYGSXoLsgS6vO
PYx06NRjhyQ=
=AzXR
-----END PGP SIGNATURE-----
More information about the Starkit
mailing list