ole32/tests: Use proper helpers for iface calls.

This commit is contained in:
Jacek Caban 2012-08-13 11:40:46 +02:00 committed by Alexandre Julliard
parent 153b94b3c5
commit df4f027238
6 changed files with 48 additions and 48 deletions

View file

@ -43,7 +43,7 @@ static HRESULT WINAPI DropTarget_QueryInterface(IDropTarget* iface, REFIID riid,
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IDropTarget))
{
IUnknown_AddRef(iface);
IDropTarget_AddRef(iface);
*ppvObject = iface;
return S_OK;
}

View file

@ -299,7 +299,7 @@ static HRESULT WINAPI TestStream_QueryInterface(IStream *iface, REFIID riid, voi
IsEqualIID(riid, &IID_IStream))
{
*ppv = iface;
IUnknown_AddRef(iface);
IStream_AddRef(iface);
return S_OK;
}
*ppv = NULL;

View file

@ -1442,7 +1442,7 @@ static DWORD CALLBACK bad_thread_proc(LPVOID p)
trace("call to proxy's QueryInterface from wrong apartment returned 0x%08x\n", hr);
/* now be really bad and release the proxy from the wrong apartment */
IUnknown_Release(cf);
IClassFactory_Release(cf);
CoUninitialize();
@ -1475,7 +1475,7 @@ static void test_proxy_used_in_wrong_thread(void)
ok_more_than_one_lock();
/* do a call that will fail, but result in IRemUnknown being used by the proxy */
IClassFactory_QueryInterface(pProxy, &IID_IStream, (LPVOID *)&pStream);
IUnknown_QueryInterface(pProxy, &IID_IStream, (LPVOID *)&pStream);
/* create a thread that we can misbehave in */
thread = CreateThread(NULL, 0, bad_thread_proc, pProxy, 0, &tid2);
@ -1500,7 +1500,7 @@ static HRESULT WINAPI MessageFilter_QueryInterface(IMessageFilter *iface, REFIID
IsEqualGUID(riid, &IID_IClassFactory))
{
*ppvObj = iface;
IClassFactory_AddRef(iface);
IMessageFilter_AddRef(iface);
return S_OK;
}
@ -2349,7 +2349,7 @@ static HRESULT WINAPI Test_SMI_QueryInterface(
IsEqualGUID(riid, &IID_IStdMarshalInfo))
{
*ppvObj = iface;
IClassFactory_AddRef(iface);
IStdMarshalInfo_AddRef(iface);
return S_OK;
}
@ -2471,10 +2471,10 @@ static void test_client_security(void)
ok_ole_success(hr, "CoUnmarshalInterface");
IStream_Release(pStream);
hr = IUnknown_QueryInterface(pProxy, &IID_IUnknown, (LPVOID*)&pUnknown1);
hr = IClassFactory_QueryInterface(pProxy, &IID_IUnknown, (LPVOID*)&pUnknown1);
ok_ole_success(hr, "IUnknown_QueryInterface IID_IUnknown");
hr = IUnknown_QueryInterface(pProxy, &IID_IRemUnknown, (LPVOID*)&pProxy2);
hr = IClassFactory_QueryInterface(pProxy, &IID_IRemUnknown, (LPVOID*)&pProxy2);
ok_ole_success(hr, "IUnknown_QueryInterface IID_IStream");
hr = IUnknown_QueryInterface(pProxy2, &IID_IUnknown, (LPVOID*)&pUnknown2);
@ -2482,10 +2482,10 @@ static void test_client_security(void)
ok(pUnknown1 == pUnknown2, "both proxy's IUnknowns should be the same - %p, %p\n", pUnknown1, pUnknown2);
hr = IUnknown_QueryInterface(pProxy, &IID_IMarshal, (LPVOID*)&pMarshal);
hr = IClassFactory_QueryInterface(pProxy, &IID_IMarshal, (LPVOID*)&pMarshal);
ok_ole_success(hr, "IUnknown_QueryInterface IID_IMarshal");
hr = IUnknown_QueryInterface(pProxy, &IID_IClientSecurity, (LPVOID*)&pCliSec);
hr = IClassFactory_QueryInterface(pProxy, &IID_IClientSecurity, (LPVOID*)&pCliSec);
ok_ole_success(hr, "IUnknown_QueryInterface IID_IClientSecurity");
hr = IClientSecurity_QueryBlanket(pCliSec, (IUnknown *)pProxy, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
@ -2942,7 +2942,7 @@ static HRESULT WINAPI TestChannelHook_QueryInterface(IChannelHook *iface, REFIID
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IChannelHook))
{
*ppv = iface;
IUnknown_AddRef(iface);
IChannelHook_AddRef(iface);
return S_OK;
}

View file

@ -723,7 +723,7 @@ static HRESULT WINAPI ParseDisplayName_QueryInterface(IParseDisplayName *iface,
IsEqualIID(riid, &IID_IParseDisplayName))
{
*ppv = iface;
IUnknown_AddRef(iface);
IParseDisplayName_AddRef(iface);
return S_OK;
}
*ppv = NULL;

View file

@ -616,7 +616,7 @@ static HRESULT WINAPI OleObjectCF_QueryInterface(IClassFactory *iface, REFIID ri
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
{
*ppv = iface;
IUnknown_AddRef(iface);
IClassFactory_AddRef(iface);
return S_OK;
}
*ppv = NULL;
@ -997,7 +997,7 @@ static HRESULT WINAPI AdviseSink_QueryInterface(IAdviseSink *iface, REFIID riid,
if (IsEqualIID(riid, &IID_IAdviseSink) || IsEqualIID(riid, &IID_IUnknown))
{
*ppv = iface;
IUnknown_AddRef(iface);
IAdviseSink_AddRef(iface);
return S_OK;
}
*ppv = NULL;
@ -1279,11 +1279,11 @@ static void test_data_cache(void)
hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IOleCache2, (LPVOID *)&pOleCache);
ok_ole_success(hr, "CreateDataCache");
hr = IOleCache_QueryInterface(pOleCache, &IID_IPersistStorage, (LPVOID *)&pPS);
hr = IOleCache2_QueryInterface(pOleCache, &IID_IPersistStorage, (LPVOID *)&pPS);
ok_ole_success(hr, "IOleCache_QueryInterface(IID_IPersistStorage)");
hr = IOleCache_QueryInterface(pOleCache, &IID_IViewObject, (LPVOID *)&pViewObject);
hr = IOleCache2_QueryInterface(pOleCache, &IID_IViewObject, (LPVOID *)&pViewObject);
ok_ole_success(hr, "IOleCache_QueryInterface(IID_IViewObject)");
hr = IOleCache_QueryInterface(pOleCache, &IID_IOleCacheControl, (LPVOID *)&pOleCacheControl);
hr = IOleCache2_QueryInterface(pOleCache, &IID_IOleCacheControl, (LPVOID *)&pOleCacheControl);
ok_ole_success(hr, "IOleCache_QueryInterface(IID_IOleCacheControl)");
hr = IViewObject_SetAdvise(pViewObject, DVASPECT_ICON, ADVF_PRIMEFIRST, &AdviseSink);
@ -1299,16 +1299,16 @@ static void test_data_cache(void)
ok_ole_success(hr, "IPersistStorage_GetClassID");
ok(IsEqualCLSID(&clsid, &IID_NULL), "clsid should be blank\n");
hr = IOleCache_Uncache(pOleCache, 0xdeadbeef);
hr = IOleCache2_Uncache(pOleCache, 0xdeadbeef);
ok(hr == OLE_E_NOCONNECTION, "IOleCache_Uncache with invalid value should return OLE_E_NOCONNECTION instead of 0x%x\n", hr);
/* Both tests crash on NT4 and below. StgCreatePropSetStg is only available on w2k and above. */
if (GetProcAddress(GetModuleHandleA("ole32.dll"), "StgCreatePropSetStg"))
{
hr = IOleCache_Cache(pOleCache, NULL, 0, &dwConnection);
hr = IOleCache2_Cache(pOleCache, NULL, 0, &dwConnection);
ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL fmtetc should have returned E_INVALIDARG instead of 0x%08x\n", hr);
hr = IOleCache_Cache(pOleCache, NULL, 0, NULL);
hr = IOleCache2_Cache(pOleCache, NULL, 0, NULL);
ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL pdwConnection should have returned E_INVALIDARG instead of 0x%08x\n", hr);
}
else
@ -1323,7 +1323,7 @@ static void test_data_cache(void)
for (i = 0; i < 7; i++)
{
fmtetc.tymed = 1 << i;
hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
if ((fmtetc.cfFormat == CF_METAFILEPICT && fmtetc.tymed == TYMED_MFPICT) ||
(fmtetc.cfFormat == CF_BITMAP && fmtetc.tymed == TYMED_GDI) ||
(fmtetc.cfFormat == CF_DIB && fmtetc.tymed == TYMED_HGLOBAL) ||
@ -1340,7 +1340,7 @@ static void test_data_cache(void)
fmtetc.cfFormat, fmtetc.tymed, hr);
if (SUCCEEDED(hr))
{
hr = IOleCache_Uncache(pOleCache, dwConnection);
hr = IOleCache2_Uncache(pOleCache, dwConnection);
ok_ole_success(hr, "IOleCache_Uncache");
}
}
@ -1349,13 +1349,13 @@ static void test_data_cache(void)
fmtetc.cfFormat = CF_BITMAP;
fmtetc.dwAspect = DVASPECT_THUMBNAIL;
fmtetc.tymed = TYMED_GDI;
hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
ok_ole_success(hr, "IOleCache_Cache");
fmtetc.cfFormat = 0;
fmtetc.dwAspect = DVASPECT_ICON;
fmtetc.tymed = TYMED_MFPICT;
hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
ok_ole_success(hr, "IOleCache_Cache");
MultiByteToWideChar(CP_ACP, 0, szSystemDir, -1, wszPath, sizeof(wszPath)/sizeof(wszPath[0]));
@ -1368,11 +1368,11 @@ static void test_data_cache(void)
stgmedium.pUnkForRelease = NULL;
fmtetc.dwAspect = DVASPECT_CONTENT;
hr = IOleCache_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
hr = IOleCache2_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
ok(hr == OLE_E_BLANK, "IOleCache_SetData for aspect not in cache should have return OLE_E_BLANK instead of 0x%08x\n", hr);
fmtetc.dwAspect = DVASPECT_ICON;
hr = IOleCache_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
hr = IOleCache2_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
ok_ole_success(hr, "IOleCache_SetData");
ReleaseStgMedium(&stgmedium);
@ -1421,7 +1421,7 @@ static void test_data_cache(void)
IPersistStorage_Release(pPS);
IViewObject_Release(pViewObject);
IOleCache_Release(pOleCache);
IOleCache2_Release(pOleCache);
IOleCacheControl_Release(pOleCacheControl);
CHECK_NO_EXTRA_METHODS();
@ -1433,9 +1433,9 @@ static void test_data_cache(void)
hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IOleCache2, (LPVOID *)&pOleCache);
ok_ole_success(hr, "CreateDataCache");
hr = IOleCache_QueryInterface(pOleCache, &IID_IPersistStorage, (LPVOID *)&pPS);
hr = IOleCache2_QueryInterface(pOleCache, &IID_IPersistStorage, (LPVOID *)&pPS);
ok_ole_success(hr, "IOleCache_QueryInterface(IID_IPersistStorage)");
hr = IOleCache_QueryInterface(pOleCache, &IID_IViewObject, (LPVOID *)&pViewObject);
hr = IOleCache2_QueryInterface(pOleCache, &IID_IViewObject, (LPVOID *)&pViewObject);
ok_ole_success(hr, "IOleCache_QueryInterface(IID_IViewObject)");
hr = IViewObject_SetAdvise(pViewObject, DVASPECT_ICON, ADVF_PRIMEFIRST, &AdviseSink);
@ -1452,7 +1452,7 @@ static void test_data_cache(void)
fmtetc.lindex = -1;
fmtetc.ptd = NULL;
fmtetc.tymed = TYMED_MFPICT;
hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
ok(hr == CACHE_S_SAMECACHE, "IOleCache_Cache with already loaded data format type should return CACHE_S_SAMECACHE instead of 0x%x\n", hr);
rcBounds.left = 0;
@ -1486,13 +1486,13 @@ static void test_data_cache(void)
DeleteDC(hdcMem);
todo_wine {
hr = IOleCache_InitCache(pOleCache, &DataObject);
hr = IOleCache2_InitCache(pOleCache, &DataObject);
ok(hr == CACHE_E_NOCACHE_UPDATED, "IOleCache_InitCache should have returned CACHE_E_NOCACHE_UPDATED instead of 0x%08x\n", hr);
}
IPersistStorage_Release(pPS);
IViewObject_Release(pViewObject);
IOleCache_Release(pOleCache);
IOleCache2_Release(pOleCache);
todo_wine {
CHECK_NO_EXTRA_METHODS();
@ -1503,16 +1503,16 @@ static void test_data_cache(void)
expected_method_list = methods_cachethenrun;
hr = IOleCache_QueryInterface(pOleCache, &IID_IDataObject, (LPVOID *)&pCacheDataObject);
hr = IOleCache2_QueryInterface(pOleCache, &IID_IDataObject, (LPVOID *)&pCacheDataObject);
ok_ole_success(hr, "IOleCache_QueryInterface(IID_IDataObject)");
hr = IOleCache_QueryInterface(pOleCache, &IID_IOleCacheControl, (LPVOID *)&pOleCacheControl);
hr = IOleCache2_QueryInterface(pOleCache, &IID_IOleCacheControl, (LPVOID *)&pOleCacheControl);
ok_ole_success(hr, "IOleCache_QueryInterface(IID_IOleCacheControl)");
fmtetc.cfFormat = CF_METAFILEPICT;
fmtetc.dwAspect = DVASPECT_CONTENT;
fmtetc.tymed = TYMED_MFPICT;
hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
ok_ole_success(hr, "IOleCache_Cache");
hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
@ -1522,14 +1522,14 @@ static void test_data_cache(void)
fmtetc.dwAspect = DVASPECT_CONTENT;
fmtetc.tymed = TYMED_HGLOBAL;
hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr);
hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
ok(hr == OLE_E_BLANK, "got %08x\n", hr);
fmtetc.cfFormat = cf_test_2;
hr = IOleCache_Cache(pOleCache, &fmtetc, ADVF_PRIMEFIRST, &dwConnection);
hr = IOleCache2_Cache(pOleCache, &fmtetc, ADVF_PRIMEFIRST, &dwConnection);
ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr);
hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
@ -1539,7 +1539,7 @@ static void test_data_cache(void)
ok_ole_success(hr, "IOleCacheControl_OnRun");
fmtetc.cfFormat = cf_test_3;
hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection);
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr);
fmtetc.cfFormat = cf_test_1;
@ -1557,7 +1557,7 @@ static void test_data_cache(void)
IOleCacheControl_Release(pOleCacheControl);
IDataObject_Release(pCacheDataObject);
IOleCache_Release(pOleCache);
IOleCache2_Release(pOleCache);
CHECK_NO_EXTRA_METHODS();

View file

@ -1332,7 +1332,7 @@ static void test_substorage_share(void)
ok(r==STG_E_REVERTED, "IStorage->CreateStream failed, hr=%08x\n", r);
if (r == S_OK)
IStorage_Release(stm);
IStream_Release(stm);
IStorage_Release(stg2);
}
@ -1347,13 +1347,13 @@ static void test_substorage_share(void)
ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStream should fail %08x\n", r);
if (r == S_OK)
IStorage_Release(stm2);
IStream_Release(stm2);
r = IStorage_OpenStream(stg, stmname, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm2);
ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStream should fail %08x\n", r);
if (r == S_OK)
IStorage_Release(stm2);
IStream_Release(stm2);
/* cannot rename the stream while it's open */
r = IStorage_RenameElement(stg, stmname, othername);
@ -1367,7 +1367,7 @@ static void test_substorage_share(void)
r = IStream_Write(stm, "this shouldn't work\n", 20, NULL);
ok(r==STG_E_REVERTED, "IStream_Write should fail %08x\n", r);
IStorage_Release(stm);
IStream_Release(stm);
}
IStorage_Release(stg);
@ -1521,7 +1521,7 @@ static void test_revert(void)
ok(r==S_OK, "IStream_Write should succeed %08x\n", r);
IStream_Release(stm);
IStream_Release(stg);
IStorage_Release(stg);
r = DeleteFileA(filenameA);
ok( r == TRUE, "deleted file\n");
@ -1651,7 +1651,7 @@ static void test_nonroot_transacted(void)
r = IStorage_CreateStorage(stg2, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
if (r == S_OK)
IStream_Release(stg3);
IStorage_Release(stg3);
/* But changes cannot be committed. */
r = IStorage_Commit(stg2, 0);
@ -1703,7 +1703,7 @@ static void test_nonroot_transacted(void)
IStorage_Release(stg2);
}
IStream_Release(stg);
IStorage_Release(stg);
r = DeleteFileA(filenameA);
ok( r == TRUE, "deleted file\n");
@ -2009,13 +2009,13 @@ static void test_readonly(void)
hr = IStorage_CreateStorage( stg2, streamW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READ, 0, 0, &stg3 );
ok(hr == STG_E_FILEALREADYEXISTS, "should fail, res=%x\n", hr);
if (SUCCEEDED(hr))
IStream_Release(stg3);
IStorage_Release(stg3);
/* CreateStorage on read-only storage, name does not exist */
hr = IStorage_CreateStorage( stg2, storageW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READ, 0, 0, &stg3 );
ok(hr == STG_E_ACCESSDENIED, "should fail, res=%x\n", hr);
if (SUCCEEDED(hr))
IStream_Release(stg3);
IStorage_Release(stg3);
/* DestroyElement on read-only storage, name exists */
hr = IStorage_DestroyElement( stg2, streamW );