ReactOS 0.4.15-dev-5669-g09dde2c
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 69 of file main.c.

70{
71 return 2;
72}

◆ ActiveScriptSite_GetDocVersionString()

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

Definition at line 108 of file main.c.

110{
111 WINE_FIXME("()\n");
112 return E_NOTIMPL;
113}
#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 87 of file main.c.

89{
90 WINE_TRACE("(%s %x %p %p)\n", wine_dbgstr_w(pstrName), dwReturnMask, ppunkItem, ppti);
91
92 if(lstrcmpW(pstrName, wshW) && lstrcmpW(pstrName, wscriptW))
93 return E_FAIL;
94
95 if(dwReturnMask & SCRIPTINFO_ITYPEINFO) {
96 ITypeInfo_AddRef(host_ti);
97 *ppti = host_ti;
98 }
99
100 if(dwReturnMask & SCRIPTINFO_IUNKNOWN) {
101 IHost_AddRef(&host_obj);
102 *ppunkItem = (IUnknown*)&host_obj;
103 }
104
105 return S_OK;
106}
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
IHost host_obj
Definition: host.c:471
#define S_OK
Definition: intsafe.h:52
#define wine_dbgstr_w
Definition: kernel32.h:34
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define WINE_TRACE
Definition: debug.h:354

◆ ActiveScriptSite_GetLCID()

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

Definition at line 79 of file main.c.

80{
81 WINE_TRACE("()\n");
82
83 *plcid = GetUserDefaultLCID();
84 return S_OK;
85}
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:772

◆ ActiveScriptSite_OnEnterScript()

static HRESULT WINAPI ActiveScriptSite_OnEnterScript ( IActiveScriptSite iface)
static

Definition at line 136 of file main.c.

137{
138 WINE_TRACE("()\n");
139 return S_OK;
140}

◆ ActiveScriptSite_OnLeaveScript()

static HRESULT WINAPI ActiveScriptSite_OnLeaveScript ( IActiveScriptSite iface)
static

Definition at line 142 of file main.c.

143{
144 WINE_TRACE("()\n");
145 return S_OK;
146}

◆ ActiveScriptSite_OnScriptError()

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

Definition at line 129 of file main.c.

131{
132 WINE_FIXME("()\n");
133 return E_NOTIMPL;
134}

◆ ActiveScriptSite_OnScriptTerminate()

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

Definition at line 115 of file main.c.

117{
118 WINE_FIXME("()\n");
119 return E_NOTIMPL;
120}

◆ ActiveScriptSite_OnStateChange()

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

Definition at line 122 of file main.c.

124{
125 WINE_TRACE("(%x)\n", ssScriptState);
126 return S_OK;
127}

◆ ActiveScriptSite_QueryInterface()

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

Definition at line 63 of file main.c.

65{
66 return query_interface(riid, ppv);
67}
static HRESULT query_interface(REFIID, void **)
Definition: main.c:203
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 74 of file main.c.

75{
76 return 1;
77}

◆ ActiveScriptSiteWindow_AddRef()

static ULONG WINAPI ActiveScriptSiteWindow_AddRef ( IActiveScriptSiteWindow iface)
static

Definition at line 169 of file main.c.

170{
171 return 2;
172}

◆ ActiveScriptSiteWindow_EnableModeless()

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

Definition at line 187 of file main.c.

188{
189 TRACE("(%x)\n", fEnable);
190 return S_OK;
191}
#define TRACE(s)
Definition: solgame.cpp:4

◆ ActiveScriptSiteWindow_GetWindow()

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

Definition at line 179 of file main.c.

180{
181 TRACE("(%p)\n", phwnd);
182
183 *phwnd = NULL;
184 return S_OK;
185}
#define NULL
Definition: types.h:112

◆ ActiveScriptSiteWindow_QueryInterface()

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

Definition at line 164 of file main.c.

165{
166 return query_interface(riid, ppv);
167}

◆ ActiveScriptSiteWindow_Release()

static ULONG WINAPI ActiveScriptSiteWindow_Release ( IActiveScriptSiteWindow iface)
static

Definition at line 174 of file main.c.

175{
176 return 1;
177}

◆ create_engine()

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

Definition at line 283 of file main.c.

285{
287 IUnknown *unk;
289
290 hres = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
291 &IID_IUnknown, (void**)&unk);
292 if(FAILED(hres))
293 return FALSE;
294
295 hres = IUnknown_QueryInterface(unk, &IID_IActiveScript, (void**)&script);
296 IUnknown_Release(unk);
297 if(FAILED(hres))
298 return FALSE;
299
300 hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParse, (void**)parser);
301 if(FAILED(hres)) {
302 IActiveScript_Release(script);
303 return FALSE;
304 }
305
306 *script_ret = script;
307 return TRUE;
308}
const GUID IID_IUnknown
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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 243 of file main.c.

244{
245 WCHAR fileid[64], progid[64];
246 DWORD res;
247 LONG size;
248 HKEY hkey;
250
251 static const WCHAR script_engineW[] =
252 {'\\','S','c','r','i','p','t','E','n','g','i','n','e',0};
253
255 if(res != ERROR_SUCCESS)
256 return FALSE;
257
258 size = ARRAY_SIZE(fileid);
259 res = RegQueryValueW(hkey, NULL, fileid, &size);
260 RegCloseKey(hkey);
261 if(res != ERROR_SUCCESS)
262 return FALSE;
263
264 WINE_TRACE("fileid is %s\n", wine_dbgstr_w(fileid));
265
266 lstrcatW(fileid, script_engineW);
267 res = RegOpenKeyW(HKEY_CLASSES_ROOT, fileid, &hkey);
268 if(res != ERROR_SUCCESS)
269 return FALSE;
270
272 res = RegQueryValueW(hkey, NULL, progid, &size);
273 RegCloseKey(hkey);
274 if(res != ERROR_SUCCESS)
275 return FALSE;
276
277 WINE_TRACE("ProgID is %s\n", wine_dbgstr_w(progid));
278
280 return SUCCEEDED(hres);
281}
#define ARRAY_SIZE(a)
Definition: main.h:24
#define RegCloseKey(hKey)
Definition: registry.h:47
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3291
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4259
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 337 of file main.c.

338{
339 const char *file_map;
340 HANDLE file, map;
341 DWORD size, len;
342 BSTR ret;
343
346 return NULL;
347
352 return NULL;
353
354 file_map = MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0);
356 if(!file_map)
357 return NULL;
358
359 len = MultiByteToWideChar(CP_ACP, 0, file_map, size, NULL, 0);
361 MultiByteToWideChar(CP_ACP, 0, file_map, size, ret, len);
362
363 UnmapViewOfFile(file_map);
364 return ret;
365}
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 310 of file main.c.

311{
313
314 if(!load_typelib())
315 return FALSE;
316
317 hres = IActiveScript_SetScriptSite(script, &script_site);
318 if(FAILED(hres))
319 return FALSE;
320
322 if(FAILED(hres))
323 return FALSE;
324
325 hres = IActiveScript_AddNamedItem(script, wscriptW, SCRIPTITEM_ISVISIBLE);
326 if(FAILED(hres))
327 return FALSE;
328
329 hres = IActiveScript_AddNamedItem(script, wshW, SCRIPTITEM_ISVISIBLE);
330 if(FAILED(hres))
331 return FALSE;
332
333 hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_INITIALIZED);
334 return SUCCEEDED(hres);
335}
@ SCRIPTSTATE_INITIALIZED
Definition: activscp.idl:62
#define IActiveScriptParse_InitNew
Definition: main.c:47
static BOOL load_typelib(void)
Definition: main.c:224
static IActiveScriptSite script_site
Definition: main.c:162

Referenced by wWinMain().

◆ load_typelib()

static BOOL load_typelib ( void  )
static

Definition at line 224 of file main.c.

225{
228
229 static const WCHAR wscript_exeW[] = {'w','s','c','r','i','p','t','.','e','x','e',0};
230
231 hres = LoadTypeLib(wscript_exeW, &typelib);
232 if(FAILED(hres))
233 return FALSE;
234
235 hres = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IHost, &host_ti);
236 if(SUCCEEDED(hres))
237 hres = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IArguments2, &arguments_ti);
238
239 ITypeLib_Release(typelib);
240 return SUCCEEDED(hres);
241}
static ITypeLib * typelib
Definition: apps.c:108
ITypeInfo * arguments_ti
Definition: main.c:59
HRESULT WINAPI LoadTypeLib(const OLECHAR *szFile, ITypeLib **pptLib)
Definition: typelib.c:458

