PHPAPI IStream *php_com_wrapper_export_stream(php_stream *stream TSRMLS_DC)
{
	php_istream *stm = (php_istream*)CoTaskMemAlloc(sizeof(*stm));

	if (stm == NULL)
		return NULL;

	memset(stm, 0, sizeof(*stm));
	stm->engine_thread = GetCurrentThreadId();
	stm->lpVtbl = &php_istream_vtbl;
	stm->refcount = 1;
	stm->stream = stream;

	zend_list_addref(stream->rsrc_id);
	stm->id = zend_list_insert(stm, le_istream);

	return (IStream*)stm;
}
PHPAPI IStream *php_com_wrapper_export_stream(php_stream *stream TSRMLS_DC)
{
	php_istream *stm = (php_istream*)CoTaskMemAlloc(sizeof(*stm));

	if (stm == NULL)
		return NULL;

	memset(stm, 0, sizeof(*stm));
	stm->engine_thread = GetCurrentThreadId();
	stm->lpVtbl = &php_istream_vtbl;
	stm->refcount = 1;
	stm->stream = stream;

	zend_list_addref(stream->rsrc_id);
	stm->id = zend_list_insert(stm, le_istream);

	return (IStream*)stm;
}