schtests: Added /create command implementation.
[wine.git] / programs / wscript / arguments.c
blob7961948b6a56d81ffd90957075f30e4e1d945c1a
1 /*
2 * Copyright 2011 Michal Zietek
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
21 #define COBJMACROS
22 #define CONST_VTABLE
24 #include <windef.h>
25 #include <winbase.h>
26 #include <ole2.h>
28 #include "wscript.h"
30 #include <wine/debug.h>
32 WINE_DEFAULT_DEBUG_CHANNEL(wscript);
34 WCHAR **argums;
35 int numOfArgs;
37 static HRESULT WINAPI Arguments2_QueryInterface(IArguments2 *iface, REFIID riid, void **ppv)
39 WINE_TRACE("(%s %p)\n", wine_dbgstr_guid(riid), ppv);
41 if(IsEqualGUID(&IID_IUnknown, riid)
42 || IsEqualGUID(&IID_IDispatch, riid)
43 || IsEqualGUID(&IID_IArguments2, riid)) {
44 *ppv = iface;
45 return S_OK;
48 *ppv = NULL;
49 return E_NOINTERFACE;
52 static ULONG WINAPI Arguments2_AddRef(IArguments2 *iface)
54 return 2;
57 static ULONG WINAPI Arguments2_Release(IArguments2 *iface)
59 return 1;
62 static HRESULT WINAPI Arguments2_GetTypeInfoCount(IArguments2 *iface, UINT *pctinfo)
64 WINE_TRACE("(%p)\n", pctinfo);
66 *pctinfo = 1;
67 return S_OK;
70 static HRESULT WINAPI Arguments2_GetTypeInfo(IArguments2 *iface, UINT iTInfo, LCID lcid,
71 ITypeInfo **ppTInfo)
73 WINE_TRACE("(%x %x %p\n", iTInfo, lcid, ppTInfo);
75 ITypeInfo_AddRef(arguments_ti);
76 *ppTInfo = arguments_ti;
77 return S_OK;
80 static HRESULT WINAPI Arguments2_GetIDsOfNames(IArguments2 *iface, REFIID riid, LPOLESTR *rgszNames,
81 UINT cNames, LCID lcid, DISPID *rgDispId)
83 WINE_TRACE("(%s %p %d %x %p)\n", wine_dbgstr_guid(riid), rgszNames,
84 cNames, lcid, rgDispId);
86 return ITypeInfo_GetIDsOfNames(arguments_ti, rgszNames, cNames, rgDispId);
89 static HRESULT WINAPI Arguments2_Invoke(IArguments2 *iface, DISPID dispIdMember, REFIID riid,
90 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
91 EXCEPINFO *pExcepInfo, UINT *puArgErr)
93 WINE_TRACE("(%d %p %p)\n", dispIdMember, pDispParams, pVarResult);
95 return ITypeInfo_Invoke(arguments_ti, iface, dispIdMember, wFlags, pDispParams,
96 pVarResult, pExcepInfo, puArgErr);
99 static HRESULT WINAPI Arguments2_Item(IArguments2 *iface, LONG index, BSTR *out_Value)
101 WINE_TRACE("(%d %p)\n", index, out_Value);
103 if(index<0 || index >= numOfArgs)
104 return E_INVALIDARG;
105 if(!(*out_Value = SysAllocString(argums[index])))
106 return E_OUTOFMEMORY;
108 return S_OK;
111 static HRESULT WINAPI Arguments2_Count(IArguments2 *iface, LONG *out_Count)
113 WINE_TRACE("(%p)\n", out_Count);
115 *out_Count = numOfArgs;
116 return S_OK;
119 static HRESULT WINAPI Arguments2_get_length(IArguments2 *iface, LONG *out_Count)
121 WINE_TRACE("(%p)\n", out_Count);
123 *out_Count = numOfArgs;
124 return S_OK;
127 static const IArguments2Vtbl Arguments2Vtbl = {
128 Arguments2_QueryInterface,
129 Arguments2_AddRef,
130 Arguments2_Release,
131 Arguments2_GetTypeInfoCount,
132 Arguments2_GetTypeInfo,
133 Arguments2_GetIDsOfNames,
134 Arguments2_Invoke,
135 Arguments2_Item,
136 Arguments2_Count,
137 Arguments2_get_length
140 IArguments2 arguments_obj = { &Arguments2Vtbl };