2 * Copyright 2011 Jacek Caban for CodeWeavers
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
33 #include "vbscript_classes.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(vbscript);
39 static HINSTANCE vbscript_hinstance;
41 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
45 if(IsEqualGUID(&IID_IUnknown, riid)) {
46 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
48 }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
49 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
54 IUnknown_AddRef((IUnknown*)*ppv);
58 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
62 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
64 TRACE("(%p)\n", iface);
68 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
70 TRACE("(%p)\n", iface);
74 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
76 TRACE("(%p)->(%x)\n", iface, fLock);
80 static const IClassFactoryVtbl VBScriptFactoryVtbl = {
81 ClassFactory_QueryInterface,
84 VBScriptFactory_CreateInstance,
85 ClassFactory_LockServer
88 static IClassFactory VBScriptFactory = { &VBScriptFactoryVtbl };
90 /******************************************************************
91 * DllMain (vbscript.@)
93 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
95 TRACE("(%p %d %p)\n", hInstDLL, fdwReason, lpv);
99 case DLL_WINE_PREATTACH:
100 return FALSE; /* prefer native version */
101 case DLL_PROCESS_ATTACH:
102 DisableThreadLibraryCalls(hInstDLL);
103 vbscript_hinstance = hInstDLL;
110 /***********************************************************************
111 * DllGetClassObject (vbscript.@)
113 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
115 if(IsEqualGUID(&CLSID_VBScript, rclsid)) {
116 TRACE("(CLSID_VBScript %s %p)\n", debugstr_guid(riid), ppv);
117 return IClassFactory_QueryInterface(&VBScriptFactory, riid, ppv);
120 FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
121 return CLASS_E_CLASSNOTAVAILABLE;
124 /***********************************************************************
125 * DllCanUnloadNow (vbscript.@)
127 HRESULT WINAPI DllCanUnloadNow(void)
132 /***********************************************************************
133 * DllRegisterServer (vbscript.@)
135 HRESULT WINAPI DllRegisterServer(void)
138 return __wine_register_resources(vbscript_hinstance);
141 /***********************************************************************
142 * DllUnregisterServer (vbscript.@)
144 HRESULT WINAPI DllUnregisterServer(void)
147 return __wine_unregister_resources(vbscript_hinstance);