ReactOS 0.4.16-dev-197-g92996da
main.c File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <ole2.h>
#include <shellapi.h>
#include <activscp.h>
#include <initguid.h>
#include "wscript.h"
#include <wine/debug.h>
Include dependency graph for main.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define IActiveScriptParse_Release   IActiveScriptParse32_Release
 
#define IActiveScriptParse_InitNew   IActiveScriptParse32_InitNew
 
#define IActiveScriptParse_ParseScriptText   IActiveScriptParse32_ParseScriptText
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wscript)
 
static HRESULT query_interface (REFIID, void **)
 
static HRESULT WINAPI ActiveScriptSite_QueryInterface (IActiveScriptSite *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ActiveScriptSite_AddRef (IActiveScriptSite *iface)
 
static ULONG WINAPI ActiveScriptSite_Release (IActiveScriptSite *iface)
 
static HRESULT WINAPI ActiveScriptSite_GetLCID (IActiveScriptSite *iface, LCID *plcid)
 
static HRESULT WINAPI ActiveScriptSite_GetItemInfo (IActiveScriptSite *iface, LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown **ppunkItem, ITypeInfo **ppti)
 
static HRESULT WINAPI ActiveScriptSite_GetDocVersionString (IActiveScriptSite *iface, BSTR *pbstrVersion)
 
static HRESULT WINAPI ActiveScriptSite_OnScriptTerminate (IActiveScriptSite *iface, const VARIANT *pvarResult, const EXCEPINFO *pexcepinfo)
 
static HRESULT WINAPI ActiveScriptSite_OnStateChange (IActiveScriptSite *iface, SCRIPTSTATE ssScriptState)
 
static HRESULT WINAPI ActiveScriptSite_OnScriptError (IActiveScriptSite *iface, IActiveScriptError *pscripterror)
 
static HRESULT WINAPI ActiveScriptSite_OnEnterScript (IActiveScriptSite *iface)
 
static HRESULT WINAPI ActiveScriptSite_OnLeaveScript (IActiveScriptSite *iface)
 
static HRESULT WINAPI ActiveScriptSiteWindow_QueryInterface (IActiveScriptSiteWindow *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ActiveScriptSiteWindow_AddRef (IActiveScriptSiteWindow *iface)
 
static ULONG WINAPI ActiveScriptSiteWindow_Release (IActiveScriptSiteWindow *iface)
 
static HRESULT WINAPI ActiveScriptSiteWindow_GetWindow (IActiveScriptSiteWindow *iface, HWND *phwnd)
 
static HRESULT WINAPI ActiveScriptSiteWindow_EnableModeless (IActiveScriptSiteWindow *iface, BOOL fEnable)
 
static BOOL load_typelib (void)
 
static BOOL get_engine_clsid (const WCHAR *ext, CLSID *clsid)
 
static BOOL create_engine (CLSID *clsid, IActiveScript **script_ret, IActiveScriptParse **parser)
 
static BOOL init_engine (IActiveScript *script, IActiveScriptParse *parser)
 
static BSTR get_script_str (const WCHAR *filename)
 
static void run_script (const WCHAR *filename, IActiveScript *script, IActiveScriptParse *parser)
 
static BOOL set_host_properties (const WCHAR *prop)
 
int WINAPI wWinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow)
 

Variables

static const WCHAR wscriptW [] = {'W','S','c','r','i','p','t',0}
 
static const WCHAR wshW [] = {'W','S','H',0}
 
WCHAR scriptFullName [MAX_PATH]
 
ITypeInfohost_ti
 
ITypeInfoarguments_ti
 
static IActiveScriptSiteVtbl ActiveScriptSiteVtbl
 
static IActiveScriptSite script_site = { &ActiveScriptSiteVtbl }
 
static const IActiveScriptSiteWindowVtbl ActiveScriptSiteWindowVtbl
 
static IActiveScriptSiteWindow script_site_window = { &ActiveScriptSiteWindowVtbl }
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file main.c.

◆ IActiveScriptParse_InitNew

#define IActiveScriptParse_InitNew   IActiveScriptParse32_InitNew

Definition at line 47 of file main.c.

◆ IActiveScriptParse_ParseScriptText

#define IActiveScriptParse_ParseScriptText   IActiveScriptParse32_ParseScriptText

Definition at line 48 of file main.c.

◆ IActiveScriptParse_Release

#define IActiveScriptParse_Release   IActiveScriptParse32_Release

Definition at line 46 of file main.c.

Function Documentation

◆ ActiveScriptSite_AddRef()

static ULONG WINAPI ActiveScriptSite_AddRef ( IActiveScriptSite iface)
static

Definition at line 204 of file main.c.

205{
206 return 2;
207}

◆ ActiveScriptSite_GetDocVersionString()

static HRESULT WINAPI ActiveScriptSite_GetDocVersionString ( IActiveScriptSite iface,
BSTR pbstrVersion 
)
static

Definition at line 252 of file main.c.

254{
255 WINE_FIXME("()\n");
256 return E_NOTIMPL;
257}
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:366

◆ ActiveScriptSite_GetItemInfo()

static HRESULT WINAPI ActiveScriptSite_GetItemInfo ( IActiveScriptSite iface,
LPCOLESTR  pstrName,
DWORD  dwReturnMask,
IUnknown **  ppunkItem,
ITypeInfo **  ppti 
)
static

Definition at line 222 of file main.c.

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}
static const WCHAR wshW[]
Definition: main.c:55
static const WCHAR wscriptW[]
Definition: main.c:54
ITypeInfo * host_ti
Definition: main.c:58
#define E_FAIL
Definition: ddrawi.h:102
#define FALSE
Definition: types.h:117
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
unsigned int BOOL
Definition: ntddk_ex.h:94
IHost host_obj
Definition: host.c:479
#define S_OK
Definition: intsafe.h:52
#define wine_dbgstr_w
Definition: kernel32.h:34
#define WINE_TRACE
Definition: debug.h:354
HRESULT hr
Definition: shlfolder.c:183

