void do_filecontents_test( const com_ptr<IDataObject>& data_object, const vector<wpath>& files, size_t index) { FORMATETC fetc = { CF_FILECONTENTS, NULL, DVASPECT_CONTENT, numeric_cast<LONG>(index), TYMED_ISTREAM }; StorageMedium medium; HRESULT hr = data_object->GetData(&fetc, medium.out()); BOOST_REQUIRE_OK(hr); com_ptr<IStream> stream = medium.get().pstm; BOOST_REQUIRE(file_stream_equivalence(files.at(index), stream)); }
void do_filedescriptor_test( const com_ptr<IDataObject>& data_object, const vector<wpath>& files) { FORMATETC fetc = { CF_FILEDESCRIPTORW, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; StorageMedium medium; HRESULT hr = data_object->GetData(&fetc, medium.out()); BOOST_REQUIRE_OK(hr); FileGroupDescriptor fgd(medium.get().hGlobal); BOOST_REQUIRE_EQUAL(fgd.size(), files.size()); for (size_t i = 0; i < files.size(); ++i) { BOOST_REQUIRE_EQUAL(fgd[i].path(), files[i].filename()); BOOST_REQUIRE_EQUAL(fgd[i].file_size(), file_size(files[i])); BOOST_REQUIRE_EQUAL( fgd[i].last_write_time(), from_time_t(last_write_time(files[i]))); } }