Skip to content

Commit

Permalink
Adding return value checking for CoCreateInstance of IShellWindows
Browse files Browse the repository at this point in the history
Fixes issue #5564.
  • Loading branch information
jimevans committed Mar 20, 2018
1 parent f454a5c commit 81371b4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cpp/iedriver/BrowserFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,14 @@ bool BrowserFactory::AttachToBrowserUsingShellWindows(
LOG(TRACE) << "Entering BrowserFactory::AttachToBrowserUsingShellWindows";

CComPtr<IShellWindows> shell_windows;
shell_windows.CoCreateInstance(CLSID_ShellWindows);
HRESULT hr = shell_windows.CoCreateInstance(CLSID_ShellWindows);
if (FAILED(hr)) {
LOGHR(WARN, hr) << "Unable to create an object using the IShellWindows interface with CoCreateInstance";
return false;
}

CComPtr<IUnknown> enumerator_unknown;
HRESULT hr = shell_windows->_NewEnum(&enumerator_unknown);
hr = shell_windows->_NewEnum(&enumerator_unknown);
if (FAILED(hr)) {
LOGHR(WARN, hr) << "Unable to get enumerator from IShellWindows interface";
return false;
Expand Down

0 comments on commit 81371b4

Please sign in to comment.