OLESTREAMVTBL

3.1

#include <ole.h>

typedef struct _OLESTREAMVTBL {   /* ostrv */
    DWORD (CALLBACK* Get)(LPOLESTREAM, void FAR*, DWORD);
    DWORD (CALLBACK* Put)(LPOLESTREAM, OLE_CONST void FAR*, DWORD);
} OLESTREAMVTBL;

The OLESTREAMVTBL structure points to functions the client library uses for stream operations on objects. This structure is allocated and initialized by client applications.

Comments

The stream is valid only for the duration of the function to which it is passed. The library obtains everything it requires while the stream is valid.

The return values for the stream functions may indicate that an error has occurred, but these values do not indicate the nature of the error. The client application is responsible for any required error-recovery operations.

A client application can use these functions to provide variations on the standard stream procedures; for example, the client could change the permanent storage of some objects so that they were stored in a database instead of the client document.

Function

Get

  DWORD Get(lpstream, lpszBuf, cbbuf)    
  LPOLESTREAM lpstream;    
  void FAR* lpszBuf;    
  DWORD cbbuf;    

The Get function gets data from the specified stream.

Parameters

lpstream

Points to an OLESTREAM structure allocated by the client.

lpszBuf

Points to a buffer to fill with data from the stream.

cbbuf

Specifies the number of bytes to read into the buffer.

Return Value

The return value is the number of bytes actually read into the buffer if the function is successful. If the end of the file is encountered, the return value is zero. A negative return value indicates that an error occurred.

Comments

The value specified by the cbbuf parameter can be larger than 64K. If the client application uses a stream-reading function that is limited to 64K, it should call that function repeatedly until it has read the number of bytes specified by cbbuf. Whenever the data size is larger than 64K, the pointer to the data buffer is always at the beginning of the segment.

Function

Put

  DWORD Put(lpstream, lpszBuf, cbbuf)    
  LPOLESTREAM lpstream;    
  OLE_CONST void FAR* lpszBuf;    
  DWORD cbbuf;    

The Put function puts data into the specified stream.

Parameters

lpstream

Points to an OLESTREAM structure allocated by the client.

lpszBuf

Points to a buffer from which to write data into the stream.

cbbuf

Specifies the number of bytes to write into the stream.

Return Value

The return value is the number of bytes actually written to the stream. A return value less than the number specified in the cbbuf parameter indicates that either there was insufficient space in the stream or an error occurred.

Comments

The value specified by the cbbuf parameter can be greater than 64K. If the client application uses a stream-writing function that is limited to 64K, it should call that function repeatedly until it has written the number of bytes specified by cbbuf. Whenever the data size is greater than 64K, the pointer to the data buffer is always at the beginning of the segment.