ReactOS 0.4.15-dev-8222-g9164419
dispex.c File Reference
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "ole2.h"
#include "msxml6.h"
#include "msxml6did.h"
#include "wininet.h"
#include "urlmon.h"
#include "winreg.h"
#include "shlwapi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "msxml_private.h"
Include dependency graph for dispex.c:

Go to the source code of this file.

Classes

struct  tid_id_t
 
struct  lib_id_t
 
struct  func_info_t
 
struct  dispex_data_t
 

Macros

#define COBJMACROS
 

Enumerations

enum  lib_version_t { LibXml = 0 , LibXml2 , LibXml_Last }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msxml)
 
const IIDget_riid_from_tid (tid_t tid)
 
static unsigned get_libid_from_tid (tid_t tid)
 
static HRESULT get_typelib (unsigned lib, ITypeLib **tl)
 
HRESULT get_typeinfo (enum tid_t tid, ITypeInfo **typeinfo)
 
void release_typelib (void)
 
static void add_func_info (dispex_data_t *data, DWORD *size, tid_t tid, DISPID id, ITypeInfo *dti)
 
static int dispid_cmp (const void *p1, const void *p2)
 
static int func_name_cmp (const void *p1, const void *p2)
 
static dispex_data_tpreprocess_dispex_data (DispatchEx *This)
 
static dispex_data_tget_dispex_data (DispatchEx *This)
 
static DispatchEximpl_from_IDispatchEx (IDispatchEx *iface)
 
