oleaut32: Implicitly initialize COM in OleLoadPicturePath.
This commit is contained in:
parent
61f7f77636
commit
96dbdcb8c9
|
@ -2273,6 +2273,7 @@ HRESULT WINAPI OleLoadPicturePath( LPOLESTR szURLorPath, LPUNKNOWN punkCaller,
|
|||
BOOL bRead;
|
||||
IPersistStream *pStream;
|
||||
HRESULT hRes;
|
||||
HRESULT init_res;
|
||||
WCHAR *file_candidate;
|
||||
WCHAR path_buf[MAX_PATH];
|
||||
|
||||
|
@ -2349,34 +2350,32 @@ HRESULT WINAPI OleLoadPicturePath( LPOLESTR szURLorPath, LPUNKNOWN punkCaller,
|
|||
return hRes;
|
||||
}
|
||||
|
||||
hRes = CoCreateInstance(&CLSID_StdPicture, punkCaller, CLSCTX_INPROC_SERVER,
|
||||
&IID_IPicture, (LPVOID*)&ipicture);
|
||||
if (hRes != S_OK) {
|
||||
IStream_Release(stream);
|
||||
return hRes;
|
||||
}
|
||||
|
||||
hRes = IPicture_QueryInterface(ipicture, &IID_IPersistStream, (LPVOID*)&pStream);
|
||||
if (hRes) {
|
||||
IStream_Release(stream);
|
||||
init_res = CoInitialize(NULL);
|
||||
|
||||
hRes = CoCreateInstance(&CLSID_StdPicture, punkCaller, CLSCTX_INPROC_SERVER,
|
||||
&IID_IPicture, (LPVOID*)&ipicture);
|
||||
if (SUCCEEDED(hRes)) {
|
||||
hRes = IPicture_QueryInterface(ipicture, &IID_IPersistStream, (LPVOID*)&pStream);
|
||||
|
||||
if (SUCCEEDED(hRes)) {
|
||||
hRes = IPersistStream_Load(pStream, stream);
|
||||
|
||||
if (SUCCEEDED(hRes)) {
|
||||
hRes = IPicture_QueryInterface(ipicture, riid, ppvRet);
|
||||
|
||||
if (FAILED(hRes))
|
||||
ERR("Failed to get interface %s from IPicture.\n", debugstr_guid(riid));
|
||||
}
|
||||
IPersistStream_Release(pStream);
|
||||
}
|
||||
IPicture_Release(ipicture);
|
||||
return hRes;
|
||||
}
|
||||
|
||||
hRes = IPersistStream_Load(pStream, stream);
|
||||
IPersistStream_Release(pStream);
|
||||
IStream_Release(stream);
|
||||
|
||||
if (hRes) {
|
||||
IPicture_Release(ipicture);
|
||||
return hRes;
|
||||
}
|
||||
if (SUCCEEDED(init_res))
|
||||
CoUninitialize();
|
||||
|
||||
hRes = IPicture_QueryInterface(ipicture,riid,ppvRet);
|
||||
if (hRes)
|
||||
ERR("Failed to get interface %s from IPicture.\n",debugstr_guid(riid));
|
||||
|
||||
IPicture_Release(ipicture);
|
||||
return hRes;
|
||||
}
|
||||
|
||||
|
|
|
@ -813,7 +813,6 @@ static void test_OleLoadPicturePath(void)
|
|||
|
||||
/* Try a normal DOS path. */
|
||||
hres = OleLoadPicturePath(temp_fileW + 8, NULL, 0, 0, &IID_IPicture, (void **)&pic);
|
||||
todo_wine
|
||||
ok(hres == S_OK ||
|
||||
broken(hres == E_UNEXPECTED), /* NT4/Win95 */
|
||||
"Expected OleLoadPicturePath to return S_OK, got 0x%08x\n", hres);
|
||||
|
@ -822,7 +821,6 @@ static void test_OleLoadPicturePath(void)
|
|||
|
||||
/* Try a DOS path with tacked on "file:". */
|
||||
hres = OleLoadPicturePath(temp_fileW, NULL, 0, 0, &IID_IPicture, (void **)&pic);
|
||||
todo_wine
|
||||
ok(hres == S_OK ||
|
||||
broken(hres == E_UNEXPECTED), /* NT4/Win95 */
|
||||
"Expected OleLoadPicturePath to return S_OK, got 0x%08x\n", hres);
|
||||
|
@ -859,7 +857,6 @@ static void test_OleLoadPicturePath(void)
|
|||
}
|
||||
|
||||
hres = OleLoadPicturePath(temp_fileW, NULL, 0, 0, &IID_IPicture, (void **)&pic);
|
||||
todo_wine
|
||||
ok(hres == S_OK ||
|
||||
broken(hres == E_UNEXPECTED), /* NT4/Win95 */
|
||||
"Expected OleLoadPicturePath to return S_OK, got 0x%08x\n", hres);
|
||||
|
|
Loading…
Reference in New Issue