ReactOS  0.4.11-dev-721-g95bc44e
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 <wine/unicode.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

#define BUILDVERSION   16535

Definition at line 36 of file host.c.

Referenced by Host_get_BuildVersion().

#define COBJMACROS

Definition at line 21 of file host.c.

#define CONST_VTABLE

Definition at line 22 of file host.c.

Function Documentation

static ULONG WINAPI Host_AddRef ( IHost *  iface)
static

Definition at line 117 of file host.c.

118 {
119  return 2;
120 }
static HRESULT WINAPI Host_ConnectObject ( IHost *  iface,
IDispatch Object,
BSTR  Prefix 
)
static

Definition at line 415 of file host.c.

416 {
417  WINE_FIXME("(%p %s)\n", Object, wine_dbgstr_w(Prefix));
418  return E_NOTIMPL;
419 }
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:370
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;
298  HRESULT hres;
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 }
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
const GUID IID_IUnknown
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2514
const GUID * guid
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IDispatch
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3237
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI Host_DisconnectObject ( IHost *  iface,
IDispatch Object 
)
static

Definition at line 403 of file host.c.

404 {
405  WINE_FIXME("(%p)\n", Object);
406  return E_NOTIMPL;
407 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:370
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 #ifdef __REACTOS__
326  LONG ubound, lbound;
327 #else
328  int ubound, lbound;
329 #endif
330  VARIANT *argv;
331  BSTR *strs;
332  HRESULT hres;
333 
334  TRACE("(%p)\n", args);
335 
336  if(SafeArrayGetDim(args) != 1) {
337  FIXME("Unsupported args dim %d\n", SafeArrayGetDim(args));
338  return E_NOTIMPL;
339  }
340 
341  SafeArrayGetLBound(args, 1, &lbound);
342  SafeArrayGetUBound(args, 1, &ubound);
343 
344  hres = SafeArrayAccessData(args, (void**)&argv);
345  if(FAILED(hres))
346  return hres;
347 
348  argc = ubound-lbound+1;
349  strs = heap_alloc_zero(argc*sizeof(*strs));
350  if(!strs) {
351  SafeArrayUnaccessData(args);
352  return E_OUTOFMEMORY;
353  }
354 
355  /* Len of spaces between arguments. */
356  len = argc-1;
357 
358  for(i=0; i < argc; i++) {
359  hres = to_string(argv+i, strs+i);
360  if(FAILED(hres))
361  break;
362 
363  len += SysStringLen(strs[i]);
364  }
365 
366  SafeArrayUnaccessData(args);
367  if(SUCCEEDED(hres)) {
368  ptr = output = heap_alloc((len+1)*sizeof(WCHAR));
369  if(output) {
370  for(i=0; i < argc; i++) {
371  if(i)
372  *ptr++ = ' ';
373  len = SysStringLen(strs[i]);
374  memcpy(ptr, strs[i], len*sizeof(WCHAR));
375  ptr += len;
376  }
377  *ptr = 0;
378  }else {
379  hres = E_OUTOFMEMORY;
380  }
381  }
382 
383  for(i=0; i < argc; i++)
384  SysFreeString(strs[i]);
385  heap_free(strs);
386  if(FAILED(hres))
387  return hres;
388 
389  print_string(output);
390 
391  heap_free(output);
392  return S_OK;
393 }
UINT WINAPI SafeArrayGetDim(SAFEARRAY *psa)
Definition: safearray.c:1096
static int argc
Definition: ServiceArgs.c:12
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
__wchar_t WCHAR
Definition: xmlstorage.h:180
void WINAPI SysFreeString(BSTR str)
Definition: oleaut.c:275
static void print_string(const WCHAR *string)
Definition: host.c:71
OLECHAR * BSTR
Definition: compat.h:1927
static char ** argv
Definition: ServiceArgs.c:11
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Definition: safearray.c:1139
long LONG
Definition: pedump.c:60
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
static HRESULT to_string(VARIANT *src, BSTR *dst)
Definition: host.c:48
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI SafeArrayGetLBound(SAFEARRAY *psa, UINT nDim, LONG *plLbound)
Definition: safearray.c:1068
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:200
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI SafeArrayGetUBound(SAFEARRAY *psa, UINT nDim, LONG *plUbound)
Definition: safearray.c:1035
#define E_NOTIMPL
Definition: ddrawi.h:99
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
Definition: safearray.c:1170
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static HRESULT WINAPI Host_get_Application ( IHost *  iface,
IDispatch **  out_Dispatch 
)
static

Definition at line 172 of file host.c.

173 {
174  WINE_TRACE("(%p)\n", out_Dispatch);
175 
176  *out_Dispatch = (IDispatch*)&host_obj;
177  return S_OK;
178 }
IHost host_obj
Definition: host.c:472
#define WINE_TRACE
Definition: debug.h:358
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI Host_get_Arguments ( IHost *  iface,
IArguments2 **  out_Arguments 
)
static

