ole32: Fix up permissions when opening streams.
Fix up permissions when opening streams in storage objects when storage object has been opened in transacted mode.
This commit is contained in:
parent
54dfdb9b00
commit
c74e5a784d
|
@ -342,13 +342,16 @@ HRESULT WINAPI StorageBaseImpl_OpenStream(
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check that we're compatible with the parent's storage mode
|
* Check that we're compatible with the parent's storage mode, but
|
||||||
|
* only if we are not in transacted mode
|
||||||
*/
|
*/
|
||||||
parent_grfMode = STGM_ACCESS_MODE( This->ancestorStorage->base.openFlags );
|
parent_grfMode = STGM_ACCESS_MODE( This->ancestorStorage->base.openFlags );
|
||||||
if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) )
|
if(!(This->ancestorStorage->base.openFlags & STGM_TRANSACTED)) {
|
||||||
{
|
if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) )
|
||||||
res = STG_E_ACCESSDENIED;
|
{
|
||||||
goto end;
|
res = STG_E_ACCESSDENIED;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -472,13 +475,16 @@ HRESULT WINAPI StorageBaseImpl_OpenStorage(
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check that we're compatible with the parent's storage mode
|
* Check that we're compatible with the parent's storage mode,
|
||||||
|
* but only if we are not transacted
|
||||||
*/
|
*/
|
||||||
parent_grfMode = STGM_ACCESS_MODE( This->ancestorStorage->base.openFlags );
|
parent_grfMode = STGM_ACCESS_MODE( This->ancestorStorage->base.openFlags );
|
||||||
if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) )
|
if(!(This->ancestorStorage->base.openFlags & STGM_TRANSACTED)) {
|
||||||
{
|
if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) )
|
||||||
res = STG_E_ACCESSDENIED;
|
{
|
||||||
goto end;
|
res = STG_E_ACCESSDENIED;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -869,10 +875,13 @@ HRESULT WINAPI StorageBaseImpl_CreateStream(
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check that we're compatible with the parent's storage mode
|
* Check that we're compatible with the parent's storage mode
|
||||||
|
* if not in transacted mode
|
||||||
*/
|
*/
|
||||||
parent_grfMode = STGM_ACCESS_MODE( This->ancestorStorage->base.openFlags );
|
parent_grfMode = STGM_ACCESS_MODE( This->ancestorStorage->base.openFlags );
|
||||||
if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) )
|
if(!(parent_grfMode & STGM_TRANSACTED)) {
|
||||||
return STG_E_ACCESSDENIED;
|
if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) )
|
||||||
|
return STG_E_ACCESSDENIED;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the out parameter
|
* Initialize the out parameter
|
||||||
|
|
|
@ -608,6 +608,21 @@ static void test_storage_refcount(void)
|
||||||
r = IStream_Release(stm);
|
r = IStream_Release(stm);
|
||||||
ok (r == 0, "stream not released\n");
|
ok (r == 0, "stream not released\n");
|
||||||
|
|
||||||
|
/* test for grfMode open issue */
|
||||||
|
|
||||||
|
r = StgOpenStorage( filename, NULL, 0x00010020, NULL, 0, &stg);
|
||||||
|
ok(r==S_OK, "StgOpenStorage failed\n");
|
||||||
|
if(stg)
|
||||||
|
{
|
||||||
|
r = IStorage_OpenStream( stg, stmname, 0, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm );
|
||||||
|
ok(r == S_OK, "OpenStream should succeed\n");
|
||||||
|
|
||||||
|
todo_wine {
|
||||||
|
r = IStorage_Release(stg);
|
||||||
|
ok(r == 0, "wrong ref count\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DeleteFileW(filename);
|
DeleteFileW(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue