[WSCRIPT]
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 8 Nov 2014 11:23:02 +0000 (11:23 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 8 Nov 2014 11:23:02 +0000 (11:23 +0000)
* Import from Wine 1.7.27.
CORE-8769 #resolve #comment Imported in r65317.
CORE-8540

svn path=/trunk/; revision=65317

reactos/base/applications/cmdutils/CMakeLists.txt
reactos/base/applications/cmdutils/wscript/CMakeLists.txt [new file with mode: 0644]
reactos/base/applications/cmdutils/wscript/arguments.c [new file with mode: 0644]
reactos/base/applications/cmdutils/wscript/host.c [new file with mode: 0644]
reactos/base/applications/cmdutils/wscript/ihost.idl [new file with mode: 0644]
reactos/base/applications/cmdutils/wscript/ihost_dispid.h [new file with mode: 0644]
reactos/base/applications/cmdutils/wscript/main.c [new file with mode: 0644]
reactos/base/applications/cmdutils/wscript/rsrc.rc [new file with mode: 0644]
reactos/base/applications/cmdutils/wscript/wscript.h [new file with mode: 0644]
reactos/media/doc/README.WINE

index a5164ec..57654ad 100644 (file)
@@ -11,4 +11,5 @@ add_subdirectory(reg)
 add_subdirectory(sort)
 add_subdirectory(taskkill)
 add_subdirectory(wmic)
+add_subdirectory(wscript)
 add_subdirectory(xcopy)
diff --git a/reactos/base/applications/cmdutils/wscript/CMakeLists.txt b/reactos/base/applications/cmdutils/wscript/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0438ccd
--- /dev/null
@@ -0,0 +1,17 @@
+
+list(APPEND SOURCE
+    arguments.c
+    host.c
+    main.c
+    wscript.h)
+
+add_executable(wscript ${SOURCE} rsrc.rc)
+add_idl_headers(wscript_idlheader ihost.idl)
+add_typelib(ihost.idl)
+set_source_files_properties(rsrc.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ihost.tlb)
+target_link_libraries(wscript uuid wine)
+set_module_type(wscript win32cui UNICODE)
+add_importlibs(wscript shell32 oleaut32 ole32 advapi32 msvcrt kernel32 ntdll)
+add_dependencies(wscript stdole2 wscript_idlheader)
+add_pch(wscript wscript.h SOURCE)
+add_cd_file(TARGET wscript DESTINATION reactos/system32 FOR all)
diff --git a/reactos/base/applications/cmdutils/wscript/arguments.c b/reactos/base/applications/cmdutils/wscript/arguments.c
new file mode 100644 (file)
index 0000000..f36b56e
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2011 Michal Zietek
+ *
+ * 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 "wscript.h"
+
+WCHAR **argums;
+int numOfArgs;
+
+static HRESULT WINAPI Arguments2_QueryInterface(IArguments2 *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_IArguments2, riid)) {
+        *ppv = iface;
+        return S_OK;
+    }
+
+    *ppv = NULL;
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI Arguments2_AddRef(IArguments2 *iface)
+{
+    return 2;
+}
+
+static ULONG WINAPI Arguments2_Release(IArguments2 *iface)
+{
+    return 1;
+}
+
+static HRESULT WINAPI Arguments2_GetTypeInfoCount(IArguments2 *iface, UINT *pctinfo)
+{
+    WINE_TRACE("(%p)\n", pctinfo);
+
+    *pctinfo = 1;
+    return S_OK;
+}
+
+static HRESULT WINAPI Arguments2_GetTypeInfo(IArguments2 *iface, UINT iTInfo, LCID lcid,
+        ITypeInfo **ppTInfo)
+{
+    WINE_TRACE("(%x %x %p\n", iTInfo, lcid, ppTInfo);
+
+    ITypeInfo_AddRef(arguments_ti);
+    *ppTInfo = arguments_ti;
+    return S_OK;
+}
+
+static HRESULT WINAPI Arguments2_GetIDsOfNames(IArguments2 *iface, REFIID riid, LPOLESTR *rgszNames,
+        UINT cNames, LCID lcid, DISPID *rgDispId)
+{
+    WINE_TRACE("(%s %p %d %x %p)\n", wine_dbgstr_guid(riid), rgszNames,
+        cNames, lcid, rgDispId);
+
+    return ITypeInfo_GetIDsOfNames(arguments_ti, rgszNames, cNames, rgDispId);
+}
+
+static HRESULT WINAPI Arguments2_Invoke(IArguments2 *iface, DISPID dispIdMember, REFIID riid,
+        LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
+        EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+    WINE_TRACE("(%d %p %p)\n", dispIdMember, pDispParams, pVarResult);
+
+    return ITypeInfo_Invoke(arguments_ti, iface, dispIdMember, wFlags, pDispParams,
+            pVarResult, pExcepInfo, puArgErr);
+}
+
+static HRESULT WINAPI Arguments2_Item(IArguments2 *iface, LONG index, BSTR *out_Value)
+{
+    WINE_TRACE("(%d %p)\n", index, out_Value);
+
+    if(index<0 || index >= numOfArgs)
+        return E_INVALIDARG;
+    if(!(*out_Value = SysAllocString(argums[index])))
+        return E_OUTOFMEMORY;
+
+    return S_OK;
+}
+
+static HRESULT WINAPI Arguments2_Count(IArguments2 *iface, LONG *out_Count)
+{
+    WINE_TRACE("(%p)\n", out_Count);
+
+    *out_Count = numOfArgs;
+    return S_OK;
+}
+
+static HRESULT WINAPI Arguments2_get_length(IArguments2 *iface, LONG *out_Count)
+{
+    WINE_TRACE("(%p)\n", out_Count);
+
+    *out_Count = numOfArgs;
+    return S_OK;
+}
+
+static const IArguments2Vtbl Arguments2Vtbl = {
+    Arguments2_QueryInterface,
+    Arguments2_AddRef,
+    Arguments2_Release,
+    Arguments2_GetTypeInfoCount,
+    Arguments2_GetTypeInfo,
+    Arguments2_GetIDsOfNames,
+    Arguments2_Invoke,
+    Arguments2_Item,
+    Arguments2_Count,
+    Arguments2_get_length
+};
+
+IArguments2 arguments_obj = { &Arguments2Vtbl };
diff --git a/reactos/base/applications/cmdutils/wscript/host.c b/reactos/base/applications/cmdutils/wscript/host.c
new file mode 100644 (file)
index 0000000..64519ad
--- /dev/null
@@ -0,0 +1,333 @@
+/*
+ * 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 "wscript.h"
+
+#define BUILDVERSION 16535
+
+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 =
+#ifndef CSCRIPT_BUILD
+    VARIANT_TRUE;
+#else
+    VARIANT_FALSE;
+#endif
+
+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_TRACE("(%x %x %p\n", iTInfo, lcid, ppTInfo);
+
+    ITypeInfo_AddRef(host_ti);
+    *ppTInfo = host_ti;
+    return S_OK;
+}
+
+static HRESULT WINAPI Host_GetIDsOfNames(IHost *iface, REFIID riid, LPOLESTR *rgszNames,
+        UINT cNames, LCID lcid, DISPID *rgDispId)
+{
+    WINE_TRACE("(%s %p %d %x %p)\n", wine_dbgstr_guid(riid), rgszNames,
+        cNames, lcid, rgDispId);
+
+    return ITypeInfo_GetIDsOfNames(host_ti, rgszNames, cNames, rgDispId);
+}
+
+static HRESULT WINAPI Host_Invoke(IHost *iface, DISPID dispIdMember, REFIID riid,
+        LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
+        EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+    WINE_TRACE("(%d %p %p)\n", dispIdMember, pDispParams, pVarResult);
+
+    return ITypeInfo_Invoke(host_ti, iface, dispIdMember, wFlags, pDispParams,
+            pVarResult, pExcepInfo, puArgErr);
+}
+
+static HRESULT WINAPI Host_get_Name(IHost *iface, BSTR *out_Name)
+{
+    WINE_TRACE("(%p)\n", out_Name);
+
+    if(!(*out_Name = SysAllocString(wshNameW)))
+       return E_OUTOFMEMORY;
+    return S_OK;
+}
+
+static HRESULT WINAPI Host_get_Application(IHost *iface, IDispatch **out_Dispatch)
+{
+    WINE_TRACE("(%p)\n", out_Dispatch);
+
+    *out_Dispatch = (IDispatch*)&host_obj;
+    return S_OK;
+}
+
+static HRESULT WINAPI Host_get_FullName(IHost *iface, BSTR *out_Path)
+{
+    WCHAR fullPath[MAX_PATH];
+
+    WINE_TRACE("(%p)\n", out_Path);
+
+    if(GetModuleFileNameW(NULL, fullPath, sizeof(fullPath)/sizeof(WCHAR)) == 0)
+        return E_FAIL;
+    if(!(*out_Path = SysAllocString(fullPath)))
+        return E_OUTOFMEMORY;
+    return S_OK;
+}
+
+static HRESULT WINAPI Host_get_Path(IHost *iface, BSTR *out_Path)
+{
+    WCHAR path[MAX_PATH];
+    int howMany;
+    WCHAR *pos;
+
+    WINE_TRACE("(%p)\n", out_Path);
+
+    if(GetModuleFileNameW(NULL, path, sizeof(path)/sizeof(WCHAR)) == 0)
+        return E_FAIL;
+    pos = strrchrW(path, '\\');
+    howMany = pos - path;
+    if(!(*out_Path = SysAllocStringLen(path, howMany)))
+        return E_OUTOFMEMORY;
+    return S_OK;
+}
+
+static HRESULT WINAPI Host_get_Interactive(IHost *iface, VARIANT_BOOL *out_Interactive)
+{
+    WINE_TRACE("(%p)\n", out_Interactive);
+
+    *out_Interactive = wshInteractive;
+    return S_OK;
+}
+
+static HRESULT WINAPI Host_put_Interactive(IHost *iface, VARIANT_BOOL v)
+{
+    WINE_TRACE("(%x)\n", v);
+
+    wshInteractive = v;
+    return S_OK;
+}
+
+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)
+{
+    WCHAR *scriptName;
+
+    WINE_TRACE("(%p)\n", out_ScriptName);
+
+    scriptName = strrchrW(scriptFullName, '\\');
+    ++scriptName;
+    if(!(*out_ScriptName = SysAllocString(scriptName)))
+        return E_OUTOFMEMORY;
+    return S_OK;
+}
+
+static HRESULT WINAPI Host_get_ScriptFullName(IHost *iface, BSTR *out_ScriptFullName)
+{
+    WINE_TRACE("(%p)\n", out_ScriptFullName);
+
+    if(!(*out_ScriptFullName = SysAllocString(scriptFullName)))
+        return E_OUTOFMEMORY;
+    return S_OK;
+}
+
+static HRESULT WINAPI Host_get_Arguments(IHost *iface, IArguments2 **out_Arguments)
+{
+    WINE_TRACE("(%p)\n", out_Arguments);
+
+    *out_Arguments = &arguments_obj;
+    return S_OK;
+}
+
+static HRESULT WINAPI Host_get_Version(IHost *iface, BSTR *out_Version)
+{
+    WINE_TRACE("(%p)\n", out_Version);
+
+    if(!(*out_Version = SysAllocString(wshVersionW)))
+       return E_OUTOFMEMORY;
+    return S_OK;
+}
+
+static HRESULT WINAPI Host_get_BuildVersion(IHost *iface, int *out_Build)
+{
+    WINE_TRACE("(%p)\n", out_Build);
+
+    *out_Build = BUILDVERSION;
+    return S_OK;
+}
+
+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)
+{
+    IUnknown *unk;
+    GUID guid;
+    HRESULT hres;
+
+    TRACE("(%s %s %p)\n", wine_dbgstr_w(ProgID), wine_dbgstr_w(Prefix), out_Dispatch);
+
+    if(Prefix && *Prefix) {
+        FIXME("Prefix %s not supported\n", debugstr_w(Prefix));
+        return E_NOTIMPL;
+    }
+
+    hres = CLSIDFromProgID(ProgID, &guid);
+    if(FAILED(hres))
+        return hres;
+
+    hres = CoCreateInstance(&guid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER,
+            &IID_IUnknown, (void**)&unk);
+    if(FAILED(hres))
+        return hres;
+
+    hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)out_Dispatch);
+    IUnknown_Release(unk);
+    return hres;
+}
+
+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/reactos/base/applications/cmdutils/wscript/ihost.idl b/reactos/base/applications/cmdutils/wscript/ihost.idl
new file mode 100644 (file)
index 0000000..9e4202e
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * 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
+ */
+
+#pragma makedep typelib
+
+#include "ihost_dispid.h"
+
+import "oaidl.idl";
+
+[
+    uuid(60254ca0-953b-11cf-8c96-00aa00b8708c),
+    version(5.6),
+]
+library IHost
+{
+    importlib("stdole2.tlb");
+
+    [
+        odl,
+        uuid(2cc5a9d1-b1e5-11d3-a286-00104bd35090),
+        dual,
+        oleautomation
+    ]
+    interface IArguments2 : IDispatch {
+        [id(DISPID_VALUE)]
+        HRESULT Item(
+            [in] LONG Index,
+            [out, retval] BSTR *out_Value);
+
+        [id(IARGUMENTS2_COUNT_DISPID)]
+        HRESULT Count([out, retval] LONG *out_Count);
+
+        [id(IARGUMENTS2_LENGTH_DISPID), propget]
+        HRESULT length([out, retval] LONG *out_Count);
+    }
+
+    [
+        odl,
+        uuid(53bad8c1-e718-11cf-893d-00a0c9054228),
+        hidden,
+        dual,
+        nonextensible,
+        oleautomation
+    ]
+    interface ITextStream : IDispatch {
+        [id(ITEXTSTREAM_LINE_DISPID), propget]
+        HRESULT Line([out, retval] LONG *Line);
+
+        [id(ITEXTSTREAM_COLUMN_DISPID), propget]
+        HRESULT Column([out, retval] LONG *Column);
+
+        [id(ITEXTSTREAM_ATENDOFSTREAM_DISPID), propget]
+        HRESULT AtEndOfStream([out, retval] VARIANT_BOOL *EOS);
+
+        [id(ITEXTSTREAM_ATENDOFLINE_DISPID), propget]
+        HRESULT AtEndOfLine([out, retval] VARIANT_BOOL *EOL);
+
+        [id(ITEXTSTREAM_READ_DISPID)]
+        HRESULT Read(
+            [in] LONG Characters,
+            [out, retval] BSTR *Text);
+
+        [id(ITEXTSTREAM_READLINE_DISPID)]
+        HRESULT ReadLine([out, retval] BSTR *Text);
+
+        [id(ITEXTSTREAM_READALL_DISPID)]
+        HRESULT ReadAll([out, retval] BSTR *Text);
+
+        [id(ITEXTSTREAM_WRITE_DISPID)]
+        HRESULT Write([in] BSTR Text);
+
+        [id(ITEXTSTREAM_WRITELINE_DISPID)]
+        HRESULT WriteLine([in, optional, defaultvalue("")] BSTR Text);
+
+        [id(ITEXTSTREAM_WRITEBLANKLINES_DISPID)]
+        HRESULT WriteBlankLines([in] LONG Lines);
+
+        [id(ITEXTSTREAM_SKIP_DISPID)]
+        HRESULT Skip([in] LONG Characters);
+
+        [id(ITEXTSTREAM_SKIPLINE_DISPID)]
+        HRESULT SkipLine();
+
+        [id(ITEXTSTREAM_CLOSE_DISPID)]
+        HRESULT Close();
+    }
+
+    [
+        odl,
+        uuid(91afbd1b-5feb-43f5-b028-e2ca960617ec),
+        dual,
+        oleautomation
+    ]
+    interface IHost : IDispatch {
+        [id(IHOST_NAME_DISPID), propget]
+        HRESULT Name([out, retval] BSTR *out_Name);
+
+        [id(IHOST_APPLICATION_DISPID), propget]
+        HRESULT Application([out, retval] IDispatch **out_Dispatch);
+
+        [id(IHOST_FULLNAME_DISPID), propget]
+        HRESULT FullName([out, retval] BSTR *out_Path);
+
+        [id(IHOST_PATH_DISPID), propget]
+        HRESULT Path([out, retval] BSTR* out_Path);
+
+        [id(IHOST_INTERACTIVE_DISPID), propget]
+        HRESULT Interactive([out, retval] VARIANT_BOOL *out_Interactive);
+
+        [id(IHOST_INTERACTIVE_DISPID), propput]
+        HRESULT Interactive([in] VARIANT_BOOL out_Interactive);
+
+        [id(IHOST_QUIT_DISPID)]
+        HRESULT Quit([in, optional, defaultvalue(0)] int ExitCode);
+
+        [id(IHOST_SCRIPTNAME_DISPID), propget]
+        HRESULT ScriptName([out, retval] BSTR *out_ScriptName);
+
+        [id(IHOST_SCRIPTFULLNAME_DISPID), propget]
+        HRESULT ScriptFullName([out, retval] BSTR* out_ScriptFullName);
+
+        [id(IHOST_ARGUMENTS_DISPID), propget]
+        HRESULT Arguments([out, retval] IArguments2 **out_Arguments);
+
+        [id(IHOST_VERSION_DISPID), propget]
+        HRESULT Version([out, retval] BSTR *out_Version);
+
+        [id(IHOST_BUILDVERSION_DISPID), propget]
+        HRESULT BuildVersion([out, retval] int *out_Build);
+
+        [id(IHOST_TIMEOUT_DISPID), propget]
+        HRESULT Timeout([out, retval] LONG *out_Timeout);
+
+        [id(IHOST_TIMEOUT_DISPID), propput]
+        HRESULT Timeout([in] LONG out_Timeout);
+
+        [id(IHOST_CREATEOBJECT_DISPID)]
+        HRESULT CreateObject(
+                [in] BSTR ProgID,
+                [in, optional, defaultvalue("")] BSTR Prefix,
+                [out, retval] IDispatch **out_Dispatch);
+
+        [id(IHOST_ECHO_DISPID), vararg]
+        HRESULT Echo([in] SAFEARRAY(VARIANT) pArgs);
+
+        [id(IHOST_GETOBJECT_DISPID)]
+        HRESULT GetObject(
+            [in] BSTR Pathname,
+            [in, optional, defaultvalue("")] BSTR ProgID,
+            [in, optional, defaultvalue("")] BSTR Prefix,
+            [out, retval] IDispatch **out_Dispatch);
+
+        [id(IHOST_DISCONNECTOBJECT_DISPID)]
+        HRESULT DisconnectObject([in] IDispatch *Object);
+
+        [id(IHOST_SLEEP_DISPID)]
+        HRESULT Sleep([in] LONG Time);
+
+        [id(IHOST_CONNECTOBJECT_DISPID)]
+        HRESULT ConnectObject(
+            [in] IDispatch *Object,
+            [in] BSTR Prefix);
+
+        [id(IHOST_STDIN_DISPID), propget]
+        HRESULT StdIn([out, retval] ITextStream **out_ppts);
+
+        [id(IHOST_STDOUT_DISPID), propget]
+        HRESULT StdOut([out, retval] ITextStream **ppts);
+
+        [id(IHOST_STDERR_DISPID), propget]
+        HRESULT StdErr([out, retval] ITextStream **ppts);
+    }
+}
diff --git a/reactos/base/applications/cmdutils/wscript/ihost_dispid.h b/reactos/base/applications/cmdutils/wscript/ihost_dispid.h
new file mode 100644 (file)
index 0000000..da60108
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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
+ */
+
+#pragma once
+
+#define IHOST_NAME_DISPID              DISPID_VALUE
+#define IHOST_APPLICATION_DISPID       100
+#define IHOST_FULLNAME_DISPID          101
+#define IHOST_PATH_DISPID              102
+#define IHOST_INTERACTIVE_DISPID       103
+#define IHOST_QUIT_DISPID              200
+#define IHOST_SCRIPTNAME_DISPID        1000
+#define IHOST_SCRIPTFULLNAME_DISPID    1001
+#define IHOST_ARGUMENTS_DISPID         1002
+#define IHOST_VERSION_DISPID           1003
+#define IHOST_BUILDVERSION_DISPID      1004
+#define IHOST_TIMEOUT_DISPID           1005
+#define IHOST_STDIN_DISPID             1006
+#define IHOST_STDOUT_DISPID            1007
+#define IHOST_STDERR_DISPID            1008
+#define IHOST_CREATEOBJECT_DISPID      2000
+#define IHOST_ECHO_DISPID              2001
+#define IHOST_GETOBJECT_DISPID         2002
+#define IHOST_DISCONNECTOBJECT_DISPID  2003
+#define IHOST_SLEEP_DISPID             2004
+#define IHOST_CONNECTOBJECT_DISPID     2005
+
+#define IARGUMENTS2_COUNT_DISPID   1
+#define IARGUMENTS2_LENGTH_DISPID  2
+
+#define ITEXTSTREAM_LINE_DISPID             10000
+#define ITEXTSTREAM_COLUMN_DISPID           -529
+#define ITEXTSTREAM_ATENDOFSTREAM_DISPID    10002
+#define ITEXTSTREAM_ATENDOFLINE_DISPID      10003
+#define ITEXTSTREAM_READ_DISPID             10004
+#define ITEXTSTREAM_READLINE_DISPID         10005
+#define ITEXTSTREAM_READALL_DISPID          10006
+#define ITEXTSTREAM_WRITE_DISPID            10007
+#define ITEXTSTREAM_WRITELINE_DISPID        10008
+#define ITEXTSTREAM_WRITEBLANKLINES_DISPID  10009
+#define ITEXTSTREAM_SKIP_DISPID             10010
+#define ITEXTSTREAM_SKIPLINE_DISPID         10011
+#define ITEXTSTREAM_CLOSE_DISPID            10012
diff --git a/reactos/base/applications/cmdutils/wscript/main.c b/reactos/base/applications/cmdutils/wscript/main.c
new file mode 100644 (file)
index 0000000..0923c33
--- /dev/null
@@ -0,0 +1,467 @@
+/*
+ * 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 "wscript.h"
+
+#include <shellapi.h>
+#include <activscp.h>
+
+#ifdef _WIN64
+
+#define IActiveScriptParse_Release IActiveScriptParse64_Release
+#define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
+#define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
+
+#else
+
+#define IActiveScriptParse_Release IActiveScriptParse32_Release
+#define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
+#define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
+
+#endif
+
+static const WCHAR wscriptW[] = {'W','S','c','r','i','p','t',0};
+static const WCHAR wshW[] = {'W','S','H',0};
+WCHAR scriptFullName[MAX_PATH];
+
+ITypeInfo *host_ti;
+ITypeInfo *arguments_ti;
+
+static HRESULT query_interface(REFIID,void**);
+
+static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface,
+                                                      REFIID riid, void **ppv)
+{
+    return query_interface(riid, ppv);
+}
+
+static ULONG WINAPI ActiveScriptSite_AddRef(IActiveScriptSite *iface)
+{
+    return 2;
+}
+
+static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface)
+{
+    return 1;
+}
+
+static HRESULT WINAPI ActiveScriptSite_GetLCID(IActiveScriptSite *iface, LCID *plcid)
+{
+    WINE_TRACE("()\n");
+
+    *plcid = GetUserDefaultLCID();
+    return S_OK;
+}
+
+static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface,
+        LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown **ppunkItem, ITypeInfo **ppti)
+{
+    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) {
+        ITypeInfo_AddRef(host_ti);
+        *ppti = host_ti;
+    }
+
+    if(dwReturnMask & SCRIPTINFO_IUNKNOWN) {
+        IHost_AddRef(&host_obj);
+        *ppunkItem = (IUnknown*)&host_obj;
+    }
+
+    return S_OK;
+}
+
+static HRESULT WINAPI ActiveScriptSite_GetDocVersionString(IActiveScriptSite *iface,
+        BSTR *pbstrVersion)
+{
+    WINE_FIXME("()\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ActiveScriptSite_OnScriptTerminate(IActiveScriptSite *iface,
+        const VARIANT *pvarResult, const EXCEPINFO *pexcepinfo)
+{
+    WINE_FIXME("()\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ActiveScriptSite_OnStateChange(IActiveScriptSite *iface,
+        SCRIPTSTATE ssScriptState)
+{
+    WINE_TRACE("(%x)\n", ssScriptState);
+    return S_OK;
+}
+
+static HRESULT WINAPI ActiveScriptSite_OnScriptError(IActiveScriptSite *iface,
+        IActiveScriptError *pscripterror)
+{
+    WINE_FIXME("()\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ActiveScriptSite_OnEnterScript(IActiveScriptSite *iface)
+{
+    WINE_TRACE("()\n");
+    return S_OK;
+}
+
+static HRESULT WINAPI ActiveScriptSite_OnLeaveScript(IActiveScriptSite *iface)
+{
+    WINE_TRACE("()\n");
+    return S_OK;
+}
+
+static IActiveScriptSiteVtbl ActiveScriptSiteVtbl = {
+    ActiveScriptSite_QueryInterface,
+    ActiveScriptSite_AddRef,
+    ActiveScriptSite_Release,
+    ActiveScriptSite_GetLCID,
+    ActiveScriptSite_GetItemInfo,
+    ActiveScriptSite_GetDocVersionString,
+    ActiveScriptSite_OnScriptTerminate,
+    ActiveScriptSite_OnStateChange,
+    ActiveScriptSite_OnScriptError,
+    ActiveScriptSite_OnEnterScript,
+    ActiveScriptSite_OnLeaveScript
+};
+
+static IActiveScriptSite script_site = { &ActiveScriptSiteVtbl };
+
+static HRESULT WINAPI ActiveScriptSiteWindow_QueryInterface(IActiveScriptSiteWindow *iface, REFIID riid, void **ppv)
+{
+    return query_interface(riid, ppv);
+}
+
+static ULONG WINAPI ActiveScriptSiteWindow_AddRef(IActiveScriptSiteWindow *iface)
+{
+    return 2;
+}
+
+static ULONG WINAPI ActiveScriptSiteWindow_Release(IActiveScriptSiteWindow *iface)
+{
+    return 1;
+}
+
+static HRESULT WINAPI ActiveScriptSiteWindow_GetWindow(IActiveScriptSiteWindow *iface, HWND *phwnd)
+{
+    TRACE("(%p)\n", phwnd);
+
+    *phwnd = NULL;
+    return S_OK;
+}
+
+static HRESULT WINAPI ActiveScriptSiteWindow_EnableModeless(IActiveScriptSiteWindow *iface, BOOL fEnable)
+{
+    TRACE("(%x)\n", fEnable);
+    return S_OK;
+}
+
+static IActiveScriptSiteWindowVtbl ActiveScriptSiteWindowVtbl = {
+    ActiveScriptSiteWindow_QueryInterface,
+    ActiveScriptSiteWindow_AddRef,
+    ActiveScriptSiteWindow_Release,
+    ActiveScriptSiteWindow_GetWindow,
+    ActiveScriptSiteWindow_EnableModeless
+};
+
+static IActiveScriptSiteWindow script_site_window = { &ActiveScriptSiteWindowVtbl };
+
+static HRESULT query_interface(REFIID riid, void **ppv)
+{
+    if(IsEqualGUID(riid, &IID_IUnknown)) {
+        TRACE("(IID_IUnknown %p)\n", ppv);
+        *ppv = &script_site;
+    }else if(IsEqualGUID(riid, &IID_IActiveScriptSite)) {
+        TRACE("(IID_IActiveScriptSite %p)\n", ppv);
+        *ppv = &script_site;
+    }else if(IsEqualGUID(riid, &IID_IActiveScriptSiteWindow)) {
+        TRACE("(IID_IActiveScriptSiteWindow %p)\n", ppv);
+        *ppv = &script_site_window;
+    }else {
+        *ppv = NULL;
+        TRACE("(%s %p)\n", wine_dbgstr_guid(riid), ppv);
+        return E_NOINTERFACE;
+    }
+
+    IUnknown_AddRef((IUnknown*)*ppv);
+    return S_OK;
+}
+
+static BOOL load_typelib(void)
+{
+    ITypeLib *typelib;
+    HRESULT hres;
+
+    static const WCHAR wscript_exeW[] = {'w','s','c','r','i','p','t','.','e','x','e',0};
+
+    hres = LoadTypeLib(wscript_exeW, &typelib);
+    if(FAILED(hres))
+        return FALSE;
+
+    hres = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IHost, &host_ti);
+    if(SUCCEEDED(hres))
+        hres = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IArguments2, &arguments_ti);
+
+    ITypeLib_Release(typelib);
+    return SUCCEEDED(hres);
+}
+
+static BOOL get_engine_clsid(const WCHAR *ext, CLSID *clsid)
+{
+    WCHAR fileid[64], progid[64];
+    DWORD res;
+    LONG size;
+    HKEY hkey;
+    HRESULT hres;
+
+    static const WCHAR script_engineW[] =
+        {'\\','S','c','r','i','p','t','E','n','g','i','n','e',0};
+
+    res = RegOpenKeyW(HKEY_CLASSES_ROOT, ext, &hkey);
+    if(res != ERROR_SUCCESS)
+        return FALSE;
+
+    size = sizeof(fileid)/sizeof(WCHAR);
+    res = RegQueryValueW(hkey, NULL, fileid, &size);
+    RegCloseKey(hkey);
+    if(res != ERROR_SUCCESS)
+        return FALSE;
+
+    WINE_TRACE("fileid is %s\n", wine_dbgstr_w(fileid));
+
+    strcatW(fileid, script_engineW);
+    res = RegOpenKeyW(HKEY_CLASSES_ROOT, fileid, &hkey);
+    if(res != ERROR_SUCCESS)
+        return FALSE;
+
+    size = sizeof(progid)/sizeof(WCHAR);
+    res = RegQueryValueW(hkey, NULL, progid, &size);
+    RegCloseKey(hkey);
+    if(res != ERROR_SUCCESS)
+        return FALSE;
+
+    WINE_TRACE("ProgID is %s\n", wine_dbgstr_w(progid));
+
+    hres = CLSIDFromProgID(progid, clsid);
+    return SUCCEEDED(hres);
+}
+
+static BOOL create_engine(CLSID *clsid, IActiveScript **script_ret,
+        IActiveScriptParse **parser)
+{
+    IActiveScript *script;
+    IUnknown *unk;
+    HRESULT hres;
+
+    hres = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
+            &IID_IUnknown, (void**)&unk);
+    if(FAILED(hres))
+        return FALSE;
+
+    hres = IUnknown_QueryInterface(unk, &IID_IActiveScript, (void**)&script);
+    IUnknown_Release(unk);
+    if(FAILED(hres))
+        return FALSE;
+
+    hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParse, (void**)parser);
+    if(FAILED(hres)) {
+        IActiveScript_Release(script);
+        return FALSE;
+    }
+
+    *script_ret = script;
+    return TRUE;
+}
+
+static BOOL init_engine(IActiveScript *script, IActiveScriptParse *parser)
+{
+    HRESULT hres;
+
+    if(!load_typelib())
+        return FALSE;
+
+    hres = IActiveScript_SetScriptSite(script, &script_site);
+    if(FAILED(hres))
+        return FALSE;
+
+    hres = IActiveScriptParse_InitNew(parser);
+    if(FAILED(hres))
+        return FALSE;
+
+    hres = IActiveScript_AddNamedItem(script, wscriptW, SCRIPTITEM_ISVISIBLE);
+    if(FAILED(hres))
+        return FALSE;
+
+    hres = IActiveScript_AddNamedItem(script, wshW, SCRIPTITEM_ISVISIBLE);
+    if(FAILED(hres))
+        return FALSE;
+
+    hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_INITIALIZED);
+    return SUCCEEDED(hres);
+}
+
+static BSTR get_script_str(const WCHAR *filename)
+{
+    const char *file_map;
+    HANDLE file, map;
+    DWORD size, len;
+    BSTR ret;
+
+    file = CreateFileW(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
+    if(file == INVALID_HANDLE_VALUE)
+        return NULL;
+
+    size = GetFileSize(file, NULL);
+    map = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL);
+    CloseHandle(file);
+    if(map == INVALID_HANDLE_VALUE)
+        return NULL;
+
+    file_map = MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0);
+    CloseHandle(map);
+    if(!file_map)
+        return NULL;
+
+    len = MultiByteToWideChar(CP_ACP, 0, file_map, size, NULL, 0);
+    ret = SysAllocStringLen(NULL, len);
+    MultiByteToWideChar(CP_ACP, 0, file_map, size, ret, len);
+
+    UnmapViewOfFile(file_map);
+    return ret;
+}
+
+static void run_script(const WCHAR *filename, IActiveScript *script, IActiveScriptParse *parser)
+{
+    BSTR text;
+    HRESULT hres;
+
+    text = get_script_str(filename);
+    if(!text) {
+        WINE_FIXME("Could not get script text\n");
+        return;
+    }
+
+    hres = IActiveScriptParse_ParseScriptText(parser, text, NULL, NULL, NULL, 1, 1,
+            SCRIPTTEXT_HOSTMANAGESSOURCE|SCRIPTITEM_ISVISIBLE, NULL, NULL);
+    SysFreeString(text);
+    if(FAILED(hres)) {
+        WINE_FIXME("ParseScriptText failed: %08x\n", hres);
+        return;
+    }
+
+    hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_STARTED);
+    if(FAILED(hres))
+        WINE_FIXME("SetScriptState failed: %08x\n", hres);
+}
+
+static BOOL set_host_properties(const WCHAR *prop)
+{
+    static const WCHAR nologoW[] = {'n','o','l','o','g','o',0};
+    static const WCHAR iactive[] = {'i',0};
+    static const WCHAR batch[] = {'b',0};
+
+    if(*prop == '/') {
+        ++prop;
+        if(*prop == '/')
+            ++prop;
+    }
+    else
+        ++prop;
+
+    if(strcmpiW(prop, iactive) == 0)
+        wshInteractive = VARIANT_TRUE;
+    else if(strcmpiW(prop, batch) == 0)
+        wshInteractive = VARIANT_FALSE;
+    else if(strcmpiW(prop, nologoW) == 0)
+        WINE_FIXME("ignored %s switch\n", debugstr_w(nologoW));
+    else
+    {
+        WINE_FIXME("unsupported switch %s\n", debugstr_w(prop));
+        return FALSE;
+    }
+    return TRUE;
+}
+
+int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow)
+{
+    WCHAR *ext, *filepart, *filename = NULL;
+    IActiveScriptParse *parser;
+    IActiveScript *script;
+    WCHAR **argv;
+    CLSID clsid;
+    int argc, i;
+    DWORD res;
+
+    WINE_TRACE("(%p %p %s %x)\n", hInst, hPrevInst, wine_dbgstr_w(cmdline), cmdshow);
+
+    argv = CommandLineToArgvW(cmdline, &argc);
+    if(!argv)
+        return 1;
+
+    for(i=0; i<argc; i++) {
+        if(*argv[i] == '/' || *argv[i] == '-') {
+            if(!set_host_properties(argv[i]))
+                return 1;
+        }else {
+            filename = argv[i];
+            argums = argv+i+1;
+            numOfArgs = argc-i-1;
+            break;
+        }
+    }
+
+    if(!filename) {
+        WINE_FIXME("No file name specified\n");
+        return 1;
+    }
+    res = GetFullPathNameW(filename, sizeof(scriptFullName)/sizeof(WCHAR), scriptFullName, &filepart);
+    if(!res || res > sizeof(scriptFullName)/sizeof(WCHAR))
+        return 1;
+
+    ext = strrchrW(filepart, '.');
+    if(!ext || !get_engine_clsid(ext, &clsid)) {
+        WINE_FIXME("Could not find engine for %s\n", wine_dbgstr_w(ext));
+        return 1;
+    }
+
+    CoInitialize(NULL);
+
+    if(!create_engine(&clsid, &script, &parser)) {
+        WINE_FIXME("Could not create script engine\n");
+        CoUninitialize();
+        return 1;
+    }
+
+    if(init_engine(script, parser)) {
+        run_script(filename, script, parser);
+        IActiveScript_Close(script);
+        ITypeInfo_Release(host_ti);
+    }else {
+        WINE_FIXME("Script initialization failed\n");
+    }
+
+    IActiveScript_Release(script);
+    IActiveScriptParse_Release(parser);
+
+    CoUninitialize();
+
+    return 0;
+}
diff --git a/reactos/base/applications/cmdutils/wscript/rsrc.rc b/reactos/base/applications/cmdutils/wscript/rsrc.rc
new file mode 100644 (file)
index 0000000..51ce098
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * 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
+ */
+
+/* @makedep: ihost.tlb */
+1 TYPELIB ihost.tlb
diff --git a/reactos/base/applications/cmdutils/wscript/wscript.h b/reactos/base/applications/cmdutils/wscript/wscript.h
new file mode 100644 (file)
index 0000000..7a86161
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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
+ */
+
+#ifndef _WSCRIPT_H_
+#define _WSCRIPT_H_
+
+#include <stdarg.h>
+
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COBJMACROS
+#define CONST_VTABLE
+
+#include <windef.h>
+#include <winbase.h>
+#include <initguid.h>
+#include <ihost.h>
+#include <wine/debug.h>
+#include <wine/unicode.h>
+
+WINE_DEFAULT_DEBUG_CHANNEL(wscript);
+
+extern IHost host_obj;
+
+extern IArguments2 arguments_obj;
+
+extern ITypeInfo *host_ti;
+
+extern ITypeInfo *arguments_ti;
+
+extern WCHAR scriptFullName[];
+
+extern WCHAR **argums;
+
+extern int numOfArgs;
+
+extern VARIANT_BOOL wshInteractive;
+
+#endif /* _WSCRIPT_H_ */
index cd13ae9..a2d3ea0 100644 (file)
@@ -237,6 +237,7 @@ ReactOS shares the following programs with Winehq.
 reactos/base/applications/cmdutils/reg      # Synced to Wine-1.7.27
 reactos/base/applications/cmdutils/taskkill # Synced to Wine-1.7.27
 reactos/base/applications/cmdutils/wmic     # Synced to Wine-1.7.27
+reactos/base/applications/cmdutils/wscript  # Synced to Wine-1.7.27
 reactos/base/applications/cmdutils/xcopy    # Synced to Wine-1.7.27
 reactos/base/applications/games/winmine     # Forked at Wine-1_3_5
 reactos/base/applications/extrac32          # Synced to Wine-1.7.27