ReactOS  0.4.15-dev-1171-gab82533
host.c File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <ole2.h>
#include "wscript.h"
#include <wine/debug.h>
#include <wine/heap.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 wshNameW [] = {'W','i','n','d','o','w','s',' ','S','c','r','i','p','t',' ','H','o','s','t',0}
 
static const WCHAR wshVersionW [] = {'5','.','8'}
 
VARIANT_BOOL wshInteractive
 
static const IHostVtbl HostVtbl
 
IHost host_obj = { &HostVtbl }
 

Macro Definition Documentation

◆ BUILDVERSION

#define BUILDVERSION   16535

Definition at line 35 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 116 of file host.c.

117 {
118  return 2;
119 }

◆ Host_ConnectObject()

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

Definition at line 414 of file host.c.

415 {
416  WINE_FIXME("(%p %s)\n", Object, wine_dbgstr_w(Prefix));
417  return E_NOTIMPL;
418 }
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
static IUnknown Object
Definition: main.c:512
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:365

◆ Host_CreateObject()

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

Definition at line 292 of file host.c.

294 {
295  IUnknown *unk;
296  GUID guid;
297  HRESULT hres;
298 
299  TRACE("(%s %s %p)\n", wine_dbgstr_w(ProgID), wine_dbgstr_w(Prefix), out_Dispatch);
300 
301  if(Prefix && *Prefix) {
302  FIXME("Prefix %s not supported\n", debugstr_w(Prefix));
303  return E_NOTIMPL;
304  }
305 
306  hres = CLSIDFromProgID(ProgID, &guid);
307  if(FAILED(hres))
308  return hres;
309 
310  hres = CoCreateInstance(&guid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER,
311  &IID_IUnknown, (void**)&unk);
312  if(FAILED(hres))
313  return hres;
314 
315  hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)out_Dispatch);
316  IUnknown_Release(unk);
317  return hres;
318 }
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2602
const GUID * guid
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
const GUID IID_IUnknown
const GUID IID_IDispatch
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Host_DisconnectObject()

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

Definition at line 402 of file host.c.

403 {
404  WINE_FIXME("(%p)\n", Object);
405  return E_NOTIMPL;
406 }
static IUnknown Object
Definition: main.c:512
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:365

◆ Host_Echo()

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

Definition at line 320 of file host.c.

321 {
322  WCHAR *output = NULL, *ptr;
323  unsigned argc, i, len;
324 #ifdef __REACTOS__
325  LONG ubound, lbound;
326 #else
327  int ubound, lbound;
328 #endif
329  VARIANT *argv;
330  BSTR *strs;
331  HRESULT hres;
332 
333  TRACE("(%p)\n", args);
334 
335  if(SafeArrayGetDim(args) != 1) {
336  FIXME("Unsupported args dim %d\n", SafeArrayGetDim(args));
337  return E_NOTIMPL;
338  }
339 
340  SafeArrayGetLBound(args, 1, &lbound);
341  SafeArrayGetUBound(args, 1, &ubound);
342 
343  hres = SafeArrayAccessData(args, (void**)&argv);
344  if(FAILED(hres))
345  return hres;
346 
347  argc = ubound-lbound+1;
348  strs = heap_alloc_zero(argc*sizeof(*strs));
349  if(!strs) {
351  return E_OUTOFMEMORY;
352  }
353 
354  /* Len of spaces between arguments. */
355  len = argc-1;
356 
357  for(i=0; i < argc; i++) {
358  hres = to_string(argv+i, strs+i);
359  if(FAILED(hres))
360  break;
361 
362  len += SysStringLen(strs[i]);
363  }
364 
366  if(SUCCEEDED(hres)) {
367  ptr = output = heap_alloc((len+1)*sizeof(WCHAR));
368  if(output) {
369  for(i=0; i < argc; i++) {
370  if(i)
371  *ptr++ = ' ';
372  len = SysStringLen(strs[i]);
373  memcpy(ptr, strs[i], len*sizeof(WCHAR));
374  ptr += len;
375  }
376  *ptr = 0;
377  }else {
379  }
380  }
381 
382  for(i=0; i < argc; i++)
383  SysFreeString(strs[i]);
384  heap_free(strs);
385  if(FAILED(hres))
386  return hres;
387 
389 
390  heap_free(output);
391  return S_OK;
392 }
UINT WINAPI SafeArrayGetDim(SAFEARRAY *psa)
Definition: safearray.c:1094
static int argc
Definition: ServiceArgs.c:12
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
static void print_string(const WCHAR *string)
Definition: host.c:70
OLECHAR * BSTR
Definition: compat.h:2041
#define argv
Definition: mplay32.c:18
Definition: match.c:390
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
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 E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Definition: safearray.c:1137
long LONG
Definition: pedump.c:60
#define FIXME(fmt,...)
Definition: debug.h:111
static PVOID ptr
Definition: dispmode.c:27
static HRESULT to_string(VARIANT *src, BSTR *dst)
Definition: host.c:47
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
HRESULT WINAPI SafeArrayGetLBound(SAFEARRAY *psa, UINT nDim, LONG *plLbound)
Definition: safearray.c:1066
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
#define S_OK
Definition: intsafe.h:51
HRESULT WINAPI SafeArrayGetUBound(SAFEARRAY *psa, UINT nDim, LONG *plUbound)
Definition: safearray.c:1033
#define E_NOTIMPL
Definition: ddrawi.h:99
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
Definition: safearray.c:1168
#define SUCCEEDED(hr)
Definition: intsafe.h:49
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ Host_get_Application()

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

