Commit f8ddba3a authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

shell32: Implement IDataObject::SetData().

parent 4f02c8ba
...@@ -344,11 +344,49 @@ static HRESULT WINAPI IDataObject_fnGetCanonicalFormatEtc(IDataObject *iface, LP ...@@ -344,11 +344,49 @@ static HRESULT WINAPI IDataObject_fnGetCanonicalFormatEtc(IDataObject *iface, LP
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IDataObject_fnSetData(IDataObject *iface, LPFORMATETC pformatetc, STGMEDIUM *pmedium, BOOL fRelease) static HRESULT WINAPI IDataObject_fnSetData(IDataObject *iface,
FORMATETC *format, STGMEDIUM *medium, BOOL release)
{ {
IDataObjectImpl *This = impl_from_IDataObject(iface); IDataObjectImpl *obj = impl_from_IDataObject(iface);
FIXME("(%p)->()\n", This); struct data *new_array;
return E_NOTIMPL;
TRACE("iface %p, format %p, medium %p, release %d.\n", iface, format, medium, release);
if (!release)
return E_INVALIDARG;
if (format->tymed != TYMED_HGLOBAL)
{
FIXME("Unhandled format tymed %#lx.\n", format->tymed);
return E_NOTIMPL;
}
if (medium->tymed != TYMED_HGLOBAL)
{
FIXME("Unhandled medium tymed %#lx.\n", format->tymed);
return E_NOTIMPL;
}
if (medium->pUnkForRelease)
FIXME("Ignoring IUnknown %p.\n", medium->pUnkForRelease);
for (size_t i = 0; i < obj->data_count; ++i)
{
if (obj->data[i].cf == format->cfFormat)
{
GlobalFree(obj->data[i].global);
obj->data[i].global = medium->hGlobal;
return S_OK;
}
}
if (!(new_array = realloc(obj->data, (obj->data_count + 1) * sizeof(*obj->data))))
return E_OUTOFMEMORY;
obj->data = new_array;
obj->data[obj->data_count].cf = format->cfFormat;
obj->data[obj->data_count].global = medium->hGlobal;
++obj->data_count;
return S_OK;
} }
static HRESULT WINAPI IDataObject_fnEnumFormatEtc(IDataObject *iface, DWORD direction, IEnumFORMATETC **out) static HRESULT WINAPI IDataObject_fnEnumFormatEtc(IDataObject *iface, DWORD direction, IEnumFORMATETC **out)
......
...@@ -5318,15 +5318,15 @@ static void test_enum_format(IDataObject *data_obj) ...@@ -5318,15 +5318,15 @@ static void test_enum_format(IDataObject *data_obj)
hr = IEnumFORMATETC_Reset(enum1); hr = IEnumFORMATETC_Reset(enum1);
ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IEnumFORMATETC_Skip(enum1, 4); hr = IEnumFORMATETC_Skip(enum1, 4);
ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
hr = IEnumFORMATETC_Skip(enum1, 1);
todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr); todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
hr = IEnumFORMATETC_Skip(enum1, 1);
ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
hr = IEnumFORMATETC_Reset(enum1); hr = IEnumFORMATETC_Reset(enum1);
ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IEnumFORMATETC_Skip(enum1, 3); hr = IEnumFORMATETC_Skip(enum1, 3);
ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IEnumFORMATETC_Skip(enum1, 1); hr = IEnumFORMATETC_Skip(enum1, 1);
ok(hr == S_FALSE, "Got hr %#lx.\n", hr); todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
hr = IEnumFORMATETC_Next(enum1, 1, formats, NULL); hr = IEnumFORMATETC_Next(enum1, 1, formats, NULL);
todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr); todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
hr = IEnumFORMATETC_Next(enum2, 1, formats, NULL); hr = IEnumFORMATETC_Next(enum2, 1, formats, NULL);
...@@ -5342,7 +5342,7 @@ static void test_enum_format(IDataObject *data_obj) ...@@ -5342,7 +5342,7 @@ static void test_enum_format(IDataObject *data_obj)
formats[0].lindex = -1; formats[0].lindex = -1;
formats[0].tymed = TYMED_HGLOBAL; formats[0].tymed = TYMED_HGLOBAL;
hr = IDataObject_SetData(data_obj, &formats[0], &medium, TRUE); hr = IDataObject_SetData(data_obj, &formats[0], &medium, TRUE);
todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IEnumFORMATETC_Reset(enum1); hr = IEnumFORMATETC_Reset(enum1);
ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(hr == S_OK, "Got hr %#lx.\n", hr);
...@@ -5457,23 +5457,20 @@ static void test_DataObject(void) ...@@ -5457,23 +5457,20 @@ static void test_DataObject(void)
medium.hGlobal = global; medium.hGlobal = global;
fmt.tymed = TYMED_HGLOBAL; fmt.tymed = TYMED_HGLOBAL;
hr = IDataObject_SetData(data_obj, &fmt, &medium, FALSE); hr = IDataObject_SetData(data_obj, &fmt, &medium, FALSE);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
hr = IDataObject_SetData(data_obj, &fmt, &medium, TRUE); hr = IDataObject_SetData(data_obj, &fmt, &medium, TRUE);
todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IDataObject_QueryGetData(data_obj, &fmt); hr = IDataObject_QueryGetData(data_obj, &fmt);
todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(hr == S_OK, "Got hr %#lx.\n", hr);
memset(&medium, 0xcc, sizeof(medium)); memset(&medium, 0xcc, sizeof(medium));
hr = IDataObject_GetData(data_obj, &fmt, &medium); hr = IDataObject_GetData(data_obj, &fmt, &medium);
todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(hr == S_OK, "Got hr %#lx.\n", hr);
if (hr == S_OK) ok(medium.hGlobal && medium.hGlobal != global, "Got global %p.\n", medium.hGlobal);
{ value = GlobalLock(medium.hGlobal);
ok(medium.hGlobal && medium.hGlobal != global, "Got global %p.\n", medium.hGlobal); ok(*value == 0xabacab, "Got value %#x.\n", *value);
value = GlobalLock(medium.hGlobal); GlobalUnlock(medium.hGlobal);
ok(*value == 0xabacab, "Got value %#x.\n", *value); ReleaseStgMedium(&medium);
GlobalUnlock(medium.hGlobal);
ReleaseStgMedium(&medium);
}
for (unsigned int i = 0; i < ARRAY_SIZE(enum_directions); ++i) for (unsigned int i = 0; i < ARRAY_SIZE(enum_directions); ++i)
{ {
......
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