jscript: Throw type error on invalid delete.
[wine.git] / dlls / jscript / jscript_main.c
blobb97e2589f5ea8d505f8e710d954ec47dd33ec801
1 /*
2 * Copyright 2008 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
19 #include "initguid.h"
21 #include "jscript.h"
23 #include "winreg.h"
24 #include "advpub.h"
25 #include "activaut.h"
26 #include "objsafe.h"
27 #include "mshtmhst.h"
28 #include "rpcproxy.h"
29 #include "jscript_classes.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(jscript);
35 LONG module_ref = 0;
37 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
39 HINSTANCE jscript_hinstance;
41 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
43 *ppv = NULL;
45 if(IsEqualGUID(&IID_IUnknown, riid)) {
46 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
47 *ppv = iface;
48 }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
49 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
50 *ppv = iface;
53 if(*ppv) {
54 IUnknown_AddRef((IUnknown*)*ppv);
55 return S_OK;
58 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
59 return E_NOINTERFACE;
62 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
64 TRACE("(%p)\n", iface);
65 return 2;
68 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
70 TRACE("(%p)\n", iface);
71 return 1;
74 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
76 TRACE("(%p)->(%x)\n", iface, fLock);
78 if(fLock)
79 lock_module();
80 else
81 unlock_module();
83 return S_OK;
86 static const IClassFactoryVtbl JScriptFactoryVtbl = {
87 ClassFactory_QueryInterface,
88 ClassFactory_AddRef,
89 ClassFactory_Release,
90 JScriptFactory_CreateInstance,
91 ClassFactory_LockServer
94 static IClassFactory JScriptFactory = { &JScriptFactoryVtbl };
96 /******************************************************************
97 * DllMain (jscript.@)
99 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
101 TRACE("(%p %d %p)\n", hInstDLL, fdwReason, lpv);
103 switch(fdwReason)
105 case DLL_WINE_PREATTACH:
106 return FALSE; /* prefer native version */
107 case DLL_PROCESS_ATTACH:
108 DisableThreadLibraryCalls(hInstDLL);
109 jscript_hinstance = hInstDLL;
110 break;
113 return TRUE;
116 /***********************************************************************
117 * DllGetClassObject (jscript.@)
119 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
121 if(IsEqualGUID(&CLSID_JScript, rclsid)) {
122 TRACE("(CLSID_JScript %s %p)\n", debugstr_guid(riid), ppv);
123 return IClassFactory_QueryInterface(&JScriptFactory, riid, ppv);
126 FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
127 return CLASS_E_CLASSNOTAVAILABLE;
130 /***********************************************************************
131 * DllCanUnloadNow (jscript.@)
133 HRESULT WINAPI DllCanUnloadNow(void)
135 TRACE("() ref=%d\n", module_ref);
137 return module_ref ? S_FALSE : S_OK;
140 /***********************************************************************
141 * DllRegisterServer (jscript.@)
143 HRESULT WINAPI DllRegisterServer(void)
145 TRACE("()\n");
146 return __wine_register_resources(jscript_hinstance);
149 /***********************************************************************
150 * DllUnregisterServer (jscript.@)
152 HRESULT WINAPI DllUnregisterServer(void)
154 TRACE("()\n");
155 return __wine_unregister_resources(jscript_hinstance);