cvs: php-src /ext/com_dotnet com_dotnet.c

From: Date: Tue, 03 Aug 2004 09:44:04 +0000
Subject: cvs: php-src /ext/com_dotnet com_dotnet.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-28163@lists.php.net to get a copy of this message
wez Tue Aug 3 05:44:04 2004 EDT Modified files: /php-src/ext/com_dotnet com_dotnet.c Log: Even more verbosity in case of error http://cvs.php.net/diff.php/php-src/ext/com_dotnet/com_dotnet.c?r1=1.8&r2=1.9&ty=u Index: php-src/ext/com_dotnet/com_dotnet.c diff -u php-src/ext/com_dotnet/com_dotnet.c:1.8 php-src/ext/com_dotnet/com_dotnet.c:1.9 --- php-src/ext/com_dotnet/com_dotnet.c:1.8 Mon Aug 2 14:02:48 2004 +++ php-src/ext/com_dotnet/com_dotnet.c Tue Aug 3 05:44:04 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: com_dotnet.c,v 1.8 2004/08/02 18:02:48 wez Exp $ */ +/* $Id: com_dotnet.c,v 1.9 2004/08/03 09:44:04 wez Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -100,12 +100,12 @@ char *assembly_name, *datatype_name; int assembly_name_len, datatype_name_len; struct dotnet_runtime_stuff *stuff; - IObjectHandle *handle; DISPPARAMS params; VARIANT vargs[2]; VARIANT retval; HRESULT hr; int ret = FAILURE; + char *where = ""; if (COMG(dotnet_runtime_stuff) == NULL) { if (FAILURE == dotnet_init(TSRMLS_C)) { @@ -143,27 +143,33 @@ V_VT(&vargs[1]) = VT_BSTR; V_BSTR(&vargs[1]) = php_com_string_to_olestring(assembly_name, assembly_name_len, obj->code_page TSRMLS_CC); + where = "IDispatch_Invoke"; hr = IDispatch_Invoke(stuff->dotnet_domain, stuff->create_instance, &IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &params, &retval, NULL, NULL); if (SUCCEEDED(hr)) { /* retval should now be an IUnknown/IDispatch representation of an IObjectHandle interface */ - if ((V_VT(&retval) == VT_UNKNOWN || V_VT(&retval) == VT_DISPATCH) && - SUCCEEDED(IUnknown_QueryInterface(V_UNKNOWN(&retval), &IID_IObjectHandle, &handle))) { + if (V_VT(&retval) == VT_UNKNOWN || V_VT(&retval) == VT_DISPATCH) { VARIANT unwrapped; + IObjectHandle *handle; - hr = IObjectHandle_Unwrap(handle, &unwrapped); + where = "QI: IID_IObjectHandle"; + hr = IUnknown_QueryInterface(V_UNKNOWN(&retval), &IID_IObjectHandle, &handle); if (SUCCEEDED(hr)) { - /* unwrapped is now the dispatch pointer we want */ - V_DISPATCH(&obj->v) = V_DISPATCH(&unwrapped); - V_VT(&obj->v) = VT_DISPATCH; - - /* get its type-info */ - IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &obj->typeinfo); - - ret = SUCCESS; + where = "IObjectHandle_Unwrap"; + hr = IObjectHandle_Unwrap(handle, &unwrapped); + if (SUCCEEDED(hr)) { + /* unwrapped is now the dispatch pointer we want */ + V_DISPATCH(&obj->v) = V_DISPATCH(&unwrapped); + V_VT(&obj->v) = VT_DISPATCH; + + /* get its type-info */ + IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &obj->typeinfo); + + ret = SUCCESS; + } + IObjectHandle_Release(handle); } - IObjectHandle_Release(handle); } VariantClear(&retval); } @@ -172,7 +178,9 @@ VariantClear(&vargs[1]); if (ret == FAILURE) { - php_com_throw_exception(hr, "Failed to instantiate .Net object" TSRMLS_CC); + char buf[1024]; + sprintf(buf, "Failed to instantiate .Net object [%s]", where); + php_com_throw_exception(hr, buf TSRMLS_CC); ZVAL_NULL(object); return; }

« previous php.cvs (#28163) next »