wscript: Implemented Arguments2_Item.

This commit is contained in:
Michał Ziętek 2011-08-23 15:15:54 +02:00 committed by Alexandre Julliard
parent 2d2a91fd01
commit 1c29375031
5 changed files with 25 additions and 3 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -27,3 +27,7 @@ extern ITypeInfo *host_ti;
extern ITypeInfo *arguments_ti;
extern WCHAR scriptFullName[];
extern WCHAR **argums;
extern int numOfArgs;