Commit 16dc0378 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

ole32: In simple mode keep the stream size above the small block limit.

parent 02fc79b2
...@@ -575,6 +575,10 @@ static HRESULT WINAPI StgStreamImpl_SetSize( ...@@ -575,6 +575,10 @@ static HRESULT WINAPI StgStreamImpl_SetSize(
return STG_E_ACCESSDENIED; return STG_E_ACCESSDENIED;
} }
/* In simple mode keep the stream size above the small block limit */
if (This->parentStorage->ancestorStorage->base.openFlags & STGM_SIMPLE)
libNewSize.u.LowPart = max(libNewSize.u.LowPart, LIMIT_TO_USE_SMALL_BLOCK);
if (This->streamSize.u.LowPart == libNewSize.u.LowPart) if (This->streamSize.u.LowPart == libNewSize.u.LowPart)
return S_OK; return S_OK;
......
...@@ -1354,6 +1354,7 @@ static void test_simple(void) ...@@ -1354,6 +1354,7 @@ static void test_simple(void)
HRESULT r; HRESULT r;
IStream *stm; IStream *stm;
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 };
LARGE_INTEGER pos; LARGE_INTEGER pos;
ULARGE_INTEGER upos; ULARGE_INTEGER upos;
DWORD count; DWORD count;
...@@ -1400,6 +1401,19 @@ static void test_simple(void) ...@@ -1400,6 +1401,19 @@ static void test_simple(void)
IStream_Release(stm); IStream_Release(stm);
r = IStorage_CreateStream(stg, stmname2, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm);
ok(r == S_OK, "got %08x\n", r);
upos.QuadPart = 100;
r = IStream_SetSize(stm, upos);
ok(r == S_OK, "got %08x\n", r);
r = IStream_Write(stm, "foo", 3, &count);
ok(r == S_OK, "got %08x\n", r);
ok(count == 3, "got %d\n", count);
IStream_Release(stm);
IStorage_Commit(stg, STGC_DEFAULT); IStorage_Commit(stg, STGC_DEFAULT);
IStorage_Release(stg); IStorage_Release(stg);
...@@ -1415,6 +1429,16 @@ static void test_simple(void) ...@@ -1415,6 +1429,16 @@ static void test_simple(void)
IStream_Release(stm); IStream_Release(stm);
r = IStorage_OpenStream(stg, stmname2, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stm);
ok(r == S_OK, "got %08x\n", r);
r = IStream_Stat(stm, &stat, STATFLAG_NONAME);
ok(r == S_OK, "got %08x\n", r);
ok(stat.cbSize.QuadPart == 4096, "got %d\n", stat.cbSize.u.LowPart);
IStream_Release(stm);
IStorage_Release(stg); IStorage_Release(stg);
DeleteFileW(filename); DeleteFileW(filename);
......
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