Robert Shearman : ole32: Check that the storage was opened with write access before creating a new stream or sub-storage .

Alexandre Julliard julliard at wine.codeweavers.com
Fri May 5 15:24:17 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 693da8c47152187d6ba210a0f63168ad95040187
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=693da8c47152187d6ba210a0f63168ad95040187

Author: Robert Shearman <rob at codeweavers.com>
Date:   Wed May  3 14:49:17 2006 +0100

ole32: Check that the storage was opened with write access before creating a new stream or sub-storage.

---

 dlls/ole32/storage32.c       |   10 ++++++++++
 dlls/ole32/tests/storage32.c |    2 --
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 79362b5..18f248c 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -914,6 +914,11 @@ HRESULT WINAPI StorageBaseImpl_CreateStr
     else
       return STG_E_FILEALREADYEXISTS;
   }
+  else if (STGM_ACCESS_MODE(This->openFlags) == STGM_READ)
+  {
+    WARN("read-only storage\n");
+    return STG_E_ACCESSDENIED;
+  }
 
   /*
    * memset the empty property
@@ -1120,6 +1125,11 @@ HRESULT WINAPI StorageImpl_CreateStorage
       return STG_E_FILEALREADYEXISTS;
     }
   }
+  else if (STGM_ACCESS_MODE(This->base.openFlags) == STGM_READ)
+  {
+    WARN("read-only storage\n");
+    return STG_E_ACCESSDENIED;
+  }
 
   /*
    * memset the empty property
diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c
index 37492ed..1936150 100644
--- a/dlls/ole32/tests/storage32.c
+++ b/dlls/ole32/tests/storage32.c
@@ -719,10 +719,8 @@ static void test_storage_refcount(void)
         r = IStorage_CreateStorage( stg2, stgname2, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, 0, &stg3 );
         ok(r == STG_E_ACCESSDENIED, "CreateStorage should have returned STG_E_ACCESSDENIED instead of 0x%08lx\n", r);
 
-        todo_wine {
         r = IStorage_CreateStream( stg2, stmname2, STGM_CREATE|STGM_SHARE_EXCLUSIVE, 0, 0, &stm );
         ok(r == STG_E_ACCESSDENIED, "CreateStream should have returned STG_E_ACCESSDENIED instead of 0x%08lx\n", r);
-        }
 
         IStorage_Release(stg2);
 




More information about the wine-cvs mailing list