ReactOS 0.4.17-dev-357-ga8f14ff
host.c File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <ole2.h>
#include "wscript.h"
#include <wine/debug.h>
Include dependency graph for host.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define BUILDVERSION   16535
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wscript)
 
static HRESULT to_string (VARIANT *src, BSTR *dst)
 
static void print_string (const WCHAR *string)
 
static HRESULT WINAPI Host_QueryInterface (IHost *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI Host_AddRef (IHost *iface)
 
static ULONG WINAPI Host_Release (IHost *iface)
 
static HRESULT WINAPI Host_GetTypeInfoCount (IHost *iface, UINT *pctinfo)
 
static HRESULT WINAPI Host_GetTypeInfo (IHost *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI Host_GetIDsOfNames (IHost *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI Host_Invoke (IHost *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI Host_get_Name (IHost *iface, BSTR *out_Name)
 
static HRESULT WINAPI Host_get_Application (IHost *iface, IDispatch **out_Dispatch)
 
static HRESULT WINAPI Host_get_FullName (IHost *iface, BSTR *out_Path)
 
static HRESULT WINAPI Host_get_Path (IHost *iface, BSTR *out_Path)
 
static HRESULT WINAPI Host_get_Interactive (IHost *iface, VARIANT_BOOL *out_Interactive)
 
static HRESULT WINAPI Host_put_Interactive (IHost *iface, VARIANT_BOOL v)
 
static HRESULT WINAPI Host_Quit (IHost *iface, int ExitCode)
 
static HRESULT WINAPI Host_get_ScriptName (IHost *iface, BSTR *out_ScriptName)
 
static HRESULT WINAPI Host_get_ScriptFullName (IHost *iface, BSTR *out_ScriptFullName)
 
static HRESULT WINAPI Host_get_Arguments (IHost *iface, IArguments2 **out_Arguments)
 
static HRESULT WINAPI Host_get_Version (IHost *iface, BSTR *out_Version)
 
static HRESULT WINAPI Host_get_BuildVersion (IHost *iface, int *out_Build)
 
static HRESULT WINAPI Host_get_Timeout (IHost *iface, LONG *out_Timeout)
 
static HRESULT WINAPI Host_put_Timeout (IHost *iface, LONG v)
 
static HRESULT WINAPI Host_CreateObject (IHost *iface, BSTR ProgID, BSTR Prefix, IDispatch **out_Dispatch)
 
static HRESULT WINAPI Host_Echo (IHost *iface, SAFEARRAY *args)
 
static HRESULT WINAPI Host_GetObject (IHost *iface, BSTR Pathname, BSTR ProgID, BSTR Prefix, IDispatch **out_Dispatch)
 
static HRESULT WINAPI Host_DisconnectObject (IHost *iface, IDispatch *Object)
 
static HRESULT WINAPI Host_Sleep (IHost *iface, LONG Time)
 
static HRESULT WINAPI Host_ConnectObject (IHost *iface, IDispatch *Object, BSTR Prefix)
 
static HRESULT WINAPI Host_get_StdIn (IHost *iface, ITextStream **ppts)
 
static HRESULT WINAPI Host_get_StdOut (IHost *iface, ITextStream **ppts)
 
static HRESULT WINAPI Host_get_StdErr (IHost *iface, ITextStream **ppts)
 

Variables

static const WCHAR wshVersionW [] = L"5.8"
 
VARIANT_BOOL wshInteractive
 
LONG wshTimeout = 0
 
static const IHostVtbl HostVtbl
 
IHost host_obj = { &HostVtbl }
 

Macro Definition Documentation

◆ BUILDVERSION

#define BUILDVERSION   16535

Definition at line 34 of file host.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file host.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 22 of file host.c.

Function Documentation

◆ Host_AddRef()

static ULONG WINAPI Host_AddRef ( IHost *  iface)
static

Definition at line 110 of file host.c.

111{
112 return 2;
113}

◆ Host_ConnectObject()

static HRESULT WINAPI Host_ConnectObject ( IHost *  iface,
IDispatch Object,
BSTR  Prefix 
)
static

Definition at line 417 of file host.c.

418{
419 WINE_FIXME("(%p %s)\n", Object, wine_dbgstr_w(Prefix));
420 return E_NOTIMPL;
421}
#define E_NOTIMPL
Definition: ddrawi.h:99
#define wine_dbgstr_w
Definition: kernel32.h:34
#define WINE_FIXME
Definition: debug.h:340
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1647

◆ Host_CreateObject()

static HRESULT WINAPI Host_CreateObject ( IHost *  iface,
BSTR  ProgID,
BSTR  Prefix,
IDispatch **  out_Dispatch 
)
static

Definition at line 293 of file host.c.

295{
296 IUnknown *unk;
297 GUID guid;
299
300 TRACE("(%s %s %p)\n", wine_dbgstr_w(ProgID), wine_dbgstr_w(Prefix), out_Dispatch);
301
302 if(Prefix && *Prefix) {
303 FIXME("Prefix %s not supported\n", debugstr_w(Prefix));
304 return E_NOTIMPL;
305 }
306
307 hres = CLSIDFromProgID(ProgID, &guid);
308 if(FAILED(hres))
309 return hres;
310
311 hres = CoCreateInstance(&guid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER,
312 &IID_IUnknown, (void**)&unk);
313 if(FAILED(hres))
314 return hres;
315
316 hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)out_Dispatch);
317 IUnknown_Release(unk);
318 return hres;
319}
#define FIXME(fmt,...)
Definition: precomp.h:53
const GUID IID_IUnknown
#define NULL
Definition: types.h:112
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, CLSID *clsid)
Definition: combase.c:1437
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
GUID guid
Definition: version.c:147
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_w
Definition: kernel32.h:32
HRESULT hres
Definition: protocol.c:465
const GUID IID_IDispatch
#define TRACE(s)
Definition: solgame.cpp:4

◆ Host_DisconnectObject()

static HRESULT WINAPI Host_DisconnectObject ( IHost *  iface,
IDispatch Object 
)
static

Definition at line 399 of file host.c.

400{
401 WINE_FIXME("(%p)\n", Object);
402 return E_NOTIMPL;
403}

◆ Host_Echo()

static HRESULT WINAPI Host_Echo ( IHost *  iface,
SAFEARRAY args 
)
static

Definition at line 321 of file host.c.

322{
323 WCHAR *output = NULL, *ptr;
324 unsigned argc, i, len;
325 LONG ubound, lbound;
326 VARIANT *argv;
327 BSTR *strs;
329
330 TRACE("(%p)\n", args);
331
332 if(SafeArrayGetDim(args) != 1) {
333 FIXME("Unsupported args dim %d\n", SafeArrayGetDim(args));
334 return E_NOTIMPL;
335 }
336
337 SafeArrayGetLBound(args, 1, &lbound);
338 SafeArrayGetUBound(args, 1, &ubound);
339
340 hres = SafeArrayAccessData(args, (void**)&argv);
341 if(FAILED(hres))
342 return hres;
343
344 argc = ubound-lbound+1;
345 if (!(strs = calloc(argc, sizeof(*strs))))
346 {
348 return E_OUTOFMEMORY;
349 }
350
351 /* Len of spaces between arguments. */
352 len = argc-1;
353
354 for(i=0; i < argc; i++) {
355 hres = to_string(argv+i, strs+i);
356 if(FAILED(hres))
357 break;
358
359 len += SysStringLen(strs[i]);
360 }
361
363 if(SUCCEEDED(hres)) {
364 ptr = output = malloc((len+1)*sizeof(WCHAR));
365 if(output) {
366 for(i=0; i < argc; i++) {
367 if(i)
368 *ptr++ = ' ';
369 len = SysStringLen(strs[i]);
370 memcpy(ptr, strs[i], len*sizeof(WCHAR));
371 ptr += len;
372 }
373 *ptr = 0;
374 }else {
376 }
377 }
378
379 for(i=0; i < argc; i++)
380 SysFreeString(strs[i]);
381 free(strs);
382 if(FAILED(hres))
383 return hres;
384
385 print_string(output);
386
387 free(output);
388 return S_OK;
389}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
OLECHAR * BSTR
Definition: compat.h:2293
MonoAssembly int argc
Definition: metahost.c:107
HRESULT WINAPI SafeArrayGetUBound(SAFEARRAY *psa, UINT nDim, LONG *plUbound)
Definition: safearray.c:1033
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Definition: safearray.c:1137
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
Definition: safearray.c:1168
UINT WINAPI SafeArrayGetDim(SAFEARRAY *psa)
Definition: safearray.c:1094
HRESULT WINAPI SafeArrayGetLBound(SAFEARRAY *psa, UINT nDim, LONG *plLbound)
Definition: safearray.c:1066
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
static void print_string(const WCHAR *string)
Definition: host.c:67
static HRESULT to_string(VARIANT *src, BSTR *dst)
Definition: host.c:46
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
#define argv
Definition: mplay32.c:18
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
#define calloc
Definition: rosglue.h:14
Definition: match.c:390

◆ Host_get_Application()

static HRESULT WINAPI Host_get_Application ( IHost *  iface,
IDispatch **  out_Dispatch 
)
static

Definition at line 165 of file host.c.

166{
167 WINE_TRACE("(%p)\n", out_Dispatch);
168
169 *out_Dispatch = (IDispatch*)&host_obj;
170 return S_OK;
171}
IHost host_obj
Definition: host.c:474
#define WINE_TRACE
Definition: debug.h:328

◆ Host_get_Arguments()

static HRESULT WINAPI Host_get_Arguments ( IHost *  iface,
IArguments2 **  out_Arguments 
)
static

Definition at line 249 of file host.c.

250{
251 WINE_TRACE("(%p)\n", out_Arguments);
252
253 *out_Arguments = &arguments_obj;
254 return S_OK;
255}
IArguments2 arguments_obj
Definition: arguments.c:140

◆ Host_get_BuildVersion()

static HRESULT WINAPI Host_get_BuildVersion ( IHost *  iface,
int out_Build 
)
static

Definition at line 266 of file host.c.

267{
268 WINE_TRACE("(%p)\n", out_Build);
269
270 *out_Build = BUILDVERSION;
271 return S_OK;
272}
#define BUILDVERSION
Definition: host.c:34

◆ Host_get_FullName()

static HRESULT WINAPI Host_get_FullName ( IHost *  iface,
BSTR out_Path 
)
static

Definition at line 173 of file host.c.

174{
175 WCHAR fullPath[MAX_PATH];
176
177 WINE_TRACE("(%p)\n", out_Path);
178
179 if(GetModuleFileNameW(NULL, fullPath, ARRAY_SIZE(fullPath)) == 0)
180 return E_FAIL;
181 if(!(*out_Path = SysAllocString(fullPath)))
182 return E_OUTOFMEMORY;
183 return S_OK;
184}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define E_FAIL
Definition: ddrawi.h:102
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238

◆ Host_get_Interactive()

static HRESULT WINAPI Host_get_Interactive ( IHost *  iface,
VARIANT_BOOL out_Interactive 
)
static

Definition at line 203 of file host.c.

204{
205 WINE_TRACE("(%p)\n", out_Interactive);
206
207 *out_Interactive = wshInteractive;
208 return S_OK;
209}
VARIANT_BOOL wshInteractive
Definition: host.c:37

◆ Host_get_Name()

static HRESULT WINAPI Host_get_Name ( IHost *  iface,
BSTR out_Name 
)
static

Definition at line 156 of file host.c.

157{
158 WINE_TRACE("(%p)\n", out_Name);
159
160 if(!(*out_Name = SysAllocString(L"Windows Script Host")))
161 return E_OUTOFMEMORY;
162 return S_OK;
163}
#define L(x)
Definition: resources.c:13

◆ Host_get_Path()

static HRESULT WINAPI Host_get_Path ( IHost *  iface,
BSTR out_Path 
)
static

Definition at line 186 of file host.c.

187{
189 int howMany;
190 WCHAR *pos;
191
192 WINE_TRACE("(%p)\n", out_Path);
193
195 return E_FAIL;
196 pos = wcsrchr(path, '\\');
197 howMany = pos - path;
198 if(!(*out_Path = SysAllocStringLen(path, howMany)))
199 return E_OUTOFMEMORY;
200 return S_OK;
201}
#define wcsrchr
Definition: compat.h:16
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339

◆ Host_get_ScriptFullName()

static HRESULT WINAPI Host_get_ScriptFullName ( IHost *  iface,
BSTR out_ScriptFullName 
)
static

Definition at line 240 of file host.c.

241{
242 WINE_TRACE("(%p)\n", out_ScriptFullName);
243
244 if(!(*out_ScriptFullName = SysAllocString(scriptFullName)))
245 return E_OUTOFMEMORY;
246 return S_OK;
247}
WCHAR scriptFullName[MAX_PATH]
Definition: main.c:54

◆ Host_get_ScriptName()

static HRESULT WINAPI Host_get_ScriptName ( IHost *  iface,
BSTR out_ScriptName 
)
static

Definition at line 227 of file host.c.

228{
229 WCHAR *scriptName;
230
231 WINE_TRACE("(%p)\n", out_ScriptName);
232
233 scriptName = wcsrchr(scriptFullName, '\\');
234 ++scriptName;
235 if(!(*out_ScriptName = SysAllocString(scriptName)))
236 return E_OUTOFMEMORY;
237 return S_OK;
238}

◆ Host_get_StdErr()

static HRESULT WINAPI Host_get_StdErr ( IHost *  iface,
ITextStream **  ppts 
)
static

Definition at line 435 of file host.c.

436{
437 WINE_FIXME("(%p)\n", ppts);
438 return E_NOTIMPL;
439}

◆ Host_get_StdIn()

static HRESULT WINAPI Host_get_StdIn ( IHost *  iface,
ITextStream **  ppts 
)
static

Definition at line 423 of file host.c.

424{
425 WINE_FIXME("(%p)\n", ppts);
426 return E_NOTIMPL;
427}

◆ Host_get_StdOut()

static HRESULT WINAPI Host_get_StdOut ( IHost *  iface,
ITextStream **  ppts 
)
static

Definition at line 429 of file host.c.

430{
431 WINE_FIXME("(%p)\n", ppts);
432 return E_NOTIMPL;
433}

◆ Host_get_Timeout()

static HRESULT WINAPI Host_get_Timeout ( IHost *  iface,
LONG out_Timeout 
)
static

Definition at line 274 of file host.c.

275{
276 TRACE("(%p)\n", out_Timeout);
277
278 *out_Timeout = wshTimeout;
279 return S_OK;
280}
LONG wshTimeout
Definition: host.c:44

◆ Host_get_Version()

static HRESULT WINAPI Host_get_Version ( IHost *  iface,
BSTR out_Version 
)
static

Definition at line 257 of file host.c.

258{
259 WINE_TRACE("(%p)\n", out_Version);
260
261 if(!(*out_Version = SysAllocString(wshVersionW)))
262 return E_OUTOFMEMORY;
263 return S_OK;
264}
static const WCHAR wshVersionW[]
Definition: host.c:35

◆ Host_GetIDsOfNames()

static HRESULT WINAPI Host_GetIDsOfNames ( IHost *  iface,
REFIID  riid,
LPOLESTR *  rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 137 of file host.c.

139{
140 WINE_TRACE("(%s %p %d %lx %p)\n", wine_dbgstr_guid(riid), rgszNames,
141 cNames, lcid, rgDispId);
142
143 return ITypeInfo_GetIDsOfNames(host_ti, rgszNames, cNames, rgDispId);
144}
ITypeInfo * host_ti
Definition: main.c:56
LCID lcid
Definition: locale.c:5660
REFIID riid
Definition: atlbase.h:39
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:171

◆ Host_GetObject()

static HRESULT WINAPI Host_GetObject ( IHost *  iface,
BSTR  Pathname,
BSTR  ProgID,
BSTR  Prefix,
IDispatch **  out_Dispatch 
)
static

Definition at line 391 of file host.c.

393{
394 WINE_FIXME("(%s %s %s %p)\n", wine_dbgstr_w(Pathname), wine_dbgstr_w(ProgID),
395 wine_dbgstr_w(Prefix), out_Dispatch);
396 return E_NOTIMPL;
397}

◆ Host_GetTypeInfo()

static HRESULT WINAPI Host_GetTypeInfo ( IHost *  iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 127 of file host.c.

129{
130 WINE_TRACE("(%x %lx %p\n", iTInfo, lcid, ppTInfo);
131
132 ITypeInfo_AddRef(host_ti);
133 *ppTInfo = host_ti;
134 return S_OK;
135}

◆ Host_GetTypeInfoCount()

static HRESULT WINAPI Host_GetTypeInfoCount ( IHost *  iface,
UINT pctinfo 
)
static

Definition at line 120 of file host.c.

121{
122 WINE_TRACE("(%p)\n", pctinfo);
123 *pctinfo = 1;
124 return S_OK;
125}

◆ Host_Invoke()

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

Definition at line 146 of file host.c.

149{
150 WINE_TRACE("(%ld %p %p)\n", dispIdMember, pDispParams, pVarResult);
151
152 return ITypeInfo_Invoke(host_ti, iface, dispIdMember, wFlags, pDispParams,
153 pVarResult, pExcepInfo, puArgErr);
154}
WINBASEAPI _In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon_undoc.h:337

◆ Host_put_Interactive()

static HRESULT WINAPI Host_put_Interactive ( IHost *  iface,
VARIANT_BOOL  v 
)
static

Definition at line 211 of file host.c.

212{
213 WINE_TRACE("(%x)\n", v);
214
216 return S_OK;
217}
const GLdouble * v
Definition: gl.h:2040

◆ Host_put_Timeout()

static HRESULT WINAPI Host_put_Timeout ( IHost *  iface,
LONG  v 
)
static

Definition at line 282 of file host.c.

283{
284 TRACE("(%ld)\n", v);
285
286 if(v < 0)
287 return E_INVALIDARG;
288 wshTimeout = v;
290 return S_OK;
291}
void schedule_timeout(LONG seconds)
Definition: main.c:416
#define E_INVALIDARG
Definition: ddrawi.h:101

◆ Host_QueryInterface()

static HRESULT WINAPI Host_QueryInterface ( IHost *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 95 of file host.c.

96{
97 WINE_TRACE("(%s %p)\n", wine_dbgstr_guid(riid), ppv);
98
101 || IsEqualGUID(&IID_IHost, riid)) {
102 *ppv = iface;
103 return S_OK;
104 }
105
106 *ppv = NULL;
107 return E_NOINTERFACE;
108}
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ Host_Quit()

static HRESULT WINAPI Host_Quit ( IHost *  iface,
int  ExitCode 
)
static

Definition at line 219 of file host.c.

220{
221 FIXME("(%d) semi-stub: no script engine clean up\n", ExitCode);
222
223 ExitProcess(ExitCode);
224 return S_OK;
225}
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1330

◆ Host_Release()

static ULONG WINAPI Host_Release ( IHost *  iface)
static

Definition at line 115 of file host.c.

116{
117 return 1;
118}

◆ Host_Sleep()

static HRESULT WINAPI Host_Sleep ( IHost *  iface,
LONG  Time 
)
static

Definition at line 405 of file host.c.

406{
407#ifdef __REACTOS__
409#endif
410 TRACE("(%ld)\n", Time);
411 if (Time < 0)
412 return E_INVALIDARG;
413 Sleep(Time);
414 return S_OK;
415}
static PLARGE_INTEGER Time
Definition: time.c:37
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:726

◆ print_string()

static void print_string ( const WCHAR string)
static

Definition at line 67 of file host.c.

68{
69 DWORD count, ret, len, lena;
70 char *buf;
71
72 if(wshInteractive) {
73 MessageBoxW(NULL, string, L"Windows Script Host", MB_OK);
74 return;
75 }
76
77 len = lstrlenW(string);
79 if(ret) {
81 return;
82 }
83
84 lena = WideCharToMultiByte(GetOEMCP(), 0, string, len, NULL, 0, NULL, NULL);
85 buf = malloc(len);
86 if(!buf)
87 return;
88
89 WideCharToMultiByte(GetOEMCP(), 0, string, len, buf, lena, NULL, NULL);
91 free(buf);
93}
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:203
#define FALSE
Definition: types.h:117
#define WideCharToMultiByte
Definition: compat.h:111
#define lstrlenW
Definition: compat.h:750
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleW(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
Definition: readwrite.c:1447
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
Definition: rw.c:25
UINT WINAPI GetOEMCP(void)
Definition: locale.c:2062
return ret
Definition: mutex.c:146
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define STD_OUTPUT_HANDLE
Definition: winbase.h:293
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_OK
Definition: winuser.h:801

Referenced by Host_Echo().

◆ to_string()

static HRESULT to_string ( VARIANT src,
BSTR dst 
)
static

Definition at line 46 of file host.c.

47{
48 VARIANT v;
50
51 if(V_VT(src) == VT_NULL) {
52 *dst = SysAllocString(L"null");
53 return *dst ? S_OK : E_OUTOFMEMORY;
54 }
55
56 V_VT(&v) = VT_EMPTY;
58 if(FAILED(hres)) {
59 WARN("Could not convert argument %s to string\n", debugstr_variant(src));
60 return hres;
61 }
62
63 *dst = V_BSTR(&v);
64 return S_OK;
65}
#define WARN(fmt,...)
Definition: precomp.h:61
@ VT_BSTR
Definition: compat.h:2303
@ VT_NULL
Definition: compat.h:2296
@ VT_EMPTY
Definition: compat.h:2295
static const char * debugstr_variant(const VARIANT *var)
Definition: dom.c:505
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962

Referenced by array_join(), Array_join(), Array_toString(), construct_function(), create_regexp_var(), DateConstr_parse(), do_attribute_tag_format(), error_constr(), Error_toString(), get_string_val(), Host_Echo(), interp_add(), interp_delete(), interp_to_string(), localize_number(), maybe_to_primitive(), Number_toExponential(), Number_toFixed(), Number_toPrecision(), Number_toString(), Object_hasOwnProperty(), rep_call(), set_error_value(), sort_cmp(), String_concat(), String_match(), StringConstr_value(), and to_locale_string().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wscript  )

Variable Documentation

◆ host_obj

◆ HostVtbl

const IHostVtbl HostVtbl
static

Definition at line 441 of file host.c.

◆ wshInteractive

VARIANT_BOOL wshInteractive
Initial value:
=
VARIANT_TRUE

Definition at line 37 of file host.c.

Referenced by Host_get_Interactive(), Host_put_Interactive(), output_formatstring(), print_error(), print_string(), set_host_properties(), and wWinMain().

◆ wshTimeout

LONG wshTimeout = 0

Definition at line 44 of file host.c.

Referenced by Host_get_Timeout(), Host_put_Timeout(), set_host_properties(), and wWinMain().

◆ wshVersionW

const WCHAR wshVersionW[] = L"5.8"
static

Definition at line 35 of file host.c.

Referenced by Host_get_Version().