Alexander Kochetkov : ole32/storage32: Fix return value for invalid access mode in OpenStream.

Alexandre Julliard julliard at winehq.org
Wed Dec 30 10:18:16 CST 2009


Module: wine
Branch: master
Commit: 56bc0515c2bd095764914631d614224763dc0623
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=56bc0515c2bd095764914631d614224763dc0623

Author: Alexander Kochetkov <al.kochet at gmail.com>
Date:   Wed Dec 30 03:54:20 2009 +0300

ole32/storage32: Fix return value for invalid access mode in OpenStream.

---

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

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 229fe76..e000535 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -448,7 +448,7 @@ static HRESULT WINAPI StorageBaseImpl_OpenStream(
   if(!(This->openFlags & STGM_TRANSACTED)) {
     if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( This->openFlags ) )
     {
-      res = STG_E_ACCESSDENIED;
+      res = STG_E_INVALIDFLAG;
       goto end;
     }
   }
diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c
index 19c1e8f..ceca756 100644
--- a/dlls/ole32/tests/storage32.c
+++ b/dlls/ole32/tests/storage32.c
@@ -355,6 +355,19 @@ static void test_storage_stream(void)
 
     r = IStorage_Release(stg);
     ok(r == 0, "wrong ref count\n");
+
+    /* try create some invalid streams */
+    stg = NULL;
+    stm = NULL;
+    r = StgOpenStorage(filename, NULL, STGM_READ | STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
+    ok(r == S_OK, "should succeed\n");
+    if (stg)
+    {
+        r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stm);
+        ok(r == STG_E_INVALIDFLAG, "IStorage->OpenStream should return STG_E_INVALIDFLAG instead of 0x%08x\n", r);
+        IStorage_Release(stg);
+    }
+
     r = DeleteFileA(filenameA);
     ok(r, "file should exist\n");
 }




More information about the wine-cvs mailing list