ole32: In simple mode keep the stream size above the small block limit.
This commit is contained in:
parent
02fc79b2c9
commit
16dc037859
|
@ -575,6 +575,10 @@ static HRESULT WINAPI StgStreamImpl_SetSize(
|
|||
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)
|
||||
return S_OK;
|
||||
|
||||
|
|
|
@ -1354,6 +1354,7 @@ static void test_simple(void)
|
|||
HRESULT r;
|
||||
IStream *stm;
|
||||
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;
|
||||
ULARGE_INTEGER upos;
|
||||
DWORD count;
|
||||
|
@ -1400,6 +1401,19 @@ static void test_simple(void)
|
|||
|
||||
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_Release(stg);
|
||||
|
||||
|
@ -1415,6 +1429,16 @@ static void test_simple(void)
|
|||
|
||||
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);
|
||||
|
||||
DeleteFileW(filename);
|
||||
|
|
Loading…
Reference in New Issue