Esme Povirk (@madewokherd) commented about dlls/ole32/tests/storage32.c:
DeleteTestLockBytes(lockbytes);}
+static void test_lockbytes_flush_operation(void) +{
- static const WCHAR stmname[] = { 'T','E','S','T','S','T','R','E','A','M',0 };
- TestLockBytes* lockbytes;
- HRESULT hr;
- IStorage* stg;
- IStream* stm;
- /* Test 1: Normal flush operation */
- CreateTestLockBytes(&lockbytes);
I don't think this tests what you want to test. `CreateTestLockBytes` uses the `TestLockBytes_Vtbl` implementation defined in the test itself. So calling the implementation of Flush defined in the test file doesn't really test anything about Windows.
In fact, there doesn't seem to be a way to get the `ILockBytes` implementation from `filelockbytes.c` directly. I think that means that only the application-observable behavior matters.
So, I think all we need the test to do is call `IStorage_Flush` on a storage file (and I think it needs to be a file, not an in-memory lockbytes) that was opened read-only. If that succeeds, then our internal ILockBytes should succeed in that case. If not, it'll depend on the behavior of `IStorage_Flush` in other situations.