7.2.3 OLE Stream Callback Functions

The specific callback functions that each member of the OLESTREAMVTBL data structure points to are described in the following sections. You will need to code these functions to meet the needs of your application.

7.2.3.1 Get

DWORD (CALLBACK *Get)(lpstream, lpszBuf, cbbuf)

LPOLESTREAM lpstream;
void FAR* lpszBuf;
DWORD cbbuf;

The Get function gets data from the specified stream.

Parameter Description

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.

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 greater than 64K, the pointer to the data buffer is always at the beginning of the segment.

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. If the return value is negative, an error occurred.

7.2.3.2 Put

DWORD (CALLBACK* Put)(lpstream, lpszBuf, cbbuf)

LPOLESTREAM lpstream;
OLE_CONST void FAR* lpszBuf;
DWORD cbbuf;

The Put function puts data into the specified stream.

Parameter Description

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.

The value specified by the cbbuf parameter can be larger 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.

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