◆ ActiveScriptSite_GetLCID()

static HRESULT WINAPI ActiveScriptSite_GetLCID ( IActiveScriptSite iface,
LCID plcid 
)
static

Definition at line 214 of file main.c.

215{
216 WINE_TRACE("()\n");
217
218 *plcid = GetUserDefaultLCID();
219 return S_OK;
220}
LCID WINAPI GetUserDefaultLCID(void)
Definition: locale.c:1211

◆ ActiveScriptSite_OnEnterScript()

static HRESULT WINAPI ActiveScriptSite_OnEnterScript ( IActiveScriptSite iface)
static

Definition at line 280 of file main.c.

281{
282 WINE_TRACE("()\n");
283 return S_OK;
284}

◆ ActiveScriptSite_OnLeaveScript()

static HRESULT WINAPI ActiveScriptSite_OnLeaveScript ( IActiveScriptSite iface)
static

Definition at line 286 of file main.c.

287{
288 WINE_TRACE("()\n");
289 return S_OK;
290}

◆ ActiveScriptSite_OnScriptError()

static HRESULT WINAPI ActiveScriptSite_OnScriptError ( IActiveScriptSite iface,
IActiveScriptError pscripterror 
)
static

Definition at line 273 of file main.c.

275{
276 WINE_FIXME("()\n");
277 return E_NOTIMPL;
278}

◆ ActiveScriptSite_OnScriptTerminate()

static HRESULT WINAPI ActiveScriptSite_OnScriptTerminate ( IActiveScriptSite iface,
const VARIANT pvarResult,
const EXCEPINFO *  pexcepinfo 
)
static

Definition at line 259 of file main.c.

261{
262 WINE_FIXME("()\n");
263 return E_NOTIMPL;
264}

◆ ActiveScriptSite_OnStateChange()

static HRESULT WINAPI ActiveScriptSite_OnStateChange ( IActiveScriptSite iface,
SCRIPTSTATE  ssScriptState 
)
static

Definition at line 266 of file main.c.

268{
269 WINE_TRACE("(%x)\n", ssScriptState);
270 return S_OK;
271}

◆ ActiveScriptSite_QueryInterface()

