summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-02-26 13:11:12 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-02-27 11:05:00 +0100
commited40d477b2412d4f23540052ca0748028c6103e6 (patch)
treed6a0013c1441e3c7d1a136479756aed7f396d786 /shell
parentf3fab0832b57677d8dfe1297ae7aba631b44cc30 (diff)
Drop ComPtr and use sal::systools::COMReference
Change-Id: I9eb6d99d883b44943ad69c2c28d4e55716dc34f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111673 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/source/win32/SysShExec.cxx16
1 files changed, 9 insertions, 7 deletions
diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx
index fde14e268c26..fa83180705a0 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -278,25 +278,27 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
break;
}
sal::systools::COMReference<IShellLinkW> link;
- auto e2 = CoCreateInstance(
- CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLinkW,
- reinterpret_cast<LPVOID *>(&link));
- if (FAILED(e2)) {
+ try
+ {
+ link.CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER);
+ }
+ catch (sal::systools::ComError& e)
+ {
throw css::lang::IllegalArgumentException(
("XSystemShellExecute.execute, CoCreateInstance failed with "
- + OUString::number(e2)),
+ + OUString::number(e.GetHresult())),
{}, 0);
}
sal::systools::COMReference<IPersistFile> file;
try {
- file = link.QueryInterface<IPersistFile>(IID_IPersistFile);
+ file = link.QueryInterface<IPersistFile>(sal::systools::COM_QUERY_THROW);
} catch(sal::systools::ComError & e3) {
throw css::lang::IllegalArgumentException(
("XSystemShellExecute.execute, QueryInterface failed with: "
+ o3tl::runtimeToOUString(e3.what())),
{}, 0);
}
- e2 = file->Load(path, STGM_READ);
+ HRESULT e2 = file->Load(path, STGM_READ);
if (FAILED(e2)) {
throw css::lang::IllegalArgumentException(
("XSystemShellExecute.execute, IPersistFile.Load failed with "