Definition at line 171 of file host.c.

172 {
173  WINE_TRACE("(%p)\n", out_Dispatch);
174 
175  *out_Dispatch = (IDispatch*)&host_obj;
176  return S_OK;
177 }
IHost host_obj
Definition: host.c:471
#define WINE_TRACE
Definition: debug.h:353
#define S_OK
Definition: intsafe.h:51

◆ Host_get_Arguments()

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

Definition at line 255 of file host.c.

256 {
257  WINE_TRACE("(%p)\n", out_Arguments);
258 
259  *out_Arguments = &arguments_obj;
260  return S_OK;
261 }
IArguments2 arguments_obj
Definition: arguments.c:140
#define WINE_TRACE
Definition: debug.h:353
#define S_OK
Definition: intsafe.h:51

◆ Host_get_BuildVersion()

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

Definition at line 272 of file host.c.

273 {
274  WINE_TRACE("(%p)\n", out_Build);
275 
276  *out_Build = BUILDVERSION;
277  return S_OK;
278 }
#define WINE_TRACE
Definition: debug.h:353
#define S_OK
Definition: intsafe.h:51
#define BUILDVERSION
Definition: host.c:35

◆ Host_get_FullName()

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

Definition at line 179 of file host.c.

180 {
181  WCHAR fullPath[MAX_PATH];
182 
183  WINE_TRACE("(%p)\n", out_Path);
184 
185  if(GetModuleFileNameW(NULL, fullPath, ARRAY_SIZE(fullPath)) == 0)
186  return E_FAIL;
187  if(!(*out_Path = SysAllocString(fullPath)))
188  return E_OUTOFMEMORY;
189  return S_OK;
190 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
#define WINE_TRACE
Definition: debug.h:353
#define E_FAIL
Definition: ddrawi.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define S_OK
Definition: intsafe.h:51
#define ARRAY_SIZE(a)
Definition: main.h:24

◆ Host_get_Interactive()

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

Definition at line 209 of file host.c.

210 {
211  WINE_TRACE("(%p)\n", out_Interactive);
212 
213  *out_Interactive = wshInteractive;
214  return S_OK;
215 }
#define WINE_TRACE
Definition: debug.h:353
#define S_OK
Definition: intsafe.h:51
VARIANT_BOOL wshInteractive
Definition: host.c:40

◆ Host_get_Name()

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

Definition at line 162 of file host.c.

163 {
164  WINE_TRACE("(%p)\n", out_Name);
165 
166  if(!(*out_Name = SysAllocString(wshNameW)))
167  return E_OUTOFMEMORY;
168  return S_OK;
169 }
static const WCHAR wshNameW[]
Definition: host.c:37
#define WINE_TRACE
Definition: debug.h:353
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
#define S_OK
Definition: intsafe.h:51

◆ Host_get_Path()

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

Definition at line 192 of file host.c.

193 {
195  int howMany;
196  WCHAR *pos;
197 
198  WINE_TRACE("(%p)\n", out_Path);
199 
201  return E_FAIL;
202  pos = wcsrchr(path, '\\');
203  howMany = pos - path;
204  if(!(*out_Path = SysAllocStringLen(path, howMany)))
205  return E_OUTOFMEMORY;
206  return S_OK;
207 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
GLsizei const GLchar ** path
Definition: glext.h:7234
#define WINE_TRACE
Definition: debug.h:353
#define E_FAIL
Definition: ddrawi.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define wcsrchr
Definition: compat.h:16
#define S_OK
Definition: intsafe.h:51
#define ARRAY_SIZE(a)
Definition: main.h:24

◆ Host_get_ScriptFullName()

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

Definition at line 246 of file host.c.

247 {
248  WINE_TRACE("(%p)\n", out_ScriptFullName);
249 
250  if(!(*out_ScriptFullName = SysAllocString(scriptFullName)))
251  return E_OUTOFMEMORY;
252  return S_OK;
253 }
#define WINE_TRACE
Definition: debug.h:353
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
WCHAR scriptFullName[MAX_PATH]
Definition: main.c:56
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
#define S_OK
Definition: intsafe.h:51

◆ Host_get_ScriptName()

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

Definition at line 233 of file host.c.

234 {
235  WCHAR *scriptName;
236 
237  WINE_TRACE("(%p)\n", out_ScriptName);
238 
239  scriptName = wcsrchr(scriptFullName, '\\');
240  ++scriptName;
241  if(!(*out_ScriptName = SysAllocString(scriptName)))
242  return E_OUTOFMEMORY;
243  return S_OK;
244 }
#define WINE_TRACE
Definition: debug.h:353
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
WCHAR scriptFullName[MAX_PATH]
Definition: main.c:56
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define wcsrchr
Definition: compat.h:16
#define S_OK
Definition: intsafe.h:51

◆ Host_get_StdErr()

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

Definition at line 432 of file host.c.

433 {
434  WINE_FIXME("(%p)\n", ppts);
435  return E_NOTIMPL;
436 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:365

◆ Host_get_StdIn()

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

Definition at line 420 of file host.c.

421 {
422  WINE_FIXME("(%p)\n", ppts);
423  return E_NOTIMPL;
424 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:365

◆ Host_get_StdOut()

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

Definition at line 426 of file host.c.

427 {
428  WINE_FIXME("(%p)\n", ppts);
429  return E_NOTIMPL;
430 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:365

◆ Host_get_Timeout()

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

Definition at line 280 of file host.c.

281 {
282  WINE_FIXME("(%p)\n", out_Timeout);
283  return E_NOTIMPL;
284 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:365

◆ Host_get_Version()

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

Definition at line 263 of file host.c.

264 {
265  WINE_TRACE("(%p)\n", out_Version);
266 
267  if(!(*out_Version = SysAllocString(wshVersionW)))
268  return E_OUTOFMEMORY;
269  return S_OK;
270 }
#define WINE_TRACE
Definition: debug.h:353
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
#define S_OK
Definition: intsafe.h:51
static const WCHAR wshVersionW[]
Definition: host.c:38

◆ Host_GetIDsOfNames()

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

Definition at line 143 of file host.c.

145 {
146  WINE_TRACE("(%s %p %d %x %p)\n", wine_dbgstr_guid(riid), rgszNames,
147  cNames, lcid, rgDispId);
148 
149  return ITypeInfo_GetIDsOfNames(host_ti, rgszNames, cNames, rgDispId);
150 }
REFIID riid
Definition: precomp.h:44
const char * wine_dbgstr_guid(const GUID *guid)
#define WINE_TRACE
Definition: debug.h:353
ITypeInfo * host_ti
Definition: main.c:58

◆ Host_GetObject()

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

Definition at line 394 of file host.c.

396 {
397  WINE_FIXME("(%s %s %s %p)\n", wine_dbgstr_w(Pathname), wine_dbgstr_w(ProgID),
398  wine_dbgstr_w(Prefix), out_Dispatch);
399  return E_NOTIMPL;
400 }
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:365
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING Pathname
Definition: acpixf.h:700

◆ Host_GetTypeInfo()

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

Definition at line 133 of file host.c.

135 {
136  WINE_TRACE("(%x %x %p\n", iTInfo, lcid, ppTInfo);
137 
138  ITypeInfo_AddRef(host_ti);
139  *ppTInfo = host_ti;
140  return S_OK;
141 }
#define WINE_TRACE
Definition: debug.h:353
ITypeInfo * host_ti
Definition: main.c:58
#define S_OK
Definition: intsafe.h:51

◆ Host_GetTypeInfoCount()

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

Definition at line 126 of file host.c.

127 {
128  WINE_TRACE("(%p)\n", pctinfo);
129  *pctinfo = 1;
130  return S_OK;
131 }
#define WINE_TRACE
Definition: debug.h:353
#define S_OK
Definition: intsafe.h:51

◆ 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 152 of file host.c.

155 {
156  WINE_TRACE("(%d %p %p)\n", dispIdMember, pDispParams, pVarResult);
157 
158  return ITypeInfo_Invoke(host_ti, iface, dispIdMember, wFlags, pDispParams,
159  pVarResult, pExcepInfo, puArgErr);
160 }
#define WINE_TRACE
Definition: debug.h:353
ITypeInfo * host_ti
Definition: main.c:58
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:534

◆ Host_put_Interactive()

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

Definition at line 217 of file host.c.

218 {
219  WINE_TRACE("(%x)\n", v);
220 
221  wshInteractive = v;
222  return S_OK;
223 }
#define WINE_TRACE
Definition: debug.h:353
#define S_OK
Definition: intsafe.h:51
const GLdouble * v
Definition: gl.h:2040
VARIANT_BOOL wshInteractive
Definition: host.c:40

◆ Host_put_Timeout()

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

Definition at line 286 of file host.c.

287 {
288  WINE_FIXME("(%d)\n", v);
289  return E_NOTIMPL;
290 }
const GLdouble * v
Definition: gl.h:2040
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:365

◆ Host_QueryInterface()

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

Definition at line 101 of file host.c.

102 {
103  WINE_TRACE("(%s %p)\n", wine_dbgstr_guid(riid), ppv);
104 
107  || IsEqualGUID(&IID_IHost, riid)) {
108  *ppv = iface;
109  return S_OK;
110  }
111 
112  *ppv = NULL;
113  return E_NOINTERFACE;
114 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
const char * wine_dbgstr_guid(const GUID *guid)
#define WINE_TRACE
Definition: debug.h:353
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
const GUID IID_IDispatch
#define S_OK
Definition: intsafe.h:51
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ Host_Quit()

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

Definition at line 225 of file host.c.

226 {
227  FIXME("(%d) semi-stub: no script engine clean up\n", ExitCode);
228 
229  ExitProcess(ExitCode);
230  return S_OK;
231 }
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1487
#define FIXME(fmt,...)
Definition: debug.h:111
#define S_OK
Definition: intsafe.h:51

◆ Host_Release()

static ULONG WINAPI Host_Release ( IHost *  iface)
static

Definition at line 121 of file host.c.

122 {
123  return 1;
124 }

◆ Host_Sleep()

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

Definition at line 408 of file host.c.

409 {
410  WINE_FIXME("(%d)\n", Time);
411  return E_NOTIMPL;
412 }
#define E_NOTIMPL
Definition: ddrawi.h:99
static PLARGE_INTEGER Time
Definition: time.c:105
#define WINE_FIXME
Definition: debug.h:365

◆ print_string()

static void print_string ( const WCHAR string)
static

Definition at line 70 of file host.c.

71 {
72  DWORD count, ret, len, lena;
73  char *buf;
74 
75  if(wshInteractive) {
76  static const WCHAR windows_script_hostW[] =
77  {'W','i','n','d','o','w','s',' ','S','c','r','i','p','t',' ','H','o','s','t',0};
78  MessageBoxW(NULL, string, windows_script_hostW, MB_OK);
79  return;
80  }
81 
82  len = lstrlenW(string);
84  if(ret) {
85  static const WCHAR crnlW[] = {'\r','\n'};
87  return;
88  }
89 
90  lena = WideCharToMultiByte(GetConsoleOutputCP(), 0, string, len, NULL, 0, NULL, NULL);
91  buf = heap_alloc(len);
92  if(!buf)
93  return;
94 
95  WideCharToMultiByte(GetConsoleOutputCP(), 0, string, len, buf, lena, NULL, NULL);
97  heap_free(buf);
99 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define WideCharToMultiByte
Definition: compat.h:111
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleW(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
Definition: readwrite.c:1447
GLuint GLuint GLsizei count
Definition: gl.h:1545
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:200
#define lstrlenW
Definition: compat.h:498
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define FALSE
Definition: types.h:117
UINT WINAPI DECLSPEC_HOTPATCH GetConsoleOutputCP(VOID)
Definition: console.c:2453
smooth NULL
Definition: ftsmooth.c:416
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define STD_OUTPUT_HANDLE
Definition: winbase.h:265
#define ARRAY_SIZE(a)
Definition: main.h:24
#define MB_OK
Definition: winuser.h:784
VARIANT_BOOL wshInteractive
Definition: host.c:40
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by Host_Echo().

◆ to_string()

static HRESULT to_string ( VARIANT src,
BSTR dst 
)
static

Definition at line 47 of file host.c.

48 {
49  VARIANT v;
50  HRESULT hres;
51 
52  static const WCHAR nullW[] = {'n','u','l','l',0};
53 
54  if(V_VT(src) == VT_NULL) {
56  return *dst ? S_OK : E_OUTOFMEMORY;
57  }
58 
59  V_VT(&v) = VT_EMPTY;
61  if(FAILED(hres)) {
62  WARN("Could not convert argument %s to string\n", debugstr_variant(src));
63  return hres;
64  }
65 
66  *dst = V_BSTR(&v);
67  return S_OK;
68 }
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962
#define WARN(fmt,...)
Definition: debug.h:112
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define V_VT(A)
Definition: oleauto.h:211
GLenum src
Definition: glext.h:6340
#define V_BSTR(A)
Definition: oleauto.h:226
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define S_OK
Definition: intsafe.h:51
const GLdouble * v
Definition: gl.h:2040
GLenum GLenum dst
Definition: glext.h:6340
static const WCHAR nullW[]
Definition: json.c:32

Referenced by add_eval(), array_join(), construct_function(), DateConstr_parse(), do_attribute_tag_format(), error_constr(), Error_toString(), get_string_val(), Host_Echo(), interp_delete(), maybe_to_primitive(), Number_toExponential(), Number_toFixed(), Number_toPrecision(), Number_toString(), Object_hasOwnProperty(), rep_call(), sort_cmp(), String_concat(), String_match(), and StringConstr_value().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wscript  )

Variable Documentation

◆ host_obj

IHost host_obj = { &HostVtbl }

Definition at line 471 of file host.c.

Referenced by ActiveScriptSite_GetItemInfo(), and Host_get_Application().

◆ HostVtbl

const IHostVtbl HostVtbl
static

Definition at line 438 of file host.c.

◆ wshInteractive

VARIANT_BOOL wshInteractive
Initial value:
=
VARIANT_TRUE

Definition at line 40 of file host.c.

Referenced by Host_get_Interactive(), Host_put_Interactive(), print_string(), and set_host_properties().

◆ wshNameW

const WCHAR wshNameW[] = {'W','i','n','d','o','w','s',' ','S','c','r','i','p','t',' ','H','o','s','t',0}
static

Definition at line 37 of file host.c.

Referenced by Host_get_Name().

◆ wshVersionW

const WCHAR wshVersionW[] = {'5','.','8'}
static

Definition at line 38 of file host.c.

Referenced by Host_get_Version().