On Fri, Oct 20, 2017 at 09:58:57AM +0800, Dmitry Timoshkov wrote:
v2: Call IPersistStorage_Save() directly instead of OleSave().
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru
dlls/ole32/tests/ole2.c | 402 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 402 insertions(+)
diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c index 0773bbf189..9ed19f1f9b 100644 --- a/dlls/ole32/tests/ole2.c +++ b/dlls/ole32/tests/ole2.c +static void check_storage_contents(IStorage *stg, const struct storage_def *stg_def,
int *enumerated_streams, int *matched_streams)
+{
- HRESULT hr;
- IEnumSTATSTG *enumstg;
- IStream *stream;
- STATSTG stat;
- int i, seen_stream[MAX_STREAM] = { 0 };
- if (winetest_debug > 1)
trace("check_storage_contents:\n=============================================\n");
- *enumerated_streams = 0;
- *matched_streams = 0;
- hr = IStorage_Stat(stg, &stat, STATFLAG_NONAME);
- ok(hr == S_OK, "unexpected %#x\n", hr);
+todo_wine_if(!IsEqualCLSID(stg_def->clsid, &stat.clsid))
- ok(IsEqualCLSID(stg_def->clsid, &stat.clsid), "expected %s, got %s\n",
wine_dbgstr_guid(stg_def->clsid), wine_dbgstr_guid(&stat.clsid));
- hr = IStorage_EnumElements(stg, 0, NULL, 0, &enumstg);
- ok(hr == S_OK, "unexpected %#x\n", hr);
- for (;;)
- {
ULONG bytes;
int clipformat = -1;
PresentationDataHeader header;
char name[32];
BYTE data[256];
memset(&header, 0, sizeof(header));
hr = IEnumSTATSTG_Next(enumstg, 1, &stat, NULL);
if(hr == S_FALSE) break;
ok(hr == S_OK, "unexpected %#x\n", hr);
if (winetest_debug > 1)
trace("name %s, type %u, size %d, clsid %s\n",
wine_dbgstr_w(stat.pwcsName), stat.type, stat.cbSize.u.LowPart, wine_dbgstr_guid(&stat.clsid));
ok(stat.type == STGTY_STREAM, "unexpected %#x\n", stat.type);
WideCharToMultiByte(CP_ACP, 0, stat.pwcsName, -1, name, sizeof(name), NULL, NULL);
hr = IStorage_OpenStream(stg, stat.pwcsName, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream);
ok(hr == S_OK, "unexpected %#x\n", hr);
if (!memcmp(name, "\2OlePres", 7))
{
clipformat = read_clipformat(stream);
hr = IStream_Read(stream, &header, sizeof(header), &bytes);
ok(hr == S_OK, "unexpected %#x\n", hr);
ok(bytes >= 24, "read %u bytes, expected to read %u bytes\n", bytes, sizeof(header));
You're using sizeof as an argument to a fprintf-like function which, for example, gives a warning on macOS.
ole2.c:3532:82: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
Also, while you're at it, couldn't that '24' be sizeof(header) instead?
Huw.
Huw Davies huw@codeweavers.com wrote:
You're using sizeof as an argument to a fprintf-like function which, for example, gives a warning on macOS.
ole2.c:3532:82: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
Also, while you're at it, couldn't that '24' be sizeof(header) instead?
Thanks, I've resent the whole sequence.
Huw Davies huw@codeweavers.com wrote:
Also, while you're at it, couldn't that '24' be sizeof(header) instead?
I was too hasty to follow your suggestion and testbot failed miserably on me. Under Windows the OlePres header size is shorter after saving the storage, sizeof(header) is 32 bytes, but Windows writes only 24 bytes. So i'm going to resend once again...