ReactOS 0.4.15-dev-8408-g466a198
main.c
Go to the documentation of this file.
1/*
2 * Copyright 2010 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#include <stdarg.h>
20
21#define COBJMACROS
22#ifdef __REACTOS__
23#define CONST_VTABLE
24#endif
25
26#include <windef.h>
27#include <winbase.h>
28#include <winreg.h>
29#include <ole2.h>
30#include <shellapi.h>
31#include <activscp.h>
32#include <initguid.h>
33
34#include "wscript.h"
35
36#include <wine/debug.h>
37
38#ifdef _WIN64
39
40#define IActiveScriptParse_Release IActiveScriptParse64_Release
41#define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
42#define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
43
44#else
45
46#define IActiveScriptParse_Release IActiveScriptParse32_Release
47#define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
48#define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
49
50#endif
51
53
54static const WCHAR wscriptW[] = {'W','S','c','r','i','p','t',0};
55static const WCHAR wshW[] = {'W','S','H',0};
57
60
61static HRESULT query_interface(REFIID,void**);
62
63#ifdef __REACTOS__
64#include <commctrl.h>
65
66typedef struct {
67 UINT itemsize, count;
68 void *mem;
69} SIMPLEVECTOR;
70
71static void SVect_Free(SIMPLEVECTOR *pV)
72{
73 if (pV->mem)
74 LocalFree(pV->mem);
75 pV->mem = NULL;
76}
77
78static void* SVect_Add(SIMPLEVECTOR *pV)
79{
80 void *p = NULL;
81 if (pV->mem)
82 {
83 p = LocalReAlloc(pV->mem, pV->itemsize * (pV->count + 1), LMEM_FIXED | LMEM_MOVEABLE);
84 if (p)
85 {
86 pV->mem = p;
87 p = (char*)p + (pV->count * pV->itemsize);
88 pV->count++;
89 }
90 }
91 else
92 {
93 p = pV->mem = LocalAlloc(LMEM_FIXED, pV->itemsize);
94 if (p)
95 {
96 pV->count = 1;
97 }
98 }
99 return p;
100}
101
102#define SVect_Delete(pV, pItem) ( (pV), (pItem) ) /* Should not be required for global items */
103
104static void* SVect_Get(SIMPLEVECTOR *pV, UINT i)
105{
106 return pV->mem && i < pV->count ? (char*)pV->mem + (i * pV->itemsize) : NULL;
107}
108
109typedef struct {
110 BSTR name;
111 IUnknown *punk;
112} GLOBAL_ITEM;
113
114SIMPLEVECTOR g_global_items = { sizeof(GLOBAL_ITEM) };
115
116static void free_globals(void)
117{
118 UINT i;
119 for (i = 0;; ++i)
120 {
121 GLOBAL_ITEM *p = (GLOBAL_ITEM*)SVect_Get(&g_global_items, i);
122 if (!p)
123 break;
124 IUnknown_Release(p->punk);
125 SysFreeString(p->name);
126 }
127 SVect_Free(&g_global_items);
128}
129
130static HRESULT add_globalitem(IActiveScript *script, BSTR name, IUnknown *punk, DWORD siflags)
131{
132 GLOBAL_ITEM *item;
133 HRESULT hr;
134
136 if (!name)
137 return E_OUTOFMEMORY;
138
139 item = SVect_Add(&g_global_items);
140 if (item)
141 {
142 item->name = name;
143 item->punk = punk;
144 hr = IActiveScript_AddNamedItem(script, name, siflags);
145 if (SUCCEEDED(hr))
146 {
147 IUnknown_AddRef(punk);
148 return hr;
149 }
150 SVect_Delete(&g_global_items, item);
151 }
153 return E_OUTOFMEMORY;
154}
155
156static HRESULT add_globalitem_from_clsid(IActiveScript *script, BSTR name, REFCLSID clsid, DWORD siflags)
157{
158 IUnknown *punk;
159 HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&punk);
160 if (SUCCEEDED(hr))
161 {
162 hr = add_globalitem(script, name, punk, siflags);
163 IUnknown_Release(punk);
164 }
165 return hr;
166}
167
168static HRESULT get_globalitem_info(LPCOLESTR Name, DWORD Mask, IUnknown **ppunk, ITypeInfo **ppti, BOOL *pHandled)
169{
171 UINT i;
172 for (i = 0;; ++i)
173 {
174 GLOBAL_ITEM *p = (GLOBAL_ITEM*)SVect_Get(&g_global_items, i);
175 if (!p)
176 break;
177 if (!lstrcmpiW(Name, p->name))
178 {
179 if (ppti)
180 *ppti = NULL;
181 if (Mask & SCRIPTINFO_IUNKNOWN)
182 {
183 *ppunk = p->punk;
184 if (p->punk)
185 {
186 IUnknown_AddRef(p->punk);
187 *pHandled = TRUE;
188 }
189 return S_OK;
190 }
191 break;
192 }
193 }
194 return hr;
195}
196#endif
197
199 REFIID riid, void **ppv)
200{
201 return query_interface(riid, ppv);
202}
203
205{
206 return 2;
207}
208
210{
211 return 1;
212}
213
215{
216 WINE_TRACE("()\n");
217
218 *plcid = GetUserDefaultLCID();
219 return S_OK;
220}
221
223 LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown **ppunkItem, ITypeInfo **ppti)
224{
225 WINE_TRACE("(%s %x %p %p)\n", wine_dbgstr_w(pstrName), dwReturnMask, ppunkItem, ppti);
226
227#ifdef __REACTOS__
228 {
229 BOOL handled = FALSE;
230 HRESULT hr = get_globalitem_info(pstrName, dwReturnMask, ppunkItem, ppti, &handled);
231 if (handled)
232 return hr;
233 }
234#endif
235
236 if(lstrcmpW(pstrName, wshW) && lstrcmpW(pstrName, wscriptW))
237 return E_FAIL;
238
239 if(dwReturnMask & SCRIPTINFO_ITYPEINFO) {
240 ITypeInfo_AddRef(host_ti);
241 *ppti = host_ti;
242 }
243
244 if(dwReturnMask & SCRIPTINFO_IUNKNOWN) {
245 IHost_AddRef(&host_obj);
246 *ppunkItem = (IUnknown*)&host_obj;
247 }
248
249 return S_OK;
250}
251
253 BSTR *pbstrVersion)
254{
255 WINE_FIXME("()\n");
256 return E_NOTIMPL;
257}
258
260 const VARIANT *pvarResult, const EXCEPINFO *pexcepinfo)
261{
262 WINE_FIXME("()\n");
263 return E_NOTIMPL;
264}
265
267 SCRIPTSTATE ssScriptState)
268{
269 WINE_TRACE("(%x)\n", ssScriptState);
270 return S_OK;
271}
272
274 IActiveScriptError *pscripterror)
275{
276 WINE_FIXME("()\n");
277 return E_NOTIMPL;
278}
279
281{
282 WINE_TRACE("()\n");
283 return S_OK;
284}
285
287{
288 WINE_TRACE("()\n");
289 return S_OK;
290}
291
292static IActiveScriptSiteVtbl ActiveScriptSiteVtbl = {
304};
305
307
309{
310 return query_interface(riid, ppv);
311}
312
314{
315 return 2;
316}
317
319{
320 return 1;
321}
322
324{
325 TRACE("(%p)\n", phwnd);
326
327 *phwnd = NULL;
328 return S_OK;
329}
330
332{
333 TRACE("(%x)\n", fEnable);
334 return S_OK;
335}
336
337static const IActiveScriptSiteWindowVtbl ActiveScriptSiteWindowVtbl = {
343};
344
346
348{
350 TRACE("(IID_IUnknown %p)\n", ppv);
351 *ppv = &script_site;
352 }else if(IsEqualGUID(riid, &IID_IActiveScriptSite)) {
353 TRACE("(IID_IActiveScriptSite %p)\n", ppv);
354 *ppv = &script_site;
355 }else if(IsEqualGUID(riid, &IID_IActiveScriptSiteWindow)) {
356 TRACE("(IID_IActiveScriptSiteWindow %p)\n", ppv);
358 }else {
359 *ppv = NULL;
360 TRACE("(%s %p)\n", wine_dbgstr_guid(riid), ppv);
361 return E_NOINTERFACE;
362 }
363
364 IUnknown_AddRef((IUnknown*)*ppv);
365 return S_OK;
366}
367
368static BOOL load_typelib(void)
369{
372
373 static const WCHAR wscript_exeW[] = {'w','s','c','r','i','p','t','.','e','x','e',0};
374
375 hres = LoadTypeLib(wscript_exeW, &typelib);
376 if(FAILED(hres))
377 return FALSE;
378
379 hres = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IHost, &host_ti);
380 if(SUCCEEDED(hres))
381 hres = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IArguments2, &arguments_ti);
382
383 ITypeLib_Release(typelib);
384 return SUCCEEDED(hres);
385}
386
388{
389 WCHAR fileid[64], progid[64];
390 DWORD res;
391 LONG size;
392 HKEY hkey;
394
395 static const WCHAR script_engineW[] =
396 {'\\','S','c','r','i','p','t','E','n','g','i','n','e',0};
397
399 if(res != ERROR_SUCCESS)
400 return FALSE;
401
402 size = ARRAY_SIZE(fileid);
403 res = RegQueryValueW(hkey, NULL, fileid, &size);
404 RegCloseKey(hkey);
405 if(res != ERROR_SUCCESS)
406 return FALSE;
407
408 WINE_TRACE("fileid is %s\n", wine_dbgstr_w(fileid));
409
410 lstrcatW(fileid, script_engineW);
411 res = RegOpenKeyW(HKEY_CLASSES_ROOT, fileid, &hkey);
412 if(res != ERROR_SUCCESS)
413 return FALSE;
414
416 res = RegQueryValueW(hkey, NULL, progid, &size);
417 RegCloseKey(hkey);
418 if(res != ERROR_SUCCESS)
419 return FALSE;
420
421 WINE_TRACE("ProgID is %s\n", wine_dbgstr_w(progid));
422
424 return SUCCEEDED(hres);
425}
426
428 IActiveScriptParse **parser)
429{
431 IUnknown *unk;
433
434 hres = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
435 &IID_IUnknown, (void**)&unk);
436 if(FAILED(hres))
437 return FALSE;
438
439 hres = IUnknown_QueryInterface(unk, &IID_IActiveScript, (void**)&script);
440 IUnknown_Release(unk);
441 if(FAILED(hres))
442 return FALSE;
443
444 hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParse, (void**)parser);
445 if(FAILED(hres)) {
446 IActiveScript_Release(script);
447 return FALSE;
448 }
449
450 *script_ret = script;
451 return TRUE;
452}
453
454static BOOL init_engine(IActiveScript *script, IActiveScriptParse *parser)
455{
457
458 if(!load_typelib())
459 return FALSE;
460
461 hres = IActiveScript_SetScriptSite(script, &script_site);
462 if(FAILED(hres))
463 return FALSE;
464
466 if(FAILED(hres))
467 return FALSE;
468
469 hres = IActiveScript_AddNamedItem(script, wscriptW, SCRIPTITEM_ISVISIBLE);
470 if(FAILED(hres))
471 return FALSE;
472
473 hres = IActiveScript_AddNamedItem(script, wshW, SCRIPTITEM_ISVISIBLE);
474 if(FAILED(hres))
475 return FALSE;
476
477 hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_INITIALIZED);
478 return SUCCEEDED(hres);
479}
480
482{
483 const char *file_map;
484 HANDLE file, map;
485 DWORD size, len;
486 BSTR ret;
487
490 return NULL;
491
496 return NULL;
497
498 file_map = MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0);
500 if(!file_map)
501 return NULL;
502
503 len = MultiByteToWideChar(CP_ACP, 0, file_map, size, NULL, 0);
505 MultiByteToWideChar(CP_ACP, 0, file_map, size, ret, len);
506
507 UnmapViewOfFile(file_map);
508 return ret;
509}
510
511static void run_script(const WCHAR *filename, IActiveScript *script, IActiveScriptParse *parser)
512{
513 BSTR text;
515
517 if(!text) {
518 WINE_FIXME("Could not get script text\n");
519 return;
520 }
521
523 SCRIPTTEXT_HOSTMANAGESSOURCE|SCRIPTITEM_ISVISIBLE, NULL, NULL);
525 if(FAILED(hres)) {
526 WINE_FIXME("ParseScriptText failed: %08x\n", hres);
527 return;
528 }
529
530 hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_STARTED);
531 if(FAILED(hres))
532 WINE_FIXME("SetScriptState failed: %08x\n", hres);
533}
534
535#ifdef __REACTOS__
536#include <msxml2.h>
537#include <shlwapi.h>
538
539static HRESULT xmldomnode_getattributevalue(IXMLDOMNode *pnode, LPCWSTR name, BSTR *pout)
540{
543 BSTR bsname = SysAllocString(name);
544 *pout = NULL;
545 if (bsname && SUCCEEDED(hr = IXMLDOMNode_get_attributes(pnode, &pmap)))
546 {
547 if (SUCCEEDED(hr = IXMLDOMNamedNodeMap_getNamedItem(pmap, bsname, &pnode)))
548 {
550 if (pnode)
551 {
552 hr = IXMLDOMNode_get_text(pnode, pout);
553 if (SUCCEEDED(hr) && !*pout)
555 IXMLDOMNode_Release(pnode);
556 }
557 }
558 IXMLDOMNamedNodeMap_Release(pmap);
559 }
560 SysFreeString(bsname);
561 return hr;
562}
563
564static HRESULT xmldomelem_getelembytag(IXMLDOMElement *pelem, LPCWSTR name, long index, IXMLDOMNode**ppout)
565{
567 IXMLDOMNodeList *pnl;
568 BSTR bsname = SysAllocString(name);
569 *ppout = NULL;
570 if (bsname && SUCCEEDED(hr = IXMLDOMElement_getElementsByTagName(pelem, bsname, &pnl)))
571 {
572 hr = IXMLDOMNodeList_get_item(pnl, index, ppout);
573 if (SUCCEEDED(hr) && !*ppout)
575 IUnknown_Release(pnl);
576 }
577 SysFreeString(bsname);
578 return hr;
579}
580
581static HRESULT xmldomelem_getelembytagasdomelem(IXMLDOMElement *pelem, LPCWSTR name, long index, IXMLDOMElement**ppout)
582{
583 IXMLDOMNode *pnode;
584 HRESULT hr = xmldomelem_getelembytag(pelem, name, index, &pnode);
585 *ppout = NULL;
586 if (SUCCEEDED(hr))
587 {
588 hr = IUnknown_QueryInterface(pnode, &IID_IXMLDOMElement, (void**)ppout);
589 IUnknown_Release(pnode);
590 }
591 return hr;
592}
593
594static void wsf_addobjectfromnode(IActiveScript *script, IXMLDOMNode *obj)
595{
596 BSTR bsid, bsclsid = NULL;
597 if (SUCCEEDED(xmldomnode_getattributevalue(obj, L"id", &bsid)))
598 {
599 CLSID clsid;
600 HRESULT hr;
601 hr = xmldomnode_getattributevalue(obj, L"clsid", &bsclsid);
602 if (FAILED(hr) || FAILED(CLSIDFromString(bsclsid, &clsid)))
603 {
604 SysFreeString(bsclsid);
605 if (SUCCEEDED(hr = xmldomnode_getattributevalue(obj, L"progid", &bsclsid)))
606 {
607 hr = CLSIDFromProgID(bsclsid, &clsid);
608 SysFreeString(bsclsid);
609 }
610 }
611 if (SUCCEEDED(hr))
612 {
613 hr = add_globalitem_from_clsid(script, bsid, &clsid, SCRIPTITEM_ISVISIBLE);
614 }
615 SysFreeString(bsid);
616 }
617}
618
619static HRESULT run_wsfjob(IXMLDOMElement *jobtag)
620{
621 // FIXME: We are supposed to somehow handle multiple languages in the same IActiveScript.
623 LPCWSTR deflang = L"JScript";
624 IXMLDOMNode *scripttag;
625 HRESULT hr = S_OK;
626 if (SUCCEEDED(xmldomelem_getelembytag(jobtag, L"script", 0, &scripttag)))
627 {
628 CLSID clsid;
629 IActiveScriptParse *parser;
630 BSTR lang, code;
631 if (FAILED(xmldomnode_getattributevalue(scripttag, L"language", &lang)))
632 lang = NULL;
633 hr = CLSIDFromProgID(lang ? lang : deflang, &clsid);
635
636 if (SUCCEEDED(hr))
637 {
638 hr = E_FAIL;
640 {
642 {
643 long index;
644 for (index = 0; index < 0x7fffffff; ++index)
645 {
647 if (SUCCEEDED(xmldomelem_getelembytag(jobtag, L"object", index, &obj)))
648 {
649 wsf_addobjectfromnode(script, obj);
650 IUnknown_Release(obj);
651 }
652 else
653 {
654 break;
655 }
656 }
657
658 if (SUCCEEDED(hr = IXMLDOMNode_get_text(scripttag, &code)))
659 {
661 SCRIPTTEXT_HOSTMANAGESSOURCE|SCRIPTITEM_ISVISIBLE,
662 NULL, NULL);
663 if (SUCCEEDED(hr))
664 {
665 hr = IActiveScript_SetScriptState(script, SCRIPTSTATE_STARTED);
666 IActiveScript_Close(script);
667 }
669 }
670 ITypeInfo_Release(host_ti);
671 }
672 IUnknown_Release(parser);
673 IUnknown_Release(script);
674 }
675 }
676 IUnknown_Release(scripttag);
677 }
678 return hr;
679}
680
681/*
682.WSF files can contain a single job, or multiple jobs if contained in a package.
683Jobs are identified by their id and if no id is specified, the first job is used.
684Each job can contain multiple script tags and all scripts are merged into one.
685
686<job><script language="JScript">WScript.Echo("JS");</script></job>
687or
688<package>
689<job><script language="JScript">WScript.Echo("JS");</script></job>
690</package>
691or
692<?xml version="1.0" ?>
693<job>
694<script language="JScript"><![CDATA[function JS(s) {WScript.Echo(s)}]]></script>
695<script language="VBScript">JS "VB2JS"</script>
696</job>
697*/
698static HRESULT run_wsf(LPCWSTR xmlpath)
699{
702 IXMLDOMDocument *pdoc;
703 HRESULT hr = UrlCreateFromPathW(xmlpath, url, &cch, 0), hrCom;
704 if (FAILED(hr))
705 return hr;
706
707 hrCom = CoInitialize(NULL);
708 hr = CoCreateInstance(&CLSID_DOMDocument30, NULL, CLSCTX_INPROC_SERVER,
709 &IID_IXMLDOMDocument, (void**)&pdoc);
710 if (SUCCEEDED(hr))
711 {
712 VARIANT_BOOL succ = VARIANT_FALSE;
713 IXMLDOMElement *pdocelm;
714 BSTR bsurl = SysAllocString(url);
715 VARIANT v;
716 V_VT(&v) = VT_BSTR;
717 V_BSTR(&v) = bsurl;
718 if (!bsurl || (hr = IXMLDOMDocument_load(pdoc, v, &succ)) > 0 || (SUCCEEDED(hr) && !succ))
719 {
720 hr = E_FAIL;
721 }
722 if (SUCCEEDED(hr) && SUCCEEDED(hr = IXMLDOMDocument_get_documentElement(pdoc, &pdocelm)))
723 {
724 BSTR tagName = NULL;
725 if (SUCCEEDED(hr = IXMLDOMElement_get_tagName(pdocelm, &tagName)))
726 {
727 if (lstrcmpiW(tagName, L"package") == 0)
728 {
729 // FIXME: Accept job id as a function parameter and find the job here
731 if (SUCCEEDED(hr = xmldomelem_getelembytagasdomelem(pdocelm, L"job", 0, &p)))
732 {
733 IUnknown_Release(pdocelm);
734 pdocelm = p;
735 }
736 }
737 else if (lstrcmpiW(tagName, L"job") != 0)
738 {
739 hr = 0x800400C0ul;
740 }
741 SysFreeString(tagName);
742 }
743 if (SUCCEEDED(hr))
744 {
745 // FIXME: Only support CDATA blocks if the xml tag is present?
746 hr = run_wsfjob(pdocelm);
747 }
748 IUnknown_Release(pdocelm);
749 }
750 VariantClear(&v);
751 IUnknown_Release(pdoc);
752 }
753 free_globals();
754 if (SUCCEEDED(hrCom))
756 return hr;
757}
758#endif
759
760static BOOL set_host_properties(const WCHAR *prop)
761{
762 static const WCHAR nologoW[] = {'n','o','l','o','g','o',0};
763 static const WCHAR iactive[] = {'i',0};
764 static const WCHAR batch[] = {'b',0};
765
766 if(*prop == '/') {
767 ++prop;
768 if(*prop == '/')
769 ++prop;
770 }
771 else
772 ++prop;
773
774 if(wcsicmp(prop, iactive) == 0)
775 wshInteractive = VARIANT_TRUE;
776 else if(wcsicmp(prop, batch) == 0)
777 wshInteractive = VARIANT_FALSE;
778 else if(wcsicmp(prop, nologoW) == 0)
779 WINE_FIXME("ignored %s switch\n", debugstr_w(nologoW));
780 else
781 {
782 WINE_FIXME("unsupported switch %s\n", debugstr_w(prop));
783 return FALSE;
784 }
785 return TRUE;
786}
787
788int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow)
789{
790 WCHAR *ext, *filepart, *filename = NULL;
791 IActiveScriptParse *parser;
793 WCHAR **argv;
794 CLSID clsid;
795 int argc, i;
796 DWORD res;
797
798 WINE_TRACE("(%p %p %s %x)\n", hInst, hPrevInst, wine_dbgstr_w(cmdline), cmdshow);
799
801 if(!argv)
802 return 1;
803
804 for(i=1; i<argc; i++) {
805 if(*argv[i] == '/' || *argv[i] == '-') {
807 return 1;
808 }else {
809 filename = argv[i];
810 argums = argv+i+1;
811 numOfArgs = argc-i-1;
812 break;
813 }
814 }
815
816 if(!filename) {
817 WINE_FIXME("No file name specified\n");
818 return 1;
819 }
822 return 1;
823
824 ext = wcsrchr(filepart, '.');
825#ifdef __REACTOS__
826 if (ext && !lstrcmpiW(ext, L".wsf")) {
827 return run_wsf(scriptFullName);
828 }
829#endif
830 if(!ext || !get_engine_clsid(ext, &clsid)) {
831 WINE_FIXME("Could not find engine for %s\n", wine_dbgstr_w(ext));
832 return 1;
833 }
834
836
837 if(!create_engine(&clsid, &script, &parser)) {
838 WINE_FIXME("Could not create script engine\n");
840 return 1;
841 }
842
845 IActiveScript_Close(script);
846 ITypeInfo_Release(host_ti);
847 }else {
848 WINE_FIXME("Script initialization failed\n");
849 }
850
851 IActiveScript_Release(script);
853
854#ifdef __REACTOS__
855 free_globals();
856#endif
857
859
860 return 0;
861}
static int argc
Definition: ServiceArgs.c:12
@ SCRIPTSTATE_INITIALIZED
Definition: activscp.idl:62
@ SCRIPTSTATE_STARTED
Definition: activscp.idl:58
enum tagSCRIPTSTATE SCRIPTSTATE
static ITypeLib * typelib
Definition: apps.c:108
int numOfArgs
Definition: arguments.c:35
WCHAR ** argums
Definition: arguments.c:34
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface)
Definition: main.c:209
ITypeInfo * arguments_ti
Definition: main.c:59
static ULONG WINAPI ActiveScriptSiteWindow_Release(IActiveScriptSiteWindow *iface)
Definition: main.c:318
static HRESULT WINAPI ActiveScriptSite_OnLeaveScript(IActiveScriptSite *iface)
Definition: main.c:286
static BSTR get_script_str(const WCHAR *filename)
Definition: main.c:481
static HRESULT query_interface(REFIID, void **)
Definition: main.c:347
static const WCHAR wshW[]
Definition: main.c:55
static HRESULT WINAPI ActiveScriptSite_OnStateChange(IActiveScriptSite *iface, SCRIPTSTATE ssScriptState)
Definition: main.c:266
WCHAR scriptFullName[MAX_PATH]
Definition: main.c:56
static const IActiveScriptSiteWindowVtbl ActiveScriptSiteWindowVtbl
Definition: main.c:337
static void run_script(const WCHAR *filename, IActiveScript *script, IActiveScriptParse *parser)
Definition: main.c:511
static HRESULT WINAPI ActiveScriptSite_GetDocVersionString(IActiveScriptSite *iface, BSTR *pbstrVersion)
Definition: main.c:252
static BOOL get_engine_clsid(const WCHAR *ext, CLSID *clsid)
Definition: main.c:387
#define IActiveScriptParse_InitNew
Definition: main.c:47
#define IActiveScriptParse_ParseScriptText
Definition: main.c:48
#define IActiveScriptParse_Release
Definition: main.c:46
static BOOL init_engine(IActiveScript *script, IActiveScriptParse *parser)
Definition: main.c:454
static BOOL load_typelib(void)
Definition: main.c:368
static HRESULT WINAPI ActiveScriptSiteWindow_GetWindow(IActiveScriptSiteWindow *iface, HWND *phwnd)
Definition: main.c:323
static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, REFIID riid, void **ppv)
Definition: main.c:198
static BOOL create_engine(CLSID *clsid, IActiveScript **script_ret, IActiveScriptParse **parser)
Definition: main.c:427
static HRESULT WINAPI ActiveScriptSite_OnEnterScript(IActiveScriptSite *iface)
Definition: main.c:280
static const WCHAR wscriptW[]
Definition: main.c:54
static HRESULT WINAPI ActiveScriptSiteWindow_EnableModeless(IActiveScriptSiteWindow *iface, BOOL fEnable)
Definition: main.c:331
static ULONG WINAPI ActiveScriptSite_AddRef(IActiveScriptSite *iface)
Definition: main.c:204
static HRESULT WINAPI ActiveScriptSite_OnScriptTerminate(IActiveScriptSite *iface, const VARIANT *pvarResult, const EXCEPINFO *pexcepinfo)
Definition: main.c:259
static HRESULT WINAPI ActiveScriptSiteWindow_QueryInterface(IActiveScriptSiteWindow *iface, REFIID riid, void **ppv)
Definition: main.c:308
int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow)
Definition: main.c:788
static IActiveScriptSiteWindow script_site_window
Definition: main.c:345
static IActiveScriptSiteVtbl ActiveScriptSiteVtbl
Definition: main.c:292
static HRESULT WINAPI ActiveScriptSite_GetLCID(IActiveScriptSite *iface, LCID *plcid)
Definition: main.c:214
static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown **ppunkItem, ITypeInfo **ppti)
Definition: main.c:222
static HRESULT WINAPI ActiveScriptSite_OnScriptError(IActiveScriptSite *iface, IActiveScriptError *pscripterror)
Definition: main.c:273
static IActiveScriptSite script_site
Definition: main.c:306
ITypeInfo * host_ti
Definition: main.c:58
static ULONG WINAPI ActiveScriptSiteWindow_AddRef(IActiveScriptSiteWindow *iface)
Definition: main.c:313
static BOOL set_host_properties(const WCHAR *prop)
Definition: main.c:760
#define index(s, c)
Definition: various.h:29
#define ARRAY_SIZE(A)
Definition: main.h:33
const GUID IID_IUnknown
#define RegCloseKey(hKey)
Definition: registry.h:49
Definition: _map.h:48
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4241
#define CloseHandle
Definition: compat.h:739
#define PAGE_READONLY
Definition: compat.h:138
#define UnmapViewOfFile
Definition: compat.h:746
#define wcsrchr
Definition: compat.h:16
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:744
OLECHAR * BSTR
Definition: compat.h:2293
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_MAP_READ
Definition: compat.h:776
short VARIANT_BOOL
Definition: compat.h:2290
#define MapViewOfFile
Definition: compat.h:745
#define MultiByteToWideChar
Definition: compat.h:110
@ VT_BSTR
Definition: compat.h:2303
#define wcsicmp
Definition: compat.h:15
static const WCHAR *const ext[]
Definition: module.c:53
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
LPWSTR WINAPI GetCommandLineW(VOID)
Definition: proc.c:2013
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4242
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4261
LCID WINAPI GetUserDefaultLCID(void)
Definition: locale.c:1210
const WCHAR * text
Definition: package.c:1799
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2602
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI LoadTypeLib(const OLECHAR *szFile, ITypeLib **pptLib)
Definition: typelib.c:458
HRESULT WINAPI UrlCreateFromPathW(LPCWSTR pszPath, LPWSTR pszUrl, LPDWORD pcchUrl, DWORD dwReserved)
Definition: url.c:2497
HINSTANCE hInst
Definition: dxdiag.c:13
#define progid(str)
Definition: exdisp.idl:31
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned int Mask
Definition: fpcontrol.c:82
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLuint res
Definition: glext.h:9613
GLuint index
Definition: glext.h:6031
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
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
HLOCAL NTAPI LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:1625
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
IHost host_obj
Definition: host.c:479
VARIANT_BOOL wshInteractive
Definition: host.c:40
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
const char * filename
Definition: ioapi.h:137
#define debugstr_w
Definition: kernel32.h:32
#define wine_dbgstr_w
Definition: kernel32.h:34
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static const WCHAR url[]
Definition: encode.c:1432
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
HRESULT hres
Definition: protocol.c:465
static ATOM item
Definition: dde.c:856
#define argv
Definition: mplay32.c:18
REFCLSID clsid
Definition: msctf.c:82
script
Definition: msipriv.h:383
unsigned int UINT
Definition: ndis.h:50
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define L(x)
Definition: ntvdm.h:50
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
DWORD LCID
Definition: nls.h:13
#define WINE_TRACE
Definition: debug.h:354
#define WINE_FIXME
Definition: debug.h:366
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
Definition: shell32_main.c:80
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
TCHAR * cmdline
Definition: stretchblt.cpp:32
char * name
Definition: apinames.c:50
Definition: inflate.c:139
Definition: fci.c:127
Definition: mem.c:156
Definition: name.c:39
Definition: import.c:81
Definition: pmap_prot.h:88
#define max(a, b)
Definition: svc.c:63
uint32_t ULONG
Definition: typedefs.h:59
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
static const WCHAR lang[]
Definition: wbemdisp.c:287
int ret
#define LMEM_MOVEABLE
Definition: winbase.h:369
#define LMEM_FIXED
Definition: winbase.h:368
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define ERROR_NOT_FOUND
Definition: winerror.h:690
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185