From 26a9f62db7a09f0e5478c536793ce31ecdb92f99 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 7 May 2015 18:56:58 +0300 Subject: [PATCH] ole32/tests: Added a test for OleRun(). --- dlls/ole32/tests/ole2.c | 76 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c index 0c27bd1e8ab..b590d3dc5f7 100644 --- a/dlls/ole32/tests/ole2.c +++ b/dlls/ole32/tests/ole2.c @@ -2074,14 +2074,90 @@ static const IUnknownVtbl UnknownVtbl = Unknown_Release }; +static HRESULT WINAPI OleRun_QueryInterface(IRunnableObject *iface, REFIID riid, void **ppv) +{ + *ppv = NULL; + + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IRunnableObject)) { + *ppv = iface; + } + + if (*ppv) + { + IUnknown_AddRef((IUnknown *)*ppv); + return S_OK; + } + + return E_NOINTERFACE; +} + +static ULONG WINAPI OleRun_AddRef(IRunnableObject *iface) +{ + return 2; +} + +static ULONG WINAPI OleRun_Release(IRunnableObject *iface) +{ + return 1; +} + +static HRESULT WINAPI OleRun_GetRunningClass(IRunnableObject *iface, CLSID *clsid) +{ + ok(0, "unxpected\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleRun_Run(IRunnableObject *iface, LPBINDCTX ctx) +{ + ok(ctx == NULL, "got %p\n", ctx); + return 0xdeadc0de; +} + +static BOOL WINAPI OleRun_IsRunning(IRunnableObject *iface) +{ + ok(0, "unxpected\n"); + return FALSE; +} + +static HRESULT WINAPI OleRun_LockRunning(IRunnableObject *iface, BOOL lock, + BOOL last_unlock_closes) +{ + ok(0, "unxpected\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleRun_SetContainedObject(IRunnableObject *iface, BOOL contained) +{ + ok(0, "unxpected\n"); + return E_NOTIMPL; +} + +static const IRunnableObjectVtbl oleruntestvtbl = +{ + OleRun_QueryInterface, + OleRun_AddRef, + OleRun_Release, + OleRun_GetRunningClass, + OleRun_Run, + OleRun_IsRunning, + OleRun_LockRunning, + OleRun_SetContainedObject +}; + static IUnknown unknown = { &UnknownVtbl }; +static IRunnableObject testrunnable = { &oleruntestvtbl }; static void test_OleRun(void) { HRESULT hr; + /* doesn't support IRunnableObject */ hr = OleRun(&unknown); ok(hr == S_OK, "OleRun failed 0x%08x\n", hr); + + hr = OleRun((IUnknown*)&testrunnable); + ok(hr == 0xdeadc0de, "got 0x%08x\n", hr); } static void test_OleLockRunning(void)