ReactOS 0.4.15-dev-8093-g3285f69
bindprot.c
Go to the documentation of this file.
1/*
2 * Copyright 2007-2009 Jacek Caban for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#include "urlmon_main.h"
20#include "wine/debug.h"
21
23
25
26struct _task_header_t {
29};
30
31#define BUFFER_SIZE 2048
32#define MIME_TEST_SIZE 255
33
34#define WM_MK_CONTINUE (WM_USER+101)
35#define WM_MK_RELEASE (WM_USER+102)
36
38{
39 task_header_t *task;
40
41 while(1) {
42 EnterCriticalSection(&This->section);
43
44 task = This->task_queue_head;
45 if(task) {
46 This->task_queue_head = task->next;
47 if(!This->task_queue_head)
48 This->task_queue_tail = NULL;
49 }
50
51 LeaveCriticalSection(&This->section);
52
53 if(!task)
54 break;
55
56 This->continue_call++;
57 task->proc(This, task);
58 This->continue_call--;
59 }
60}
61
63{
64 switch(msg) {
65 case WM_MK_CONTINUE: {
67
69
70 IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface);
71 return 0;
72 }
73 case WM_MK_RELEASE: {
75
76 if(!--data->notif_hwnd_cnt) {
78 data->notif_hwnd = NULL;
79 }
80 }
81 }
82
84}
85
87 {'U','R','L',' ','M','o','n','i','k','e','r',' ',
88 'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0};
89
91
93{
94 static WNDCLASSEXW wndclass = {
95 sizeof(wndclass), 0, notif_wnd_proc, 0, 0,
98 };
99
100 wndclass.hInstance = hProxyDll;
102 return TRUE;
103}
104
106{
109}
110
112{
113 tls_data_t *tls_data;
114
115 static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
116
117 tls_data = get_tls_data();
118 if(!tls_data)
119 return NULL;
120
121 if(tls_data->notif_hwnd_cnt) {
122 tls_data->notif_hwnd_cnt++;
123 return tls_data->notif_hwnd;
124 }
125
127 if(!notif_wnd_class)
128 return NULL;
129
132 NULL, hProxyDll, NULL);
133 if(tls_data->notif_hwnd)
134 tls_data->notif_hwnd_cnt++;
135
136 TRACE("hwnd = %p\n", tls_data->notif_hwnd);
137
138 return tls_data->notif_hwnd;
139}
140
142{
144
145 if(!data)
146 return;
147
148 if(data->notif_hwnd != hwnd) {
149 PostMessageW(data->notif_hwnd, WM_MK_RELEASE, 0, 0);
150 return;
151 }
152
153 if(!--data->notif_hwnd_cnt) {
154 DestroyWindow(data->notif_hwnd);
155 data->notif_hwnd = NULL;
156 }
157}
158
160{
161 BOOL do_post = FALSE;
162
163 task->proc = proc;
164 task->next = NULL;
165
166 EnterCriticalSection(&This->section);
167
168 if(This->task_queue_tail) {
169 This->task_queue_tail->next = task;
170 This->task_queue_tail = task;
171 }else {
172 This->task_queue_tail = This->task_queue_head = task;
173 do_post = !This->continue_call;
174 }
175
176 LeaveCriticalSection(&This->section);
177
178 if(do_post) {
179 IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface);
180 PostMessageW(This->notif_hwnd, WM_MK_CONTINUE, 0, (LPARAM)This);
181 }
182}
183
185{
186 return This->apartment_thread == GetCurrentThreadId();
187}
188
190{
191 return !(This->pi & PI_APARTMENTTHREADED) || (is_apartment_thread(This) && !This->continue_call);
192}
193
195{
196 PROTOCOLFILTERDATA filter_data = { sizeof(PROTOCOLFILTERDATA), NULL, NULL, NULL, 0 };
198
199 hres = IInternetProtocol_QueryInterface(mime_filter, &IID_IInternetProtocolSink, (void**)&This->protocol_sink_handler);
200 if(FAILED(hres)) {
201 This->protocol_sink_handler = &This->default_protocol_handler.IInternetProtocolSink_iface;
202 return hres;
203 }
204
205 IInternetProtocol_AddRef(mime_filter);
206 This->protocol_handler = mime_filter;
207
208 filter_data.pProtocol = &This->default_protocol_handler.IInternetProtocol_iface;
209 hres = IInternetProtocol_Start(mime_filter, This->mime, &This->default_protocol_handler.IInternetProtocolSink_iface,
210 &This->IInternetBindInfo_iface, PI_FILTER_MODE|PI_FORCE_ASYNC,
211 (HANDLE_PTR)&filter_data);
212 if(FAILED(hres)) {
213 IInternetProtocolSink_Release(This->protocol_sink_handler);
214 IInternetProtocol_Release(This->protocol_handler);
215 This->protocol_sink_handler = &This->default_protocol_handler.IInternetProtocolSink_iface;
216 This->protocol_handler = &This->default_protocol_handler.IInternetProtocol_iface;
217 return hres;
218 }
219
220 /* NOTE: IE9 calls it on the new protocol_sink. It doesn't make sense so it seems to be a bug there. */
221 IInternetProtocolSink_ReportProgress(This->protocol_sink, BINDSTATUS_LOADINGMIMEHANDLER, NULL);
222
223 return S_OK;
224}
225
227{
230
231 heap_free(This->mime);
232 This->mime = heap_strdupW(mime);
233
234 if(This->protocol_handler==&This->default_protocol_handler.IInternetProtocol_iface
236 TRACE("Got mime filter for %s\n", debugstr_w(mime));
237
239 IInternetProtocol_Release(mime_filter);
240 if(FAILED(hres))
241 FIXME("MIME filter failed: %08x\n", hres);
242 }
243
244 if(This->reported_mime || verified || !(This->pi & PI_MIMEVERIFICATION)) {
245 This->reported_mime = TRUE;
246 IInternetProtocolSink_ReportProgress(This->protocol_sink, BINDSTATUS_MIMETYPEAVAILABLE, mime);
247 }
248}
249
251{
252 return CONTAINING_RECORD(iface, BindProtocol, IInternetProtocolEx_iface);
253}
254
256{
258
259 *ppv = NULL;
261 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
262 *ppv = &This->IInternetProtocolEx_iface;
263 }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
264 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
265 *ppv = &This->IInternetProtocolEx_iface;
266 }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
267 TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
268 *ppv = &This->IInternetProtocolEx_iface;
269 }else if(IsEqualGUID(&IID_IInternetProtocolEx, riid)) {
270 TRACE("(%p)->(IID_IInternetProtocolEx %p)\n", This, ppv);
271 *ppv = &This->IInternetProtocolEx_iface;
272 }else if(IsEqualGUID(&IID_IInternetBindInfo, riid)) {
273 TRACE("(%p)->(IID_IInternetBindInfo %p)\n", This, ppv);
274 *ppv = &This->IInternetBindInfo_iface;
275 }else if(IsEqualGUID(&IID_IInternetPriority, riid)) {
276 TRACE("(%p)->(IID_IInternetPriority %p)\n", This, ppv);
277 *ppv = &This->IInternetPriority_iface;
278 }else if(IsEqualGUID(&IID_IAuthenticate, riid)) {
279 FIXME("(%p)->(IID_IAuthenticate %p)\n", This, ppv);
280 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
281 TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
282 *ppv = &This->IServiceProvider_iface;
283 }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) {
284 TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv);
285 *ppv = &This->IInternetProtocolSink_iface;
286 }else if(This->protocol_unk) {
288 hres = IUnknown_QueryInterface(This->protocol_unk, riid, ppv);
289 TRACE("(%p) aggregated handler returned %08x for %s\n", This, hres, debugstr_guid(riid));
290 return hres;
291 }else {
292 WARN("not supported interface %s\n", debugstr_guid(riid));
293 }
294
295 if(!*ppv)
296 return E_NOINTERFACE;
297
298 IUnknown_AddRef((IUnknown*)*ppv);
299 return S_OK;
300}
301
303{
306 TRACE("(%p) ref=%d\n", This, ref);
307 return ref;
308}
309
311{
312 if(This->protocol) {
313 IInternetProtocol_Release(This->protocol);
314 This->protocol = NULL;
315 }
316 if(This->protocol_handler && This->protocol_handler != &This->default_protocol_handler.IInternetProtocol_iface) {
317 IInternetProtocol_Release(This->protocol_handler);
318 This->protocol_handler = &This->default_protocol_handler.IInternetProtocol_iface;
319 }
320 if(This->protocol_sink_handler &&
321 This->protocol_sink_handler != &This->default_protocol_handler.IInternetProtocolSink_iface) {
322 IInternetProtocolSink_Release(This->protocol_sink_handler);
323 This->protocol_sink_handler = &This->default_protocol_handler.IInternetProtocolSink_iface;
324 }
325 if(This->protocol_unk) {
326 IUnknown_Release(This->protocol_unk);
327 This->protocol_unk = NULL;
328 }
329}
330
332{
335
336 TRACE("(%p) ref=%d\n", This, ref);
337
338 if(!ref) {
340 if(This->redirect_callback)
341 IBindCallbackRedirect_Release(This->redirect_callback);
342 if(This->bind_info)
343 IInternetBindInfo_Release(This->bind_info);
344 if(This->uri)
345 IUri_Release(This->uri);
346 SysFreeString(This->display_uri);
347
349
350 if(This->notif_hwnd)
351 release_notif_hwnd(This->notif_hwnd);
352 This->section.DebugInfo->Spare[0] = 0;
353 DeleteCriticalSection(&This->section);
354
355 heap_free(This->mime);
357
359 }
360
361 return ref;
362}
363
365 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
367{
369 IUri *uri;
371
372 TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink,
373 pOIBindInfo, grfPI, dwReserved);
374
375 hres = CreateUri(szUrl, Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri);
376 if(FAILED(hres))
377 return hres;
378
379 hres = IInternetProtocolEx_StartEx(&This->IInternetProtocolEx_iface, uri, pOIProtSink,
380 pOIBindInfo, grfPI, (HANDLE*)dwReserved);
381
382 IUri_Release(uri);
383 return hres;
384}
385
386static HRESULT WINAPI BindProtocol_Continue(IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData)
387{
389
390 TRACE("(%p)->(%p)\n", This, pProtocolData);
391
392 return IInternetProtocol_Continue(This->protocol_handler, pProtocolData);
393}
394
397{
399
400 TRACE("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
401
402 return IInternetProtocol_Abort(This->protocol_handler, hrReason, dwOptions);
403}
404
406{
408
409 TRACE("(%p)->(%08x)\n", This, dwOptions);
410
411 return IInternetProtocol_Terminate(This->protocol_handler, dwOptions);
412}
413
415{
417 FIXME("(%p)\n", This);
418 return E_NOTIMPL;
419}
420
422{
424 FIXME("(%p)\n", This);
425 return E_NOTIMPL;
426}
427
429 ULONG cb, ULONG *pcbRead)
430{
432
433 TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
434
435 if(pcbRead)
436 *pcbRead = 0;
437 return IInternetProtocol_Read(This->protocol_handler, pv, cb, pcbRead);
438}
439
441 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
442{
444 FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
445 return E_NOTIMPL;
446}
447
449{
451
452 TRACE("(%p)->(%08x)\n", This, dwOptions);
453
454 return IInternetProtocol_LockRequest(This->protocol_handler, dwOptions);
455}
456
458{
460
461 TRACE("(%p)\n", This);
462
463 return IInternetProtocol_UnlockRequest(This->protocol_handler);
464}
465
467 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
468 DWORD grfPI, HANDLE *dwReserved)
469{
472 IInternetProtocolEx *protocolex;
476 IUnknown *protocol_unk = NULL;
477 LPOLESTR clsid_str;
479
480 TRACE("(%p)->(%p %p %p %08x %p)\n", This, pUri, pOIProtSink, pOIBindInfo, grfPI, dwReserved);
481
482 if(!pUri || !pOIProtSink || !pOIBindInfo)
483 return E_INVALIDARG;
484
485 This->pi = grfPI;
486
487 if(This->uri) {
488 SysFreeString(This->display_uri);
489 IUri_Release(This->uri);
490 }
491 IUri_AddRef(pUri);
492 This->uri = pUri;
493
494 hres = IInternetProtocolSink_QueryInterface(pOIProtSink, &IID_IServiceProvider,
495 (void**)&service_provider);
496 if(SUCCEEDED(hres)) {
497 /* FIXME: What's protocol CLSID here? */
498 IServiceProvider_QueryService(service_provider, &IID_IInternetProtocol,
499 &IID_IInternetProtocol, (void**)&protocol);
500 IServiceProvider_Release(service_provider);
501 }
502
503 if(!protocol) {
505
506 hres = get_protocol_handler(pUri, &clsid, &cf);
507 if(FAILED(hres))
508 return hres;
509
510 hres = IClassFactory_CreateInstance(cf, (IUnknown*)&This->IInternetBindInfo_iface,
511 &IID_IUnknown, (void**)&protocol_unk);
512 if(SUCCEEDED(hres)) {
513 hres = IUnknown_QueryInterface(protocol_unk, &IID_IInternetProtocol, (void**)&protocol);
514 if(SUCCEEDED(hres))
515 This->protocol_unk = protocol_unk;
516 else
517 IUnknown_Release(protocol_unk);
518 }
519 else if(hres == CLASS_E_NOAGGREGATION)
520 hres = IClassFactory_CreateInstance(cf, NULL, &IID_IInternetProtocol, (void**)&protocol);
521
522 IClassFactory_Release(cf);
523 if(FAILED(hres))
524 return hres;
525 }
526
527 StringFromCLSID(&clsid, &clsid_str);
528 IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_PROTOCOLCLASSID, clsid_str);
529 CoTaskMemFree(clsid_str);
530
531 This->protocol_unk = protocol_unk;
532 This->protocol = protocol;
533
534 if(!protocol_unk)
535 protocol_unk = (IUnknown*)protocol;
536
537 set_binding_sink(This, pOIProtSink, pOIBindInfo);
538
539 hres = IUnknown_QueryInterface(protocol_unk, &IID_IInternetPriority, (void**)&priority);
540 if(SUCCEEDED(hres)) {
541 IInternetPriority_SetPriority(priority, This->priority);
542 IInternetPriority_Release(priority);
543 }
544
545 hres = IUnknown_QueryInterface(protocol_unk, &IID_IInternetProtocolEx, (void**)&protocolex);
546 if(SUCCEEDED(hres)) {
547 hres = IInternetProtocolEx_StartEx(protocolex, pUri, &This->IInternetProtocolSink_iface,
548 &This->IInternetBindInfo_iface, 0, NULL);
549 IInternetProtocolEx_Release(protocolex);
550 }else {
551 hres = IUri_GetDisplayUri(pUri, &This->display_uri);
552 if(FAILED(hres))
553 return hres;
554
555 hres = IInternetProtocol_Start(protocol, This->display_uri, &This->IInternetProtocolSink_iface,
556 &This->IInternetBindInfo_iface, 0, 0);
557 }
558
559 if(SUCCEEDED(hres))
561 return hres;
562}
563
565{
566 IInternetProtocolSink *prev_sink;
568
569 if(sink)
570 IInternetProtocolSink_AddRef(sink);
571 prev_sink = InterlockedExchangePointer((void**)&This->protocol_sink, sink);
572 if(prev_sink)
573 IInternetProtocolSink_Release(prev_sink);
574
575 if(sink)
576 IInternetProtocolSink_QueryInterface(sink, &IID_IServiceProvider, (void**)&service_provider);
579 IServiceProvider_Release(service_provider);
580
581 if(bind_info)
582 IInternetBindInfo_AddRef(bind_info);
583 bind_info = InterlockedExchangePointer((void**)&This->bind_info, bind_info);
584 if(bind_info)
585 IInternetBindInfo_Release(bind_info);
586}
587
588static const IInternetProtocolExVtbl BindProtocolVtbl = {
603};
604
606{
607 return CONTAINING_RECORD(iface, BindProtocol, default_protocol_handler.IInternetProtocol_iface);
608}
609
611{
613
614 *ppv = NULL;
616 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
617 *ppv = &This->default_protocol_handler.IInternetProtocol_iface;
618 }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
619 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
620 *ppv = &This->default_protocol_handler.IInternetProtocol_iface;
621 }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
622 TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
623 *ppv = &This->default_protocol_handler.IInternetProtocol_iface;
624 }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) {
625 TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv);
626 *ppv = &This->default_protocol_handler.IInternetProtocolSink_iface;
627 }
628
629 if(*ppv) {
630 IInternetProtocol_AddRef(iface);
631 return S_OK;
632 }
633
634 WARN("not supported interface %s\n", debugstr_guid(riid));
635 return E_NOINTERFACE;
636}
637
639{
641 return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface);
642}
643
645{
647 return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface);
648}
649
651 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
653{
654 ERR("Should not be called\n");
655 return E_NOTIMPL;
656}
657
658static HRESULT WINAPI ProtocolHandler_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
659{
663
664 TRACE("(%p)->(%p)\n", This, pProtocolData);
665
666 /* FIXME: This should not be needed. */
667 if(!This->protocol) {
668 if(!This->protocol_unk)
669 return E_FAIL;
670 hres = IUnknown_QueryInterface(This->protocol_unk, &IID_IInternetProtocol, (void**)&protocol);
671 if(FAILED(hres))
672 return E_FAIL;
673 }
674
675 hres = IInternetProtocol_Continue(protocol ? protocol : This->protocol, pProtocolData);
676
677 heap_free(pProtocolData);
678 if(protocol)
679 IInternetProtocol_Release(protocol);
680 return hres;
681}
682
685{
687
688 TRACE("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
689
690 if(This->protocol && !This->reported_result)
691 return IInternetProtocol_Abort(This->protocol, hrReason, dwOptions);
692
693 return S_OK;
694}
695
697{
699
700 TRACE("(%p)->(%08x)\n", This, dwOptions);
701
702 if(!This->reported_result)
703 return E_FAIL;
704
705 /* This may get released in Terminate call. */
706 IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface);
707
708 if(This->protocol) {
709 IInternetProtocol_Terminate(This->protocol, 0);
710
711 if (This->protocol_unk) {
712 IInternetProtocol_Release(This->protocol);
713 This->protocol = NULL;
714 }
715 }
716
718
719 if(This->bind_info) {
720 IInternetBindInfo_Release(This->bind_info);
721 This->bind_info = NULL;
722 }
723
724 if(This->redirect_callback) {
725 IBindCallbackRedirect_Release(This->redirect_callback);
726 This->redirect_callback = NULL;
727 }
728
729 IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface);
730 return S_OK;
731}
732
734{
736 FIXME("(%p)\n", This);
737 return E_NOTIMPL;
738}
739
741{
743 FIXME("(%p)\n", This);
744 return E_NOTIMPL;
745}
746
748 ULONG cb, ULONG *pcbRead)
749{
751 ULONG read = 0;
752 HRESULT hres = S_OK;
753
754 TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
755
756 if(This->buf_size) {
757 read = min(cb, This->buf_size);
758 memcpy(pv, This->buf, read);
759
760 if(read == This->buf_size) {
761 heap_free(This->buf);
762 This->buf = NULL;
763 }else {
764 memmove(This->buf, This->buf+cb, This->buf_size-cb);
765 }
766
767 This->buf_size -= read;
768 }
769
770 if(read < cb) {
772 ULONG cread = 0;
773
774 /* FIXME: We shouldn't need it, but out binding code currently depends on it. */
775 if(!This->protocol && This->protocol_unk) {
776 hres = IUnknown_QueryInterface(This->protocol_unk, &IID_IInternetProtocol,
777 (void**)&protocol);
778 if(FAILED(hres))
779 return E_ABORT;
780 }else {
781 protocol = This->protocol;
782 }
783
785 This->continue_call++;
786 hres = IInternetProtocol_Read(protocol, (BYTE*)pv+read, cb-read, &cread);
788 This->continue_call--;
789 read += cread;
790
791 if(!This->protocol)
792 IInternetProtocol_Release(protocol);
793 }
794
795 *pcbRead = read;
796 return hres;
797}
798
800 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
801{
803 FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
804 return E_NOTIMPL;
805}
806
808{
810
811 TRACE("(%p)->(%08x)\n", This, dwOptions);
812
813 return IInternetProtocol_LockRequest(This->protocol, dwOptions);
814}
815
817{
819
820 TRACE("(%p)\n", This);
821
822 return IInternetProtocol_UnlockRequest(This->protocol);
823}
824
825static const IInternetProtocolVtbl InternetProtocolHandlerVtbl = {
839};
840
842{
843 return CONTAINING_RECORD(iface, BindProtocol, default_protocol_handler.IInternetProtocolSink_iface);
844}
845
847 REFIID riid, void **ppvObject)
848{
850 return IInternetProtocol_QueryInterface(&This->default_protocol_handler.IInternetProtocol_iface,
851 riid, ppvObject);
852}
853
855{
857 return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface);
858}
859
861{
863 return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface);
864}
865
867 PROTOCOLDATA *pProtocolData)
868{
870
871 TRACE("(%p)->(%p)\n", This, pProtocolData);
872
873 if(!This->protocol_sink) {
874 IInternetProtocol_Continue(This->protocol_handler, pProtocolData);
875 return S_OK;
876 }
877
878 return IInternetProtocolSink_Switch(This->protocol_sink, pProtocolData);
879}
880
882 ULONG status_code, LPCWSTR status_text)
883{
885
886 TRACE("(%p)->(%s %s)\n", This, debugstr_bindstatus(status_code), debugstr_w(status_text));
887
888 if(!This->protocol_sink)
889 return S_OK;
890
891 switch(status_code) {
892 case BINDSTATUS_FINDINGRESOURCE:
893 case BINDSTATUS_CONNECTING:
894 case BINDSTATUS_REDIRECTING:
895 case BINDSTATUS_SENDINGREQUEST:
896 case BINDSTATUS_CACHEFILENAMEAVAILABLE:
897 case BINDSTATUS_DIRECTBIND:
898 case BINDSTATUS_ACCEPTRANGES:
899 case BINDSTATUS_DECODING:
900 IInternetProtocolSink_ReportProgress(This->protocol_sink, status_code, status_text);
901 break;
902
903 case BINDSTATUS_BEGINDOWNLOADDATA:
904 IInternetProtocolSink_ReportData(This->protocol_sink, This->bscf, This->progress, This->progress_max);
905 break;
906
907 case BINDSTATUS_MIMETYPEAVAILABLE:
908 mime_available(This, status_text, FALSE);
909 break;
910
911 case BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE:
912 mime_available(This, status_text, TRUE);
913 break;
914
915 default:
916 FIXME("unsupported ulStatusCode %u\n", status_code);
917 }
918
919 return S_OK;
920}
921
923 DWORD bscf, ULONG progress, ULONG progress_max)
924{
926
927 TRACE("(%p)->(%x %u %u)\n", This, bscf, progress, progress_max);
928
929 This->bscf = bscf;
930 This->progress = progress;
931 This->progress_max = progress_max;
932
933 if(!This->protocol_sink)
934 return S_OK;
935
936 if((This->pi & PI_MIMEVERIFICATION) && !This->reported_mime) {
938 DWORD read = 0;
939 LPWSTR mime;
941
942 do {
943 read = 0;
945 This->continue_call++;
946 hres = IInternetProtocol_Read(This->protocol, buf,
947 sizeof(buf)-This->buf_size, &read);
949 This->continue_call--;
950 if(FAILED(hres) && hres != E_PENDING)
951 return hres;
952
953 if(!This->buf) {
955 if(!This->buf)
956 return E_OUTOFMEMORY;
957 }else if(read + This->buf_size > BUFFER_SIZE) {
958 BYTE *tmp;
959
960 tmp = heap_realloc(This->buf, read+This->buf_size);
961 if(!tmp)
962 return E_OUTOFMEMORY;
963 This->buf = tmp;
964 }
965
966 memcpy(This->buf+This->buf_size, buf, read);
967 This->buf_size += read;
968 }while(This->buf_size < MIME_TEST_SIZE && hres == S_OK);
969
970 if(This->buf_size < MIME_TEST_SIZE && hres != S_FALSE)
971 return S_OK;
972
973 bscf = BSCF_FIRSTDATANOTIFICATION;
974 if(hres == S_FALSE)
975 bscf |= BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE;
976
977 if(!This->reported_mime) {
978 BSTR raw_uri;
979
980 hres = IUri_GetRawUri(This->uri, &raw_uri);
981 if(FAILED(hres))
982 return hres;
983
984 hres = FindMimeFromData(NULL, raw_uri, This->buf, min(This->buf_size, MIME_TEST_SIZE),
985 This->mime, 0, &mime, 0);
986 SysFreeString(raw_uri);
987 if(FAILED(hres))
988 return hres;
989
990 heap_free(This->mime);
991 This->mime = heap_strdupW(mime);
993 This->reported_mime = TRUE;
994 if(This->protocol_sink)
995 IInternetProtocolSink_ReportProgress(This->protocol_sink, BINDSTATUS_MIMETYPEAVAILABLE, This->mime);
996 }
997 }
998
999 if(!This->protocol_sink)
1000 return S_OK;
1001
1002 return IInternetProtocolSink_ReportData(This->protocol_sink, bscf, progress, progress_max);
1003}
1004
1006{
1007 HRESULT hres;
1008
1009 if(This->redirect_callback) {
1010 VARIANT_BOOL cancel = VARIANT_FALSE;
1011 IBindCallbackRedirect_Redirect(This->redirect_callback, url, &cancel);
1012 if(cancel)
1013 return INET_E_REDIRECT_FAILED;
1014 }
1015
1016 if(This->protocol_sink) {
1017 hres = IInternetProtocolSink_ReportProgress(This->protocol_sink, BINDSTATUS_REDIRECTING, url);
1018 if(FAILED(hres))
1019 return hres;
1020 }
1021
1022 IInternetProtocol_Terminate(This->protocol, 0); /* should this be done in StartEx? */
1024
1025 return IInternetProtocolEx_Start(&This->IInternetProtocolEx_iface, url, This->protocol_sink, This->bind_info, This->pi, 0);
1026}
1027
1029 HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
1030{
1032
1033 TRACE("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult));
1034
1035 if(hrResult == INET_E_REDIRECT_FAILED) {
1036 hrResult = handle_redirect(This, szResult);
1037 if(hrResult == S_OK)
1038 return S_OK;
1039 szResult = NULL;
1040 }
1041
1042 if(This->protocol_sink)
1043 return IInternetProtocolSink_ReportResult(This->protocol_sink, hrResult, dwError, szResult);
1044 return S_OK;
1045}
1046
1047static const IInternetProtocolSinkVtbl InternetProtocolSinkHandlerVtbl = {
1055};
1056
1058{
1059 return CONTAINING_RECORD(iface, BindProtocol, IInternetBindInfo_iface);
1060}
1061
1063 REFIID riid, void **ppv)
1064{
1066 return IInternetProtocolEx_QueryInterface(&This->IInternetProtocolEx_iface, riid, ppv);
1067}
1068
1070{
1072 return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface);
1073}
1074
1076{
1078 return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface);
1079}
1080
1082 DWORD *grfBINDF, BINDINFO *pbindinfo)
1083{
1085 HRESULT hres;
1086
1087 TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo);
1088
1089 hres = IInternetBindInfo_GetBindInfo(This->bind_info, grfBINDF, pbindinfo);
1090 if(FAILED(hres)) {
1091 WARN("GetBindInfo failed: %08x\n", hres);
1092 return hres;
1093 }
1094
1095 if((pbindinfo->dwOptions & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS) && !This->redirect_callback) {
1097
1098 hres = IInternetProtocolSink_QueryInterface(This->protocol_sink, &IID_IServiceProvider, (void**)&service_provider);
1099 if(SUCCEEDED(hres)) {
1100 hres = IServiceProvider_QueryService(service_provider, &IID_IBindCallbackRedirect, &IID_IBindCallbackRedirect,
1101 (void**)&This->redirect_callback);
1102 IServiceProvider_Release(service_provider);
1103 }
1104 }
1105
1106 *grfBINDF |= BINDF_FROMURLMON;
1107 return hres;
1108}
1109
1111 ULONG ulStringType, LPOLESTR *ppwzStr, ULONG cEl, ULONG *pcElFetched)
1112{
1114
1115 TRACE("(%p)->(%d %p %d %p)\n", This, ulStringType, ppwzStr, cEl, pcElFetched);
1116
1117 return IInternetBindInfo_GetBindString(This->bind_info, ulStringType, ppwzStr, cEl, pcElFetched);
1118}
1119
1120static const IInternetBindInfoVtbl InternetBindInfoVtbl = {
1126};
1127
1129{
1130 return CONTAINING_RECORD(iface, BindProtocol, IInternetPriority_iface);
1131}
1132
1134 REFIID riid, void **ppv)
1135{
1137 return IInternetProtocolEx_QueryInterface(&This->IInternetProtocolEx_iface, riid, ppv);
1138}
1139
1141{
1143 return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface);
1144}
1145
1147{
1149 return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface);
1150}
1151
1153{
1155
1156 TRACE("(%p)->(%d)\n", This, nPriority);
1157
1158 This->priority = nPriority;
1159 return S_OK;
1160}
1161
1163{
1165
1166 TRACE("(%p)->(%p)\n", This, pnPriority);
1167
1168 *pnPriority = This->priority;
1169 return S_OK;
1170}
1171
1172static const IInternetPriorityVtbl InternetPriorityVtbl = {
1178
1179};
1180
1182{
1183 return CONTAINING_RECORD(iface, BindProtocol, IInternetProtocolSink_iface);
1184}
1185
1187 REFIID riid, void **ppv)
1188{
1190 return IInternetProtocolEx_QueryInterface(&This->IInternetProtocolEx_iface, riid, ppv);
1191}
1192
1194{
1196 return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface);
1197}
1198
1200{
1202 return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface);
1203}
1204
1205typedef struct {
1207 PROTOCOLDATA *data;
1209
1211{
1212 switch_task_t *task = (switch_task_t*)t;
1213
1214 IInternetProtocol_Continue(bind->protocol_handler, task->data);
1215
1216 heap_free(task);
1217}
1218
1220 PROTOCOLDATA *pProtocolData)
1221{
1223 PROTOCOLDATA *data;
1224
1225 TRACE("(%p)->(%p)\n", This, pProtocolData);
1226
1227 TRACE("flags %x state %x data %p cb %u\n", pProtocolData->grfFlags, pProtocolData->dwState,
1228 pProtocolData->pData, pProtocolData->cbData);
1229
1230 data = heap_alloc(sizeof(PROTOCOLDATA));
1231 if(!data)
1232 return E_OUTOFMEMORY;
1233 memcpy(data, pProtocolData, sizeof(PROTOCOLDATA));
1234
1235 if((This->pi&PI_APARTMENTTHREADED && pProtocolData->grfFlags&PI_FORCE_ASYNC)
1236 || !do_direct_notif(This)) {
1237 switch_task_t *task;
1238
1239 task = heap_alloc(sizeof(switch_task_t));
1240 if(!task)
1241 {
1242 heap_free(data);
1243 return E_OUTOFMEMORY;
1244 }
1245
1246 task->data = data;
1247
1248 push_task(This, &task->header, switch_proc);
1249 return S_OK;
1250 }
1251
1252 return IInternetProtocolSink_Switch(This->protocol_sink_handler, data);
1253}
1254
1255typedef struct {
1257
1261
1263{
1265
1266 IInternetProtocolSink_ReportProgress(This->protocol_sink_handler, task->status_code, task->status_text);
1267
1268 heap_free(task->status_text);
1269 heap_free(task);
1270}
1271
1273 ULONG ulStatusCode, LPCWSTR szStatusText)
1274{
1276
1277 TRACE("(%p)->(%u %s)\n", This, ulStatusCode, debugstr_w(szStatusText));
1278
1279 if(do_direct_notif(This)) {
1280 IInternetProtocolSink_ReportProgress(This->protocol_sink_handler, ulStatusCode, szStatusText);
1281 }else {
1282 on_progress_task_t *task;
1283
1284 task = heap_alloc(sizeof(on_progress_task_t));
1285
1286 task->status_code = ulStatusCode;
1287 task->status_text = heap_strdupW(szStatusText);
1288
1290 }
1291
1292 return S_OK;
1293}
1294
1295typedef struct {
1301
1303{
1305
1306 IInternetProtocolSink_ReportData(This->protocol_sink_handler,
1307 task->bscf, task->progress, task->progress_max);
1308
1309 heap_free(task);
1310}
1311
1313 DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
1314{
1316
1317 TRACE("(%p)->(%x %u %u)\n", This, grfBSCF, ulProgress, ulProgressMax);
1318
1319 if(!This->protocol_sink)
1320 return S_OK;
1321
1322 if(!do_direct_notif(This)) {
1323 report_data_task_t *task;
1324
1325 task = heap_alloc(sizeof(report_data_task_t));
1326 if(!task)
1327 return E_OUTOFMEMORY;
1328
1329 task->bscf = grfBSCF;
1330 task->progress = ulProgress;
1331 task->progress_max = ulProgressMax;
1332
1334 return S_OK;
1335 }
1336
1337 return IInternetProtocolSink_ReportData(This->protocol_sink_handler,
1338 grfBSCF, ulProgress, ulProgressMax);
1339}
1340
1341typedef struct {
1343
1348
1350{
1352
1353 IInternetProtocolSink_ReportResult(This->protocol_sink_handler, task->hres, task->err, task->str);
1354
1355 heap_free(task->str);
1356 heap_free(task);
1357}
1358
1360 HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
1361{
1363
1364 TRACE("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult));
1365
1366 if(!This->protocol_sink)
1367 return E_FAIL;
1368 This->reported_result = TRUE;
1369
1370 if(!do_direct_notif(This)) {
1372
1373 task = heap_alloc(sizeof(report_result_task_t));
1374 if(!task)
1375 return E_OUTOFMEMORY;
1376
1377 task->hres = hrResult;
1378 task->err = dwError;
1379 task->str = heap_strdupW(szResult);
1380
1382 return S_OK;
1383 }
1384
1385 return IInternetProtocolSink_ReportResult(This->protocol_sink_handler, hrResult, dwError, szResult);
1386}
1387
1388static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = {
1396};
1397
1399{
1400 return CONTAINING_RECORD(iface, BindProtocol, IServiceProvider_iface);
1401}
1402
1404 REFIID riid, void **ppv)
1405{
1407 return IInternetProtocolEx_QueryInterface(&This->IInternetProtocolEx_iface, riid, ppv);
1408}
1409
1411{
1413 return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface);
1414}
1415
1417{
1419 return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface);
1420}
1421
1423 REFGUID guidService, REFIID riid, void **ppv)
1424{
1426
1427 TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
1428
1429 if(!This->service_provider)
1430 return E_NOINTERFACE;
1431
1432 return IServiceProvider_QueryService(This->service_provider, guidService, riid, ppv);
1433}
1434
1435static const IServiceProviderVtbl ServiceProviderVtbl = {
1440};
1441
1443{
1444 BindProtocol *ret = heap_alloc_zero(sizeof(BindProtocol));
1445
1446 ret->IInternetProtocolEx_iface.lpVtbl = &BindProtocolVtbl;
1447 ret->IInternetBindInfo_iface.lpVtbl = &InternetBindInfoVtbl;
1448 ret->IInternetPriority_iface.lpVtbl = &InternetPriorityVtbl;
1449 ret->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
1450 ret->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl;
1451
1452 ret->default_protocol_handler.IInternetProtocol_iface.lpVtbl = &InternetProtocolHandlerVtbl;
1453 ret->default_protocol_handler.IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkHandlerVtbl;
1454
1455 ret->ref = 1;
1456 ret->apartment_thread = GetCurrentThreadId();
1457 ret->notif_hwnd = get_notif_hwnd();
1458 ret->protocol_handler = &ret->default_protocol_handler.IInternetProtocol_iface;
1459 ret->protocol_sink_handler = &ret->default_protocol_handler.IInternetProtocolSink_iface;
1460 InitializeCriticalSection(&ret->section);
1461 ret->section.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": BindProtocol.section");
1462
1464
1465 *protocol = ret;
1466 return S_OK;
1467}
#define read
Definition: acwin.h:96
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define msg(x)
Definition: auth_time.c:54
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
unsigned long HANDLE_PTR
Definition: basetsd.h:78
const GUID IID_IUnknown
static ULONG WINAPI ProtocolHandler_AddRef(IInternetProtocol *iface)
Definition: bindprot.c:638
static ULONG WINAPI ProtocolHandler_Release(IInternetProtocol *iface)
Definition: bindprot.c:644
static HRESULT WINAPI BindProtocol_LockRequest(IInternetProtocolEx *iface, DWORD dwOptions)
Definition: bindprot.c:448
static HRESULT WINAPI BPServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
Definition: bindprot.c:1422
static BindProtocol * impl_from_IInternetBindInfo(IInternetBindInfo *iface)
Definition: bindprot.c:1057
static HRESULT WINAPI BindProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
Definition: bindprot.c:364
#define MIME_TEST_SIZE
Definition: bindprot.c:32
static HRESULT WINAPI BindProtocol_Continue(IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData)
Definition: bindprot.c:386
static HRESULT WINAPI BindProtocol_Read(IInternetProtocolEx *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: bindprot.c:428
static HRESULT WINAPI ProtocolHandler_UnlockRequest(IInternetProtocol *iface)
Definition: bindprot.c:816
static HRESULT WINAPI InternetPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv)
Definition: bindprot.c:1133
static const IInternetProtocolVtbl InternetProtocolHandlerVtbl
Definition: bindprot.c:825
static HRESULT handle_mime_filter(BindProtocol *This, IInternetProtocol *mime_filter)
Definition: bindprot.c:194
static ULONG WINAPI ProtocolSinkHandler_AddRef(IInternetProtocolSink *iface)
Definition: bindprot.c:854
static const IInternetBindInfoVtbl InternetBindInfoVtbl
Definition: bindprot.c:1120
static HRESULT WINAPI BindProtocol_Terminate(IInternetProtocolEx *iface, DWORD dwOptions)
Definition: bindprot.c:405
static BOOL WINAPI register_notif_wnd_class(INIT_ONCE *once, void *param, void **context)
Definition: bindprot.c:92
static HRESULT WINAPI BindProtocol_Resume(IInternetProtocolEx *iface)
Definition: bindprot.c:421
static HRESULT WINAPI InternetPriority_SetPriority(IInternetPriority *iface, LONG nPriority)
Definition: bindprot.c:1152
static ULONG WINAPI BindInfo_Release(IInternetBindInfo *iface)
Definition: bindprot.c:1075
void unregister_notif_wnd_class(void)
Definition: bindprot.c:105
static HRESULT WINAPI BPInternetProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv)
Definition: bindprot.c:1186
static BindProtocol * impl_from_IInternetPriority(IInternetPriority *iface)
Definition: bindprot.c:1128
static void mime_available(BindProtocol *This, LPCWSTR mime, BOOL verified)
Definition: bindprot.c:226
static HRESULT WINAPI InternetPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority)
Definition: bindprot.c:1162
static HRESULT WINAPI ProtocolSinkHandler_ReportData(IInternetProtocolSink *iface, DWORD bscf, ULONG progress, ULONG progress_max)
Definition: bindprot.c:922
static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE *dwReserved)
Definition: bindprot.c:466
static void release_protocol_handler(BindProtocol *This)
Definition: bindprot.c:310
static void push_task(BindProtocol *This, task_header_t *task, task_proc_t proc)
Definition: bindprot.c:159
static ULONG WINAPI InternetPriority_Release(IInternetPriority *iface)
Definition: bindprot.c:1146
static HRESULT WINAPI ProtocolSinkHandler_ReportProgress(IInternetProtocolSink *iface, ULONG status_code, LPCWSTR status_text)
Definition: bindprot.c:881
static ULONG WINAPI BPServiceProvider_AddRef(IServiceProvider *iface)
Definition: bindprot.c:1410
static BindProtocol * impl_from_IInternetProtocolSink(IInternetProtocolSink *iface)
Definition: bindprot.c:1181
static HRESULT WINAPI ProtocolSinkHandler_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
Definition: bindprot.c:866
static HRESULT handle_redirect(BindProtocol *This, const WCHAR *url)
Definition: bindprot.c:1005
static BindProtocol * impl_from_IInternetProtocolSinkHandler(IInternetProtocolSink *iface)
Definition: bindprot.c:841
static void report_result_proc(BindProtocol *This, task_header_t *t)
Definition: bindprot.c:1349
static void switch_proc(BindProtocol *bind, task_header_t *t)
Definition: bindprot.c:1210
static HRESULT WINAPI ProtocolHandler_Start(IInternetProtocol *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
Definition: bindprot.c:650
HRESULT create_binding_protocol(BindProtocol **protocol)
Definition: bindprot.c:1442
static HRESULT WINAPI BPInternetProtocolSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
Definition: bindprot.c:1359
static HRESULT WINAPI ProtocolHandler_Abort(IInternetProtocol *iface, HRESULT hrReason, DWORD dwOptions)
Definition: bindprot.c:683
static HRESULT WINAPI ProtocolHandler_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
Definition: bindprot.c:807
static HRESULT WINAPI ProtocolHandler_Terminate(IInternetProtocol *iface, DWORD dwOptions)
Definition: bindprot.c:696
static HRESULT WINAPI BindProtocol_Abort(IInternetProtocolEx *iface, HRESULT hrReason, DWORD dwOptions)
Definition: bindprot.c:395
static BindProtocol * impl_from_IServiceProvider(IServiceProvider *iface)
Definition: bindprot.c:1398
#define BUFFER_SIZE
Definition: bindprot.c:31
static HRESULT WINAPI BPInternetProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
Definition: bindprot.c:1219
static HRESULT WINAPI BindInfo_QueryInterface(IInternetBindInfo *iface, REFIID riid, void **ppv)
Definition: bindprot.c:1062
static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl
Definition: bindprot.c:1388
static HRESULT WINAPI BindProtocol_Suspend(IInternetProtocolEx *iface)
Definition: bindprot.c:414
static HRESULT WINAPI BindProtocol_Seek(IInternetProtocolEx *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
Definition: bindprot.c:440
static HRESULT WINAPI BindInfo_GetBindInfo(IInternetBindInfo *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
Definition: bindprot.c:1081
static const IInternetProtocolExVtbl BindProtocolVtbl
Definition: bindprot.c:588
static HRESULT WINAPI ProtocolHandler_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
Definition: bindprot.c:610
static void process_tasks(BindProtocol *This)
Definition: bindprot.c:37
static HRESULT WINAPI BindProtocol_UnlockRequest(IInternetProtocolEx *iface)
Definition: bindprot.c:457
static HRESULT WINAPI BPServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
Definition: bindprot.c:1403
void(* task_proc_t)(BindProtocol *, task_header_t *)
Definition: bindprot.c:24
static void report_data_proc(BindProtocol *This, task_header_t *t)
Definition: bindprot.c:1302
static BindProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: bindprot.c:605
static HRESULT WINAPI ProtocolHandler_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
Definition: bindprot.c:799
static ULONG WINAPI BindProtocol_Release(IInternetProtocolEx *iface)
Definition: bindprot.c:331
static void on_progress_proc(BindProtocol *This, task_header_t *t)
Definition: bindprot.c:1262
static LRESULT WINAPI notif_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: bindprot.c:62
void set_binding_sink(BindProtocol *This, IInternetProtocolSink *sink, IInternetBindInfo *bind_info)
Definition: bindprot.c:564
#define WM_MK_CONTINUE
Definition: bindprot.c:34
static ULONG WINAPI ProtocolSinkHandler_Release(IInternetProtocolSink *iface)
Definition: bindprot.c:860
static HRESULT WINAPI ProtocolSinkHandler_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppvObject)
Definition: bindprot.c:846
void release_notif_hwnd(HWND hwnd)
Definition: bindprot.c:141
static ATOM notif_wnd_class
Definition: bindprot.c:90
static ULONG WINAPI BPInternetProtocolSink_Release(IInternetProtocolSink *iface)
Definition: bindprot.c:1199
static BindProtocol * impl_from_IInternetProtocolEx(IInternetProtocolEx *iface)
Definition: bindprot.c:250
HWND get_notif_hwnd(void)
Definition: bindprot.c:111
static HRESULT WINAPI ProtocolHandler_Suspend(IInternetProtocol *iface)
Definition: bindprot.c:733
static HRESULT WINAPI BPInternetProtocolSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: bindprot.c:1272
static const IInternetPriorityVtbl InternetPriorityVtbl
Definition: bindprot.c:1172
static ULONG WINAPI BPInternetProtocolSink_AddRef(IInternetProtocolSink *iface)
Definition: bindprot.c:1193
#define WM_MK_RELEASE
Definition: bindprot.c:35
static const WCHAR wszURLMonikerNotificationWindow[]
Definition: bindprot.c:86
static ULONG WINAPI InternetPriority_AddRef(IInternetPriority *iface)
Definition: bindprot.c:1140
static HRESULT WINAPI ProtocolHandler_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
Definition: bindprot.c:658
static HRESULT WINAPI ProtocolSinkHandler_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
Definition: bindprot.c:1028
static const IServiceProviderVtbl ServiceProviderVtbl
Definition: bindprot.c:1435
static HRESULT WINAPI BindInfo_GetBindString(IInternetBindInfo *iface, ULONG ulStringType, LPOLESTR *ppwzStr, ULONG cEl, ULONG *pcElFetched)
Definition: bindprot.c:1110
static const IInternetProtocolSinkVtbl InternetProtocolSinkHandlerVtbl
Definition: bindprot.c:1047
static ULONG WINAPI BindInfo_AddRef(IInternetBindInfo *iface)
Definition: bindprot.c:1069
static HRESULT WINAPI BPInternetProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
Definition: bindprot.c:1312
static BOOL is_apartment_thread(BindProtocol *This)
Definition: bindprot.c:184
static BOOL do_direct_notif(BindProtocol *This)
Definition: bindprot.c:189
static HRESULT WINAPI ProtocolHandler_Resume(IInternetProtocol *iface)
Definition: bindprot.c:740
static HRESULT WINAPI BindProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
Definition: bindprot.c:255
static ULONG WINAPI BPServiceProvider_Release(IServiceProvider *iface)
Definition: bindprot.c:1416
static ULONG WINAPI BindProtocol_AddRef(IInternetProtocolEx *iface)
Definition: bindprot.c:302
static HRESULT WINAPI ProtocolHandler_Read(IInternetProtocol *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: bindprot.c:747
#define FIXME(fmt,...)
Definition: debug.h:114
#define WARN(fmt,...)
Definition: debug.h:115
#define ERR(fmt,...)
Definition: debug.h:113
cd_progress_ptr progress
Definition: cdjpeg.h:152
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
WORD ATOM
Definition: dimm.idl:113
#define E_PENDING
Definition: dinput.h:172
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
OLECHAR * BSTR
Definition: compat.h:2293
short VARIANT_BOOL
Definition: compat.h:2290
BOOL WINAPI InitOnceExecuteOnce(_Inout_ PINIT_ONCE InitOnce, _In_ __callback PINIT_ONCE_FN InitFn, _Inout_opt_ PVOID Parameter, _Outptr_opt_result_maybenull_ LPVOID *Context)
Definition: InitOnce.c:12
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
IInternetProtocol * get_mime_filter(LPCWSTR mime)
Definition: session.c:250
HRESULT get_protocol_handler(IUri *uri, CLSID *clsid, IClassFactory **ret)
Definition: session.c:220
HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IUri **ppURI)
Definition: uri.c:5700
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble t
Definition: gl.h:2047
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
GLfloat param
Definition: glext.h:5796
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer, DWORD cbSize, LPCWSTR pwzMimeProposed, DWORD dwMimeFlags, LPWSTR *ppwzMimeOut, DWORD dwReserved)
Definition: mimefilter.c:680
const WCHAR * mime
Definition: mimefilter.c:512
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static const WCHAR url[]
Definition: encode.c:1432
static IServiceProvider service_provider
Definition: mimeole.c:1313
static IInternetBindInfo bind_info
Definition: mimeole.c:1273
HRESULT hres
Definition: protocol.c:465
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
static LPOLESTR
Definition: stg_prop.c:27
const char * uri
Definition: sec_mgr.c:1588
static int priority
Definition: timer.c:163
#define min(a, b)
Definition: monoChain.cc:55
REFCLSID clsid
Definition: msctf.c:82
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
unsigned int UINT
Definition: ndis.h:50
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
static HANDLE proc()
Definition: pdb.c:34
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define IID_NULL
Definition: guiddef.h:98
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwOptions
Definition: solitaire.cpp:25
IInternetProtocol IInternetProtocol_iface
Definition: urlmon_main.h:192
IInternetProtocolSink IInternetProtocolSink_iface
Definition: urlmon_main.h:179
Definition: scsiwmi.h:51
HINSTANCE hInstance
Definition: winuser.h:3221
IInternetProtocol * pProtocol
Definition: urlmon.idl:1697
task_proc_t proc
Definition: ieframe.h:80
task_header_t * next
Definition: bindprot.c:28
Definition: http.c:7252
task_header_t header
Definition: bindprot.c:1256
Definition: send.c:48
task_header_t header
Definition: bindprot.c:1296
task_header_t header
Definition: bindprot.c:1342
task_header_t header
Definition: bindprot.c:1206
PROTOCOLDATA * data
Definition: bindprot.c:1207
async_task_proc_t proc
Definition: internet.h:389
HWND notif_hwnd
Definition: urlmon_main.h:226
DWORD notif_hwnd_cnt
Definition: urlmon_main.h:227
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define DWORD_PTR
Definition: treelist.c:76
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
struct _LARGE_INTEGER::@2299 u
struct _tagPROTOCOLFILTERDATA PROTOCOLFILTERDATA
tls_data_t * get_tls_data(void)
Definition: urlmon_main.c:62
const char * debugstr_bindstatus(ULONG status)
Definition: urlmon_main.c:175
static void URLMON_LockModule(void)
Definition: urlmon_main.h:68
static void URLMON_UnlockModule(void)
Definition: urlmon_main.h:69
int ret
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
RTL_RUN_ONCE INIT_ONCE
Definition: winbase.h:3931
#define INIT_ONCE_STATIC_INIT
Definition: winbase.h:612
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define E_ABORT
Definition: winerror.h:2366
#define HWND_MESSAGE
Definition: winuser.h:1210
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL WINAPI DestroyWindow(_In_ HWND)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193