int test_strings (::Test::A_ptr server) { int status = 0; { CORBA::String_var arg2, arg3; CORBA::String_out arg2_out = arg2.out (); status |= call_method (server, ::Test::A::ARG1, ::Test::FailStr, arg2_out, arg3, "exception is thrown in a call " "for `in bounded_string`.\n"); status |= call_method_s (server, ::Test::A::ARG1, ::Test::FailStr, arg2_out, arg3, "exception is thrown in a call " "for `in string<BOUND>`.\n"); } { CORBA::String_var arg2, arg3; CORBA::String_out arg2_out = arg2.out (); status |= call_method (server, ::Test::A::ARG2, 0, arg2_out, arg3, "exception is thrown in a call " "for `out bounded_string`.\n"); status |= call_method_s (server, ::Test::A::ARG2, 0, arg2_out, arg3, "exception is thrown in a call " "for `out string<BOUND>`.\n"); } { CORBA::String_var arg2, arg3; CORBA::String_out arg2_out = arg2.out (); status |= call_method (server, ::Test::A::ARG3, 0, arg2_out, arg3, "exception is thrown in a call " "for `inout bounded_string` (server side).\n"); status |= call_method_s (server, ::Test::A::ARG3, 0, arg2_out, arg3, "exception is thrown in a call " "for `inout string<BOUND>` (server side).\n"); } { CORBA::String_var arg2; CORBA::String_var arg3 = CORBA::string_dup (::Test::FailStr); CORBA::String_out arg2_out = arg2.out (); status |= call_method (server, ::Test::A::ARG3, 0, arg2_out, arg3, "exception is thrown in a call " "for `inout bounded_string`.\n"); status |= call_method_s (server, ::Test::A::ARG3, 0, arg2_out, arg3, "exception is thrown in a call " "for `inout string<BOUND>`.\n"); } { CORBA::String_var arg2, arg3; CORBA::String_out arg2_out = arg2.out (); status |= call_method (server, ::Test::A::RETN, 0, arg2_out, arg3, "exception is thrown in a call " "when server returns `bounded_string`.\n"); status |= call_method_s (server, ::Test::A::RETN, 0, arg2_out, arg3, "exception is thrown in a call " "when server returns `string<BOUND>`.\n"); } return status; }
static HRESULT get_ie_elem_at(IDispatch *doc, int x, int y, IDispatch **ret_elem) { IDispatch *inner_doc; VARIANTARG args[2]; VARIANT var; HRESULT hres; inner_doc = doc; IDispatch_AddRef(inner_doc); { IDispatch *win; hres = get_property_dp(inner_doc, L"parentWindow", &win); if(FAILED(hres)) { IDispatch_Release(inner_doc); spr->log_hresult( LOG_LEVEL_NOTIFY, L"ie-scroll: Failed to get document.parentWindow", hres, 1); return hres; } { long sx = 0, sy = 0; get_property_long(win, L"screenLeft", &sx); get_property_long(win, L"screenTop", &sy); IDispatch_Release(win); x -= sx; y -= sy; } } while(1) { IDispatch *elem; args[0].vt = VT_I4; args[0].lVal = y; args[1].vt = VT_I4; args[1].lVal = x; hres = call_method_s(inner_doc, L"elementFromPoint", args, 2, &var); IDispatch_Release(inner_doc); if(FAILED(hres)) { spr->log_hresult( LOG_LEVEL_NOTIFY, L"ie-scroll: Failed to get document.elementFromPoint", hres, 1); return hres; } if(var.vt != VT_DISPATCH) { spr->log_printf( LOG_LEVEL_NOTIFY, L"ie-scroll: Failed to get document.elementFromPoint: " L"return value is not IDispatch\n"); return E_FAIL; } elem = var.pdispVal; if(elem == NULL) { spr->log_printf( LOG_LEVEL_NOTIFY, L"ie-scroll: Failed to get document.elementFromPoint: " L"return value is NULL\n"); return E_FAIL; } { BSTR str; hres = get_property_str(elem, L"tagName", &str); if(FAILED(hres)) { IDispatch_Release(elem); spr->log_hresult( LOG_LEVEL_NOTIFY, L"ie-scroll: Failed to get element.tagName", hres, 1); return hres; } spr->log_printf(LOG_LEVEL_DEBUG, L"ie-scroll: tagName of target element: %ls\n", str); if(str == NULL || wcsstr(str, L"FRAME") == NULL) { SysFreeString(str); *ret_elem = elem; break; } SysFreeString(str); } { static LPOLESTR props[] = {L"contentWindow", L"document", NULL}; hres = get_property_dpv(elem, props, &inner_doc); } if(FAILED(hres)) { *ret_elem = elem; spr->log_hresult( LOG_LEVEL_NOTIFY, L"ie-scroll: Failed to get " L"frameElement.contentWindow.document", hres, 1); break; } while(1) { IDispatch *parent = NULL; long ox = 0, oy = 0, cx = 0, cy = 0, sx = 0, sy = 0; BSTR tp = NULL; get_property_long(elem, L"clientLeft", &cx); get_property_long(elem, L"clientTop", &cy); get_property_long(elem, L"offsetLeft", &ox); get_property_long(elem, L"offsetTop", &oy); get_property_long(elem, L"scrollLeft", &sx); get_property_long(elem, L"scrollTop", &sy); x -= cx + ox - sx; y -= cy + oy - sy; hres = get_property_dp(elem, L"offsetParent", &parent); if(FAILED(hres) || parent == NULL) { break; } get_property_str(parent, L"tagName", &tp); if(tp != NULL && wcscmp(tp, L"FRAMESET") == 0) { SysFreeString(tp); IDispatch_Release(parent); break; } SysFreeString(tp); IDispatch_Release(elem); elem = parent; } while(1) { IDispatch *parent = NULL; long sx = 0, sy = 0; hres = get_property_dp(elem, L"parentElement", &parent); if(FAILED(hres) || parent == NULL) { break; } get_property_long(parent, L"scrollLeft", &sx); get_property_long(parent, L"scrollTop", &sy); x += sx; y += sy; IDispatch_Release(elem); elem = parent; } IDispatch_Release(elem); } return S_OK; }