Commit 1c293750 authored by Michał Ziętek's avatar Michał Ziętek Committed by Alexandre Julliard

wscript: Implemented Arguments2_Item.

parent 2d2a91fd
......@@ -31,6 +31,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(wscript);
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);
......@@ -95,8 +98,14 @@ static HRESULT WINAPI Arguments2_Invoke(IArguments2 *iface, DISPID dispIdMember,
static HRESULT WINAPI Arguments2_Item(IArguments2 *iface, LONG index, BSTR *out_Value)
{
WINE_FIXME("(%d %p)\n", index, out_Value);
return E_NOTIMPL;
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)
......
......@@ -343,6 +343,8 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm
WINE_FIXME("Unsupported argument %s\n", wine_dbgstr_w(argv[i]));
}else {
filename = argv[i];
argums = argv+i+1;
numOfArgs = argc-i-1;
break;
}
}
......
......@@ -336,7 +336,7 @@ static void run_test(const char *file_name)
BOOL bres;
script_name = file_name;
sprintf(command, "wscript.exe %s", file_name);
sprintf(command, "wscript.exe %s arg1 2 ar3", file_name);
SET_EXPECT(reportSuccess);
......
......@@ -33,5 +33,12 @@ ok(WScript.Path === winetest.wscriptPath, "WScript.Path = ", WScript.Path);
ok(WScript.ScriptName === winetest.wscriptScriptName, "WScript.ScriptName = " + WScript.ScriptName);
ok(WScript.ScriptFullName === winetest.wscriptScriptFullName, "WScript.ScriptFullName = " + WScript.ScriptFullName);
ok(typeof(WScript.Arguments) === "object", "typeof(WScript.Arguments) = " + typeof(WScript.Arguments));
ok(WScript.Arguments.Item(0) === "arg1", "WScript.Arguments.Item(0) = " + WScript.Arguments.Item(0));
ok(WScript.Arguments.Item(1) === "2", "WScript.Arguments.Item(1) = " + WScript.Arguments.Item(1));
ok(WScript.Arguments.Item(2) === "ar3", "WScript.Arguments.Item(2) = " + WScript.Arguments.Item(2));
try {
WScript.Arguments.Item(3);
ok(false, "expected exception");
}catch(e) {}
winetest.reportSuccess();
......@@ -27,3 +27,7 @@ extern ITypeInfo *host_ti;
extern ITypeInfo *arguments_ti;
extern WCHAR scriptFullName[];
extern WCHAR **argums;
extern int numOfArgs;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment