STDMETHODIMP vmsUrlMonDefaultApphSpy::InternetProtocolEx_StartEx(IInternetProtocolEx *pthis, IUri *pUri, IInternetProtocolSink *pSink, IInternetBindInfo *pInfo, DWORD grfPI, DWORD dwReserved) { IServiceProviderPtr spSP (pSink); assert (spSP != NULL); if (spSP != NULL) { IHttpNegotiatePtr spHN; spSP->QueryService (IID_IHttpNegotiate, IID_IHttpNegotiate, (void**)&spHN); assert (spHN != NULL); if (spHN != NULL) { _Hooks.HookMethod (spHN, HttpNegotiate_BeginningTransaction, 3); _Hooks.HookMethod (spHN, HttpNegotiate_OnResponse, 4); } } _Hooks.HookMethod (pSink, InternetProtocolSink_ReportProgress, 4); _Hooks.HookMethod (pSink, InternetProtocolSink_ReportData, 5); _Hooks.HookMethod (pSink, InternetProtocolSink_ReportResult, 6); _Requests.onInternetProtocolEx_StartEx (pthis, pUri, pSink, pInfo, grfPI); typedef HRESULT (STDMETHODCALLTYPE *FNSTARTEX)(IInternetProtocolEx *pthis, IUri *pUri, IInternetProtocolSink *pSink, IInternetBindInfo *pInfo, DWORD grfPI, DWORD dwReserved); int nIndex = _Hooks.findHookIndex (pthis, 13); assert (nIndex != -1); if (nIndex == -1) return E_UNEXPECTED; HRESULT hr = ((FNSTARTEX)_Hooks.getHook (nIndex)->pvOriginalFn) (pthis, pUri, pSink, pInfo, grfPI, dwReserved); LOG ("ProtocolRoot_StartEx hr = 0x%x", hr); LOG ("ProtocolRoot_StartEx pSink = 0x%x", (DWORD)pSink); LOG ("ProtocolRoot_StartEx pInfo = 0x%x", (DWORD)pInfo); LOG ("ProtocolRoot_StartEx pUri = 0x%x", (DWORD)pUri); LOG ("ProtocolRoot_StartEx grfPI = 0x%x", (DWORD)grfPI); return hr; }
void vmsUrlMonRequestCollector::onNewRequest(Request *request) { _BrowsersSharedData.ModifyActiveDownloadsCount (1); RemoveTooOldRequests (); request->dwTicksStarted = GetTickCount (); IServiceProviderPtr spSP (request->spSink); assert (spSP != NULL); if (spSP != NULL) spSP->QueryService (IID_IHttpNegotiate, IID_IHttpNegotiate, (void**)&request->spHttpNegotiate); request->dwthridStart = GetCurrentThreadId (); if (_IEVersion.m_appVersion.empty () || _IEVersion.m_appVersion [0] < 10) { BINDINFO bi; DWORD dwBindF; ZeroMemory (&bi, sizeof (bi)); bi.cbSize = sizeof (bi); request->spBindInfo->GetBindInfo (&dwBindF, &bi); if (bi.dwBindVerb == BINDVERB_POST && bi.cbstgmedData) { if (bi.stgmedData.tymed == TYMED_HGLOBAL) { LPVOID pData = GlobalLock (bi.stgmedData.hGlobal); if (pData) { request->vbPostData.resize (bi.cbstgmedData); CopyMemory (&request->vbPostData [0], pData, bi.cbstgmedData); GlobalUnlock (bi.stgmedData.hGlobal); } } } } vmsCriticalSectionAutoLock csal (&m_csReq); m_vReq.push_back (request); #ifdef SCL_ENABLE LOGsnl ("New request:"); USES_CONVERSION; LOG (" URL: %s", W2CA (request->wstrUrl.c_str ())); LOG (" thridStart: %d", request->dwthridStart); LOG (" post data size: %d", request->vbPostData.size ()); #endif request->spSink->Switch (&_protocolData); }
IWebBrowser2Ptr IEToolbar::getWebBrowser() const { // Retrieve service provider to query service from. IServiceProviderPtr serviceProvider = getServiceProvider(); // Query web browser interface. IWebBrowser2Ptr webBrowser; const HRESULT getBrowserResult = serviceProvider->QueryService( SID_SWebBrowserApp, &webBrowser); if (FAILED(getBrowserResult)) { throw(_com_error(getBrowserResult)); } return webBrowser; }
HRESULT vmsDomHelper::GetWebBrowser(IHTMLWindow2 *pWnd, IWebBrowser2 **ppWebBrowser) { *ppWebBrowser = NULL; ATLASSERT (pWnd != NULL); if (!pWnd) return E_INVALIDARG; IServiceProviderPtr spSP (pWnd); if (spSP == NULL) return E_INVALIDARG; return spSP->QueryService (IID_IWebBrowserApp, IID_IWebBrowser2, (void**)ppWebBrowser); }
static IAccessible2* IAccessible2FromIdentifier(int docHandle, int id) { IAccessiblePtr acc = NULL; VARIANT varChild; // WebKit returns a positive value for uniqueID, // but we need to pass a negative value when retrieving objects. id = -id; if (AccessibleObjectFromEvent((HWND)UlongToHandle(docHandle), OBJID_CLIENT, id, &acc, &varChild) != S_OK) return NULL; if (varChild.lVal != CHILDID_SELF) { // IAccessible2 can't be implemented on a simple child, // so this object is invalid. return NULL; } VariantClear(&varChild); IServiceProviderPtr serv = NULL; if (acc.QueryInterface(IID_IServiceProvider, &serv) != S_OK) return NULL; IAccessible2* pacc2 = NULL; serv->QueryService(IID_IAccessible, IID_IAccessible2, (void**)&pacc2); return pacc2; }
PRBool CFDMForFirefox::TransferUrlToFDM(IFDMUrl *url) { assert (url != NULL); if (!url) return FALSE; IWGUrlReceiverPtr spUrlRcvr; spUrlRcvr.CreateInstance (__uuidof (WGUrlReceiver)); assert (spUrlRcvr != NULL); if (spUrlRcvr == NULL) return FALSE; if (NS_OK != CFDMUrlReceiver::ApplyUrlToReceiver (spUrlRcvr, url)) return FALSE; spUrlRcvr->put_IgnoreSize (FALSE); if (FAILED (spUrlRcvr->ShowAddDownloadDialog ())) return FALSE; IServiceProviderPtr spSP (spUrlRcvr); IFdmUiWindowPtr spUiWindow; if (spSP) spSP->QueryService (__uuidof (IFdmUiWindow), __uuidof (IFdmUiWindow), (void**)&spUiWindow); if (spUiWindow != NULL) { spUiWindow->WaitForWindowCreation (5000); ULONG u = 0; spUiWindow->get_Handle (&u); if (u) { SetForegroundWindow ((HWND)u); BringWindowToTop ((HWND)u); } } DWORD dwAllow = TRUE; m_keyFDMMonitor.QueryValue (dwAllow, "AllowDownload"); if (dwAllow == FALSE) return TRUE; BSTR bstrState = NULL; do { if (bstrState) { SysFreeString (bstrState); bstrState = NULL; } Sleep (5); spUrlRcvr->get_UIState (&bstrState); assert (bstrState != NULL); if (!bstrState) return FALSE; } while (wcsicmp (bstrState, L"in_progress") == 0); BOOL bAdded = wcsicmp (bstrState, L"added") == 0; SysFreeString (bstrState); return bAdded; }