本文整理汇总了C++中IStream_Seek函数的典型用法代码示例。如果您正苦于以下问题:C++ IStream_Seek函数的具体用法?C++ IStream_Seek怎么用?C++ IStream_Seek使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IStream_Seek函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: msi_dump_stream_to_file
static UINT msi_dump_stream_to_file( IStream *stm, LPCWSTR name )
{
ULARGE_INTEGER size;
LARGE_INTEGER pos;
IStream *out;
DWORD stgm;
HRESULT r;
stgm = STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_FAILIFTHERE;
r = SHCreateStreamOnFileW( name, stgm, &out );
if( FAILED( r ) )
return ERROR_FUNCTION_FAILED;
pos.QuadPart = 0;
r = IStream_Seek( stm, pos, STREAM_SEEK_END, &size );
if( FAILED( r ) )
goto end;
pos.QuadPart = 0;
r = IStream_Seek( stm, pos, STREAM_SEEK_SET, NULL );
if( FAILED( r ) )
goto end;
r = IStream_CopyTo( stm, out, size, NULL, NULL );
end:
IStream_Release( out );
if( FAILED( r ) )
return ERROR_FUNCTION_FAILED;
return ERROR_SUCCESS;
}
开发者ID:GYGit,项目名称:reactos,代码行数:31,代码来源:record.c
示例2: report_data
static inline HRESULT report_data(BindStatusCallback *This)
{
FORMATETC formatetc = {0, NULL, 1, -1, TYMED_ISTREAM};
STGMEDIUM stgmedium;
LARGE_INTEGER off;
ULARGE_INTEGER size;
HRESULT hres;
off.QuadPart = 0;
hres = IStream_Seek(This->stream, off, STREAM_SEEK_CUR, &size);
if(FAILED(hres))
return hres;
hres = IStream_Seek(This->stream, off, STREAM_SEEK_SET, NULL);
if(FAILED(hres))
return hres;
stgmedium.tymed = TYMED_ISTREAM;
stgmedium.u.pstm = This->stream;
stgmedium.pUnkForRelease = NULL;
hres = IBindStatusCallback_OnDataAvailable(This->bsc,
BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
size.u.LowPart, &formatetc, &stgmedium);
IStream_Release(This->stream);
This->stream = NULL;
return hres;
}
开发者ID:RareHare,项目名称:reactos,代码行数:29,代码来源:xmlview.c
示例3: IDirectMusicSegTriggerTrack_IPersistStream_ParseSegTrackList
static HRESULT IDirectMusicSegTriggerTrack_IPersistStream_ParseSegTrackList (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm) {
/*ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, PersistStreamVtbl, iface);*/
HRESULT hr = E_FAIL;
DMUS_PRIVATE_CHUNK Chunk;
DWORD ListSize[3], ListCount[3];
LARGE_INTEGER liMove; /* used when skipping chunks */
if (pChunk->fccID != DMUS_FOURCC_SEGTRACK_LIST) {
ERR_(dmfile)(": %s chunk should be a SEGTRACK list\n", debugstr_fourcc (pChunk->fccID));
return E_FAIL;
}
ListSize[0] = pChunk->dwSize - sizeof(FOURCC);
ListCount[0] = 0;
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case DMUS_FOURCC_SEGTRACK_CHUNK: {
TRACE_(dmfile)(": segment trigger track chunk\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
case FOURCC_LIST: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
ListSize[1] = Chunk.dwSize - sizeof(FOURCC);
ListCount[1] = 0;
switch (Chunk.fccID) {
case DMUS_FOURCC_SEGMENTS_LIST: {
TRACE_(dmfile)(": SEGMENTS list\n");
hr = IDirectMusicSegTriggerTrack_IPersistStream_ParseSegmentsList (iface, &Chunk, pStm);
if (FAILED(hr)) return hr;
break;
}
default: {
TRACE_(dmfile)(": unknown (skipping)\n");
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
} while (ListCount[0] < ListSize[0]);
return S_OK;
}
开发者ID:AmesianX,项目名称:RosWine,代码行数:59,代码来源:segtriggertrack.c
示例4: MSI_RecordReadStream
UINT MSI_RecordReadStream(MSIRECORD *rec, UINT iField, char *buf, LPDWORD sz)
{
ULONG count;
HRESULT r;
IStream *stm;
TRACE("%p %d %p %p\n", rec, iField, buf, sz);
if( !sz )
return ERROR_INVALID_PARAMETER;
if( iField > rec->count)
return ERROR_INVALID_PARAMETER;
if ( rec->fields[iField].type == MSIFIELD_NULL )
{
*sz = 0;
return ERROR_INVALID_DATA;
}
if( rec->fields[iField].type != MSIFIELD_STREAM )
return ERROR_INVALID_DATATYPE;
stm = rec->fields[iField].u.stream;
if( !stm )
return ERROR_INVALID_PARAMETER;
/* if there's no buffer pointer, calculate the length to the end */
if( !buf )
{
LARGE_INTEGER ofs;
ULARGE_INTEGER end, cur;
ofs.QuadPart = cur.QuadPart = 0;
end.QuadPart = 0;
IStream_Seek( stm, ofs, STREAM_SEEK_SET, &cur );
IStream_Seek( stm, ofs, STREAM_SEEK_END, &end );
ofs.QuadPart = cur.QuadPart;
IStream_Seek( stm, ofs, STREAM_SEEK_SET, &cur );
*sz = end.QuadPart - cur.QuadPart;
return ERROR_SUCCESS;
}
/* read the data */
count = 0;
r = IStream_Read( stm, buf, *sz, &count );
if( FAILED( r ) )
{
*sz = 0;
return ERROR_FUNCTION_FAILED;
}
*sz = count;
return ERROR_SUCCESS;
}
开发者ID:GYGit,项目名称:reactos,代码行数:57,代码来源:record.c
示例5: 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
示例6: test_pic
static void
test_pic(const unsigned char *imgdata, unsigned int imgsize)
{
LPSTREAM stream;
HGLOBAL hglob;
LPBYTE data;
HRESULT hres;
LARGE_INTEGER seekto;
ULARGE_INTEGER newpos1;
/* Let the fun begin */
hglob = GlobalAlloc (0, imgsize);
data = GlobalLock (hglob);
memcpy(data, imgdata, imgsize);
hres = CreateStreamOnHGlobal (hglob, FALSE, &stream);
ok (hres == S_OK, "createstreamonhglobal failed? doubt it... hres 0x%08lx\n", hres);
memset(&seekto,0,sizeof(seekto));
hres = IStream_Seek(stream,seekto,SEEK_CUR,&newpos1);
ok (hres == S_OK, "istream seek failed? doubt it... hres 0x%08lx\n", hres);
test_pic_with_stream(stream, imgsize);
/* again with Non Statable and Non Seekable stream */
stream = (LPSTREAM)NoStatStreamImpl_Construct(hglob);
test_pic_with_stream(stream, 0);
}
开发者ID:howard5888,项目名称:wineT,代码行数:27,代码来源:olepicture.c
示例7: SHIsEmptyStream
/*************************************************************************
* @ [SHLWAPI.166]
*
* Determine if a stream has 0 length.
*
* PARAMS
* lpStream [I] IStream object
*
* RETURNS
* TRUE: If the stream has 0 length
* FALSE: Otherwise.
*/
BOOL WINAPI SHIsEmptyStream(IStream *lpStream)
{
STATSTG statstg;
BOOL bRet = TRUE;
TRACE("(%p)\n", lpStream);
memset(&statstg, 0, sizeof(statstg));
if(SUCCEEDED(IStream_Stat(lpStream, &statstg, 1)))
{
if(statstg.cbSize.QuadPart)
bRet = FALSE; /* Non-Zero */
}
else
{
DWORD dwDummy;
/* Try to read from the stream */
if(SUCCEEDED(SHIStream_Read(lpStream, &dwDummy, sizeof(dwDummy))))
{
LARGE_INTEGER zero;
zero.QuadPart = 0;
IStream_Seek(lpStream, zero, 0, NULL);
bRet = FALSE; /* Non-Zero */
}
}
return bRet;
}
开发者ID:GYGit,项目名称:reactos,代码行数:42,代码来源:istream.c
示例8: IStream_Reset
/*************************************************************************
* @ [SHLWAPI.213]
*
* Seek to the start of a stream.
*
* PARAMS
* lpStream [I] IStream object
*
* RETURNS
* Success: S_OK. The current position within the stream is updated
* Failure: An HRESULT error code.
*/
HRESULT WINAPI IStream_Reset(IStream *lpStream)
{
LARGE_INTEGER zero;
TRACE("(%p)\n", lpStream);
zero.QuadPart = 0;
return IStream_Seek(lpStream, zero, 0, NULL);
}
开发者ID:GYGit,项目名称:reactos,代码行数:19,代码来源:istream.c
示例9: navigate_history
static HRESULT navigate_history(DocHost *This, unsigned travellog_pos)
{
IPersistHistory *persist_history;
travellog_entry_t *entry;
LARGE_INTEGER li;
HRESULT hres;
if(!This->doc_navigate) {
FIXME("unsupported doc_navigate FALSE\n");
return E_NOTIMPL;
}
This->travellog.loading_pos = travellog_pos;
entry = This->travellog.log + This->travellog.loading_pos;
if(!entry->stream)
return async_doc_navigate(This, entry->url, NULL, NULL, 0, FALSE);
hres = IUnknown_QueryInterface(This->document, &IID_IPersistHistory, (void**)&persist_history);
if(FAILED(hres))
return hres;
li.QuadPart = 0;
IStream_Seek(entry->stream, li, STREAM_SEEK_SET, NULL);
hres = IPersistHistory_LoadHistory(persist_history, entry->stream, NULL);
IPersistHistory_Release(persist_history);
return hres;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:29,代码来源:navigate.c
示例10: IDirectMusicLoaderGenericStream_IStream_Seek
static HRESULT WINAPI IDirectMusicLoaderGenericStream_IStream_Seek (LPSTREAM iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) {
ICOM_THIS_MULTI(IDirectMusicLoaderGenericStream, StreamVtbl, iface);
TRACE_(dmfileraw)("(%p, 0x%08llX, %s, %p): redirecting to low-level stream\n", This, dlibMove.QuadPart, resolve_STREAM_SEEK(dwOrigin), plibNewPosition);
if (!This->pStream)
return E_FAIL;
return IStream_Seek (This->pStream, dlibMove, dwOrigin, plibNewPosition);
}
开发者ID:howard5888,项目名称:wineT,代码行数:8,代码来源:loaderstream.c
示例11: IWICStreamImpl_Seek
static HRESULT WINAPI IWICStreamImpl_Seek(IWICStream *iface,
LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
{
IWICStreamImpl *This = impl_from_IWICStream(iface);
TRACE("(%p): relay\n", This);
if (!This->pStream) return WINCODEC_ERR_NOTINITIALIZED;
return IStream_Seek(This->pStream, dlibMove, dwOrigin, plibNewPosition);
}
开发者ID:RareHare,项目名称:reactos,代码行数:9,代码来源:stream.c
示例12: gdip_save_bitmap_to_callback
static gboolean
gdip_save_bitmap_to_callback (GpBitmap *bitmap,
const CLSID *format,
const EncoderParameters *encoder_params,
GdkPixbufSaveFunc save_func,
gpointer user_data,
GError **error)
{
HRESULT hr;
IStream *streamOut = NULL;
gboolean success = FALSE;
guint64 zero = 0;
GpStatus status;
hr = CreateStreamOnHGlobal (NULL, TRUE, &streamOut);
if (!SUCCEEDED (hr)) {
gdip_set_error_from_hresult (error, GDK_PIXBUF_ERROR_FAILED, hr, _("Could not create stream: %s"));
return FALSE;
}
status = GdipSaveImageToStream ((GpImage *)bitmap, streamOut, format, encoder_params);
if (Ok != status) {
gdip_set_error_from_gpstatus (error, GDK_PIXBUF_ERROR_FAILED, status);
IStream_Release (streamOut);
return FALSE;
}
/* seek back to the beginning of the stream */
hr = IStream_Seek (streamOut, *(LARGE_INTEGER *)&zero, STREAM_SEEK_SET, NULL);
if (!SUCCEEDED (hr)) {
gdip_set_error_from_hresult (error, GDK_PIXBUF_ERROR_FAILED, hr, _("Could not seek stream: %s"));
IStream_Release (streamOut);
return FALSE;
}
for (;;) {
char buffer[LOAD_BUFFER_SIZE];
ULONG nread;
hr = IStream_Read (streamOut, buffer, sizeof(buffer), &nread);
if (!SUCCEEDED (hr))
{
gdip_set_error_from_hresult (error, GDK_PIXBUF_ERROR_FAILED, hr, _("Could not read from stream: %s"));
break;
}
else if (0 == nread) {
success = TRUE; /* EOF */
break;
}
else if (!(*save_func) (buffer, nread, error, user_data))
break;
}
IStream_Release (streamOut);
return success;
}
开发者ID:chipx86,项目名称:gtk,代码行数:57,代码来源:io-gdip-utils.c
示例13: IDirectMusicSegTriggerTrack_IPersistStream_Load
static HRESULT WINAPI IDirectMusicSegTriggerTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, PersistStreamVtbl, iface);
DMUS_PRIVATE_CHUNK Chunk;
LARGE_INTEGER liMove;
HRESULT hr;
TRACE("(%p, %p): Loading\n", This, pStm);
#if 1
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_LIST: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case DMUS_FOURCC_SEGTRACK_LIST: {
TRACE_(dmfile)(": segment trigger track list\n");
hr = IDirectMusicSegTriggerTrack_IPersistStream_ParseSegTrackList (iface, &Chunk, pStm);
if (FAILED(hr)) return hr;
break;
}
default: {
TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
return E_FAIL;
}
}
TRACE_(dmfile)(": reading finished\n");
break;
}
default: {
TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
return E_FAIL;
}
}
#endif
return S_OK;
}
开发者ID:AmesianX,项目名称:RosWine,代码行数:44,代码来源:segtriggertrack.c
示例14: BmpFrameDecode_ReadUncompressed
static HRESULT BmpFrameDecode_ReadUncompressed(BmpFrameDecode* This)
{
UINT bytesperrow;
UINT width, height;
UINT datasize;
int bottomup;
HRESULT hr;
LARGE_INTEGER offbits;
ULONG bytesread;
if (This->bih.bV5Size == sizeof(BITMAPCOREHEADER))
{
BITMAPCOREHEADER *bch = (BITMAPCOREHEADER*)&This->bih;
width = bch->bcWidth;
height = bch->bcHeight;
bottomup = 1;
}
else
{
width = This->bih.bV5Width;
height = abs(This->bih.bV5Height);
bottomup = (This->bih.bV5Height > 0);
}
/* row sizes in BMP files must be divisible by 4 bytes */
bytesperrow = (((width * This->bitsperpixel)+31)/32)*4;
datasize = bytesperrow * height;
This->imagedata = HeapAlloc(GetProcessHeap(), 0, datasize);
if (!This->imagedata) return E_OUTOFMEMORY;
offbits.QuadPart = This->bfh.bfOffBits;
hr = IStream_Seek(This->stream, offbits, STREAM_SEEK_SET, NULL);
if (FAILED(hr)) goto fail;
hr = IStream_Read(This->stream, This->imagedata, datasize, &bytesread);
if (FAILED(hr) || bytesread != datasize) goto fail;
if (bottomup)
{
This->imagedatastart = This->imagedata + (height-1) * bytesperrow;
This->stride = -bytesperrow;
}
else
{
This->imagedatastart = This->imagedata;
This->stride = bytesperrow;
}
return S_OK;
fail:
HeapFree(GetProcessHeap(), 0, This->imagedata);
This->imagedata = NULL;
if (SUCCEEDED(hr)) hr = E_FAIL;
return hr;
}
开发者ID:bilboed,项目名称:wine,代码行数:56,代码来源:bmpdecode.c
示例15: IDirectMusicBandImpl_IPersistStream_Load
static HRESULT WINAPI IDirectMusicBandImpl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
ICOM_THIS_MULTI(IDirectMusicBandImpl, PersistStreamVtbl, iface);
DMUS_PRIVATE_CHUNK Chunk;
LARGE_INTEGER liMove;
HRESULT hr;
TRACE("(%p,%p): loading\n", This, pStm);
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_RIFF: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case DMUS_FOURCC_BAND_FORM: {
TRACE_(dmfile)(": Band form\n");
hr = IDirectMusicBandImpl_IPersistStream_ParseBandForm (iface, &Chunk, pStm);
if (FAILED(hr)) return hr;
break;
}
default: {
TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
return E_FAIL;
}
}
TRACE_(dmfile)(": reading finished\n");
break;
}
default: {
TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
return E_FAIL;
}
}
return S_OK;
}
开发者ID:Eltechs,项目名称:wine,代码行数:42,代码来源:band.c
示例16: StreamOnStreamRange_Write
static HRESULT WINAPI StreamOnStreamRange_Write(IStream *iface,
void const *pv, ULONG cb, ULONG *pcbWritten)
{
StreamOnStreamRange *This = StreamOnStreamRange_from_IStream(iface);
HRESULT hr;
ULARGE_INTEGER OldPosition;
LARGE_INTEGER SetPosition;
ULONG uBytesWritten=0;
TRACE("(%p)\n", This);
if (!pv) return E_INVALIDARG;
EnterCriticalSection(&This->lock);
SetPosition.QuadPart = 0;
hr = IStream_Seek(This->stream, SetPosition, STREAM_SEEK_CUR, &OldPosition);
if (SUCCEEDED(hr))
{
SetPosition.QuadPart = This->pos.QuadPart + This->offset.QuadPart;
hr = IStream_Seek(This->stream, SetPosition, STREAM_SEEK_SET, NULL);
}
if (SUCCEEDED(hr))
{
if (This->pos.QuadPart + cb > This->max_size.QuadPart)
{
/* This would read past the end of the stream. */
if (This->pos.QuadPart > This->max_size.QuadPart)
cb = 0;
else
cb = This->max_size.QuadPart - This->pos.QuadPart;
}
hr = IStream_Write(This->stream, pv, cb, &uBytesWritten);
SetPosition.QuadPart = OldPosition.QuadPart;
IStream_Seek(This->stream, SetPosition, STREAM_SEEK_SET, NULL);
}
if (SUCCEEDED(hr))
This->pos.QuadPart += uBytesWritten;
LeaveCriticalSection(&This->lock);
if (SUCCEEDED(hr) && pcbWritten) *pcbWritten = uBytesWritten;
return hr;
}
开发者ID:RareHare,项目名称:reactos,代码行数:42,代码来源:stream.c
示例17: advance_stream
static inline HRESULT advance_stream(IStream *stream, ULONG bytes)
{
LARGE_INTEGER move;
HRESULT ret;
move.QuadPart = bytes;
ret = IStream_Seek(stream, move, STREAM_SEEK_CUR, NULL);
if (FAILED(ret))
WARN("IStream_Seek failed: %08x\n", ret);
return ret;
}
开发者ID:Barrell,项目名称:wine,代码行数:13,代码来源:instrument.c
示例18: CHM_ReadString
/* Reads a string from the #STRINGS section in the CHM file */
static LPWSTR CHM_ReadString(CHMInfo *pChmInfo, DWORD dwOffset)
{
LARGE_INTEGER liOffset;
IStorage *pStorage = pChmInfo->pStorage;
IStream *pStream;
DWORD cbRead;
ULONG iPos;
DWORD dwSize;
LPSTR szString;
LPWSTR stringW;
const int CB_READ_BLOCK = 64;
static const WCHAR stringsW[] = {'#','S','T','R','I','N','G','S',0};
dwSize = CB_READ_BLOCK;
szString = HeapAlloc(GetProcessHeap(), 0, dwSize);
if (FAILED(IStorage_OpenStream(pStorage, stringsW, NULL, STGM_READ, 0, &pStream)))
return NULL;
liOffset.QuadPart = dwOffset;
if (FAILED(IStream_Seek(pStream, liOffset, STREAM_SEEK_SET, NULL)))
{
IStream_Release(pStream);
return NULL;
}
while (SUCCEEDED(IStream_Read(pStream, szString, CB_READ_BLOCK, &cbRead)))
{
if (!cbRead)
return NULL;
for (iPos = 0; iPos < cbRead; iPos++)
{
if (!szString[iPos])
{
stringW = CHM_ANSIToUnicode(szString);
HeapFree(GetProcessHeap(), 0, szString);
return stringW;
}
}
dwSize *= 2;
szString = HeapReAlloc(GetProcessHeap(), 0, szString, dwSize);
szString += cbRead;
}
/* didn't find a string */
return NULL;
}
开发者ID:howard5888,项目名称:wineT,代码行数:52,代码来源:chm.c
示例19: CHM_LoadWinTypeFromCHM
/* Loads the HH_WINTYPE data from the CHM file
*
* FIXME: There may be more than one window type in the file, so
* add the ability to choose a certain window type
*/
BOOL CHM_LoadWinTypeFromCHM(CHMInfo *pChmInfo, HH_WINTYPEW *pHHWinType)
{
LARGE_INTEGER liOffset;
IStorage *pStorage = pChmInfo->pStorage;
IStream *pStream;
HRESULT hr;
DWORD cbRead;
static const WCHAR windowsW[] = {'#','W','I','N','D','O','W','S',0};
hr = IStorage_OpenStream(pStorage, windowsW, NULL, STGM_READ, 0, &pStream);
if (FAILED(hr))
return FALSE;
/* jump past the #WINDOWS header */
liOffset.QuadPart = sizeof(DWORD) * 2;
hr = IStream_Seek(pStream, liOffset, STREAM_SEEK_SET, NULL);
if (FAILED(hr)) goto done;
/* read the HH_WINTYPE struct data */
hr = IStream_Read(pStream, pHHWinType, sizeof(*pHHWinType), &cbRead);
if (FAILED(hr)) goto done;
/* convert the #STRINGS offsets to actual strings */
pHHWinType->pszType = CHM_ReadString(pChmInfo, (DWORD)pHHWinType->pszType);
pHHWinType->pszCaption = CHM_ReadString(pChmInfo, (DWORD)pHHWinType->pszCaption);
pHHWinType->pszToc = CHM_ReadString(pChmInfo, (DWORD)pHHWinType->pszToc);
pHHWinType->pszIndex = CHM_ReadString(pChmInfo, (DWORD)pHHWinType->pszIndex);
pHHWinType->pszFile = CHM_ReadString(pChmInfo, (DWORD)pHHWinType->pszFile);
pHHWinType->pszHome = CHM_ReadString(pChmInfo, (DWORD)pHHWinType->pszHome);
pHHWinType->pszJump1 = CHM_ReadString(pChmInfo, (DWORD)pHHWinType->pszJump1);
pHHWinType->pszJump2 = CHM_ReadString(pChmInfo, (DWORD)pHHWinType->pszJump2);
pHHWinType->pszUrlJump1 = CHM_ReadString(pChmInfo, (DWORD)pHHWinType->pszUrlJump1);
pHHWinType->pszUrlJump2 = CHM_ReadString(pChmInfo, (DWORD)pHHWinType->pszUrlJump2);
/* FIXME: pszCustomTabs is a list of multiple zero-terminated strings so ReadString won't
* work in this case
*/
#if 0
pHHWinType->pszCustomTabs = CHM_ReadString(pChmInfo, (DWORD)pHHWinType->pszCustomTabs);
#endif
done:
IStream_Release(pStream);
return SUCCEEDED(hr);
}
开发者ID:howard5888,项目名称:wineT,代码行数:53,代码来源:chm.c
示例20: HGLOBALStreamImpl_Clone
static HRESULT WINAPI HGLOBALStreamImpl_Clone(
IStream* iface,
IStream** ppstm) /* [out] */
{
HGLOBALStreamImpl* This = impl_from_IStream(iface);
ULARGE_INTEGER dummy;
LARGE_INTEGER offset;
HRESULT hr;
TRACE(" Cloning %p (deleteOnRelease=%d seek position=%ld)\n",iface,This->deleteOnRelease,(long)This->currentPosition.QuadPart);
hr = CreateStreamOnHGlobal(This->supportHandle, FALSE, ppstm);
if(FAILED(hr))
return hr;
offset.QuadPart = (LONGLONG)This->currentPosition.QuadPart;
IStream_Seek(*ppstm, offset, STREAM_SEEK_SET, &dummy);
return S_OK;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:17,代码来源:hglobalstream.c
注:本文中的IStream_Seek函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论