Commit cf5e6c57 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

ole32: Forbid substorages of simple mode storages.

parent e48f4253
...@@ -530,6 +530,12 @@ static HRESULT WINAPI StorageBaseImpl_OpenStorage( ...@@ -530,6 +530,12 @@ static HRESULT WINAPI StorageBaseImpl_OpenStorage(
goto end; goto end;
} }
if (This->openFlags & STGM_SIMPLE)
{
res = STG_E_INVALIDFUNCTION;
goto end;
}
/* as documented */ /* as documented */
if (snbExclude != NULL) if (snbExclude != NULL)
{ {
...@@ -1022,6 +1028,11 @@ static HRESULT WINAPI StorageBaseImpl_CreateStorage( ...@@ -1022,6 +1028,11 @@ static HRESULT WINAPI StorageBaseImpl_CreateStorage(
if (ppstg == 0) if (ppstg == 0)
return STG_E_INVALIDPOINTER; return STG_E_INVALIDPOINTER;
if (This->openFlags & STGM_SIMPLE)
{
return STG_E_INVALIDFUNCTION;
}
if (pwcsName == 0) if (pwcsName == 0)
return STG_E_INVALIDNAME; return STG_E_INVALIDNAME;
......
...@@ -1774,9 +1774,10 @@ static void test_simple(void) ...@@ -1774,9 +1774,10 @@ static void test_simple(void)
{ {
/* Tests for STGM_SIMPLE mode */ /* Tests for STGM_SIMPLE mode */
IStorage *stg; IStorage *stg, *stg2;
HRESULT r; HRESULT r;
IStream *stm; 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 stmname[] = { 'C','O','N','T','E','N','T','S',0 };
static const WCHAR stmname2[] = { 'S','m','a','l','l',0 }; static const WCHAR stmname2[] = { 'S','m','a','l','l',0 };
LARGE_INTEGER pos; LARGE_INTEGER pos;
...@@ -1789,6 +1790,10 @@ static void test_simple(void) ...@@ -1789,6 +1790,10 @@ static void test_simple(void)
r = StgCreateDocfile( filename, STGM_SIMPLE | STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg); r = StgCreateDocfile( filename, STGM_SIMPLE | STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg);
ok(r == S_OK, "got %08x\n", r); 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); r = IStorage_CreateStream(stg, stmname, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm);
ok(r == STG_E_INVALIDFLAG, "got %08x\n", r); ok(r == STG_E_INVALIDFLAG, "got %08x\n", r);
r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm); r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm);
...@@ -1853,6 +1858,10 @@ static void test_simple(void) ...@@ -1853,6 +1858,10 @@ static void test_simple(void)
} }
ok(r == S_OK, "got %08x\n", r); 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); r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stm);
ok(r == S_OK, "got %08x\n", r); ok(r == S_OK, "got %08x\n", r);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment