Commit 384d5bfd authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

vbscript: Implement IActiveScriptSite service.

parent 62000c28
......@@ -74,6 +74,7 @@ extern const CLSID CLSID_VBScript;
expect_ ## func = called_ ## func = FALSE
DEFINE_EXPECT(sp_caller_QI_NULL);
DEFINE_EXPECT(site_QI_NULL);
DEFINE_EXPECT(testGetCaller);
DEFINE_EXPECT(testGetCallerVBS);
DEFINE_EXPECT(testGetCallerNested);
......@@ -303,7 +304,9 @@ static HRESULT WINAPI Test_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WO
break;
}
case DISPID_TEST_TESTGETCALLERVBS:
case DISPID_TEST_TESTGETCALLERVBS: {
IUnknown *unk;
CHECK_EXPECT(testGetCallerVBS);
ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
......@@ -318,7 +321,14 @@ static HRESULT WINAPI Test_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WO
hres = IServiceProvider_QueryService(pspCaller, &SID_GetCaller, &IID_IServiceProvider, (void**)&caller);
ok(hres == E_NOINTERFACE, "QueryService(SID_GetCaller) returned: %08lx\n", hres);
ok(caller == NULL, "caller != NULL\n");
SET_EXPECT(site_QI_NULL);
hres = IServiceProvider_QueryService(pspCaller, &IID_IActiveScriptSite, &IID_NULL, (void**)&unk);
ok(hres == E_NOINTERFACE, "QueryService(IActiveScriptSite->NULL) returned: %08lx\n", hres);
ok(!unk, "unk != NULL\n");
CHECK_CALLED(site_QI_NULL);
break;
}
case DISPID_TEST_TESTGETCALLERNESTED:
CHECK_EXPECT(testGetCallerNested);
......@@ -374,6 +384,8 @@ static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface,
}else if(IsEqualGUID(&IID_IActiveScriptSite, riid)) {
*ppv = iface;
}else {
if(IsEqualGUID(&IID_NULL, riid))
CHECK_EXPECT(site_QI_NULL);
*ppv = NULL;
return E_NOINTERFACE;
}
......
......@@ -421,6 +421,14 @@ static HRESULT WINAPI vbcaller_QueryService(IServiceProvider *iface, REFGUID gui
{
struct vbcaller *This = vbcaller_from_IServiceProvider(iface);
if(IsEqualGUID(guidService, &IID_IActiveScriptSite)) {
TRACE("(%p)->(IID_IActiveScriptSite)\n", This);
if(This->ctx->site)
return IActiveScriptSite_QueryInterface(This->ctx->site, riid, ppv);
*ppv = NULL;
return E_NOINTERFACE;
}
if(IsEqualGUID(guidService, &SID_GetCaller)) {
TRACE("(%p)->(SID_GetCaller)\n", This);
*ppv = NULL;
......@@ -1224,6 +1232,7 @@ HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pU
return E_OUTOFMEMORY;
}
vbcaller->ctx = ctx;
ctx->vbcaller = vbcaller;
ctx->safeopt = INTERFACE_USES_DISPEX;
list_init(&ctx->objects);
......
......@@ -187,6 +187,7 @@ struct vbcaller {
LONG ref;
script_ctx_t *ctx;
IServiceProvider *caller;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment