Vincent Povirk : ole32: Forbid substorages of simple mode storages.
Alexandre Julliard
julliard at winehq.org
Fri Dec 4 09:11:28 CST 2009
Module: wine
Branch: master
Commit: cf5e6c571ad7b7a78289a116e9fdf2c2d7910997
URL: http://source.winehq.org/git/wine.git/?a=commit;h=cf5e6c571ad7b7a78289a116e9fdf2c2d7910997
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Wed Dec 2 11:28:09 2009 -0600
ole32: Forbid substorages of simple mode storages.
---
dlls/ole32/storage32.c | 11 +++++++++++
dlls/ole32/tests/storage32.c | 11 ++++++++++-
2 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 089206d..3991b9e 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -530,6 +530,12 @@ static HRESULT WINAPI StorageBaseImpl_OpenStorage(
goto end;
}
+ if (This->openFlags & STGM_SIMPLE)
+ {
+ res = STG_E_INVALIDFUNCTION;
+ goto end;
+ }
+
/* as documented */
if (snbExclude != NULL)
{
@@ -1022,6 +1028,11 @@ static HRESULT WINAPI StorageBaseImpl_CreateStorage(
if (ppstg == 0)
return STG_E_INVALIDPOINTER;
+ if (This->openFlags & STGM_SIMPLE)
+ {
+ return STG_E_INVALIDFUNCTION;
+ }
+
if (pwcsName == 0)
return STG_E_INVALIDNAME;
diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c
index 53811db..6e222c7 100644
--- a/dlls/ole32/tests/storage32.c
+++ b/dlls/ole32/tests/storage32.c
@@ -1774,9 +1774,10 @@ static void test_simple(void)
{
/* Tests for STGM_SIMPLE mode */
- IStorage *stg;
+ IStorage *stg, *stg2;
HRESULT r;
IStream *stm;
+ static const WCHAR stgname[] = { 'S','t','g',0 };
static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 };
static const WCHAR stmname2[] = { 'S','m','a','l','l',0 };
LARGE_INTEGER pos;
@@ -1789,6 +1790,10 @@ static void test_simple(void)
r = StgCreateDocfile( filename, STGM_SIMPLE | STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg);
ok(r == S_OK, "got %08x\n", r);
+ r = IStorage_CreateStorage(stg, stgname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stg2);
+ ok(r == STG_E_INVALIDFUNCTION, "got %08x\n", r);
+ if (SUCCEEDED(r)) IStorage_Release(stg2);
+
r = IStorage_CreateStream(stg, stmname, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm);
ok(r == STG_E_INVALIDFLAG, "got %08x\n", r);
r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm);
@@ -1853,6 +1858,10 @@ static void test_simple(void)
}
ok(r == S_OK, "got %08x\n", r);
+ r = IStorage_OpenStorage(stg, stgname, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, NULL, 0, &stg2);
+ ok(r == STG_E_INVALIDFUNCTION, "got %08x\n", r);
+ if (SUCCEEDED(r)) IStorage_Release(stg2);
+
r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stm);
ok(r == S_OK, "got %08x\n", r);
More information about the wine-cvs
mailing list