Michał Ziętek : wscript: Implemented Host_get_Interactive.

Alexandre Julliard julliard at winehq.org
Thu Aug 25 13:00:15 CDT 2011


Module: wine
Branch: master
Commit: 280dbcf84a314ff111306f85432df60bd65effff
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=280dbcf84a314ff111306f85432df60bd65effff

Author: Michał Ziętek <smierc.w.wenecji at gmail.com>
Date:   Tue Aug 23 15:16:08 2011 +0200

wscript: Implemented Host_get_Interactive.

---

 programs/wscript/host.c       |    7 +++++--
 programs/wscript/main.c       |   25 ++++++++++++++++++++++++-
 programs/wscript/tests/run.js |    1 +
 programs/wscript/wscript.h    |    2 ++
 4 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/programs/wscript/host.c b/programs/wscript/host.c
index 02a9291..0ce7e58 100644
--- a/programs/wscript/host.c
+++ b/programs/wscript/host.c
@@ -34,6 +34,7 @@
 
 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 = VARIANT_TRUE;
 
 WINE_DEFAULT_DEBUG_CHANNEL(wscript);
 
@@ -145,8 +146,10 @@ static HRESULT WINAPI Host_get_Path(IHost *iface, BSTR *out_Path)
 
 static HRESULT WINAPI Host_get_Interactive(IHost *iface, VARIANT_BOOL *out_Interactive)
 {
-    WINE_FIXME("(%p)\n", out_Interactive);
-    return E_NOTIMPL;
+    WINE_TRACE("(%p)\n", out_Interactive);
+
+    *out_Interactive = wshInteractive;
+    return S_OK;
 }
 
 static HRESULT WINAPI Host_put_Interactive(IHost *iface, VARIANT_BOOL v)
diff --git a/programs/wscript/main.c b/programs/wscript/main.c
index 3073445..9d79415 100644
--- a/programs/wscript/main.c
+++ b/programs/wscript/main.c
@@ -322,6 +322,28 @@ static void run_script(const WCHAR *filename, IActiveScript *script, IActiveScri
         WINE_FIXME("SetScriptState failed: %08x\n", hres);
 }
 
+static BOOL set_host_properties(const WCHAR *prop)
+{
+    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
+        return FALSE;
+    return TRUE;
+}
+
 int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow)
 {
     const WCHAR *ext, *filename = NULL;
@@ -340,7 +362,8 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm
 
     for(i=0; i<argc; i++) {
         if(*argv[i] == '/' || *argv[i] == '-') {
-            WINE_FIXME("Unsupported argument %s\n", wine_dbgstr_w(argv[i]));
+            if(!set_host_properties(argv[i]))
+                return 1;
         }else {
             filename = argv[i];
             argums = argv+i+1;
diff --git a/programs/wscript/tests/run.js b/programs/wscript/tests/run.js
index 430dfb6..6773df5 100644
--- a/programs/wscript/tests/run.js
+++ b/programs/wscript/tests/run.js
@@ -42,5 +42,6 @@ try {
 }catch(e) {}
 ok(WScript.Arguments.Count() === 3, "WScript.Arguments.Count() = " + WScript.Arguments.Count());
 ok(WScript.Arguments.length === 3, "WScript.Arguments.length = " + WScript.Arguments.length);
+ok(WScript.Interactive === true, "WScript.Interactive = " + WScript.Interactive);
 
 winetest.reportSuccess();
diff --git a/programs/wscript/wscript.h b/programs/wscript/wscript.h
index 3c9191f..d624a2d 100644
--- a/programs/wscript/wscript.h
+++ b/programs/wscript/wscript.h
@@ -31,3 +31,5 @@ extern WCHAR scriptFullName[];
 extern WCHAR **argums;
 
 extern int numOfArgs;
+
+extern VARIANT_BOOL wshInteractive;




More information about the wine-cvs mailing list