Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Please ask technical questions in the appropriate category. Thank you!

Unhandled exception in Oracle Smart View

User_U4MW0Sep 7 2021 — edited Nov 22 2021

Dear Oracle,
we found a problem with Oracle Smart View that is frequent, and we believe should be addressed.
HSADDIN.DLL calls Excel::Window::PointsToScreenPixelsX inside a WM_TIMER callback, and this call fails fairly often with VBA_E_IGNORE. The HRESULT is wrapped into an _com_error exception by the COM call wrapper, but not handled and falls through into the Windows WM_TIMER dispatch mechanism. There, it usually gets caught by a catch-all __try __except block, and thus does not become visible.
But Excel contains code that disables this catch-all by calling the Win32 API function SetUserObjectInformationW(…, UOI_TIMERPROC_EXCEPTION_SUPPRESSION, …), which is actually recommended as described here:
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-settimer#remarks
We do not know under which circumstances Excel disables UOI_TIMERPROC_EXCEPTION_SUPPRESSION, but our telemetry indicates that the _com_error exception described above falls through the WM_TIMER dispatch quite frequently and then gets accidentally caught by us. It is fairly certain that all this is not intended by Oracle, and you simply forgot to handle VBA_E_IGNORE in your add-in.
Regards,
Arno
CTO think-cell Software

P.S.:

Here is some pseudo-code that replicates roughly what HSADDIN.DLL is doing:

struct SOracleSmartViewSimulator {
HHOOK m_hhookCallWndProc;
bool m_bExcelIsBusy;
} g_oraclesmartviewsim;

  g\_oraclesmartviewsim.m\_hhookCallWndProc = APIERR( SetWindowsHookEx(  
         WH\_CALLWNDPROC,  
         (HOOKPROC)\[\](int nCode, WPARAM wParam, LPARAM lParam) noexcept -> LRESULT {  
                 if( HC\_ACTION == nCode ) {  
                        CWPSTRUCT const\* cwpstruct = reinterpret\_cast\<CWPSTRUCT const\*>(lParam);  
                        if( WM\_SETFOCUS == cwpstruct->message || WM\_KILLFOCUS == cwpstruct->message ) {  
                               tc::ui::win::CWindowClass wndclass(cwpstruct->hwnd);  
                               if( wndclass.Is(\_T("EXCEL6")) || wndclass.Is(\_T("EXCEL\<")) ) {  
                                     g\_oraclesmartviewsim.m\_bExcelIsBusy = WM\_SETFOCUS == cwpstruct->message;  
                                     APIERR( SetTimer(nullptr, /\*Oracle uses 1?\*/0, 0, \[\](HWND hWnd, UINT uElapse, UINT\_PTR nIDEvent, DWORD dwReserved) {  
                                            if( !g\_oraclesmartviewsim.m\_bExcelIsBusy ) {  
                                                   if( auto\_cref(activeWindow, NOEXCEPT(XlApplication()->m\_iApplication->GetActiveWindow())) ) {  
                                                           activeWindow->PointsToScreenPixelsX(530); // throws VBA\_E\_IGNORE  
                                                     }  
                                             }  
                                            APIERR( KillTimer( nullptr, nIDEvent ) );  
                                             // SmartView kills timer here  
                                      }) );  
                               }  
                        }  
                 }  
                 return CallNextHookEx(g\_oraclesmartviewsim.m\_hhookCallWndProc, nCode, wParam, lParam);  
         },  
         /\*hmod\*/nullptr,  
         VERIFYEQUAL(g\_threadidMain, tc::this\_thread::get\_id())  
  ) );
Comments
Post Details
Added on Sep 7 2021
1 comment
231 views