Jacek Caban : vbscript: Added stub VBScript object implementation.
Alexandre Julliard
julliard at winehq.org
Mon Jul 18 12:47:01 CDT 2011
Module: wine
Branch: master
Commit: 03b8ad29cc587f5898c6540ba04cf4d27f4cd78d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=03b8ad29cc587f5898c6540ba04cf4d27f4cd78d
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Jul 18 16:57:27 2011 +0200
vbscript: Added stub VBScript object implementation.
---
dlls/vbscript/Makefile.in | 1 +
dlls/vbscript/vbscript.c | 229 +++++++++++++++++++++++++++++++++++++++++
dlls/vbscript/vbscript.h | 43 ++++++++
dlls/vbscript/vbscript_main.c | 7 +-
4 files changed, 274 insertions(+), 6 deletions(-)
diff --git a/dlls/vbscript/Makefile.in b/dlls/vbscript/Makefile.in
index 3e8a3eb..2a90e46 100644
--- a/dlls/vbscript/Makefile.in
+++ b/dlls/vbscript/Makefile.in
@@ -1,6 +1,7 @@
MODULE = vbscript.dll
C_SRCS = \
+ vbscript.c \
vbscript_main.c
RC_SRCS = vbscript.rc
diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c
new file mode 100644
index 0000000..f82bc56
--- /dev/null
+++ b/dlls/vbscript/vbscript.c
@@ -0,0 +1,229 @@
+/*
+ * Copyright 2011 Jacek Caban for CodeWeavers
+ *
+ * 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 "config.h"
+
+#include <stdarg.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "ole2.h"
+
+#include "vbscript.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(vbscript);
+
+#ifdef _WIN64
+
+#define CTXARG_T DWORDLONG
+#define IActiveScriptParseVtbl IActiveScriptParse64Vtbl
+
+#else
+
+#define CTXARG_T DWORD
+#define IActiveScriptParseVtbl IActiveScriptParse32Vtbl
+
+#endif
+
+static inline VBScript *impl_from_IActiveScript(IActiveScript *iface)
+{
+ return CONTAINING_RECORD(iface, VBScript, IActiveScript_iface);
+}
+
+static HRESULT WINAPI VBScript_QueryInterface(IActiveScript *iface, REFIID riid, void **ppv)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+
+ if(IsEqualGUID(riid, &IID_IUnknown)) {
+ TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
+ *ppv = &This->IActiveScript_iface;
+ }else if(IsEqualGUID(riid, &IID_IActiveScript)) {
+ TRACE("(%p)->(IID_IActiveScript %p)\n", This, ppv);
+ *ppv = &This->IActiveScript_iface;
+ }else {
+ FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+
+ IUnknown_AddRef((IUnknown*)*ppv);
+ return S_OK;
+}
+
+static ULONG WINAPI VBScript_AddRef(IActiveScript *iface)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ LONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p) ref=%d\n", This, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI VBScript_Release(IActiveScript *iface)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ LONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p) ref=%d\n", iface, ref);
+
+ if(!ref)
+ heap_free(This);
+
+ return ref;
+}
+
+static HRESULT WINAPI VBScript_SetScriptSite(IActiveScript *iface, IActiveScriptSite *pass)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ FIXME("(%p)->(%p)\n", This, pass);
+ return S_OK;
+}
+
+static HRESULT WINAPI VBScript_GetScriptSite(IActiveScript *iface, REFIID riid,
+ void **ppvObject)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ FIXME("(%p)->()\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI VBScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE ss)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ FIXME("(%p)->(%d)\n", This, ss);
+ return S_OK;
+}
+
+static HRESULT WINAPI VBScript_GetScriptState(IActiveScript *iface, SCRIPTSTATE *pssState)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ FIXME("(%p)->(%p)\n", This, pssState);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI VBScript_Close(IActiveScript *iface)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ FIXME("(%p)->()\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI VBScript_AddNamedItem(IActiveScript *iface, LPCOLESTR pstrName, DWORD dwFlags)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ FIXME("(%p)->(%s %x)\n", This, debugstr_w(pstrName), dwFlags);
+ return S_OK;
+}
+
+static HRESULT WINAPI VBScript_AddTypeLib(IActiveScript *iface, REFGUID rguidTypeLib,
+ DWORD dwMajor, DWORD dwMinor, DWORD dwFlags)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ FIXME("(%p)->()\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI VBScript_GetScriptDispatch(IActiveScript *iface, LPCOLESTR pstrItemName, IDispatch **ppdisp)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ FIXME("(%p)->(%p)\n", This, ppdisp);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI VBScript_GetCurrentScriptThreadID(IActiveScript *iface,
+ SCRIPTTHREADID *pstridThread)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ FIXME("(%p)->()\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI VBScript_GetScriptThreadID(IActiveScript *iface,
+ DWORD dwWin32ThreadId, SCRIPTTHREADID *pstidThread)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ FIXME("(%p)->()\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI VBScript_GetScriptThreadState(IActiveScript *iface,
+ SCRIPTTHREADID stidThread, SCRIPTTHREADSTATE *pstsState)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ FIXME("(%p)->()\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI VBScript_InterruptScriptThread(IActiveScript *iface,
+ SCRIPTTHREADID stidThread, const EXCEPINFO *pexcepinfo, DWORD dwFlags)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ FIXME("(%p)->()\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI VBScript_Clone(IActiveScript *iface, IActiveScript **ppscript)
+{
+ VBScript *This = impl_from_IActiveScript(iface);
+ FIXME("(%p)->()\n", This);
+ return E_NOTIMPL;
+}
+
+static const IActiveScriptVtbl VBScriptVtbl = {
+ VBScript_QueryInterface,
+ VBScript_AddRef,
+ VBScript_Release,
+ VBScript_SetScriptSite,
+ VBScript_GetScriptSite,
+ VBScript_SetScriptState,
+ VBScript_GetScriptState,
+ VBScript_Close,
+ VBScript_AddNamedItem,
+ VBScript_AddTypeLib,
+ VBScript_GetScriptDispatch,
+ VBScript_GetCurrentScriptThreadID,
+ VBScript_GetScriptThreadID,
+ VBScript_GetScriptThreadState,
+ VBScript_InterruptScriptThread,
+ VBScript_Clone
+};
+
+HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv)
+{
+ VBScript *ret;
+ HRESULT hres;
+
+ TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppv);
+
+ ret = heap_alloc_zero(sizeof(*ret));
+ if(!ret)
+ return E_OUTOFMEMORY;
+
+ ret->IActiveScript_iface.lpVtbl = &VBScriptVtbl;
+
+ ret->ref = 1;
+
+ hres = IActiveScript_QueryInterface(&ret->IActiveScript_iface, riid, ppv);
+ IActiveScript_Release(&ret->IActiveScript_iface);
+ return hres;
+}
diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h
new file mode 100644
index 0000000..3b2da9a
--- /dev/null
+++ b/dlls/vbscript/vbscript.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2011 Jacek Caban for CodeWeavers
+ *
+ * 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 "activscp.h"
+#include "vbscript_classes.h"
+
+struct VBScript {
+ IActiveScript IActiveScript_iface;
+
+ LONG ref;
+};
+
+HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**);
+
+static inline void *heap_alloc(size_t len)
+{
+ return HeapAlloc(GetProcessHeap(), 0, len);
+}
+
+static inline void *heap_alloc_zero(size_t len)
+{
+ return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
+}
+
+static inline BOOL heap_free(void *mem)
+{
+ return HeapFree(GetProcessHeap(), 0, mem);
+}
diff --git a/dlls/vbscript/vbscript_main.c b/dlls/vbscript/vbscript_main.c
index 50e4eb7..53f2841 100644
--- a/dlls/vbscript/vbscript_main.c
+++ b/dlls/vbscript/vbscript_main.c
@@ -28,6 +28,7 @@
#include "ole2.h"
#include "rpcproxy.h"
+#include "vbscript.h"
#include "vbscript_classes.h"
#include "wine/debug.h"
@@ -36,12 +37,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(vbscript);
static HINSTANCE vbscript_hinstance;
-static HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv)
-{
- FIXME("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppv);
- return E_NOINTERFACE;
-}
-
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
{
*ppv = NULL;
More information about the wine-cvs
mailing list