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; ...@@ -74,6 +74,7 @@ extern const CLSID CLSID_VBScript;
expect_ ## func = called_ ## func = FALSE expect_ ## func = called_ ## func = FALSE
DEFINE_EXPECT(sp_caller_QI_NULL); DEFINE_EXPECT(sp_caller_QI_NULL);
DEFINE_EXPECT(site_QI_NULL);
DEFINE_EXPECT(testGetCaller); DEFINE_EXPECT(testGetCaller);
DEFINE_EXPECT(testGetCallerVBS); DEFINE_EXPECT(testGetCallerVBS);
DEFINE_EXPECT(testGetCallerNested); DEFINE_EXPECT(testGetCallerNested);
...@@ -303,7 +304,9 @@ static HRESULT WINAPI Test_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WO ...@@ -303,7 +304,9 @@ static HRESULT WINAPI Test_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WO
break; break;
} }
case DISPID_TEST_TESTGETCALLERVBS: case DISPID_TEST_TESTGETCALLERVBS: {
IUnknown *unk;
CHECK_EXPECT(testGetCallerVBS); CHECK_EXPECT(testGetCallerVBS);
ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags); ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
...@@ -318,7 +321,14 @@ static HRESULT WINAPI Test_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WO ...@@ -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); hres = IServiceProvider_QueryService(pspCaller, &SID_GetCaller, &IID_IServiceProvider, (void**)&caller);
ok(hres == E_NOINTERFACE, "QueryService(SID_GetCaller) returned: %08lx\n", hres); ok(hres == E_NOINTERFACE, "QueryService(SID_GetCaller) returned: %08lx\n", hres);
ok(caller == NULL, "caller != NULL\n"); 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; break;
}
case DISPID_TEST_TESTGETCALLERNESTED: case DISPID_TEST_TESTGETCALLERNESTED:
CHECK_EXPECT(testGetCallerNested); CHECK_EXPECT(testGetCallerNested);
...@@ -374,6 +384,8 @@ static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, ...@@ -374,6 +384,8 @@ static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface,
}else if(IsEqualGUID(&IID_IActiveScriptSite, riid)) { }else if(IsEqualGUID(&IID_IActiveScriptSite, riid)) {
*ppv = iface; *ppv = iface;
}else { }else {
if(IsEqualGUID(&IID_NULL, riid))
CHECK_EXPECT(site_QI_NULL);
*ppv = NULL; *ppv = NULL;
return E_NOINTERFACE; return E_NOINTERFACE;
} }
......
...@@ -421,6 +421,14 @@ static HRESULT WINAPI vbcaller_QueryService(IServiceProvider *iface, REFGUID gui ...@@ -421,6 +421,14 @@ static HRESULT WINAPI vbcaller_QueryService(IServiceProvider *iface, REFGUID gui
{ {
struct vbcaller *This = vbcaller_from_IServiceProvider(iface); 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)) { if(IsEqualGUID(guidService, &SID_GetCaller)) {
TRACE("(%p)->(SID_GetCaller)\n", This); TRACE("(%p)->(SID_GetCaller)\n", This);
*ppv = NULL; *ppv = NULL;
...@@ -1224,6 +1232,7 @@ HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pU ...@@ -1224,6 +1232,7 @@ HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pU
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
vbcaller->ctx = ctx;
ctx->vbcaller = vbcaller; ctx->vbcaller = vbcaller;
ctx->safeopt = INTERFACE_USES_DISPEX; ctx->safeopt = INTERFACE_USES_DISPEX;
list_init(&ctx->objects); list_init(&ctx->objects);
......
...@@ -187,6 +187,7 @@ struct vbcaller { ...@@ -187,6 +187,7 @@ struct vbcaller {
LONG ref; LONG ref;
script_ctx_t *ctx;
IServiceProvider *caller; 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