BOOL bRead;
IPersistStream *pStream;
HRESULT hRes;
+ HRESULT init_res;
WCHAR *file_candidate;
WCHAR path_buf[MAX_PATH];
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;
}
/* 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);
/* 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);
}
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);