version 1.1.1.1, 2012/02/21 23:47:53
|
version 1.1.1.2, 2012/05/29 12:34:36
|
Line 45 typedef struct {
|
Line 45 typedef struct {
|
} php_istream; |
} php_istream; |
|
|
static int le_istream; |
static int le_istream; |
static void istream_destructor(php_istream *stm); | static void istream_destructor(php_istream *stm TSRMLS_DC); |
|
|
static void istream_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) |
static void istream_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) |
{ |
{ |
php_istream *stm = (php_istream *)rsrc->ptr; |
php_istream *stm = (php_istream *)rsrc->ptr; |
istream_destructor(stm); | istream_destructor(stm TSRMLS_CC); |
} |
} |
|
|
#ifdef ZTS |
|
# define TSRMLS_FIXED() TSRMLS_FETCH(); |
|
#else |
|
# define TSRMLS_FIXED() |
|
#endif |
|
|
|
#define FETCH_STM() \ |
#define FETCH_STM() \ |
TSRMLS_FIXED() \ |
|
php_istream *stm = (php_istream*)This; \ |
php_istream *stm = (php_istream*)This; \ |
|
TSRMLS_FETCH(); \ |
if (GetCurrentThreadId() != stm->engine_thread) \ |
if (GetCurrentThreadId() != stm->engine_thread) \ |
return RPC_E_WRONG_THREAD; |
return RPC_E_WRONG_THREAD; |
|
|
|
#define FETCH_STM_EX() \ |
|
php_istream *stm = (php_istream*)This; \ |
|
if (GetCurrentThreadId() != stm->engine_thread) \ |
|
return RPC_E_WRONG_THREAD; |
|
|
static HRESULT STDMETHODCALLTYPE stm_queryinterface( |
static HRESULT STDMETHODCALLTYPE stm_queryinterface( |
IStream *This, |
IStream *This, |
/* [in] */ REFIID riid, |
/* [in] */ REFIID riid, |
/* [iid_is][out] */ void **ppvObject) |
/* [iid_is][out] */ void **ppvObject) |
{ |
{ |
FETCH_STM(); | FETCH_STM_EX(); |
|
|
if (IsEqualGUID(&IID_IUnknown, riid) || |
if (IsEqualGUID(&IID_IUnknown, riid) || |
IsEqualGUID(&IID_IStream, riid)) { |
IsEqualGUID(&IID_IStream, riid)) { |
Line 85 static HRESULT STDMETHODCALLTYPE stm_queryinterface(
|
Line 84 static HRESULT STDMETHODCALLTYPE stm_queryinterface(
|
|
|
static ULONG STDMETHODCALLTYPE stm_addref(IStream *This) |
static ULONG STDMETHODCALLTYPE stm_addref(IStream *This) |
{ |
{ |
FETCH_STM(); | FETCH_STM_EX(); |
|
|
return InterlockedIncrement(&stm->refcount); |
return InterlockedIncrement(&stm->refcount); |
} |
} |
Line 190 static HRESULT STDMETHODCALLTYPE stm_set_size(IStream
|
Line 189 static HRESULT STDMETHODCALLTYPE stm_set_size(IStream
|
static HRESULT STDMETHODCALLTYPE stm_copy_to(IStream *This, IStream *pstm, ULARGE_INTEGER cb, |
static HRESULT STDMETHODCALLTYPE stm_copy_to(IStream *This, IStream *pstm, ULARGE_INTEGER cb, |
ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) |
ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) |
{ |
{ |
FETCH_STM(); | FETCH_STM_EX(); |
|
|
return E_NOTIMPL; |
return E_NOTIMPL; |
} |
} |
Line 250 static struct IStreamVtbl php_istream_vtbl = {
|
Line 249 static struct IStreamVtbl php_istream_vtbl = {
|
stm_clone |
stm_clone |
}; |
}; |
|
|
static void istream_destructor(php_istream *stm) | static void istream_destructor(php_istream *stm TSRMLS_DC) |
{ |
{ |
TSRMLS_FETCH(); |
|
|
|
if (stm->id) { |
if (stm->id) { |
int id = stm->id; |
int id = stm->id; |
stm->id = 0; |
stm->id = 0; |
Line 285 PHPAPI IStream *php_com_wrapper_export_stream(php_stre
|
Line 282 PHPAPI IStream *php_com_wrapper_export_stream(php_stre
|
stm->stream = stream; |
stm->stream = stream; |
|
|
zend_list_addref(stream->rsrc_id); |
zend_list_addref(stream->rsrc_id); |
stm->id = zend_list_insert(stm, le_istream); | stm->id = zend_list_insert(stm, le_istream TSRMLS_CC); |
|
|
return (IStream*)stm; |
return (IStream*)stm; |
} |
} |
Line 382 CPH_METHOD(SaveToFile)
|
Line 379 CPH_METHOD(SaveToFile)
|
|
|
res = get_persist_file(helper); |
res = get_persist_file(helper); |
if (helper->ipf) { |
if (helper->ipf) { |
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!|b", | if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p!|b", |
&filename, &filename_len, &remember)) { |
&filename, &filename_len, &remember)) { |
php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC); |
php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC); |
return; |
return; |
} |
} |
|
|
if (filename) { |
if (filename) { |
if (strlen(filename) != filename_len) { |
|
RETURN_FALSE; |
|
} |
|
fullpath = expand_filepath(filename, NULL TSRMLS_CC); |
fullpath = expand_filepath(filename, NULL TSRMLS_CC); |
if (!fullpath) { |
if (!fullpath) { |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
|
|
if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || | if (php_check_open_basedir(fullpath TSRMLS_CC)) { |
php_check_open_basedir(fullpath TSRMLS_CC)) { | |
efree(fullpath); |
efree(fullpath); |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
Line 450 CPH_METHOD(LoadFromFile)
|
Line 443 CPH_METHOD(LoadFromFile)
|
res = get_persist_file(helper); |
res = get_persist_file(helper); |
if (helper->ipf) { |
if (helper->ipf) { |
|
|
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", | if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", |
&filename, &filename_len, &flags)) { |
&filename, &filename_len, &flags)) { |
php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC); |
php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC); |
return; |
return; |
} |
} |
|
|
if (strlen(filename) != filename_len) { |
|
RETURN_FALSE; |
|
} |
|
|
|
if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) { |
if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) { |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
|
|
if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || | if (php_check_open_basedir(fullpath TSRMLS_CC)) { |
php_check_open_basedir(fullpath TSRMLS_CC)) { | |
efree(fullpath); |
efree(fullpath); |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |