wscript: Implemented Host_get_Arguments.

This commit is contained in:
Michał Ziętek 2011-08-23 15:15:48 +02:00 committed by Alexandre Julliard
parent d34ff26230
commit 2d2a91fd01
6 changed files with 140 additions and 2 deletions

View File

@ -7,6 +7,7 @@ RC_SRCS = \
rsrc.rc
C_SRCS = \
arguments.c \
host.c \
main.c

View File

@ -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 <stdarg.h>
#define COBJMACROS
#define CONST_VTABLE
#include <windef.h>
#include <winbase.h>
#include <ole2.h>
#include "wscript.h"
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(wscript);
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_FIXME("(%d %p)\n", index, out_Value);
return E_NOTIMPL;
}
static HRESULT WINAPI Arguments2_Count(IArguments2 *iface, LONG *out_Count)
{
WINE_FIXME("(%p)\n", out_Count);
return E_NOTIMPL;
}
static HRESULT WINAPI Arguments2_get_length(IArguments2 *iface, LONG *out_Count)
{
WINE_FIXME("(%p)\n", out_Count);
return E_NOTIMPL;
}
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 };

View File

@ -185,8 +185,10 @@ static HRESULT WINAPI Host_get_ScriptFullName(IHost *iface, BSTR *out_ScriptFull
static HRESULT WINAPI Host_get_Arguments(IHost *iface, IArguments2 **out_Arguments)
{
WINE_FIXME("(%p)\n", out_Arguments);
return E_NOTIMPL;
WINE_TRACE("(%p)\n", out_Arguments);
*out_Arguments = &arguments_obj;
return S_OK;
}
static HRESULT WINAPI Host_get_Version(IHost *iface, BSTR *out_Version)

View File

@ -39,6 +39,7 @@ static const WCHAR wshW[] = {'W','S','H',0};
WCHAR scriptFullName[MAX_PATH];
ITypeInfo *host_ti;
ITypeInfo *arguments_ti;
static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface,
REFIID riid, void **ppv)
@ -166,6 +167,8 @@ static BOOL load_typelib(void)
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);

View File

@ -32,5 +32,6 @@ ok(WScript.FullName === winetest.wscriptFullName, "WScript.FullName = ", WScript
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));
winetest.reportSuccess();

View File

@ -20,6 +20,10 @@
extern IHost host_obj;
extern IArguments2 arguments_obj;
extern ITypeInfo *host_ti;
extern ITypeInfo *arguments_ti;
extern WCHAR scriptFullName[];