1 /* 2 * Copyright 2008 Jacek Caban for CodeWeavers 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 */ 18 19 #define COBJMACROS 20 21 #include "config.h" 22 23 #include <stdarg.h> 24 #ifdef HAVE_LIBXML2 25 # include <libxml/parser.h> 26 # include <libxml/xmlerror.h> 27 #endif 28 29 #include "windef.h" 30 #include "winbase.h" 31 #include "winuser.h" 32 #include "winnls.h" 33 #include "ole2.h" 34 #include "msxml6.h" 35 #include "msxml6did.h" 36 #include "wininet.h" 37 #include "urlmon.h" 38 #include "winreg.h" 39 #include "shlwapi.h" 40 41 #include "wine/debug.h" 42 #include "wine/unicode.h" 43 44 #include "msxml_private.h" 45 46 WINE_DEFAULT_DEBUG_CHANNEL(msxml); 47 48 static CRITICAL_SECTION cs_dispex_static_data; 49 static CRITICAL_SECTION_DEBUG cs_dispex_static_data_dbg = 50 { 51 0, 0, &cs_dispex_static_data, 52 { &cs_dispex_static_data_dbg.ProcessLocksList, &cs_dispex_static_data_dbg.ProcessLocksList }, 53 0, 0, { (DWORD_PTR)(__FILE__ ": dispex_static_data") } 54 }; 55 static CRITICAL_SECTION cs_dispex_static_data = { &cs_dispex_static_data_dbg, -1, 0, 0, 0, 0 }; 56 57 58 enum lib_version_t 59 { 60 LibXml = 0, 61 LibXml2, 62 LibXml_Last 63 }; 64 65 typedef struct { 66 REFIID iid; 67 enum lib_version_t lib; 68 } tid_id_t; 69 70 typedef struct { 71 REFIID iid; 72 unsigned short major; 73 } lib_id_t; 74 75 typedef struct { 76 DISPID id; 77 BSTR name; 78 enum tid_t tid; 79 } func_info_t; 80 81 struct dispex_data_t { 82 DWORD func_cnt; 83 func_info_t *funcs; 84 func_info_t **name_table; 85 86 struct list entry; 87 }; 88 89 static struct list dispex_data_list = LIST_INIT(dispex_data_list); 90 static ITypeLib *typelib[LibXml_Last]; 91 static ITypeInfo *typeinfos[LAST_tid]; 92 93 /* indexed with lib_version_t values */ 94 static lib_id_t lib_ids[] = { 95 { &LIBID_MSXML, 2 }, 96 { &LIBID_MSXML2, 3 } 97 }; 98 99 static tid_id_t tid_ids[] = { 100 { &IID_NULL, LibXml_Last }, 101 { &IID_IXMLDOMAttribute, LibXml2 }, 102 { &IID_IXMLDOMCDATASection, LibXml2 }, 103 { &IID_IXMLDOMComment, LibXml2 }, 104 { &IID_IXMLDOMDocument, LibXml2 }, 105 { &IID_IXMLDOMDocument2, LibXml2 }, 106 { &IID_IXMLDOMDocument3, LibXml2 }, 107 { &IID_IXMLDOMDocumentFragment, LibXml2 }, 108 { &IID_IXMLDOMDocumentType, LibXml2 }, 109 { &IID_IXMLDOMElement, LibXml2 }, 110 { &IID_IXMLDOMEntityReference, LibXml2 }, 111 { &IID_IXMLDOMImplementation, LibXml2 }, 112 { &IID_IXMLDOMNamedNodeMap, LibXml2 }, 113 { &IID_IXMLDOMNode, LibXml2 }, 114 { &IID_IXMLDOMNodeList, LibXml2 }, 115 { &IID_IXMLDOMParseError2, LibXml2 }, 116 { &IID_IXMLDOMProcessingInstruction, LibXml2 }, 117 { &IID_IXMLDOMSchemaCollection, LibXml2 }, 118 { &IID_IXMLDOMSchemaCollection2, LibXml2 }, 119 { &IID_IXMLDOMSelection, LibXml2 }, 120 { &IID_IXMLDOMText, LibXml2 }, 121 { &IID_IXMLElement, LibXml }, 122 { &IID_IXMLDocument, LibXml }, 123 { &IID_IXMLHTTPRequest, LibXml2 }, 124 { &IID_IXSLProcessor, LibXml2 }, 125 { &IID_IXSLTemplate, LibXml2 }, 126 { &IID_IVBSAXAttributes, LibXml2 }, 127 { &IID_IVBSAXContentHandler, LibXml2 }, 128 { &IID_IVBSAXDeclHandler, LibXml2 }, 129 { &IID_IVBSAXDTDHandler, LibXml2 }, 130 { &IID_IVBSAXEntityResolver, LibXml2 }, 131 { &IID_IVBSAXErrorHandler, LibXml2 }, 132 { &IID_IVBSAXLexicalHandler, LibXml2 }, 133 { &IID_IVBSAXLocator, LibXml2 }, 134 { &IID_IVBSAXXMLFilter, LibXml2 }, 135 { &IID_IVBSAXXMLReader, LibXml2 }, 136 { &IID_IMXAttributes, LibXml2 }, 137 { &IID_IMXReaderControl, LibXml2 }, 138 { &IID_IMXWriter, LibXml2 }, 139 { &IID_IVBMXNamespaceManager, LibXml2 }, 140 { &IID_IServerXMLHTTPRequest, LibXml2 } 141 }; 142 143 const IID *get_riid_from_tid(tid_t tid) 144 { 145 return tid_ids[tid].iid; 146 } 147 148 static inline unsigned get_libid_from_tid(tid_t tid) 149 { 150 return tid_ids[tid].lib; 151 } 152 153 static HRESULT get_typelib(unsigned lib, ITypeLib **tl) 154 { 155 HRESULT hres; 156 157 if(!typelib[lib]) { 158 hres = LoadRegTypeLib(lib_ids[lib].iid, lib_ids[lib].major, 0, LOCALE_SYSTEM_DEFAULT, tl); 159 if(FAILED(hres)) { 160 ERR("LoadRegTypeLib failed: %08x\n", hres); 161 return hres; 162 } 163 164 if (InterlockedCompareExchangePointer((void**)&typelib[lib], *tl, NULL)) 165 ITypeLib_Release(*tl); 166 } 167 168 *tl = typelib[lib]; 169 return S_OK; 170 } 171 172 HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo) 173 { 174 unsigned lib = get_libid_from_tid(tid); 175 ITypeLib *typelib; 176 HRESULT hres; 177 178 if (FAILED(hres = get_typelib(lib, &typelib))) 179 return hres; 180 181 if(!typeinfos[tid]) { 182 ITypeInfo *ti; 183 184 hres = ITypeLib_GetTypeInfoOfGuid(typelib, get_riid_from_tid(tid), &ti); 185 if(FAILED(hres)) { 186 /* try harder with typelib from msxml.dll */ 187 if (FAILED(hres = get_typelib(LibXml, &typelib))) 188 return hres; 189 hres = ITypeLib_GetTypeInfoOfGuid(typelib, get_riid_from_tid(tid), &ti); 190 if(FAILED(hres)) { 191 ERR("GetTypeInfoOfGuid failed: %08x\n", hres); 192 return hres; 193 } 194 } 195 196 if(InterlockedCompareExchangePointer((void**)(typeinfos+tid), ti, NULL)) 197 ITypeInfo_Release(ti); 198 } 199 200 *typeinfo = typeinfos[tid]; 201 202 ITypeInfo_AddRef(typeinfos[tid]); 203 return S_OK; 204 } 205 206 void release_typelib(void) 207 { 208 dispex_data_t *iter; 209 unsigned i; 210 211 while(!list_empty(&dispex_data_list)) { 212 iter = LIST_ENTRY(list_head(&dispex_data_list), dispex_data_t, entry); 213 list_remove(&iter->entry); 214 215 for(i=0; i < iter->func_cnt; i++) 216 SysFreeString(iter->funcs[i].name); 217 218 heap_free(iter->funcs); 219 heap_free(iter->name_table); 220 heap_free(iter); 221 } 222 223 for(i=0; i < ARRAY_SIZE(typeinfos); i++) 224 if(typeinfos[i]) 225 ITypeInfo_Release(typeinfos[i]); 226 227 for(i=0; i < ARRAY_SIZE(typelib); i++) 228 if(typelib[i]) 229 ITypeLib_Release(typelib[i]); 230 231 DeleteCriticalSection(&cs_dispex_static_data); 232 } 233 234 static void add_func_info(dispex_data_t *data, DWORD *size, tid_t tid, DISPID id, ITypeInfo *dti) 235 { 236 HRESULT hres; 237 238 if(data->func_cnt && data->funcs[data->func_cnt-1].id == id) 239 return; 240 241 if(data->func_cnt == *size) 242 data->funcs = heap_realloc(data->funcs, (*size <<= 1)*sizeof(func_info_t)); 243 244 hres = ITypeInfo_GetDocumentation(dti, id, &data->funcs[data->func_cnt].name, NULL, NULL, NULL); 245 if(FAILED(hres)) 246 return; 247 248 data->funcs[data->func_cnt].id = id; 249 data->funcs[data->func_cnt].tid = tid; 250 251 data->func_cnt++; 252 } 253 254 static int dispid_cmp(const void *p1, const void *p2) 255 { 256 return ((const func_info_t*)p1)->id - ((const func_info_t*)p2)->id; 257 } 258 259 static int func_name_cmp(const void *p1, const void *p2) 260 { 261 return strcmpiW((*(func_info_t* const*)p1)->name, (*(func_info_t* const*)p2)->name); 262 } 263 264 static dispex_data_t *preprocess_dispex_data(DispatchEx *This) 265 { 266 const tid_t *tid = This->data->iface_tids; 267 FUNCDESC *funcdesc; 268 dispex_data_t *data; 269 DWORD size = 16, i; 270 ITypeInfo *ti, *dti; 271 HRESULT hres; 272 273 TRACE("(%p)\n", This); 274 275 hres = get_typeinfo(This->data->disp_tid, &dti); 276 if(FAILED(hres)) { 277 ERR("Could not get disp type info: %08x\n", hres); 278 return NULL; 279 } 280 281 data = heap_alloc(sizeof(dispex_data_t)); 282 data->func_cnt = 0; 283 data->funcs = heap_alloc(size*sizeof(func_info_t)); 284 list_add_tail(&dispex_data_list, &data->entry); 285 286 while(*tid) { 287 hres = get_typeinfo(*tid, &ti); 288 if(FAILED(hres)) 289 break; 290 291 i=0; 292 while(1) { 293 hres = ITypeInfo_GetFuncDesc(ti, i++, &funcdesc); 294 if(FAILED(hres)) 295 break; 296 297 add_func_info(data, &size, *tid, funcdesc->memid, dti); 298 ITypeInfo_ReleaseFuncDesc(ti, funcdesc); 299 } 300 301 ITypeInfo_Release(ti); 302 tid++; 303 } 304 305 if(!data->func_cnt) { 306 heap_free(data->funcs); 307 data->funcs = NULL; 308 }else if(data->func_cnt != size) { 309 data->funcs = heap_realloc(data->funcs, data->func_cnt * sizeof(func_info_t)); 310 } 311 312 qsort(data->funcs, data->func_cnt, sizeof(func_info_t), dispid_cmp); 313 314 if(data->funcs) { 315 data->name_table = heap_alloc(data->func_cnt * sizeof(func_info_t*)); 316 for(i=0; i < data->func_cnt; i++) 317 data->name_table[i] = data->funcs+i; 318 qsort(data->name_table, data->func_cnt, sizeof(func_info_t*), func_name_cmp); 319 }else { 320 data->name_table = NULL; 321 } 322 323 ITypeInfo_Release(dti); 324 return data; 325 } 326 327 static dispex_data_t *get_dispex_data(DispatchEx *This) 328 { 329 if(This->data->data) 330 return This->data->data; 331 332 EnterCriticalSection(&cs_dispex_static_data); 333 334 if(!This->data->data) 335 This->data->data = preprocess_dispex_data(This); 336 337 LeaveCriticalSection(&cs_dispex_static_data); 338 339 return This->data->data; 340 } 341 342 static inline DispatchEx *impl_from_IDispatchEx(IDispatchEx *iface) 343 { 344 return CONTAINING_RECORD(iface, DispatchEx, IDispatchEx_iface); 345 } 346 347 static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv) 348 { 349 DispatchEx *This = impl_from_IDispatchEx(iface); 350 351 return IUnknown_QueryInterface(This->outer, riid, ppv); 352 } 353 354 static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface) 355 { 356 DispatchEx *This = impl_from_IDispatchEx(iface); 357 358 return IUnknown_AddRef(This->outer); 359 } 360 361 static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface) 362 { 363 DispatchEx *This = impl_from_IDispatchEx(iface); 364 365 return IUnknown_Release(This->outer); 366 } 367 368 static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo) 369 { 370 DispatchEx *This = impl_from_IDispatchEx(iface); 371 372 TRACE("(%p)->(%p)\n", This, pctinfo); 373 374 *pctinfo = 1; 375 return S_OK; 376 } 377 378 static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, 379 LCID lcid, ITypeInfo **ppTInfo) 380 { 381 DispatchEx *This = impl_from_IDispatchEx(iface); 382 383 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); 384 385 return get_typeinfo(This->data->disp_tid, ppTInfo); 386 } 387 388 static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, 389 LPOLESTR *rgszNames, UINT cNames, 390 LCID lcid, DISPID *rgDispId) 391 { 392 DispatchEx *This = impl_from_IDispatchEx(iface); 393 UINT i; 394 HRESULT hres; 395 396 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, 397 lcid, rgDispId); 398 399 for(i=0; i < cNames; i++) { 400 hres = IDispatchEx_GetDispID(&This->IDispatchEx_iface, rgszNames[i], 0, rgDispId+i); 401 if(FAILED(hres)) 402 return hres; 403 } 404 405 return S_OK; 406 } 407 408 static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, 409 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, 410 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) 411 { 412 DispatchEx *This = impl_from_IDispatchEx(iface); 413 414 TRACE("(%p)->(%x %s %x %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), 415 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); 416 417 return IDispatchEx_InvokeEx(&This->IDispatchEx_iface, dispIdMember, lcid, wFlags, 418 pDispParams, pVarResult, pExcepInfo, NULL); 419 } 420 421 static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) 422 { 423 DispatchEx *This = impl_from_IDispatchEx(iface); 424 dispex_data_t *data; 425 int min, max, n, c; 426 427 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); 428 429 if(grfdex & ~(fdexNameCaseSensitive|fdexNameEnsure|fdexNameImplicit)) 430 FIXME("Unsupported grfdex %x\n", grfdex); 431 432 data = get_dispex_data(This); 433 if(!data) 434 return E_FAIL; 435 436 min = 0; 437 max = data->func_cnt-1; 438 439 while(min <= max) { 440 n = (min+max)/2; 441 442 c = strcmpiW(data->name_table[n]->name, bstrName); 443 if(!c) { 444 if((grfdex & fdexNameCaseSensitive) && strcmpW(data->name_table[n]->name, bstrName)) 445 break; 446 447 *pid = data->name_table[n]->id; 448 return S_OK; 449 } 450 451 if(c > 0) 452 max = n-1; 453 else 454 min = n+1; 455 } 456 457 if(This->data->vtbl && This->data->vtbl->get_dispid) { 458 HRESULT hres; 459 460 hres = This->data->vtbl->get_dispid(This->outer, bstrName, grfdex, pid); 461 if(hres != DISP_E_UNKNOWNNAME) 462 return hres; 463 } 464 465 TRACE("not found %s\n", debugstr_w(bstrName)); 466 return DISP_E_UNKNOWNNAME; 467 } 468 469 static BOOL is_propputref_id(DISPID id) 470 { 471 switch (id) 472 { 473 case DISPID_DOM_DOCUMENT_DOCUMENTELEMENT: 474 case DISPID_XMLDOM_DOCUMENT2_SCHEMAS: 475 case DISPID_XMLDOM_SELECTION_CONTEXT: 476 case DISPID_XMLDOM_TEMPLATE_STYLESHEET: 477 case DISPID_SAX_CONTENTHANDLER_DOCUMENTLOCATOR: 478 case DISPID_SAX_XMLFILTER_PARENT: 479 case DISPID_SAX_XMLREADER_ENTITYRESOLVER: 480 case DISPID_SAX_XMLREADER_CONTENTHANDLER: 481 case DISPID_SAX_XMLREADER_DTDHANDLER: 482 case DISPID_SAX_XMLREADER_ERRORHANDLER: 483 case DISPID_MXXML_FILTER_ENTITYRESOLVER: 484 case DISPID_MXXML_FILTER_CONTENTHANDLER: 485 case DISPID_MXXML_FILTER_DTDHANDLER: 486 case DISPID_MXXML_FILTER_ERRORHANDLER: 487 return TRUE; 488 default: 489 return FALSE; 490 } 491 } 492 493 static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, 494 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) 495 { 496 DispatchEx *This = impl_from_IDispatchEx(iface); 497 IUnknown *unk; 498 ITypeInfo *ti; 499 dispex_data_t *data; 500 UINT argerr=0; 501 int min, max, n; 502 HRESULT hres; 503 504 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); 505 506 if(This->data->vtbl && This->data->vtbl->invoke) { 507 hres = This->data->vtbl->invoke(This->outer, id, lcid, wFlags, pdp, pvarRes, pei); 508 if (hres != DISP_E_UNKNOWNNAME) return hres; 509 } 510 511 if(wFlags == DISPATCH_CONSTRUCT) { 512 FIXME("DISPATCH_CONSTRUCT not implemented\n"); 513 return E_NOTIMPL; 514 } 515 516 data = get_dispex_data(This); 517 if(!data) 518 return E_FAIL; 519 520 min = 0; 521 max = data->func_cnt-1; 522 523 while(min <= max) { 524 n = (min+max)/2; 525 526 if(data->funcs[n].id == id) 527 break; 528 529 if(data->funcs[n].id < id) 530 min = n+1; 531 else 532 max = n-1; 533 } 534 535 if(min > max) { 536 WARN("invalid id %x\n", id); 537 return DISP_E_UNKNOWNNAME; 538 } 539 540 hres = get_typeinfo(data->funcs[n].tid, &ti); 541 if(FAILED(hres)) { 542 ERR("Could not get type info: %08x\n", hres); 543 return hres; 544 } 545 546 hres = IUnknown_QueryInterface(This->outer, get_riid_from_tid(data->funcs[n].tid), (void**)&unk); 547 if(FAILED(hres)) { 548 ERR("Could not get iface: %08x\n", hres); 549 ITypeInfo_Release(ti); 550 return E_FAIL; 551 } 552 553 if (is_propputref_id(id) && wFlags == DISPATCH_PROPERTYPUT) 554 wFlags = DISPATCH_PROPERTYPUTREF; 555 hres = ITypeInfo_Invoke(ti, unk, id, wFlags, pdp, pvarRes, pei, &argerr); 556 557 ITypeInfo_Release(ti); 558 IUnknown_Release(unk); 559 return hres; 560 } 561 562 static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex) 563 { 564 DispatchEx *This = impl_from_IDispatchEx(iface); 565 TRACE("Not implemented in native msxml3 (%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex); 566 return E_NOTIMPL; 567 } 568 569 static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id) 570 { 571 DispatchEx *This = impl_from_IDispatchEx(iface); 572 TRACE("Not implemented in native msxml3 (%p)->(%x)\n", This, id); 573 return E_NOTIMPL; 574 } 575 576 static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex) 577 { 578 DispatchEx *This = impl_from_IDispatchEx(iface); 579 TRACE("Not implemented in native msxml3 (%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex); 580 return E_NOTIMPL; 581 } 582 583 static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName) 584 { 585 DispatchEx *This = impl_from_IDispatchEx(iface); 586 TRACE("Not implemented in native msxml3 (%p)->(%x %p)\n", This, id, pbstrName); 587 return E_NOTIMPL; 588 } 589 590 static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid) 591 { 592 DispatchEx *This = impl_from_IDispatchEx(iface); 593 TRACE(" Not implemented in native msxml3 (%p)->(%x %x %p)\n", This, grfdex, id, pid); 594 return E_NOTIMPL; 595 } 596 597 static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk) 598 { 599 DispatchEx *This = impl_from_IDispatchEx(iface); 600 TRACE("Not implemented in native msxml3 (%p)->(%p)\n", This, ppunk); 601 return E_NOTIMPL; 602 } 603 604 static IDispatchExVtbl DispatchExVtbl = { 605 DispatchEx_QueryInterface, 606 DispatchEx_AddRef, 607 DispatchEx_Release, 608 DispatchEx_GetTypeInfoCount, 609 DispatchEx_GetTypeInfo, 610 DispatchEx_GetIDsOfNames, 611 DispatchEx_Invoke, 612 DispatchEx_GetDispID, 613 DispatchEx_InvokeEx, 614 DispatchEx_DeleteMemberByName, 615 DispatchEx_DeleteMemberByDispID, 616 DispatchEx_GetMemberProperties, 617 DispatchEx_GetMemberName, 618 DispatchEx_GetNextDispID, 619 DispatchEx_GetNameSpaceParent 620 }; 621 622 BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv) 623 { 624 static const IID IID_UndocumentedScriptIface = 625 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}}; 626 static const IID IID_IDispatchJS = 627 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6}}; 628 629 if(IsEqualGUID(&IID_IDispatch, riid)) { 630 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); 631 *ppv = &This->IDispatchEx_iface; 632 }else if(IsEqualGUID(&IID_IDispatchEx, riid)) { 633 TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv); 634 *ppv = &This->IDispatchEx_iface; 635 }else if(IsEqualGUID(&IID_IDispatchJS, riid)) { 636 TRACE("(%p)->(IID_IDispatchJS %p) returning NULL\n", This, ppv); 637 *ppv = NULL; 638 }else if(IsEqualGUID(&IID_UndocumentedScriptIface, riid)) { 639 TRACE("(%p)->(IID_UndocumentedScriptIface %p) returning NULL\n", This, ppv); 640 *ppv = NULL; 641 }else if (IsEqualGUID(&IID_IObjectIdentity, riid)) { 642 TRACE("IID_IObjectIdentity not supported returning NULL\n"); 643 *ppv = NULL; 644 }else { 645 return FALSE; 646 } 647 648 if(*ppv) 649 IUnknown_AddRef((IUnknown*)*ppv); 650 return TRUE; 651 } 652 653 void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data) 654 { 655 dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl; 656 dispex->outer = outer; 657 dispex->data = data; 658 } 659