wscript.exe: Added IHost stub implementation.
diff --git a/.gitignore b/.gitignore
index 8756317..78a693f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -259,6 +259,7 @@
programs/winetest/*_test.rc
programs/winetest/build.rc
programs/winhlp32/macro.lex.yy.c
+programs/wscript/ihost.h
programs/wscript/ihost.tlb
server/wineserver
server/wineserver-installed
diff --git a/programs/wscript/Makefile.in b/programs/wscript/Makefile.in
index 52f29fd..a45dddf 100644
--- a/programs/wscript/Makefile.in
+++ b/programs/wscript/Makefile.in
@@ -11,8 +11,10 @@
rsrc.rc
C_SRCS = \
+ host.c \
main.c
+IDL_H_SRCS = ihost.idl
IDL_TLB_SRCS = ihost.idl
@MAKE_PROG_RULES@
diff --git a/programs/wscript/host.c b/programs/wscript/host.c
new file mode 100644
index 0000000..b22bff6
--- /dev/null
+++ b/programs/wscript/host.c
@@ -0,0 +1,263 @@
+/*
+ * Copyright 2010 Jacek Caban for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#define COBJMACROS
+#define CONST_VTABLE
+
+#include <windef.h>
+#include <winbase.h>
+#include <ole2.h>
+
+#include "wscript.h"
+
+#include <wine/debug.h>
+
+WINE_DEFAULT_DEBUG_CHANNEL(wscript);
+
+static HRESULT WINAPI Host_QueryInterface(IHost *iface, REFIID riid, void **ppv)
+{
+ WINE_TRACE("(%s %p)\n", wine_dbgstr_guid(riid), ppv);
+
+ if(IsEqualGUID(&IID_IUnknown, riid)
+ || IsEqualGUID(&IID_IDispatch, riid)
+ || IsEqualGUID(&IID_IHost, riid)) {
+ *ppv = iface;
+ return S_OK;
+ }
+
+ *ppv = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI Host_AddRef(IHost *iface)
+{
+ return 2;
+}
+
+static ULONG WINAPI Host_Release(IHost *iface)
+{
+ return 1;
+}
+
+static HRESULT WINAPI Host_GetTypeInfoCount(IHost *iface, UINT *pctinfo)
+{
+ WINE_TRACE("(%p)\n", pctinfo);
+ *pctinfo = 1;
+ return S_OK;
+}
+
+static HRESULT WINAPI Host_GetTypeInfo(IHost *iface, UINT iTInfo, LCID lcid,
+ ITypeInfo **ppTInfo)
+{
+ WINE_FIXME("(%x %x %p\n", iTInfo, lcid, ppTInfo);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_GetIDsOfNames(IHost *iface, REFIID riid, LPOLESTR *rgszNames,
+ UINT cNames, LCID lcid, DISPID *rgDispId)
+{
+ WINE_FIXME("(%s %p %d %x %p)\n", wine_dbgstr_guid(riid), rgszNames,
+ cNames, lcid, rgDispId);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_Invoke(IHost *iface, DISPID dispIdMember, REFIID riid,
+ LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
+ EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+ WINE_FIXME("(%d %p %p)\n", dispIdMember, pDispParams, pVarResult);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_get_Name(IHost *iface, BSTR *out_Name)
+{
+ WINE_FIXME("(%p)\n", out_Name);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_get_Application(IHost *iface, IDispatch **out_Dispatch)
+{
+ WINE_FIXME("(%p)\n", out_Dispatch);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_get_FullName(IHost *iface, BSTR *out_Path)
+{
+ WINE_FIXME("(%p)\n", out_Path);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_get_Path(IHost *iface, BSTR *out_Path)
+{
+ WINE_FIXME("(%p)\n", out_Path);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_get_Interactive(IHost *iface, VARIANT_BOOL *out_Interactive)
+{
+ WINE_FIXME("(%p)\n", out_Interactive);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_put_Interactive(IHost *iface, VARIANT_BOOL v)
+{
+ WINE_FIXME("(%x)\n", v);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_Quit(IHost *iface, int ExitCode)
+{
+ WINE_FIXME("(%d)\n", ExitCode);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_get_ScriptName(IHost *iface, BSTR *out_ScriptName)
+{
+ WINE_FIXME("(%p)\n", out_ScriptName);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_get_ScriptFullName(IHost *iface, BSTR *out_ScriptFullName)
+{
+ WINE_FIXME("(%p)\n", out_ScriptFullName);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_get_Arguments(IHost *iface, IArguments2 **out_Arguments)
+{
+ WINE_FIXME("(%p)\n", out_Arguments);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_get_Version(IHost *iface, BSTR *out_Version)
+{
+ WINE_FIXME("(%p)\n", out_Version);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_get_BuildVersion(IHost *iface, int *out_Build)
+{
+ WINE_FIXME("(%p)\n", out_Build);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_get_Timeout(IHost *iface, LONG *out_Timeout)
+{
+ WINE_FIXME("(%p)\n", out_Timeout);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_put_Timeout(IHost *iface, LONG v)
+{
+ WINE_FIXME("(%d)\n", v);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_CreateObject(IHost *iface, BSTR ProgID, BSTR Prefix,
+ IDispatch **out_Dispatch)
+{
+ WINE_FIXME("(%s %s %p)\n", wine_dbgstr_w(ProgID), wine_dbgstr_w(Prefix), out_Dispatch);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_Echo(IHost *iface, SAFEARRAY *args)
+{
+ WINE_FIXME("(%p)\n", args);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_GetObject(IHost *iface, BSTR Pathname, BSTR ProgID,
+ BSTR Prefix, IDispatch **out_Dispatch)
+{
+ WINE_FIXME("(%s %s %s %p)\n", wine_dbgstr_w(Pathname), wine_dbgstr_w(ProgID),
+ wine_dbgstr_w(Prefix), out_Dispatch);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_DisconnectObject(IHost *iface, IDispatch *Object)
+{
+ WINE_FIXME("(%p)\n", Object);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_Sleep(IHost *iface, LONG Time)
+{
+ WINE_FIXME("(%d)\n", Time);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_ConnectObject(IHost *iface, IDispatch *Object, BSTR Prefix)
+{
+ WINE_FIXME("(%p %s)\n", Object, wine_dbgstr_w(Prefix));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_get_StdIn(IHost *iface, ITextStream **ppts)
+{
+ WINE_FIXME("(%p)\n", ppts);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_get_StdOut(IHost *iface, ITextStream **ppts)
+{
+ WINE_FIXME("(%p)\n", ppts);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Host_get_StdErr(IHost *iface, ITextStream **ppts)
+{
+ WINE_FIXME("(%p)\n", ppts);
+ return E_NOTIMPL;
+}
+
+static const IHostVtbl HostVtbl = {
+ Host_QueryInterface,
+ Host_AddRef,
+ Host_Release,
+ Host_GetTypeInfoCount,
+ Host_GetTypeInfo,
+ Host_GetIDsOfNames,
+ Host_Invoke,
+ Host_get_Name,
+ Host_get_Application,
+ Host_get_FullName,
+ Host_get_Path,
+ Host_get_Interactive,
+ Host_put_Interactive,
+ Host_Quit,
+ Host_get_ScriptName,
+ Host_get_ScriptFullName,
+ Host_get_Arguments,
+ Host_get_Version,
+ Host_get_BuildVersion,
+ Host_get_Timeout,
+ Host_put_Timeout,
+ Host_CreateObject,
+ Host_Echo,
+ Host_GetObject,
+ Host_DisconnectObject,
+ Host_Sleep,
+ Host_ConnectObject,
+ Host_get_StdIn,
+ Host_get_StdOut,
+ Host_get_StdErr
+};
+
+IHost host_obj = { &HostVtbl };
diff --git a/programs/wscript/main.c b/programs/wscript/main.c
index f94c3ae..d5631a2 100644
--- a/programs/wscript/main.c
+++ b/programs/wscript/main.c
@@ -25,12 +25,18 @@
#include <winreg.h>
#include <ole2.h>
#include <activscp.h>
+#include <initguid.h>
+
+#include "wscript.h"
#include <wine/debug.h>
#include <wine/unicode.h>
WINE_DEFAULT_DEBUG_CHANNEL(wscript);
+static const WCHAR wscriptW[] = {'W','S','c','r','i','p','t',0};
+static const WCHAR wshW[] = {'W','S','H',0};
+
static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface,
REFIID riid, void **ppv)
{
@@ -71,8 +77,22 @@
static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface,
LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown **ppunkItem, ITypeInfo **ppti)
{
- WINE_FIXME("(%s %x %p %p)\n", wine_dbgstr_w(pstrName), dwReturnMask, ppunkItem, ppti);
- return E_NOTIMPL;
+ WINE_TRACE("(%s %x %p %p)\n", wine_dbgstr_w(pstrName), dwReturnMask, ppunkItem, ppti);
+
+ if(strcmpW(pstrName, wshW) && strcmpW(pstrName, wscriptW))
+ return E_FAIL;
+
+ if(dwReturnMask & SCRIPTINFO_ITYPEINFO) {
+ WINE_FIXME("SCRIPTINFO_ITYPEINFO not supported\n");
+ return E_NOTIMPL;
+ }
+
+ if(dwReturnMask & SCRIPTINFO_IUNKNOWN) {
+ IHost_AddRef(&host_obj);
+ *ppunkItem = (IUnknown*)&host_obj;
+ }
+
+ return S_OK;
}
static HRESULT WINAPI ActiveScriptSite_GetDocVersionString(IActiveScriptSite *iface,
@@ -202,9 +222,6 @@
{
HRESULT hres;
- static const WCHAR wscriptW[] = {'W','S','c','r','i','p','t',0};
- static const WCHAR wshW[] = {'W','S','H',0};
-
hres = IActiveScript_SetScriptSite(script, &script_site);
if(FAILED(hres))
return FALSE;
diff --git a/programs/wscript/wscript.h b/programs/wscript/wscript.h
new file mode 100644
index 0000000..cd29ed4
--- /dev/null
+++ b/programs/wscript/wscript.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2010 Jacek Caban for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "ihost.h"
+
+extern IHost host_obj;