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
29 #include "jscript_classes.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(jscript
);
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
)
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
);
86 static HRESULT WINAPI
JScriptFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
,
87 REFIID riid
, void **ppv
)
89 TRACE("(%p %s %p)\n", outer
, debugstr_guid(riid
), ppv
);
93 return CLASS_E_NOAGGREGATION
;
96 return create_jscript_object(FALSE
, riid
, ppv
);
99 static const IClassFactoryVtbl JScriptFactoryVtbl
= {
100 ClassFactory_QueryInterface
,
102 ClassFactory_Release
,
103 JScriptFactory_CreateInstance
,
104 ClassFactory_LockServer
107 static IClassFactory JScriptFactory
= { &JScriptFactoryVtbl
};
109 static HRESULT WINAPI
JScriptEncodeFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
,
110 REFIID riid
, void **ppv
)
112 TRACE("(%p %s %p)\n", outer
, debugstr_guid(riid
), ppv
);
116 return CLASS_E_NOAGGREGATION
;
119 return create_jscript_object(TRUE
, riid
, ppv
);
122 static const IClassFactoryVtbl JScriptEncodeFactoryVtbl
= {
123 ClassFactory_QueryInterface
,
125 ClassFactory_Release
,
126 JScriptEncodeFactory_CreateInstance
,
127 ClassFactory_LockServer
130 static IClassFactory JScriptEncodeFactory
= { &JScriptEncodeFactoryVtbl
};
132 /******************************************************************
133 * DllMain (jscript.@)
135 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
137 TRACE("(%p %d %p)\n", hInstDLL
, fdwReason
, lpv
);
141 case DLL_WINE_PREATTACH
:
142 return FALSE
; /* prefer native version */
143 case DLL_PROCESS_ATTACH
:
144 DisableThreadLibraryCalls(hInstDLL
);
145 jscript_hinstance
= hInstDLL
;
152 /***********************************************************************
153 * DllGetClassObject (jscript.@)
155 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
157 if(IsEqualGUID(&CLSID_JScript
, rclsid
)) {
158 TRACE("(CLSID_JScript %s %p)\n", debugstr_guid(riid
), ppv
);
159 return IClassFactory_QueryInterface(&JScriptFactory
, riid
, ppv
);
162 if(IsEqualGUID(&CLSID_JScriptEncode
, rclsid
)) {
163 TRACE("(CLSID_JScriptEncode %s %p)\n", debugstr_guid(riid
), ppv
);
164 return IClassFactory_QueryInterface(&JScriptEncodeFactory
, riid
, ppv
);
167 FIXME("%s %s %p\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
168 return CLASS_E_CLASSNOTAVAILABLE
;
171 /***********************************************************************
172 * DllCanUnloadNow (jscript.@)
174 HRESULT WINAPI
DllCanUnloadNow(void)
176 TRACE("() ref=%d\n", module_ref
);
178 return module_ref
? S_FALSE
: S_OK
;
181 /***********************************************************************
182 * DllRegisterServer (jscript.@)
184 HRESULT WINAPI
DllRegisterServer(void)
187 return __wine_register_resources(jscript_hinstance
);
190 /***********************************************************************
191 * DllUnregisterServer (jscript.@)
193 HRESULT WINAPI
DllUnregisterServer(void)
196 return __wine_unregister_resources(jscript_hinstance
);