Dr J A Gow : ole32: Fix up permissions when opening streams.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Feb 21 05:04:08 CST 2006
Module: wine
Branch: refs/heads/master
Commit: c74e5a784d9fcda57c428f325e61688c1d7ffee5
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=c74e5a784d9fcda57c428f325e61688c1d7ffee5
Author: Dr J A Gow <J.A.Gow at furrybubble.co.uk>
Date: Tue Feb 21 17:02:04 2006 +0900
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.
---
dlls/ole32/storage32.c | 33 +++++++++++++++++++++------------
dlls/ole32/tests/storage32.c | 15 +++++++++++++++
2 files changed, 36 insertions(+), 12 deletions(-)
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 8512667..08084e4 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -342,13 +342,16 @@ HRESULT WINAPI StorageBaseImpl_OpenStrea
}
/*
- * 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 );
- if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) )
- {
- res = STG_E_ACCESSDENIED;
- goto end;
+ if(!(This->ancestorStorage->base.openFlags & STGM_TRANSACTED)) {
+ if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) )
+ {
+ res = STG_E_ACCESSDENIED;
+ goto end;
+ }
}
/*
@@ -472,13 +475,16 @@ HRESULT WINAPI StorageBaseImpl_OpenStora
}
/*
- * 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 );
- if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) )
- {
- res = STG_E_ACCESSDENIED;
- goto end;
+ if(!(This->ancestorStorage->base.openFlags & STGM_TRANSACTED)) {
+ if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) )
+ {
+ res = STG_E_ACCESSDENIED;
+ goto end;
+ }
}
/*
@@ -869,10 +875,13 @@ HRESULT WINAPI StorageBaseImpl_CreateStr
/*
* 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 );
- if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) )
- return STG_E_ACCESSDENIED;
+ if(!(parent_grfMode & STGM_TRANSACTED)) {
+ if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) )
+ return STG_E_ACCESSDENIED;
+ }
/*
* Initialize the out parameter
diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c
index 07aaf11..b4edf13 100644
--- a/dlls/ole32/tests/storage32.c
+++ b/dlls/ole32/tests/storage32.c
@@ -608,6 +608,21 @@ static void test_storage_refcount(void)
r = IStream_Release(stm);
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);
}
More information about the wine-cvs
mailing list