d3d11: Implement d3d11_immediate_context_DSGetSamplers().
[wine.git] / dlls / msscript.ocx / msscript.c
blobb0ea1e55a13bc41ff3204eaf21b3448a2b1a37d1
1 /*
2 * Copyright 2015 Jacek Caban for CodeWeavers
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.
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.
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
19 #define COBJMACROS
21 #include "windows.h"
22 #include "initguid.h"
23 #include "ole2.h"
24 #include "olectl.h"
25 #include "objsafe.h"
26 #include "activscp.h"
27 #include "rpcproxy.h"
28 #include "msscript.h"
30 #include "wine/debug.h"
31 #include "wine/list.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(msscript);
35 #ifdef _WIN64
37 #define IActiveScriptParse_Release IActiveScriptParse64_Release
38 #define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
39 #define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
41 #else
43 #define IActiveScriptParse_Release IActiveScriptParse32_Release
44 #define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
45 #define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
47 #endif
49 struct ScriptControl;
50 typedef struct ConnectionPoint ConnectionPoint;
52 struct ConnectionPoint {
53 IConnectionPoint IConnectionPoint_iface;
54 ScriptControl *control;
55 const IID *riid;
56 ConnectionPoint *next;
59 struct named_item {
60 struct list entry;
61 BSTR name;
62 IDispatch *disp;
65 typedef struct ScriptHost {
66 IActiveScriptSite IActiveScriptSite_iface;
67 IActiveScriptSiteWindow IActiveScriptSiteWindow_iface;
68 IServiceProvider IServiceProvider_iface;
69 LONG ref;
71 IActiveScript *script;
72 IActiveScriptParse *parse;
73 CLSID clsid;
75 struct list named_items;
76 } ScriptHost;
78 struct ScriptControl {
79 IScriptControl IScriptControl_iface;
80 IPersistStreamInit IPersistStreamInit_iface;
81 IOleObject IOleObject_iface;
82 IOleControl IOleControl_iface;
83 IQuickActivate IQuickActivate_iface;
84 IViewObjectEx IViewObjectEx_iface;
85 IPointerInactive IPointerInactive_iface;
86 IConnectionPointContainer IConnectionPointContainer_iface;
87 LONG ref;
88 IOleClientSite *site;
89 SIZEL extent;
90 LONG timeout;
92 /* connection points */
93 ConnectionPoint *cp_list;
94 ConnectionPoint cp_scsource;
95 ConnectionPoint cp_propnotif;
97 /* IViewObject sink */
98 IAdviseSink *view_sink;
99 DWORD view_sink_flags;
101 ScriptHost *host;
104 static HINSTANCE msscript_instance;
106 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
108 return HeapAlloc(GetProcessHeap(), 0, len);
111 static inline BOOL heap_free(void *mem)
113 return HeapFree(GetProcessHeap(), 0, mem);
116 typedef enum tid_t {
117 IScriptControl_tid,
118 LAST_tid
119 } tid_t;
121 static ITypeLib *typelib;
122 static ITypeInfo *typeinfos[LAST_tid];
124 static REFIID tid_ids[] = {
125 &IID_IScriptControl
128 static HRESULT load_typelib(void)
130 HRESULT hres;
131 ITypeLib *tl;
133 hres = LoadRegTypeLib(&LIBID_MSScriptControl, 1, 0, LOCALE_SYSTEM_DEFAULT, &tl);
134 if(FAILED(hres)) {
135 ERR("LoadRegTypeLib failed: %08x\n", hres);
136 return hres;
139 if(InterlockedCompareExchangePointer((void**)&typelib, tl, NULL))
140 ITypeLib_Release(tl);
141 return hres;
144 static HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo)
146 HRESULT hres;
148 if (!typelib)
149 hres = load_typelib();
150 if (!typelib)
151 return hres;
153 if(!typeinfos[tid]) {
154 ITypeInfo *ti;
156 hres = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], &ti);
157 if(FAILED(hres)) {
158 ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_ids[tid]), hres);
159 return hres;
162 if(InterlockedCompareExchangePointer((void**)(typeinfos+tid), ti, NULL))
163 ITypeInfo_Release(ti);
166 *typeinfo = typeinfos[tid];
167 ITypeInfo_AddRef(typeinfos[tid]);
168 return S_OK;
171 static void release_typelib(void)
173 unsigned i;
175 if(!typelib)
176 return;
178 for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
179 if(typeinfos[i])
180 ITypeInfo_Release(typeinfos[i]);
182 ITypeLib_Release(typelib);
185 static void clear_named_items(ScriptHost *host)
187 struct named_item *item, *item1;
188 LIST_FOR_EACH_ENTRY_SAFE(item, item1, &host->named_items, struct named_item, entry) {
189 list_remove(&item->entry);
190 SysFreeString(item->name);
191 IDispatch_Release(item->disp);
192 heap_free(item);
196 static struct named_item *host_get_named_item(ScriptHost *host, const WCHAR *nameW)
198 struct named_item *item;
200 LIST_FOR_EACH_ENTRY(item, &host->named_items, struct named_item, entry) {
201 if (!lstrcmpW(item->name, nameW))
202 return item;
205 return NULL;
208 static inline ScriptControl *impl_from_IScriptControl(IScriptControl *iface)
210 return CONTAINING_RECORD(iface, ScriptControl, IScriptControl_iface);
213 static inline ScriptControl *impl_from_IOleObject(IOleObject *iface)
215 return CONTAINING_RECORD(iface, ScriptControl, IOleObject_iface);
218 static inline ScriptControl *impl_from_IPersistStreamInit(IPersistStreamInit *iface)
220 return CONTAINING_RECORD(iface, ScriptControl, IPersistStreamInit_iface);
223 static inline ScriptControl *impl_from_IOleControl(IOleControl *iface)
225 return CONTAINING_RECORD(iface, ScriptControl, IOleControl_iface);
228 static inline ScriptControl *impl_from_IQuickActivate(IQuickActivate *iface)
230 return CONTAINING_RECORD(iface, ScriptControl, IQuickActivate_iface);
233 static inline ScriptControl *impl_from_IViewObjectEx(IViewObjectEx *iface)
235 return CONTAINING_RECORD(iface, ScriptControl, IViewObjectEx_iface);
238 static inline ScriptControl *impl_from_IPointerInactive(IPointerInactive *iface)
240 return CONTAINING_RECORD(iface, ScriptControl, IPointerInactive_iface);
243 static inline ScriptControl *impl_from_IConnectionPointContainer(IConnectionPointContainer *iface)
245 return CONTAINING_RECORD(iface, ScriptControl, IConnectionPointContainer_iface);
248 static inline ConnectionPoint *impl_from_IConnectionPoint(IConnectionPoint *iface)
250 return CONTAINING_RECORD(iface, ConnectionPoint, IConnectionPoint_iface);
253 static inline ScriptHost *impl_from_IActiveScriptSite(IActiveScriptSite *iface)
255 return CONTAINING_RECORD(iface, ScriptHost, IActiveScriptSite_iface);
258 static inline ScriptHost *impl_from_IActiveScriptSiteWindow(IActiveScriptSiteWindow *iface)
260 return CONTAINING_RECORD(iface, ScriptHost, IActiveScriptSiteWindow_iface);
263 static inline ScriptHost *impl_from_IServiceProvider(IServiceProvider *iface)
265 return CONTAINING_RECORD(iface, ScriptHost, IServiceProvider_iface);
268 /* IActiveScriptSite */
269 static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, REFIID riid, void **ppv)
271 ScriptHost *This = impl_from_IActiveScriptSite(iface);
273 if(IsEqualGUID(&IID_IUnknown, riid)) {
274 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
275 *ppv = &This->IActiveScriptSite_iface;
276 }else if(IsEqualGUID(&IID_IActiveScriptSite, riid)) {
277 TRACE("(%p)->(IID_IActiveScriptSite %p)\n", This, ppv);
278 *ppv = &This->IActiveScriptSite_iface;
279 }else if(IsEqualGUID(&IID_IActiveScriptSiteWindow, riid)) {
280 TRACE("(%p)->(IID_IActiveScriptSiteWindow %p)\n", This, ppv);
281 *ppv = &This->IActiveScriptSiteWindow_iface;
282 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
283 TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
284 *ppv = &This->IServiceProvider_iface;
285 }else {
286 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
287 *ppv = NULL;
288 return E_NOINTERFACE;
291 IUnknown_AddRef((IUnknown*)*ppv);
292 return S_OK;
295 static ULONG WINAPI ActiveScriptSite_AddRef(IActiveScriptSite *iface)
297 ScriptHost *This = impl_from_IActiveScriptSite(iface);
298 LONG ref = InterlockedIncrement(&This->ref);
300 TRACE("(%p) ref=%d\n", This, ref);
302 return ref;
305 static void release_script_engine(ScriptHost *host)
307 if (host->script) {
308 IActiveScript_Close(host->script);
309 IActiveScript_Release(host->script);
312 if (host->parse)
313 IActiveScriptParse_Release(host->parse);
315 host->parse = NULL;
316 host->script = NULL;
318 IActiveScriptSite_Release(&host->IActiveScriptSite_iface);
321 static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface)
323 ScriptHost *This = impl_from_IActiveScriptSite(iface);
324 LONG ref = InterlockedDecrement(&This->ref);
326 TRACE("(%p) ref=%d\n", This, ref);
328 if(!ref) {
329 clear_named_items(This);
330 heap_free(This);
333 return ref;
336 static HRESULT WINAPI ActiveScriptSite_GetLCID(IActiveScriptSite *iface, LCID *lcid)
338 ScriptHost *This = impl_from_IActiveScriptSite(iface);
340 TRACE("(%p, %p)\n", This, lcid);
342 *lcid = GetUserDefaultLCID();
343 return S_OK;
346 static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPCOLESTR name, DWORD mask,
347 IUnknown **unk, ITypeInfo **ti)
349 ScriptHost *This = impl_from_IActiveScriptSite(iface);
350 struct named_item *item;
352 TRACE("(%p, %s, %#x, %p, %p)\n", This, debugstr_w(name), mask, unk, ti);
354 item = host_get_named_item(This, name);
355 if (!item)
356 return TYPE_E_ELEMENTNOTFOUND;
358 if (mask != SCRIPTINFO_IUNKNOWN) {
359 FIXME("mask %#x is not supported\n", mask);
360 return E_NOTIMPL;
363 *unk = (IUnknown*)item->disp;
364 IUnknown_AddRef(*unk);
366 return S_OK;
369 static HRESULT WINAPI ActiveScriptSite_GetDocVersionString(IActiveScriptSite *iface, BSTR *version)
371 ScriptHost *This = impl_from_IActiveScriptSite(iface);
373 FIXME("(%p, %p)\n", This, version);
375 return E_NOTIMPL;
378 static HRESULT WINAPI ActiveScriptSite_OnScriptTerminate(IActiveScriptSite *iface, const VARIANT *result,
379 const EXCEPINFO *ei)
381 ScriptHost *This = impl_from_IActiveScriptSite(iface);
383 FIXME("(%p, %s, %p)\n", This, debugstr_variant(result), ei);
385 return E_NOTIMPL;
388 static HRESULT WINAPI ActiveScriptSite_OnStateChange(IActiveScriptSite *iface, SCRIPTSTATE state)
390 ScriptHost *This = impl_from_IActiveScriptSite(iface);
392 FIXME("(%p, %d)\n", This, state);
394 return E_NOTIMPL;
397 static HRESULT WINAPI ActiveScriptSite_OnScriptError(IActiveScriptSite *iface, IActiveScriptError *script_error)
399 ScriptHost *This = impl_from_IActiveScriptSite(iface);
401 FIXME("(%p, %p)\n", This, script_error);
403 return E_NOTIMPL;
406 static HRESULT WINAPI ActiveScriptSite_OnEnterScript(IActiveScriptSite *iface)
408 ScriptHost *This = impl_from_IActiveScriptSite(iface);
410 FIXME("(%p)\n", This);
412 return E_NOTIMPL;
415 static HRESULT WINAPI ActiveScriptSite_OnLeaveScript(IActiveScriptSite *iface)
417 ScriptHost *This = impl_from_IActiveScriptSite(iface);
419 FIXME("(%p)\n", This);
421 return E_NOTIMPL;
424 static const IActiveScriptSiteVtbl ActiveScriptSiteVtbl = {
425 ActiveScriptSite_QueryInterface,
426 ActiveScriptSite_AddRef,
427 ActiveScriptSite_Release,
428 ActiveScriptSite_GetLCID,
429 ActiveScriptSite_GetItemInfo,
430 ActiveScriptSite_GetDocVersionString,
431 ActiveScriptSite_OnScriptTerminate,
432 ActiveScriptSite_OnStateChange,
433 ActiveScriptSite_OnScriptError,
434 ActiveScriptSite_OnEnterScript,
435 ActiveScriptSite_OnLeaveScript
438 /* IActiveScriptSiteWindow */
439 static HRESULT WINAPI ActiveScriptSiteWindow_QueryInterface(IActiveScriptSiteWindow *iface, REFIID riid, void **obj)
441 ScriptHost *This = impl_from_IActiveScriptSiteWindow(iface);
442 return IActiveScriptSite_QueryInterface(&This->IActiveScriptSite_iface, riid, obj);
445 static ULONG WINAPI ActiveScriptSiteWindow_AddRef(IActiveScriptSiteWindow *iface)
447 ScriptHost *This = impl_from_IActiveScriptSiteWindow(iface);
448 return IActiveScriptSite_AddRef(&This->IActiveScriptSite_iface);
451 static ULONG WINAPI ActiveScriptSiteWindow_Release(IActiveScriptSiteWindow *iface)
453 ScriptHost *This = impl_from_IActiveScriptSiteWindow(iface);
454 return IActiveScriptSite_Release(&This->IActiveScriptSite_iface);
457 static HRESULT WINAPI ActiveScriptSiteWindow_GetWindow(IActiveScriptSiteWindow *iface, HWND *hwnd)
459 ScriptHost *This = impl_from_IActiveScriptSiteWindow(iface);
461 FIXME("(%p, %p)\n", This, hwnd);
463 return E_NOTIMPL;
466 static HRESULT WINAPI ActiveScriptSiteWindow_EnableModeless(IActiveScriptSiteWindow *iface, BOOL enable)
468 ScriptHost *This = impl_from_IActiveScriptSiteWindow(iface);
470 FIXME("(%p, %d)\n", This, enable);
472 return E_NOTIMPL;
475 static const IActiveScriptSiteWindowVtbl ActiveScriptSiteWindowVtbl = {
476 ActiveScriptSiteWindow_QueryInterface,
477 ActiveScriptSiteWindow_AddRef,
478 ActiveScriptSiteWindow_Release,
479 ActiveScriptSiteWindow_GetWindow,
480 ActiveScriptSiteWindow_EnableModeless
483 /* IServiceProvider */
484 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **obj)
486 ScriptHost *This = impl_from_IServiceProvider(iface);
487 return IActiveScriptSite_QueryInterface(&This->IActiveScriptSite_iface, riid, obj);
490 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
492 ScriptHost *This = impl_from_IServiceProvider(iface);
493 return IActiveScriptSite_AddRef(&This->IActiveScriptSite_iface);
496 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
498 ScriptHost *This = impl_from_IServiceProvider(iface);
499 return IActiveScriptSite_Release(&This->IActiveScriptSite_iface);
502 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID service,
503 REFIID riid, void **obj)
505 ScriptHost *This = impl_from_IServiceProvider(iface);
507 FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(service), debugstr_guid(riid), obj);
509 return E_NOTIMPL;
512 static const IServiceProviderVtbl ServiceProviderVtbl = {
513 ServiceProvider_QueryInterface,
514 ServiceProvider_AddRef,
515 ServiceProvider_Release,
516 ServiceProvider_QueryService
519 static HRESULT init_script_host(const CLSID *clsid, ScriptHost **ret)
521 IObjectSafety *objsafety;
522 ScriptHost *host;
523 HRESULT hr;
525 *ret = NULL;
527 host = heap_alloc(sizeof(*host));
528 if (!host)
529 return E_OUTOFMEMORY;
531 host->IActiveScriptSite_iface.lpVtbl = &ActiveScriptSiteVtbl;
532 host->IActiveScriptSiteWindow_iface.lpVtbl = &ActiveScriptSiteWindowVtbl;
533 host->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
534 host->ref = 1;
535 host->script = NULL;
536 host->parse = NULL;
537 host->clsid = *clsid;
538 list_init(&host->named_items);
540 hr = CoCreateInstance(&host->clsid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
541 &IID_IActiveScript, (void**)&host->script);
542 if (FAILED(hr)) {
543 WARN("Failed to create an instance for %s, %#x\n", debugstr_guid(clsid), hr);
544 goto failed;
547 hr = IActiveScript_QueryInterface(host->script, &IID_IObjectSafety, (void**)&objsafety);
548 if (FAILED(hr)) {
549 FIXME("Could not get IObjectSafety, %#x\n", hr);
550 goto failed;
553 hr = IObjectSafety_SetInterfaceSafetyOptions(objsafety, &IID_IActiveScriptParse, INTERFACESAFE_FOR_UNTRUSTED_DATA, 0);
554 IObjectSafety_Release(objsafety);
555 if (FAILED(hr)) {
556 FIXME("SetInterfaceSafetyOptions failed, %#x\n", hr);
557 goto failed;
560 hr = IActiveScript_SetScriptSite(host->script, &host->IActiveScriptSite_iface);
561 if (FAILED(hr)) {
562 WARN("SetScriptSite failed, %#x\n", hr);
563 goto failed;
566 hr = IActiveScript_QueryInterface(host->script, &IID_IActiveScriptParse, (void**)&host->parse);
567 if (FAILED(hr)) {
568 WARN("Failed to get IActiveScriptParse, %#x\n", hr);
569 goto failed;
572 hr = IActiveScriptParse_InitNew(host->parse);
573 if (FAILED(hr)) {
574 WARN("InitNew failed, %#x\n", hr);
575 goto failed;
578 *ret = host;
579 return S_OK;
581 failed:
582 release_script_engine(host);
583 return hr;
586 static HRESULT WINAPI ScriptControl_QueryInterface(IScriptControl *iface, REFIID riid, void **ppv)
588 ScriptControl *This = impl_from_IScriptControl(iface);
590 if(IsEqualGUID(&IID_IUnknown, riid)) {
591 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
592 *ppv = &This->IScriptControl_iface;
593 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
594 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
595 *ppv = &This->IScriptControl_iface;
596 }else if(IsEqualGUID(&IID_IScriptControl, riid)) {
597 TRACE("(%p)->(IID_IScriptControl %p)\n", This, ppv);
598 *ppv = &This->IScriptControl_iface;
599 }else if(IsEqualGUID(&IID_IOleObject, riid)) {
600 TRACE("(%p)->(IID_IOleObject %p)\n", This, ppv);
601 *ppv = &This->IOleObject_iface;
602 }else if(IsEqualGUID(&IID_IPersistStreamInit, riid)) {
603 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
604 *ppv = &This->IPersistStreamInit_iface;
605 }else if(IsEqualGUID(&IID_IPersist, riid)) {
606 TRACE("(%p)->(IID_IPersist %p)\n", This, ppv);
607 *ppv = &This->IPersistStreamInit_iface;
608 }else if(IsEqualGUID(&IID_IOleControl, riid)) {
609 TRACE("(%p)->(IID_IOleControl %p)\n", This, ppv);
610 *ppv = &This->IOleControl_iface;
611 }else if(IsEqualGUID(&IID_IQuickActivate, riid)) {
612 TRACE("(%p)->(IID_IQuickActivate %p)\n", This, ppv);
613 *ppv = &This->IQuickActivate_iface;
614 }else if(IsEqualGUID(&IID_IViewObject, riid)) {
615 TRACE("(%p)->(IID_IViewObject %p)\n", This, ppv);
616 *ppv = &This->IViewObjectEx_iface;
617 }else if(IsEqualGUID(&IID_IViewObject2, riid)) {
618 TRACE("(%p)->(IID_IViewObject2 %p)\n", This, ppv);
619 *ppv = &This->IViewObjectEx_iface;
620 }else if(IsEqualGUID(&IID_IViewObjectEx, riid)) {
621 TRACE("(%p)->(IID_IViewObjectEx %p)\n", This, ppv);
622 *ppv = &This->IViewObjectEx_iface;
623 }else if(IsEqualGUID(&IID_IPointerInactive, riid)) {
624 TRACE("(%p)->(IID_IPointerInactive %p)\n", This, ppv);
625 *ppv = &This->IPointerInactive_iface;
626 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
627 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
628 *ppv = &This->IConnectionPointContainer_iface;
629 }else {
630 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
631 *ppv = NULL;
632 return E_NOINTERFACE;
635 IUnknown_AddRef((IUnknown*)*ppv);
636 return S_OK;
639 static ULONG WINAPI ScriptControl_AddRef(IScriptControl *iface)
641 ScriptControl *This = impl_from_IScriptControl(iface);
642 LONG ref = InterlockedIncrement(&This->ref);
644 TRACE("(%p) ref=%d\n", This, ref);
646 return ref;
649 static ULONG WINAPI ScriptControl_Release(IScriptControl *iface)
651 ScriptControl *This = impl_from_IScriptControl(iface);
652 LONG ref = InterlockedDecrement(&This->ref);
654 TRACE("(%p) ref=%d\n", This, ref);
656 if(!ref) {
657 if (This->site)
658 IOleClientSite_Release(This->site);
659 if (This->host)
660 release_script_engine(This->host);
661 heap_free(This);
664 return ref;
667 static HRESULT WINAPI ScriptControl_GetTypeInfoCount(IScriptControl *iface, UINT *pctinfo)
669 ScriptControl *This = impl_from_IScriptControl(iface);
670 TRACE("(%p)->(%p)\n", This, pctinfo);
671 *pctinfo = 1;
672 return S_OK;
675 static HRESULT WINAPI ScriptControl_GetTypeInfo(IScriptControl *iface, UINT iTInfo,
676 LCID lcid, ITypeInfo **ppTInfo)
678 ScriptControl *This = impl_from_IScriptControl(iface);
679 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
680 return get_typeinfo(IScriptControl_tid, ppTInfo);
683 static HRESULT WINAPI ScriptControl_GetIDsOfNames(IScriptControl *iface, REFIID riid,
684 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
686 ScriptControl *This = impl_from_IScriptControl(iface);
687 ITypeInfo *typeinfo;
688 HRESULT hres;
690 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
692 hres = get_typeinfo(IScriptControl_tid, &typeinfo);
693 if(SUCCEEDED(hres)) {
694 hres = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
695 ITypeInfo_Release(typeinfo);
698 return hres;
701 static HRESULT WINAPI ScriptControl_Invoke(IScriptControl *iface, DISPID dispIdMember,
702 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
703 EXCEPINFO *pExcepInfo, UINT *puArgErr)
705 ScriptControl *This = impl_from_IScriptControl(iface);
706 ITypeInfo *typeinfo;
707 HRESULT hres;
709 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
710 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
712 hres = get_typeinfo(IScriptControl_tid, &typeinfo);
713 if(SUCCEEDED(hres)) {
714 hres = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags,
715 pDispParams, pVarResult, pExcepInfo, puArgErr);
716 ITypeInfo_Release(typeinfo);
719 return hres;
722 static HRESULT WINAPI ScriptControl_get_Language(IScriptControl *iface, BSTR *p)
724 ScriptControl *This = impl_from_IScriptControl(iface);
725 LPOLESTR progidW;
726 HRESULT hr;
728 TRACE("(%p)->(%p)\n", This, p);
730 if (!p)
731 return E_POINTER;
733 *p = NULL;
735 if (!This->host)
736 return S_OK;
738 hr = ProgIDFromCLSID(&This->host->clsid, &progidW);
739 if (FAILED(hr))
740 return hr;
742 *p = SysAllocString(progidW);
743 CoTaskMemFree(progidW);
744 return *p ? S_OK : E_OUTOFMEMORY;
747 static HRESULT WINAPI ScriptControl_put_Language(IScriptControl *iface, BSTR language)
749 ScriptControl *This = impl_from_IScriptControl(iface);
750 CLSID clsid;
752 TRACE("(%p)->(%s)\n", This, debugstr_w(language));
754 if (language && FAILED(CLSIDFromProgID(language, &clsid)))
755 return CTL_E_INVALIDPROPERTYVALUE;
757 if (This->host) {
758 release_script_engine(This->host);
759 This->host = NULL;
762 if (!language)
763 return S_OK;
765 return init_script_host(&clsid, &This->host);
768 static HRESULT WINAPI ScriptControl_get_State(IScriptControl *iface, ScriptControlStates *p)
770 ScriptControl *This = impl_from_IScriptControl(iface);
771 FIXME("(%p)->(%p)\n", This, p);
772 return E_NOTIMPL;
775 static HRESULT WINAPI ScriptControl_put_State(IScriptControl *iface, ScriptControlStates state)
777 ScriptControl *This = impl_from_IScriptControl(iface);
778 FIXME("(%p)->(%x)\n", This, state);
779 return E_NOTIMPL;
782 static HRESULT WINAPI ScriptControl_put_SitehWnd(IScriptControl *iface, LONG hwnd)
784 ScriptControl *This = impl_from_IScriptControl(iface);
785 FIXME("(%p)->(%x)\n", This, hwnd);
786 return E_NOTIMPL;
789 static HRESULT WINAPI ScriptControl_get_SitehWnd(IScriptControl *iface, LONG *p)
791 ScriptControl *This = impl_from_IScriptControl(iface);
792 FIXME("(%p)->(%p)\n", This, p);
793 return E_NOTIMPL;
796 static HRESULT WINAPI ScriptControl_get_Timeout(IScriptControl *iface, LONG *p)
798 ScriptControl *This = impl_from_IScriptControl(iface);
800 TRACE("(%p)->(%p)\n", This, p);
802 if (!p)
803 return E_POINTER;
805 *p = This->timeout;
806 return S_OK;
809 static HRESULT WINAPI ScriptControl_put_Timeout(IScriptControl *iface, LONG timeout)
811 ScriptControl *This = impl_from_IScriptControl(iface);
813 TRACE("(%p)->(%d)\n", This, timeout);
815 if (timeout < -1)
816 return CTL_E_INVALIDPROPERTYVALUE;
818 if (timeout != -1)
819 FIXME("execution timeout ignored\n");
821 This->timeout = timeout;
822 return S_OK;
825 static HRESULT WINAPI ScriptControl_get_AllowUI(IScriptControl *iface, VARIANT_BOOL *p)
827 ScriptControl *This = impl_from_IScriptControl(iface);
828 FIXME("(%p)->(%p)\n", This, p);
829 return E_NOTIMPL;
832 static HRESULT WINAPI ScriptControl_put_AllowUI(IScriptControl *iface, VARIANT_BOOL allow_ui)
834 ScriptControl *This = impl_from_IScriptControl(iface);
835 FIXME("(%p)->(%x)\n", This, allow_ui);
836 return E_NOTIMPL;
839 static HRESULT WINAPI ScriptControl_get_UseSafeSubset(IScriptControl *iface, VARIANT_BOOL *p)
841 ScriptControl *This = impl_from_IScriptControl(iface);
842 FIXME("(%p)->(%p)\n", This, p);
843 return E_NOTIMPL;
846 static HRESULT WINAPI ScriptControl_put_UseSafeSubset(IScriptControl *iface, VARIANT_BOOL v)
848 ScriptControl *This = impl_from_IScriptControl(iface);
849 FIXME("(%p)->(%x)\n", This, v);
850 return E_NOTIMPL;
853 static HRESULT WINAPI ScriptControl_get_Modules(IScriptControl *iface, IScriptModuleCollection **p)
855 ScriptControl *This = impl_from_IScriptControl(iface);
856 FIXME("(%p)->(%p)\n", This, p);
857 return E_NOTIMPL;
860 static HRESULT WINAPI ScriptControl_get_Error(IScriptControl *iface, IScriptError **p)
862 ScriptControl *This = impl_from_IScriptControl(iface);
863 FIXME("(%p)->(%p)\n", This, p);
864 return E_NOTIMPL;
867 static HRESULT WINAPI ScriptControl_get_CodeObject(IScriptControl *iface, IDispatch **p)
869 ScriptControl *This = impl_from_IScriptControl(iface);
870 FIXME("(%p)->(%p)\n", This, p);
871 return E_NOTIMPL;
874 static HRESULT WINAPI ScriptControl_get_Procedures(IScriptControl *iface, IScriptProcedureCollection **p)
876 ScriptControl *This = impl_from_IScriptControl(iface);
877 FIXME("(%p)->(%p)\n", This, p);
878 return E_NOTIMPL;
881 static HRESULT WINAPI ScriptControl__AboutBox(IScriptControl *iface)
883 ScriptControl *This = impl_from_IScriptControl(iface);
884 FIXME("(%p)\n", This);
885 return E_NOTIMPL;
888 static HRESULT WINAPI ScriptControl_AddObject(IScriptControl *iface, BSTR name, IDispatch *object, VARIANT_BOOL add_members)
890 ScriptControl *This = impl_from_IScriptControl(iface);
891 DWORD flags = SCRIPTITEM_ISVISIBLE | SCRIPTITEM_ISSOURCE;
892 struct named_item *item;
893 HRESULT hr;
895 TRACE("(%p)->(%s %p %x)\n", This, debugstr_w(name), object, add_members);
897 if (!object)
898 return E_INVALIDARG;
900 if (!This->host)
901 return E_FAIL;
903 if (host_get_named_item(This->host, name))
904 return E_INVALIDARG;
906 item = heap_alloc(sizeof(*item));
907 if (!item)
908 return E_OUTOFMEMORY;
910 item->name = SysAllocString(name);
911 IDispatch_AddRef(item->disp = object);
912 list_add_tail(&This->host->named_items, &item->entry);
914 if (add_members)
915 flags |= SCRIPTITEM_GLOBALMEMBERS;
916 hr = IActiveScript_AddNamedItem(This->host->script, name, flags);
917 if (FAILED(hr)) {
918 list_remove(&item->entry);
919 IDispatch_Release(item->disp);
920 SysFreeString(item->name);
921 heap_free(item);
922 return hr;
926 return hr;
929 static HRESULT WINAPI ScriptControl_Reset(IScriptControl *iface)
931 ScriptControl *This = impl_from_IScriptControl(iface);
933 TRACE("(%p)\n", This);
935 if (!This->host)
936 return E_FAIL;
938 clear_named_items(This->host);
939 return IActiveScript_SetScriptState(This->host->script, SCRIPTSTATE_INITIALIZED);
942 static HRESULT WINAPI ScriptControl_AddCode(IScriptControl *iface, BSTR code)
944 ScriptControl *This = impl_from_IScriptControl(iface);
945 FIXME("(%p)->(%s)\n", This, debugstr_w(code));
946 return E_NOTIMPL;
949 static HRESULT WINAPI ScriptControl_Eval(IScriptControl *iface, BSTR expression, VARIANT *res)
951 ScriptControl *This = impl_from_IScriptControl(iface);
952 FIXME("(%p)->(%s %p)\n", This, debugstr_w(expression), res);
953 return E_NOTIMPL;
956 static HRESULT WINAPI ScriptControl_ExecuteStatement(IScriptControl *iface, BSTR statement)
958 ScriptControl *This = impl_from_IScriptControl(iface);
959 FIXME("(%p)->(%s)\n", This, debugstr_w(statement));
960 return E_NOTIMPL;
963 static HRESULT WINAPI ScriptControl_Run(IScriptControl *iface, BSTR procedure_name, SAFEARRAY **parameters, VARIANT *res)
965 ScriptControl *This = impl_from_IScriptControl(iface);
966 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(procedure_name), parameters, res);
967 return E_NOTIMPL;
970 static const IScriptControlVtbl ScriptControlVtbl = {
971 ScriptControl_QueryInterface,
972 ScriptControl_AddRef,
973 ScriptControl_Release,
974 ScriptControl_GetTypeInfoCount,
975 ScriptControl_GetTypeInfo,
976 ScriptControl_GetIDsOfNames,
977 ScriptControl_Invoke,
978 ScriptControl_get_Language,
979 ScriptControl_put_Language,
980 ScriptControl_get_State,
981 ScriptControl_put_State,
982 ScriptControl_put_SitehWnd,
983 ScriptControl_get_SitehWnd,
984 ScriptControl_get_Timeout,
985 ScriptControl_put_Timeout,
986 ScriptControl_get_AllowUI,
987 ScriptControl_put_AllowUI,
988 ScriptControl_get_UseSafeSubset,
989 ScriptControl_put_UseSafeSubset,
990 ScriptControl_get_Modules,
991 ScriptControl_get_Error,
992 ScriptControl_get_CodeObject,
993 ScriptControl_get_Procedures,
994 ScriptControl__AboutBox,
995 ScriptControl_AddObject,
996 ScriptControl_Reset,
997 ScriptControl_AddCode,
998 ScriptControl_Eval,
999 ScriptControl_ExecuteStatement,
1000 ScriptControl_Run
1003 static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **obj)
1005 ScriptControl *This = impl_from_IOleObject(iface);
1006 return IScriptControl_QueryInterface(&This->IScriptControl_iface, riid, obj);
1009 static ULONG WINAPI OleObject_AddRef(IOleObject *iface)
1011 ScriptControl *This = impl_from_IOleObject(iface);
1012 return IScriptControl_AddRef(&This->IScriptControl_iface);
1015 static ULONG WINAPI OleObject_Release(IOleObject *iface)
1017 ScriptControl *This = impl_from_IOleObject(iface);
1018 return IScriptControl_Release(&This->IScriptControl_iface);
1021 static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *site)
1023 ScriptControl *This = impl_from_IOleObject(iface);
1025 TRACE("(%p)->(%p)\n", This, site);
1027 if (This->site)
1028 IOleClientSite_Release(This->site);
1030 if ((This->site = site))
1031 IOleClientSite_AddRef(site);
1033 return S_OK;
1036 static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, IOleClientSite **site)
1038 ScriptControl *This = impl_from_IOleObject(iface);
1040 TRACE("(%p)->(%p)\n", This, site);
1042 if (!site)
1043 return E_POINTER;
1045 if ((*site = This->site))
1046 IOleClientSite_AddRef(*site);
1048 return S_OK;
1051 static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR containerapp, LPCOLESTR containerobj)
1053 ScriptControl *This = impl_from_IOleObject(iface);
1055 FIXME("(%p)->(%s %s)\n", This, debugstr_w(containerapp), debugstr_w(containerobj));
1057 return E_NOTIMPL;
1060 static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD save)
1062 ScriptControl *This = impl_from_IOleObject(iface);
1064 FIXME("(%p)->(%d)\n", This, save);
1066 return E_NOTIMPL;
1069 static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD which, IMoniker *moniker)
1071 ScriptControl *This = impl_from_IOleObject(iface);
1073 FIXME("(%p)->(%d %p)\n", This, which, moniker);
1075 return E_NOTIMPL;
1078 static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD assign, DWORD which, IMoniker **moniker)
1080 ScriptControl *This = impl_from_IOleObject(iface);
1082 FIXME("(%p)->(%d %d %p)\n", This, assign, which, moniker);
1084 return E_NOTIMPL;
1087 static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, IDataObject *dataobj, BOOL creation,
1088 DWORD reserved)
1090 ScriptControl *This = impl_from_IOleObject(iface);
1092 FIXME("(%p)->(%p %d %d)\n", This, dataobj, creation, reserved);
1094 return E_NOTIMPL;
1097 static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD reserved, IDataObject **dataobj)
1099 ScriptControl *This = impl_from_IOleObject(iface);
1101 FIXME("(%p)->(%d %p)\n", This, reserved, dataobj);
1103 return E_NOTIMPL;
1106 static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG verb, LPMSG msg, IOleClientSite *active_site,
1107 LONG index, HWND hwndParent, LPCRECT rect)
1109 ScriptControl *This = impl_from_IOleObject(iface);
1111 FIXME("(%p)->(%d %p %p %d %p %p)\n", This, verb, msg, active_site, index, hwndParent, rect);
1113 return E_NOTIMPL;
1116 static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **enumoleverb)
1118 ScriptControl *This = impl_from_IOleObject(iface);
1120 FIXME("(%p)->(%p)\n", This, enumoleverb);
1122 return E_NOTIMPL;
1125 static HRESULT WINAPI OleObject_Update(IOleObject *iface)
1127 ScriptControl *This = impl_from_IOleObject(iface);
1129 FIXME("(%p)\n", This);
1131 return E_NOTIMPL;
1134 static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface)
1136 ScriptControl *This = impl_from_IOleObject(iface);
1138 FIXME("(%p)\n", This);
1140 return E_NOTIMPL;
1143 static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID *clsid)
1145 ScriptControl *This = impl_from_IOleObject(iface);
1147 FIXME("(%p)->(%p)\n", This, clsid);
1149 return E_NOTIMPL;
1152 static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD form_of_type, LPOLESTR *usertype)
1154 ScriptControl *This = impl_from_IOleObject(iface);
1156 FIXME("(%p)->(%d %p)\n", This, form_of_type, usertype);
1158 return E_NOTIMPL;
1161 static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD aspect, SIZEL *size)
1163 ScriptControl *This = impl_from_IOleObject(iface);
1165 FIXME("(%p)->(%d %p)\n", This, aspect, size);
1167 return E_NOTIMPL;
1170 static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD aspect, SIZEL *size)
1172 ScriptControl *This = impl_from_IOleObject(iface);
1174 TRACE("(%p)->(%d %p)\n", This, aspect, size);
1176 if (aspect != DVASPECT_CONTENT)
1177 return DV_E_DVASPECT;
1179 *size = This->extent;
1180 return S_OK;
1183 static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *sink, DWORD *connection)
1185 ScriptControl *This = impl_from_IOleObject(iface);
1187 FIXME("(%p)->(%p %p)\n", This, sink, connection);
1189 return E_NOTIMPL;
1192 static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD connection)
1194 ScriptControl *This = impl_from_IOleObject(iface);
1196 FIXME("(%p)->(%d)\n", This, connection);
1198 return E_NOTIMPL;
1201 static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **enumadvise)
1203 ScriptControl *This = impl_from_IOleObject(iface);
1205 FIXME("(%p)->(%p)\n", This, enumadvise);
1207 return E_NOTIMPL;
1210 static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD aspect, DWORD *status)
1212 ScriptControl *This = impl_from_IOleObject(iface);
1214 TRACE("(%p)->(%d %p)\n", This, aspect, status);
1216 return OleRegGetMiscStatus(&CLSID_ScriptControl, aspect, status);
1219 static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE *logpal)
1221 ScriptControl *This = impl_from_IOleObject(iface);
1223 FIXME("(%p)->(%p)\n", This, logpal);
1225 return E_NOTIMPL;
1228 static const IOleObjectVtbl OleObjectVtbl = {
1229 OleObject_QueryInterface,
1230 OleObject_AddRef,
1231 OleObject_Release,
1232 OleObject_SetClientSite,
1233 OleObject_GetClientSite,
1234 OleObject_SetHostNames,
1235 OleObject_Close,
1236 OleObject_SetMoniker,
1237 OleObject_GetMoniker,
1238 OleObject_InitFromData,
1239 OleObject_GetClipboardData,
1240 OleObject_DoVerb,
1241 OleObject_EnumVerbs,
1242 OleObject_Update,
1243 OleObject_IsUpToDate,
1244 OleObject_GetUserClassID,
1245 OleObject_GetUserType,
1246 OleObject_SetExtent,
1247 OleObject_GetExtent,
1248 OleObject_Advise,
1249 OleObject_Unadvise,
1250 OleObject_EnumAdvise,
1251 OleObject_GetMiscStatus,
1252 OleObject_SetColorScheme
1255 static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface, REFIID riid, void **obj)
1257 ScriptControl *This = impl_from_IPersistStreamInit(iface);
1258 return IScriptControl_QueryInterface(&This->IScriptControl_iface, riid, obj);
1261 static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface)
1263 ScriptControl *This = impl_from_IPersistStreamInit(iface);
1264 return IScriptControl_AddRef(&This->IScriptControl_iface);
1267 static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface)
1269 ScriptControl *This = impl_from_IPersistStreamInit(iface);
1270 return IScriptControl_Release(&This->IScriptControl_iface);
1273 static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *clsid)
1275 ScriptControl *This = impl_from_IPersistStreamInit(iface);
1277 FIXME("(%p)->(%p)\n", This, clsid);
1279 return E_NOTIMPL;
1282 static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
1284 ScriptControl *This = impl_from_IPersistStreamInit(iface);
1286 FIXME("(%p)\n", This);
1288 return E_NOTIMPL;
1291 static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, IStream *stream)
1293 ScriptControl *This = impl_from_IPersistStreamInit(iface);
1295 FIXME("(%p)->(%p)\n", This, stream);
1297 return E_NOTIMPL;
1300 static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, IStream *stream, BOOL clear_dirty)
1302 ScriptControl *This = impl_from_IPersistStreamInit(iface);
1304 FIXME("(%p)->(%p %d)\n", This, stream, clear_dirty);
1306 return E_NOTIMPL;
1309 static HRESULT WINAPI PersistStreamInit_GetSizeMax(IPersistStreamInit *iface, ULARGE_INTEGER *size)
1311 ScriptControl *This = impl_from_IPersistStreamInit(iface);
1313 FIXME("(%p)->(%p)\n", This, size);
1315 return E_NOTIMPL;
1318 static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
1320 ScriptControl *This = impl_from_IPersistStreamInit(iface);
1322 FIXME("(%p)\n", This);
1324 return S_OK;
1327 static const IPersistStreamInitVtbl PersistStreamInitVtbl = {
1328 PersistStreamInit_QueryInterface,
1329 PersistStreamInit_AddRef,
1330 PersistStreamInit_Release,
1331 PersistStreamInit_GetClassID,
1332 PersistStreamInit_IsDirty,
1333 PersistStreamInit_Load,
1334 PersistStreamInit_Save,
1335 PersistStreamInit_GetSizeMax,
1336 PersistStreamInit_InitNew
1339 static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface, REFIID riid, void **obj)
1341 ScriptControl *This = impl_from_IOleControl(iface);
1342 return IScriptControl_QueryInterface(&This->IScriptControl_iface, riid, obj);
1345 static ULONG WINAPI OleControl_AddRef(IOleControl *iface)
1347 ScriptControl *This = impl_from_IOleControl(iface);
1348 return IScriptControl_AddRef(&This->IScriptControl_iface);
1351 static ULONG WINAPI OleControl_Release(IOleControl *iface)
1353 ScriptControl *This = impl_from_IOleControl(iface);
1354 return IScriptControl_Release(&This->IScriptControl_iface);
1357 static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, CONTROLINFO *info)
1359 ScriptControl *This = impl_from_IOleControl(iface);
1361 TRACE("(%p)->(%p)\n", This, info);
1363 if (!info)
1364 return E_POINTER;
1366 info->hAccel = NULL;
1367 info->cAccel = 0;
1369 return S_OK;
1372 static HRESULT WINAPI OleControl_OnMnemonic(IOleControl *iface, MSG *msg)
1374 ScriptControl *This = impl_from_IOleControl(iface);
1376 FIXME("(%p)->(%p)\n", This, msg);
1378 return E_NOTIMPL;
1381 static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispid)
1383 ScriptControl *This = impl_from_IOleControl(iface);
1385 FIXME("(%p)->(%#x)\n", This, dispid);
1387 return E_NOTIMPL;
1390 static HRESULT WINAPI OleControl_FreezeEvents(IOleControl *iface, BOOL freeze)
1392 ScriptControl *This = impl_from_IOleControl(iface);
1394 FIXME("(%p)->(%d)\n", This, freeze);
1396 return E_NOTIMPL;
1399 static const IOleControlVtbl OleControlVtbl = {
1400 OleControl_QueryInterface,
1401 OleControl_AddRef,
1402 OleControl_Release,
1403 OleControl_GetControlInfo,
1404 OleControl_OnMnemonic,
1405 OleControl_OnAmbientPropertyChange,
1406 OleControl_FreezeEvents
1409 static HRESULT WINAPI QuickActivate_QueryInterface(IQuickActivate *iface, REFIID riid, void **obj)
1411 ScriptControl *This = impl_from_IQuickActivate(iface);
1412 return IScriptControl_QueryInterface(&This->IScriptControl_iface, riid, obj);
1415 static ULONG WINAPI QuickActivate_AddRef(IQuickActivate *iface)
1417 ScriptControl *This = impl_from_IQuickActivate(iface);
1418 return IScriptControl_AddRef(&This->IScriptControl_iface);
1421 static ULONG WINAPI QuickActivate_Release(IQuickActivate *iface)
1423 ScriptControl *This = impl_from_IQuickActivate(iface);
1424 return IScriptControl_Release(&This->IScriptControl_iface);
1427 static HRESULT WINAPI QuickActivate_QuickActivate(IQuickActivate *iface, QACONTAINER *container, QACONTROL *control)
1429 ScriptControl *This = impl_from_IQuickActivate(iface);
1431 FIXME("(%p)->(%p %p)\n", This, container, control);
1433 return E_NOTIMPL;
1436 static HRESULT WINAPI QuickActivate_SetContentExtent(IQuickActivate *iface, SIZEL *size)
1438 ScriptControl *This = impl_from_IQuickActivate(iface);
1440 FIXME("(%p)->(%p)\n", This, size);
1442 return E_NOTIMPL;
1445 static HRESULT WINAPI QuickActivate_GetContentExtent(IQuickActivate *iface, SIZEL *size)
1447 ScriptControl *This = impl_from_IQuickActivate(iface);
1449 FIXME("(%p)->(%p)\n", This, size);
1451 return E_NOTIMPL;
1454 static const IQuickActivateVtbl QuickActivateVtbl = {
1455 QuickActivate_QueryInterface,
1456 QuickActivate_AddRef,
1457 QuickActivate_Release,
1458 QuickActivate_QuickActivate,
1459 QuickActivate_SetContentExtent,
1460 QuickActivate_GetContentExtent
1463 static HRESULT WINAPI ViewObject_QueryInterface(IViewObjectEx *iface, REFIID riid, void **obj)
1465 ScriptControl *This = impl_from_IViewObjectEx(iface);
1466 return IScriptControl_QueryInterface(&This->IScriptControl_iface, riid, obj);
1469 static ULONG WINAPI ViewObject_AddRef(IViewObjectEx *iface)
1471 ScriptControl *This = impl_from_IViewObjectEx(iface);
1472 return IScriptControl_AddRef(&This->IScriptControl_iface);
1475 static ULONG WINAPI ViewObject_Release(IViewObjectEx *iface)
1477 ScriptControl *This = impl_from_IViewObjectEx(iface);
1478 return IScriptControl_Release(&This->IScriptControl_iface);
1481 static HRESULT WINAPI ViewObject_Draw(IViewObjectEx *iface, DWORD drawaspect, LONG index, void *aspect,
1482 DVTARGETDEVICE *device, HDC target_dev, HDC hdc_draw, const RECTL *bounds, const RECTL *win_bounds,
1483 BOOL (STDMETHODCALLTYPE *fn_continue)(ULONG_PTR cont), ULONG_PTR cont)
1485 ScriptControl *This = impl_from_IViewObjectEx(iface);
1487 FIXME("(%p)->(%d %d %p %p %p %p %p %p %p %lu)\n", This, drawaspect, index, aspect, device, target_dev,
1488 hdc_draw, bounds, win_bounds, fn_continue, cont);
1490 return E_NOTIMPL;
1493 static HRESULT WINAPI ViewObject_GetColorSet(IViewObjectEx *iface, DWORD drawaspect, LONG index, void *aspect,
1494 DVTARGETDEVICE *device, HDC hic_target, LOGPALETTE **colorset)
1496 ScriptControl *This = impl_from_IViewObjectEx(iface);
1498 FIXME("(%p)->(%d %d %p %p %p %p)\n", This, drawaspect, index, aspect, device, hic_target,
1499 colorset);
1501 return E_NOTIMPL;
1504 static HRESULT WINAPI ViewObject_Freeze(IViewObjectEx *iface, DWORD drawaspect, LONG index, void *aspect,
1505 DWORD *freeze)
1507 ScriptControl *This = impl_from_IViewObjectEx(iface);
1509 FIXME("(%p)->(%d %d %p %p)\n", This, drawaspect, index, aspect, freeze);
1511 return E_NOTIMPL;
1514 static HRESULT WINAPI ViewObject_Unfreeze(IViewObjectEx *iface, DWORD freeze)
1516 ScriptControl *This = impl_from_IViewObjectEx(iface);
1518 FIXME("(%p)->(%d)\n", This, freeze);
1520 return E_NOTIMPL;
1523 static HRESULT WINAPI ViewObject_SetAdvise(IViewObjectEx *iface, DWORD aspects, DWORD flags, IAdviseSink *sink)
1525 ScriptControl *This = impl_from_IViewObjectEx(iface);
1527 TRACE("(%p)->(%d %#x %p)\n", This, aspects, flags, sink);
1529 if (aspects != DVASPECT_CONTENT)
1530 return DV_E_DVASPECT;
1532 This->view_sink_flags = flags;
1533 if (This->view_sink)
1534 IAdviseSink_Release(This->view_sink);
1535 This->view_sink = sink;
1536 if (This->view_sink)
1537 IAdviseSink_AddRef(This->view_sink);
1539 return S_OK;
1542 static HRESULT WINAPI ViewObject_GetAdvise(IViewObjectEx *iface, DWORD *aspects, DWORD *flags, IAdviseSink **sink)
1544 ScriptControl *This = impl_from_IViewObjectEx(iface);
1546 TRACE("(%p)->(%p %p %p)\n", This, aspects, flags, sink);
1548 if (aspects)
1549 *aspects = DVASPECT_CONTENT;
1550 if (flags)
1551 *flags = This->view_sink_flags;
1552 if (sink) {
1553 *sink = This->view_sink;
1554 if (*sink)
1555 IAdviseSink_AddRef(*sink);
1558 return S_OK;
1561 static HRESULT WINAPI ViewObject_GetExtent(IViewObjectEx *iface, DWORD draw_aspect, LONG index,
1562 DVTARGETDEVICE *device, SIZEL *size)
1564 ScriptControl *This = impl_from_IViewObjectEx(iface);
1566 FIXME("(%p)->(%d %d %p %p)\n", This, draw_aspect, index, device, size);
1568 return E_NOTIMPL;
1571 static HRESULT WINAPI ViewObject_GetRect(IViewObjectEx *iface, DWORD aspect, RECTL *rect)
1573 ScriptControl *This = impl_from_IViewObjectEx(iface);
1575 FIXME("(%p)->(%d %p)\n", This, aspect, rect);
1577 return E_NOTIMPL;
1580 static HRESULT WINAPI ViewObject_GetViewStatus(IViewObjectEx *iface, DWORD *status)
1582 ScriptControl *This = impl_from_IViewObjectEx(iface);
1584 TRACE("(%p)->(%p)\n", This, status);
1586 *status = VIEWSTATUS_OPAQUE;
1587 return S_OK;
1590 static HRESULT WINAPI ViewObject_QueryHitPoint(IViewObjectEx *iface, DWORD aspect, const RECT *bounds,
1591 POINT pt, LONG close_hint, DWORD *hit_result)
1593 ScriptControl *This = impl_from_IViewObjectEx(iface);
1595 FIXME("(%p)->(%d %s %s %d %p)\n", This, aspect, wine_dbgstr_rect(bounds), wine_dbgstr_point(&pt), close_hint, hit_result);
1597 return E_NOTIMPL;
1600 static HRESULT WINAPI ViewObject_QueryHitRect(IViewObjectEx *iface, DWORD aspect, const RECT *bounds,
1601 const RECT *loc, LONG close_hint, DWORD *hit_result)
1603 ScriptControl *This = impl_from_IViewObjectEx(iface);
1605 FIXME("(%p)->(%d %s %s %d %p)\n", This, aspect, wine_dbgstr_rect(bounds), wine_dbgstr_rect(loc), close_hint, hit_result);
1607 return E_NOTIMPL;
1610 static HRESULT WINAPI ViewObject_GetNaturalExtent(IViewObjectEx *iface, DWORD aspect, LONG index,
1611 DVTARGETDEVICE *device, HDC target_hdc, DVEXTENTINFO *extent_info, SIZEL *size)
1613 ScriptControl *This = impl_from_IViewObjectEx(iface);
1615 FIXME("(%p)->(%d %d %p %p %p %p)\n", This, aspect, index, device, target_hdc, extent_info, size);
1617 return E_NOTIMPL;
1620 static const IViewObjectExVtbl ViewObjectExVtbl = {
1621 ViewObject_QueryInterface,
1622 ViewObject_AddRef,
1623 ViewObject_Release,
1624 ViewObject_Draw,
1625 ViewObject_GetColorSet,
1626 ViewObject_Freeze,
1627 ViewObject_Unfreeze,
1628 ViewObject_SetAdvise,
1629 ViewObject_GetAdvise,
1630 ViewObject_GetExtent,
1631 ViewObject_GetRect,
1632 ViewObject_GetViewStatus,
1633 ViewObject_QueryHitPoint,
1634 ViewObject_QueryHitRect,
1635 ViewObject_GetNaturalExtent
1638 static HRESULT WINAPI PointerInactive_QueryInterface(IPointerInactive *iface, REFIID riid, void **obj)
1640 ScriptControl *This = impl_from_IPointerInactive(iface);
1641 return IScriptControl_QueryInterface(&This->IScriptControl_iface, riid, obj);
1644 static ULONG WINAPI PointerInactive_AddRef(IPointerInactive *iface)
1646 ScriptControl *This = impl_from_IPointerInactive(iface);
1647 return IScriptControl_AddRef(&This->IScriptControl_iface);
1650 static ULONG WINAPI PointerInactive_Release(IPointerInactive *iface)
1652 ScriptControl *This = impl_from_IPointerInactive(iface);
1653 return IScriptControl_Release(&This->IScriptControl_iface);
1656 static HRESULT WINAPI PointerInactive_GetActivationPolicy(IPointerInactive *iface, DWORD *policy)
1658 ScriptControl *This = impl_from_IPointerInactive(iface);
1660 TRACE("(%p)->(%p)\n", This, policy);
1662 if (!policy)
1663 return E_POINTER;
1665 *policy = 0;
1666 return S_OK;
1669 static HRESULT WINAPI PointerInactive_OnInactiveMouseMove(IPointerInactive *iface, const RECT *bounds,
1670 LONG x, LONG y, DWORD key_state)
1672 ScriptControl *This = impl_from_IPointerInactive(iface);
1674 FIXME("(%p)->(%s %d %d %#x)\n", This, wine_dbgstr_rect(bounds), x, y, key_state);
1676 return E_NOTIMPL;
1679 static HRESULT WINAPI PointerInactive_OnInactiveSetCursor(IPointerInactive *iface, const RECT *bounds,
1680 LONG x, LONG y, DWORD msg, BOOL set_always)
1682 ScriptControl *This = impl_from_IPointerInactive(iface);
1684 FIXME("(%p)->(%s %d %d %#x %d)\n", This, wine_dbgstr_rect(bounds), x, y, msg, set_always);
1686 return E_NOTIMPL;
1689 static const IPointerInactiveVtbl PointerInactiveVtbl = {
1690 PointerInactive_QueryInterface,
1691 PointerInactive_AddRef,
1692 PointerInactive_Release,
1693 PointerInactive_GetActivationPolicy,
1694 PointerInactive_OnInactiveMouseMove,
1695 PointerInactive_OnInactiveSetCursor
1698 static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface, REFIID riid, void **obj)
1700 ScriptControl *This = impl_from_IConnectionPointContainer(iface);
1701 return IScriptControl_QueryInterface(&This->IScriptControl_iface, riid, obj);
1704 static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
1706 ScriptControl *This = impl_from_IConnectionPointContainer(iface);
1707 return IScriptControl_AddRef(&This->IScriptControl_iface);
1710 static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
1712 ScriptControl *This = impl_from_IConnectionPointContainer(iface);
1713 return IScriptControl_Release(&This->IScriptControl_iface);
1716 static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface, IEnumConnectionPoints **enum_points)
1718 ScriptControl *This = impl_from_IConnectionPointContainer(iface);
1720 FIXME("(%p)->(%p)\n", This, enum_points);
1722 return E_NOTIMPL;
1725 static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface, REFIID riid, IConnectionPoint **cp)
1727 ScriptControl *This = impl_from_IConnectionPointContainer(iface);
1728 ConnectionPoint *iter;
1730 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), cp);
1732 *cp = NULL;
1734 for (iter = This->cp_list; iter; iter = iter->next) {
1735 if (IsEqualIID(iter->riid, riid))
1736 *cp = &iter->IConnectionPoint_iface;
1739 if (*cp) {
1740 IConnectionPoint_AddRef(*cp);
1741 return S_OK;
1744 FIXME("unsupported connection point %s\n", debugstr_guid(riid));
1745 return CONNECT_E_NOCONNECTION;
1748 static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = {
1749 ConnectionPointContainer_QueryInterface,
1750 ConnectionPointContainer_AddRef,
1751 ConnectionPointContainer_Release,
1752 ConnectionPointContainer_EnumConnectionPoints,
1753 ConnectionPointContainer_FindConnectionPoint
1756 static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface,
1757 REFIID riid, void **ppv)
1759 ConnectionPoint *This = impl_from_IConnectionPoint(iface);
1761 if(IsEqualGUID(&IID_IUnknown, riid)) {
1762 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1763 *ppv = &This->IConnectionPoint_iface;
1764 }else if(IsEqualGUID(&IID_IConnectionPoint, riid)) {
1765 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1766 *ppv = &This->IConnectionPoint_iface;
1767 }else {
1768 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
1769 *ppv = NULL;
1770 return E_NOINTERFACE;
1773 IUnknown_AddRef((IUnknown*)*ppv);
1774 return S_OK;
1777 static ULONG WINAPI ConnectionPoint_AddRef(IConnectionPoint *iface)
1779 ConnectionPoint *This = impl_from_IConnectionPoint(iface);
1780 return IConnectionPointContainer_AddRef(&This->control->IConnectionPointContainer_iface);
1783 static ULONG WINAPI ConnectionPoint_Release(IConnectionPoint *iface)
1785 ConnectionPoint *This = impl_from_IConnectionPoint(iface);
1786 return IConnectionPointContainer_Release(&This->control->IConnectionPointContainer_iface);
1789 static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *iface, IID *iid)
1791 ConnectionPoint *This = impl_from_IConnectionPoint(iface);
1793 TRACE("(%p)->(%p)\n", This, iid);
1795 *iid = *This->riid;
1796 return S_OK;
1799 static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoint *iface,
1800 IConnectionPointContainer **container)
1802 ConnectionPoint *This = impl_from_IConnectionPoint(iface);
1804 TRACE("(%p)->(%p)\n", This, container);
1806 if (!container)
1807 return E_POINTER;
1809 *container = &This->control->IConnectionPointContainer_iface;
1810 IConnectionPointContainer_AddRef(*container);
1812 return S_OK;
1815 static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *unk_sink,
1816 DWORD *cookie)
1818 ConnectionPoint *This = impl_from_IConnectionPoint(iface);
1820 FIXME("(%p)->(%p %p)\n", This, unk_sink, cookie);
1822 return E_NOTIMPL;
1825 static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD cookie)
1827 ConnectionPoint *This = impl_from_IConnectionPoint(iface);
1829 FIXME("(%p)->(%d)\n", This, cookie);
1831 return E_NOTIMPL;
1834 static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface,
1835 IEnumConnections **ppEnum)
1837 ConnectionPoint *This = impl_from_IConnectionPoint(iface);
1839 FIXME("(%p)->(%p): stub\n", This, ppEnum);
1841 return E_NOTIMPL;
1844 static const IConnectionPointVtbl ConnectionPointVtbl =
1846 ConnectionPoint_QueryInterface,
1847 ConnectionPoint_AddRef,
1848 ConnectionPoint_Release,
1849 ConnectionPoint_GetConnectionInterface,
1850 ConnectionPoint_GetConnectionPointContainer,
1851 ConnectionPoint_Advise,
1852 ConnectionPoint_Unadvise,
1853 ConnectionPoint_EnumConnections
1856 static void ConnectionPoint_Init(ConnectionPoint *cp, ScriptControl *sc, REFIID riid)
1858 cp->IConnectionPoint_iface.lpVtbl = &ConnectionPointVtbl;
1859 cp->control = sc;
1860 cp->riid = riid;
1862 cp->next = sc->cp_list;
1863 sc->cp_list = cp;
1866 static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
1868 ScriptControl *script_control;
1869 DWORD dpi_x, dpi_y;
1870 HRESULT hres;
1871 HDC hdc;
1873 TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
1875 script_control = heap_alloc(sizeof(*script_control));
1876 if(!script_control)
1877 return E_OUTOFMEMORY;
1879 script_control->IScriptControl_iface.lpVtbl = &ScriptControlVtbl;
1880 script_control->IPersistStreamInit_iface.lpVtbl = &PersistStreamInitVtbl;
1881 script_control->IOleObject_iface.lpVtbl = &OleObjectVtbl;
1882 script_control->IOleControl_iface.lpVtbl = &OleControlVtbl;
1883 script_control->IQuickActivate_iface.lpVtbl = &QuickActivateVtbl;
1884 script_control->IViewObjectEx_iface.lpVtbl = &ViewObjectExVtbl;
1885 script_control->IPointerInactive_iface.lpVtbl = &PointerInactiveVtbl;
1886 script_control->IConnectionPointContainer_iface.lpVtbl = &ConnectionPointContainerVtbl;
1887 script_control->ref = 1;
1888 script_control->site = NULL;
1889 script_control->cp_list = NULL;
1890 script_control->host = NULL;
1891 script_control->timeout = 10000;
1892 script_control->view_sink_flags = 0;
1893 script_control->view_sink = NULL;
1895 ConnectionPoint_Init(&script_control->cp_scsource, script_control, &DIID_DScriptControlSource);
1896 ConnectionPoint_Init(&script_control->cp_propnotif, script_control, &IID_IPropertyNotifySink);
1898 hdc = GetDC(0);
1899 dpi_x = GetDeviceCaps(hdc, LOGPIXELSX);
1900 dpi_y = GetDeviceCaps(hdc, LOGPIXELSY);
1901 ReleaseDC(0, hdc);
1903 script_control->extent.cx = MulDiv(38, 2540, dpi_x);
1904 script_control->extent.cy = MulDiv(38, 2540, dpi_y);
1906 hres = IScriptControl_QueryInterface(&script_control->IScriptControl_iface, riid, ppv);
1907 IScriptControl_Release(&script_control->IScriptControl_iface);
1908 return hres;
1911 /******************************************************************
1912 * DllMain (msscript.ocx.@)
1914 BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
1916 TRACE("(%p %d %p)\n", instance, reason, reserved);
1918 switch(reason) {
1919 case DLL_WINE_PREATTACH:
1920 return FALSE; /* prefer native version */
1921 case DLL_PROCESS_ATTACH:
1922 msscript_instance = instance;
1923 DisableThreadLibraryCalls(instance);
1924 break;
1925 case DLL_PROCESS_DETACH:
1926 if(!reserved)
1927 release_typelib();
1928 break;
1931 return TRUE;
1934 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
1936 *ppv = NULL;
1938 if(IsEqualGUID(&IID_IUnknown, riid)) {
1939 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
1940 *ppv = iface;
1941 }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
1942 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
1943 *ppv = iface;
1946 if(*ppv) {
1947 IUnknown_AddRef((IUnknown*)*ppv);
1948 return S_OK;
1951 WARN("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
1952 return E_NOINTERFACE;
1955 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
1957 TRACE("(%p)\n", iface);
1958 return 2;
1961 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
1963 TRACE("(%p)\n", iface);
1964 return 1;
1967 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
1969 TRACE("(%p)->(%x)\n", iface, fLock);
1970 return S_OK;
1973 static const IClassFactoryVtbl ScriptControlFactoryVtbl = {
1974 ClassFactory_QueryInterface,
1975 ClassFactory_AddRef,
1976 ClassFactory_Release,
1977 ScriptControl_CreateInstance,
1978 ClassFactory_LockServer
1981 static IClassFactory ScriptControlFactory = { &ScriptControlFactoryVtbl };
1983 /***********************************************************************
1984 * DllGetClassObject (msscript.ocx.@)
1986 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
1988 if(IsEqualGUID(&CLSID_ScriptControl, rclsid)) {
1989 TRACE("(CLSID_ScriptControl %s %p)\n", debugstr_guid(riid), ppv);
1990 return IClassFactory_QueryInterface(&ScriptControlFactory, riid, ppv);
1993 FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
1994 return CLASS_E_CLASSNOTAVAILABLE;
1997 /***********************************************************************
1998 * DllCanUnloadNow (msscript.ocx.@)
2000 HRESULT WINAPI DllCanUnloadNow(void)
2002 TRACE("\n");
2003 return S_FALSE;
2006 /***********************************************************************
2007 * DllRegisterServer (msscript.ocx.@)
2009 HRESULT WINAPI DllRegisterServer(void)
2011 TRACE("()\n");
2012 return __wine_register_resources(msscript_instance);
2015 /***********************************************************************
2016 * DllUnregisterServer (msscript.ocx.@)
2018 HRESULT WINAPI DllUnregisterServer(void)
2020 TRACE("()\n");
2021 return __wine_unregister_resources(msscript_instance);