Referenced by init_engine().

◆ query_interface()

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

Definition at line 203 of file main.c.

204{
206 TRACE("(IID_IUnknown %p)\n", ppv);
207 *ppv = &script_site;
208 }else if(IsEqualGUID(riid, &IID_IActiveScriptSite)) {
209 TRACE("(IID_IActiveScriptSite %p)\n", ppv);
210 *ppv = &script_site;
211 }else if(IsEqualGUID(riid, &IID_IActiveScriptSiteWindow)) {
212 TRACE("(IID_IActiveScriptSiteWindow %p)\n", ppv);
214 }else {
215 *ppv = NULL;
216 TRACE("(%s %p)\n", wine_dbgstr_guid(riid), ppv);
217 return E_NOINTERFACE;
218 }
219
220 IUnknown_AddRef((IUnknown*)*ppv);
221 return S_OK;
222}
static IActiveScriptSiteWindow script_site_window
Definition: main.c:201
#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 367 of file main.c.

368{
369 BSTR text;
371
373 if(!text) {
374 WINE_FIXME("Could not get script text\n");
375 return;
376 }
377
379 SCRIPTTEXT_HOSTMANAGESSOURCE|SCRIPTITEM_ISVISIBLE, NULL, NULL);
381 if(FAILED(hres)) {
382 WINE_FIXME("ParseScriptText failed: %08x\n", hres);
383 return;
384 }
385
386 hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_STARTED);
387 if(FAILED(hres))
388 WINE_FIXME("SetScriptState failed: %08x\n", hres);
389}
@ SCRIPTSTATE_STARTED
Definition: activscp.idl:58
static BSTR get_script_str(const WCHAR *filename)
Definition: main.c:337
#define IActiveScriptParse_ParseScriptText
Definition: main.c:48
const WCHAR * text
Definition: package.c:1799
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 391 of file main.c.

392{
393 static const WCHAR nologoW[] = {'n','o','l','o','g','o',0};
394 static const WCHAR iactive[] = {'i',0};
395 static const WCHAR batch[] = {'b',0};
396
397 if(*prop == '/') {
398 ++prop;
399 if(*prop == '/')
400 ++prop;
401 }
402 else
403 ++prop;
404
405 if(wcsicmp(prop, iactive) == 0)
406 wshInteractive = VARIANT_TRUE;
407 else if(wcsicmp(prop, batch) == 0)
408 wshInteractive = VARIANT_FALSE;
409 else if(wcsicmp(prop, nologoW) == 0)
410 WINE_FIXME("ignored %s switch\n", debugstr_w(nologoW));
411 else
412 {
413 WINE_FIXME("unsupported switch %s\n", debugstr_w(prop));
414 return FALSE;
415 }
416 return TRUE;
417}
#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 419 of file main.c.

420{
421 WCHAR *ext, *filepart, *filename = NULL;
422 IActiveScriptParse *parser;
424 WCHAR **argv;
425 CLSID clsid;
426 int argc, i;
427 DWORD res;
428
429 WINE_TRACE("(%p %p %s %x)\n", hInst, hPrevInst, wine_dbgstr_w(cmdline), cmdshow);
430
432 if(!argv)
433 return 1;
434
435 for(i=1; i<argc; i++) {
436 if(*argv[i] == '/' || *argv[i] == '-') {
438 return 1;
439 }else {
440 filename = argv[i];
441 argums = argv+i+1;
442 numOfArgs = argc-i-1;
443 break;
444 }
445 }
446
447 if(!filename) {
448 WINE_FIXME("No file name specified\n");
449 return 1;
450 }
453 return 1;
454
455 ext = wcsrchr(filepart, '.');
456 if(!ext || !get_engine_clsid(ext, &clsid)) {
457 WINE_FIXME("Could not find engine for %s\n", wine_dbgstr_w(ext));
458 return 1;
459 }
460
462
463 if(!create_engine(&clsid, &script, &parser)) {
464 WINE_FIXME("Could not create script engine\n");
466 return 1;
467 }
468
471 IActiveScript_Close(script);
472 ITypeInfo_Release(host_ti);
473 }else {
474 WINE_FIXME("Script initialization failed\n");
475 }
476
477 IActiveScript_Release(script);
479
481
482 return 0;
483}
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:367
static BOOL get_engine_clsid(const WCHAR *ext, CLSID *clsid)
Definition: main.c:243
#define IActiveScriptParse_Release
Definition: main.c:46
static BOOL init_engine(IActiveScript *script, IActiveScriptParse *parser)
Definition: main.c:310
static BOOL create_engine(CLSID *clsid, IActiveScript **script_ret, IActiveScriptParse **parser)
Definition: main.c:283
static BOOL set_host_properties(const WCHAR *prop)
Definition: main.c:391
#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:2013
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
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
Definition: shell32_main.c:80
TCHAR * cmdline
Definition: stretchblt.cpp:32

