jscript: Added JScript class factory.

This commit is contained in:
Jacek Caban 2008-03-16 21:09:51 +01:00 committed by Alexandre Julliard
parent e8be5eaba7
commit 85b024d5f7
2 changed files with 62 additions and 2 deletions

View file

@ -4,7 +4,6 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = jscript.dll
IMPORTS = kernel32
EXTRALIBS = -luuid
RC_SRCS = rsrc.rc

View file

@ -27,10 +27,10 @@
#include "winbase.h"
#include "winuser.h"
#include "winreg.h"
#include "ole2.h"
#include "advpub.h"
#include "initguid.h"
#include "ole2.h"
#include "activscp.h"
#include "activaut.h"
@ -47,6 +47,62 @@ static const CLSID CLSID_JScriptEncode =
static HINSTANCE jscript_hinstance;
HRESULT WINAPI JScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter,
REFIID riid, void **ppv)
{
FIXME("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppv);
return E_NOTIMPL;
}
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
{
*ppv = NULL;
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
*ppv = iface;
}else if(IsEqualGUID(&IID_IClassFactory, riid)) {
TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
*ppv = iface;
}
if(*ppv) {
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
return E_NOINTERFACE;
}
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
{
TRACE("(%p)\n", iface);
return 2;
}
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
{
TRACE("(%p)\n", iface);
return 1;
}
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
{
TRACE("(%p)->(%x)\n", iface, fLock);
return S_OK;
}
static const IClassFactoryVtbl JScriptFactoryVtbl = {
ClassFactory_QueryInterface,
ClassFactory_AddRef,
ClassFactory_Release,
JScriptFactory_CreateInstance,
ClassFactory_LockServer
};
static IClassFactory JScriptFactory = { &JScriptFactoryVtbl };
/******************************************************************
* DllMain (jscript.@)
*/
@ -72,6 +128,11 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
*/
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
if(IsEqualGUID(&CLSID_JScript, rclsid)) {
TRACE("(CLSID_JScript %s %p)\n", debugstr_guid(riid), ppv);
return IClassFactory_QueryInterface(&JScriptFactory, riid, ppv);
}
FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
return CLASS_E_CLASSNOTAVAILABLE;
}