tangled
alpha
login
or
join now
huwcampbell.com
/
reactos
0
fork
atom
Reactos
0
fork
atom
overview
issues
pulls
pipelines
[OLE32_WINETEST] Sync with Wine Staging 4.0. CORE-15682
Amine Khaldi
7 years ago
5c1bcfec
aeea2943
+770
-96
11 changed files
expand all
collapse all
unified
split
modules
rostests
winetests
ole32
clipboard.c
compobj.c
dragdrop.c
marshal.c
moniker.c
ole2.c
ole_server.c
propvariant.c
stg_prop.c
storage32.c
usrmarshal.c
+180
-18
modules/rostests/winetests/ole32/clipboard.c
···
61
61
HANDLE text;
62
62
IStream *stm;
63
63
IStorage *stg;
64
64
+
HMETAFILEPICT hmfp;
64
65
} DataObjectImpl;
65
66
66
67
typedef struct EnumFormatImpl {
···
81
82
static UINT cf_stream, cf_storage, cf_global, cf_another, cf_onemore;
82
83
83
84
static HRESULT EnumFormatImpl_Create(FORMATETC *fmtetc, UINT size, LPENUMFORMATETC *lplpformatetc);
85
85
+
86
86
+
static HMETAFILE create_mf(void)
87
87
+
{
88
88
+
RECT rect = {0, 0, 100, 100};
89
89
+
HDC hdc = CreateMetaFileA(NULL);
90
90
+
ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rect, "Test String", strlen("Test String"), NULL);
91
91
+
return CloseMetaFile(hdc);
92
92
+
}
93
93
+
94
94
+
static HMETAFILEPICT create_metafilepict(void)
95
95
+
{
96
96
+
HGLOBAL ret = GlobalAlloc(GMEM_MOVEABLE, sizeof(METAFILEPICT));
97
97
+
METAFILEPICT *mf = GlobalLock(ret);
98
98
+
mf->mm = MM_ANISOTROPIC;
99
99
+
mf->xExt = 100;
100
100
+
mf->yExt = 200;
101
101
+
mf->hMF = create_mf();
102
102
+
GlobalUnlock(ret);
103
103
+
return ret;
104
104
+
}
84
105
85
106
static inline DataObjectImpl *impl_from_IDataObject(IDataObject *iface)
86
107
{
···
232
253
HeapFree(GetProcessHeap(), 0, This->fmtetc);
233
254
if(This->stm) IStream_Release(This->stm);
234
255
if(This->stg) IStorage_Release(This->stg);
256
256
+
if(This->hmfp) {
257
257
+
METAFILEPICT *mfp = GlobalLock(This->hmfp);
258
258
+
DeleteMetaFile(mfp->hMF);
259
259
+
GlobalUnlock(This->hmfp);
260
260
+
GlobalFree(This->hmfp);
261
261
+
}
235
262
HeapFree(GetProcessHeap(), 0, This);
236
263
}
237
264
···
242
269
{
243
270
DataObjectImpl *This = impl_from_IDataObject(iface);
244
271
UINT i;
245
245
-
BOOL foundFormat = FALSE;
246
272
247
273
trace("getdata: %s\n", dump_fmtetc(pformatetc));
248
274
···
259
285
{
260
286
if(This->fmtetc[i].cfFormat == pformatetc->cfFormat)
261
287
{
262
262
-
foundFormat = TRUE;
263
288
if(This->fmtetc[i].tymed & pformatetc->tymed)
264
289
{
265
290
pmedium->pUnkForRelease = (LPUNKNOWN)iface;
···
282
307
IStorage_AddRef(This->stg);
283
308
U(*pmedium).pstg = This->stg;
284
309
}
310
310
+
else if(pformatetc->cfFormat == CF_METAFILEPICT)
311
311
+
{
312
312
+
pmedium->tymed = TYMED_MFPICT;
313
313
+
U(*pmedium).hMetaFilePict = This->hmfp;
314
314
+
}
285
315
return S_OK;
286
316
}
287
317
}
288
318
}
289
319
290
290
-
return foundFormat ? DV_E_TYMED : DV_E_FORMATETC;
320
320
+
return E_FAIL;
291
321
}
292
322
293
323
static HRESULT WINAPI DataObjectImpl_GetDataHere(IDataObject* iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
···
384
414
DataObjectImpl_EnumDAdvise
385
415
};
386
416
387
387
-
static HRESULT DataObjectImpl_CreateText(LPCSTR text, LPDATAOBJECT *lplpdataobj)
417
417
+
static HRESULT DataObjectImpl_CreateFromHGlobal(HGLOBAL text, LPDATAOBJECT *dataobj)
388
418
{
389
419
DataObjectImpl *obj;
390
420
391
421
obj = HeapAlloc(GetProcessHeap(), 0, sizeof(DataObjectImpl));
392
422
obj->IDataObject_iface.lpVtbl = &VT_DataObjectImpl;
393
423
obj->ref = 1;
394
394
-
obj->text = GlobalAlloc(GMEM_MOVEABLE, strlen(text) + 1);
395
395
-
strcpy(GlobalLock(obj->text), text);
396
396
-
GlobalUnlock(obj->text);
424
424
+
obj->text = text;
397
425
obj->stm = NULL;
398
426
obj->stg = NULL;
427
427
+
obj->hmfp = NULL;
399
428
400
429
obj->fmtetc_cnt = 1;
401
430
obj->fmtetc = HeapAlloc(GetProcessHeap(), 0, obj->fmtetc_cnt*sizeof(FORMATETC));
402
431
InitFormatEtc(obj->fmtetc[0], CF_TEXT, TYMED_HGLOBAL);
403
432
404
404
-
*lplpdataobj = &obj->IDataObject_iface;
433
433
+
*dataobj = &obj->IDataObject_iface;
405
434
return S_OK;
406
435
}
407
436
437
437
+
static HRESULT DataObjectImpl_CreateText(LPCSTR text, LPDATAOBJECT *lplpdataobj)
438
438
+
{
439
439
+
HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, strlen(text) + 1);
440
440
+
strcpy(GlobalLock(h), text);
441
441
+
GlobalUnlock(h);
442
442
+
return DataObjectImpl_CreateFromHGlobal(h, lplpdataobj);
443
443
+
}
444
444
+
408
445
static const char *cmpl_stm_data = "complex stream";
409
446
static const char *cmpl_text_data = "complex text";
410
447
static const WCHAR device_name[] = {'m','y','d','e','v',0};
···
428
465
StgCreateDocfileOnILockBytes(lbs, STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &obj->stg);
429
466
ILockBytes_Release(lbs);
430
467
431
431
-
obj->fmtetc_cnt = 8;
468
468
+
obj->hmfp = create_metafilepict();
469
469
+
470
470
+
obj->fmtetc_cnt = 9;
432
471
/* zeroing here since FORMATETC has a hole in it, and it's confusing to have this uninitialised. */
433
472
obj->fmtetc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, obj->fmtetc_cnt*sizeof(FORMATETC));
434
473
InitFormatEtc(obj->fmtetc[0], CF_TEXT, TYMED_HGLOBAL);
···
456
495
InitFormatEtc(obj->fmtetc[6], cf_another, 0xfffff);
457
496
InitFormatEtc(obj->fmtetc[7], cf_another, 0xfffff);
458
497
obj->fmtetc[7].dwAspect = DVASPECT_ICON;
498
498
+
InitFormatEtc(obj->fmtetc[8], CF_METAFILEPICT, TYMED_MFPICT);
459
499
460
500
*lplpdataobj = &obj->IDataObject_iface;
461
501
return S_OK;
···
510
550
ok(hr == DV_E_FORMATETC || broken(hr == S_OK),
511
551
"IDataObject_QueryGetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr);
512
552
513
513
-
InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
514
514
-
fmtetc.cfFormat = CF_RIFF;
553
553
+
InitFormatEtc(fmtetc, CF_RIFF, TYMED_HGLOBAL);
515
554
hr = IDataObject_QueryGetData(data_obj, &fmtetc);
516
555
ok(hr == DV_E_CLIPFORMAT, "IDataObject_QueryGetData should have failed with DV_E_CLIPFORMAT instead of 0x%08x\n", hr);
517
556
518
518
-
InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
519
519
-
fmtetc.tymed = TYMED_FILE;
557
557
+
InitFormatEtc(fmtetc, CF_TEXT, TYMED_FILE);
520
558
hr = IDataObject_QueryGetData(data_obj, &fmtetc);
521
559
ok(hr == S_OK, "IDataObject_QueryGetData failed with error 0x%08x\n", hr);
522
560
···
554
592
ReleaseStgMedium(&stgmedium);
555
593
}
556
594
557
557
-
InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
558
558
-
fmtetc.cfFormat = CF_RIFF;
595
595
+
InitFormatEtc(fmtetc, CF_RIFF, TYMED_HGLOBAL);
559
596
hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
560
597
ok(hr == DV_E_FORMATETC, "IDataObject_GetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr);
561
598
if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
562
599
563
563
-
InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
564
564
-
fmtetc.tymed = TYMED_FILE;
600
600
+
InitFormatEtc(fmtetc, CF_TEXT, TYMED_FILE);
565
601
hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
566
602
ok(hr == DV_E_TYMED, "IDataObject_GetData should have failed with DV_E_TYMED instead of 0x%08x\n", hr);
567
603
if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
···
591
627
hr = IDataObject_EnumFormatEtc(data, DATADIR_GET, &enum_fmt);
592
628
ok(hr == S_OK, "got %08x\n", hr);
593
629
ok(DataObjectImpl_EnumFormatEtc_calls == 0, "EnumFormatEtc was called\n");
630
630
+
if (FAILED(hr))
631
631
+
{
632
632
+
skip("EnumFormatEtc failed, skipping tests.\n");
633
633
+
return;
634
634
+
}
594
635
595
636
if(src) IDataObject_EnumFormatEtc(src, DATADIR_GET, &src_enum);
596
637
···
826
867
ok(found_priv_data, "didn't find cf_ole_priv_data\n");
827
868
}
828
869
870
870
+
static void test_complex_get_clipboard(void)
871
871
+
{
872
872
+
HRESULT hr;
873
873
+
IDataObject *data_obj;
874
874
+
FORMATETC fmtetc;
875
875
+
STGMEDIUM stgmedium;
876
876
+
877
877
+
hr = OleGetClipboard(&data_obj);
878
878
+
ok(hr == S_OK, "OleGetClipboard failed with error 0x%08x\n", hr);
879
879
+
880
880
+
DataObjectImpl_GetData_calls = 0;
881
881
+
882
882
+
InitFormatEtc(fmtetc, CF_METAFILEPICT, TYMED_MFPICT);
883
883
+
hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
884
884
+
ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08x\n", hr);
885
885
+
if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
886
886
+
887
887
+
InitFormatEtc(fmtetc, CF_METAFILEPICT, TYMED_HGLOBAL);
888
888
+
hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
889
889
+
ok(hr == DV_E_TYMED, "IDataObject_GetData failed with error 0x%08x\n", hr);
890
890
+
if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
891
891
+
892
892
+
InitFormatEtc(fmtetc, CF_ENHMETAFILE, TYMED_HGLOBAL);
893
893
+
hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
894
894
+
ok(hr == DV_E_TYMED, "IDataObject_GetData failed with error 0x%08x\n", hr);
895
895
+
if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
896
896
+
897
897
+
InitFormatEtc(fmtetc, CF_ENHMETAFILE, TYMED_ENHMF);
898
898
+
hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
899
899
+
ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08x\n", hr);
900
900
+
if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
901
901
+
902
902
+
ok(DataObjectImpl_GetData_calls == 5,
903
903
+
"DataObjectImpl_GetData called 5 times instead of %d times\n",
904
904
+
DataObjectImpl_GetData_calls);
905
905
+
IDataObject_Release(data_obj);
906
906
+
}
907
907
+
829
908
static void test_set_clipboard(void)
830
909
{
831
910
HRESULT hr;
···
933
1012
trace("setting complex\n");
934
1013
hr = OleSetClipboard(data_cmpl);
935
1014
ok(hr == S_OK, "failed to set clipboard to complex data, hr = 0x%08x\n", hr);
1015
1015
+
test_complex_get_clipboard();
936
1016
test_cf_dataobject(data_cmpl);
937
1017
test_enum_fmtetc(data_cmpl);
938
1018
···
1206
1286
IDataObject_Release(src);
1207
1287
}
1208
1288
1289
1289
+
static HGLOBAL create_storage(void)
1290
1290
+
{
1291
1291
+
ILockBytes *ilb;
1292
1292
+
IStorage *stg;
1293
1293
+
HGLOBAL hg;
1294
1294
+
HRESULT hr;
1295
1295
+
1296
1296
+
hr = CreateILockBytesOnHGlobal(NULL, FALSE, &ilb);
1297
1297
+
ok(hr == S_OK, "got %08x\n", hr);
1298
1298
+
hr = StgCreateDocfileOnILockBytes(ilb, STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stg);
1299
1299
+
ok(hr == S_OK, "got %08x\n", hr);
1300
1300
+
IStorage_Release(stg);
1301
1301
+
hr = GetHGlobalFromILockBytes(ilb, &hg);
1302
1302
+
ok(hr == S_OK, "got %08x\n", hr);
1303
1303
+
ILockBytes_Release(ilb);
1304
1304
+
return hg;
1305
1305
+
}
1306
1306
+
1209
1307
static void test_flushed_getdata(void)
1210
1308
{
1211
1309
HRESULT hr;
···
1347
1445
HeapFree(GetProcessHeap(), 0, fmt.ptd);
1348
1446
}
1349
1447
1448
1448
+
/* CF_ENHMETAFILE format */
1449
1449
+
InitFormatEtc(fmt, CF_ENHMETAFILE, TYMED_ENHMF);
1450
1450
+
hr = IDataObject_GetData(get, &fmt, &med);
1451
1451
+
ok(hr == S_OK, "got %08x\n", hr);
1452
1452
+
if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
1350
1453
1351
1454
IDataObject_Release(get);
1352
1455
IDataObject_Release(src);
1456
1456
+
1457
1457
+
hr = DataObjectImpl_CreateFromHGlobal(create_storage(), &src);
1458
1458
+
ok(hr == S_OK, "got %08x\n", hr);
1459
1459
+
1460
1460
+
hr = OleSetClipboard(src);
1461
1461
+
ok(hr == S_OK, "got %08x\n", hr);
1462
1462
+
1463
1463
+
hr = OleGetClipboard(&get);
1464
1464
+
ok(hr == S_OK, "got %08x\n", hr);
1465
1465
+
InitFormatEtc(fmt, CF_TEXT, TYMED_ISTORAGE);
1466
1466
+
hr = IDataObject_GetData(get, &fmt, &med);
1467
1467
+
ok(hr == S_OK, "got %08x\n", hr);
1468
1468
+
ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed);
1469
1469
+
if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
1470
1470
+
IDataObject_Release(get);
1471
1471
+
1472
1472
+
hr = OleFlushClipboard();
1473
1473
+
ok(hr == S_OK, "got %08x\n", hr);
1474
1474
+
1475
1475
+
hr = OleGetClipboard(&get);
1476
1476
+
ok(hr == S_OK, "got %08x\n", hr);
1477
1477
+
1478
1478
+
InitFormatEtc(fmt, CF_TEXT, TYMED_ISTORAGE);
1479
1479
+
hr = IDataObject_GetData(get, &fmt, &med);
1480
1480
+
ok(hr == S_OK, "got %08x\n", hr);
1481
1481
+
ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed);
1482
1482
+
if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
1483
1483
+
1484
1484
+
InitFormatEtc(fmt, CF_TEXT, 0xffff);
1485
1485
+
hr = IDataObject_GetData(get, &fmt, &med);
1486
1486
+
ok(hr == S_OK, "got %08x\n", hr);
1487
1487
+
ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed);
1488
1488
+
if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
1489
1489
+
1490
1490
+
IDataObject_Release(get);
1491
1491
+
IDataObject_Release(src);
1492
1492
+
1353
1493
OleUninitialize();
1354
1494
}
1355
1495
···
1377
1517
IDataObject *get;
1378
1518
IEnumFORMATETC *enum_fmt;
1379
1519
FORMATETC fmt;
1380
1380
-
HGLOBAL h, hblob, htext;
1520
1520
+
HGLOBAL h, hblob, htext, hstorage;
1381
1521
HENHMETAFILE emf;
1382
1522
STGMEDIUM med;
1383
1523
DWORD obj_type;
···
1408
1548
htext = create_text();
1409
1549
hblob = GlobalAlloc(GMEM_DDESHARE|GMEM_MOVEABLE|GMEM_ZEROINIT, 10);
1410
1550
emf = create_emf();
1551
1551
+
hstorage = create_storage();
1411
1552
1412
1553
r = OpenClipboard(NULL);
1413
1554
ok(r, "gle %d\n", GetLastError());
···
1417
1558
ok(h == hblob, "got %p\n", h);
1418
1559
h = SetClipboardData(CF_ENHMETAFILE, emf);
1419
1560
ok(h == emf, "got %p\n", h);
1561
1561
+
h = SetClipboardData(cf_storage, hstorage);
1562
1562
+
ok(h == hstorage, "got %p\n", h);
1420
1563
r = CloseClipboard();
1421
1564
ok(r, "gle %d\n", GetLastError());
1422
1565
···
1424
1567
ok(hr == S_OK, "got %08x\n", hr);
1425
1568
hr = IDataObject_EnumFormatEtc(get, DATADIR_GET, &enum_fmt);
1426
1569
ok(hr == S_OK, "got %08x\n", hr);
1570
1570
+
if (FAILED(hr))
1571
1571
+
{
1572
1572
+
skip("EnumFormatEtc failed, skipping tests.\n");
1573
1573
+
return;
1574
1574
+
}
1427
1575
1428
1576
hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
1429
1577
ok(hr == S_OK, "got %08x\n", hr);
···
1450
1598
ok(fmt.tymed == TYMED_ENHMF, "tymed %x\n", fmt.tymed);
1451
1599
1452
1600
hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
1601
1601
+
ok(hr == S_OK, "got %08x\n", hr);
1602
1602
+
ok(fmt.cfFormat == cf_storage, "cf %04x\n", fmt.cfFormat);
1603
1603
+
ok(fmt.ptd == NULL, "ptd %p\n", fmt.ptd);
1604
1604
+
ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %x\n", fmt.dwAspect);
1605
1605
+
ok(fmt.lindex == -1, "lindex %d\n", fmt.lindex);
1606
1606
+
ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %x\n", fmt.tymed);
1607
1607
+
1608
1608
+
hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
1453
1609
ok(hr == S_OK, "got %08x\n", hr); /* User32 adds some synthesised formats */
1454
1610
1455
1611
ok(fmt.cfFormat == CF_LOCALE, "cf %04x\n", fmt.cfFormat);
···
1492
1648
ok(hr == S_OK, "got %08x\n", hr);
1493
1649
obj_type = GetObjectType(U(med).hEnhMetaFile);
1494
1650
ok(obj_type == OBJ_ENHMETAFILE, "got %d\n", obj_type);
1651
1651
+
if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
1652
1652
+
1653
1653
+
InitFormatEtc(fmt, cf_storage, TYMED_ISTORAGE);
1654
1654
+
hr = IDataObject_GetData(get, &fmt, &med);
1655
1655
+
ok(hr == S_OK, "got %08x\n", hr);
1656
1656
+
ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed);
1495
1657
if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
1496
1658
1497
1659
IDataObject_Release(get);
+4
-12
modules/rostests/winetests/ole32/compobj.c
···
27
27
#include "windef.h"
28
28
#include "winbase.h"
29
29
#define USE_COM_CONTEXT_DEF
30
30
-
#ifndef __REACTOS__
31
31
-
#include "initguid.h"
32
32
-
#endif
33
30
#include "objbase.h"
34
31
#include "shlguid.h"
35
32
#include "urlmon.h" /* for CLSID_FileProtocol */
···
39
36
#include "ctxtcall.h"
40
37
41
38
#include "wine/test.h"
42
42
-
43
43
-
#ifdef __REACTOS__
44
44
-
#include <initguid.h>
45
45
-
#endif
39
39
+
#include "initguid.h"
46
40
47
41
#define DEFINE_EXPECT(func) \
48
42
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
···
101
95
static const GUID IID_Testiface6 = { 0x72222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
102
96
static const GUID IID_TestPS = { 0x66666666, 0x8888, 0x7777, { 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 } };
103
97
104
104
-
DEFINE_GUID(CLSID_InProcFreeMarshaler, 0x0000033a,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
105
98
DEFINE_GUID(CLSID_testclsid, 0xacd014c7,0x9535,0x4fac,0x8b,0x53,0xa4,0x8c,0xa7,0xf4,0xd7,0x26);
106
106
-
DEFINE_GUID(CLSID_GlobalOptions, 0x0000034b,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
107
99
108
100
static const WCHAR stdfont[] = {'S','t','d','F','o','n','t',0};
109
101
static const WCHAR wszNonExistent[] = {'N','o','n','E','x','i','s','t','e','n','t',0};
···
203
195
WCHAR path[MAX_PATH];
204
196
205
197
MultiByteToWideChar( CP_ACP, 0, filename, -1, path, MAX_PATH );
206
206
-
GetFullPathNameW(path, sizeof(manifest_path)/sizeof(WCHAR), manifest_path, NULL);
198
198
+
GetFullPathNameW(path, ARRAY_SIZE(manifest_path), manifest_path, NULL);
207
199
208
200
manifest_len = strlen(manifest);
209
201
file = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
···
2340
2332
}
2341
2333
2342
2334
/* test using registered CLSID */
2343
2343
-
StringFromGUID2(&CLSID_non_existent, clsidW, sizeof(clsidW)/sizeof(clsidW[0]));
2335
2335
+
StringFromGUID2(&CLSID_non_existent, clsidW, ARRAY_SIZE(clsidW));
2344
2336
2345
2337
ret = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsidkeyW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &clsidhkey, &disposition);
2346
2338
if (!ret)
···
2528
2520
2529
2521
static LRESULT CALLBACK cowait_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
2530
2522
{
2531
2531
-
if(cowait_msgs_last < sizeof(cowait_msgs)/sizeof(*cowait_msgs))
2523
2523
+
if(cowait_msgs_last < ARRAY_SIZE(cowait_msgs))
2532
2524
cowait_msgs[cowait_msgs_last++] = msg;
2533
2525
if(msg == WM_DDE_FIRST)
2534
2526
return 6;
+1
-1
modules/rostests/winetests/ole32/dragdrop.c
···
701
701
GetWindowRect(hwnd, &rect);
702
702
ok(SetCursorPos(rect.left+50, rect.top+50), "SetCursorPos failed\n");
703
703
704
704
-
for (seq = 0; seq < sizeof(call_lists) / sizeof(call_lists[0]); seq++)
704
704
+
for (seq = 0; seq < ARRAY_SIZE(call_lists); seq++)
705
705
{
706
706
DWORD effect_in;
707
707
trace("%d\n", seq);
+368
-28
modules/rostests/winetests/ole32/marshal.c
···
31
31
#include "olectl.h"
32
32
#include "shlguid.h"
33
33
#include "shobjidl.h"
34
34
-
#include "initguid.h"
35
34
36
35
#include "wine/test.h"
37
36
#include "wine/heap.h"
···
60
59
expect_ ## func = called_ ## func = FALSE; \
61
60
}while(0)
62
61
63
63
-
DEFINE_GUID(CLSID_StdGlobalInterfaceTable,0x00000323,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
64
64
-
DEFINE_GUID(CLSID_ManualResetEvent, 0x0000032c,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
65
65
-
66
62
static const GUID CLSID_WineTestPSFactoryBuffer = { 0x22222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
63
63
+
static const GUID CLSID_DfMarshal = { 0x0000030b, 0x0000, 0x0000, { 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } };
67
64
68
65
/* functions that are not present on all versions of Windows */
69
66
static HRESULT (WINAPI * pCoInitializeEx)(LPVOID lpReserved, DWORD dwCoInit);
···
76
73
#define ok_non_zero_external_conn() do {if (with_external_conn) ok(external_connections, "got no external connections\n");} while(0);
77
74
#define ok_zero_external_conn() do {if (with_external_conn) ok(!external_connections, "got %d external connections\n", external_connections);} while(0);
78
75
#define ok_last_release_closes(b) do {if (with_external_conn) ok(last_release_closes == b, "got %d expected %d\n", last_release_closes, b);} while(0);
76
76
+
77
77
+
#define OBJREF_SIGNATURE (0x574f454d)
78
78
+
#define OBJREF_STANDARD (0x1)
79
79
+
#define OBJREF_CUSTOM (0x4)
80
80
+
81
81
+
typedef struct tagDUALSTRINGARRAY {
82
82
+
unsigned short wNumEntries;
83
83
+
unsigned short wSecurityOffset;
84
84
+
unsigned short aStringArray[1];
85
85
+
} DUALSTRINGARRAY;
86
86
+
87
87
+
typedef UINT64 OXID;
88
88
+
typedef UINT64 OID;
89
89
+
typedef GUID IPID;
90
90
+
91
91
+
typedef struct tagSTDOBJREF {
92
92
+
ULONG flags;
93
93
+
ULONG cPublicRefs;
94
94
+
OXID oxid;
95
95
+
OID oid;
96
96
+
IPID ipid;
97
97
+
} STDOBJREF;
98
98
+
99
99
+
typedef struct tagOBJREF {
100
100
+
ULONG signature;
101
101
+
ULONG flags;
102
102
+
GUID iid;
103
103
+
union {
104
104
+
struct OR_STANDARD {
105
105
+
STDOBJREF std;
106
106
+
DUALSTRINGARRAY saResAddr;
107
107
+
} u_standard;
108
108
+
struct OR_HANDLER {
109
109
+
STDOBJREF std;
110
110
+
CLSID clsid;
111
111
+
DUALSTRINGARRAY saResAddr;
112
112
+
} u_handler;
113
113
+
struct OR_CUSTOM {
114
114
+
CLSID clsid;
115
115
+
ULONG cbExtension;
116
116
+
ULONG size;
117
117
+
byte *pData;
118
118
+
} u_custom;
119
119
+
} u_objref;
120
120
+
} OBJREF;
79
121
80
122
static const IID IID_IWineTest =
81
123
{
···
1297
1339
SET_EXPECT(GetWindow);
1298
1340
hr = IOleWindow_GetWindow(ole_window, &hwnd);
1299
1341
ok(hr == S_OK, "GetWindow failed: %08x\n", hr);
1300
1300
-
ok(hwnd == (HWND)0xdeadbeef, "hwnd = %p\n", hwnd);
1342
1342
+
ok((DWORD)(DWORD_PTR)hwnd == 0xdeadbeef, "hwnd = %p\n", hwnd);
1301
1343
CHECK_CALLED(Invoke);
1302
1344
CHECK_CALLED(GetWindow);
1303
1345
···
1314
1356
end_host_object(tid, thread);
1315
1357
}
1316
1358
1359
1359
+
static const CLSID *unmarshal_class;
1360
1360
+
DEFINE_EXPECT(CustomMarshal_GetUnmarshalClass);
1361
1361
+
DEFINE_EXPECT(CustomMarshal_GetMarshalSizeMax);
1362
1362
+
DEFINE_EXPECT(CustomMarshal_MarshalInterface);
1363
1363
+
1364
1364
+
static HRESULT WINAPI CustomMarshal_QueryInterface(IMarshal *iface, REFIID riid, void **ppv)
1365
1365
+
{
1366
1366
+
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IMarshal)) {
1367
1367
+
*ppv = iface;
1368
1368
+
}
1369
1369
+
else
1370
1370
+
{
1371
1371
+
*ppv = NULL;
1372
1372
+
return E_NOINTERFACE;
1373
1373
+
}
1374
1374
+
IUnknown_AddRef((IUnknown*)*ppv);
1375
1375
+
return S_OK;
1376
1376
+
}
1377
1377
+
1378
1378
+
static ULONG WINAPI CustomMarshal_AddRef(IMarshal *iface)
1379
1379
+
{
1380
1380
+
return 2;
1381
1381
+
}
1382
1382
+
1383
1383
+
static ULONG WINAPI CustomMarshal_Release(IMarshal *iface)
1384
1384
+
{
1385
1385
+
return 1;
1386
1386
+
}
1387
1387
+
1388
1388
+
static HRESULT WINAPI CustomMarshal_GetUnmarshalClass(IMarshal *iface, REFIID riid,
1389
1389
+
void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *clsid)
1390
1390
+
{
1391
1391
+
CHECK_EXPECT(CustomMarshal_GetUnmarshalClass);
1392
1392
+
*clsid = *unmarshal_class;
1393
1393
+
return S_OK;
1394
1394
+
}
1395
1395
+
1396
1396
+
static HRESULT WINAPI CustomMarshal_GetMarshalSizeMax(IMarshal *iface, REFIID riid,
1397
1397
+
void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *size)
1398
1398
+
{
1399
1399
+
CHECK_EXPECT(CustomMarshal_GetMarshalSizeMax);
1400
1400
+
ok(size != NULL, "size = NULL\n");
1401
1401
+
1402
1402
+
*size = 0;
1403
1403
+
return S_OK;
1404
1404
+
}
1405
1405
+
1406
1406
+
static HRESULT WINAPI CustomMarshal_MarshalInterface(IMarshal *iface, IStream *stream,
1407
1407
+
REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags)
1408
1408
+
{
1409
1409
+
IMarshal *std_marshal;
1410
1410
+
STATSTG stat;
1411
1411
+
HRESULT hr;
1412
1412
+
1413
1413
+
CHECK_EXPECT(CustomMarshal_MarshalInterface);
1414
1414
+
1415
1415
+
if(unmarshal_class != &CLSID_StdMarshal)
1416
1416
+
return S_OK;
1417
1417
+
1418
1418
+
hr = IStream_Stat(stream, &stat, STATFLAG_DEFAULT);
1419
1419
+
ok_ole_success(hr, IStream_Stat);
1420
1420
+
ok(U(stat.cbSize).LowPart == 0, "stream is not empty (%d)\n", U(stat.cbSize).LowPart);
1421
1421
+
ok(U(stat.cbSize).HighPart == 0, "stream is not empty (%d)\n", U(stat.cbSize).HighPart);
1422
1422
+
1423
1423
+
hr = CoGetStandardMarshal(riid, (IUnknown*)iface,
1424
1424
+
dwDestContext, NULL, mshlflags, &std_marshal);
1425
1425
+
ok_ole_success(hr, CoGetStandardMarshal);
1426
1426
+
hr = IMarshal_MarshalInterface(std_marshal, stream, riid, pv,
1427
1427
+
dwDestContext, pvDestContext, mshlflags);
1428
1428
+
ok_ole_success(hr, IMarshal_MarshalInterface);
1429
1429
+
IMarshal_Release(std_marshal);
1430
1430
+
1431
1431
+
return S_OK;
1432
1432
+
}
1433
1433
+
1434
1434
+
static HRESULT WINAPI CustomMarshal_UnmarshalInterface(IMarshal *iface,
1435
1435
+
IStream *stream, REFIID riid, void **ppv)
1436
1436
+
{
1437
1437
+
ok(0, "unexpected call\n");
1438
1438
+
return E_NOTIMPL;
1439
1439
+
}
1440
1440
+
1441
1441
+
static HRESULT WINAPI CustomMarshal_ReleaseMarshalData(IMarshal *iface, IStream *stream)
1442
1442
+
{
1443
1443
+
ok(0, "unexpected call\n");
1444
1444
+
return E_NOTIMPL;
1445
1445
+
}
1446
1446
+
1447
1447
+
static HRESULT WINAPI CustomMarshal_DisconnectObject(IMarshal *iface, DWORD res)
1448
1448
+
{
1449
1449
+
ok(0, "unexpected call\n");
1450
1450
+
return E_NOTIMPL;
1451
1451
+
}
1452
1452
+
1453
1453
+
static IMarshalVtbl CustomMarshalVtbl =
1454
1454
+
{
1455
1455
+
CustomMarshal_QueryInterface,
1456
1456
+
CustomMarshal_AddRef,
1457
1457
+
CustomMarshal_Release,
1458
1458
+
CustomMarshal_GetUnmarshalClass,
1459
1459
+
CustomMarshal_GetMarshalSizeMax,
1460
1460
+
CustomMarshal_MarshalInterface,
1461
1461
+
CustomMarshal_UnmarshalInterface,
1462
1462
+
CustomMarshal_ReleaseMarshalData,
1463
1463
+
CustomMarshal_DisconnectObject
1464
1464
+
};
1465
1465
+
1466
1466
+
static IMarshal CustomMarshal = { &CustomMarshalVtbl };
1467
1467
+
1468
1468
+
static void test_StdMarshal_custom_marshaling(void)
1469
1469
+
{
1470
1470
+
IStream *stream;
1471
1471
+
IUnknown *unk;
1472
1472
+
DWORD size;
1473
1473
+
HRESULT hr;
1474
1474
+
1475
1475
+
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
1476
1476
+
ok_ole_success(hr, CreateStreamOnHGlobal);
1477
1477
+
1478
1478
+
unmarshal_class = &CLSID_StdMarshal;
1479
1479
+
SET_EXPECT(CustomMarshal_GetUnmarshalClass);
1480
1480
+
SET_EXPECT(CustomMarshal_MarshalInterface);
1481
1481
+
hr = CoMarshalInterface(stream, &IID_IUnknown, (IUnknown*)&CustomMarshal,
1482
1482
+
MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1483
1483
+
ok_ole_success(hr, CoMarshalInterface);
1484
1484
+
CHECK_CALLED(CustomMarshal_GetUnmarshalClass);
1485
1485
+
CHECK_CALLED(CustomMarshal_MarshalInterface);
1486
1486
+
1487
1487
+
hr = IStream_Seek(stream, ullZero, STREAM_SEEK_SET, NULL);
1488
1488
+
ok_ole_success(hr, IStream_Seek);
1489
1489
+
hr = CoUnmarshalInterface(stream, &IID_IUnknown, (void**)&unk);
1490
1490
+
ok_ole_success(hr, CoUnmarshalInterface);
1491
1491
+
ok(unk == (IUnknown*)&CustomMarshal, "unk != &CustomMarshal\n");
1492
1492
+
IUnknown_Release(unk);
1493
1493
+
IStream_Release(stream);
1494
1494
+
1495
1495
+
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
1496
1496
+
ok_ole_success(hr, CreateStreamOnHGlobal);
1497
1497
+
1498
1498
+
SET_EXPECT(CustomMarshal_GetUnmarshalClass);
1499
1499
+
SET_EXPECT(CustomMarshal_MarshalInterface);
1500
1500
+
hr = CoMarshalInterface(stream, &IID_IUnknown, (IUnknown*)&CustomMarshal,
1501
1501
+
MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1502
1502
+
ok_ole_success(hr, CoMarshalInterface);
1503
1503
+
CHECK_CALLED(CustomMarshal_GetUnmarshalClass);
1504
1504
+
CHECK_CALLED(CustomMarshal_MarshalInterface);
1505
1505
+
1506
1506
+
hr = IStream_Seek(stream, ullZero, STREAM_SEEK_SET, NULL);
1507
1507
+
ok_ole_success(hr, IStream_Seek);
1508
1508
+
hr = CoReleaseMarshalData(stream);
1509
1509
+
ok_ole_success(hr, CoReleaseMarshalData);
1510
1510
+
IStream_Release(stream);
1511
1511
+
1512
1512
+
SET_EXPECT(CustomMarshal_GetMarshalSizeMax);
1513
1513
+
hr = CoGetMarshalSizeMax(&size, &IID_IUnknown, (IUnknown*)&CustomMarshal,
1514
1514
+
MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1515
1515
+
ok_ole_success(hr, CoGetMarshalSizeMax);
1516
1516
+
CHECK_CALLED(CustomMarshal_GetMarshalSizeMax);
1517
1517
+
ok(size == sizeof(OBJREF), "size = %d, expected %d\n", size, (int)sizeof(OBJREF));
1518
1518
+
}
1519
1519
+
1520
1520
+
static void test_DfMarshal_custom_marshaling(void)
1521
1521
+
{
1522
1522
+
DWORD size, read;
1523
1523
+
IStream *stream;
1524
1524
+
OBJREF objref;
1525
1525
+
HRESULT hr;
1526
1526
+
1527
1527
+
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
1528
1528
+
ok_ole_success(hr, CreateStreamOnHGlobal);
1529
1529
+
1530
1530
+
unmarshal_class = &CLSID_DfMarshal;
1531
1531
+
SET_EXPECT(CustomMarshal_GetUnmarshalClass);
1532
1532
+
SET_EXPECT(CustomMarshal_GetMarshalSizeMax);
1533
1533
+
SET_EXPECT(CustomMarshal_MarshalInterface);
1534
1534
+
hr = CoMarshalInterface(stream, &IID_IUnknown, (IUnknown*)&CustomMarshal,
1535
1535
+
MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1536
1536
+
ok_ole_success(hr, CoMarshalInterface);
1537
1537
+
CHECK_CALLED(CustomMarshal_GetUnmarshalClass);
1538
1538
+
CHECK_CALLED(CustomMarshal_GetMarshalSizeMax);
1539
1539
+
CHECK_CALLED(CustomMarshal_MarshalInterface);
1540
1540
+
1541
1541
+
hr = IStream_Seek(stream, ullZero, STREAM_SEEK_SET, NULL);
1542
1542
+
ok_ole_success(hr, IStream_Seek);
1543
1543
+
size = FIELD_OFFSET(OBJREF, u_objref.u_custom.pData);
1544
1544
+
hr = IStream_Read(stream, &objref, size, &read);
1545
1545
+
ok_ole_success(hr, IStream_Read);
1546
1546
+
ok(read == size, "read = %d, expected %d\n", read, size);
1547
1547
+
ok(objref.signature == OBJREF_SIGNATURE, "objref.signature = %x\n",
1548
1548
+
objref.signature);
1549
1549
+
ok(objref.flags == OBJREF_CUSTOM, "objref.flags = %x\n", objref.flags);
1550
1550
+
ok(IsEqualIID(&objref.iid, &IID_IUnknown), "objref.iid = %s\n",
1551
1551
+
wine_dbgstr_guid(&objref.iid));
1552
1552
+
ok(IsEqualIID(&objref.u_objref.u_custom.clsid, &CLSID_DfMarshal),
1553
1553
+
"custom.clsid = %s\n", wine_dbgstr_guid(&objref.u_objref.u_custom.clsid));
1554
1554
+
ok(!objref.u_objref.u_custom.cbExtension, "custom.cbExtension = %d\n",
1555
1555
+
objref.u_objref.u_custom.cbExtension);
1556
1556
+
ok(!objref.u_objref.u_custom.size, "custom.size = %d\n",
1557
1557
+
objref.u_objref.u_custom.size);
1558
1558
+
1559
1559
+
IStream_Release(stream);
1560
1560
+
1561
1561
+
SET_EXPECT(CustomMarshal_GetMarshalSizeMax);
1562
1562
+
hr = CoGetMarshalSizeMax(&size, &IID_IUnknown, (IUnknown*)&CustomMarshal,
1563
1563
+
MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1564
1564
+
ok_ole_success(hr, CoGetMarshalSizeMax);
1565
1565
+
CHECK_CALLED(CustomMarshal_GetMarshalSizeMax);
1566
1566
+
ok(size == sizeof(OBJREF), "size = %d, expected %d\n", size, (int)sizeof(OBJREF));
1567
1567
+
}
1568
1568
+
1569
1569
+
static void test_CoGetStandardMarshal(void)
1570
1570
+
{
1571
1571
+
DUALSTRINGARRAY *dualstringarr;
1572
1572
+
STDOBJREF *stdobjref;
1573
1573
+
OBJREF objref;
1574
1574
+
IMarshal *marshal;
1575
1575
+
DWORD size, read;
1576
1576
+
IStream *stream;
1577
1577
+
IUnknown *unk;
1578
1578
+
CLSID clsid;
1579
1579
+
HRESULT hr;
1580
1580
+
1581
1581
+
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
1582
1582
+
ok_ole_success(hr, CreateStreamOnHGlobal);
1583
1583
+
1584
1584
+
hr = CoGetStandardMarshal(&IID_IUnknown, &Test_Unknown,
1585
1585
+
MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &marshal);
1586
1586
+
ok_ole_success(hr, CoGetStandardMarshal);
1587
1587
+
1588
1588
+
hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUnknown, &Test_Unknown,
1589
1589
+
MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &clsid);
1590
1590
+
ok_ole_success(hr, IMarshal_GetUnmarshalClass);
1591
1591
+
ok(IsEqualGUID(&clsid, &CLSID_StdMarshal), "clsid = %s\n", wine_dbgstr_guid(&clsid));
1592
1592
+
1593
1593
+
hr = IMarshal_GetMarshalSizeMax(marshal, &IID_IUnknown, &Test_Unknown,
1594
1594
+
MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &size);
1595
1595
+
ok_ole_success(hr, IMarshal_GetMarshalSizeMax);
1596
1596
+
hr = CoGetMarshalSizeMax(&read, &IID_IUnknown, &Test_Unknown,
1597
1597
+
MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1598
1598
+
ok_ole_success(hr, CoGetMarshalSizeMax);
1599
1599
+
ok(size == read, "IMarshal_GetMarshalSizeMax size = %d, expected %d\n", size, read);
1600
1600
+
1601
1601
+
hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUnknown,
1602
1602
+
&Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1603
1603
+
ok_ole_success(hr, IMarshal_MarshalInterface);
1604
1604
+
1605
1605
+
hr = IStream_Seek(stream, ullZero, STREAM_SEEK_SET, NULL);
1606
1606
+
ok_ole_success(hr, IStream_Seek);
1607
1607
+
size = FIELD_OFFSET(OBJREF, u_objref.u_standard.saResAddr.aStringArray);
1608
1608
+
hr = IStream_Read(stream, &objref, size, &read);
1609
1609
+
ok_ole_success(hr, IStream_Read);
1610
1610
+
ok(read == size, "read = %d, expected %d\n", read, size);
1611
1611
+
ok(objref.signature == OBJREF_SIGNATURE, "objref.signature = %x\n",
1612
1612
+
objref.signature);
1613
1613
+
ok(objref.flags == OBJREF_STANDARD, "objref.flags = %x\n", objref.flags);
1614
1614
+
ok(IsEqualIID(&objref.iid, &IID_IUnknown), "objref.iid = %s\n",
1615
1615
+
wine_dbgstr_guid(&objref.iid));
1616
1616
+
stdobjref = &objref.u_objref.u_standard.std;
1617
1617
+
ok(stdobjref->flags == 0, "stdobjref.flags = %d\n", stdobjref->flags);
1618
1618
+
ok(stdobjref->cPublicRefs == 5, "stdobjref.cPublicRefs = %d\n",
1619
1619
+
stdobjref->cPublicRefs);
1620
1620
+
dualstringarr = &objref.u_objref.u_standard.saResAddr;
1621
1621
+
ok(dualstringarr->wNumEntries == 0, "dualstringarr.wNumEntries = %d\n",
1622
1622
+
dualstringarr->wNumEntries);
1623
1623
+
ok(dualstringarr->wSecurityOffset == 0, "dualstringarr.wSecurityOffset = %d\n",
1624
1624
+
dualstringarr->wSecurityOffset);
1625
1625
+
1626
1626
+
hr = IStream_Seek(stream, ullZero, STREAM_SEEK_SET, NULL);
1627
1627
+
ok_ole_success(hr, IStream_Seek);
1628
1628
+
hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUnknown, (void**)&unk);
1629
1629
+
ok_ole_success(hr, IMarshal_UnmarshalInterface);
1630
1630
+
IUnknown_Release(unk);
1631
1631
+
1632
1632
+
hr = IStream_Seek(stream, ullZero, STREAM_SEEK_SET, NULL);
1633
1633
+
ok_ole_success(hr, IStream_Seek);
1634
1634
+
hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUnknown,
1635
1635
+
&Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1636
1636
+
ok_ole_success(hr, IMarshal_MarshalInterface);
1637
1637
+
1638
1638
+
hr = IStream_Seek(stream, ullZero, STREAM_SEEK_SET, NULL);
1639
1639
+
ok_ole_success(hr, IStream_Seek);
1640
1640
+
hr = IMarshal_ReleaseMarshalData(marshal, stream);
1641
1641
+
ok_ole_success(hr, IMarshal_ReleaseMarshalData);
1642
1642
+
IStream_Release(stream);
1643
1643
+
1644
1644
+
IMarshal_Release(marshal);
1645
1645
+
}
1317
1646
struct ncu_params
1318
1647
{
1319
1648
LPSTREAM stream;
···
2878
3207
IStream *pStream;
2879
3208
IUnknown *pProxy;
2880
3209
static const LARGE_INTEGER llZero;
3210
3210
+
CLSID clsid;
2881
3211
2882
3212
cLocks = 0;
2883
3213
hr = CoCreateFreeThreadedMarshaler(NULL, &pFTUnknown);
···
2890
3220
ok_ole_success(hr, CreateStreamOnHGlobal);
2891
3221
2892
3222
/* inproc normal marshaling */
3223
3223
+
3224
3224
+
hr = IMarshal_GetUnmarshalClass(pFTMarshal, &IID_IClassFactory,
3225
3225
+
&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &clsid);
3226
3226
+
ok_ole_success(hr, IMarshal_GetUnmarshalClass);
3227
3227
+
ok(IsEqualIID(&clsid, &CLSID_InProcFreeMarshaler), "clsid = %s\n",
3228
3228
+
wine_dbgstr_guid(&clsid));
2893
3229
2894
3230
hr = IMarshal_MarshalInterface(pFTMarshal, pStream, &IID_IClassFactory,
2895
3231
&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
···
2906
3242
IUnknown_Release(pProxy);
2907
3243
2908
3244
ok_no_locks();
2909
2909
-
2910
2910
-
/* native doesn't allow us to unmarshal or release the stream data,
2911
2911
-
* presumably because it wants us to call CoMarshalInterface instead */
2912
2912
-
if (0)
2913
2913
-
{
2914
2914
-
/* local normal marshaling */
2915
2915
-
2916
2916
-
IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
2917
2917
-
hr = IMarshal_MarshalInterface(pFTMarshal, pStream, &IID_IClassFactory, &Test_ClassFactory, MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
2918
2918
-
ok_ole_success(hr, IMarshal_MarshalInterface);
2919
2919
-
2920
2920
-
ok_more_than_one_lock();
2921
2921
-
2922
2922
-
test_freethreadedmarshaldata(pStream, MSHCTX_LOCAL, &Test_ClassFactory, MSHLFLAGS_NORMAL);
2923
2923
-
2924
2924
-
IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
2925
2925
-
hr = IMarshal_ReleaseMarshalData(pFTMarshal, pStream);
2926
2926
-
ok_ole_success(hr, IMarshal_ReleaseMarshalData);
2927
2927
-
2928
2928
-
ok_no_locks();
2929
2929
-
}
2930
3245
2931
3246
/* inproc table-strong marshaling */
2932
3247
···
3002
3317
IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
3003
3318
hr = IMarshal_UnmarshalInterface(pFTMarshal, pStream, &IID_IUnknown, (void **)&pProxy);
3004
3319
ok_ole_success(hr, IMarshal_UnmarshalInterface);
3320
3320
+
3321
3321
+
ok_no_locks();
3322
3322
+
3323
3323
+
/* local normal marshaling */
3324
3324
+
3325
3325
+
hr = IMarshal_GetUnmarshalClass(pFTMarshal, &IID_IClassFactory,
3326
3326
+
&Test_ClassFactory, MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL, &clsid);
3327
3327
+
ok_ole_success(hr, IMarshal_GetUnmarshalClass);
3328
3328
+
ok(IsEqualIID(&clsid, &CLSID_StdMarshal), "clsid = %s\n",
3329
3329
+
wine_dbgstr_guid(&clsid));
3330
3330
+
3331
3331
+
IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
3332
3332
+
hr = IMarshal_MarshalInterface(pFTMarshal, pStream, &IID_IClassFactory, &Test_ClassFactory, MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
3333
3333
+
ok_ole_success(hr, IMarshal_MarshalInterface);
3334
3334
+
3335
3335
+
ok_more_than_one_lock();
3336
3336
+
3337
3337
+
test_freethreadedmarshaldata(pStream, MSHCTX_LOCAL, &Test_ClassFactory, MSHLFLAGS_NORMAL);
3338
3338
+
3339
3339
+
IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
3340
3340
+
hr = CoReleaseMarshalData(pStream);
3341
3341
+
ok_ole_success(hr, CoReleaseMarshalData);
3005
3342
3006
3343
ok_no_locks();
3007
3344
···
3943
4280
WCHAR bufferW[39];
3944
4281
char buffer[39];
3945
4282
LONG name_size = sizeof(name);
3946
3946
-
StringFromGUID2(riid, bufferW, sizeof(bufferW)/sizeof(bufferW[0]));
3947
3947
-
WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer, sizeof(buffer), NULL, NULL);
4283
4283
+
StringFromGUID2(riid, bufferW, ARRAY_SIZE(bufferW));
4284
4284
+
WideCharToMultiByte(CP_ACP, 0, bufferW, ARRAY_SIZE(bufferW), buffer, sizeof(buffer), NULL, NULL);
3948
4285
if (RegOpenKeyExA(HKEY_CLASSES_ROOT, "Interface", 0, KEY_QUERY_VALUE, &hkeyInterface) != ERROR_SUCCESS)
3949
4286
{
3950
4287
memcpy(name, buffer, sizeof(buffer));
···
4323
4660
} while (with_external_conn);
4324
4661
4325
4662
test_marshal_channel_buffer();
4663
4663
+
test_StdMarshal_custom_marshaling();
4664
4664
+
test_DfMarshal_custom_marshaling();
4665
4665
+
test_CoGetStandardMarshal();
4326
4666
test_hresult_marshaling();
4327
4667
test_proxy_used_in_wrong_thread();
4328
4668
test_message_filter();
+10
-10
modules/rostests/winetests/ole32/moniker.c
···
29
29
#include "winbase.h"
30
30
#include "objbase.h"
31
31
#include "ocidl.h"
32
32
-
#include "initguid.h"
33
32
#include "comcat.h"
34
33
#include "olectl.h"
35
34
···
38
37
#define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks)
39
38
#define ok_no_locks() ok(cLocks == 0, "Number of locks should be 0, but actually is %d\n", cLocks)
40
39
#define ok_ole_success(hr, func) ok(hr == S_OK, #func " failed with error 0x%08x\n", hr)
41
41
-
#define COUNTOF(x) (sizeof(x) / sizeof(x[0]))
42
40
43
41
#define CHECK_EXPECTED_METHOD(method_name) \
44
42
do { \
···
905
903
hr = CreateBindCtx(0, &pbc);
906
904
ok_ole_success(hr, CreateBindCtx);
907
905
908
908
-
for (i = 0; i < sizeof(invalid_parameters)/sizeof(invalid_parameters[0]); i++)
906
906
+
for (i = 0; i < ARRAY_SIZE(invalid_parameters); i++)
909
907
{
910
908
eaten = 0xdeadbeef;
911
909
pmk = (IMoniker *)0xdeadbeef;
···
947
945
pmk = NULL;
948
946
hr = MkParseDisplayName(pbc, wszDisplayName, &eaten, &pmk);
949
947
ok_ole_success(hr, MkParseDisplayName);
950
950
-
ok(eaten == sizeof(wszDisplayName)/sizeof(WCHAR) - 1,
948
948
+
ok(eaten == ARRAY_SIZE(wszDisplayName) - 1,
951
949
"Processed character count should have been 43 instead of %u\n", eaten);
952
950
if (pmk)
953
951
{
···
969
967
pmk = NULL;
970
968
hr = MkParseDisplayName(pbc, wszDisplayNameRunning, &eaten, &pmk);
971
969
ok_ole_success(hr, MkParseDisplayName);
972
972
-
ok(eaten == sizeof(wszDisplayNameRunning)/sizeof(WCHAR) - 1,
970
970
+
ok(eaten == ARRAY_SIZE(wszDisplayNameRunning) - 1,
973
971
"Processed character count should have been 15 instead of %u\n", eaten);
974
972
if (pmk)
975
973
{
···
987
985
expected_display_name = wszDisplayNameProgId1;
988
986
hr = MkParseDisplayName(pbc, wszDisplayNameProgId1, &eaten, &pmk);
989
987
ok_ole_success(hr, MkParseDisplayName);
990
990
-
ok(eaten == sizeof(wszDisplayNameProgId1)/sizeof(WCHAR) - 1,
988
988
+
ok(eaten == ARRAY_SIZE(wszDisplayNameProgId1) - 1,
991
989
"Processed character count should have been 8 instead of %u\n", eaten);
992
990
if (pmk)
993
991
{
···
999
997
expected_display_name = wszDisplayNameProgId2;
1000
998
hr = MkParseDisplayName(pbc, wszDisplayNameProgId2, &eaten, &pmk);
1001
999
ok_ole_success(hr, MkParseDisplayName);
1002
1002
-
ok(eaten == sizeof(wszDisplayNameProgId2)/sizeof(WCHAR) - 1,
1000
1000
+
ok(eaten == ARRAY_SIZE(wszDisplayNameProgId2) - 1,
1003
1001
"Processed character count should have been 8 instead of %u\n", eaten);
1004
1002
if (pmk)
1005
1003
{
···
1021
1019
1022
1020
GetSystemDirectoryA(szDisplayNameFile, sizeof(szDisplayNameFile));
1023
1021
strcat(szDisplayNameFile, "\\kernel32.dll");
1024
1024
-
len = MultiByteToWideChar(CP_ACP, 0, szDisplayNameFile, -1, wszDisplayNameFile, sizeof(wszDisplayNameFile)/sizeof(wszDisplayNameFile[0]));
1022
1022
+
len = MultiByteToWideChar(CP_ACP, 0, szDisplayNameFile, -1, wszDisplayNameFile,
1023
1023
+
ARRAY_SIZE(wszDisplayNameFile));
1025
1024
hr = MkParseDisplayName(pbc, wszDisplayNameFile, &eaten, &pmk);
1026
1025
ok_ole_success(hr, MkParseDisplayName);
1027
1026
ok(eaten == len - 1, "Processed character count should have been %d instead of %u\n", len - 1, eaten);
···
1034
1033
1035
1034
hr = MkParseDisplayName(pbc, wszDisplayName, &eaten, &pmk);
1036
1035
ok_ole_success(hr, MkParseDisplayName);
1037
1037
-
ok(eaten == sizeof(wszDisplayName)/sizeof(WCHAR) - 1, "Processed character count should have been 43 instead of %u\n", eaten);
1036
1036
+
ok(eaten == ARRAY_SIZE(wszDisplayName) - 1,
1037
1037
+
"Processed character count should have been 43 instead of %u\n", eaten);
1038
1038
1039
1039
if (pmk)
1040
1040
{
···
1550
1550
1551
1551
trace("ACP is %u\n", GetACP());
1552
1552
1553
1553
-
for (i = 0; i < COUNTOF(wszFile); ++i)
1553
1553
+
for (i = 0; i < ARRAY_SIZE(wszFile); ++i)
1554
1554
{
1555
1555
int j ;
1556
1556
if (i == 2)
+197
-10
modules/rostests/winetests/ole32/ole2.c
···
33
33
34
34
#include "wine/test.h"
35
35
36
36
-
#include "initguid.h"
37
37
-
38
38
-
DEFINE_GUID(CLSID_Picture_Metafile,0x315,0,0,0xc0,0,0,0,0,0,0,0x46);
39
39
-
DEFINE_GUID(CLSID_Picture_Dib,0x316,0,0,0xc0,0,0,0,0,0,0,0x46);
40
40
-
DEFINE_GUID(CLSID_Picture_EnhMetafile,0x319,0,0,0xc0,0,0,0,0,0,0,0x46);
41
41
-
42
36
#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
43
37
44
38
#define DEFINE_EXPECT(func) \
···
258
252
mf->yExt = 200;
259
253
mf->hMF = CloseMetaFile(hdc);
260
254
GlobalUnlock(U(med)->hMetaFilePict);
255
255
+
med->pUnkForRelease = NULL;
256
256
+
}
257
257
+
258
258
+
static void create_text(STGMEDIUM *med)
259
259
+
{
260
260
+
HGLOBAL handle;
261
261
+
char *p;
262
262
+
263
263
+
handle = GlobalAlloc(GMEM_DDESHARE|GMEM_MOVEABLE, 5);
264
264
+
p = GlobalLock(handle);
265
265
+
strcpy(p, "test");
266
266
+
GlobalUnlock(handle);
267
267
+
268
268
+
med->tymed = TYMED_HGLOBAL;
269
269
+
U(med)->hGlobal = handle;
261
270
med->pUnkForRelease = NULL;
262
271
}
263
272
···
1494
1503
case CF_BITMAP:
1495
1504
create_bitmap( med );
1496
1505
return S_OK;
1506
1506
+
case CF_ENHMETAFILE:
1507
1507
+
create_emf( med );
1508
1508
+
return S_OK;
1509
1509
+
case CF_TEXT:
1510
1510
+
create_text( med );
1511
1511
+
return S_OK;
1497
1512
default:
1498
1513
trace( "unhandled fmt %d\n", fmt->cfFormat );
1499
1514
}
···
1732
1747
{ NULL, 0 }
1733
1748
};
1734
1749
1735
1735
-
GetSystemDirectoryA(szSystemDir, sizeof(szSystemDir)/sizeof(szSystemDir[0]));
1750
1750
+
GetSystemDirectoryA(szSystemDir, ARRAY_SIZE(szSystemDir));
1736
1751
1737
1752
expected_method_list = methods_cacheinitnew;
1738
1753
···
1864
1879
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
1865
1880
ok_ole_success(hr, "IOleCache_Cache");
1866
1881
1867
1867
-
MultiByteToWideChar(CP_ACP, 0, szSystemDir, -1, wszPath, sizeof(wszPath)/sizeof(wszPath[0]));
1882
1882
+
MultiByteToWideChar(CP_ACP, 0, szSystemDir, -1, wszPath, ARRAY_SIZE(wszPath));
1868
1883
memcpy(wszPath+lstrlenW(wszPath), wszShell32, sizeof(wszShell32));
1869
1884
1870
1885
fmtetc.cfFormat = CF_METAFILEPICT;
···
2494
2509
{ &CLSID_Picture_EnhMetafile, 3, 1 }
2495
2510
};
2496
2511
2497
2497
-
for (i = 0; i < sizeof(data) / sizeof(data[0]); i++)
2512
2512
+
for (i = 0; i < ARRAY_SIZE(data); i++)
2498
2513
{
2499
2514
hr = CreateDataCache( NULL, data[i].clsid, &IID_IOleCache2, (void **)&cache );
2500
2515
ok( hr == S_OK, "got %08x\n", hr );
···
4080
4095
4081
4096
*enumerated_streams += 1;
4082
4097
}
4098
4098
+
4099
4099
+
IEnumSTATSTG_Release(enumstg);
4083
4100
}
4084
4101
4085
4102
static HRESULT stgmedium_cmp(const STGMEDIUM *med1, STGMEDIUM *med2)
···
4545
4562
{ &stg_def_9, &stg_def_9_saved },
4546
4563
};
4547
4564
4548
4548
-
for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++)
4565
4565
+
for (i = 0; i < ARRAY_SIZE(test_data); i++)
4549
4566
{
4550
4567
if (winetest_debug > 1)
4551
4568
trace("start testing storage def %d\n", i);
···
4597
4614
}
4598
4615
}
4599
4616
4617
4617
+
static void test_OleCreateStaticFromData(void)
4618
4618
+
{
4619
4619
+
HRESULT hr;
4620
4620
+
IOleObject *ole_obj = NULL;
4621
4621
+
IStorage *storage;
4622
4622
+
ILockBytes *ilb;
4623
4623
+
IPersist *persist;
4624
4624
+
CLSID clsid;
4625
4625
+
STATSTG statstg;
4626
4626
+
int enumerated_streams, matched_streams;
4627
4627
+
STGMEDIUM stgmed;
4628
4628
+
static FORMATETC dib_fmt[] =
4629
4629
+
{
4630
4630
+
{ CF_DIB, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL },
4631
4631
+
{ 0 }
4632
4632
+
};
4633
4633
+
static FORMATETC emf_fmt[] =
4634
4634
+
{
4635
4635
+
{ CF_ENHMETAFILE, NULL, DVASPECT_CONTENT, -1, TYMED_ENHMF },
4636
4636
+
{ 0 }
4637
4637
+
};
4638
4638
+
static FORMATETC text_fmt[] =
4639
4639
+
{
4640
4640
+
{ CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL },
4641
4641
+
{ 0 }
4642
4642
+
};
4643
4643
+
static const struct expected_method methods_create_from_dib[] =
4644
4644
+
{
4645
4645
+
{ "DataObject_EnumFormatEtc", TEST_TODO },
4646
4646
+
{ "DataObject_GetDataHere", 0 },
4647
4647
+
{ "DataObject_QueryGetData", 0, { CF_METAFILEPICT, NULL, DVASPECT_CONTENT, -1, TYMED_ISTORAGE } },
4648
4648
+
{ NULL }
4649
4649
+
};
4650
4650
+
static const struct expected_method methods_createstatic_from_dib[] =
4651
4651
+
{
4652
4652
+
{ "DataObject_GetData", 0, { CF_DIB, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL } },
4653
4653
+
{ NULL }
4654
4654
+
};
4655
4655
+
static const struct expected_method methods_createstatic_from_emf[] =
4656
4656
+
{
4657
4657
+
{ "DataObject_GetData", 0, { CF_ENHMETAFILE, NULL, DVASPECT_CONTENT, -1, TYMED_ENHMF } },
4658
4658
+
{ NULL }
4659
4659
+
};
4660
4660
+
static const struct expected_method methods_createstatic_from_text[] =
4661
4661
+
{
4662
4662
+
{ "DataObject_GetData", 0, { CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL } },
4663
4663
+
{ NULL }
4664
4664
+
};
4665
4665
+
static struct storage_def stg_def_dib =
4666
4666
+
{
4667
4667
+
&CLSID_Picture_Dib, 3,
4668
4668
+
{{ "\1Ole", -1, 0, 0, NULL, 0 },
4669
4669
+
{ "\1CompObj", -1, 0, 0, NULL, 0 },
4670
4670
+
{ "CONTENTS", -1, 0, 0, NULL, 0 }}
4671
4671
+
};
4672
4672
+
static struct storage_def stg_def_emf =
4673
4673
+
{
4674
4674
+
&CLSID_Picture_EnhMetafile, 3,
4675
4675
+
{{ "\1Ole", -1, 0, 0, NULL, 0 },
4676
4676
+
{ "\1CompObj", -1, 0, 0, NULL, 0 },
4677
4677
+
{ "CONTENTS", -1, 0, 0, NULL, 0 }}
4678
4678
+
};
4679
4679
+
4680
4680
+
4681
4681
+
hr = CreateILockBytesOnHGlobal(NULL, TRUE, &ilb);
4682
4682
+
ok(hr == S_OK, "CreateILockBytesOnHGlobal failed: 0x%08x.\n", hr);
4683
4683
+
hr = StgCreateDocfileOnILockBytes(ilb, STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE,
4684
4684
+
0, &storage);
4685
4685
+
ok(hr == S_OK, "StgCreateDocfileOnILockBytes failed: 0x%08x.\n", hr);
4686
4686
+
ILockBytes_Release(ilb);
4687
4687
+
4688
4688
+
hr = OleCreateStaticFromData(&DataObject, &IID_IOleObject, OLERENDER_FORMAT,
4689
4689
+
dib_fmt, NULL, NULL, (void **)&ole_obj);
4690
4690
+
ok(hr == E_INVALIDARG, "OleCreateStaticFromData should fail: 0x%08x.\n", hr);
4691
4691
+
4692
4692
+
hr = OleCreateStaticFromData(&DataObject, &IID_IOleObject, OLERENDER_FORMAT,
4693
4693
+
dib_fmt, NULL, storage, NULL);
4694
4694
+
ok(hr == E_INVALIDARG, "OleCreateStaticFromData should fail: 0x%08x.\n", hr);
4695
4695
+
4696
4696
+
/* CF_DIB */
4697
4697
+
g_dataobject_fmts = dib_fmt;
4698
4698
+
expected_method_list = methods_createstatic_from_dib;
4699
4699
+
hr = OleCreateStaticFromData(&DataObject, &IID_IOleObject, OLERENDER_FORMAT,
4700
4700
+
dib_fmt, NULL, storage, (void **)&ole_obj);
4701
4701
+
ok(hr == S_OK, "OleCreateStaticFromData failed: 0x%08x.\n", hr);
4702
4702
+
hr = IOleObject_QueryInterface(ole_obj, &IID_IPersist, (void **)&persist);
4703
4703
+
ok(hr == S_OK, "IOleObject_QueryInterface failed: 0x%08x.\n", hr);
4704
4704
+
hr = IPersist_GetClassID(persist, &clsid);
4705
4705
+
ok(hr == S_OK, "IPersist_GetClassID failed: 0x%08x.\n", hr);
4706
4706
+
ok(IsEqualCLSID(&clsid, &CLSID_Picture_Dib), "Got wrong clsid: %s, expected: %s.\n",
4707
4707
+
wine_dbgstr_guid(&clsid), wine_dbgstr_guid(&CLSID_Picture_Dib));
4708
4708
+
hr = IStorage_Stat(storage, &statstg, STATFLAG_NONAME);
4709
4709
+
ok_ole_success(hr, "IStorage_Stat");
4710
4710
+
ok(IsEqualCLSID(&CLSID_Picture_Dib, &statstg.clsid), "Wrong CLSID in storage.\n");
4711
4711
+
enumerated_streams = matched_streams = -1;
4712
4712
+
get_stgmedium(CF_DIB, &stgmed);
4713
4713
+
get_stgdef(&stg_def_dib, CF_DIB, &stgmed, 2);
4714
4714
+
check_storage_contents(storage, &stg_def_dib, &enumerated_streams, &matched_streams);
4715
4715
+
ok(enumerated_streams == matched_streams, "enumerated %d != matched %d\n",
4716
4716
+
enumerated_streams, matched_streams);
4717
4717
+
ok(enumerated_streams == stg_def_dib.stream_count, "created %d != def streams %d\n",
4718
4718
+
enumerated_streams, stg_def_dib.stream_count);
4719
4719
+
ReleaseStgMedium(&stgmed);
4720
4720
+
IPersist_Release(persist);
4721
4721
+
IStorage_Release(storage);
4722
4722
+
IOleObject_Release(ole_obj);
4723
4723
+
4724
4724
+
/* CF_ENHMETAFILE */
4725
4725
+
hr = CreateILockBytesOnHGlobal(NULL, TRUE, &ilb);
4726
4726
+
ok(hr == S_OK, "CreateILockBytesOnHGlobal failed: 0x%08x.\n", hr);
4727
4727
+
hr = StgCreateDocfileOnILockBytes(ilb, STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE,
4728
4728
+
0, &storage);
4729
4729
+
ok(hr == S_OK, "StgCreateDocfileOnILockBytes failed: 0x%08x.\n", hr);
4730
4730
+
ILockBytes_Release(ilb);
4731
4731
+
g_dataobject_fmts = emf_fmt;
4732
4732
+
expected_method_list = methods_createstatic_from_emf;
4733
4733
+
hr = OleCreateStaticFromData(&DataObject, &IID_IOleObject, OLERENDER_FORMAT,
4734
4734
+
emf_fmt, NULL, storage, (void **)&ole_obj);
4735
4735
+
ok(hr == S_OK, "OleCreateStaticFromData failed: 0x%08x.\n", hr);
4736
4736
+
hr = IOleObject_QueryInterface(ole_obj, &IID_IPersist, (void **)&persist);
4737
4737
+
ok(hr == S_OK, "IOleObject_QueryInterface failed: 0x%08x.\n", hr);
4738
4738
+
hr = IPersist_GetClassID(persist, &clsid);
4739
4739
+
ok(hr == S_OK, "IPersist_GetClassID failed: 0x%08x.\n", hr);
4740
4740
+
ok(IsEqualCLSID(&clsid, &CLSID_Picture_EnhMetafile), "Got wrong clsid: %s, expected: %s.\n",
4741
4741
+
wine_dbgstr_guid(&clsid), wine_dbgstr_guid(&CLSID_Picture_EnhMetafile));
4742
4742
+
hr = IStorage_Stat(storage, &statstg, STATFLAG_NONAME);
4743
4743
+
ok_ole_success(hr, "IStorage_Stat");
4744
4744
+
ok(IsEqualCLSID(&CLSID_Picture_EnhMetafile, &statstg.clsid), "Wrong CLSID in storage.\n");
4745
4745
+
enumerated_streams = matched_streams = -1;
4746
4746
+
get_stgmedium(CF_ENHMETAFILE, &stgmed);
4747
4747
+
get_stgdef(&stg_def_emf, CF_ENHMETAFILE, &stgmed, 2);
4748
4748
+
check_storage_contents(storage, &stg_def_emf, &enumerated_streams, &matched_streams);
4749
4749
+
ok(enumerated_streams == matched_streams, "enumerated %d != matched %d\n",
4750
4750
+
enumerated_streams, matched_streams);
4751
4751
+
ok(enumerated_streams == stg_def_emf.stream_count, "created %d != def streams %d\n",
4752
4752
+
enumerated_streams, stg_def_emf.stream_count);
4753
4753
+
ReleaseStgMedium(&stgmed);
4754
4754
+
IPersist_Release(persist);
4755
4755
+
IStorage_Release(storage);
4756
4756
+
IOleObject_Release(ole_obj);
4757
4757
+
4758
4758
+
/* CF_TEXT */
4759
4759
+
hr = CreateILockBytesOnHGlobal(NULL, TRUE, &ilb);
4760
4760
+
ok(hr == S_OK, "CreateILockBytesOnHGlobal failed: 0x%08x.\n", hr);
4761
4761
+
hr = StgCreateDocfileOnILockBytes(ilb, STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE,
4762
4762
+
0, &storage);
4763
4763
+
ok(hr == S_OK, "StgCreateDocfileOnILockBytes failed: 0x%08x.\n", hr);
4764
4764
+
ILockBytes_Release(ilb);
4765
4765
+
g_dataobject_fmts = text_fmt;
4766
4766
+
expected_method_list = methods_createstatic_from_text;
4767
4767
+
hr = OleCreateStaticFromData(&DataObject, &IID_IOleObject, OLERENDER_FORMAT,
4768
4768
+
text_fmt, NULL, storage, (void **)&ole_obj);
4769
4769
+
ok(hr == DV_E_CLIPFORMAT, "OleCreateStaticFromData should fail: 0x%08x.\n", hr);
4770
4770
+
IStorage_Release(storage);
4771
4771
+
4772
4772
+
hr = CreateILockBytesOnHGlobal(NULL, TRUE, &ilb);
4773
4773
+
ok(hr == S_OK, "CreateILockBytesOnHGlobal failed: 0x%08x.\n", hr);
4774
4774
+
hr = StgCreateDocfileOnILockBytes(ilb, STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE,
4775
4775
+
0, &storage);
4776
4776
+
ok(hr == S_OK, "StgCreateDocfileOnILockBytes failed: 0x%08x.\n", hr);
4777
4777
+
ILockBytes_Release(ilb);
4778
4778
+
g_dataobject_fmts = dib_fmt;
4779
4779
+
expected_method_list = methods_create_from_dib;
4780
4780
+
hr = OleCreateFromData(&DataObject, &IID_IOleObject, OLERENDER_FORMAT, dib_fmt, NULL,
4781
4781
+
storage, (void **)&ole_obj);
4782
4782
+
todo_wine ok(hr == DV_E_FORMATETC, "OleCreateFromData should failed: 0x%08x.\n", hr);
4783
4783
+
IStorage_Release(storage);
4784
4784
+
}
4785
4785
+
4600
4786
START_TEST(ole2)
4601
4787
{
4602
4788
DWORD dwRegister;
···
4647
4833
test_data_cache_save();
4648
4834
test_data_cache_save_data();
4649
4835
test_data_cache_contents();
4836
4836
+
test_OleCreateStaticFromData();
4650
4837
4651
4838
CoUninitialize();
4652
4839
}
+1
-4
modules/rostests/winetests/ole32/ole_server.c
···
30
30
31
31
#include <initguid.h>
32
32
DEFINE_GUID(CLSID_WineTestObject, 0xdeadbeef,0xdead,0xbeef,0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef);
33
33
-
#ifndef CLSID_IdentityUnmarshal
34
34
-
DEFINE_GUID(CLSID_IdentityUnmarshal,0x0000001b,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
35
35
-
#endif
36
33
DEFINE_GUID(CLSID_UnknownUnmarshal,0x4c1e39e1,0xe3e3,0x4296,0xaa,0x86,0xec,0x93,0x8d,0x89,0x6e,0x92);
37
34
38
35
struct winetest_info
···
69
66
70
67
if (!guid) return "(null)";
71
68
72
72
-
for (i = 0; i < sizeof(guid_name)/sizeof(guid_name[0]); i++)
69
69
+
for (i = 0; i < ARRAY_SIZE(guid_name); i++)
73
70
{
74
71
if (IsEqualIID(guid, guid_name[i].guid))
75
72
return guid_name[i].name;
+1
-1
modules/rostests/winetests/ole32/propvariant.c
···
189
189
ok(U(propvar).uhVal.QuadPart == 0, "expected 0, got %#x/%#x\n",
190
190
U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
191
191
192
192
-
for (i = 0; i < sizeof(valid_types)/sizeof(valid_types[0]); i++)
192
192
+
for (i = 0; i < ARRAY_SIZE(valid_types); i++)
193
193
{
194
194
VARTYPE vt;
195
195
-6
modules/rostests/winetests/ole32/stg_prop.c
···
19
19
#define COBJMACROS
20
20
#include "objbase.h"
21
21
#include "wine/test.h"
22
22
-
#include "initguid.h"
23
23
-
24
24
-
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
25
25
-
DEFINE_GUID(FMTID_SummaryInformation,0xF29F85E0,0x4FF9,0x1068,0xAB,0x91,0x08,0x00,0x2B,0x27,0xB3,0xD9);
26
26
-
DEFINE_GUID(FMTID_DocSummaryInformation,0xD5CDD502,0x2E9C,0x101B,0x93,0x97,0x08,0x00,0x2B,0x2C,0xF9,0xAE);
27
27
-
DEFINE_GUID(FMTID_UserDefinedProperties,0xD5CDD505,0x2E9C,0x101B,0x93,0x97,0x08,0x00,0x2B,0x2C,0xF9,0xAE);
28
22
29
23
#ifndef PID_BEHAVIOR
30
24
#define PID_BEHAVIOR 0x80000003
+7
-5
modules/rostests/winetests/ole32/storage32.c
···
21
21
#include <stdio.h>
22
22
23
23
#define COBJMACROS
24
24
-
#ifndef __REACTOS__
24
24
+
#ifdef __REACTOS__
25
25
+
#define CONST_VTABLE
26
26
+
#else
25
27
#define NONAMELESSUNION
26
28
#define NONAMELESSSTRUCT
27
29
#endif
···
222
224
return S_OK;
223
225
}
224
226
225
225
-
static /* const */ ILockBytesVtbl TestLockBytes_Vtbl = {
227
227
+
static const ILockBytesVtbl TestLockBytes_Vtbl = {
226
228
TestLockBytes_QueryInterface,
227
229
TestLockBytes_AddRef,
228
230
TestLockBytes_Release,
···
2086
2088
{
2087
2089
int i, j, idx = 0;
2088
2090
2089
2089
-
for (i = 0; i < sizeof(access_modes)/sizeof(access_modes[0]); i++)
2091
2091
+
for (i = 0; i < ARRAY_SIZE(access_modes); i++)
2090
2092
{
2091
2091
-
for (j = 0; j < sizeof(share_modes)/sizeof(share_modes[0]); j++)
2093
2093
+
for (j = 0; j < ARRAY_SIZE(share_modes); j++)
2092
2094
{
2093
2095
DWORD lasterr;
2094
2096
HANDLE hfile;
···
3492
3494
IStorage *stg;
3493
3495
HRESULT hr;
3494
3496
3495
3495
-
for (i=0; i<sizeof(lock_tests)/sizeof(lock_tests[0]); i++)
3497
3497
+
for (i = 0; i < ARRAY_SIZE(lock_tests); i++)
3496
3498
{
3497
3499
const struct lock_test *current = &lock_tests[i];
3498
3500
BOOL any_failure = FALSE;
+1
-1
modules/rostests/winetests/ole32/usrmarshal.c
···
1067
1067
ok(*(ULONG*)wiresnb->rgString == wiresnb->ulCntStr, "got %u\n", *(ULONG*)wiresnb->rgString);
1068
1068
dataW = &wiresnb->rgString[2];
1069
1069
ok(!lstrcmpW(dataW, str1W), "marshalled string 0: %s\n", wine_dbgstr_w(dataW));
1070
1070
-
dataW += sizeof(str1W)/sizeof(WCHAR);
1070
1070
+
dataW += ARRAY_SIZE(str1W);
1071
1071
ok(!lstrcmpW(dataW, str2W), "marshalled string 1: %s\n", wine_dbgstr_w(dataW));
1072
1072
1073
1073
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);