Variable Documentation

◆ ActiveScriptSiteVtbl

IActiveScriptSiteVtbl ActiveScriptSiteVtbl
static
Initial value:
= {
}
static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface)
Definition: main.c:74
static HRESULT WINAPI ActiveScriptSite_OnLeaveScript(IActiveScriptSite *iface)
Definition: main.c:142
static HRESULT WINAPI ActiveScriptSite_OnStateChange(IActiveScriptSite *iface, SCRIPTSTATE ssScriptState)
Definition: main.c:122
static HRESULT WINAPI ActiveScriptSite_GetDocVersionString(IActiveScriptSite *iface, BSTR *pbstrVersion)
Definition: main.c:108
static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, REFIID riid, void **ppv)
Definition: main.c:63
static HRESULT WINAPI ActiveScriptSite_OnEnterScript(IActiveScriptSite *iface)
Definition: main.c:136
static ULONG WINAPI ActiveScriptSite_AddRef(IActiveScriptSite *iface)
Definition: main.c:69
static HRESULT WINAPI ActiveScriptSite_OnScriptTerminate(IActiveScriptSite *iface, const VARIANT *pvarResult, const EXCEPINFO *pexcepinfo)
Definition: main.c:115
static HRESULT WINAPI ActiveScriptSite_GetLCID(IActiveScriptSite *iface, LCID *plcid)
Definition: main.c:79
static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown **ppunkItem, ITypeInfo **ppti)
Definition: main.c:87
static HRESULT WINAPI ActiveScriptSite_OnScriptError(IActiveScriptSite *iface, IActiveScriptError *pscripterror)
Definition: main.c:129

Definition at line 148 of file main.c.

◆ ActiveScriptSiteWindowVtbl

const IActiveScriptSiteWindowVtbl ActiveScriptSiteWindowVtbl
static
Initial value:
= {
}
static ULONG WINAPI ActiveScriptSiteWindow_Release(IActiveScriptSiteWindow *iface)
Definition: main.c:174
static HRESULT WINAPI ActiveScriptSiteWindow_GetWindow(IActiveScriptSiteWindow *iface, HWND *phwnd)
Definition: main.c:179
static HRESULT WINAPI ActiveScriptSiteWindow_EnableModeless(IActiveScriptSiteWindow *iface, BOOL fEnable)
Definition: main.c:187
static HRESULT WINAPI ActiveScriptSiteWindow_QueryInterface(IActiveScriptSiteWindow *iface, REFIID riid, void **ppv)
Definition: main.c:164
static ULONG WINAPI ActiveScriptSiteWindow_AddRef(IActiveScriptSiteWindow *iface)
Definition: main.c:169

Definition at line 193 of file main.c.

◆ arguments_ti

ITypeInfo* arguments_ti

◆ host_ti

◆ script_site

IActiveScriptSite script_site = { &ActiveScriptSiteVtbl }
static

Definition at line 162 of file main.c.

Referenced by init_engine(), query_interface(), and run_script().

◆ script_site_window

IActiveScriptSiteWindow script_site_window = { &ActiveScriptSiteWindowVtbl }
static

Definition at line 201 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().