jscript: Added beginning support for JScriptEncode object.

This commit is contained in:
Jacek Caban 2012-03-26 11:41:56 +02:00 committed by Alexandre Julliard
parent 0762106648
commit 4a9eea3516
3 changed files with 47 additions and 12 deletions

View File

@ -55,6 +55,7 @@ typedef struct {
LONG thread_id;
LCID lcid;
DWORD version;
BOOL is_encode;
IActiveScriptSite *site;
@ -1029,25 +1030,17 @@ static const IVariantChangeTypeVtbl VariantChangeTypeVtbl = {
VariantChangeType_ChangeType
};
HRESULT WINAPI JScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter,
REFIID riid, void **ppv)
HRESULT create_jscript_object(BOOL is_encode, REFIID riid, void **ppv)
{
JScript *ret;
HRESULT hres;
TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppv);
if(pUnkOuter) {
*ppv = NULL;
return CLASS_E_NOAGGREGATION;
}
lock_module();
ret = heap_alloc_zero(sizeof(*ret));
if(!ret)
return E_OUTOFMEMORY;
lock_module();
ret->IActiveScript_iface.lpVtbl = &JScriptVtbl;
ret->IActiveScriptParse_iface.lpVtbl = &JScriptParseVtbl;
ret->IActiveScriptParseProcedure2_iface.lpVtbl = &JScriptParseProcedureVtbl;
@ -1056,6 +1049,7 @@ HRESULT WINAPI JScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pUn
ret->IVariantChangeType_iface.lpVtbl = &VariantChangeTypeVtbl;
ret->ref = 1;
ret->safeopt = INTERFACE_USES_DISPEX;
ret->is_encode = is_encode;
hres = IActiveScript_QueryInterface(&ret->IActiveScript_iface, riid, ppv);
IActiveScript_Release(&ret->IActiveScript_iface);

View File

@ -505,7 +505,7 @@ static inline BOOL is_jscript_error(HRESULT hres)
const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
HRESULT WINAPI JScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
HRESULT create_jscript_object(BOOL,REFIID,void**) DECLSPEC_HIDDEN;
extern LONG module_ref DECLSPEC_HIDDEN;

View File

@ -83,6 +83,19 @@ static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
return S_OK;
}
static HRESULT WINAPI JScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *outer,
REFIID riid, void **ppv)
{
TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
if(outer) {
*ppv = NULL;
return CLASS_E_NOAGGREGATION;
}
return create_jscript_object(FALSE, riid, ppv);
}
static const IClassFactoryVtbl JScriptFactoryVtbl = {
ClassFactory_QueryInterface,
ClassFactory_AddRef,
@ -93,6 +106,29 @@ static const IClassFactoryVtbl JScriptFactoryVtbl = {
static IClassFactory JScriptFactory = { &JScriptFactoryVtbl };
static HRESULT WINAPI JScriptEncodeFactory_CreateInstance(IClassFactory *iface, IUnknown *outer,
REFIID riid, void **ppv)
{
TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
if(outer) {
*ppv = NULL;
return CLASS_E_NOAGGREGATION;
}
return create_jscript_object(TRUE, riid, ppv);
}
static const IClassFactoryVtbl JScriptEncodeFactoryVtbl = {
ClassFactory_QueryInterface,
ClassFactory_AddRef,
ClassFactory_Release,
JScriptEncodeFactory_CreateInstance,
ClassFactory_LockServer
};
static IClassFactory JScriptEncodeFactory = { &JScriptEncodeFactoryVtbl };
/******************************************************************
* DllMain (jscript.@)
*/
@ -123,6 +159,11 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
return IClassFactory_QueryInterface(&JScriptFactory, riid, ppv);
}
if(IsEqualGUID(&CLSID_JScriptEncode, rclsid)) {
TRACE("(CLSID_JScriptEncode %s %p)\n", debugstr_guid(riid), ppv);
return IClassFactory_QueryInterface(&JScriptEncodeFactory, riid, ppv);
}
FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
return CLASS_E_CLASSNOTAVAILABLE;
}