ole32: Forbid opening the same storage twice.
This commit is contained in:
parent
d3c0a3a829
commit
c62a4ad841
|
@ -113,6 +113,7 @@ static BOOL StorageImpl_ReadDWordFromBigBlock( StorageImpl* This,
|
||||||
ULONG blockIndex, ULONG offset, DWORD* value);
|
ULONG blockIndex, ULONG offset, DWORD* value);
|
||||||
|
|
||||||
static BOOL StorageBaseImpl_IsStreamOpen(StorageBaseImpl * stg, DirRef streamEntry);
|
static BOOL StorageBaseImpl_IsStreamOpen(StorageBaseImpl * stg, DirRef streamEntry);
|
||||||
|
static BOOL StorageBaseImpl_IsStorageOpen(StorageBaseImpl * stg, DirRef storageEntry);
|
||||||
static void StorageInternalImpl_Invalidate( StorageInternalImpl *This );
|
static void StorageInternalImpl_Invalidate( StorageInternalImpl *This );
|
||||||
|
|
||||||
/* OLESTREAM memory structure to use for Get and Put Routines */
|
/* OLESTREAM memory structure to use for Get and Put Routines */
|
||||||
|
@ -579,6 +580,13 @@ static HRESULT WINAPI StorageBaseImpl_OpenStorage(
|
||||||
if ( (storageEntryRef!=DIRENTRY_NULL) &&
|
if ( (storageEntryRef!=DIRENTRY_NULL) &&
|
||||||
(currentEntry.stgType==STGTY_STORAGE) )
|
(currentEntry.stgType==STGTY_STORAGE) )
|
||||||
{
|
{
|
||||||
|
if (StorageBaseImpl_IsStorageOpen(This, storageEntryRef))
|
||||||
|
{
|
||||||
|
/* A single storage cannot be opened a second time. */
|
||||||
|
res = STG_E_ACCESSDENIED;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
newStorage = StorageInternalImpl_Construct(
|
newStorage = StorageInternalImpl_Construct(
|
||||||
This->ancestorStorage,
|
This->ancestorStorage,
|
||||||
grfMode,
|
grfMode,
|
||||||
|
@ -1875,6 +1883,21 @@ static BOOL StorageBaseImpl_IsStreamOpen(StorageBaseImpl * stg, DirRef streamEnt
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL StorageBaseImpl_IsStorageOpen(StorageBaseImpl * stg, DirRef storageEntry)
|
||||||
|
{
|
||||||
|
StorageInternalImpl *childstg;
|
||||||
|
|
||||||
|
LIST_FOR_EACH_ENTRY(childstg, &stg->storageHead, StorageInternalImpl, ParentListEntry)
|
||||||
|
{
|
||||||
|
if (childstg->base.storageDirEntry == storageEntry)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void StorageBaseImpl_DeleteAll(StorageBaseImpl * stg)
|
static void StorageBaseImpl_DeleteAll(StorageBaseImpl * stg)
|
||||||
{
|
{
|
||||||
struct list *cur, *cur2;
|
struct list *cur, *cur2;
|
||||||
|
|
|
@ -1060,13 +1060,13 @@ static void test_substorage_share(void)
|
||||||
if (r == S_OK)
|
if (r == S_OK)
|
||||||
{
|
{
|
||||||
r = IStorage_OpenStorage(stg, stgname, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
|
r = IStorage_OpenStorage(stg, stgname, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
|
||||||
todo_wine ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStorage should fail %08x\n", r);
|
ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStorage should fail %08x\n", r);
|
||||||
|
|
||||||
if (r == S_OK)
|
if (r == S_OK)
|
||||||
IStorage_Release(stg3);
|
IStorage_Release(stg3);
|
||||||
|
|
||||||
r = IStorage_OpenStorage(stg, stgname, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
|
r = IStorage_OpenStorage(stg, stgname, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
|
||||||
todo_wine ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStorage should fail %08x\n", r);
|
ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStorage should fail %08x\n", r);
|
||||||
|
|
||||||
if (r == S_OK)
|
if (r == S_OK)
|
||||||
IStorage_Release(stg3);
|
IStorage_Release(stg3);
|
||||||
|
|
Loading…
Reference in New Issue