本文整理汇总了C++中IStream_Write函数的典型用法代码示例。如果您正苦于以下问题:C++ IStream_Write函数的具体用法?C++ IStream_Write怎么用?C++ IStream_Write使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IStream_Write函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PersistHistory_SaveHistory
static HRESULT WINAPI PersistHistory_SaveHistory(IPersistHistory *iface, IStream *pStream)
{
HTMLDocument *This = impl_from_IPersistHistory(iface);
ULONG len, written;
BSTR display_uri;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, pStream);
if(!This->window || !This->window->uri) {
FIXME("No current URI\n");
return E_FAIL;
}
/* NOTE: The format we store is *not* compatible with native MSHTML. We currently
* store only URI of the page (as a length followed by a string) */
hres = IUri_GetDisplayUri(This->window->uri, &display_uri);
if(FAILED(hres))
return hres;
len = SysStringLen(display_uri);
hres = IStream_Write(pStream, &len, sizeof(len), &written);
if(SUCCEEDED(hres))
hres = IStream_Write(pStream, display_uri, len*sizeof(WCHAR), &written);
SysFreeString(display_uri);
return hres;
}
开发者ID:GeonHun,项目名称:wine,代码行数:27,代码来源:persist.c
示例2: ItemMonikerImpl_Save
/******************************************************************************
* ItemMoniker_Save
******************************************************************************/
static HRESULT WINAPI ItemMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty)
{
ItemMonikerImpl *This = impl_from_IMoniker(iface);
HRESULT res;
CHAR *itemNameA,*itemDelimiterA;
/* data written by this function are : 1) DWORD : size of item delimiter string ('\0' included ) */
/* 2) String (type A): item delimiter string ('\0' included) */
/* 3) DWORD : size of item name string ('\0' included) */
/* 4) String (type A): item name string ('\0' included) */
DWORD nameLength = WideCharToMultiByte( CP_ACP, 0, This->itemName, -1, NULL, 0, NULL, NULL);
DWORD delimiterLength = WideCharToMultiByte( CP_ACP, 0, This->itemDelimiter, -1, NULL, 0, NULL, NULL);
itemNameA=HeapAlloc(GetProcessHeap(),0,nameLength);
itemDelimiterA=HeapAlloc(GetProcessHeap(),0,delimiterLength);
WideCharToMultiByte( CP_ACP, 0, This->itemName, -1, itemNameA, nameLength, NULL, NULL);
WideCharToMultiByte( CP_ACP, 0, This->itemDelimiter, -1, itemDelimiterA, delimiterLength, NULL, NULL);
TRACE("%p, %s\n", pStm, fClearDirty ? "TRUE" : "FALSE");
res=IStream_Write(pStm,&delimiterLength,sizeof(DWORD),NULL);
res=IStream_Write(pStm,itemDelimiterA,delimiterLength * sizeof(CHAR),NULL);
res=IStream_Write(pStm,&nameLength,sizeof(DWORD),NULL);
res=IStream_Write(pStm,itemNameA,nameLength * sizeof(CHAR),NULL);
HeapFree(GetProcessHeap(), 0, itemNameA);
HeapFree(GetProcessHeap(), 0, itemDelimiterA);
return res;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:33,代码来源:itemmoniker.c
示例3: CB_Save
static HRESULT CALLBACK CB_Save(LPITEMDATA pInfo, IStream *pStm, LPARAM lp)
{
HRESULT hRes;
ok(lp == 0xdeadbeef, "lp=%ld\n", lp);
hRes = IStream_Write(pStm, &pInfo->iPos, sizeof(INT), NULL);
ok(hRes == S_OK, "hRes=0x%x\n", hRes);
hRes = IStream_Write(pStm, &pInfo->pvData, sizeof(PVOID), NULL);
ok(hRes == S_OK, "hRes=0x%x\n", hRes);
return S_OK;
}
开发者ID:devyn,项目名称:wine,代码行数:11,代码来源:dpa.c
示例4: CB_Save
static HRESULT CALLBACK CB_Save(DPASTREAMINFO *pInfo, IStream *pStm, LPVOID lp)
{
HRESULT hRes;
ok(lp == (LPVOID)0xdeadbeef, "lp=%p\n", lp);
hRes = IStream_Write(pStm, &pInfo->iPos, sizeof(INT), NULL);
expect(S_OK, hRes);
hRes = IStream_Write(pStm, &pInfo->pvItem, sizeof(PVOID), NULL);
expect(S_OK, hRes);
return S_OK;
}
开发者ID:GYGit,项目名称:reactos,代码行数:11,代码来源:dpa.c
示例5: ClassMoniker_Save
/******************************************************************************
* ClassMoniker_Save
******************************************************************************/
static HRESULT WINAPI ClassMoniker_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty)
{
ClassMoniker *This = impl_from_IMoniker(iface);
HRESULT hr;
DWORD zero = 0;
TRACE("(%p, %s)\n", pStm, fClearDirty ? "TRUE" : "FALSE");
hr = IStream_Write(pStm, &This->clsid, sizeof(This->clsid), NULL);
if (FAILED(hr)) return hr;
return IStream_Write(pStm, &zero, sizeof(zero), NULL);
}
开发者ID:RareHare,项目名称:reactos,代码行数:16,代码来源:classmoniker.c
示例6: FTMarshalImpl_MarshalInterface
static HRESULT WINAPI
FTMarshalImpl_MarshalInterface (LPMARSHAL iface, IStream * pStm, REFIID riid, void *pv,
DWORD dwDestContext, void *pvDestContext, DWORD mshlflags)
{
IMarshal *pMarshal = NULL;
HRESULT hres;
TRACE("(%p, %s, %p, 0x%x, %p, 0x%x)\n", pStm, debugstr_guid(riid), pv,
dwDestContext, pvDestContext, mshlflags);
/* if the marshalling happens inside the same process the interface pointer is
copied between the apartments */
if (dwDestContext == MSHCTX_INPROC || dwDestContext == MSHCTX_CROSSCTX) {
void *object;
DWORD constant = 0;
GUID unknown_guid = { 0 };
hres = IUnknown_QueryInterface((IUnknown *)pv, riid, &object);
if (FAILED(hres))
return hres;
/* don't hold a reference to table-weak marshaled interfaces */
if (mshlflags & MSHLFLAGS_TABLEWEAK)
IUnknown_Release((IUnknown *)object);
hres = IStream_Write (pStm, &mshlflags, sizeof (mshlflags), NULL);
if (hres != S_OK) return STG_E_MEDIUMFULL;
hres = IStream_Write (pStm, &object, sizeof (object), NULL);
if (hres != S_OK) return STG_E_MEDIUMFULL;
if (sizeof(object) == sizeof(DWORD))
{
hres = IStream_Write (pStm, &constant, sizeof (constant), NULL);
if (hres != S_OK) return STG_E_MEDIUMFULL;
}
hres = IStream_Write (pStm, &unknown_guid, sizeof (unknown_guid), NULL);
if (hres != S_OK) return STG_E_MEDIUMFULL;
return S_OK;
}
/* use the standard marshaler to handle all other cases */
CoGetStandardMarshal (riid, pv, dwDestContext, pvDestContext, mshlflags, &pMarshal);
hres = IMarshal_MarshalInterface (pMarshal, pStm, riid, pv, dwDestContext, pvDestContext, mshlflags);
IMarshal_Release (pMarshal);
return hres;
}
开发者ID:AmesianX,项目名称:RosWine,代码行数:50,代码来源:ftmarshal.c
示例7: AntiMonikerImpl_Save
/******************************************************************************
* AntiMoniker_Save
******************************************************************************/
static HRESULT WINAPI
AntiMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDirty)
{
static const DWORD constant = 1;
/* data written by this function is only a DWORD constant set to 1 ! */
return IStream_Write(pStm,&constant,sizeof(constant),NULL);
}
开发者ID:Barrell,项目名称:wine,代码行数:10,代码来源:antimoniker.c
示例8: CreateSampleFiles
// Creates a set of sample files in the current user's Documents directory to use as items in the
// custom category inserted into the Jump List.
HRESULT CreateSampleFiles()
{
PWSTR pszPathDocuments;
HRESULT hr = SHGetKnownFolderPath(FOLDERID_Documents, KF_FLAG_CREATE, NULL, &pszPathDocuments);
if (SUCCEEDED(hr))
{
for (UINT i = 0; SUCCEEDED(hr) && i < ARRAYSIZE(c_rgpszFiles); i++)
{
WCHAR szPathSample[MAX_PATH];
hr = PathCombine(szPathSample, pszPathDocuments, c_rgpszFiles[i]) ? S_OK : E_FAIL;
if (SUCCEEDED(hr))
{
IStream *pstm;
hr = SHCreateStreamOnFileEx(szPathSample, (STGM_WRITE | STGM_FAILIFTHERE), FILE_ATTRIBUTE_NORMAL, TRUE, NULL, &pstm);
if (SUCCEEDED(hr))
{
PCWSTR pszText = L"This is a sample file for the CustomJumpListSample.\r\n";
ULONG cb = (sizeof(pszText[0]) * (lstrlen(pszText) + 1));
hr = IStream_Write(pstm, pszText, cb);
pstm->Release();
}
else if (HRESULT_FROM_WIN32(ERROR_FILE_EXISTS) == hr)
{
// If the file exists, we're ok, we'll just reuse it
hr = S_OK;
}
}
}
CoTaskMemFree(pszPathDocuments);
}
return hr;
}
开发者ID:Ippei-Murofushi,项目名称:WindowsSDK7-Samples,代码行数:34,代码来源:CustomJumpListSample.cpp
示例9: XMLView_BindStatusCallback_OnDataAvailable
static HRESULT WINAPI XMLView_BindStatusCallback_OnDataAvailable(
IBindStatusCallback *iface, DWORD grfBSCF, DWORD dwSize,
FORMATETC *pformatetc, STGMEDIUM *pstgmed)
{
BindStatusCallback *This = impl_from_IBindStatusCallback(iface);
char buf[1024];
DWORD size;
HRESULT hres;
TRACE("(%p)->(%x %d %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
if(!This->stream)
return E_FAIL;
do {
hres = IStream_Read(pstgmed->u.pstm, buf, sizeof(buf), &size);
IStream_Write(This->stream, buf, size, &size);
} while(hres==S_OK && size);
if(FAILED(hres) && hres!=E_PENDING)
return hres;
if(hres != S_FALSE)
return S_OK;
return handle_xml_load(This);
}
开发者ID:RareHare,项目名称:reactos,代码行数:26,代码来源:xmlview.c
示例10: mxwriter_saxcontent_startDocument
static HRESULT WINAPI mxwriter_saxcontent_startDocument(ISAXContentHandler *iface)
{
mxwriter *This = impl_from_ISAXContentHandler( iface );
TRACE("(%p)\n", This);
/* If properties have been changed since the last "endDocument" call
* we need to reset the output buffer. If we don't the output buffer
* could end up with multiple XML documents in it, plus this seems to
* be how Windows works.
*/
if (This->prop_changed) {
reset_output_buffer(This);
This->prop_changed = FALSE;
}
if (This->props[MXWriter_OmitXmlDecl] == VARIANT_TRUE) return S_OK;
write_prolog_buffer(This);
if (This->dest && This->xml_enc == XmlEncoding_UTF16) {
static const char utf16BOM[] = {0xff,0xfe};
if (This->props[MXWriter_BOM] == VARIANT_TRUE)
/* Windows passes a NULL pointer as the pcbWritten parameter and
* ignores any error codes returned from this Write call.
*/
IStream_Write(This->dest, utf16BOM, sizeof(utf16BOM), NULL);
}
return S_OK;
}
开发者ID:bpon,项目名称:wine,代码行数:32,代码来源:mxwriter.c
示例11: IcnsEncoder_Commit
static HRESULT WINAPI IcnsEncoder_Commit(IWICBitmapEncoder *iface)
{
IcnsEncoder *This = impl_from_IWICBitmapEncoder(iface);
size_t buffer_size;
HRESULT hr = S_OK;
ULONG byteswritten;
TRACE("(%p)\n", iface);
EnterCriticalSection(&This->lock);
if (!This->any_frame_committed || This->outstanding_commits > 0 || This->committed)
{
hr = WINCODEC_ERR_WRONGSTATE;
goto end;
}
buffer_size = GetHandleSize((Handle)This->icns_family);
hr = IStream_Write(This->stream, *This->icns_family, buffer_size, &byteswritten);
if (FAILED(hr) || byteswritten != buffer_size)
{
WARN("writing file failed, hr = 0x%08X\n", hr);
hr = E_FAIL;
goto end;
}
This->committed = TRUE;
end:
LeaveCriticalSection(&This->lock);
return hr;
}
开发者ID:AndreRH,项目名称:wine,代码行数:32,代码来源:icnsformat.c
示例12: PersistStreamInit_Save
static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStm,
BOOL fClearDirty)
{
HTMLDocument *This = impl_from_IPersistStreamInit(iface);
char *str;
DWORD written=0;
HRESULT hres;
TRACE("(%p)->(%p %x)\n", This, pStm, fClearDirty);
hres = get_doc_string(This->doc_node, &str);
if(FAILED(hres))
return hres;
hres = IStream_Write(pStm, str, strlen(str), &written);
if(FAILED(hres))
FIXME("Write failed: %08x\n", hres);
heap_free(str);
if(fClearDirty)
set_dirty(This, VARIANT_FALSE);
return S_OK;
}
开发者ID:GeonHun,项目名称:wine,代码行数:25,代码来源:persist.c
示例13: IDirectMusicLoaderGenericStream_IStream_Write
static HRESULT WINAPI IDirectMusicLoaderGenericStream_IStream_Write (LPSTREAM iface, const void* pv, ULONG cb, ULONG* pcbWritten) {
ICOM_THIS_MULTI(IDirectMusicLoaderGenericStream, StreamVtbl, iface);
TRACE_(dmfileraw)("(%p, %p, 0x%08lX, %p): redirecting to low-level stream\n", This, pv, cb, pcbWritten);
if (!This->pStream)
return E_FAIL;
return IStream_Write (This->pStream, pv, cb, pcbWritten);
}
开发者ID:howard5888,项目名称:wineT,代码行数:8,代码来源:loaderstream.c
示例14: write_hlink_string
static HRESULT write_hlink_string(IStream *pStm, LPCWSTR str)
{
DWORD len;
HRESULT hr;
TRACE("(%p, %s)\n", pStm, debugstr_w(str));
len = strlenW(str) + 1;
hr = IStream_Write(pStm, &len, sizeof(len), NULL);
if (FAILED(hr)) return hr;
hr = IStream_Write(pStm, str, len * sizeof(WCHAR), NULL);
if (FAILED(hr)) return hr;
return S_OK;
}
开发者ID:GYGit,项目名称:reactos,代码行数:17,代码来源:link.c
示例15: IWICStreamImpl_Write
static HRESULT WINAPI IWICStreamImpl_Write(IWICStream *iface,
void const *pv, ULONG cb, ULONG *pcbWritten)
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
TRACE("(%p): relay\n", This);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED;
return IStream_Write(This->pStream, pv, cb, pcbWritten);
}
开发者ID:RareHare,项目名称:reactos,代码行数:9,代码来源:stream.c
示例16: URLMoniker_Save
static HRESULT WINAPI URLMoniker_Save(IMoniker *iface, IStream* pStm, BOOL fClearDirty)
{
URLMoniker *This = impl_from_IMoniker(iface);
HRESULT res;
ULONG size;
TRACE("(%p,%p,%d)\n", This, pStm, fClearDirty);
if(!pStm)
return E_INVALIDARG;
size = (SysStringLen(This->URLName) + 1)*sizeof(WCHAR);
res=IStream_Write(pStm,&size,sizeof(ULONG),NULL);
if(SUCCEEDED(res))
res=IStream_Write(pStm,This->URLName,size,NULL);
return res;
}
开发者ID:Moteesh,项目名称:reactos,代码行数:19,代码来源:umon.c
示例17: HGLOBALStreamImpl_CopyTo
/***
* This method is part of the IStream interface.
*
* It will copy the 'cb' Bytes to 'pstm' IStream.
*
* See the documentation of IStream for more info.
*/
static HRESULT WINAPI HGLOBALStreamImpl_CopyTo(
IStream* iface,
IStream* pstm, /* [unique][in] */
ULARGE_INTEGER cb, /* [in] */
ULARGE_INTEGER* pcbRead, /* [out] */
ULARGE_INTEGER* pcbWritten) /* [out] */
{
HRESULT hr = S_OK;
BYTE tmpBuffer[128];
ULONG bytesRead, bytesWritten, copySize;
ULARGE_INTEGER totalBytesRead;
ULARGE_INTEGER totalBytesWritten;
TRACE("(%p, %p, %d, %p, %p)\n", iface, pstm,
cb.u.LowPart, pcbRead, pcbWritten);
if ( pstm == 0 )
return STG_E_INVALIDPOINTER;
totalBytesRead.QuadPart = 0;
totalBytesWritten.QuadPart = 0;
while ( cb.QuadPart > 0 )
{
if ( cb.QuadPart >= sizeof(tmpBuffer) )
copySize = sizeof(tmpBuffer);
else
copySize = cb.u.LowPart;
hr = IStream_Read(iface, tmpBuffer, copySize, &bytesRead);
if (FAILED(hr))
break;
totalBytesRead.QuadPart += bytesRead;
if (bytesRead)
{
hr = IStream_Write(pstm, tmpBuffer, bytesRead, &bytesWritten);
if (FAILED(hr))
break;
totalBytesWritten.QuadPart += bytesWritten;
}
if (bytesRead!=copySize)
cb.QuadPart = 0;
else
cb.QuadPart -= bytesRead;
}
if (pcbRead) pcbRead->QuadPart = totalBytesRead.QuadPart;
if (pcbWritten) pcbWritten->QuadPart = totalBytesWritten.QuadPart;
return hr;
}
开发者ID:MichaelMcDonnell,项目名称:wine,代码行数:62,代码来源:hglobalstream.c
示例18: test_copyto
static void test_copyto(void)
{
IStream *pStream, *pStream2;
HRESULT hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
static const char szHello[] = "Hello";
ULARGE_INTEGER cb;
static const char *methods_copyto[] =
{
"TestStream_Write",
NULL
};
ULONG written;
ULARGE_INTEGER ullRead;
ULARGE_INTEGER ullWritten;
ULARGE_INTEGER libNewPosition;
static const LARGE_INTEGER llZero;
char buffer[15];
ok_ole_success(hr, "CreateStreamOnHGlobal");
expected_method_list = methods_copyto;
hr = IStream_Write(pStream, szHello, sizeof(szHello), &written);
ok_ole_success(hr, "IStream_Write");
ok(written == sizeof(szHello), "only %d bytes written\n", written);
hr = IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
ok_ole_success(hr, "IStream_Seek");
cb.QuadPart = sizeof(szHello);
hr = IStream_CopyTo(pStream, &Test_Stream, cb, &ullRead, &ullWritten);
ok(ullWritten.QuadPart == 5, "ullWritten was %d instead\n", (ULONG)ullWritten.QuadPart);
ok(ullRead.QuadPart == sizeof(szHello), "only %d bytes read\n", (ULONG)ullRead.QuadPart);
ok_ole_success(hr, "IStream_CopyTo");
ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
hr = IStream_Clone(pStream, &pStream2);
ok_ole_success(hr, "IStream_Clone");
hr = IStream_Seek(pStream2, llZero, STREAM_SEEK_CUR, &libNewPosition);
ok_ole_success(hr, "IStream_Seek");
ok(libNewPosition.QuadPart == sizeof(szHello), "libNewPosition wasn't set correctly for the cloned stream\n");
hr = IStream_Seek(pStream2, llZero, STREAM_SEEK_SET, NULL);
ok_ole_success(hr, "IStream_Seek");
hr = IStream_Read(pStream2, buffer, sizeof(buffer), NULL);
ok_ole_success(hr, "IStream_Read");
ok(!strcmp(buffer, szHello), "read data \"%s\" didn't match originally written data\n", buffer);
IStream_Release(pStream2);
IStream_Release(pStream);
}
开发者ID:Barrell,项目名称:wine,代码行数:54,代码来源:hglobalstream.c
示例19: xmldoc_IPersistStreamInit_Load
static HRESULT WINAPI xmldoc_IPersistStreamInit_Load(
IPersistStreamInit *iface, LPSTREAM pStm)
{
xmldoc *This = impl_from_IPersistStreamInit(iface);
HRESULT hr;
HGLOBAL hglobal;
DWORD read, written, len;
BYTE buf[4096];
char *ptr;
TRACE("(%p, %p)\n", iface, pStm);
if (!pStm)
return E_INVALIDARG;
/* release previously allocated stream */
if (This->stream) IStream_Release(This->stream);
hr = CreateStreamOnHGlobal(NULL, TRUE, &This->stream);
if (FAILED(hr))
return hr;
do
{
IStream_Read(pStm, buf, sizeof(buf), &read);
hr = IStream_Write(This->stream, buf, read, &written);
} while(SUCCEEDED(hr) && written != 0 && read != 0);
if (FAILED(hr))
{
ERR("Failed to copy stream\n");
return hr;
}
hr = GetHGlobalFromStream(This->stream, &hglobal);
if (FAILED(hr))
return hr;
len = GlobalSize(hglobal);
ptr = GlobalLock(hglobal);
if (len != 0)
{
xmlFreeDoc(This->xmldoc);
This->xmldoc = parse_xml(ptr, len);
}
GlobalUnlock(hglobal);
if (!This->xmldoc)
{
ERR("Failed to parse xml\n");
return E_FAIL;
}
return S_OK;
}
开发者ID:MichaelMcDonnell,项目名称:wine,代码行数:54,代码来源:xmldoc.c
示例20: user_write_data
static void user_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
PngEncoder *This = ppng_get_io_ptr(png_ptr);
HRESULT hr;
ULONG byteswritten;
hr = IStream_Write(This->stream, data, length, &byteswritten);
if (FAILED(hr) || byteswritten != length)
{
ppng_error(png_ptr, "failed writing data");
}
}
开发者ID:bilboed,项目名称:wine,代码行数:12,代码来源:pngformat.c
注:本文中的IStream_Write函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论