Commit 01e7891d authored by Mikolaj Zalewski's avatar Mikolaj Zalewski Committed by Alexandre Julliard

ole32: OleIsRunning should return TRUE if the class doesn't implement IRunnableObject.

parent fa0524a4
...@@ -2515,7 +2515,7 @@ BOOL WINAPI OleIsRunning(LPOLEOBJECT pObject) ...@@ -2515,7 +2515,7 @@ BOOL WINAPI OleIsRunning(LPOLEOBJECT pObject)
hr = IOleObject_QueryInterface(pObject, &IID_IRunnableObject, (void **)&pRunnable); hr = IOleObject_QueryInterface(pObject, &IID_IRunnableObject, (void **)&pRunnable);
if (FAILED(hr)) if (FAILED(hr))
return FALSE; return TRUE;
running = IRunnableObject_IsRunning(pRunnable); running = IRunnableObject_IsRunning(pRunnable);
IRunnableObject_Release(pRunnable); IRunnableObject_Release(pRunnable);
return running; return running;
......
...@@ -46,6 +46,9 @@ static const CLSID CLSID_WineTest = ...@@ -46,6 +46,9 @@ static const CLSID CLSID_WineTest =
static char const * const *expected_method_list; static char const * const *expected_method_list;
BOOL g_showRunnable = TRUE;
BOOL g_isRunning = TRUE;
#define CHECK_EXPECTED_METHOD(method_name) \ #define CHECK_EXPECTED_METHOD(method_name) \
do { \ do { \
trace("%s\n", method_name); \ trace("%s\n", method_name); \
...@@ -70,7 +73,7 @@ static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, v ...@@ -70,7 +73,7 @@ static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, v
*ppv = &OleObjectPersistStg; *ppv = &OleObjectPersistStg;
else if (IsEqualIID(riid, &IID_IOleCache)) else if (IsEqualIID(riid, &IID_IOleCache))
*ppv = cache; *ppv = cache;
else if (IsEqualIID(riid, &IID_IRunnableObject)) else if (IsEqualIID(riid, &IID_IRunnableObject) && g_showRunnable)
*ppv = runnable; *ppv = runnable;
if(*ppv) { if(*ppv) {
...@@ -616,7 +619,7 @@ static HRESULT WINAPI OleObjectRunnable_Run( ...@@ -616,7 +619,7 @@ static HRESULT WINAPI OleObjectRunnable_Run(
static BOOL WINAPI OleObjectRunnable_IsRunning(IRunnableObject *iface) static BOOL WINAPI OleObjectRunnable_IsRunning(IRunnableObject *iface)
{ {
CHECK_EXPECTED_METHOD("OleObjectRunnable_IsRunning"); CHECK_EXPECTED_METHOD("OleObjectRunnable_IsRunning");
return TRUE; return g_isRunning;
} }
static HRESULT WINAPI OleObjectRunnable_LockRunning( static HRESULT WINAPI OleObjectRunnable_LockRunning(
...@@ -1453,6 +1456,43 @@ static void test_default_handler(void) ...@@ -1453,6 +1456,43 @@ static void test_default_handler(void)
IOleObject_Release(pObject); IOleObject_Release(pObject);
} }
void test_runnable(void)
{
static const char *methods_query_runnable[] =
{
"OleObject_QueryInterface",
"OleObjectRunnable_AddRef",
"OleObjectRunnable_IsRunning",
"OleObjectRunnable_Release",
NULL
};
static const char *methods_no_runnable[] =
{
"OleObject_QueryInterface",
NULL
};
IOleObject *object = (IOleObject *)&OleObject;
expected_method_list = methods_query_runnable;
ok(OleIsRunning(object), "Object should be running\n");
ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
g_isRunning = FALSE;
expected_method_list = methods_query_runnable;
ok(OleIsRunning(object) == FALSE, "Object should not be running\n");
ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
g_showRunnable = FALSE; /* QueryInterface(IID_IRunnableObject, ...) will fail */
expected_method_list = methods_no_runnable;
ok(OleIsRunning(object), "Object without IRunnableObject should be running\n");
ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
g_isRunning = TRUE;
g_showRunnable = TRUE;
}
START_TEST(ole2) START_TEST(ole2)
{ {
DWORD dwRegister; DWORD dwRegister;
...@@ -1483,6 +1523,7 @@ START_TEST(ole2) ...@@ -1483,6 +1523,7 @@ START_TEST(ole2)
test_data_cache(); test_data_cache();
test_default_handler(); test_default_handler();
test_runnable();
CoUninitialize(); CoUninitialize();
} }
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