@@ -306,18 +306,20 @@ ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj
306
306
307
307
if (obj ) {
308
308
if (dispname == NULL && sink ) {
309
- IProvideClassInfo2 * pci2 ;
310
- IProvideClassInfo * pci ;
309
+ if (V_VT (& obj -> v ) == VT_DISPATCH ) {
310
+ IProvideClassInfo2 * pci2 ;
311
+ IProvideClassInfo * pci ;
311
312
312
- if (SUCCEEDED (IDispatch_QueryInterface (V_DISPATCH (& obj -> v ), & IID_IProvideClassInfo2 , (void * * )& pci2 ))) {
313
- gotguid = SUCCEEDED (IProvideClassInfo2_GetGUID (pci2 , GUIDKIND_DEFAULT_SOURCE_DISP_IID , & iid ));
314
- IProvideClassInfo2_Release (pci2 );
315
- }
316
- if (!gotguid && SUCCEEDED (IDispatch_QueryInterface (V_DISPATCH (& obj -> v ), & IID_IProvideClassInfo , (void * * )& pci ))) {
317
- /* examine the available interfaces */
318
- /* TODO: write some code here */
319
- php_error_docref (NULL , E_WARNING , "IProvideClassInfo: this code not yet written!" );
320
- IProvideClassInfo_Release (pci );
313
+ if (SUCCEEDED (IDispatch_QueryInterface (V_DISPATCH (& obj -> v ), & IID_IProvideClassInfo2 , (void * * )& pci2 ))) {
314
+ gotguid = SUCCEEDED (IProvideClassInfo2_GetGUID (pci2 , GUIDKIND_DEFAULT_SOURCE_DISP_IID , & iid ));
315
+ IProvideClassInfo2_Release (pci2 );
316
+ }
317
+ if (!gotguid && SUCCEEDED (IDispatch_QueryInterface (V_DISPATCH (& obj -> v ), & IID_IProvideClassInfo , (void * * )& pci ))) {
318
+ /* examine the available interfaces */
319
+ /* TODO: write some code here */
320
+ php_error_docref (NULL , E_WARNING , "IProvideClassInfo: this code not yet written!" );
321
+ IProvideClassInfo_Release (pci );
322
+ }
321
323
}
322
324
} else if (dispname == NULL ) {
323
325
if (obj -> typeinfo ) {
@@ -334,15 +336,17 @@ ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj
334
336
/* get the library from the object; the rest will be dealt with later */
335
337
ITypeInfo_GetContainingTypeLib (obj -> typeinfo , & typelib , & idx );
336
338
} else if (typelibname == NULL ) {
337
- IDispatch_GetTypeInfo (V_DISPATCH (& obj -> v ), 0 , LANG_NEUTRAL , & typeinfo );
338
- if (dispname ) {
339
- unsigned int idx ;
340
- /* get the library from the object; the rest will be dealt with later */
341
- ITypeInfo_GetContainingTypeLib (typeinfo , & typelib , & idx );
342
-
343
- if (typelib ) {
344
- ITypeInfo_Release (typeinfo );
345
- typeinfo = NULL ;
339
+ if (V_VT (& obj -> v ) == VT_DISPATCH ) {
340
+ IDispatch_GetTypeInfo (V_DISPATCH (& obj -> v ), 0 , LANG_NEUTRAL , & typeinfo );
341
+ if (dispname ) {
342
+ unsigned int idx ;
343
+ /* get the library from the object; the rest will be dealt with later */
344
+ ITypeInfo_GetContainingTypeLib (typeinfo , & typelib , & idx );
345
+
346
+ if (typelib ) {
347
+ ITypeInfo_Release (typeinfo );
348
+ typeinfo = NULL ;
349
+ }
346
350
}
347
351
}
348
352
}
0 commit comments