Module: wine Branch: master Commit: 1a12141d8691df7df2a9526b097347b058154646 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1a12141d8691df7df2a9526b09...
Author: Vincent Povirk vincent@codeweavers.com Date: Fri Dec 4 15:32:16 2009 -0600
ole32: Add a test for modifying read-only substorage objects.
---
dlls/ole32/tests/storage32.c | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c index b5ecf22..b658a46 100644 --- a/dlls/ole32/tests/storage32.c +++ b/dlls/ole32/tests/storage32.c @@ -1348,7 +1348,7 @@ static void test_parent_free(void)
static void test_nonroot_transacted(void) { - IStorage *stg = NULL, *stg2 = NULL; + IStorage *stg = NULL, *stg2 = NULL, *stg3 = NULL; HRESULT r; IStream *stm = NULL; static const WCHAR stgname[] = { 'P','E','R','M','S','T','G',0 }; @@ -1398,7 +1398,26 @@ static void test_nonroot_transacted(void) IStorage_Release(stg2); }
- IStream_Release(stg); + /* create a read-only transacted substorage */ + r = IStorage_OpenStorage(stg, stgname, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED, NULL, 0, &stg2); + ok(r==S_OK, "IStorage->OpenStorage failed, hr=%08x\n", r); + + if (r == S_OK) + { + /* The storage can be modified. */ + r = IStorage_CreateStorage(stg2, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3); + todo_wine ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r); + if (r == S_OK) + IStream_Release(stg3); + + /* But changes cannot be committed. */ + r = IStorage_Commit(stg2, 0); + todo_wine ok(r==STG_E_ACCESSDENIED, "IStorage->Commit should fail, hr=%08x\n", r); + + IStorage_Release(stg2); + } + + IStorage_Release(stg);
/* create a non-transacted file */ r = StgCreateDocfile( filename, STGM_CREATE | STGM_SHARE_EXCLUSIVE |