Definition at line 256 of file host.c.

257 {
258  WINE_TRACE("(%p)\n", out_Arguments);
259 
260  *out_Arguments = &arguments_obj;
261  return S_OK;
262 }
IArguments2 arguments_obj
Definition: arguments.c:140
#define WINE_TRACE
Definition: debug.h:358
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI Host_get_BuildVersion ( IHost *  iface,
int out_Build 
)
static

Definition at line 273 of file host.c.

274 {
275  WINE_TRACE("(%p)\n", out_Build);
276 
277  *out_Build = BUILDVERSION;
278  return S_OK;
279 }
#define WINE_TRACE
Definition: debug.h:358
#define S_OK
Definition: intsafe.h:59
#define BUILDVERSION
Definition: host.c:36
static HRESULT WINAPI Host_get_FullName ( IHost *  iface,
BSTR out_Path 
)
static

Definition at line 180 of file host.c.

181 {
182  WCHAR fullPath[MAX_PATH];
183 
184  WINE_TRACE("(%p)\n", out_Path);
185 
186  if(GetModuleFileNameW(NULL, fullPath, ARRAY_SIZE(fullPath)) == 0)
187  return E_FAIL;
188  if(!(*out_Path = SysAllocString(fullPath)))
189  return E_OUTOFMEMORY;
190  return S_OK;
191 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:607
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WINE_TRACE
Definition: debug.h:358
#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:242
#define MAX_PATH
Definition: compat.h:26
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
static HRESULT WINAPI Host_get_Interactive ( IHost *  iface,
VARIANT_BOOL out_Interactive 
)
static

Definition at line 210 of file host.c.

211 {
212  WINE_TRACE("(%p)\n", out_Interactive);
213 
214  *out_Interactive = wshInteractive;
215  return S_OK;
216 }
#define WINE_TRACE
Definition: debug.h:358
#define S_OK
Definition: intsafe.h:59
VARIANT_BOOL wshInteractive
Definition: host.c:41
static HRESULT WINAPI Host_get_Name ( IHost *  iface,
BSTR out_Name 
)
static

Definition at line 163 of file host.c.

164 {
165  WINE_TRACE("(%p)\n", out_Name);
166 
167  if(!(*out_Name = SysAllocString(wshNameW)))
168  return E_OUTOFMEMORY;
169  return S_OK;
170 }
static const WCHAR wshNameW[]
Definition: host.c:38
#define WINE_TRACE
Definition: debug.h:358
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:242
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI Host_get_Path ( IHost *  iface,
BSTR out_Path 
)
static

Definition at line 193 of file host.c.

194 {
196  int howMany;
197  WCHAR *pos;
198 
199  WINE_TRACE("(%p)\n", out_Path);
200 
201  if(GetModuleFileNameW(NULL, path, ARRAY_SIZE(path)) == 0)
202  return E_FAIL;
203  pos = strrchrW(path, '\\');
204  howMany = pos - path;
205  if(!(*out_Path = SysAllocStringLen(path, howMany)))
206  return E_OUTOFMEMORY;
207  return S_OK;
208 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:607
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:343
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLsizei const GLchar ** path
Definition: glext.h:7234
#define WINE_TRACE
Definition: debug.h:358
#define E_FAIL
Definition: ddrawi.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define MAX_PATH
Definition: compat.h:26
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
Definition: services.c:325
static HRESULT WINAPI Host_get_ScriptFullName ( IHost *  iface,
BSTR out_ScriptFullName 
)
static

Definition at line 247 of file host.c.

248 {
249  WINE_TRACE("(%p)\n", out_ScriptFullName);
250 
251  if(!(*out_ScriptFullName = SysAllocString(scriptFullName)))
252  return E_OUTOFMEMORY;
253  return S_OK;
254 }
#define WINE_TRACE
Definition: debug.h:358
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
WCHAR scriptFullName[MAX_PATH]
Definition: main.c:57
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:242
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI Host_get_ScriptName ( IHost *  iface,
BSTR out_ScriptName 
)
static

Definition at line 234 of file host.c.

235 {
236  WCHAR *scriptName;
237 
238  WINE_TRACE("(%p)\n", out_ScriptName);
239 
240  scriptName = strrchrW(scriptFullName, '\\');
241  ++scriptName;
242  if(!(*out_ScriptName = SysAllocString(scriptName)))
243  return E_OUTOFMEMORY;
244  return S_OK;
245 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WINE_TRACE
Definition: debug.h:358
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
WCHAR scriptFullName[MAX_PATH]
Definition: main.c:57
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:242
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI Host_get_StdErr ( IHost *  iface,
ITextStream **  ppts 
)
static

Definition at line 433 of file host.c.

434 {
435  WINE_FIXME("(%p)\n", ppts);
436  return E_NOTIMPL;
437 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:370
static HRESULT WINAPI Host_get_StdIn ( IHost *  iface,
ITextStream **  ppts 
)
static

Definition at line 421 of file host.c.

422 {
423  WINE_FIXME("(%p)\n", ppts);
424  return E_NOTIMPL;
425 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:370
static HRESULT WINAPI Host_get_StdOut ( IHost *  iface,
ITextStream **  ppts 
)
static

Definition at line 427 of file host.c.

428 {
429  WINE_FIXME("(%p)\n", ppts);
430  return E_NOTIMPL;
431 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:370
static HRESULT WINAPI Host_get_Timeout ( IHost *  iface,
LONG out_Timeout 
)
static

Definition at line 281 of file host.c.

282 {
283  WINE_FIXME("(%p)\n", out_Timeout);
284  return E_NOTIMPL;
285 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:370
static HRESULT WINAPI Host_get_Version ( IHost *  iface,
BSTR out_Version 
)
static

Definition at line 264 of file host.c.

265 {
266  WINE_TRACE("(%p)\n", out_Version);
267 
268  if(!(*out_Version = SysAllocString(wshVersionW)))
269  return E_OUTOFMEMORY;
270  return S_OK;
271 }
#define WINE_TRACE
Definition: debug.h:358
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:242
#define S_OK
Definition: intsafe.h:59
static const WCHAR wshVersionW[]
Definition: host.c:39
static HRESULT WINAPI Host_GetIDsOfNames ( IHost *  iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 144 of file host.c.

146 {
147  WINE_TRACE("(%s %p %d %x %p)\n", wine_dbgstr_guid(riid), rgszNames,
148  cNames, lcid, rgDispId);
149 
150  return ITypeInfo_GetIDsOfNames(host_ti, rgszNames, cNames, rgDispId);
151 }
REFIID riid
Definition: precomp.h:44
const char * wine_dbgstr_guid(const GUID *guid)
#define WINE_TRACE
Definition: debug.h:358
ITypeInfo * host_ti
Definition: main.c:59
static HRESULT WINAPI Host_GetObject ( IHost *  iface,
BSTR  Pathname,
BSTR  ProgID,
BSTR  Prefix,
IDispatch **  out_Dispatch 
)
static

Definition at line 395 of file host.c.

397 {
398  WINE_FIXME("(%s %s %s %p)\n", wine_dbgstr_w(Pathname), wine_dbgstr_w(ProgID),
399  wine_dbgstr_w(Prefix), out_Dispatch);
400  return E_NOTIMPL;
401 }
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:370
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:703
static HRESULT WINAPI Host_GetTypeInfo ( IHost *  iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 134 of file host.c.

136 {
137  WINE_TRACE("(%x %x %p\n", iTInfo, lcid, ppTInfo);
138 
139  ITypeInfo_AddRef(host_ti);
140  *ppTInfo = host_ti;
141  return S_OK;
142 }
#define WINE_TRACE
Definition: debug.h:358
ITypeInfo * host_ti
Definition: main.c:59
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI Host_GetTypeInfoCount ( IHost *  iface,
UINT pctinfo 
)
static

Definition at line 127 of file host.c.

128 {
129  WINE_TRACE("(%p)\n", pctinfo);
130  *pctinfo = 1;
131  return S_OK;
132 }
#define WINE_TRACE
Definition: debug.h:358
#define S_OK
Definition: intsafe.h:59
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 153 of file host.c.

156 {
157  WINE_TRACE("(%d %p %p)\n", dispIdMember, pDispParams, pVarResult);
158 
159  return ITypeInfo_Invoke(host_ti, iface, dispIdMember, wFlags, pDispParams,
160  pVarResult, pExcepInfo, puArgErr);
161 }
#define WINE_TRACE
Definition: debug.h:358
ITypeInfo * host_ti
Definition: main.c:59
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
static HRESULT WINAPI Host_put_Interactive ( IHost *  iface,
VARIANT_BOOL  v 
)
static

Definition at line 218 of file host.c.

219 {
220  WINE_TRACE("(%x)\n", v);
221 
222  wshInteractive = v;
223  return S_OK;
224 }
#define WINE_TRACE
Definition: debug.h:358
#define S_OK
Definition: intsafe.h:59
const GLdouble * v
Definition: gl.h:2040
VARIANT_BOOL wshInteractive
Definition: host.c:41
static HRESULT WINAPI Host_put_Timeout ( IHost *  iface,
LONG  v 
)
static

Definition at line 287 of file host.c.

288 {
289  WINE_FIXME("(%d)\n", v);
290  return E_NOTIMPL;
291 }
const GLdouble * v
Definition: gl.h:2040
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINE_FIXME
Definition: debug.h:370
static HRESULT WINAPI Host_QueryInterface ( IHost *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 102 of file host.c.

103 {
104  WINE_TRACE("(%s %p)\n", wine_dbgstr_guid(riid), ppv);
105 
108  || IsEqualGUID(&IID_IHost, riid)) {
109  *ppv = iface;
110  return S_OK;
111  }
112 
113  *ppv = NULL;
114  return E_NOINTERFACE;
115 }
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
const char * wine_dbgstr_guid(const GUID *guid)
#define WINE_TRACE
Definition: debug.h:358
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IDispatch
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4024
static HRESULT WINAPI Host_Quit ( IHost *  iface,
int  ExitCode 
)
static

Definition at line 226 of file host.c.

227 {
228  FIXME("(%d) semi-stub: no script engine clean up\n", ExitCode);
229 
230  ExitProcess(ExitCode);
231  return S_OK;
232 }
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1517
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59
static ULONG WINAPI Host_Release ( IHost *  iface)
static

Definition at line 122 of file host.c.

123 {
124  return 1;
125 }
static HRESULT WINAPI Host_Sleep ( IHost *  iface,
LONG  Time 
)
static

Definition at line 409 of file host.c.

410 {
411  WINE_FIXME("(%d)\n", Time);
412  return E_NOTIMPL;
413 }
#define E_NOTIMPL
Definition: ddrawi.h:99
static PLARGE_INTEGER Time
Definition: time.c:105
#define WINE_FIXME
Definition: debug.h:370
static void print_string ( const WCHAR string)
static

Definition at line 71 of file host.c.

Referenced by Host_Echo().

72 {
73  DWORD count, ret, len, lena;
74  char *buf;
75 
76  if(wshInteractive) {
77  static const WCHAR windows_script_hostW[] =
78  {'W','i','n','d','o','w','s',' ','S','c','r','i','p','t',' ','H','o','s','t',0};
79  MessageBoxW(NULL, string, windows_script_hostW, MB_OK);
80  return;
81  }
82 
83  len = strlenW(string);
84  ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), string, len, &count, NULL);
85  if(ret) {
86  static const WCHAR crnlW[] = {'\r','\n'};
88  return;
89  }
90 
91  lena = WideCharToMultiByte(GetConsoleOutputCP(), 0, string, len, NULL, 0, NULL, NULL);
92  buf = heap_alloc(len);
93  if(!buf)
94  return;
95 
96  WideCharToMultiByte(GetConsoleOutputCP(), 0, string, len, buf, lena, NULL, NULL);
97  WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), buf, lena, &count, FALSE);
98  heap_free(buf);
99  WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &count, FALSE);
100 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WideCharToMultiByte
Definition: compat.h:101
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleW(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
Definition: readwrite.c:1449
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:152
DWORD DWORD
Definition: winlogon.h:84
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
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
GLuint GLuint GLsizei count
Definition: gl.h:1545
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:41
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static HRESULT to_string ( VARIANT src,
BSTR dst 
)
static

Definition at line 48 of file host.c.

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().

49 {
50  VARIANT v;
51  HRESULT hres;
52 
53  static const WCHAR nullW[] = {'n','u','l','l',0};
54 
55  if(V_VT(src) == VT_NULL) {
56  *dst = SysAllocString(nullW);
57  return *dst ? S_OK : E_OUTOFMEMORY;
58  }
59 
60  V_VT(&v) = VT_EMPTY;
61  hres = VariantChangeType(&v, src, 0, VT_BSTR);
62  if(FAILED(hres)) {
63  WARN("Could not convert argument %s to string\n", debugstr_variant(src));
64  return hres;
65  }
66 
67  *dst = V_BSTR(&v);
68  return S_OK;
69 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WARN(fmt,...)
Definition: debug.h:111
HRESULT WINAPI VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:965
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:242
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define V_VT(A)
Definition: oleauto.h:211
#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:59
const GLdouble * v
Definition: gl.h:2040
GLuint const GLubyte GLvoid const GLvoid * dst
Definition: s_context.h:57
static const WCHAR nullW[]
Definition: json.c:33
WINE_DEFAULT_DEBUG_CHANNEL ( wscript  )

Variable Documentation

IHost host_obj = { &HostVtbl }

Definition at line 472 of file host.c.

Referenced by ActiveScriptSite_GetItemInfo(), and Host_get_Application().

const IHostVtbl HostVtbl
static

Definition at line 439 of file host.c.

VARIANT_BOOL wshInteractive
Initial value:
=
VARIANT_TRUE

Definition at line 41 of file host.c.

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

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

Referenced by Host_get_Name().

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

Definition at line 39 of file host.c.

Referenced by Host_get_Version().