@@ -267,18 +267,20 @@ ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj
267267
268268 if (obj ) {
269269 if (dispname == NULL && sink ) {
270- IProvideClassInfo2 * pci2 ;
271- IProvideClassInfo * pci ;
270+ if (V_VT (& obj -> v ) == VT_DISPATCH ) {
271+ IProvideClassInfo2 * pci2 ;
272+ IProvideClassInfo * pci ;
272273
273- if (SUCCEEDED (IDispatch_QueryInterface (V_DISPATCH (& obj -> v ), & IID_IProvideClassInfo2 , (void * * )& pci2 ))) {
274- gotguid = SUCCEEDED (IProvideClassInfo2_GetGUID (pci2 , GUIDKIND_DEFAULT_SOURCE_DISP_IID , & iid ));
275- IProvideClassInfo2_Release (pci2 );
276- }
277- if (!gotguid && SUCCEEDED (IDispatch_QueryInterface (V_DISPATCH (& obj -> v ), & IID_IProvideClassInfo , (void * * )& pci ))) {
278- /* examine the available interfaces */
279- /* TODO: write some code here */
280- php_error_docref (NULL , E_WARNING , "IProvideClassInfo: this code not yet written!" );
281- IProvideClassInfo_Release (pci );
274+ if (SUCCEEDED (IDispatch_QueryInterface (V_DISPATCH (& obj -> v ), & IID_IProvideClassInfo2 , (void * * )& pci2 ))) {
275+ gotguid = SUCCEEDED (IProvideClassInfo2_GetGUID (pci2 , GUIDKIND_DEFAULT_SOURCE_DISP_IID , & iid ));
276+ IProvideClassInfo2_Release (pci2 );
277+ }
278+ if (!gotguid && SUCCEEDED (IDispatch_QueryInterface (V_DISPATCH (& obj -> v ), & IID_IProvideClassInfo , (void * * )& pci ))) {
279+ /* examine the available interfaces */
280+ /* TODO: write some code here */
281+ php_error_docref (NULL , E_WARNING , "IProvideClassInfo: this code not yet written!" );
282+ IProvideClassInfo_Release (pci );
283+ }
282284 }
283285 } else if (dispname == NULL ) {
284286 if (obj -> typeinfo ) {
@@ -295,15 +297,17 @@ ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj
295297 /* get the library from the object; the rest will be dealt with later */
296298 ITypeInfo_GetContainingTypeLib (obj -> typeinfo , & typelib , & idx );
297299 } else if (typelibname == NULL ) {
298- IDispatch_GetTypeInfo (V_DISPATCH (& obj -> v ), 0 , LANG_NEUTRAL , & typeinfo );
299- if (dispname ) {
300- unsigned int idx ;
301- /* get the library from the object; the rest will be dealt with later */
302- ITypeInfo_GetContainingTypeLib (typeinfo , & typelib , & idx );
303-
304- if (typelib ) {
305- ITypeInfo_Release (typeinfo );
306- typeinfo = NULL ;
300+ if (V_VT (& obj -> v ) == VT_DISPATCH ) {
301+ IDispatch_GetTypeInfo (V_DISPATCH (& obj -> v ), 0 , LANG_NEUTRAL , & typeinfo );
302+ if (dispname ) {
303+ unsigned int idx ;
304+ /* get the library from the object; the rest will be dealt with later */
305+ ITypeInfo_GetContainingTypeLib (typeinfo , & typelib , & idx );
306+
307+ if (typelib ) {
308+ ITypeInfo_Release (typeinfo );
309+ typeinfo = NULL ;
310+ }
307311 }
308312 }
309313 }
0 commit comments