static HRESULT WINAPI DispatchEx_QueryInterface (IDispatchEx *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI DispatchEx_AddRef (IDispatchEx *iface)
 
static ULONG WINAPI DispatchEx_Release (IDispatchEx *iface)
 
static HRESULT WINAPI DispatchEx_GetTypeInfoCount (IDispatchEx *iface, UINT *pctinfo)
 
static HRESULT WINAPI DispatchEx_GetTypeInfo (IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI DispatchEx_GetIDsOfNames (IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI DispatchEx_Invoke (IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI DispatchEx_GetDispID (IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
 
static BOOL is_propputref_id (DISPID id)
 
static HRESULT WINAPI DispatchEx_InvokeEx (IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
 
static HRESULT WINAPI DispatchEx_DeleteMemberByName (IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
 
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID (IDispatchEx *iface, DISPID id)
 
static HRESULT WINAPI DispatchEx_GetMemberProperties (IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
 
static HRESULT WINAPI DispatchEx_GetMemberName (IDispatchEx *iface, DISPID id, BSTR *pbstrName)
 
static HRESULT WINAPI DispatchEx_GetNextDispID (IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
 
static HRESULT WINAPI DispatchEx_GetNameSpaceParent (IDispatchEx *iface, IUnknown **ppunk)
 
BOOL dispex_query_interface (DispatchEx *This, REFIID riid, void **ppv)
 
void init_dispex (DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data)
 

Variables

static CRITICAL_SECTION cs_dispex_static_data = { &cs_dispex_static_data_dbg, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG cs_dispex_static_data_dbg
 
static struct list dispex_data_list = LIST_INIT(dispex_data_list)
 
static ITypeLibtypelib [LibXml_Last]
 
static ITypeInfotypeinfos [LAST_tid]
 
static lib_id_t lib_ids []
 
static tid_id_t tid_ids []
 
static IDispatchExVtbl DispatchExVtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file dispex.c.

Enumeration Type Documentation

◆ lib_version_t

Enumerator
LibXml 
LibXml2 
LibXml_Last 

Definition at line 58 of file dispex.c.

59{
60 LibXml = 0,
61 LibXml2,
63};
@ LibXml2
Definition: dispex.c:61
@ LibXml
Definition: dispex.c:60
@ LibXml_Last
Definition: dispex.c:62

Function Documentation

◆ add_func_info()

static void add_func_info ( dispex_data_t data,
DWORD size,
tid_t  tid,
DISPID  id,
ITypeInfo dti 
)
static

Definition at line 234 of file dispex.c.

235{
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}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
#define NULL
Definition: types.h:112
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
GLuint id
Definition: glext.h:5910
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hres
Definition: protocol.c:465
static TfClientId tid

◆ DispatchEx_AddRef()

static ULONG WINAPI DispatchEx_AddRef ( IDispatchEx iface)
static

Definition at line 354 of file dispex.c.

355{
357
358 return IUnknown_AddRef(This->outer);
359}
static jsdisp_t * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:593

◆ DispatchEx_DeleteMemberByDispID()

static HRESULT WINAPI DispatchEx_DeleteMemberByDispID ( IDispatchEx iface,
DISPID  id 
)
static

Definition at line 569 of file dispex.c.

570{
572 TRACE("Not implemented in native msxml3 (%p)->(%x)\n", This, id);
573 return E_NOTIMPL;
574}
#define E_NOTIMPL
Definition: ddrawi.h:99
#define TRACE(s)
Definition: solgame.cpp:4

◆ DispatchEx_DeleteMemberByName()

static HRESULT WINAPI DispatchEx_DeleteMemberByName ( IDispatchEx iface,
BSTR  bstrName,
DWORD  grfdex 
)
static

Definition at line 562 of file dispex.c.

563{
565 TRACE("Not implemented in native msxml3 (%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex);
566 return E_NOTIMPL;
567}
#define debugstr_w
Definition: kernel32.h:32

◆ DispatchEx_GetDispID()

static HRESULT WINAPI DispatchEx_GetDispID ( IDispatchEx iface,
BSTR  bstrName,
DWORD  grfdex,
DISPID pid 
)
static

Definition at line 421 of file dispex.c.

422{
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
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) {
459
460 hres = This->data->vtbl->get_dispid(This->outer, bstrName, grfdex, pid);
462 return hres;
463 }
464
465 TRACE("not found %s\n", debugstr_w(bstrName));
466 return DISP_E_UNKNOWNNAME;
467}
#define FIXME(fmt,...)
Definition: debug.h:114
#define E_FAIL
Definition: ddrawi.h:102
GLdouble n
Definition: glext.h:7729
const GLubyte * c
Definition: glext.h:8905
#define S_OK
Definition: intsafe.h:52
#define c
Definition: ke_i.h:80
#define min(a, b)
Definition: monoChain.cc:55
static dispex_data_t * get_dispex_data(DispatchEx *This)
Definition: dispex.c:439
#define strcmpW(s1, s2)
Definition: unicode.h:44
#define strcmpiW(s1, s2)
Definition: unicode.h:45
#define max(a, b)
Definition: svc.c:63
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515

◆ DispatchEx_GetIDsOfNames()

static HRESULT WINAPI DispatchEx_GetIDsOfNames ( IDispatchEx iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 388 of file dispex.c.

391{
393 UINT i;
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}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
unsigned int UINT
Definition: ndis.h:50

◆ DispatchEx_GetMemberName()

static HRESULT WINAPI DispatchEx_GetMemberName ( IDispatchEx iface,
DISPID  id,
BSTR pbstrName 
)
static

Definition at line 583 of file dispex.c.

584{
586 TRACE("Not implemented in native msxml3 (%p)->(%x %p)\n", This, id, pbstrName);
587 return E_NOTIMPL;
588}

◆ DispatchEx_GetMemberProperties()

static HRESULT WINAPI DispatchEx_GetMemberProperties ( IDispatchEx iface,
DISPID  id,
DWORD  grfdexFetch,
DWORD pgrfdex 
)
static

Definition at line 576 of file dispex.c.

577{
579 TRACE("Not implemented in native msxml3 (%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex);
580 return E_NOTIMPL;
581}

◆ DispatchEx_GetNameSpaceParent()

static HRESULT WINAPI DispatchEx_GetNameSpaceParent ( IDispatchEx iface,
IUnknown **  ppunk 
)
static

Definition at line 597 of file dispex.c.

598{
600 TRACE("Not implemented in native msxml3 (%p)->(%p)\n", This, ppunk);
601 return E_NOTIMPL;
602}

◆ DispatchEx_GetNextDispID()

static HRESULT WINAPI DispatchEx_GetNextDispID ( IDispatchEx iface,
DWORD  grfdex,
DISPID  id,
DISPID pid 
)
static

Definition at line 590 of file dispex.c.

591{
593 TRACE(" Not implemented in native msxml3 (%p)->(%x %x %p)\n", This, grfdex, id, pid);
594 return E_NOTIMPL;
595}

◆ DispatchEx_GetTypeInfo()

static HRESULT WINAPI DispatchEx_GetTypeInfo ( IDispatchEx iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 378 of file dispex.c.

380{
382
383 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
384
385 return get_typeinfo(This->data->disp_tid, ppTInfo);
386}
static HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo)
Definition: dispex.c:118

◆ DispatchEx_GetTypeInfoCount()

static HRESULT WINAPI DispatchEx_GetTypeInfoCount ( IDispatchEx iface,
UINT pctinfo 
)
static

Definition at line 368 of file dispex.c.

369{
371
372 TRACE("(%p)->(%p)\n", This, pctinfo);
373
374 *pctinfo = 1;
375 return S_OK;
376}

◆ DispatchEx_Invoke()

static HRESULT WINAPI DispatchEx_Invoke ( IDispatchEx iface,
DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
static

Definition at line 408 of file dispex.c.

411{
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}
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531

◆ DispatchEx_InvokeEx()

static HRESULT WINAPI DispatchEx_InvokeEx ( IDispatchEx iface,
DISPID  id,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pdp,
VARIANT pvarRes,
EXCEPINFO *  pei,
IServiceProvider pspCaller 
)
static

Definition at line 493 of file dispex.c.

495{
497 IUnknown *unk;
498 ITypeInfo *ti;
500 UINT argerr=0;
501 int min, max, n;
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
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
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}
#define WARN(fmt,...)
Definition: debug.h:115
#define ERR(fmt,...)
Definition: debug.h:113
const IID * get_riid_from_tid(tid_t tid)
Definition: dispex.c:143
static BOOL is_propputref_id(DISPID id)
Definition: dispex.c:469
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
#define DISPATCH_PROPERTYPUTREF
Definition: oleauto.h:1009

◆ DispatchEx_QueryInterface()

static HRESULT WINAPI DispatchEx_QueryInterface ( IDispatchEx iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 347 of file dispex.c.

348{
350
351 return IUnknown_QueryInterface(This->outer, riid, ppv);
352}
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ DispatchEx_Release()

static ULONG WINAPI DispatchEx_Release ( IDispatchEx iface)
static

Definition at line 361 of file dispex.c.

362{
364
365 return IUnknown_Release(This->outer);
366}

◆ dispex_query_interface()

BOOL dispex_query_interface ( DispatchEx This,
REFIID  riid,
void **  ppv 
)

Definition at line 622 of file dispex.c.

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
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}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
const GUID IID_IDispatch
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

◆ dispid_cmp()

static int dispid_cmp ( const void p1,
const void p2 
)
static

Definition at line 254 of file dispex.c.

255{
256 return ((const func_info_t*)p1)->id - ((const func_info_t*)p2)->id;
257}

◆ func_name_cmp()

static int func_name_cmp ( const void p1,
const void p2 
)
static

Definition at line 259 of file dispex.c.

260{
261 return strcmpiW((*(func_info_t* const*)p1)->name, (*(func_info_t* const*)p2)->name);
262}
Definition: name.c:39

◆ get_dispex_data()

static dispex_data_t * get_dispex_data ( DispatchEx This)
static

Definition at line 327 of file dispex.c.

328{
329 if(This->data->data)
330 return This->data->data;
331
333
334 if(!This->data->data)
335 This->data->data = preprocess_dispex_data(This);
336
338
339 return This->data->data;
340}
static dispex_data_t * preprocess_dispex_data(DispatchEx *This)
Definition: dispex.c:313
static CRITICAL_SECTION cs_dispex_static_data
Definition: dispex.c:23
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

◆ get_libid_from_tid()

static unsigned get_libid_from_tid ( tid_t  tid)
inlinestatic

Definition at line 148 of file dispex.c.

149{
150 return tid_ids[tid].lib;
151}
static REFIID tid_ids[]
Definition: dispex.c:94

Referenced by get_typeinfo().

◆ get_riid_from_tid()

const IID * get_riid_from_tid ( tid_t  tid)

Definition at line 143 of file dispex.c.

144{
145 return tid_ids[tid].iid;
146}

Referenced by DispatchEx_InvokeEx(), and get_typeinfo().

◆ get_typeinfo()

HRESULT get_typeinfo ( enum tid_t  tid,
ITypeInfo **  typeinfo 
)

Definition at line 172 of file dispex.c.

173{
174 unsigned lib = get_libid_from_tid(tid);
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 */
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
197 ITypeInfo_Release(ti);
198 }
199
201
202 ITypeInfo_AddRef(typeinfos[tid]);
203 return S_OK;
204}
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
static ITypeLib * typelib
Definition: dispex.c:90
static ITypeInfo * typeinfos[LAST_tid]
Definition: dispex.c:91
static HRESULT get_typelib(unsigned lib, ITypeLib **tl)
Definition: dispex.c:153
static unsigned get_libid_from_tid(tid_t tid)
Definition: dispex.c:148

◆ get_typelib()

static HRESULT get_typelib ( unsigned  lib,
ITypeLib **  tl 
)
static

Definition at line 153 of file dispex.c.

154{
156
157 if(!typelib[lib]) {
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}
HRESULT WINAPI LoadRegTypeLib(REFGUID rguid, WORD wVerMajor, WORD wVerMinor, LCID lcid, ITypeLib **ppTLib)
Definition: typelib.c:531
static lib_id_t lib_ids[]
Definition: dispex.c:94
#define LOCALE_SYSTEM_DEFAULT
#define major(rdev)
Definition: propsheet.cpp:928

Referenced by get_typeinfo().

◆ impl_from_IDispatchEx()

static DispatchEx * impl_from_IDispatchEx ( IDispatchEx iface)
inlinestatic

Definition at line 342 of file dispex.c.

343{
344 return CONTAINING_RECORD(iface, DispatchEx, IDispatchEx_iface);
345}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

◆ init_dispex()

void init_dispex ( DispatchEx dispex,
IUnknown outer,
dispex_static_data_t data 
)

Definition at line 653 of file dispex.c.

654{
655 dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl;
656 dispex->outer = outer;
657 dispex->data = data;
658}
static IDispatchExVtbl DispatchExVtbl
Definition: dispex.c:890
dispex_static_data_t * data
IDispatchEx IDispatchEx_iface
IUnknown * outer

◆ is_propputref_id()

static BOOL is_propputref_id ( DISPID  id)
static

Definition at line 469 of file dispex.c.

470{
471 switch (id)
472 {
487 return TRUE;
488 default:
489 return FALSE;
490 }
491}
#define DISPID_DOM_DOCUMENT_DOCUMENTELEMENT
Definition: msxml2did.h:114
#define DISPID_XMLDOM_DOCUMENT2_SCHEMAS
Definition: msxml2did.h:280
#define DISPID_MXXML_FILTER_ENTITYRESOLVER
Definition: msxml2did.h:480
#define DISPID_SAX_XMLREADER_ERRORHANDLER
Definition: msxml2did.h:349
#define DISPID_MXXML_FILTER_ERRORHANDLER
Definition: msxml2did.h:481
#define DISPID_SAX_XMLFILTER_PARENT
Definition: msxml2did.h:369
#define DISPID_SAX_XMLREADER_ENTITYRESOLVER
Definition: msxml2did.h:346
#define DISPID_XMLDOM_TEMPLATE_STYLESHEET
Definition: msxml2did.h:313
#define DISPID_XMLDOM_SELECTION_CONTEXT
Definition: msxml2did.h:302
#define DISPID_SAX_CONTENTHANDLER_DOCUMENTLOCATOR
Definition: msxml2did.h:381
#define DISPID_SAX_XMLREADER_DTDHANDLER
Definition: msxml2did.h:348
#define DISPID_MXXML_FILTER_DTDHANDLER
Definition: msxml2did.h:479
#define DISPID_MXXML_FILTER_CONTENTHANDLER
Definition: msxml2did.h:478
#define DISPID_SAX_XMLREADER_CONTENTHANDLER
Definition: msxml2did.h:347

Referenced by DispatchEx_InvokeEx().

◆ preprocess_dispex_data()

static dispex_data_t * preprocess_dispex_data ( DispatchEx This)
static

Definition at line 264 of file dispex.c.

265{
266 const tid_t *tid = This->data->iface_tids;
267 FUNCDESC *funcdesc;
269 DWORD size = 16, i;
270 ITypeInfo *ti, *dti;
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));
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}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
unsigned long DWORD
Definition: ntddk_ex.h:95
tid_t
Definition: ieframe.h:311
static struct list dispex_data_list
Definition: dispex.c:92
static int func_name_cmp(const void *p1, const void *p2)
Definition: dispex.c:308
static void add_func_info(dispex_data_t *data, DWORD *size, tid_t tid, const FUNCDESC *desc, ITypeInfo *dti)
Definition: dispex.c:213
static int dispid_cmp(const void *p1, const void *p2)
Definition: dispex.c:303
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))

◆ release_typelib()

void release_typelib ( void  )

Definition at line 206 of file dispex.c.

207{
208 dispex_data_t *iter;
209 unsigned i;
210
211 while(!list_empty(&dispex_data_list)) {
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
232}
#define ARRAY_SIZE(A)
Definition: main.h:33
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static int list_empty(struct list_entry *head)
Definition: list.h:58
uint32_t entry
Definition: isohybrid.c:63
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
func_info_t * funcs
Definition: dispex.c:50
DWORD func_cnt
Definition: dispex.c:49
func_info_t ** name_table
Definition: dispex.c:51
struct list entry
Definition: dispex.c:54
BSTR name
Definition: dispex.c:37
Definition: list.h:15
#define LIST_ENTRY(type)
Definition: queue.h:175
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msxml  )

Variable Documentation

◆ cs_dispex_static_data

static CRITICAL_SECTION cs_dispex_static_data = { &cs_dispex_static_data_dbg, -1, 0, 0, 0, 0 }
static

Definition at line 48 of file dispex.c.

◆ cs_dispex_static_data_dbg

CRITICAL_SECTION_DEBUG cs_dispex_static_data_dbg
static
Initial value:
=
{
0, 0, { (DWORD_PTR)(__FILE__ ": dispex_static_data") }
}
static CRITICAL_SECTION_DEBUG cs_dispex_static_data_dbg
Definition: dispex.c:24
LIST_ENTRY ProcessLocksList
Definition: winbase.h:883
#define DWORD_PTR
Definition: treelist.c:76

Definition at line 49 of file dispex.c.

◆ DispatchExVtbl

IDispatchExVtbl DispatchExVtbl
static
Initial value:
= {
}
static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: dispex.c:703
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
Definition: dispex.c:845
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
Definition: dispex.c:628
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: dispex.c:656
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
Definition: dispex.c:828
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
Definition: dispex.c:883
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: dispex.c:689
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: dispex.c:676
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
Definition: dispex.c:852
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
Definition: dispex.c:870
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
Definition: dispex.c:598
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
Definition: dispex.c:621
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: dispex.c:648
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
Definition: dispex.c:805
static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
Definition: dispex.c:638

Definition at line 604 of file dispex.c.

◆ dispex_data_list

struct list dispex_data_list = LIST_INIT(dispex_data_list)
static

Definition at line 89 of file dispex.c.

◆ lib_ids

lib_id_t lib_ids[]
static
Initial value:
= {
{ &LIBID_MSXML, 2 },
{ &LIBID_MSXML2, 3 }
}

Definition at line 94 of file dispex.c.

Referenced by get_typelib().

◆ tid_ids

tid_id_t tid_ids[]
static

Definition at line 99 of file dispex.c.

◆ typeinfos

ITypeInfo* typeinfos[LAST_tid]
static

Definition at line 91 of file dispex.c.

◆ typelib

ITypeLib* typelib[LibXml_Last]
static

Definition at line 90 of file dispex.c.