diff options
author | Wez Furlong <wez@php.net> | 2005-04-19 06:14:56 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2005-04-19 06:14:56 +0000 |
commit | 70137887112c7916412017b5e750fc3f49ef5020 (patch) | |
tree | 9444d455a9f516ad98bdda116b042598a59deab8 /ext/com_dotnet | |
parent | e211d4e3ae176458b61a2af86174f398501bc141 (diff) | |
download | php-git-70137887112c7916412017b5e750fc3f49ef5020.tar.gz |
merge from branch: fixes for #32758 and #32759
Diffstat (limited to 'ext/com_dotnet')
-rw-r--r-- | ext/com_dotnet/com_com.c | 4 | ||||
-rw-r--r-- | ext/com_dotnet/com_handlers.c | 46 | ||||
-rw-r--r-- | ext/com_dotnet/com_typeinfo.c | 1 | ||||
-rw-r--r-- | ext/com_dotnet/php_com_dotnet_internal.h | 2 |
4 files changed, 7 insertions, 46 deletions
diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index 39c90eae1f..25a5c73e51 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -398,7 +398,7 @@ HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member, default: desc = php_win_err(hr); - spprintf(&msg, 0, "Error %s", desc); + spprintf(&msg, 0, "Error [0x%08x] %s", hr, desc); LocalFree(desc); break; } @@ -620,7 +620,7 @@ int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid, efree(vargs); } - /* a bit strange this, but... */ + /* a bit of a hack this, but it's needed for COM array access. */ if (hr == DISP_E_BADPARAMCOUNT) return hr; diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c index 8f628c03b6..30fcd18c77 100644 --- a/ext/com_dotnet/com_handlers.c +++ b/ext/com_dotnet/com_handlers.c @@ -49,7 +49,7 @@ static zval *com_property_read(zval *object, zval *member, int type TSRMLS_DC) convert_to_string_ex(&member); res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), - DISPATCH_PROPERTYGET, &v, 0, NULL TSRMLS_CC); + DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL TSRMLS_CC); if (res == SUCCESS) { php_com_zval_from_variant(return_value, &v, obj->code_page TSRMLS_CC); @@ -84,30 +84,6 @@ static void com_property_write(zval *object, zval *member, zval *value TSRMLS_DC } } -static HRESULT com_get_default_binding(php_com_dotnet_object *obj TSRMLS_DC) -{ - VARDESC *vardesc; - int i; - - if (!obj->typeinfo) { - return FAILURE; - } - - for (i = 0; !obj->have_default_bind; i++) { - if (FAILED(ITypeInfo_GetVarDesc(obj->typeinfo, i, &vardesc))) { - return FAILURE; - } - - if (vardesc->wVarFlags & VARFLAG_FDEFAULTBIND) { - obj->default_bind = (DISPID)vardesc->memid; - obj->have_default_bind = 1; - } - - ITypeInfo_ReleaseVarDesc(obj->typeinfo, vardesc); - } - return obj->have_default_bind ? SUCCESS : FAILURE; -} - static zval *com_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) { zval *return_value; @@ -122,14 +98,9 @@ static zval *com_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) obj = CDNO_FETCH(object); if (V_VT(&obj->v) == VT_DISPATCH) { - if (!obj->have_default_bind && !com_get_default_binding(obj TSRMLS_CC)) { - php_com_throw_exception(E_INVALIDARG, "this COM object has no default property" TSRMLS_CC); - return return_value; - } - VariantInit(&v); - if (SUCCESS == php_com_do_invoke_by_id(obj, obj->default_bind, + if (SUCCESS == php_com_do_invoke_by_id(obj, DISPID_VALUE, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 1, &offset TSRMLS_CC)) { php_com_zval_from_variant(return_value, &v, obj->code_page TSRMLS_CC); VariantClear(&v); @@ -163,17 +134,12 @@ static void com_write_dimension(zval *object, zval *offset, zval *value TSRMLS_D obj = CDNO_FETCH(object); if (V_VT(&obj->v) == VT_DISPATCH) { - if (!obj->have_default_bind && !com_get_default_binding(obj TSRMLS_CC)) { - php_com_throw_exception(E_INVALIDARG, "this COM object has no default property" TSRMLS_CC); - return; - } - args[0] = offset; args[1] = value; VariantInit(&v); - if (SUCCESS == php_com_do_invoke_by_id(obj, obj->default_bind, + if (SUCCESS == php_com_do_invoke_by_id(obj, DISPID_VALUE, DISPATCH_METHOD|DISPATCH_PROPERTYPUT, &v, 2, args TSRMLS_CC)) { VariantClear(&v); } @@ -537,11 +503,7 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type, int should_f VariantInit(&v); if (V_VT(&obj->v) == VT_DISPATCH) { - if (!obj->have_default_bind && !com_get_default_binding(obj TSRMLS_CC)) { - return FAILURE; - } - - if (FAILURE == php_com_do_invoke_by_id(obj, obj->default_bind, + if (FAILURE == php_com_do_invoke_by_id(obj, DISPID_VALUE, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL TSRMLS_CC)) { return FAILURE; } diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c index 9a10376d0b..181cd5e357 100644 --- a/ext/com_dotnet/com_typeinfo.c +++ b/ext/com_dotnet/com_typeinfo.c @@ -400,6 +400,7 @@ static const struct { { VT_VOID, "VT_VOID" }, { VT_PTR, "VT_PTR" }, { VT_HRESULT, "VT_HRESULT" }, + { VT_SAFEARRAY, "VT_SAFEARRAY" }, { 0, NULL } }; diff --git a/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h index f24f7cfbfb..9cf7723818 100644 --- a/ext/com_dotnet/php_com_dotnet_internal.h +++ b/ext/com_dotnet/php_com_dotnet_internal.h @@ -37,10 +37,8 @@ typedef struct _php_com_dotnet_object { ITypeInfo *typeinfo; long code_page; - unsigned int have_default_bind:1; zend_class_entry *ce; - DISPID default_bind; /* default property for array accesses */ /* associated event sink */ IDispatch *sink_dispatch; |