ole32: Handle null argument in OleIsRunning().

This commit is contained in:
Nikolay Sivov 2011-04-08 13:31:33 +04:00 committed by Alexandre Julliard
parent 032c374307
commit 0c33682330
2 changed files with 16 additions and 6 deletions

View File

@ -2628,15 +2628,17 @@ HRESULT WINAPI OleDoAutoConvert(LPSTORAGE pStg, LPCLSID pClsidNew)
/******************************************************************************
* OleIsRunning [OLE32.@]
*/
BOOL WINAPI OleIsRunning(LPOLEOBJECT pObject)
BOOL WINAPI OleIsRunning(LPOLEOBJECT object)
{
IRunnableObject *pRunnable;
HRESULT hr;
BOOL running;
TRACE("(%p)\n", pObject);
TRACE("(%p)\n", object);
hr = IOleObject_QueryInterface(pObject, &IID_IRunnableObject, (void **)&pRunnable);
if (!object) return FALSE;
hr = IOleObject_QueryInterface(object, &IID_IRunnableObject, (void **)&pRunnable);
if (FAILED(hr))
return TRUE;
running = IRunnableObject_IsRunning(pRunnable);

View File

@ -1784,20 +1784,28 @@ static void test_runnable(void)
{ NULL, 0 }
};
BOOL ret;
IOleObject *object = &OleObject;
/* null argument */
ret = OleIsRunning(NULL);
ok(ret == FALSE, "got %d\n", ret);
expected_method_list = methods_query_runnable;
ok(OleIsRunning(object), "Object should be running\n");
ret = OleIsRunning(object);
ok(ret == TRUE, "Object should be running\n");
CHECK_NO_EXTRA_METHODS();
g_isRunning = FALSE;
expected_method_list = methods_query_runnable;
ok(OleIsRunning(object) == FALSE, "Object should not be running\n");
ret = OleIsRunning(object);
ok(ret == FALSE, "Object should not be running\n");
CHECK_NO_EXTRA_METHODS();
g_showRunnable = FALSE; /* QueryInterface(IID_IRunnableObject, ...) will fail */
expected_method_list = methods_no_runnable;
ok(OleIsRunning(object), "Object without IRunnableObject should be running\n");
ret = OleIsRunning(object);
ok(ret == TRUE, "Object without IRunnableObject should be running\n");
CHECK_NO_EXTRA_METHODS();
g_isRunning = TRUE;