OLD | NEW |
1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
2 | 2 |
3 #include "PluginWbPassThrough.h" | 3 #include "PluginWbPassThrough.h" |
4 #include "PluginClient.h" | 4 #include "PluginClient.h" |
5 #include "PluginClientFactory.h" | 5 #include "PluginClientFactory.h" |
6 #include "PluginFilter.h" | 6 #include "PluginFilter.h" |
7 #include "PluginSettings.h" | 7 #include "PluginSettings.h" |
8 #include "PluginClass.h" | 8 #include "PluginClass.h" |
9 #include "PluginSystem.h" | 9 #include "PluginSystem.h" |
10 #include <WinInet.h> | 10 #include <WinInet.h> |
11 #include "wtypes.h" | 11 #include "wtypes.h" |
| 12 #include "../shared/Utils.h" |
12 | 13 |
13 namespace | 14 namespace |
14 { | 15 { |
15 std::string g_blockedByABPPage = "<!DOCTYPE html>" | 16 std::string g_blockedByABPPage = "<!DOCTYPE html>" |
16 "<html>" | 17 "<html>" |
17 "<body>" | 18 "<body>" |
18 "<!-- blocked by AdblockPlus -->" | 19 "<!-- blocked by AdblockPlus -->" |
19 "</body>" | 20 "</body>" |
20 "</html>"; | 21 "</html>"; |
| 22 |
| 23 template <class T> |
| 24 T ExtractHttpHeader(const T& allHeaders, const T& targetHeaderName, const T& d
elimiter) |
| 25 { |
| 26 auto targetHeaderBeginsAt = allHeaders.find(targetHeaderName); |
| 27 if (targetHeaderBeginsAt == T::npos) |
| 28 { |
| 29 return T(); |
| 30 } |
| 31 targetHeaderBeginsAt += targetHeaderName.length(); |
| 32 auto targetHeaderEndsAt = allHeaders.find(delimiter, targetHeaderBeginsAt); |
| 33 if (targetHeaderEndsAt == T::npos) |
| 34 { |
| 35 return T(); |
| 36 } |
| 37 return allHeaders.substr(targetHeaderBeginsAt, targetHeaderEndsAt - targetHe
aderBeginsAt); |
| 38 } |
| 39 |
| 40 std::string ExtractHttpAcceptHeader(IInternetProtocol* internetProtocol) |
| 41 { |
| 42 // Despite there being HTTP_QUERY_ACCEPT and other query info flags, they do
n't work here, |
| 43 // only HTTP_QUERY_RAW_HEADERS_CRLF | HTTP_QUERY_FLAG_REQUEST_HEADERS does w
ork. |
| 44 ATL::CComPtr<IWinInetHttpInfo> winInetHttpInfo; |
| 45 HRESULT hr = internetProtocol->QueryInterface(&winInetHttpInfo); |
| 46 if (FAILED(hr)) |
| 47 { |
| 48 return ""; |
| 49 } |
| 50 DWORD size = 0; |
| 51 DWORD flags = 0; |
| 52 DWORD queryOption = HTTP_QUERY_RAW_HEADERS_CRLF | HTTP_QUERY_FLAG_REQUEST_HE
ADERS; |
| 53 hr = winInetHttpInfo->QueryInfo(queryOption, /*buffer*/ nullptr, /*get size*
/ &size, &flags, /*reserved*/ 0); |
| 54 if (FAILED(hr)) |
| 55 { |
| 56 return ""; |
| 57 } |
| 58 std::string buf(size, '\0'); |
| 59 hr = winInetHttpInfo->QueryInfo(queryOption, &buf[0], &size, &flags, 0); |
| 60 if (FAILED(hr)) |
| 61 { |
| 62 return ""; |
| 63 } |
| 64 return ExtractHttpHeader<std::string>(buf, "Accept:", "\r\n"); |
| 65 } |
21 } | 66 } |
22 | 67 |
23 WBPassthruSink::WBPassthruSink() | 68 WBPassthruSink::WBPassthruSink() |
24 : m_currentPositionOfSentPage(0) | 69 : m_currentPositionOfSentPage(0) |
25 , m_contentType(CFilter::EContentType::contentTypeAny) | 70 , m_contentType(CFilter::EContentType::contentTypeAny) |
26 , m_blockedInTransaction(false) | 71 , m_blockedInTransaction(false) |
27 { | 72 { |
28 } | 73 } |
29 | 74 |
30 int WBPassthruSink::GetContentTypeFromMimeType(const CString& mimeType) | 75 int WBPassthruSink::GetContentTypeFromMimeType(const CString& mimeType) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 ////////////////////////////////////////////////////////////////////////////////
//////// | 163 ////////////////////////////////////////////////////////////////////////////////
//////// |
119 //WBPassthruSink | 164 //WBPassthruSink |
120 //Monitor and/or cancel every request and responde | 165 //Monitor and/or cancel every request and responde |
121 //WB makes, including images, sounds, scripts, etc | 166 //WB makes, including images, sounds, scripts, etc |
122 ////////////////////////////////////////////////////////////////////////////////
//////// | 167 ////////////////////////////////////////////////////////////////////////////////
//////// |
123 HRESULT WBPassthruSink::OnStart(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSin
k, | 168 HRESULT WBPassthruSink::OnStart(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSin
k, |
124 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HAN
DLE_PTR dwReserved, | 169 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HAN
DLE_PTR dwReserved, |
125 IInternetProtocol* pTargetProtocol, bool& handle
d) | 170 IInternetProtocol* pTargetProtocol, bool& handle
d) |
126 { | 171 { |
127 m_pTargetProtocol = pTargetProtocol; | 172 m_pTargetProtocol = pTargetProtocol; |
128 bool isBlocked = false; | 173 return BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved,
pTargetProtocol); |
129 CString src = szUrl; | |
130 DEBUG_GENERAL(src); | |
131 CPluginClient::UnescapeUrl(src); | |
132 | |
133 // call the impl of the base class as soon as possible because it initializes
the base class | |
134 // members, used by this method. It queries for the required interfaces. | |
135 HRESULT hr = BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwRese
rved, pTargetProtocol); | |
136 if (FAILED(hr)) | |
137 { | |
138 return hr; | |
139 } | |
140 | |
141 CString mimeType; | |
142 if (pOIBindInfo) | |
143 { | |
144 ULONG resLen = 0; | |
145 | |
146 // Apparently IE will report random mime type if there's more then 1 in the
list. | |
147 // So we get the whole list and just use the first one (top priority one) | |
148 LPOLESTR mime[10]; | |
149 pOIBindInfo->GetBindString(BINDSTRING_ACCEPT_MIMES, mime, 10, &resLen); | |
150 if (mime && resLen > 0) | |
151 { | |
152 mimeType.SetString(mime[0]); | |
153 } | |
154 LPOLESTR bindString = nullptr; | |
155 pOIBindInfo->GetBindString(BINDSTRING_FLAG_BIND_TO_OBJECT, &bindString, 1, &
resLen); | |
156 LPOLESTR domainRetrieved = nullptr; | |
157 if (resLen == 0 || wcscmp(bindString, L"FALSE") == 0) | |
158 { | |
159 HRESULT hr = pOIBindInfo->GetBindString(BINDSTRING_XDR_ORIGIN, &domainRetr
ieved, 1, &resLen); | |
160 if ((hr == S_OK) && domainRetrieved && (resLen > 0)) | |
161 { | |
162 m_boundDomain = domainRetrieved; | |
163 } | |
164 } | |
165 // We can obtain IBindCtx* here, but IEnumString obtained via IBindCtx::Enum
ObjectParam | |
166 // does not return any parameter, so it's useless. | |
167 } | |
168 | |
169 CString cookie; | |
170 ULONG len1 = 2048; | |
171 ULONG len2 = 2048; | |
172 | |
173 CPluginTab* tab = CPluginClass::GetTab(::GetCurrentThreadId()); | |
174 CPluginClient* client = CPluginClient::GetInstance(); | |
175 | |
176 if (tab && client) | |
177 { | |
178 CString documentUrl = tab->GetDocumentUrl(); | |
179 // Page is identical to document => don't block | |
180 if (documentUrl == src) | |
181 { | |
182 // fall through | |
183 } | |
184 else if (CPluginSettings::GetInstance()->IsPluginEnabled() && !client->IsWhi
telistedUrl(std::wstring(documentUrl))) | |
185 { | |
186 m_boundDomain = tab->GetDocumentUrl(); | |
187 m_contentType = CFilter::contentTypeAny; | |
188 if (tab != nullptr && tab->IsFrameCached(src)) | |
189 { | |
190 m_contentType = CFilter::contentTypeSubdocument; | |
191 } | |
192 else | |
193 { | |
194 m_contentType = GetContentType(mimeType, m_boundDomain, src); | |
195 } | |
196 } | |
197 } | |
198 | |
199 if (tab == nullptr) | |
200 { | |
201 m_contentType = GetContentType(mimeType, m_boundDomain, src); | |
202 } | |
203 | |
204 { | |
205 // Here is the heuristic which detects the requests issued by Flash.ocx. | |
206 // It turned out that the implementation from ''Flash.ocx'' (tested version
is 15.0.0.152) | |
207 // returns quite minimal configuration in comparison with the implementation
from Microsofts' | |
208 // libraries (see grfBINDF and bindInfo.dwOptions). The impl from MS often i
ncludes something | |
209 // else. | |
210 ATL::CComPtr<IBindStatusCallback> bscb; | |
211 if (SUCCEEDED(QueryServiceFromClient(&bscb)) && !!bscb) | |
212 { | |
213 DWORD grfBINDF = 0; | |
214 BINDINFO bindInfo = {}; | |
215 bindInfo.cbSize = sizeof(bindInfo); | |
216 if (SUCCEEDED(bscb->GetBindInfo(&grfBINDF, &bindInfo)) | |
217 && (BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE| BINDF_PULLDATA) == grfBINDF | |
218 && (BINDINFO_OPTIONS_ENABLE_UTF8 | BINDINFO_OPTIONS_USE_IE_ENCODING) ==
bindInfo.dwOptions | |
219 ) | |
220 { | |
221 m_contentType = CFilter::EContentType::contentTypeObjectSubrequest; | |
222 } | |
223 } | |
224 } | |
225 | |
226 // The descision about EContentType::contentTypeAny is made later in | |
227 // WBPassthruSink::BeginningTransaction. Sometimes here we cannot detect the r
equest type, but | |
228 // in WBPassthruSink::BeginningTransaction the header Accept is available whic
h allows to | |
229 // obtain the "request type" in our terminology. | |
230 if (nullptr != client | |
231 && CFilter::EContentType::contentTypeAny != m_contentType | |
232 && client->ShouldBlock(static_cast<const wchar_t*>(src), m_contentType, m_bo
undDomain, true)) | |
233 { | |
234 isBlocked = true; | |
235 } | |
236 | |
237 // For IE6 and earlier there is iframe back button issue, so avoid it. | |
238 if (isBlocked && client->GetIEVersion() > 6) | |
239 { | |
240 handled = true; | |
241 if (CFilter::EContentType::contentTypeImage == m_contentType) | |
242 { | |
243 // IE shows a cross that img is not loaded | |
244 return INET_E_REDIRECT_FAILED; | |
245 } | |
246 if (CFilter::EContentType::contentTypeSubdocument == m_contentType) | |
247 { | |
248 PassthroughAPP::CustomSinkStartPolicy<WBPassthru, WBPassthruSink>::GetProt
ocol(this)->m_shouldSupplyCustomContent = true; | |
249 m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, L"t
ext/html"); | |
250 m_spInternetProtocolSink->ReportData(BSCF_FIRSTDATANOTIFICATION, 0, static
_cast<ULONG>(g_blockedByABPPage.size())); | |
251 return S_OK; | |
252 } | |
253 if (CFilter::EContentType::contentTypeScript == m_contentType) | |
254 { | |
255 m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, L"t
ext/javascript"); | |
256 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"data:"); | |
257 return INET_E_REDIRECT_FAILED; | |
258 } | |
259 if (CFilter::EContentType::contentTypeXmlHttpRequest == m_contentType) | |
260 { | |
261 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"data:"); | |
262 return INET_E_REDIRECT_FAILED; | |
263 } | |
264 if (CFilter::EContentType::contentTypeAny != m_contentType) | |
265 { | |
266 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"data:"); | |
267 return INET_E_REDIRECT_FAILED; | |
268 } | |
269 } | |
270 | |
271 return isBlocked ? S_FALSE : hr; | |
272 } | 174 } |
273 | 175 |
274 HRESULT WBPassthruSink::OnRead(void* pv, ULONG cb, ULONG* pcbRead) | 176 HRESULT WBPassthruSink::OnRead(void* pv, ULONG cb, ULONG* pcbRead) |
275 { | 177 { |
276 if (pv == nullptr) | 178 if (pv == nullptr) |
277 { | 179 { |
278 return E_POINTER; | 180 return E_POINTER; |
279 } | 181 } |
280 if (pcbRead == nullptr) | 182 if (pcbRead == nullptr) |
281 { | 183 { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 PROTOCOLDATA::grfFlags, eventually URLMon will turn around and call | 231 PROTOCOLDATA::grfFlags, eventually URLMon will turn around and call |
330 IInternetProtocol::Continue on the main thread. | 232 IInternetProtocol::Continue on the main thread. |
331 | 233 |
332 Or, if you happen to have a window handy that was created on the main | 234 Or, if you happen to have a window handy that was created on the main |
333 thread, you can post yourself a message. | 235 thread, you can post yourself a message. |
334 " | 236 " |
335 */ | 237 */ |
336 return m_spInternetProtocolSink ? m_spInternetProtocolSink->Switch(pProtocolDa
ta) : E_UNEXPECTED; | 238 return m_spInternetProtocolSink ? m_spInternetProtocolSink->Switch(pProtocolDa
ta) : E_UNEXPECTED; |
337 } | 239 } |
338 | 240 |
| 241 // This is the heuristic which detects the requests issued by Flash.ocx. |
| 242 // It turned out that the implementation from ''Flash.ocx'' (tested version is 1
5.0.0.152) |
| 243 // returns quite minimal configuration in comparison with the implementation fro
m Microsofts' |
| 244 // libraries (see grfBINDF and bindInfo.dwOptions). The impl from MS often inclu
des something |
| 245 // else. |
| 246 bool WBPassthruSink::IsFlashRequest() |
| 247 { |
| 248 ATL::CComPtr<IBindStatusCallback> bscb; |
| 249 if (SUCCEEDED(QueryServiceFromClient(&bscb)) && !!bscb) |
| 250 { |
| 251 DWORD grfBINDF = 0; |
| 252 BINDINFO bindInfo = {}; |
| 253 bindInfo.cbSize = sizeof(bindInfo); |
| 254 if (SUCCEEDED(bscb->GetBindInfo(&grfBINDF, &bindInfo)) && |
| 255 (BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE| BINDF_PULLDATA) == grfBINDF && |
| 256 (BINDINFO_OPTIONS_ENABLE_UTF8 | BINDINFO_OPTIONS_USE_IE_ENCODING) == bindI
nfo.dwOptions |
| 257 ) |
| 258 { |
| 259 return true; |
| 260 } |
| 261 } |
| 262 return false; |
| 263 } |
| 264 |
339 STDMETHODIMP WBPassthruSink::BeginningTransaction(LPCWSTR szURL, LPCWSTR szHeade
rs, DWORD dwReserved, LPWSTR* pszAdditionalHeaders) | 265 STDMETHODIMP WBPassthruSink::BeginningTransaction(LPCWSTR szURL, LPCWSTR szHeade
rs, DWORD dwReserved, LPWSTR* pszAdditionalHeaders) |
340 { | 266 { |
| 267 std::wstring src = szURL; |
| 268 DEBUG_GENERAL(ToCString(src)); |
| 269 |
| 270 std::string acceptHeader = ExtractHttpAcceptHeader(m_spTargetProtocol); |
| 271 m_contentType = GetContentTypeFromMimeType(ATL::CString(acceptHeader.c_str()))
; |
| 272 |
341 if (pszAdditionalHeaders) | 273 if (pszAdditionalHeaders) |
342 { | 274 { |
343 *pszAdditionalHeaders = nullptr; | 275 *pszAdditionalHeaders = nullptr; |
344 } | 276 } |
345 | 277 |
346 CPluginClient* client = nullptr; | 278 CComPtr<IHttpNegotiate> httpNegotiate; |
347 if (CFilter::EContentType::contentTypeAny == m_contentType && (client = CPlugi
nClient::GetInstance())) | 279 QueryServiceFromClient(&httpNegotiate); |
| 280 // This fills the pszAdditionalHeaders with more headers. One of which is the
Referer header, which we need. |
| 281 // There doesn't seem to be any other way to get this header before the reques
t has been made. |
| 282 HRESULT nativeHr = httpNegotiate ? httpNegotiate->BeginningTransaction(szURL,
szHeaders, dwReserved, pszAdditionalHeaders) : S_OK; |
| 283 |
| 284 if (*pszAdditionalHeaders != 0) |
348 { | 285 { |
349 auto acceptHeader = [&]() -> std::string | 286 m_boundDomain = ExtractHttpHeader<std::wstring>(*pszAdditionalHeaders, L"Ref
erer:", L"\n").c_str(); |
| 287 } |
| 288 m_boundDomain = TrimString(m_boundDomain); |
| 289 CPluginTab* tab = CPluginClass::GetTab(::GetCurrentThreadId()); |
| 290 CPluginClient* client = CPluginClient::GetInstance(); |
| 291 |
| 292 if (tab && client) |
| 293 { |
| 294 CString documentUrl = tab->GetDocumentUrl(); |
| 295 // Page is identical to document => don't block |
| 296 if (documentUrl == ToCString(src)) |
350 { | 297 { |
351 // Despite there is HTTP_QUERY_ACCEPT and other query info flags, they don
't work here, | 298 return nativeHr; |
352 // only HTTP_QUERY_RAW_HEADERS_CRLF | HTTP_QUERY_FLAG_REQUEST_HEADERS does
dork. | 299 } |
353 ATL::CComPtr<IWinInetHttpInfo> winInetHttpInfo; | 300 else if (CPluginSettings::GetInstance()->IsPluginEnabled() && !client->IsWhi
telistedUrl(std::wstring(documentUrl))) |
354 HRESULT hr = m_spTargetProtocol->QueryInterface(&winInetHttpInfo); | 301 { |
355 if(FAILED(hr)) | 302 if (tab->IsFrameCached(ToCString(src))) |
356 { | 303 { |
357 return ""; | 304 m_contentType = CFilter::contentTypeSubdocument; |
358 } | 305 } |
359 DWORD size = 0; | |
360 DWORD flags = 0; | |
361 hr = winInetHttpInfo->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF | HTTP_QUERY_F
LAG_REQUEST_HEADERS, | |
362 /*buffer*/nullptr, /* get size */&size, &flags, /*reserved*/ 0); | |
363 if(FAILED(hr)) | |
364 { | |
365 return ""; | |
366 } | |
367 std::string buf(size, '\0'); | |
368 hr = winInetHttpInfo->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF | HTTP_QUERY_F
LAG_REQUEST_HEADERS, | |
369 &buf[0], &size, &flags, 0); | |
370 if(FAILED(hr)) | |
371 { | |
372 return ""; | |
373 } | |
374 char acceptHeader[] = "Accept:"; | |
375 auto acceptHeaderBeginsAt = buf.find(acceptHeader); | |
376 if (std::string::npos == acceptHeaderBeginsAt) | |
377 { | |
378 return ""; | |
379 } | |
380 acceptHeaderBeginsAt += sizeof(acceptHeader); | |
381 auto acceptHeaderEndsAt = buf.find("\n", acceptHeaderBeginsAt); | |
382 if (std::string::npos == acceptHeaderEndsAt) | |
383 { | |
384 return ""; | |
385 } | |
386 return buf.substr(acceptHeaderBeginsAt, acceptHeaderEndsAt - acceptHeaderB
eginsAt); | |
387 }(); | |
388 m_contentType = GetContentTypeFromMimeType(ATL::CString(acceptHeader.c_str()
)); | |
389 bool isBlocked = client->ShouldBlock(szURL, m_contentType, m_boundDomain, /*
debug flag but must be set*/true); | |
390 if (isBlocked) | |
391 { | |
392 m_blockedInTransaction = true; | |
393 return E_ABORT; | |
394 } | 306 } |
395 } | 307 } |
396 CComPtr<IHttpNegotiate> spHttpNegotiate; | 308 |
397 QueryServiceFromClient(&spHttpNegotiate); | 309 if (IsFlashRequest()) |
398 return spHttpNegotiate ? spHttpNegotiate->BeginningTransaction(szURL, szHeader
s,dwReserved, pszAdditionalHeaders) : S_OK; | 310 { |
| 311 m_contentType = CFilter::EContentType::contentTypeObjectSubrequest; |
| 312 } |
| 313 |
| 314 m_blockedInTransaction = client->ShouldBlock(szURL, m_contentType, m_boundDoma
in, /*debug flag but must be set*/true); |
| 315 if (m_blockedInTransaction) |
| 316 { |
| 317 return E_ABORT; |
| 318 } |
| 319 return nativeHr; |
399 } | 320 } |
400 | 321 |
401 STDMETHODIMP WBPassthruSink::OnResponse(DWORD dwResponseCode, LPCWSTR szResponse
Headers, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders) | 322 STDMETHODIMP WBPassthruSink::OnResponse(DWORD dwResponseCode, LPCWSTR szResponse
Headers, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders) |
402 { | 323 { |
403 if (pszAdditionalRequestHeaders) | 324 if (pszAdditionalRequestHeaders) |
404 { | 325 { |
405 *pszAdditionalRequestHeaders = 0; | 326 *pszAdditionalRequestHeaders = 0; |
406 } | 327 } |
407 | 328 |
408 CComPtr<IHttpNegotiate> spHttpNegotiate; | 329 CComPtr<IHttpNegotiate> spHttpNegotiate; |
(...skipping 15 matching lines...) Expand all Loading... |
424 // Current method is called by the original protocol implementation and we a
re intercepting the | 345 // Current method is called by the original protocol implementation and we a
re intercepting the |
425 // call here and eating it, we will call the proper ReportResult later by ou
rself. | 346 // call here and eating it, we will call the proper ReportResult later by ou
rself. |
426 return S_OK; | 347 return S_OK; |
427 } | 348 } |
428 return BaseClass::ReportResult(hrResult, dwError, szResult); | 349 return BaseClass::ReportResult(hrResult, dwError, szResult); |
429 } | 350 } |
430 | 351 |
431 | 352 |
432 WBPassthru::WBPassthru() | 353 WBPassthru::WBPassthru() |
433 : m_shouldSupplyCustomContent(false) | 354 : m_shouldSupplyCustomContent(false) |
434 , m_hasOriginalStartCalled(false) | |
435 { | 355 { |
436 } | 356 } |
437 | 357 |
438 STDMETHODIMP WBPassthru::Start(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink
, | 358 STDMETHODIMP WBPassthru::Start(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink
, |
439 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) | 359 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) |
440 { | 360 { |
441 ATLASSERT(m_spInternetProtocol != 0); | 361 ATLASSERT(m_spInternetProtocol != 0); |
442 if (!m_spInternetProtocol) | 362 if (!m_spInternetProtocol) |
443 { | 363 { |
444 return E_UNEXPECTED; | 364 return E_UNEXPECTED; |
445 } | 365 } |
446 | 366 |
447 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne
tProtocol); | 367 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne
tProtocol); |
448 } | 368 } |
449 | 369 |
450 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o
ut] */ ULONG *pcbRead) | 370 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o
ut] */ ULONG *pcbRead) |
451 { | 371 { |
452 WBPassthruSink* pSink = GetSink(); | 372 WBPassthruSink* pSink = GetSink(); |
453 return pSink->OnRead(pv, cb, pcbRead); | 373 return pSink->OnRead(pv, cb, pcbRead); |
454 } | 374 } |
455 | 375 |
456 STDMETHODIMP WBPassthru::LockRequest(/* [in] */ DWORD options) | 376 STDMETHODIMP WBPassthru::LockRequest(/* [in] */ DWORD options) |
457 { | 377 { |
458 if (!m_hasOriginalStartCalled) | |
459 { | |
460 return S_OK; | |
461 } | |
462 return BaseClass::LockRequest(options); | 378 return BaseClass::LockRequest(options); |
463 } | 379 } |
464 | 380 |
465 STDMETHODIMP WBPassthru::UnlockRequest() | 381 STDMETHODIMP WBPassthru::UnlockRequest() |
466 { | 382 { |
467 if (!m_hasOriginalStartCalled) | |
468 { | |
469 return S_OK; | |
470 } | |
471 return BaseClass::UnlockRequest(); | 383 return BaseClass::UnlockRequest(); |
472 } | 384 } |
OLD | NEW |