static HRESULT WINAPI ActiveScriptSite_QueryInterface ( IActiveScriptSite iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 198 of file main.c.

200{
201 return query_interface(riid, ppv);
202}
static HRESULT query_interface(REFIID, void **)
Definition: main.c:347
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ ActiveScriptSite_Release()

static ULONG WINAPI ActiveScriptSite_Release ( IActiveScriptSite iface)
static

Definition at line 209 of file main.c.

210{
211 return 1;
212}

◆ ActiveScriptSiteWindow_AddRef()

static ULONG WINAPI ActiveScriptSiteWindow_AddRef ( IActiveScriptSiteWindow iface)
static

Definition at line 313 of file main.c.

314{
315 return 2;
316}

◆ ActiveScriptSiteWindow_EnableModeless()

static HRESULT WINAPI ActiveScriptSiteWindow_EnableModeless ( IActiveScriptSiteWindow iface,
BOOL  fEnable 
)
static

Definition at line 331 of file main.c.

332{
333 TRACE("(%x)\n", fEnable);
334 return S_OK;
335}
#define TRACE(s)
Definition: solgame.cpp:4

◆ ActiveScriptSiteWindow_GetWindow()

static HRESULT WINAPI ActiveScriptSiteWindow_GetWindow ( IActiveScriptSiteWindow iface,
HWND phwnd 
)
static

Definition at line 323 of file main.c.

324{
325 TRACE("(%p)\n", phwnd);
326
327 *phwnd = NULL;
328 return S_OK;
329}
#define NULL
Definition: types.h:112

◆ ActiveScriptSiteWindow_QueryInterface()

static HRESULT WINAPI ActiveScriptSiteWindow_QueryInterface ( IActiveScriptSiteWindow iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 308 of file main.c.

309{
310 return query_interface(riid, ppv);
311}

◆ ActiveScriptSiteWindow_Release()

static ULONG WINAPI ActiveScriptSiteWindow_Release ( IActiveScriptSiteWindow iface)
static

Definition at line 318 of file main.c.

319{
320 return 1;
321}

◆ create_engine()

static BOOL create_engine ( CLSID clsid,
IActiveScript **  script_ret,
IActiveScriptParse **  parser 
)
static

Definition at line 427 of file main.c.

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}
const GUID IID_IUnknown
#define TRUE
Definition: types.h:120
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hres
Definition: protocol.c:465
REFCLSID clsid
Definition: msctf.c:82
script
Definition: msipriv.h:383
Definition: import.c:81

Referenced by wWinMain().

◆ get_engine_clsid()

static BOOL get_engine_clsid ( const WCHAR ext,
CLSID clsid 
)
static

Definition at line 387 of file main.c.

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}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
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
static const WCHAR *const ext[]
Definition: module.c:53
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2602
#define progid(str)
Definition: exdisp.idl:31
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
GLuint res
Definition: glext.h:9613
#define SUCCEEDED(hr)
Definition: intsafe.h:50
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
long LONG
Definition: pedump.c:60
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by wWinMain().

◆ get_script_str()

static BSTR get_script_str ( const WCHAR filename)
static

Definition at line 481 of file main.c.

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}
Definition: _map.h:48
#define CloseHandle
Definition: compat.h:739
#define PAGE_READONLY
Definition: compat.h:138
#define UnmapViewOfFile
Definition: compat.h:746
#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 GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_MAP_READ
Definition: compat.h:776
#define MapViewOfFile
Definition: compat.h:745
#define MultiByteToWideChar
Definition: compat.h:110
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
GLenum GLsizei len
Definition: glext.h:6722
const char * filename
Definition: ioapi.h:137
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
Definition: fci.c:127
int ret

Referenced by run_script().

◆ init_engine()

static BOOL init_engine ( IActiveScript script,
IActiveScriptParse *  parser 
)
static

Definition at line 454 of file main.c.

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}
@ SCRIPTSTATE_INITIALIZED
Definition: activscp.idl:62
#define IActiveScriptParse_InitNew
Definition: main.c:47
static BOOL load_typelib(void)
Definition: main.c:368

Referenced by wWinMain().

◆ load_typelib()

static BOOL load_typelib ( void  )
static

Definition at line 368 of file main.c.

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}
ITypeInfo * arguments_ti
Definition: main.c:59
HRESULT WINAPI LoadTypeLib(const OLECHAR *szFile, ITypeLib **pptLib)
Definition: typelib.c:458

Referenced by init_engine(), and ITERATE_RegisterTypeLibraries().

◆ query_interface()

static HRESULT query_interface ( REFIID  riid,
void **  ppv 
)
static

Definition at line 347 of file main.c.

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}
static IActiveScriptSiteWindow script_site_window
Definition: main.c:345
static IActiveScriptSite script_site
Definition: main.c:306
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
#define E_NOINTERFACE
Definition: winerror.h:2364

Referenced by ActiveScriptSite_QueryInterface(), and ActiveScriptSiteWindow_QueryInterface().

◆ run_script()

static void run_script ( const WCHAR filename,
IActiveScript script,
IActiveScriptParse *  parser 
)
static

Definition at line 511 of file main.c.

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}
@ SCRIPTSTATE_STARTED
Definition: activscp.idl:58
static BSTR get_script_str(const WCHAR *filename)
Definition: main.c:481
#define IActiveScriptParse_ParseScriptText
Definition: main.c:48
const WCHAR * text
Definition: package.c:1794
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271

Referenced by InternetGetProxyInfo(), and wWinMain().

◆ set_host_properties()

static BOOL set_host_properties ( const WCHAR prop)
static

