wscript: Implemented Host_get_Interactive.

This commit is contained in:
Michał Ziętek 2011-08-23 15:16:08 +02:00 committed by Alexandre Julliard
parent 4252bd8653
commit 280dbcf84a
4 changed files with 32 additions and 3 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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();

View File

@ -31,3 +31,5 @@ extern WCHAR scriptFullName[];
extern WCHAR **argums;
extern int numOfArgs;
extern VARIANT_BOOL wshInteractive;