Definition at line 760 of file main.c.

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}
#define wcsicmp
Definition: compat.h:15
VARIANT_BOOL wshInteractive
Definition: host.c:40
#define debugstr_w
Definition: kernel32.h:32

Referenced by wWinMain().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wscript  )

◆ wWinMain()

int WINAPI wWinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPWSTR  lpCmdLine,
int  nShowCmd 
)

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER.PD within this package.

Definition at line 788 of file main.c.

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
int numOfArgs
Definition: arguments.c:35
WCHAR ** argums
Definition: arguments.c:34
WCHAR scriptFullName[MAX_PATH]
Definition: main.c:56
static void run_script(const WCHAR *filename, IActiveScript *script, IActiveScriptParse *parser)
Definition: main.c:511
static BOOL get_engine_clsid(const WCHAR *ext, CLSID *clsid)
Definition: main.c:387
#define IActiveScriptParse_Release
Definition: main.c:46
static BOOL init_engine(IActiveScript *script, IActiveScriptParse *parser)
Definition: main.c:454
static BOOL create_engine(CLSID *clsid, IActiveScript **script_ret, IActiveScriptParse **parser)
Definition: main.c:427
static BOOL set_host_properties(const WCHAR *prop)
Definition: main.c:760
#define wcsrchr
Definition: compat.h:16
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:2019
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4262
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HINSTANCE hInst
Definition: dxdiag.c:13
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
#define argv
Definition: mplay32.c:18
#define L(x)
Definition: ntvdm.h:50
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
Definition: shell32_main.c:79
TCHAR * cmdline
Definition: stretchblt.cpp:32

Variable Documentation

◆ ActiveScriptSiteVtbl

IActiveScriptSiteVtbl ActiveScriptSiteVtbl
static
Initial value:
= {
}
static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface)
Definition: main.c:209
static HRESULT WINAPI ActiveScriptSite_OnLeaveScript(IActiveScriptSite *iface)
Definition: main.c:286
static HRESULT WINAPI ActiveScriptSite_OnStateChange(IActiveScriptSite *iface, SCRIPTSTATE ssScriptState)
Definition: main.c:266
static HRESULT WINAPI ActiveScriptSite_GetDocVersionString(IActiveScriptSite *iface, BSTR *pbstrVersion)
Definition: main.c:252
static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, REFIID riid, void **ppv)
Definition: main.c:198
static HRESULT WINAPI ActiveScriptSite_OnEnterScript(IActiveScriptSite *iface)
Definition: main.c:280
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 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

Definition at line 292 of file main.c.

◆ ActiveScriptSiteWindowVtbl

const IActiveScriptSiteWindowVtbl ActiveScriptSiteWindowVtbl
static
Initial value:
= {
}
static ULONG WINAPI ActiveScriptSiteWindow_Release(IActiveScriptSiteWindow *iface)
Definition: main.c:318
static HRESULT WINAPI ActiveScriptSiteWindow_GetWindow(IActiveScriptSiteWindow *iface, HWND *phwnd)
Definition: main.c:323
static HRESULT WINAPI ActiveScriptSiteWindow_EnableModeless(IActiveScriptSiteWindow *iface, BOOL fEnable)
Definition: main.c:331
static HRESULT WINAPI ActiveScriptSiteWindow_QueryInterface(IActiveScriptSiteWindow *iface, REFIID riid, void **ppv)
Definition: main.c:308
static ULONG WINAPI ActiveScriptSiteWindow_AddRef(IActiveScriptSiteWindow *iface)
Definition: main.c:313

Definition at line 337 of file main.c.

◆ arguments_ti

ITypeInfo* arguments_ti

◆ host_ti

◆ script_site

Definition at line 306 of file main.c.

Referenced by query_interface().

◆ script_site_window

IActiveScriptSiteWindow script_site_window = { &ActiveScriptSiteWindowVtbl }
static

Definition at line 345 of file main.c.

Referenced by query_interface().

◆ scriptFullName

WCHAR scriptFullName[MAX_PATH]

Definition at line 56 of file main.c.

Referenced by Host_get_ScriptFullName(), Host_get_ScriptName(), and wWinMain().

◆ wscriptW

const WCHAR wscriptW[] = {'W','S','c','r','i','p','t',0}
static

Definition at line 54 of file main.c.

Referenced by ActiveScriptSite_GetItemInfo(), and init_engine().

◆ wshW

const WCHAR wshW[] = {'W','S','H',0}
static

Definition at line 55 of file main.c.

Referenced by ActiveScriptSite_GetItemInfo(), and init_engine().