ReactOS 0.4.17-dev-684-ga6524ef
protocol.c
Go to the documentation of this file.
1/*
2 * Copyright 2005-2011 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#define COBJMACROS
20#define CONST_VTABLE
21
22#include <wine/test.h>
23#include <stdarg.h>
24#include <stdio.h>
25
26#include "windef.h"
27#include "winbase.h"
28#include "ole2.h"
29#include "urlmon.h"
30#include "wininet.h"
31
32static HRESULT (WINAPI *pCoInternetGetSession)(DWORD, IInternetSession **, DWORD);
33static HRESULT (WINAPI *pReleaseBindInfo)(BINDINFO*);
34static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
35
36#define CHARS_IN_GUID 39
37
38#define DEFINE_EXPECT(func) \
39 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
40
41#define SET_EXPECT(func) \
42 expect_ ## func = TRUE
43
44#define CHECK_EXPECT2(func) \
45 do { \
46 ok(expect_ ##func, "unexpected call " #func "\n"); \
47 called_ ## func = TRUE; \
48 }while(0)
49
50#define CHECK_EXPECT(func) \
51 do { \
52 CHECK_EXPECT2(func); \
53 expect_ ## func = FALSE; \
54 }while(0)
55
56#define CHECK_CALLED(func) \
57 do { \
58 ok(called_ ## func, "expected " #func "\n"); \
59 expect_ ## func = called_ ## func = FALSE; \
60 }while(0)
61
62#define CHECK_NOT_CALLED(func) \
63 do { \
64 ok(!called_ ## func, "unexpected " #func "\n"); \
65 expect_ ## func = called_ ## func = FALSE; \
66 }while(0)
67
68#define CLEAR_CALLED(func) \
69 expect_ ## func = called_ ## func = FALSE
70
71DEFINE_EXPECT(GetBindInfo);
72DEFINE_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
73DEFINE_EXPECT(ReportProgress_DIRECTBIND);
74DEFINE_EXPECT(ReportProgress_RAWMIMETYPE);
75DEFINE_EXPECT(ReportProgress_FINDINGRESOURCE);
76DEFINE_EXPECT(ReportProgress_CONNECTING);
77DEFINE_EXPECT(ReportProgress_SENDINGREQUEST);
78DEFINE_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
79DEFINE_EXPECT(ReportProgress_VERIFIEDMIMETYPEAVAILABLE);
80DEFINE_EXPECT(ReportProgress_PROTOCOLCLASSID);
81DEFINE_EXPECT(ReportProgress_COOKIE_SENT);
82DEFINE_EXPECT(ReportProgress_REDIRECTING);
83DEFINE_EXPECT(ReportProgress_ENCODING);
84DEFINE_EXPECT(ReportProgress_ACCEPTRANGES);
85DEFINE_EXPECT(ReportProgress_PROXYDETECTING);
86DEFINE_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
87DEFINE_EXPECT(ReportProgress_DECODING);
88DEFINE_EXPECT(ReportData);
89DEFINE_EXPECT(ReportData2);
90DEFINE_EXPECT(ReportResult);
91DEFINE_EXPECT(GetBindString_ACCEPT_MIMES);
92DEFINE_EXPECT(GetBindString_USER_AGENT);
93DEFINE_EXPECT(GetBindString_POST_COOKIE);
94DEFINE_EXPECT(GetBindString_URL);
95DEFINE_EXPECT(GetBindString_ROOTDOC_URL);
96DEFINE_EXPECT(GetBindString_SAMESITE_COOKIE_LEVEL);
97DEFINE_EXPECT(QueryService_HttpNegotiate);
98DEFINE_EXPECT(QueryService_InternetProtocol);
99DEFINE_EXPECT(QueryService_HttpSecurity);
100DEFINE_EXPECT(QueryService_IBindCallbackRedirect);
101DEFINE_EXPECT(QueryInterface_IWinInetInfo);
102DEFINE_EXPECT(QueryInterface_IWinInetHttpInfo);
103DEFINE_EXPECT(BeginningTransaction);
104DEFINE_EXPECT(GetRootSecurityId);
105DEFINE_EXPECT(OnResponse);
109DEFINE_EXPECT(CreateInstance_no_aggregation);
112DEFINE_EXPECT(Terminate);
120DEFINE_EXPECT(MimeFilter_Start);
121DEFINE_EXPECT(MimeFilter_ReportData);
122DEFINE_EXPECT(MimeFilter_ReportResult);
123DEFINE_EXPECT(MimeFilter_Terminate);
124DEFINE_EXPECT(MimeFilter_LockRequest);
125DEFINE_EXPECT(MimeFilter_UnlockRequest);
126DEFINE_EXPECT(MimeFilter_Read);
127DEFINE_EXPECT(MimeFilter_Switch);
128DEFINE_EXPECT(MimeFilter_Continue);
132DEFINE_EXPECT(outer_QI_test);
133DEFINE_EXPECT(Protocol_destructor);
134
135static const WCHAR wszIndexHtml[] = {'i','n','d','e','x','.','h','t','m','l',0};
136static const WCHAR index_url[] =
137 {'f','i','l','e',':','i','n','d','e','x','.','h','t','m','l',0};
138
139static const WCHAR acc_mimeW[] = {'*','/','*',0};
140static const WCHAR user_agentW[] = {'W','i','n','e',0};
141static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0};
142static const WCHAR hostW[] = {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
143static const WCHAR winehq_ipW[] = {'2','0','9','.','4','6','.','2','5','.','1','3','4',0};
144static const WCHAR emptyW[] = {0};
145static const WCHAR pjpegW[] = {'i','m','a','g','e','/','p','j','p','e','g',0};
146static const WCHAR gifW[] = {'i','m','a','g','e','/','g','i','f',0};
147static const WCHAR null_guid[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-',
148 '0','0','0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0','0','}',0};
150
160static void *expect_pv;
163static PROTOCOLDATA protocoldata, *pdata, continue_protdata;
169
170enum {
176
177static enum {
186
187typedef struct {
194} Protocol;
195
197
198static const WCHAR protocol_names[][10] = {
199 {'f','i','l','e',0},
200 {'h','t','t','p',0},
201 {'h','t','t','p','s',0},
202 {'f','t','p',0},
203 {'m','k',0},
204 {'i','t','s',0},
205 {'t','e','s','t',0}
206};
207
208static const WCHAR binding_urls[][130] = {
209 {'f','i','l','e',':','t','e','s','t','.','h','t','m','l',0},
210 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.',
211 'o','r','g','/','s','i','t','e','/','a','b','o','u','t',0},
212 {'h','t','t','p','s',':','/','/','w','w','w','.','c','o','d','e','w','e','a','v','e','r','s',
213 '.','c','o','m','/','t','e','s','t','.','h','t','m','l',0},
214 {'f','t','p',':','/','/','f','t','p','.','w','i','n','e','h','q','.','o','r','g',
215 '/','p','u','b','/','o','t','h','e','r',
216 '/','w','i','n','e','l','o','g','o','.','x','c','f','.','t','a','r','.','b','z','2',0},
217 {'m','k',':','t','e','s','t',0},
218 {'i','t','s',':','t','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0},
219 {'t','e','s','t',':','/','/','f','i','l','e','.','h','t','m','l',0}
220};
221
222static const CHAR post_data[] = "mode=Test";
223
224static LONG obj_refcount(void *obj)
225{
226 IUnknown_AddRef((IUnknown *)obj);
227 return IUnknown_Release((IUnknown *)obj);
228}
229
230static const char *w2a(LPCWSTR str)
231{
232 static char buf[INTERNET_MAX_URL_LENGTH];
233 WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
234 return buf;
235}
236
238{
240 || IsEqualGUID(&IID_IHttpSecurity, riid)) {
241 *ppv = iface;
242 return S_OK;
243 }
244
245 ok(0, "unexpected call\n");
246 return E_NOINTERFACE;
247}
248
250{
251 return 2;
252}
253
255{
256 return 1;
257}
258
260{
261 if(winetest_debug > 1) trace("HttpSecurity_GetWindow\n");
262
263 return S_FALSE;
264}
265
267{
268 win_skip("Security problem: %lu\n", dwProblem);
270 "Expected got %lu security problem\n", dwProblem);
271
272 /* Only retry once */
274 return E_ABORT;
275
277 if(dwProblem == ERROR_INTERNET_INVALID_CA)
278 return E_ABORT;
279 SET_EXPECT(BeginningTransaction);
280
281 return RPC_E_RETRY;
282}
283
284static IHttpSecurityVtbl HttpSecurityVtbl = {
290};
291
293
295{
297 || IsEqualGUID(&IID_IHttpNegotiate, riid)
298 || IsEqualGUID(&IID_IHttpNegotiate2, riid)) {
299 *ppv = iface;
300 return S_OK;
301 }
302
303 ok(0, "unexpected call\n");
304 return E_NOINTERFACE;
305}
306
308{
309 return 2;
310}
311
313{
314 return 1;
315}
316
318 LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
319{
320 LPWSTR addl_headers;
321
322 static const WCHAR wszHeaders[] =
323 {'C','o','n','t','e','n','t','-','T','y','p','e',':',' ','a','p','p','l','i','c','a','t',
324 'i','o','n','/','x','-','w','w','w','-','f','o','r','m','-','u','r','l','e','n','c','o',
325 'd','e','d','\r','\n',0};
326
327 CHECK_EXPECT(BeginningTransaction);
328
329 if(binding_test)
330 ok(!lstrcmpW(szURL, binding_urls[tested_protocol]), "szURL != http_url\n");
331 else
332 ok(!lstrcmpW(szURL, http_url), "szURL != http_url\n");
333 ok(!dwReserved, "dwReserved=%ld, expected 0\n", dwReserved);
334 ok(pszAdditionalHeaders != NULL, "pszAdditionalHeaders == NULL\n");
335 if(pszAdditionalHeaders)
336 {
337 ok(*pszAdditionalHeaders == NULL, "*pszAdditionalHeaders != NULL\n");
338 if (http_post_test)
339 {
340 addl_headers = CoTaskMemAlloc(sizeof(wszHeaders));
341 memcpy(addl_headers, wszHeaders, sizeof(wszHeaders));
342 *pszAdditionalHeaders = addl_headers;
343 }
344 }
345
346 return S_OK;
347}
348
350 LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders)
351{
352 CHECK_EXPECT(OnResponse);
353
354 ok(dwResponseCode == 200, "dwResponseCode=%ld, expected 200\n", dwResponseCode);
355 ok(szResponseHeaders != NULL, "szResponseHeaders == NULL\n");
356 ok(szRequestHeaders == NULL, "szRequestHeaders != NULL\n");
357 ok(pszAdditionalRequestHeaders == NULL, "pszAdditionalHeaders != NULL\n");
358
359 return S_OK;
360}
361
363 BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
364{
365 static const BYTE sec_id[] = {'h','t','t','p',':','t','e','s','t',1,0,0,0};
366
367 CHECK_EXPECT(GetRootSecurityId);
368
369 ok(!dwReserved, "dwReserved=%Id, expected 0\n", dwReserved);
370 ok(pbSecurityId != NULL, "pbSecurityId == NULL\n");
371 ok(pcbSecurityId != NULL, "pcbSecurityId == NULL\n");
372
373 if(pcbSecurityId) {
374 ok(*pcbSecurityId == 512, "*pcbSecurityId=%ld, expected 512\n", *pcbSecurityId);
375 *pcbSecurityId = sizeof(sec_id);
376 }
377
378 if(pbSecurityId)
379 memcpy(pbSecurityId, sec_id, sizeof(sec_id));
380
381 return E_FAIL;
382}
383
384static IHttpNegotiate2Vtbl HttpNegotiateVtbl = {
391};
392
394
396{
397 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
398 *ppv = NULL;
399 return E_NOINTERFACE;
400}
401
403{
404 return 2;
405}
406
408{
409 return 1;
410}
411
413{
414 CHECK_EXPECT(Redirect);
415 *cancel = VARIANT_FALSE;
416 return S_OK;
417}
418
419static const IBindCallbackRedirectVtbl BindCallbackRedirectVtbl = {
424};
425
427
428static HRESULT QueryInterface(REFIID,void**);
429
431{
432 return QueryInterface(riid, ppv);
433}
434
436{
437 return 2;
438}
439
441{
442 return 1;
443}
444
446 REFIID riid, void **ppv)
447{
448 if(IsEqualGUID(&IID_IHttpNegotiate, guidService) || IsEqualGUID(&IID_IHttpNegotiate2, riid)) {
449 CHECK_EXPECT2(QueryService_HttpNegotiate);
450 return IHttpNegotiate2_QueryInterface(&http_negotiate, riid, ppv);
451 }
452
453 if(IsEqualGUID(&IID_IInternetProtocol, guidService)) {
454 ok(IsEqualGUID(&IID_IInternetProtocol, riid), "unexpected riid\n");
455 CHECK_EXPECT(QueryService_InternetProtocol);
456 return E_NOINTERFACE;
457 }
458
459 if(IsEqualGUID(&IID_IHttpSecurity, guidService)) {
460 ok(IsEqualGUID(&IID_IHttpSecurity, riid), "unexpected riid\n");
461 CHECK_EXPECT(QueryService_HttpSecurity);
462 return IHttpSecurity_QueryInterface(&http_security, riid, ppv);
463 }
464
465 if(IsEqualGUID(&IID_IBindCallbackRedirect, guidService)) {
466 CHECK_EXPECT(QueryService_IBindCallbackRedirect);
467 ok(IsEqualGUID(&IID_IBindCallbackRedirect, riid), "riid = %s\n", wine_dbgstr_guid(riid));
469 return S_OK;
470 }
471
472 if(IsEqualGUID(&IID_IGetBindHandle, guidService)) {
473 if(winetest_debug > 1) trace("QueryService(IID_IGetBindHandle)\n");
474 *ppv = NULL;
475 return E_NOINTERFACE;
476 }
477
478 if(IsEqualGUID(&IID_IWindowForBindingUI, guidService)) {
479 if(winetest_debug > 1) trace("QueryService(IID_IWindowForBindingUI)\n");
480 *ppv = NULL;
481 return E_NOINTERFACE;
482 }
483
484 ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService));
485 return E_FAIL;
486}
487
488static const IServiceProviderVtbl ServiceProviderVtbl = {
493};
494
496
498{
499 static const IID IID_strm_unknown = {0x2f68429a,0x199a,0x4043,{0x93,0x11,0xf2,0xfe,0x7c,0x13,0xcc,0xb9}};
500
501 if(!IsEqualGUID(&IID_strm_unknown, riid)) /* IE11 */
502 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
503
504 *ppv = NULL;
505 return E_NOINTERFACE;
506}
507
509{
510 return 2;
511}
512
514{
515 return 1;
516}
517
518static HRESULT WINAPI Stream_Read(IStream *iface, void *pv,
519 ULONG cb, ULONG *pcbRead)
520{
522
523 ok(GetCurrentThreadId() != thread_id, "wrong thread %ld\n", GetCurrentThreadId());
524
525 ok(pv != NULL, "pv == NULL\n");
526 ok(cb == 0x20000 || broken(cb == 0x2000), "cb = %ld\n", cb);
527 ok(pcbRead != NULL, "pcbRead == NULL\n");
528
529 if(post_stream_read) {
530 *pcbRead = 0;
531 return S_FALSE;
532 }
533
534 memcpy(pv, post_data, sizeof(post_data)-1);
535 post_stream_read += *pcbRead = sizeof(post_data)-1;
536 return S_OK;
537}
538
539static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv,
540 ULONG cb, ULONG *pcbWritten)
541{
542 ok(0, "unexpected call\n");
543 return E_NOTIMPL;
544}
545
547 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
548{
550
551 ok(!dlibMove.QuadPart, "dlibMove != 0\n");
552 ok(dwOrigin == STREAM_SEEK_SET, "dwOrigin = %ld\n", dwOrigin);
553 ok(!plibNewPosition, "plibNewPosition == NULL\n");
554
555 return S_OK;
556}
557
559{
560 ok(0, "unexpected call\n");
561 return E_NOTIMPL;
562}
563
565 ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
566{
567 ok(0, "unexpected call\n");
568 return E_NOTIMPL;
569}
570
571static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
572{
573 ok(0, "unexpected call\n");
574 return E_NOTIMPL;
575}
576
578{
579 ok(0, "unexpected call\n");
580 return E_NOTIMPL;
581}
582
584 ULARGE_INTEGER cb, DWORD dwLockType)
585{
586 ok(0, "unexpected call\n");
587 return E_NOTIMPL;
588}
589
591 ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
592{
593 ok(0, "unexpected call\n");
594 return E_NOTIMPL;
595}
596
597static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg,
598 DWORD dwStatFlag)
599{
600 ok(0, "unexpected call\n");
601 return E_NOTIMPL;
602}
603
605{
606 ok(0, "unexpected call\n");
607 return E_NOTIMPL;
608}
609
610static const IStreamVtbl StreamVtbl = {
625};
626
628
630{
631 return QueryInterface(riid, ppv);
632}
633
635{
636 return 2;
637}
638
640{
641 return 1;
642}
643
644static void call_continue(PROTOCOLDATA *protocol_data)
645{
647
648 if (winetest_debug > 1)
649 if(winetest_debug > 1) trace("continue in state %d\n", state);
650
651 if(state == STATE_CONNECTING) {
653 if (http_is_first){
654 CLEAR_CALLED(ReportProgress_FINDINGRESOURCE);
655 CLEAR_CALLED(ReportProgress_PROXYDETECTING);
656 }
657 CLEAR_CALLED(ReportProgress_CONNECTING);
658 }
660 todo_wine CHECK_CALLED(ReportProgress_SENDINGREQUEST);
661 else if (tested_protocol != HTTPS_TEST)
662 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
663 if(test_redirect && !(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS)) {
664 CHECK_CALLED(ReportProgress_REDIRECTING);
665 CLEAR_CALLED(GetBindString_SAMESITE_COOKIE_LEVEL); /* New in IE11 */
666 }
668 }
669
670 switch(state) {
673 SET_EXPECT(ReportProgress_SENDINGREQUEST);
674 break;
677 && (!test_redirect || !(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS))) {
678 SET_EXPECT(OnResponse);
680 SET_EXPECT(ReportProgress_ACCEPTRANGES);
681 SET_EXPECT(ReportProgress_ENCODING);
682 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
683 if(bindf & BINDF_NEEDFILE)
684 SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
685 }
686 default:
687 break;
688 }
689
690 if(state != STATE_SENDINGREQUEST && (!test_redirect || !(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS)))
691 SET_EXPECT(ReportData);
692 hres = IInternetProtocol_Continue(async_protocol, protocol_data);
693 ok(hres == S_OK, "Continue failed: %08lx\n", hres);
695 CLEAR_CALLED(ReportData);
696 else if(state != STATE_SENDINGREQUEST && (!test_redirect || !(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS)))
697 CHECK_CALLED(ReportData);
698
699 switch(state) {
702 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
704 break;
706 if(!security_problem) {
709 && (!test_redirect || !(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS))) {
710 CHECK_CALLED(OnResponse);
712 CHECK_CALLED(ReportProgress_ACCEPTRANGES);
713 else if(test_redirect || test_abort)
714 CLEAR_CALLED(ReportProgress_ACCEPTRANGES);
715 CLEAR_CALLED(ReportProgress_ENCODING);
716 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
717 if(bindf & BINDF_NEEDFILE)
718 CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
719 }
720 }
721 else
722 {
724 SET_EXPECT(ReportProgress_CONNECTING);
725 }
726 default:
727 break;
728 }
729}
730
731static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
732{
734 CHECK_EXPECT2(Switch);
735 else
736 CHECK_EXPECT(Switch);
737
738 ok(pProtocolData != NULL, "pProtocolData == NULL\n");
739 if(binding_test) {
740 ok(pProtocolData != &protocoldata, "pProtocolData == &protocoldata\n");
741 ok(pProtocolData->grfFlags == protocoldata.grfFlags, "grfFlags wrong %lx/%lx\n",
742 pProtocolData->grfFlags, protocoldata.grfFlags );
743 ok(pProtocolData->dwState == protocoldata.dwState, "dwState wrong %lx/%lx\n",
744 pProtocolData->dwState, protocoldata.dwState );
745 ok(pProtocolData->pData == protocoldata.pData, "pData wrong %p/%p\n",
746 pProtocolData->pData, protocoldata.pData );
747 ok(pProtocolData->cbData == protocoldata.cbData, "cbData wrong %lx/%lx\n",
748 pProtocolData->cbData, protocoldata.cbData );
749 }
750
751 pdata = pProtocolData;
752
753 if(binding_test) {
755 ok( WaitForSingleObject(event_complete2, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
756 return S_OK;
757 }if(direct_read) {
758 continue_protdata = *pProtocolData;
760 ok( WaitForSingleObject(event_continue_done, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
761 }else {
762 call_continue(pProtocolData);
764 }
765
766 return S_OK;
767}
768
769static const char *status_names[] =
770{
771 "0",
772 "FINDINGRESOURCE",
773 "CONNECTING",
774 "REDIRECTING",
775 "BEGINDOWNLOADDATA",
776 "DOWNLOADINGDATA",
777 "ENDDOWNLOADDATA",
778 "BEGINDOWNLOADCOMPONENTS",
779 "INSTALLINGCOMPONENTS",
780 "ENDDOWNLOADCOMPONENTS",
781 "USINGCACHEDCOPY",
782 "SENDINGREQUEST",
783 "CLASSIDAVAILABLE",
784 "MIMETYPEAVAILABLE",
785 "CACHEFILENAMEAVAILABLE",
786 "BEGINSYNCOPERATION",
787 "ENDSYNCOPERATION",
788 "BEGINUPLOADDATA",
789 "UPLOADINGDATA",
790 "ENDUPLOADINGDATA",
791 "PROTOCOLCLASSID",
792 "ENCODING",
793 "VERIFIEDMIMETYPEAVAILABLE",
794 "CLASSINSTALLLOCATION",
795 "DECODING",
796 "LOADINGMIMEHANDLER",
797 "CONTENTDISPOSITIONATTACH",
798 "FILTERREPORTMIMETYPE",
799 "CLSIDCANINSTANTIATE",
800 "IUNKNOWNAVAILABLE",
801 "DIRECTBIND",
802 "RAWMIMETYPE",
803 "PROXYDETECTING",
804 "ACCEPTRANGES",
805 "COOKIE_SENT",
806 "COMPACT_POLICY_RECEIVED",
807 "COOKIE_SUPPRESSED",
808 "COOKIE_STATE_UNKNOWN",
809 "COOKIE_STATE_ACCEPT",
810 "COOKIE_STATE_REJECT",
811 "COOKIE_STATE_PROMPT",
812 "COOKIE_STATE_LEASH",
813 "COOKIE_STATE_DOWNGRADE",
814 "POLICY_HREF",
815 "P3P_HEADER",
816 "SESSION_COOKIE_RECEIVED",
817 "PERSISTENT_COOKIE_RECEIVED",
818 "SESSION_COOKIES_ALLOWED",
819 "CACHECONTROL",
820 "CONTENTDISPOSITIONFILENAME",
821 "MIMETEXTPLAINMISMATCH",
822 "PUBLISHERAVAILABLE",
823 "DISPLAYNAMEAVAILABLE"
824};
825
827 LPCWSTR szStatusText)
828{
829 static const WCHAR text_plain[] = {'t','e','x','t','/','p','l','a','i','n',0};
830
831 if (winetest_debug > 1)
832 {
833 if (ulStatusCode < ARRAY_SIZE(status_names))
834 trace( "progress: %s %s\n", status_names[ulStatusCode], wine_dbgstr_w(szStatusText) );
835 else
836 trace( "progress: %lu %s\n", ulStatusCode, wine_dbgstr_w(szStatusText) );
837 }
838
839 switch(ulStatusCode) {
840 case BINDSTATUS_MIMETYPEAVAILABLE:
841 CHECK_EXPECT2(ReportProgress_MIMETYPEAVAILABLE);
842 if(tested_protocol != FILE_TEST && tested_protocol != ITS_TEST && !mimefilter_test && (pi & PI_MIMEVERIFICATION)) {
843 if(!short_read || !direct_read)
844 CHECK_CALLED(Read); /* set in Continue */
845 else if(short_read)
846 CHECK_CALLED(Read2); /* set in Read */
847 }
848 ok(szStatusText != NULL, "szStatusText == NULL\n");
849 if(szStatusText) {
851 ok(!lstrcmpW(szStatusText, expect_wsz), "unexpected szStatusText %s\n", wine_dbgstr_w(szStatusText));
852 else if (http_post_test)
853 ok(lstrlenW(text_plain) <= lstrlenW(szStatusText) &&
854 !memcmp(szStatusText, text_plain, lstrlenW(text_plain)*sizeof(WCHAR)),
855 "szStatusText != text/plain\n");
856 else if(empty_file)
857 ok(!lstrcmpW(szStatusText, L"text/javascript"), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
858 else if((pi & PI_MIMEVERIFICATION) && emulate_prot && !mimefilter_test
860 ok(lstrlenW(gifW) <= lstrlenW(szStatusText) &&
861 !memcmp(szStatusText, gifW, lstrlenW(gifW)*sizeof(WCHAR)),
862 "szStatusText != image/gif\n");
863 else if(!mimefilter_test)
864 ok(lstrlenW(text_htmlW) <= lstrlenW(szStatusText) &&
865 !memcmp(szStatusText, text_htmlW, lstrlenW(text_htmlW)*sizeof(WCHAR)),
866 "szStatusText != text/html\n");
867 }
868 break;
869 case BINDSTATUS_DIRECTBIND:
870 CHECK_EXPECT2(ReportProgress_DIRECTBIND);
871 ok(szStatusText == NULL, "szStatusText != NULL\n");
872 break;
873 case BINDSTATUS_RAWMIMETYPE:
874 CHECK_EXPECT2(ReportProgress_RAWMIMETYPE);
875 ok(szStatusText != NULL, "szStatusText == NULL\n");
876 if(szStatusText)
877 ok(lstrlenW(szStatusText) < lstrlenW(text_htmlW) ||
878 !memcmp(szStatusText, text_htmlW, lstrlenW(text_htmlW)*sizeof(WCHAR)),
879 "szStatusText != text/html\n");
880 break;
881 case BINDSTATUS_CACHEFILENAMEAVAILABLE:
882 CHECK_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
883 ok(szStatusText != NULL, "szStatusText == NULL\n");
884 if(szStatusText) {
885 if(binding_test)
886 ok(!lstrcmpW(szStatusText, expect_wsz), "unexpected szStatusText\n");
887 else if(tested_protocol == FILE_TEST)
888 ok(!lstrcmpW(szStatusText, file_name), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
889 else
890 ok(szStatusText != NULL, "szStatusText == NULL\n");
891 }
892 break;
893 case BINDSTATUS_FINDINGRESOURCE:
894 CHECK_EXPECT2(ReportProgress_FINDINGRESOURCE);
895 ok(szStatusText != NULL, "szStatusText == NULL\n");
896 break;
897 case BINDSTATUS_CONNECTING:
898 CHECK_EXPECT2(ReportProgress_CONNECTING);
899 ok(szStatusText != NULL, "szStatusText == NULL\n");
900 break;
901 case BINDSTATUS_SENDINGREQUEST:
902 CHECK_EXPECT2(ReportProgress_SENDINGREQUEST);
904 ok(szStatusText != NULL, "szStatusText == NULL\n");
905 if(szStatusText)
906 ok(!*szStatusText, "wrong szStatusText\n");
907 }
908 break;
909 case BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE:
910 CHECK_EXPECT(ReportProgress_VERIFIEDMIMETYPEAVAILABLE);
911 ok(szStatusText != NULL, "szStatusText == NULL\n");
912 if(szStatusText)
913 ok(!lstrcmpW(szStatusText, L"text/html"), "szStatusText != text/html\n");
914 break;
915 case BINDSTATUS_PROTOCOLCLASSID:
916 CHECK_EXPECT(ReportProgress_PROTOCOLCLASSID);
917 ok(szStatusText != NULL, "szStatusText == NULL\n");
918 ok(!lstrcmpW(szStatusText, protocol_clsid), "unexpected classid %s\n", wine_dbgstr_w(szStatusText));
919 break;
920 case BINDSTATUS_COOKIE_SENT:
921 CHECK_EXPECT2(ReportProgress_COOKIE_SENT);
922 ok(szStatusText == NULL, "szStatusText != NULL\n");
923 break;
924 case BINDSTATUS_REDIRECTING:
925 CHECK_EXPECT(ReportProgress_REDIRECTING);
926 if(test_redirect)
927 ok(!lstrcmpW(szStatusText, L"http://test.winehq.org/tests/hello.html"), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
928 else
929 ok(szStatusText == NULL, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
930 break;
931 case BINDSTATUS_ENCODING:
932 CHECK_EXPECT(ReportProgress_ENCODING);
933 ok(!lstrcmpW(szStatusText, L"gzip"), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
934 break;
935 case BINDSTATUS_ACCEPTRANGES:
936 CHECK_EXPECT(ReportProgress_ACCEPTRANGES);
937 ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
938 break;
939 case BINDSTATUS_PROXYDETECTING:
940 if(!called_ReportProgress_PROXYDETECTING)
941 SET_EXPECT(ReportProgress_CONNECTING);
942 CHECK_EXPECT2(ReportProgress_PROXYDETECTING);
943 ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
944 break;
945 case BINDSTATUS_LOADINGMIMEHANDLER:
946 CHECK_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
947 ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
948 break;
949 case BINDSTATUS_DECODING:
950 CHECK_EXPECT(ReportProgress_DECODING);
951 ok(!lstrcmpW(szStatusText, pjpegW), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
952 break;
953 case BINDSTATUS_RESERVED_7:
954 if(winetest_debug > 1) trace("BINDSTATUS_RESERVED_7\n");
955 break;
956 case BINDSTATUS_RESERVED_8:
957 if(winetest_debug > 1) trace("BINDSTATUS_RESERVED_8\n");
958 break;
959 default:
960 ok(0, "Unexpected status %ld (%ld)\n", ulStatusCode, ulStatusCode-BINDSTATUS_LAST);
961 };
962
963 return S_OK;
964}
965
967{
969 char buf[1024];
970 DWORD size, len;
972
973 static const WCHAR connectionW[] = {'c','o','n','n','e','c','t','i','o','n',0};
974
975 hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&info);
976 ok(hres == S_OK, "Could not get IWinInterHttpInfo iface: %08lx\n", hres);
977
978 size = sizeof(buf);
979 strcpy(buf, "connection");
980 hres = IWinInetHttpInfo_QueryInfo(info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL);
982 ok(hres == S_OK, "QueryInfo failed: %08lx\n", hres);
983
984 ok(!strcmp(buf, "Keep-Alive") || !strcmp(buf, "Upgrade, Keep-Alive"), "buf = %s\n", buf);
985 len = strlen(buf);
986 ok(size == len, "size = %lu, expected %lu\n", size, len);
987
988 size = sizeof(buf);
989 memcpy(buf, connectionW, sizeof(connectionW));
990 hres = IWinInetHttpInfo_QueryInfo(info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL);
991 ok(hres == S_FALSE, "QueryInfo returned %08lx\n", hres);
992 }else {
993 ok(hres == S_FALSE, "QueryInfo failed: %08lx\n", hres);
994 }
995
996 IWinInetHttpInfo_Release(info);
997}
998
1000 ULONG ulProgress, ULONG ulProgressMax)
1001{
1002 HRESULT hres;
1003
1004 static int rec_depth;
1005 rec_depth++;
1006
1008 CHECK_EXPECT2(ReportData);
1009
1010 ok(ulProgress == ulProgressMax, "ulProgress (%ld) != ulProgressMax (%ld)\n",
1011 ulProgress, ulProgressMax);
1012 if(!file_with_hash)
1013 ok(ulProgressMax == 13, "ulProgressMax=%ld, expected 13\n", ulProgressMax);
1014 /* BSCF_SKIPDRAINDATAFORFILEURLS added in IE8 */
1016 ok((grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION)) ||
1017 (grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION | BSCF_SKIPDRAINDATAFORFILEURLS)),
1018 "grcfBSCF = %08lx\n", grfBSCF);
1019 else
1020 ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE), "grcfBSCF = %08lx\n", grfBSCF);
1021 }else if(bind_from_cache) {
1022 CHECK_EXPECT(ReportData);
1023
1024 ok(grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE), "grcfBSCF = %08lx\n", grfBSCF);
1025 ok(ulProgress == 1000, "ulProgress = %lu\n", ulProgress);
1026 ok(!ulProgressMax, "ulProgressMax = %lu\n", ulProgressMax);
1027 }else if(direct_read) {
1028 BYTE buf[14096];
1029 ULONG read;
1030
1031 if(!read_report_data && rec_depth == 1) {
1032 BOOL reported_all_data = called_ReportData2;
1033
1034 CHECK_EXPECT2(ReportData);
1035
1036 if(short_read) {
1037 ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE)
1038 || grfBSCF == BSCF_FIRSTDATANOTIFICATION, /* < IE8 */
1039 "grcfBSCF = %08lx\n", grfBSCF);
1040 CHECK_CALLED(Read); /* Set in Continue */
1042 }else if(first_data_notif) {
1043 ok(grfBSCF == BSCF_FIRSTDATANOTIFICATION, "grcfBSCF = %08lx\n", grfBSCF);
1045 }else if(reported_all_data) {
1046 ok(grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION),
1047 "grcfBSCF = %08lx\n", grfBSCF);
1048 }else if(!direct_read) {
1049 ok(grfBSCF == BSCF_INTERMEDIATEDATANOTIFICATION, "grcfBSCF = %08lx\n", grfBSCF);
1050 }
1051
1052 do {
1053 read = 0;
1054 if(emulate_prot)
1056 else
1057 SET_EXPECT(ReportData2);
1058 SET_EXPECT(ReportResult);
1059 if(!emulate_prot)
1060 SET_EXPECT(Switch);
1061 hres = IInternetProtocol_Read(binding_test ? binding_protocol : async_protocol, expect_pv = buf, sizeof(buf), &read);
1062 ok(hres == E_PENDING || hres == S_FALSE || hres == S_OK, "Read failed: %08lx\n", hres);
1063 if(hres == S_OK)
1064 ok(read, "read == 0\n");
1065 if(reported_all_data)
1066 ok(hres == S_FALSE, "Read failed: %08lx, expected S_FALSE\n", hres);
1067 if(!emulate_prot && hres != E_PENDING)
1068 CHECK_NOT_CALLED(Switch); /* otherwise checked in wait_for_switch loop */
1069 if(emulate_prot)
1071 if(!reported_all_data && called_ReportData2) {
1072 if(!emulate_prot)
1073 CHECK_CALLED(ReportData2);
1074 CHECK_CALLED(ReportResult);
1075 reported_all_data = TRUE;
1076 }else {
1077 if(!emulate_prot)
1078 CHECK_NOT_CALLED(ReportData2);
1079 CHECK_NOT_CALLED(ReportResult);
1080 }
1081 }while(hres == S_OK);
1082 if(hres == S_FALSE)
1084 }else {
1085 CHECK_EXPECT(ReportData2);
1086
1087 ok(grfBSCF & BSCF_LASTDATANOTIFICATION, "grfBSCF = %08lx\n", grfBSCF);
1088
1089 read = 0xdeadbeef;
1090 if(emulate_prot)
1091 SET_EXPECT(Read2);
1092 hres = IInternetProtocol_Read(binding_test ? binding_protocol : async_protocol, expect_pv = buf, sizeof(buf), &read);
1093 if(emulate_prot)
1094 CHECK_CALLED(Read2);
1095 ok(hres == S_FALSE, "Read returned: %08lx, expected E_FALSE\n", hres);
1096 ok(!read, "read = %ld\n", read);
1097 }
1099 || tested_protocol == FTP_TEST)) {
1100 if(empty_file)
1101 CHECK_EXPECT2(ReportData);
1102 else if(!(grfBSCF & BSCF_LASTDATANOTIFICATION) || (grfBSCF & BSCF_DATAFULLYAVAILABLE))
1103 CHECK_EXPECT(ReportData);
1104 else if (http_post_test)
1105 ok(ulProgress == 13, "Read %lu bytes instead of 13\n", ulProgress);
1106
1107 if(empty_file) {
1108 ok(!ulProgress, "ulProgress = %ld\n", ulProgress);
1109 ok(!ulProgressMax, "ulProgressMax = %ld\n", ulProgressMax);
1110 }else {
1111 ok(ulProgress, "ulProgress == 0\n");
1112 }
1113
1114 if(empty_file) {
1115 ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION),
1116 "grcfBSCF = %08lx\n", grfBSCF);
1118 }else if(first_data_notif) {
1119 ok(grfBSCF == BSCF_FIRSTDATANOTIFICATION
1120 || grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE),
1121 "grcfBSCF = %08lx\n", grfBSCF);
1123 } else {
1124 ok(grfBSCF == BSCF_INTERMEDIATEDATANOTIFICATION
1125 || grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION)
1126 || broken(grfBSCF == (BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION)),
1127 "grcfBSCF = %08lx\n", grfBSCF);
1128 }
1129
1130 if((grfBSCF & BSCF_FIRSTDATANOTIFICATION) && !binding_test)
1132
1133 if(!(bindf & BINDF_FROMURLMON) &&
1134 !(grfBSCF & BSCF_LASTDATANOTIFICATION)) {
1135 if(state == STATE_CONNECTING) {
1137 if(http_is_first) {
1138 CHECK_CALLED(ReportProgress_FINDINGRESOURCE);
1139 CHECK_CALLED(ReportProgress_CONNECTING);
1140 }
1141 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
1142 CHECK_CALLED(OnResponse);
1143 CHECK_CALLED(ReportProgress_RAWMIMETYPE);
1144 }
1146 }
1147 }else if(!read_report_data) {
1148 BYTE buf[1000];
1149 ULONG read;
1150 HRESULT hres;
1151
1152 CHECK_EXPECT(ReportData);
1153
1154 if(tested_protocol != BIND_TEST) {
1155 do {
1156 if(mimefilter_test)
1157 SET_EXPECT(MimeFilter_Read);
1158 else if(rec_depth > 1)
1159 SET_EXPECT(Read2);
1160 else
1162 hres = IInternetProtocol_Read(binding_protocol, expect_pv=buf, sizeof(buf), &read);
1163 if(mimefilter_test)
1164 CHECK_CALLED(MimeFilter_Read);
1165 else if(rec_depth > 1)
1166 CHECK_CALLED(Read2);
1167 else
1169 }while(hres == S_OK);
1170 }
1171 }
1172
1173 if(result_from_lock) {
1175 hres = IInternetProtocol_LockRequest(binding_protocol, 0);
1176 ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
1178
1179 /* ReportResult is called before ReportData returns */
1180 SET_EXPECT(ReportResult);
1181 }
1182
1183 rec_depth--;
1184 return S_OK;
1185}
1186
1188 DWORD dwError, LPCWSTR szResult)
1189{
1190 CHECK_EXPECT(ReportResult);
1191
1193 return S_OK;
1194
1196 ok(hrResult == E_PENDING || hrResult == S_OK, "hrResult = %08lx, expected E_PENDING or S_OK\n", hrResult);
1197 else
1198 ok(hrResult == expect_hrResult || (test_abort && hrResult == S_OK), /* result can come in before the abort */
1199 "hrResult = %08lx, expected: %08lx\n", hrResult, expect_hrResult);
1200 if(SUCCEEDED(hrResult) || tested_protocol == FTP_TEST || test_abort || hrResult == INET_E_REDIRECT_FAILED)
1201 ok(dwError == ERROR_SUCCESS, "dwError = %ld, expected ERROR_SUCCESS\n", dwError);
1202 else
1203 ok(dwError != ERROR_SUCCESS ||
1204 broken(tested_protocol == MK_TEST), /* WinME and NT4 */
1205 "dwError == ERROR_SUCCESS\n");
1206
1207 if(hrResult == INET_E_REDIRECT_FAILED)
1208 ok(!lstrcmpW(szResult, L"http://test.winehq.org/tests/hello.html"), "szResult = %s\n", wine_dbgstr_w(szResult));
1209 else
1210 ok(!szResult, "szResult = %s\n", wine_dbgstr_w(szResult));
1211
1212 if(direct_read)
1213 SET_EXPECT(ReportData); /* checked after main loop */
1214
1215 return S_OK;
1216}
1217
1218static IInternetProtocolSinkVtbl protocol_sink_vtbl = {
1226};
1227
1229
1231{
1233 || IsEqualGUID(&IID_IInternetProtocolSink, riid)) {
1234 *ppv = iface;
1235 return S_OK;
1236 }
1237
1238 ok(0, "unexpected call\n");
1239 return E_NOTIMPL;
1240}
1241
1243{
1244 return 2;
1245}
1246
1248{
1249 return 1;
1250}
1251
1252static HRESULT WINAPI MimeProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
1253{
1254 HRESULT hres;
1255
1256 CHECK_EXPECT(MimeFilter_Switch);
1257
1258 SET_EXPECT(Switch);
1259 hres = IInternetProtocolSink_Switch(filtered_sink, pProtocolData);
1260 ok(hres == S_OK, "Switch failed: %08lx\n", hres);
1261 CHECK_CALLED(Switch);
1262
1263 return S_OK;
1264}
1265
1267 LPCWSTR szStatusText)
1268{
1269 switch(ulStatusCode) {
1270 case BINDSTATUS_LOADINGMIMEHANDLER:
1271 /*
1272 * IE9 for some reason (bug?) calls this on mime handler's protocol sink instead of the
1273 * main protocol sink. We check ReportProgress_LOADINGMIMEHANDLER both here and in
1274 * ProtocolSink_ReportProgress to workaround it.
1275 */
1276 CHECK_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
1277 ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
1278 break;
1279 default:
1280 ok(0, "Unexpected status code %ld\n", ulStatusCode);
1281 }
1282
1283 return S_OK;
1284}
1285
1287 ULONG ulProgress, ULONG ulProgressMax)
1288{
1289 DWORD read = 0;
1290 BYTE buf[8192];
1291 HRESULT hres;
1293
1294 CHECK_EXPECT(MimeFilter_ReportData);
1295
1296 if(!filter_state && !no_mime) {
1298 hres = IInternetProtocol_Read(filtered_protocol, buf, sizeof(buf), &read);
1300 ok(hres == S_OK || hres == E_PENDING || hres == S_FALSE, "Read failed: %08lx\n", hres);
1301 else
1302 ok(hres == S_OK, "Read failed: %08lx\n", hres);
1304
1305 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
1306 hres = IInternetProtocolSink_ReportProgress(filtered_sink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, text_htmlW);
1307 ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
1308 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
1309
1310 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
1311 hres = IInternetProtocolSink_ReportProgress(filtered_sink, BINDSTATUS_MIMETYPEAVAILABLE, text_htmlW);
1312 ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
1313 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
1314
1315 /* FIXME: test BINDSTATUS_CACHEFILENAMEAVAILABLE */
1316 }
1317
1318 if(no_mime && prot_read<200) {
1320 }else if(no_mime && prot_read<300) {
1321 report_mime = TRUE;
1323 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
1324 SET_EXPECT(ReportData);
1325 }else if(!read_report_data) {
1326 SET_EXPECT(ReportData);
1327 }
1328 hres = IInternetProtocolSink_ReportData(filtered_sink, grfBSCF, ulProgress, ulProgressMax);
1329 ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
1330 if(no_mime && prot_read<=200) {
1332 }else if(report_mime) {
1333 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
1334 CHECK_CALLED(ReportData);
1335 }else if(!read_report_data) {
1336 CHECK_CALLED(ReportData);
1337 }
1338
1339 if(!filter_state)
1340 filter_state = 1;
1341
1342 return S_OK;
1343}
1344
1346 DWORD dwError, LPCWSTR szResult)
1347{
1348 HRESULT hres;
1349
1350 CHECK_EXPECT(MimeFilter_ReportResult);
1351
1352 ok(hrResult == S_OK, "hrResult = %08lx\n", hrResult);
1353 ok(dwError == ERROR_SUCCESS, "dwError = %lu\n", dwError);
1354 ok(!szResult, "szResult = %s\n", wine_dbgstr_w(szResult));
1355
1356 SET_EXPECT(ReportResult);
1357 hres = IInternetProtocolSink_ReportResult(filtered_sink, hrResult, dwError, szResult);
1358 ok(SUCCEEDED(hres), "ReportResult failed: %08lx\n", hres);
1359 CHECK_CALLED(ReportResult);
1360
1361 return S_OK;
1362}
1363
1364static IInternetProtocolSinkVtbl mime_protocol_sink_vtbl = {
1372};
1373
1375
1377{
1378 static const IID IID_undocumented = {0x58DFC7D0,0x5381,0x43E5,{0x9D,0x72,0x4C,0xDD,0xE4,0xCB,0x0F,0x1A}};
1379 static const IID IID_undocumentedIE10 = {0xc28722e5,0xbc1a,0x4c55,{0xa6,0x8d,0x33,0x21,0x9f,0x69,0x89,0x10}};
1380
1381 *ppv = NULL;
1382
1383 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocolSink, riid))
1384 *ppv = &protocol_sink;
1385 if(IsEqualGUID(&IID_IServiceProvider, riid))
1387 if(IsEqualGUID(&IID_IUriContainer, riid))
1388 return E_NOINTERFACE; /* TODO */
1389
1390 /* NOTE: IE8 queries for undocumented {58DFC7D0-5381-43E5-9D72-4CDDE4CB0F1A} interface. */
1391 if(IsEqualGUID(&IID_undocumented, riid))
1392 return E_NOINTERFACE;
1393 /* NOTE: IE10 queries for undocumented {c28722e5-bc1a-4c55-a68d-33219f698910} interface. */
1394 if(IsEqualGUID(&IID_undocumentedIE10, riid))
1395 return E_NOINTERFACE;
1396
1397 if(*ppv)
1398 return S_OK;
1399
1400 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
1401 return E_NOINTERFACE;
1402}
1403
1405{
1406 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetBindInfo, riid)) {
1407 *ppv = iface;
1408 return S_OK;
1409 }
1410 return E_NOINTERFACE;
1411}
1412
1414{
1415 return 2;
1416}
1417
1419{
1420 return 1;
1421}
1422
1423static HRESULT WINAPI BindInfo_GetBindInfo(IInternetBindInfo *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
1424{
1425 DWORD cbSize;
1426
1427 CHECK_EXPECT(GetBindInfo);
1428
1429 ok(grfBINDF != NULL, "grfBINDF == NULL\n");
1430 ok(pbindinfo != NULL, "pbindinfo == NULL\n");
1431 ok(pbindinfo->cbSize == sizeof(BINDINFO), "wrong size of pbindinfo: %ld\n", pbindinfo->cbSize);
1432
1433 *grfBINDF = bindf;
1434 if(binding_test)
1435 *grfBINDF |= BINDF_FROMURLMON;
1436 cbSize = pbindinfo->cbSize;
1437 memset(pbindinfo, 0, cbSize);
1438 pbindinfo->cbSize = cbSize;
1439 pbindinfo->dwOptions = bindinfo_options;
1440
1441 if(http_post_test)
1442 {
1443 pbindinfo->cbstgmedData = sizeof(post_data)-1;
1444 pbindinfo->dwBindVerb = BINDVERB_POST;
1445 pbindinfo->stgmedData.tymed = http_post_test;
1446
1447 if(http_post_test == TYMED_HGLOBAL) {
1448 HGLOBAL data;
1449
1450 /* Must be GMEM_FIXED, GMEM_MOVABLE does not work properly */
1451 data = GlobalAlloc(GPTR, sizeof(post_data));
1452 memcpy(data, post_data, sizeof(post_data));
1453 pbindinfo->stgmedData.hGlobal = data;
1454 }else {
1455 pbindinfo->stgmedData.pstm = &Stream;
1456 }
1457 }
1458
1459 return S_OK;
1460}
1461
1463 LPOLESTR *ppwzStr, ULONG cEl, ULONG *pcElFetched)
1464{
1465 ok(ppwzStr != NULL, "ppwzStr == NULL\n");
1466 ok(pcElFetched != NULL, "pcElFetched == NULL\n");
1467
1468 switch(ulStringType) {
1469 case BINDSTRING_ACCEPT_MIMES:
1470 CHECK_EXPECT(GetBindString_ACCEPT_MIMES);
1471 ok(cEl == 256, "cEl=%ld, expected 256\n", cEl);
1472 if(pcElFetched) {
1473 ok(*pcElFetched == 256, "*pcElFetched=%ld, expected 256\n", *pcElFetched);
1474 *pcElFetched = 1;
1475 }
1476 if(ppwzStr) {
1477 *ppwzStr = CoTaskMemAlloc(sizeof(acc_mimeW));
1478 memcpy(*ppwzStr, acc_mimeW, sizeof(acc_mimeW));
1479 }
1480 return S_OK;
1481 case BINDSTRING_USER_AGENT:
1482 CHECK_EXPECT(GetBindString_USER_AGENT);
1483 ok(cEl == 1, "cEl=%ld, expected 1\n", cEl);
1484 if(pcElFetched) {
1485 ok(*pcElFetched == 0, "*pcElFetch=%ld, expected 0\n", *pcElFetched);
1486 *pcElFetched = 1;
1487 }
1488 if(ppwzStr) {
1489 *ppwzStr = CoTaskMemAlloc(sizeof(user_agentW));
1490 memcpy(*ppwzStr, user_agentW, sizeof(user_agentW));
1491 }
1492 return S_OK;
1493 case BINDSTRING_POST_COOKIE:
1494 CHECK_EXPECT(GetBindString_POST_COOKIE);
1495 ok(cEl == 1, "cEl=%ld, expected 1\n", cEl);
1496 if(pcElFetched)
1497 ok(*pcElFetched == 0, "*pcElFetch=%ld, expected 0\n", *pcElFetched);
1498 return S_OK;
1499 case BINDSTRING_URL: {
1500 DWORD size;
1501
1502 CHECK_EXPECT(GetBindString_URL);
1503 ok(cEl == 1, "cEl=%ld, expected 1\n", cEl);
1504 ok(*pcElFetched == 0, "*pcElFetch=%ld, expected 0\n", *pcElFetched);
1505 *pcElFetched = 1;
1506
1508 *ppwzStr = CoTaskMemAlloc(size);
1510 return S_OK;
1511 }
1512 case BINDSTRING_ROOTDOC_URL:
1513 CHECK_EXPECT(GetBindString_ROOTDOC_URL);
1514 ok(cEl == 1, "cEl=%ld, expected 1\n", cEl);
1515 return E_NOTIMPL;
1516 case BINDSTRING_ENTERPRISE_ID:
1517 ok(cEl == 1, "cEl=%ld, expected 1\n", cEl);
1518 return E_NOTIMPL;
1519 case BINDSTRING_SAMESITE_COOKIE_LEVEL:
1520 CHECK_EXPECT(GetBindString_SAMESITE_COOKIE_LEVEL);
1521 ok(cEl == 1, "cEl=%ld, expected 1\n", cEl);
1522 return E_NOTIMPL;
1523 default:
1524 ok(0, "unexpected ulStringType %ld\n", ulStringType);
1525 }
1526
1527 return E_NOTIMPL;
1528}
1529
1530static IInternetBindInfoVtbl bind_info_vtbl = {
1536};
1537
1539
1541{
1542 return CONTAINING_RECORD(iface, Protocol, IInternetPriority_iface);
1543}
1544
1546 REFIID riid, void **ppv)
1547{
1548 ok(0, "unexpected call\n");
1549 return E_NOINTERFACE;
1550}
1551
1553{
1555 if (This->outer)
1556 {
1557 This->outer_ref++;
1558 return IUnknown_AddRef(This->outer);
1559 }
1560 return IUnknown_AddRef(&This->IUnknown_inner);
1561}
1562
1564{
1566 if (This->outer)
1567 {
1568 This->outer_ref--;
1569 return IUnknown_Release(This->outer);
1570 }
1571 return IUnknown_Release(&This->IUnknown_inner);
1572}
1573
1575{
1577 ok(nPriority == ex_priority, "nPriority=%ld\n", nPriority);
1578 return S_OK;
1579}
1580
1582{
1583 ok(0, "unexpected call\n");
1584 return E_NOTIMPL;
1585}
1586
1587
1588static const IInternetPriorityVtbl InternetPriorityVtbl = {
1594};
1595
1597{
1598 return 2;
1599}
1600
1602{
1603 return 1;
1604}
1605
1608{
1609 HRESULT hres;
1610
1611 CHECK_EXPECT(Abort);
1612
1613 SET_EXPECT(ReportResult);
1614 hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
1615 ok(hres == S_OK, "ReportResult failed: %08lx\n", hres);
1616 CHECK_CALLED(ReportResult);
1617
1618 return S_OK;
1619}
1620
1622{
1623 ok(0, "unexpected call\n");
1624 return E_NOTIMPL;
1625}
1626
1628{
1629 ok(0, "unexpected call\n");
1630 return E_NOTIMPL;
1631}
1632
1634 LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
1635{
1636 ok(0, "unexpected call\n");
1637 return E_NOTIMPL;
1638}
1639
1641{
1642 return CONTAINING_RECORD(iface, Protocol, IInternetProtocolEx_iface);
1643}
1644
1646{
1648
1649 static const IID unknown_iid = {0x7daf9908,0x8415,0x4005,{0x95,0xae, 0xbd,0x27,0xf6,0xe3,0xdc,0x00}};
1650 static const IID unknown_iid2 = {0x5b7ebc0c,0xf630,0x4cea,{0x89,0xd3,0x5a,0xf0,0x38,0xed,0x05,0x5c}};
1651
1652 if(IsEqualGUID(riid, &IID_IInternetProtocolEx)) {
1653 *ppv = &This->IInternetProtocolEx_iface;
1654 IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface);
1655 return S_OK;
1656 }
1657
1658 /* FIXME: Why is it calling here instead of outer IUnknown? */
1659 if(IsEqualGUID(riid, &IID_IInternetPriority)) {
1660 *ppv = &This->IInternetPriority_iface;
1661 IInternetPriority_AddRef(&This->IInternetPriority_iface);
1662 return S_OK;
1663 }
1664 if(!IsEqualGUID(riid, &unknown_iid) && !IsEqualGUID(riid, &unknown_iid2)) /* IE10 */
1665 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
1666 *ppv = NULL;
1667 return E_NOINTERFACE;
1668}
1669
1671{
1673 if (This->outer)
1674 {
1675 This->outer_ref++;
1676 return IUnknown_AddRef(This->outer);
1677 }
1678 return IUnknown_AddRef(&This->IUnknown_inner);
1679}
1680
1682{
1684 if (This->outer)
1685 {
1686 This->outer_ref--;
1687 return IUnknown_Release(This->outer);
1688 }
1689 return IUnknown_Release(&This->IUnknown_inner);
1690}
1691
1693{
1694 BOOL redirect = redirect_on_continue;
1695 HRESULT hres;
1696
1697 memset(&protocoldata, -1, sizeof(protocoldata));
1698
1699 while(1) {
1700 prot_state = 0;
1701
1702 SET_EXPECT(ReportProgress_FINDINGRESOURCE);
1703 hres = IInternetProtocolSink_ReportProgress(binding_sink,
1704 BINDSTATUS_FINDINGRESOURCE, hostW);
1705 CHECK_CALLED(ReportProgress_FINDINGRESOURCE);
1706 ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
1707
1708 SET_EXPECT(ReportProgress_CONNECTING);
1709 hres = IInternetProtocolSink_ReportProgress(binding_sink,
1710 BINDSTATUS_CONNECTING, winehq_ipW);
1711 CHECK_CALLED(ReportProgress_CONNECTING);
1712 ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
1713
1714 SET_EXPECT(ReportProgress_SENDINGREQUEST);
1715 hres = IInternetProtocolSink_ReportProgress(binding_sink,
1716 BINDSTATUS_SENDINGREQUEST, NULL);
1717 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
1718 ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
1719
1720 prot_state = 1;
1721 SET_EXPECT(Switch);
1722 hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
1723 CHECK_CALLED(Switch);
1724 ok(hres == S_OK, "Switch failed: %08lx\n", hres);
1725
1726 if(!redirect)
1727 break;
1728 redirect = FALSE;
1729 }
1730
1731 if(!short_read) {
1732 prot_state = 2;
1733 if(mimefilter_test)
1734 SET_EXPECT(MimeFilter_Switch);
1735 else
1736 SET_EXPECT(Switch);
1737 hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
1738 ok(hres == S_OK, "Switch failed: %08lx\n", hres);
1739 if(mimefilter_test)
1740 CHECK_CALLED(MimeFilter_Switch);
1741 else
1742 CHECK_CALLED(Switch);
1743
1744 if(test_abort) {
1746 return 0;
1747 }
1748
1749 prot_state = 2;
1750 if(mimefilter_test)
1751 SET_EXPECT(MimeFilter_Switch);
1752 else
1753 SET_EXPECT(Switch);
1754 hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
1755 ok(hres == S_OK, "Switch failed: %08lx\n", hres);
1756 if(mimefilter_test)
1757 CHECK_CALLED(MimeFilter_Switch);
1758 else
1759 CHECK_CALLED(Switch);
1760
1761 prot_state = 3;
1762 if(mimefilter_test)
1763 SET_EXPECT(MimeFilter_Switch);
1764 else
1765 SET_EXPECT(Switch);
1766 hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
1767 ok(hres == S_OK, "Switch failed: %08lx\n", hres);
1768 if(mimefilter_test)
1769 CHECK_CALLED(MimeFilter_Switch);
1770 else
1771 CHECK_CALLED(Switch);
1772 }
1773
1775
1776 return 0;
1777}
1778
1779static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD pi)
1780{
1781 BINDINFO bindinfo, exp_bindinfo;
1782 DWORD cbindf = 0;
1783 HRESULT hres;
1784
1785 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
1786 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
1787 ok(pOIProtSink != &protocol_sink, "unexpected pOIProtSink\n");
1788 ok(pOIBindInfo != &bind_info, "unexpected pOIBindInfo\n");
1789 ok(!pi, "pi = %lx\n", pi);
1790
1791 if(binding_test)
1792 ok(pOIProtSink == binding_sink, "pOIProtSink != binding_sink\n");
1793
1794 memset(&bindinfo, 0, sizeof(bindinfo));
1795 bindinfo.cbSize = sizeof(bindinfo);
1796 memcpy(&exp_bindinfo, &bindinfo, sizeof(bindinfo));
1797 if(test_redirect)
1798 exp_bindinfo.dwOptions = bindinfo_options;
1799 SET_EXPECT(GetBindInfo);
1800 if(redirect_on_continue && (bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS))
1801 SET_EXPECT(QueryService_IBindCallbackRedirect);
1802 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &cbindf, &bindinfo);
1803 if(redirect_on_continue && (bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS))
1804 CHECK_CALLED(QueryService_IBindCallbackRedirect);
1805 ok(hres == S_OK, "GetBindInfo failed: %08lx\n", hres);
1806 CHECK_CALLED(GetBindInfo);
1807 ok(cbindf == (bindf|BINDF_FROMURLMON), "bindf = %lx, expected %lx\n",
1808 cbindf, (bindf|BINDF_FROMURLMON));
1809 ok(!memcmp(&exp_bindinfo, &bindinfo, sizeof(bindinfo)), "unexpected bindinfo\n");
1810 pReleaseBindInfo(&bindinfo);
1811
1812 SET_EXPECT(ReportProgress_SENDINGREQUEST);
1813 hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, emptyW);
1814 ok(hres == S_OK, "ReportProgress(BINDSTATUS_SENDINGREQUEST) failed: %08lx\n", hres);
1815 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
1816
1820 IHttpNegotiate2 *http_negotiate2;
1821 LPWSTR ua = (LPWSTR)0xdeadbeef, accept_mimes[256];
1822 LPWSTR additional_headers = NULL;
1823 BYTE sec_id[100];
1824 DWORD fetched = 0, size = 100;
1825 DWORD tid;
1826
1827 SET_EXPECT(GetBindString_USER_AGENT);
1828 hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_USER_AGENT,
1829 &ua, 1, &fetched);
1830 CHECK_CALLED(GetBindString_USER_AGENT);
1831 ok(hres == S_OK, "GetBindString(BINDSTRING_USER_AGETNT) failed: %08lx\n", hres);
1832 ok(fetched == 1, "fetched = %ld, expected 254\n", fetched);
1833 ok(ua != NULL, "ua = %p\n", ua);
1834 ok(!lstrcmpW(ua, user_agentW), "unexpected user agent %s\n", wine_dbgstr_w(ua));
1835 CoTaskMemFree(ua);
1836
1837 fetched = 256;
1838 SET_EXPECT(GetBindString_ACCEPT_MIMES);
1839 hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_ACCEPT_MIMES,
1840 accept_mimes, 256, &fetched);
1841 CHECK_CALLED(GetBindString_ACCEPT_MIMES);
1842
1843 ok(hres == S_OK,
1844 "GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08lx\n", hres);
1845 ok(fetched == 1, "fetched = %ld, expected 1\n", fetched);
1846 ok(!lstrcmpW(acc_mimeW, accept_mimes[0]), "unexpected mimes %s\n", wine_dbgstr_w(accept_mimes[0]));
1847 CoTaskMemFree(accept_mimes[0]);
1848
1849 hres = IInternetBindInfo_QueryInterface(pOIBindInfo, &IID_IServiceProvider,
1850 (void**)&service_provider);
1851 ok(hres == S_OK, "QueryInterface failed: %08lx\n", hres);
1852
1853 SET_EXPECT(QueryService_HttpNegotiate);
1854 hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate,
1855 &IID_IHttpNegotiate, (void**)&http_negotiate);
1856 CHECK_CALLED(QueryService_HttpNegotiate);
1857 ok(hres == S_OK, "QueryService failed: %08lx\n", hres);
1858
1859 SET_EXPECT(BeginningTransaction);
1860 hres = IHttpNegotiate_BeginningTransaction(http_negotiate, binding_urls[tested_protocol],
1861 NULL, 0, &additional_headers);
1862 CHECK_CALLED(BeginningTransaction);
1863 IHttpNegotiate_Release(http_negotiate);
1864 ok(hres == S_OK, "BeginningTransction failed: %08lx\n", hres);
1865 ok(additional_headers == NULL, "additional_headers=%p\n", additional_headers);
1866
1867 SET_EXPECT(QueryService_HttpNegotiate);
1868 hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate2,
1869 &IID_IHttpNegotiate2, (void**)&http_negotiate2);
1870 CHECK_CALLED(QueryService_HttpNegotiate);
1871 ok(hres == S_OK, "QueryService failed: %08lx\n", hres);
1872
1873 size = 512;
1874 SET_EXPECT(GetRootSecurityId);
1875 hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, sec_id, &size, 0);
1876 CHECK_CALLED(GetRootSecurityId);
1877 IHttpNegotiate2_Release(http_negotiate2);
1878 ok(hres == E_FAIL, "GetRootSecurityId failed: %08lx, expected E_FAIL\n", hres);
1879 ok(size == 13, "size=%ld\n", size);
1880
1881 IServiceProvider_Release(service_provider);
1882
1885 return;
1886 }
1887
1888 SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
1889 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
1890 BINDSTATUS_CACHEFILENAMEAVAILABLE, expect_wsz = emptyW);
1891 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08lx\n", hres);
1892 CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
1893
1894 if(mimefilter_test) {
1896 SET_EXPECT(MimeFilter_Start);
1897 SET_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
1898 }
1899 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
1900 hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE,
1902 ok(hres == S_OK,
1903 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08lx\n", hres);
1904 if(mimefilter_test) {
1906 CHECK_CALLED(MimeFilter_Start);
1907 CHECK_CALLED(ReportProgress_LOADINGMIMEHANDLER);
1908 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
1909 }else {
1910 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
1911 }
1912
1913 if(mimefilter_test)
1914 SET_EXPECT(MimeFilter_ReportData);
1915 else
1916 SET_EXPECT(ReportData);
1917 hres = IInternetProtocolSink_ReportData(pOIProtSink,
1918 BSCF_FIRSTDATANOTIFICATION | (tested_protocol == ITS_TEST ? BSCF_DATAFULLYAVAILABLE : BSCF_LASTDATANOTIFICATION),
1919 13, 13);
1920 ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
1921 if(mimefilter_test)
1922 CHECK_CALLED(MimeFilter_ReportData);
1923 else
1924 CHECK_CALLED(ReportData);
1925
1926 if(result_from_lock) {
1927 /* set in ProtocolSink_ReportData */
1928 CHECK_CALLED(ReportResult);
1929 return;
1930 }
1931
1932 if(tested_protocol == ITS_TEST) {
1933 SET_EXPECT(ReportData);
1934 hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_BEGINDOWNLOADDATA, NULL);
1935 ok(hres == S_OK, "ReportProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08lx\n", hres);
1936 CHECK_CALLED(ReportData);
1937 }
1938
1939 if(tested_protocol == BIND_TEST) {
1940 hres = IInternetProtocol_Terminate(binding_protocol, 0);
1941 ok(hres == E_FAIL, "Termiante failed: %08lx\n", hres);
1942 }
1943
1944 if(mimefilter_test)
1945 SET_EXPECT(MimeFilter_ReportResult);
1946 else
1947 SET_EXPECT(ReportResult);
1948 hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
1949 ok(hres == S_OK, "ReportResult failed: %08lx\n", hres);
1950 if(mimefilter_test)
1951 CHECK_CALLED(MimeFilter_ReportResult);
1952 else
1953 CHECK_CALLED(ReportResult);
1954}
1955
1957 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
1959{
1961
1962 ok(!dwReserved, "dwReserved = %Ix\n", dwReserved);
1963 protocol_start(pOIProtSink, pOIBindInfo, grfPI);
1964 return S_OK;
1965}
1966
1968 PROTOCOLDATA *pProtocolData)
1969{
1970 DWORD bscf = 0, pr;
1971 HRESULT hres;
1972
1973 CHECK_EXPECT(Continue);
1974
1975 ok(pProtocolData != NULL, "pProtocolData == NULL\n");
1976 if(!pProtocolData || tested_protocol == BIND_TEST)
1977 return S_OK;
1978 if(binding_test) {
1979 ok(pProtocolData != &protocoldata, "pProtocolData == &protocoldata\n");
1980 ok(pProtocolData->grfFlags == protocoldata.grfFlags, "grfFlags wrong %lx/%lx\n",
1981 pProtocolData->grfFlags, protocoldata.grfFlags );
1982 ok(pProtocolData->dwState == protocoldata.dwState, "dwState wrong %lx/%lx\n",
1983 pProtocolData->dwState, protocoldata.dwState );
1984 ok(pProtocolData->pData == protocoldata.pData, "pData wrong %p/%p\n",
1985 pProtocolData->pData, protocoldata.pData );
1986 ok(pProtocolData->cbData == protocoldata.cbData, "cbData wrong %lx/%lx\n",
1987 pProtocolData->cbData, protocoldata.cbData );
1988 }
1989
1990 switch(prot_state) {
1991 case 1: {
1994 static const WCHAR header[] = {'?',0};
1995 static const WCHAR redirect_urlW[] = {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',
1996 '/','t','e','s','t','s','/','h','e','l','l','o','.','h','t','m','l',0};
1997
2001
2002 if(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS)
2003 SET_EXPECT(Redirect);
2004 SET_EXPECT(ReportProgress_REDIRECTING);
2005 SET_EXPECT(Terminate);
2006 SET_EXPECT(Protocol_destructor);
2007 SET_EXPECT(QueryService_InternetProtocol);
2009 SET_EXPECT(ReportProgress_PROTOCOLCLASSID);
2012 hres = IInternetProtocolSink_ReportResult(binding_sink, INET_E_REDIRECT_FAILED, ERROR_SUCCESS, redirect_urlW);
2013 ok(hres == S_OK, "ReportResult failed: %08lx\n", hres);
2014 if(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS)
2015 CHECK_CALLED(Redirect);
2016 CHECK_CALLED(ReportProgress_REDIRECTING);
2017 CHECK_CALLED(Terminate);
2018 CHECK_CALLED(Protocol_destructor);
2019 CHECK_CALLED(QueryService_InternetProtocol);
2021 CHECK_CALLED(ReportProgress_PROTOCOLCLASSID);
2024
2025 return S_OK;
2026 }
2027
2028 hres = IInternetProtocolSink_QueryInterface(binding_sink, &IID_IServiceProvider,
2029 (void**)&service_provider);
2030 ok(hres == S_OK, "Could not get IServiceProvicder\n");
2031
2032 SET_EXPECT(QueryService_HttpNegotiate);
2033 hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate,
2034 &IID_IHttpNegotiate, (void**)&http_negotiate);
2035 IServiceProvider_Release(service_provider);
2036 CHECK_CALLED(QueryService_HttpNegotiate);
2037 ok(hres == S_OK, "Could not get IHttpNegotiate\n");
2038
2039 SET_EXPECT(OnResponse);
2040 hres = IHttpNegotiate_OnResponse(http_negotiate, 200, header, NULL, NULL);
2041 IHttpNegotiate_Release(http_negotiate);
2042 CHECK_CALLED(OnResponse);
2043 IHttpNegotiate_Release(http_negotiate);
2044 ok(hres == S_OK, "OnResponse failed: %08lx\n", hres);
2045
2046 if(mimefilter_test) {
2048 SET_EXPECT(MimeFilter_Start);
2049 SET_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
2050 }else if(!(pi & PI_MIMEVERIFICATION)) {
2051 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
2052 }
2053 hres = IInternetProtocolSink_ReportProgress(binding_sink,
2054 BINDSTATUS_MIMETYPEAVAILABLE, mimefilter_test ? pjpegW : text_htmlW);
2055 if(mimefilter_test) {
2057 CHECK_CALLED(MimeFilter_Start);
2058 CHECK_CALLED(ReportProgress_LOADINGMIMEHANDLER);
2059 }else if(!(pi & PI_MIMEVERIFICATION)) {
2060 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
2061 }
2062 ok(hres == S_OK,
2063 "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08lx\n", hres);
2064
2065 bscf |= BSCF_FIRSTDATANOTIFICATION;
2066 break;
2067 }
2068 case 2:
2069 case 3:
2070 bscf = BSCF_INTERMEDIATEDATANOTIFICATION;
2071 break;
2072 }
2073
2074 pr = prot_read;
2075 if(mimefilter_test)
2076 SET_EXPECT(MimeFilter_ReportData);
2077 if((!mimefilter_test || no_mime) && (pi & PI_MIMEVERIFICATION)) {
2078 if(pr < 200)
2079 SET_EXPECT(Read); /* checked in ReportData for short_read */
2080 if(pr == 200) {
2081 if(!mimefilter_test)
2082 SET_EXPECT(Read); /* checked in BINDSTATUS_MIMETYPEAVAILABLE or ReportData */
2083 SET_EXPECT(GetBindInfo);
2084 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
2085 }
2086 if(pr >= 200)
2087 SET_EXPECT(ReportData);
2088 }else {
2089 SET_EXPECT(ReportData);
2090 }
2091
2092 hres = IInternetProtocolSink_ReportData(binding_sink, bscf, pr, 400);
2093 ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
2094
2095 if(mimefilter_test) {
2096 SET_EXPECT(MimeFilter_ReportData);
2097 }else if(pi & PI_MIMEVERIFICATION) {
2098 if(!short_read && pr < 200)
2100 if(pr == 200) {
2101 CLEAR_CALLED(GetBindInfo); /* IE9 */
2102 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
2103 }
2104 }else {
2105 CHECK_CALLED(ReportData);
2106 }
2107
2108 if(prot_state == 3)
2109 prot_state = 4;
2110
2111 return S_OK;
2112}
2113
2115{
2116 CHECK_EXPECT(Terminate);
2117 ok(!dwOptions, "dwOptions=%ld\n", dwOptions);
2118 return S_OK;
2119}
2120
2122 ULONG cb, ULONG *pcbRead)
2123{
2125 CHECK_EXPECT2(Read2);
2126
2128 if(!read_report_data)
2130 }else if((pi & PI_MIMEVERIFICATION)) {
2131 if(!read_report_data)
2133
2134 if(prot_read < 300) {
2135 ok(pv != expect_pv, "pv == expect_pv\n");
2136 if(prot_read < 300)
2137 ok(cb == 2048-prot_read, "cb=%ld\n", cb);
2138 else
2139 ok(cb == 700, "cb=%ld\n", cb);
2140 }else {
2141 ok(expect_pv <= pv && (BYTE*)pv < (BYTE*)expect_pv + cb, "pv != expect_pv\n");
2142 }
2143 }else {
2144 if(!read_report_data)
2146
2147 ok(pv == expect_pv, "pv != expect_pv\n");
2148 ok(cb == 1000, "cb=%ld\n", cb);
2149 ok(!*pcbRead, "*pcbRead = %ld\n", *pcbRead);
2150 }
2151 ok(pcbRead != NULL, "pcbRead == NULL\n");
2152
2153 if(prot_state == 3 || (short_read && prot_state != 4)) {
2154 HRESULT hres;
2155
2156 prot_state = 4;
2157 if(short_read) {
2158 SET_EXPECT(Read2); /* checked in BINDSTATUS_MIMETYPEAVAILABLE */
2159 SET_EXPECT(GetBindInfo);
2160 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
2161 }
2162 if(mimefilter_test)
2163 SET_EXPECT(MimeFilter_ReportData);
2164 else if(direct_read)
2165 SET_EXPECT(ReportData2);
2167 hres = IInternetProtocolSink_ReportData(binding_sink,
2168 BSCF_LASTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION, 0, 0);
2170 ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
2171 if(short_read) {
2172 CLEAR_CALLED(GetBindInfo); /* IE9 */
2173 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
2174 }
2175 if(mimefilter_test)
2176 CHECK_CALLED(MimeFilter_ReportData);
2177 else if(direct_read)
2178 CHECK_CALLED(ReportData2);
2179
2180 if(mimefilter_test)
2181 SET_EXPECT(MimeFilter_ReportResult);
2182 else
2183 SET_EXPECT(ReportResult);
2184 hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
2185 ok(hres == S_OK, "ReportResult failed: %08lx\n", hres);
2186 if(mimefilter_test)
2187 CHECK_CALLED(MimeFilter_ReportResult);
2188 else
2189 CHECK_CALLED(ReportResult);
2190
2191 if(cb > 100)
2192 cb = 100;
2193 memset(pv, 'x', cb);
2194 if(cb>6)
2195 memcpy(pv, "gif87a", 6);
2196 prot_read += *pcbRead = cb;
2197 return S_OK;
2198 }
2199
2200 if(prot_state == 4) {
2201 *pcbRead = 0;
2202 return S_FALSE;
2203 }
2204
2206 *pcbRead = 0;
2208 }
2209
2210 if(cb > 100)
2211 cb = 100;
2212 memset(pv, 'x', cb);
2213 if(cb>6)
2214 memcpy(pv, "gif87a", 6);
2215 prot_read += *pcbRead = cb;
2216 return S_OK;
2217}
2218
2220{
2222 ok(dwOptions == 0, "dwOptions=%lx\n", dwOptions);
2223 if(result_from_lock) {
2224 HRESULT hres;
2225 hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
2226 ok(hres == S_OK, "ReportResult failed: %08lx, expected E_FAIL\n", hres);
2227 }
2228 return S_OK;
2229}
2230
2232{
2234 return S_OK;
2235}
2236
2238 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
2239 DWORD grfPI, HANDLE *dwReserved)
2240{
2241 CHECK_EXPECT(StartEx);
2242 ok(!dwReserved, "dwReserved = %p\n", dwReserved);
2243 protocol_start(pOIProtSink, pOIBindInfo, grfPI);
2244 return S_OK;
2245}
2246
2247static const IInternetProtocolExVtbl ProtocolVtbl = {
2262};
2263
2265{
2266 return CONTAINING_RECORD(iface, Protocol, IUnknown_inner);
2267}
2268
2270{
2271 static const IID IID_undocumentedIE10 = {0x7daf9908,0x8415,0x4005,{0x95,0xae,0xbd,0x27,0xf6,0xe3,0xdc,0x00}};
2273
2275 if(winetest_debug > 1) trace("QI(IUnknown)\n");
2276 *ppv = &This->IUnknown_inner;
2277 }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
2278 if(winetest_debug > 1) trace("QI(InternetProtocol)\n");
2279 *ppv = &This->IInternetProtocolEx_iface;
2280 }else if(IsEqualGUID(&IID_IInternetProtocolEx, riid)) {
2281 if(winetest_debug > 1) trace("QI(InternetProtocolEx)\n");
2282 if(!impl_protex) {
2283 *ppv = NULL;
2284 return E_NOINTERFACE;
2285 }
2286 *ppv = &This->IInternetProtocolEx_iface;
2287 }else if(IsEqualGUID(&IID_IInternetPriority, riid)) {
2288 if(winetest_debug > 1) trace("QI(InternetPriority)\n");
2289 *ppv = &This->IInternetPriority_iface;
2290 }else if(IsEqualGUID(&IID_IWinInetInfo, riid)) {
2291 if(winetest_debug > 1) trace("QI(IWinInetInfo)\n");
2292 CHECK_EXPECT(QueryInterface_IWinInetInfo);
2293 *ppv = NULL;
2294 return E_NOINTERFACE;
2295 }else if(IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
2296 if(winetest_debug > 1) trace("QI(IWinInetHttpInfo)\n");
2297 CHECK_EXPECT(QueryInterface_IWinInetHttpInfo);
2298 *ppv = NULL;
2299 return E_NOINTERFACE;
2300 }else if(IsEqualGUID(&IID_undocumentedIE10, riid)) {
2301 if(winetest_debug > 1) trace("QI(%s)\n", wine_dbgstr_guid(riid));
2302 *ppv = NULL;
2303 return E_NOINTERFACE;
2304 }else {
2305 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
2306 *ppv = NULL;
2307 return E_NOINTERFACE;
2308 }
2309
2310 IUnknown_AddRef((IUnknown*)*ppv);
2311 return S_OK;
2312}
2313
2315{
2317 return ++This->inner_ref;
2318}
2319
2321{
2323 LONG ref = --This->inner_ref;
2324 if(!ref) {
2325 /* IE9 is broken on redirects. It will cause -1 outer_ref on original protocol handler
2326 * and 1 on redirected handler. */
2327 ok(!This->outer_ref
2328 || broken(test_redirect && (This->outer_ref == -1 || This->outer_ref == 1)),
2329 "outer_ref = %ld\n", This->outer_ref);
2330 if(This->outer_ref)
2331 trace("outer_ref %ld\n", This->outer_ref);
2332 CHECK_EXPECT(Protocol_destructor);
2333 free(This);
2334 }
2335 return ref;
2336}
2337
2338static const IUnknownVtbl ProtocolUnkVtbl = {
2342};
2343
2345{
2346 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
2347 *ppv = iface;
2348 return S_OK;
2349 }
2350
2351 if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) {
2353 return S_OK;
2354 }
2355
2356 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
2357 *ppv = NULL;
2358 return E_NOINTERFACE;
2359}
2360
2362 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
2364{
2366 LPOLESTR url_str = NULL;
2367 DWORD fetched = 0;
2368 BINDINFO bindinfo;
2369 DWORD cbindf = 0;
2370 HRESULT hres;
2371
2372 CHECK_EXPECT(MimeFilter_Start);
2373
2374 ok(!lstrcmpW(szUrl, pjpegW), "wrong url %s\n", wine_dbgstr_w(szUrl));
2375 ok(grfPI == (PI_FILTER_MODE|PI_FORCE_ASYNC), "grfPI=%lx, expected PI_FILTER_MODE|PI_FORCE_ASYNC\n", grfPI);
2376 ok(dwReserved, "dwReserved == 0\n");
2377 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
2378 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
2379
2380 if(binding_test) {
2381 ok(pOIProtSink != binding_sink, "pOIProtSink == protocol_sink\n");
2382 ok(pOIBindInfo == prot_bind_info, "pOIBindInfo != bind_info\n");
2383 }else {
2384 ok(pOIProtSink == &protocol_sink, "pOIProtSink != protocol_sink\n");
2385 ok(pOIBindInfo == &bind_info, "pOIBindInfo != bind_info\n");
2386 }
2387
2388 data = (void*)dwReserved;
2389 ok(data->cbSize == sizeof(*data), "data->cbSize = %ld\n", data->cbSize);
2390 ok(!data->pProtocolSink, "data->pProtocolSink != NULL\n");
2391 ok(data->pProtocol != NULL, "data->pProtocol == NULL\n");
2392 ok(!data->pUnk, "data->pUnk != NULL\n");
2393 ok(!data->dwFilterFlags, "data->dwProtocolFlags = %lx\n", data->dwFilterFlags);
2394 if(binding_test) {
2395 IInternetProtocolSink *prot_sink;
2396
2397 IInternetProtocol_QueryInterface(data->pProtocol, &IID_IInternetProtocolSink, (void**)&prot_sink);
2398 ok(prot_sink == pOIProtSink, "QI(data->pProtocol, IID_IInternetProtocolSink) != pOIProtSink\n");
2399 IInternetProtocolSink_Release(prot_sink);
2400
2401 ok(data->pProtocol != binding_protocol, "data->pProtocol == binding_protocol\n");
2402
2403 filtered_protocol = data->pProtocol;
2404 IInternetProtocol_AddRef(filtered_protocol);
2405 }else {
2406 IInternetProtocol *prot;
2407
2408 IInternetProtocol_QueryInterface(data->pProtocol, &IID_IInternetProtocol, (void**)&prot);
2409 ok(prot == async_protocol, "QI(data->pProtocol, IID_IInternetProtocol) != async_protocol\n");
2410 IInternetProtocol_Release(prot);
2411
2412 ok(data->pProtocol != async_protocol, "data->pProtocol == async_protocol\n");
2413 }
2414
2415 filtered_sink = pOIProtSink;
2416
2417 SET_EXPECT(ReportProgress_DECODING);
2418 hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_DECODING, pjpegW);
2419 ok(hres == S_OK, "ReportProgress(BINDSTATUS_DECODING) failed: %08lx\n", hres);
2420 CHECK_CALLED(ReportProgress_DECODING);
2421
2422 SET_EXPECT(GetBindInfo);
2423 memset(&bindinfo, 0, sizeof(bindinfo));
2424 bindinfo.cbSize = sizeof(bindinfo);
2425 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &cbindf, &bindinfo);
2426 ok(hres == S_OK, "GetBindInfo failed: %08lx\n", hres);
2427 ok(cbindf == (bindf|BINDF_FROMURLMON), "cbindf = %lx, expected %lx\n", cbindf, bindf);
2428 CHECK_CALLED(GetBindInfo);
2429
2430 SET_EXPECT(GetBindString_URL);
2431 hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_URL, &url_str, 1, &fetched);
2432 ok(hres == S_OK, "GetBindString(BINDSTRING_URL) failed: %08lx\n", hres);
2433 ok(fetched == 1, "fetched = %ld\n", fetched);
2434 ok(!lstrcmpW(url_str, binding_urls[tested_protocol]), "wrong url_str %s\n", wine_dbgstr_w(url_str));
2435 CoTaskMemFree(url_str);
2436 CHECK_CALLED(GetBindString_URL);
2437
2438 return S_OK;
2439}
2440
2442 PROTOCOLDATA *pProtocolData)
2443{
2444 CHECK_EXPECT(MimeFilter_Continue);
2445 return E_NOTIMPL;
2446}
2447
2449{
2450 HRESULT hres;
2451
2452 CHECK_EXPECT(MimeFilter_Terminate);
2453
2454 ok(!dwOptions, "dwOptions = %lx\n", dwOptions);
2455
2456 SET_EXPECT(Terminate);
2457 hres = IInternetProtocol_Terminate(filtered_protocol, dwOptions);
2458 ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
2459 CHECK_CALLED(Terminate);
2460
2461 return S_OK;
2462}
2463
2465 ULONG cb, ULONG *pcbRead)
2466{
2467 BYTE buf[2096];
2468 DWORD read = 0;
2469 HRESULT hres;
2470
2471 CHECK_EXPECT(MimeFilter_Read);
2472
2473 ok(pv != NULL, "pv == NULL\n");
2474 ok(cb != 0, "cb == 0\n");
2475 ok(pcbRead != NULL, "pcbRead == NULL\n");
2476
2478 SET_EXPECT(Read2);
2479 else
2481 hres = IInternetProtocol_Read(filtered_protocol, buf, sizeof(buf), &read);
2482 ok(hres == S_OK || hres == S_FALSE || hres == E_PENDING, "Read failed: %08lx\n", hres);
2484 CHECK_CALLED(Read2);
2485 else
2487
2488 if(pcbRead) {
2489 ok(*pcbRead == 0, "*pcbRead=%ld, expected 0\n", *pcbRead);
2490 *pcbRead = read;
2491 }
2492
2493 memset(pv, 'x', read);
2494 return hres;
2495}
2496
2498{
2499 HRESULT hres;
2500
2501 CHECK_EXPECT(MimeFilter_LockRequest);
2502
2503 ok(!dwOptions, "dwOptions = %lx\n", dwOptions);
2504
2506 hres = IInternetProtocol_LockRequest(filtered_protocol, dwOptions);
2507 ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
2509
2510 return S_OK;
2511}
2512
2514{
2515 HRESULT hres;
2516
2517 CHECK_EXPECT(MimeFilter_UnlockRequest);
2518
2520 hres = IInternetProtocol_UnlockRequest(filtered_protocol);
2521 ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
2523
2524 return S_OK;
2525}
2526
2527static const IInternetProtocolExVtbl MimeProtocolVtbl = {
2541};
2542
2544
2546{
2547 ok(0, "unexpected call\n");
2548 return E_NOINTERFACE;
2549}
2550
2552{
2553 return 2;
2554}
2555
2557{
2558 return 1;
2559}
2560
2562 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
2563 DWORD *pcchResult, DWORD dwReserved)
2564{
2565 ok(0, "unexpected call %d\n", ParseAction);
2566 return E_NOTIMPL;
2567}
2568
2570 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
2571 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
2572{
2573 ok(0, "unexpected call\n");
2574 return E_NOTIMPL;
2575}
2576
2578 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
2579{
2580 ok(0, "unexpected call\n");
2581 return E_NOTIMPL;
2582}
2583
2585 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
2586 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
2587{
2588 ok(0, "unexpected call\n");
2589 return E_NOTIMPL;
2590}
2591
2592static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
2600};
2601
2603
2605{
2606 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
2607 *ppv = &protocol_info;
2608 return S_OK;
2609 }
2610
2611 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
2612 return E_NOINTERFACE;
2613}
2614
2616{
2617 return 2;
2618}
2619
2621{
2622 return 1;
2623}
2624
2626 REFIID riid, void **ppv)
2627{
2628 Protocol *ret;
2629
2630 ok(ppv != NULL, "ppv == NULL\n");
2631
2632 if(!pOuter) {
2633 CHECK_EXPECT(CreateInstance_no_aggregation);
2634 ok(IsEqualGUID(&IID_IInternetProtocol, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
2635 }else {
2637 ok(pOuter == (IUnknown*)prot_bind_info, "pOuter != protocol_unk\n");
2638 ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
2639 if (no_aggregation) {
2640 *ppv = NULL;
2641 return CLASS_E_NOAGGREGATION;
2642 }
2643 }
2644
2645 ret = malloc(sizeof(*ret));
2646 ret->IUnknown_inner.lpVtbl = &ProtocolUnkVtbl;
2647 ret->IInternetProtocolEx_iface.lpVtbl = &ProtocolVtbl;
2648 ret->IInternetPriority_iface.lpVtbl = &InternetPriorityVtbl;
2649 ret->outer = pOuter;
2650 ret->inner_ref = 1;
2651 ret->outer_ref = 0;
2652
2654 if (!pOuter)
2655 *ppv = &ret->IInternetProtocolEx_iface;
2656 else
2657 *ppv = &ret->IUnknown_inner;
2658 return S_OK;
2659}
2660
2662{
2663 ok(0, "unexpected call\n");
2664 return S_OK;
2665}
2666
2667static const IClassFactoryVtbl ClassFactoryVtbl = {
2673};
2674
2676
2678{
2680
2681 ok(!outer, "outer = %p\n", outer);
2682 ok(IsEqualGUID(&IID_IInternetProtocol, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
2683
2684 *ppv = &MimeProtocol;
2685 return S_OK;
2686}
2687
2688static const IClassFactoryVtbl MimeFilterCFVtbl = {
2694};
2695
2697
2698#define TEST_BINDING 0x0001
2699#define TEST_FILTER 0x0002
2700#define TEST_FIRST_HTTP 0x0004
2701#define TEST_DIRECT_READ 0x0008
2702#define TEST_POST 0x0010
2703#define TEST_EMULATEPROT 0x0020
2704#define TEST_SHORT_READ 0x0040
2705#define TEST_REDIRECT 0x0080
2706#define TEST_ABORT 0x0100
2707#define TEST_ASYNCREQ 0x0200
2708#define TEST_USEIURI 0x0400
2709#define TEST_IMPLPROTEX 0x0800
2710#define TEST_EMPTY 0x1000
2711#define TEST_NOMIME 0x2000
2712#define TEST_FROMCACHE 0x4000
2713#define TEST_DISABLEAUTOREDIRECT 0x8000
2714#define TEST_RESULTFROMLOCK 0x10000
2715#define TEST_USEBINDING 0x20000
2716
2717static void register_filter(BOOL do_register)
2718{
2720 HRESULT hres;
2721
2722 hres = pCoInternetGetSession(0, &session, 0);
2723 ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
2724
2725 if(do_register) {
2726 hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, pjpegW);
2727 ok(hres == S_OK, "RegisterMimeFilter failed: %08lx\n", hres);
2728 hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, gifW);
2729 ok(hres == S_OK, "RegisterMimeFilter failed: %08lx\n", hres);
2730 }else {
2731 hres = IInternetSession_UnregisterMimeFilter(session, &mimefilter_cf, pjpegW);
2732 ok(hres == S_OK, "RegisterMimeFilter failed: %08lx\n", hres);
2733 hres = IInternetSession_UnregisterMimeFilter(session, &mimefilter_cf, gifW);
2734 ok(hres == S_OK, "RegisterMimeFilter failed: %08lx\n", hres);
2735 }
2736
2737 IInternetSession_Release(session);
2738}
2739
2740static void init_test(int prot, DWORD flags)
2741{
2742 tested_protocol = prot;
2743 binding_test = (flags & TEST_BINDING) != 0;
2745 prot_read = 0;
2746 prot_state = 0;
2749 no_mime = (flags & TEST_NOMIME) != 0;
2750 filter_state = 0;
2751 post_stream_read = 0;
2765 short_read = (flags & TEST_SHORT_READ) != 0;
2766 http_post_test = TYMED_NULL;
2768 test_abort = (flags & TEST_ABORT) != 0;
2770 empty_file = (flags & TEST_EMPTY) != 0;
2777
2778 bindinfo_options = 0;
2780 bindinfo_options |= BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS;
2781
2783}
2784
2786{
2788 LONG pr;
2789 HRESULT hres;
2790
2791 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority,
2792 (void**)&priority);
2793 ok(hres == S_OK, "QueryInterface(IID_IInternetPriority) failed: %08lx\n", hres);
2794 if(FAILED(hres))
2795 return;
2796
2797 hres = IInternetPriority_GetPriority(priority, &pr);
2798 ok(hres == S_OK, "GetPriority failed: %08lx\n", hres);
2799 ok(pr == 0, "pr=%ld, expected 0\n", pr);
2800
2801 hres = IInternetPriority_SetPriority(priority, 1);
2802 ok(hres == S_OK, "SetPriority failed: %08lx\n", hres);
2803
2804 hres = IInternetPriority_GetPriority(priority, &pr);
2805 ok(hres == S_OK, "GetPriority failed: %08lx\n", hres);
2806 ok(pr == 1, "pr=%ld, expected 1\n", pr);
2807
2808 IInternetPriority_Release(priority);
2809}
2810
2811static void test_early_abort(const CLSID *clsid)
2812{
2814 HRESULT hres;
2815
2816 hres = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2817 &IID_IInternetProtocol, (void**)&protocol);
2818 ok(hres == S_OK, "CoCreateInstance failed: %08lx\n", hres);
2819
2820 hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
2821 ok(hres == S_OK, "Abort failed: %08lx\n", hres);
2822
2823 hres = IInternetProtocol_Abort(protocol, E_FAIL, 0);
2824 ok(hres == S_OK, "Abort failed: %08lx\n", hres);
2825
2826 IInternetProtocol_Release(protocol);
2827}
2828
2830 IInternetProtocolEx *protocolex, IUri *uri, BOOL is_first)
2831{
2832 HRESULT hres;
2833
2834 SET_EXPECT(GetBindInfo);
2835 if(!(bindf & BINDF_FROMURLMON))
2836 SET_EXPECT(ReportProgress_DIRECTBIND);
2837 if(is_first) {
2838 SET_EXPECT(ReportProgress_SENDINGREQUEST);
2839 SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
2840 if(bindf & BINDF_FROMURLMON)
2841 SET_EXPECT(ReportProgress_VERIFIEDMIMETYPEAVAILABLE);
2842 else
2843 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
2844 }
2845 SET_EXPECT(ReportData);
2846 if(is_first)
2847 SET_EXPECT(ReportResult);
2848
2850
2851 if(protocolex) {
2852 hres = IInternetProtocolEx_StartEx(protocolex, uri, &protocol_sink, &bind_info, 0, 0);
2853 ok(hres == S_OK, "StartEx failed: %08lx\n", hres);
2854 }else {
2855 hres = IInternetProtocol_Start(protocol, url, &protocol_sink, &bind_info, 0, 0);
2857 win_skip("Start failed\n");
2858 return FALSE;
2859 }
2860 ok(hres == S_OK, "Start failed: %08lx\n", hres);
2861 }
2862
2863 CHECK_CALLED(GetBindInfo);
2864 if(!(bindf & BINDF_FROMURLMON))
2865 CLEAR_CALLED(ReportProgress_DIRECTBIND); /* Not called by IE10 */
2866 if(is_first) {
2867 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
2868 CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
2869 if(bindf & BINDF_FROMURLMON)
2870 CHECK_CALLED(ReportProgress_VERIFIEDMIMETYPEAVAILABLE);
2871 else
2872 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
2873 }
2874 CHECK_CALLED(ReportData);
2875 if(is_first)
2876 CHECK_CALLED(ReportResult);
2877
2878 return TRUE;
2879}
2880
2882{
2884 IUnknown *unk;
2887 BYTE buf[512];
2888 ULONG cb;
2889 HRESULT hres;
2890
2891 hres = CoGetClassObject(&CLSID_FileProtocol, CLSCTX_INPROC_SERVER, NULL,
2892 &IID_IUnknown, (void**)&unk);
2893 ok(hres == S_OK, "CoGetClassObject failed: %08lx\n", hres);
2894 if(FAILED(hres))
2895 return;
2896
2897 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
2899 "Could not get IInternetProtocolInfo interface: %08lx, expected E_NOINTERFACE\n", hres);
2900
2901 hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
2902 ok(hres == S_OK, "Could not get IClassFactory interface\n");
2903 IUnknown_Release(unk);
2904 if(FAILED(hres))
2905 return;
2906
2907 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&protocol);
2908 ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
2909
2910 if(SUCCEEDED(hres)) {
2912 hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
2913 ok(hres == S_OK, "Read failed: %08lx\n", hres);
2914 ok(cb == 2, "cb=%lu expected 2\n", cb);
2915 buf[2] = 0;
2916 ok(!memcmp(buf, file_with_hash ? "XX" : "<H", 2), "Unexpected data %s\n", buf);
2917 hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
2918 ok(hres == S_FALSE, "Read failed: %08lx\n", hres);
2919 hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
2920 ok(hres == S_FALSE, "Read failed: %08lx expected S_FALSE\n", hres);
2921 ok(cb == 0, "cb=%lu expected 0\n", cb);
2922 hres = IInternetProtocol_UnlockRequest(protocol);
2923 ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
2924 }
2925
2927 hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
2928 ok(hres == S_FALSE, "Read failed: %08lx\n", hres);
2929 hres = IInternetProtocol_LockRequest(protocol, 0);
2930 ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
2931 hres = IInternetProtocol_UnlockRequest(protocol);
2932 ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
2933 }
2934
2935 IInternetProtocol_Release(protocol);
2936 }
2937
2938 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&protocol);
2939 ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
2940 if(SUCCEEDED(hres)) {
2942 hres = IInternetProtocol_LockRequest(protocol, 0);
2943 ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
2944 hres = IInternetProtocol_Terminate(protocol, 0);
2945 ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
2946 hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
2947 ok(hres == S_OK, "Read failed: %08lx\n\n", hres);
2948 hres = IInternetProtocol_UnlockRequest(protocol);
2949 ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
2950 hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
2951 todo_wine_if(file_with_hash) /* FIXME: An effect of UnlockRequest call? */
2952 ok(hres == S_OK, "Read failed: %08lx\n", hres);
2953 hres = IInternetProtocol_Terminate(protocol, 0);
2954 ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
2955 }
2956
2957 IInternetProtocol_Release(protocol);
2958 }
2959
2960 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&protocol);
2961 ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
2962 if(SUCCEEDED(hres)) {
2964 hres = IInternetProtocol_Terminate(protocol, 0);
2965 ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
2966 hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
2967 ok(hres == S_OK, "Read failed: %08lx\n", hres);
2968 ok(cb == 2, "cb=%lu expected 2\n", cb);
2969 }
2970
2971 IInternetProtocol_Release(protocol);
2972 }
2973
2974 if(pCreateUri) {
2975 IInternetProtocolEx *protocolex;
2976 IUri *uri;
2977
2978 hres = pCreateUri(url, Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri);
2979 ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
2980
2981 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocolEx, (void**)&protocolex);
2982 ok(hres == S_OK, "Could not get IInternetProtocolEx: %08lx\n", hres);
2983
2984 if(file_protocol_start(NULL, NULL, protocolex, uri, TRUE)) {
2985 hres = IInternetProtocolEx_Read(protocolex, buf, 2, &cb);
2986 ok(hres == S_OK, "Read failed: %08lx\n", hres);
2987 hres = IInternetProtocolEx_LockRequest(protocolex, 0);
2988 ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
2989 hres = IInternetProtocolEx_UnlockRequest(protocolex);
2990 ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
2991 }
2992
2993 IUri_Release(uri);
2994 IInternetProtocolEx_Release(protocolex);
2995
2996 hres = pCreateUri(url, 0, 0, &uri);
2997 ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
2998
2999 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocolEx, (void**)&protocolex);
3000 ok(hres == S_OK, "Could not get IInternetProtocolEx: %08lx\n", hres);
3001
3002 if(file_protocol_start(NULL, NULL, protocolex, uri, TRUE)) {
3003 hres = IInternetProtocolEx_Read(protocolex, buf, 2, &cb);
3004 ok(hres == S_OK, "Read failed: %08lx\n", hres);
3005 hres = IInternetProtocolEx_LockRequest(protocolex, 0);
3006 ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
3007 hres = IInternetProtocolEx_UnlockRequest(protocolex);
3008 ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
3009 }
3010
3011 IUri_Release(uri);
3012 IInternetProtocolEx_Release(protocolex);
3013 }else {
3014 win_skip("Skipping file protocol StartEx tests\n");
3015 }
3016
3017 IClassFactory_Release(factory);
3018}
3019
3021{
3023 HRESULT hres;
3024
3025 static const WCHAR index_url2[] =
3026 {'f','i','l','e',':','/','/','i','n','d','e','x','.','h','t','m','l',0};
3027
3028 hres = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
3029 &IID_IInternetProtocol, (void**)&protocol);
3030 ok(hres == S_OK, "CoCreateInstance failed: %08lx\n", hres);
3031 if(FAILED(hres))
3032 return;
3033
3034 SET_EXPECT(GetBindInfo);
3036 hres = IInternetProtocol_Start(protocol, wszIndexHtml, &protocol_sink, &bind_info, 0, 0);
3037 ok(hres == MK_E_SYNTAX ||
3038 hres == E_INVALIDARG,
3039 "Start failed: %08lx, expected MK_E_SYNTAX or E_INVALIDARG\n", hres);
3040 CLEAR_CALLED(GetBindInfo); /* GetBindInfo not called in IE7 */
3041
3042 SET_EXPECT(GetBindInfo);
3043 if(!(bindf & BINDF_FROMURLMON))
3044 SET_EXPECT(ReportProgress_DIRECTBIND);
3045 SET_EXPECT(ReportProgress_SENDINGREQUEST);
3046 SET_EXPECT(ReportResult);
3048 hres = IInternetProtocol_Start(protocol, index_url, &protocol_sink, &bind_info, 0, 0);
3050 "Start failed: %08lx expected INET_E_RESOURCE_NOT_FOUND\n", hres);
3051 CHECK_CALLED(GetBindInfo);
3052 if(!(bindf & BINDF_FROMURLMON))
3053 CHECK_CALLED(ReportProgress_DIRECTBIND);
3054 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
3055 CHECK_CALLED(ReportResult);
3056
3057 IInternetProtocol_Release(protocol);
3058
3059 hres = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
3060 &IID_IInternetProtocol, (void**)&protocol);
3061 ok(hres == S_OK, "CoCreateInstance failed: %08lx\n", hres);
3062 if(FAILED(hres))
3063 return;
3064
3065 SET_EXPECT(GetBindInfo);
3066 if(!(bindf & BINDF_FROMURLMON))
3067 SET_EXPECT(ReportProgress_DIRECTBIND);
3068 SET_EXPECT(ReportProgress_SENDINGREQUEST);
3069 SET_EXPECT(ReportResult);
3071
3072 hres = IInternetProtocol_Start(protocol, index_url2, &protocol_sink, &bind_info, 0, 0);
3074 "Start failed: %08lx, expected INET_E_RESOURCE_NOT_FOUND\n", hres);
3075 CHECK_CALLED(GetBindInfo);
3076 if(!(bindf & BINDF_FROMURLMON))
3077 CHECK_CALLED(ReportProgress_DIRECTBIND);
3078 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
3079 CHECK_CALLED(ReportResult);
3080
3081 SET_EXPECT(GetBindInfo);
3082 hres = IInternetProtocol_Start(protocol, NULL, &protocol_sink, &bind_info, 0, 0);
3083 ok(hres == E_INVALIDARG, "Start failed: %08lx, expected E_INVALIDARG\n", hres);
3084 CLEAR_CALLED(GetBindInfo); /* GetBindInfo not called in IE7 */
3085
3086 SET_EXPECT(GetBindInfo);
3087 hres = IInternetProtocol_Start(protocol, emptyW, &protocol_sink, &bind_info, 0, 0);
3088 ok(hres == E_INVALIDARG, "Start failed: %08lx, expected E_INVALIDARG\n", hres);
3089 CLEAR_CALLED(GetBindInfo); /* GetBindInfo not called in IE7 */
3090
3091 IInternetProtocol_Release(protocol);
3092}
3093
3094static void test_file_protocol(void) {
3095 WCHAR buf[INTERNET_MAX_URL_LENGTH], file_name_buf[MAX_PATH];
3096 DWORD size;
3097 ULONG len;
3098 HANDLE file;
3099
3100 static const WCHAR wszFile[] = {'f','i','l','e',':',0};
3101 static const WCHAR wszFile2[] = {'f','i','l','e',':','/','/',0};
3102 static const WCHAR wszFile3[] = {'f','i','l','e',':','/','/','/',0};
3103 static const WCHAR wszFile4[] = {'f','i','l','e',':','\\','\\',0};
3104 static const char html_doc[] = "<HTML></HTML>";
3105 static const WCHAR fragmentW[] = {'#','f','r','a','g',0};
3106
3107 trace("Testing file protocol...\n");
3108 init_test(FILE_TEST, 0);
3109
3110 SetLastError(0xdeadbeef);
3113 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n");
3115 return;
3116 WriteFile(file, html_doc, sizeof(html_doc)-1, &size, NULL);
3118
3120 bindf = 0;
3122 bindf = BINDF_FROMURLMON;
3124 bindf = BINDF_FROMURLMON | BINDF_NEEDFILE;
3126
3127 memcpy(buf, wszFile, sizeof(wszFile));
3128 len = ARRAY_SIZE(wszFile)-1;
3130 buf[len++] = '\\';
3132
3134 bindf = 0;
3136 bindf = BINDF_FROMURLMON;
3138
3139 memcpy(buf, wszFile2, sizeof(wszFile2));
3140 len = GetCurrentDirectoryW(ARRAY_SIZE(file_name_buf), file_name_buf);
3141 file_name_buf[len++] = '\\';
3142 memcpy(file_name_buf+len, wszIndexHtml, sizeof(wszIndexHtml));
3143 lstrcpyW(buf+ARRAY_SIZE(wszFile2)-1, file_name_buf);
3144 file_name = file_name_buf;
3145 bindf = 0;
3147 bindf = BINDF_FROMURLMON;
3149
3150 buf[ARRAY_SIZE(wszFile2)] = '|';
3152
3153 memcpy(buf, wszFile3, sizeof(wszFile3));
3154 len = ARRAY_SIZE(wszFile3)-1;
3156 buf[len++] = '\\';
3158
3159 file_name = buf + ARRAY_SIZE(wszFile3)-1;
3160 bindf = 0;
3162 bindf = BINDF_FROMURLMON;
3164
3165 memcpy(buf, wszFile4, sizeof(wszFile4));
3166 len = GetCurrentDirectoryW(ARRAY_SIZE(file_name_buf), file_name_buf);
3167 file_name_buf[len++] = '\\';
3168 memcpy(file_name_buf+len, wszIndexHtml, sizeof(wszIndexHtml));
3169 lstrcpyW(buf+ARRAY_SIZE(wszFile4)-1, file_name_buf);
3170 file_name = file_name_buf;
3171 bindf = 0;
3173 bindf = BINDF_FROMURLMON;
3175
3176 buf[ARRAY_SIZE(wszFile4)] = '|';
3178
3179 /* Fragment part of URL is skipped if the file doesn't exist. */
3180 lstrcatW(buf, fragmentW);
3182
3183 /* Fragment part is considered a part of the file name, if the file exists. */
3184 len = lstrlenW(file_name_buf);
3185 lstrcpyW(file_name_buf+len, fragmentW);
3188 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n");
3189 WriteFile(file, "XXX", 3, &size, NULL);
3191 file_name_buf[len] = 0;
3192
3195
3197 DeleteFileW(file_name_buf);
3198
3199 bindf = 0;
3201 bindf = BINDF_FROMURLMON;
3203}
3204
3205static void create_cache_entry(const WCHAR *urlw)
3206{
3207 FILETIME now, tomorrow, yesterday;
3208 char file_path[MAX_PATH];
3209 BYTE content[1000];
3211 const char *url;
3212 HANDLE file;
3213 DWORD size;
3214 unsigned i;
3215 BOOL res;
3216
3217 BYTE cache_headers[] = "HTTP/1.1 200 OK\r\n\r\n";
3218
3219 trace("Testing cache read...\n");
3220
3221 url = w2a(urlw);
3222
3223 for(i = 0; i < sizeof(content); i++)
3224 content[i] = '0' + (i%10);
3225
3227 li.u.HighPart = now.dwHighDateTime;
3228 li.u.LowPart = now.dwLowDateTime;
3229 li.QuadPart += (LONGLONG)10000000 * 3600 * 24;
3230 tomorrow.dwHighDateTime = li.u.HighPart;
3231 tomorrow.dwLowDateTime = li.u.LowPart;
3232 li.QuadPart -= (LONGLONG)10000000 * 3600 * 24 * 2;
3233 yesterday.dwHighDateTime = li.u.HighPart;
3234 yesterday.dwLowDateTime = li.u.LowPart;
3235
3236 res = CreateUrlCacheEntryA(url, sizeof(content), "", file_path, 0);
3237 ok(res, "CreateUrlCacheEntryA failed: %lu\n", GetLastError());
3238
3240 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n");
3241
3242 WriteFile(file, content, sizeof(content), &size, NULL);
3244
3245 res = CommitUrlCacheEntryA(url, file_path, tomorrow, yesterday, NORMAL_CACHE_ENTRY,
3246 cache_headers, sizeof(cache_headers)-1, "", 0);
3247 ok(res, "CommitUrlCacheEntryA failed: %lu\n", GetLastError());
3248}
3249
3251{
3252 static BOOL got_user_agent = FALSE;
3253 IUri *uri = NULL;
3254 HRESULT hres;
3255
3256 if(use_iuri && pCreateUri) {
3257 hres = pCreateUri(url, 0, 0, &uri);
3258 ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
3259 }
3260
3261 SET_EXPECT(GetBindInfo);
3262 if (!(bindf & BINDF_FROMURLMON))
3263 SET_EXPECT(ReportProgress_DIRECTBIND);
3264 if(!got_user_agent)
3265 SET_EXPECT(GetBindString_USER_AGENT);
3266 SET_EXPECT(GetBindString_ROOTDOC_URL);
3267 SET_EXPECT(GetBindString_ACCEPT_MIMES);
3268 SET_EXPECT(QueryService_HttpNegotiate);
3269 SET_EXPECT(BeginningTransaction);
3270 SET_EXPECT(GetRootSecurityId);
3271 if(http_post_test) {
3272 SET_EXPECT(GetBindString_POST_COOKIE);
3273 if(http_post_test == TYMED_ISTREAM)
3275 }
3276 if(bind_from_cache) {
3277 SET_EXPECT(OnResponse);
3278 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
3279 SET_EXPECT(ReportData);
3280 }
3281
3282 if(uri) {
3283 IInternetProtocolEx *protocolex;
3284
3285 hres = IInternetProtocol_QueryInterface(async_protocol, &IID_IInternetProtocolEx, (void**)&protocolex);
3286 ok(hres == S_OK, "Could not get IInternetProtocolEx iface: %08lx\n", hres);
3287
3288 hres = IInternetProtocolEx_StartEx(protocolex, uri, &protocol_sink, &bind_info, 0, 0);
3289 ok(hres == S_OK, "Start failed: %08lx\n", hres);
3290
3291 IInternetProtocolEx_Release(protocolex);
3292 IUri_Release(uri);
3293 }else {
3294 hres = IInternetProtocol_Start(async_protocol, url, &protocol_sink, &bind_info, 0, 0);
3295 ok(hres == S_OK, "Start failed: %08lx\n", hres);
3296 }
3297 if(FAILED(hres))
3298 return FALSE;
3299
3300 CHECK_CALLED(GetBindInfo);
3301 if (!(bindf & BINDF_FROMURLMON))
3302 CHECK_CALLED(ReportProgress_DIRECTBIND);
3303 if (!got_user_agent)
3304 {
3305 CHECK_CALLED(GetBindString_USER_AGENT);
3306 got_user_agent = TRUE;
3307 }
3308 CLEAR_CALLED(GetBindString_ROOTDOC_URL); /* New in IE11 */
3309 CHECK_CALLED(GetBindString_ACCEPT_MIMES);
3310 CHECK_CALLED(QueryService_HttpNegotiate);
3311 CHECK_CALLED(BeginningTransaction);
3312 /* GetRootSecurityId called on WinXP but not on Win98 */
3313 CLEAR_CALLED(GetRootSecurityId);
3314 if(http_post_test) {
3315 CHECK_CALLED(GetBindString_POST_COOKIE);
3316 if(http_post_test == TYMED_ISTREAM)
3318 }
3319 if(bind_from_cache) {
3320 CHECK_CALLED(OnResponse);
3321 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
3322 CHECK_CALLED(ReportData);
3323 }
3324
3325 return TRUE;
3326}
3327
3329{
3330 BYTE buf[3600];
3331 DWORD cb;
3332 HRESULT hres;
3333
3334 hres = IInternetProtocol_LockRequest(protocol, 0);
3335 ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
3336
3337 hres = IInternetProtocol_Read(protocol, buf, 1, &cb);
3338 ok(hres == S_FALSE || (test_abort && hres == S_OK), /* result can come in before the abort */
3339 "Read failed: %08lx\n", hres);
3340
3341 hres = IInternetProtocol_Terminate(protocol, 0);
3342 ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
3343
3344 /* This wait is to give the internet handles being freed in Terminate
3345 * enough time to actually terminate in all cases. Internet handles
3346 * terminate asynchronously and native reuses the main InternetOpen
3347 * handle. The only case in which this seems to be necessary is on
3348 * wine with native wininet and urlmon, resulting in the next time
3349 * test_http_protocol_url being called the first data notification actually
3350 * being an extra last data notification from the previous connection
3351 * about once out of every ten times. */
3352 Sleep(100);
3353
3354 hres = IInternetProtocol_UnlockRequest(protocol);
3355 ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
3356}
3357
3358/* is_first refers to whether this is the first call to this function
3359 * _for this url_ */
3361{
3365 IUnknown *unk;
3366 HRESULT hres;
3367
3368 init_test(prot, flags);
3369 http_url = url;
3371 if(flags & TEST_FROMCACHE)
3373
3374 hres = CoGetClassObject(prot == HTTPS_TEST ? &CLSID_HttpSProtocol : &CLSID_HttpProtocol,
3375 CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
3376 ok(hres == S_OK, "CoGetClassObject failed: %08lx\n", hres);
3377 if(FAILED(hres))
3378 return;
3379
3380 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
3382 "Could not get IInternetProtocolInfo interface: %08lx, expected E_NOINTERFACE\n",
3383 hres);
3384
3385 hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
3386 ok(hres == S_OK, "Could not get IClassFactory interface\n");
3387 IUnknown_Release(unk);
3388 if(FAILED(hres))
3389 return;
3390
3391 if (flags & TEST_USEBINDING) {
3392 hres = pCoInternetGetSession(0, &session, 0);
3393 ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
3394 hres = IInternetSession_CreateBinding(session, NULL, url, NULL, NULL, &async_protocol, 0);
3395 } else
3396 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
3397 (void**)&async_protocol);
3398 ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
3399 if(SUCCEEDED(hres)) {
3400 BYTE buf[3600];
3401 DWORD cb;
3402 ULONG ref;
3403
3405
3406 if (flags & TEST_USEBINDING) {
3407 SET_EXPECT(QueryService_InternetProtocol);
3408 SET_EXPECT(ReportProgress_PROTOCOLCLASSID);
3411 SET_EXPECT(QueryService_IBindCallbackRedirect);
3412 }
3413
3414 SET_EXPECT(ReportProgress_COOKIE_SENT);
3415 if(http_is_first) {
3416 SET_EXPECT(ReportProgress_FINDINGRESOURCE);
3417 SET_EXPECT(ReportProgress_CONNECTING);
3418 }
3419 SET_EXPECT(ReportProgress_SENDINGREQUEST);
3420 if(test_redirect && !(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS)) {
3421 SET_EXPECT(ReportProgress_REDIRECTING);
3422 SET_EXPECT(GetBindString_SAMESITE_COOKIE_LEVEL); /* New in IE11 */
3423 }
3424 SET_EXPECT(ReportProgress_PROXYDETECTING);
3425 if(prot == HTTP_TEST)
3426 SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
3427 else
3428 SET_EXPECT(QueryService_HttpSecurity);
3429 if(!(bindf & BINDF_FROMURLMON)) {
3430 SET_EXPECT(OnResponse);
3431 SET_EXPECT(ReportProgress_RAWMIMETYPE);
3432 SET_EXPECT(ReportData);
3433 } else {
3434 SET_EXPECT(Switch);
3435 }
3436
3437 if(!http_protocol_start(url, (flags & TEST_USEIURI) != 0)) {
3438 IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
3439 IInternetProtocol_Release(async_protocol);
3440 return;
3441 }
3442
3443 if (flags & TEST_USEBINDING) {
3444 todo_wine CHECK_NOT_CALLED(QueryService_InternetProtocol);
3445 todo_wine CHECK_NOT_CALLED(ReportProgress_PROTOCOLCLASSID);
3447 CHECK_CALLED(QueryService_IBindCallbackRedirect);
3448 }
3449
3451 SET_EXPECT(ReportResult);
3452
3455 else if(test_abort)
3457 else
3459
3460 if(direct_read) {
3461 SET_EXPECT(Switch);
3462 while(wait_for_switch) {
3463 ok( WaitForSingleObject(event_continue, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
3464 CHECK_CALLED(Switch); /* Set in ReportData */
3467 }
3468 }else if(bind_from_cache) {
3469 BYTE buf[1500];
3470
3471 hres = IInternetProtocol_Read(async_protocol, buf, 100, &cb);
3472 ok(hres == S_OK && cb == 100, "Read failed: %08lx (%ld bytes)\n", hres, cb);
3473
3474 SET_EXPECT(ReportResult);
3475 hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
3476 ok(hres == S_OK && cb == 900, "Read failed: %08lx (%ld bytes)\n", hres, cb);
3477 CHECK_CALLED(ReportResult);
3478
3479 hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
3480 ok(hres == S_FALSE && !cb, "Read failed: %08lx (%ld bytes)\n", hres, cb);
3481 }else {
3482 hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
3483 ok((hres == E_PENDING && cb==0) ||
3484 (hres == S_OK && cb==1), "Read failed: %08lx (%ld bytes)\n", hres, cb);
3485
3486 ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
3487 if(bindf & BINDF_FROMURLMON)
3488 CHECK_CALLED(Switch);
3489 else
3490 CHECK_CALLED(ReportData);
3491 if(prot == HTTPS_TEST)
3492 CLEAR_CALLED(QueryService_HttpSecurity);
3493
3494 while(1) {
3495 if(bindf & BINDF_FROMURLMON)
3496 SET_EXPECT(Switch);
3497 else
3498 SET_EXPECT(ReportData);
3499 hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
3500 if(hres == E_PENDING) {
3501 hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
3502 ok((hres == E_PENDING && cb==0) ||
3503 (hres == S_OK && cb==1), "Read failed: %08lx (%ld bytes)\n", hres, cb);
3504#ifdef __REACTOS__
3506 {
3507 trace("wait timed out\n");
3508 break;
3509 }
3510#else
3511 ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
3512#endif
3513 if(bindf & BINDF_FROMURLMON)
3514 CHECK_CALLED(Switch);
3515 else
3516 CHECK_CALLED(ReportData);
3517
3518 if(test_abort) {
3519 HRESULT hres;
3520
3521 SET_EXPECT(ReportResult);
3522 hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
3523 ok(hres == S_OK, "Abort failed: %08lx\n", hres);
3524 CHECK_CALLED(ReportResult);
3525
3526 hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
3527 ok(hres == INET_E_RESULT_DISPATCHED || hres == S_OK /* IE10 */, "Abort failed: %08lx\n", hres);
3528 break;
3529 }
3530 }else {
3531 if(bindf & BINDF_FROMURLMON)
3532 CHECK_NOT_CALLED(Switch);
3533 else
3534 CHECK_NOT_CALLED(ReportData);
3535 if(cb == 0) break;
3536 }
3537 }
3538 if(!test_abort) {
3539 ok(hres == S_FALSE, "Read failed: %08lx\n", hres);
3540 CHECK_CALLED(ReportResult);
3541 }
3542 }
3543 if(prot == HTTPS_TEST)
3544 CLEAR_CALLED(ReportProgress_SENDINGREQUEST);
3545
3546 if (prot == HTTP_TEST || prot == HTTPS_TEST)
3547 CLEAR_CALLED(ReportProgress_COOKIE_SENT);
3548
3549 hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
3550 ok(hres == INET_E_RESULT_DISPATCHED || hres == S_OK /* IE10 */, "Abort failed: %08lx\n", hres);
3551
3553
3554 hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
3555 ok(hres == S_OK, "Abort failed: %08lx\n", hres);
3556
3557 ref = IInternetProtocol_Release(async_protocol);
3558 ok(!ref, "ref=%lx\n", ref);
3559 }
3560
3561 IClassFactory_Release(factory);
3562
3563 if(flags & TEST_FROMCACHE) {
3564 BOOL res;
3565
3567 ok(res, "DeleteUrlCacheEntryA failed: %lu\n", GetLastError());
3568 }
3569}
3570
3571static void test_http_protocol(void)
3572{
3573 static const WCHAR posttest_url[] =
3574 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3575 't','e','s','t','s','/','p','o','s','t','.','p','h','p',0};
3576 static const WCHAR redirect_url[] =
3577 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3578 't','e','s','t','s','/','r','e','d','i','r','e','c','t',0};
3579 static const WCHAR winetest_url[] =
3580 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3581 't','e','s','t','s','/','d','a','t','a','.','p','h','p',0};
3582 static const WCHAR empty_url[] =
3583 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3584 't','e','s','t','s','/','e','m','p','t','y','.','j','s',0};
3585 static const WCHAR cache_only_url[] =
3586 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3587 't','e','s','t','s','/','c','a','c','h','e','-','o','n','l','y',0};
3588
3589
3590 trace("Testing http protocol (not from urlmon)...\n");
3591 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
3592 test_http_protocol_url(winetest_url, HTTP_TEST, TEST_FIRST_HTTP, TYMED_NULL);
3593
3594 trace("Testing http protocol (from urlmon)...\n");
3595 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
3596 test_http_protocol_url(winetest_url, HTTP_TEST, 0, TYMED_NULL);
3597
3598 trace("Testing http protocol (to file)...\n");
3599 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NEEDFILE;
3600 test_http_protocol_url(winetest_url, HTTP_TEST, 0, TYMED_NULL);
3601
3602 trace("Testing http protocol (post data)...\n");
3603 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
3604 test_http_protocol_url(posttest_url, HTTP_TEST, TEST_FIRST_HTTP|TEST_POST, TYMED_HGLOBAL);
3605
3606 trace("Testing http protocol (post data stream)...\n");
3608
3609 trace("Testing http protocol (direct read)...\n");
3610 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
3612
3613 trace("Testing http protocol (redirected)...\n");
3614 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3615 test_http_protocol_url(redirect_url, HTTP_TEST, TEST_REDIRECT, TYMED_NULL);
3616
3617 trace("Testing http protocol (redirected, disable auto redirect)...\n");
3618 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3620
3621 trace("Testing http protocol empty file...\n");
3622 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3623 test_http_protocol_url(empty_url, HTTP_TEST, TEST_EMPTY, TYMED_NULL);
3624
3625 trace("Testing http protocol (redirected, binding)...\n");
3626 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3628
3629 /* This is a bit ugly. We unconditionally disable this test on Wine. This won't work until we have
3630 * support for reading from cache via HTTP layer in wininet. Until then, Wine will fail badly, affecting
3631 * other, unrelated, tests. Working around it is not worth the trouble, we may simply make sure those
3632 * tests work on Windows and have them around for the future.
3633 */
3634 if(broken(1)) {
3635 trace("Testing http protocol (from cache)...\n");
3636 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
3637 test_http_protocol_url(cache_only_url, HTTP_TEST, TEST_FROMCACHE, TYMED_NULL);
3638 }
3639
3640 trace("Testing http protocol abort...\n");
3641 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3642 test_http_protocol_url(winetest_url, HTTP_TEST, TEST_ABORT, TYMED_NULL);
3643
3644 test_early_abort(&CLSID_HttpProtocol);
3645 test_early_abort(&CLSID_HttpSProtocol);
3646}
3647
3648static void test_https_protocol(void)
3649{
3650 static const WCHAR https_winehq_url[] =
3651 {'h','t','t','p','s',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3652 't','e','s','t','s','/','h','e','l','l','o','.','h','t','m','l',0};
3653
3654 trace("Testing https protocol (from urlmon)...\n");
3655 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3656 test_http_protocol_url(https_winehq_url, HTTPS_TEST, TEST_FIRST_HTTP, TYMED_NULL);
3657}
3658
3659
3660static void test_ftp_protocol(void)
3661{
3664 IUnknown *unk;
3665 BYTE buf[4096];
3666 ULONG ref;
3667 DWORD cb, ret;
3668 HRESULT hres;
3669
3670 static const WCHAR ftp_urlW[] = {'f','t','p',':','/','/','f','t','p','.','w','i','n','e','h','q','.','o','r','g',
3671 '/','p','u','b','/','o','t','h','e','r','/',
3672 'w','i','n','e','l','o','g','o','.','x','c','f','.','t','a','r','.','b','z','2',0};
3673
3674 trace("Testing ftp protocol...\n");
3675
3676 init_test(FTP_TEST, 0);
3677
3678 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3681
3682 hres = CoGetClassObject(&CLSID_FtpProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
3683 ok(hres == S_OK, "CoGetClassObject failed: %08lx\n", hres);
3684 if(FAILED(hres))
3685 return;
3686
3687 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
3688 ok(hres == E_NOINTERFACE, "Could not get IInternetProtocolInfo interface: %08lx, expected E_NOINTERFACE\n", hres);
3689
3690 hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
3691 ok(hres == S_OK, "Could not get IClassFactory interface\n");
3692 IUnknown_Release(unk);
3693 if(FAILED(hres))
3694 return;
3695
3696 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
3697 (void**)&async_protocol);
3698 IClassFactory_Release(factory);
3699 ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
3700
3702
3703 SET_EXPECT(GetBindInfo);
3704 SET_EXPECT(ReportProgress_FINDINGRESOURCE);
3705 SET_EXPECT(ReportProgress_CONNECTING);
3706 SET_EXPECT(ReportProgress_SENDINGREQUEST);
3707 SET_EXPECT(Switch);
3708
3709 hres = IInternetProtocol_Start(async_protocol, ftp_urlW, &protocol_sink, &bind_info, 0, 0);
3710 ok(hres == S_OK, "Start failed: %08lx\n", hres);
3711 CHECK_CALLED(GetBindInfo);
3712
3713 SET_EXPECT(ReportResult);
3714
3715 hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
3716 ok((hres == E_PENDING && cb==0) ||
3717 (hres == S_OK && cb==1), "Read failed: %08lx (%ld bytes)\n", hres, cb);
3718
3720 if (ret != WAIT_OBJECT_0)
3721 {
3722 skip( "FTP protocol timed out\n" );
3723 IInternetProtocol_Release(async_protocol);
3724 return;
3725 }
3726
3727 while(1) {
3728 hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
3729 if(hres == E_PENDING)
3730 {
3732 ok( ret == WAIT_OBJECT_0, "wait timed out\n" );
3733 if (ret != WAIT_OBJECT_0) break;
3734 }
3735 else
3736 if(cb == 0) break;
3737 }
3738
3739 ok(hres == S_FALSE, "Read failed: %08lx\n", hres);
3740 CHECK_CALLED(ReportResult);
3741 CHECK_CALLED(Switch);
3742
3744
3745 if(pCreateUri) {
3746 IInternetProtocolEx *protocolex;
3747
3748 hres = IInternetProtocol_QueryInterface(async_protocol, &IID_IInternetProtocolEx, (void**)&protocolex);
3749 ok(hres == S_OK, "Could not get IInternetProtocolEx iface: %08lx\n", hres);
3750 IInternetProtocolEx_Release(protocolex);
3751 }
3752
3753 ref = IInternetProtocol_Release(async_protocol);
3754 ok(!ref, "ref=%ld\n", ref);
3755
3756 test_early_abort(&CLSID_FtpProtocol);
3757}
3758
3759static void test_gopher_protocol(void)
3760{
3763 IUnknown *unk;
3764 HRESULT hres;
3765
3766 trace("Testing gopher protocol...\n");
3767
3768 hres = CoGetClassObject(&CLSID_GopherProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
3769 ok(hres == S_OK ||
3770 broken(hres == REGDB_E_CLASSNOTREG || hres == CLASS_E_CLASSNOTAVAILABLE), /* Gopher protocol has been removed as of Vista */
3771 "CoGetClassObject failed: %08lx\n", hres);
3772 if(FAILED(hres))
3773 return;
3774
3775 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
3776 ok(hres == E_NOINTERFACE, "Could not get IInternetProtocolInfo interface: %08lx, expected E_NOINTERFACE\n", hres);
3777
3778 hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
3779 ok(hres == S_OK, "Could not get IClassFactory interface\n");
3780 IUnknown_Release(unk);
3781 if(FAILED(hres))
3782 return;
3783
3784 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
3785 (void**)&async_protocol);
3786 IClassFactory_Release(factory);
3787 ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
3788
3790
3791 IInternetProtocol_Release(async_protocol);
3792
3793 test_early_abort(&CLSID_GopherProtocol);
3794}
3795
3796static void test_mk_protocol(void)
3797{
3801 IUnknown *unk;
3802 HRESULT hres;
3803
3804 static const WCHAR wrong_url1[] = {'t','e','s','t',':','@','M','S','I','T','S','t','o','r','e',
3805 ':',':','/','t','e','s','t','.','h','t','m','l',0};
3806 static const WCHAR wrong_url2[] = {'m','k',':','/','t','e','s','t','.','h','t','m','l',0};
3807
3808 trace("Testing mk protocol...\n");
3809 init_test(MK_TEST, 0);
3810
3811 hres = CoGetClassObject(&CLSID_MkProtocol, CLSCTX_INPROC_SERVER, NULL,
3812 &IID_IUnknown, (void**)&unk);
3813 ok(hres == S_OK, "CoGetClassObject failed: %08lx\n", hres);
3814
3815 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
3817 "Could not get IInternetProtocolInfo interface: %08lx, expected E_NOINTERFACE\n",
3818 hres);
3819
3820 hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
3821 ok(hres == S_OK, "Could not get IClassFactory interface\n");
3822 IUnknown_Release(unk);
3823 if(FAILED(hres))
3824 return;
3825
3826 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
3827 (void**)&protocol);
3828 IClassFactory_Release(factory);
3829 ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
3830
3831 SET_EXPECT(GetBindInfo);
3832 hres = IInternetProtocol_Start(protocol, wrong_url1, &protocol_sink, &bind_info, 0, 0);
3834 "Start failed: %08lx, expected MK_E_SYNTAX or INET_E_INVALID_URL\n", hres);
3835 CLEAR_CALLED(GetBindInfo);
3836
3837 SET_EXPECT(GetBindInfo);
3838 SET_EXPECT(ReportProgress_DIRECTBIND);
3839 SET_EXPECT(ReportProgress_SENDINGREQUEST);
3840 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
3841 SET_EXPECT(ReportResult);
3843
3844 hres = IInternetProtocol_Start(protocol, wrong_url2, &protocol_sink, &bind_info, 0, 0);
3846 hres == INET_E_INVALID_URL, /* win2k3 */
3847 "Start failed: %08lx, expected INET_E_RESOURCE_NOT_FOUND or INET_E_INVALID_URL\n", hres);
3848
3850 CHECK_CALLED(GetBindInfo);
3851 CLEAR_CALLED(ReportProgress_DIRECTBIND);
3852 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
3853 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
3854 CHECK_CALLED(ReportResult);
3855 }else {
3856 CLEAR_CALLED(GetBindInfo);
3857 CLEAR_CALLED(ReportProgress_DIRECTBIND);
3858 CLEAR_CALLED(ReportProgress_SENDINGREQUEST);
3859 CLEAR_CALLED(ReportProgress_MIMETYPEAVAILABLE);
3860 CLEAR_CALLED(ReportResult);
3861 }
3862
3863 IInternetProtocol_Release(protocol);
3864}
3865
3866static void test_CreateBinding(void)
3867{
3871 IWinInetHttpInfo *http_info;
3872 IWinInetInfo *inet_info;
3873 LONG p;
3874 BYTE buf[1000];
3875 DWORD read;
3876 HRESULT hres;
3877
3878 static const WCHAR test_url[] =
3879 {'t','e','s','t',':','/','/','f','i','l','e','.','h','t','m','l',0};
3880 static const WCHAR wsz_test[] = {'t','e','s','t',0};
3881
3882 trace("Testing CreateBinding%s...\n", no_aggregation ? "(no aggregation)" : "");
3884
3885 hres = pCoInternetGetSession(0, &session, 0);
3886 ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
3887
3888 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL, wsz_test, 0, NULL, 0);
3889 ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
3890
3891 hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0);
3893 ok(hres == S_OK, "CreateBinding failed: %08lx\n", hres);
3894 ok(protocol != NULL, "protocol == NULL\n");
3895
3896 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetBindInfo, (void**)&prot_bind_info);
3897 ok(hres == S_OK, "QueryInterface(IID_IInternetBindInfo) failed: %08lx\n", hres);
3898
3899 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolSink, (void**)&binding_sink);
3900 ok(hres == S_OK, "Could not get IInternetProtocolSink: %08lx\n", hres);
3901
3902 hres = IInternetProtocol_Start(protocol, test_url, NULL, &bind_info, 0, 0);
3903 ok(hres == E_INVALIDARG, "Start failed: %08lx, expected E_INVALIDARG\n", hres);
3904 hres = IInternetProtocol_Start(protocol, test_url, &protocol_sink, NULL, 0, 0);
3905 ok(hres == E_INVALIDARG, "Start failed: %08lx, expected E_INVALIDARG\n", hres);
3906 hres = IInternetProtocol_Start(protocol, NULL, &protocol_sink, &bind_info, 0, 0);
3907 ok(hres == E_INVALIDARG, "Start failed: %08lx, expected E_INVALIDARG\n", hres);
3908
3909 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority, (void**)&priority);
3910 ok(hres == S_OK, "QueryInterface(IID_IInternetPriority) failed: %08lx\n", hres);
3911
3912 p = 0xdeadbeef;
3913 hres = IInternetPriority_GetPriority(priority, &p);
3914 ok(hres == S_OK, "GetPriority failed: %08lx\n", hres);
3915 ok(!p, "p=%ld\n", p);
3916
3917 ex_priority = 100;
3918 hres = IInternetPriority_SetPriority(priority, 100);
3919 ok(hres == S_OK, "SetPriority failed: %08lx\n", hres);
3920
3921 p = 0xdeadbeef;
3922 hres = IInternetPriority_GetPriority(priority, &p);
3923 ok(hres == S_OK, "GetPriority failed: %08lx\n", hres);
3924 ok(p == 100, "p=%ld\n", p);
3925
3926 hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
3927 ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08lx\n", hres);
3928
3929 SET_EXPECT(QueryService_InternetProtocol);
3930
3932 if(no_aggregation) {
3933 SET_EXPECT(CreateInstance_no_aggregation);
3934 SET_EXPECT(StartEx);
3935 }else {
3937 }
3938
3939 SET_EXPECT(ReportProgress_PROTOCOLCLASSID);
3941
3942 ok(obj_refcount(protocol) == 4, "wrong protocol refcount %ld\n", obj_refcount(protocol));
3943
3945 hres = IInternetProtocol_Start(protocol, test_url, &protocol_sink, &bind_info, 0, 0);
3946 ok(hres == S_OK, "Start failed: %08lx\n", hres);
3947
3948 CHECK_CALLED(QueryService_InternetProtocol);
3949
3951 if(no_aggregation) {
3952 CHECK_CALLED(CreateInstance_no_aggregation);
3953 ok(obj_refcount(protocol) == 4, "wrong protocol refcount %ld\n", obj_refcount(protocol));
3954 ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %lu\n", protocol_emul->outer_ref);
3955 }else {
3956 ok(obj_refcount(protocol) == 5 || broken(obj_refcount(protocol) == 4) /* before win7 */, "wrong protocol refcount %ld\n",
3958 ok(protocol_emul->outer_ref == 1 || broken(protocol_emul->outer_ref == 0) /* before win7 */, "protocol_outer_ref = %lu\n",
3960 }
3961
3962 CHECK_CALLED(ReportProgress_PROTOCOLCLASSID);
3964 if(no_aggregation)
3965 CHECK_CALLED(StartEx);
3966 else
3968
3969 if(!no_aggregation)
3970 SET_EXPECT(QueryInterface_IWinInetInfo);
3971 hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
3972 ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08lx\n", hres);
3973 if(!no_aggregation)
3974 CHECK_CALLED(QueryInterface_IWinInetInfo);
3975
3976 if(!no_aggregation)
3977 SET_EXPECT(QueryInterface_IWinInetInfo);
3978 hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
3979 ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08lx\n", hres);
3980 if(!no_aggregation)
3981 CHECK_CALLED(QueryInterface_IWinInetInfo);
3982
3983 if(!no_aggregation)
3984 SET_EXPECT(QueryInterface_IWinInetHttpInfo);
3985 hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&http_info);
3986 ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08lx\n", hres);
3987 if(!no_aggregation)
3988 CHECK_CALLED(QueryInterface_IWinInetHttpInfo);
3989
3991 read = 0xdeadbeef;
3992 hres = IInternetProtocol_Read(protocol, expect_pv = buf, sizeof(buf), &read);
3993 ok(hres == S_OK, "Read failed: %08lx\n", hres);
3994 ok(read == 100, "read = %ld\n", read);
3996
3998 read = 0xdeadbeef;
3999 hres = IInternetProtocol_Read(protocol, expect_pv = buf, sizeof(buf), &read);
4000 ok(hres == S_FALSE, "Read failed: %08lx\n", hres);
4001 ok(!read, "read = %ld\n", read);
4003
4004 p = 0xdeadbeef;
4005 hres = IInternetPriority_GetPriority(priority, &p);
4006 ok(hres == S_OK, "GetPriority failed: %08lx\n", hres);
4007 ok(p == 100, "p=%ld\n", p);
4008
4009 hres = IInternetPriority_SetPriority(priority, 101);
4010 ok(hres == S_OK, "SetPriority failed: %08lx\n", hres);
4011
4012 if(no_aggregation) {
4013 ok(obj_refcount(protocol) == 4, "wrong protocol refcount %ld\n", obj_refcount(protocol));
4014 ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %lu\n", protocol_emul->outer_ref);
4015 }else {
4016 ok(obj_refcount(protocol) == 5 || broken(obj_refcount(protocol) == 4) /* before win7 */, "wrong protocol refcount %ld\n", obj_refcount(protocol));
4017 ok(protocol_emul->outer_ref == 1 || broken(protocol_emul->outer_ref == 0) /* before win7 */, "protocol_outer_ref = %lu\n", protocol_emul->outer_ref);
4018 }
4019
4020 SET_EXPECT(Terminate);
4021 hres = IInternetProtocol_Terminate(protocol, 0xdeadbeef);
4022 ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
4023 CHECK_CALLED(Terminate);
4024
4025 ok(obj_refcount(protocol) == 4, "wrong protocol refcount %ld\n", obj_refcount(protocol));
4026 ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %lu\n", protocol_emul->outer_ref);
4027
4028 SET_EXPECT(Continue);
4029 hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
4030 ok(hres == S_OK, "Switch failed: %08lx\n", hres);
4031 CHECK_CALLED(Continue);
4032
4034 read = 0xdeadbeef;
4035 hres = IInternetProtocol_Read(protocol, expect_pv = buf, sizeof(buf), &read);
4036 if(no_aggregation) {
4037 ok(hres == S_OK, "Read failed: %08lx\n", hres);
4038 ok(read == 100, "read = %ld\n", read);
4040 }else {
4041 todo_wine
4042 ok(hres == E_ABORT, "Read failed: %08lx\n", hres);
4043 todo_wine
4044 ok(read == 0, "read = %ld\n", read);
4045 todo_wine
4047 }
4048
4049 hres = IInternetProtocolSink_ReportProgress(binding_sink,
4050 BINDSTATUS_CACHEFILENAMEAVAILABLE, expect_wsz = emptyW);
4051 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08lx\n", hres);
4052
4053 hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
4054 ok(hres == E_FAIL, "ReportResult failed: %08lx, expected E_FAIL\n", hres);
4055
4056 hres = IInternetProtocolSink_ReportData(binding_sink, 0, 0, 0);
4057 ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
4058
4059 IInternetProtocolSink_Release(binding_sink);
4060 IInternetPriority_Release(priority);
4061 IInternetBindInfo_Release(prot_bind_info);
4062
4063 ok(obj_refcount(protocol) == 1, "wrong protocol refcount %ld\n", obj_refcount(protocol));
4064
4065 SET_EXPECT(Protocol_destructor);
4066 IInternetProtocol_Release(protocol);
4067 CHECK_CALLED(Protocol_destructor);
4068
4069 hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0);
4070 ok(hres == S_OK, "CreateBinding failed: %08lx\n", hres);
4071 ok(protocol != NULL, "protocol == NULL\n");
4072
4073 hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
4074 ok(hres == S_OK, "Abort failed: %08lx\n", hres);
4075
4076 hres = IInternetProtocol_Abort(protocol, E_FAIL, 0);
4077 ok(hres == S_OK, "Abort failed: %08lx\n", hres);
4078
4079 IInternetProtocol_Release(protocol);
4080
4081 hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, wsz_test);
4082 ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
4083
4084 hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0);
4085 ok(hres == S_OK, "CreateBinding failed: %08lx\n", hres);
4086 ok(protocol != NULL, "protocol == NULL\n");
4087
4088 SET_EXPECT(QueryService_InternetProtocol);
4089 hres = IInternetProtocol_Start(protocol, test_url, &protocol_sink, &bind_info, 0, 0);
4090 ok(hres == MK_E_SYNTAX, "Start failed: %08lx, expected MK_E_SYNTAX\n", hres);
4091 CHECK_CALLED(QueryService_InternetProtocol);
4092
4093 IInternetProtocol_Release(protocol);
4094
4095 IInternetSession_Release(session);
4096}
4097
4098static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
4099{
4100 IInternetProtocolEx *protocolex = NULL;
4103 IUri *uri = NULL;
4104 ULONG ref;
4105 HRESULT hres;
4106
4107 pi = grf_pi;
4108
4109 init_test(prot, test_flags|TEST_BINDING);
4110
4111 hres = pCoInternetGetSession(0, &session, 0);
4112 ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
4113
4114 if(test_flags & TEST_EMULATEPROT) {
4115 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL, protocol_names[prot], 0, NULL, 0);
4116 ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
4117 }
4118
4119 hres = IInternetSession_CreateBinding(session, NULL, binding_urls[prot], NULL, NULL, &protocol, 0);
4121 ok(hres == S_OK, "CreateBinding failed: %08lx\n", hres);
4122 ok(protocol != NULL, "protocol == NULL\n");
4123
4124 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetBindInfo, (void**)&prot_bind_info);
4125 ok(hres == S_OK, "QueryInterface(IID_IInternetBindInfo) failed: %08lx\n", hres);
4126
4127 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolSink, (void**)&binding_sink);
4128 ok(hres == S_OK, "QueryInterface(IID_IInternetProtocolSink) failed: %08lx\n", hres);
4129
4130 if(test_flags & TEST_USEIURI) {
4131 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolEx, (void**)&protocolex);
4132 ok(hres == S_OK, "Could not get IInternetProtocolEx iface: %08lx\n", hres);
4133
4134 hres = pCreateUri(binding_urls[prot], Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri);
4135 ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
4136 }
4137
4138 ex_priority = 0;
4139 SET_EXPECT(QueryService_InternetProtocol);
4141 SET_EXPECT(ReportProgress_PROTOCOLCLASSID);
4143 if(impl_protex)
4144 SET_EXPECT(StartEx);
4145 else
4147
4149
4150 if(protocolex) {
4151 hres = IInternetProtocolEx_StartEx(protocolex, uri, &protocol_sink, &bind_info, pi, 0);
4152 ok(hres == S_OK, "StartEx failed: %08lx\n", hres);
4153 }else {
4154 hres = IInternetProtocol_Start(protocol, binding_urls[prot], &protocol_sink, &bind_info, pi, 0);
4155 ok(hres == S_OK, "Start failed: %08lx\n", hres);
4156 }
4157
4158 CHECK_CALLED(QueryService_InternetProtocol);
4160 CHECK_CALLED(ReportProgress_PROTOCOLCLASSID);
4161 CLEAR_CALLED(SetPriority); /* IE11 does not call it. */
4162 if(impl_protex)
4163 CHECK_CALLED(StartEx);
4164 else
4166
4167 if(protocolex)
4168 IInternetProtocolEx_Release(protocolex);
4169 if(uri)
4170 IUri_Release(uri);
4171
4172 if(prot == HTTP_TEST || prot == HTTPS_TEST) {
4173 while(prot_state < 4) {
4174 ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
4176 SET_EXPECT(Continue);
4177 IInternetProtocol_Continue(filtered_protocol, pdata);
4178 CHECK_CALLED(Continue);
4179 }else {
4180 SET_EXPECT(Continue);
4181 IInternetProtocol_Continue(protocol, pdata);
4182 CHECK_CALLED(Continue);
4183 }
4184 if(test_abort && prot_state == 2) {
4185 SET_EXPECT(Abort);
4186 hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
4187 ok(hres == S_OK, "Abort failed: %08lx\n", hres);
4188 CHECK_CALLED(Abort);
4189
4190 hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
4191 ok(hres == S_OK, "Abort failed: %08lx\n", hres);
4193 break;
4194 }
4196 }
4197 if(direct_read)
4198 CHECK_CALLED(ReportData); /* Set in ReportResult */
4199 ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
4200 }else {
4201 if(!result_from_lock) {
4202 if(mimefilter_test)
4203 SET_EXPECT(MimeFilter_LockRequest);
4204 else
4206 hres = IInternetProtocol_LockRequest(protocol, 0);
4207 ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
4208 if(mimefilter_test)
4209 CHECK_CALLED(MimeFilter_LockRequest);
4210 else
4212 }
4213
4214 if(mimefilter_test)
4215 SET_EXPECT(MimeFilter_UnlockRequest);
4216 else
4218 hres = IInternetProtocol_UnlockRequest(protocol);
4219 ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
4220 if(mimefilter_test)
4221 CHECK_CALLED(MimeFilter_UnlockRequest);
4222 else
4224 }
4225
4226 if(mimefilter_test)
4227 SET_EXPECT(MimeFilter_Terminate);
4228 else
4229 SET_EXPECT(Terminate);
4230 hres = IInternetProtocol_Terminate(protocol, 0);
4231 ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
4232 if(mimefilter_test)
4233 CLEAR_CALLED(MimeFilter_Terminate);
4234 else
4235 CHECK_CALLED(Terminate);
4236
4238 IInternetProtocol_Release(filtered_protocol);
4239 IInternetBindInfo_Release(prot_bind_info);
4240 IInternetProtocolSink_Release(binding_sink);
4241
4242 SET_EXPECT(Protocol_destructor);
4243 ref = IInternetProtocol_Release(protocol);
4244 ok(!ref, "ref=%lu, expected 0\n", ref);
4245 CHECK_CALLED(Protocol_destructor);
4246
4247 if(test_flags & TEST_EMULATEPROT) {
4248 hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, protocol_names[prot]);
4249 ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
4250 }
4251
4252 IInternetSession_Release(session);
4253}
4254
4255static const IID outer_test_iid = {0xabcabc00,0,0,{0,0,0,0,0,0,0,0x66}};
4256
4258{
4260 CHECK_EXPECT(outer_QI_test);
4261 *ppv = (IUnknown*)0xdeadbeef;
4262 return S_OK;
4263 }
4264 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
4265 return E_NOINTERFACE;
4266}
4267
4269{
4270 return 2;
4271}
4272
4274{
4275 return 1;
4276}
4277
4278static const IUnknownVtbl outer_vtbl = {
4282};
4283
4285{
4286 IUnknown outer = { &outer_vtbl };
4288 IUnknown *unk, *unk2, *unk3;
4289 HRESULT hres;
4290
4291 hres = CoGetClassObject(clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&class_factory);
4292 ok(hres == S_OK, "CoGetClassObject failed: %08lx\n", hres);
4293
4294 hres = IClassFactory_CreateInstance(class_factory, &outer, &IID_IUnknown, (void**)&unk);
4295 ok(hres == S_OK, "CreateInstance returned: %08lx\n", hres);
4296
4297 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocol, (void**)&unk2);
4298 ok(hres == S_OK, "Could not get IDispatch iface: %08lx\n", hres);
4299
4300 SET_EXPECT(outer_QI_test);
4301 hres = IUnknown_QueryInterface(unk2, &outer_test_iid, (void**)&unk3);
4302 CHECK_CALLED(outer_QI_test);
4303 ok(hres == S_OK, "Could not get IInternetProtocol iface: %08lx\n", hres);
4304 ok(unk3 == (IUnknown*)0xdeadbeef, "unexpected unk2\n");
4305
4306 IUnknown_Release(unk2);
4307 IUnknown_Release(unk);
4308
4309 unk = (void*)0xdeadbeef;
4310 hres = IClassFactory_CreateInstance(class_factory, &outer, &IID_IInternetProtocol, (void**)&unk);
4311 ok(hres == CLASS_E_NOAGGREGATION, "CreateInstance returned: %08lx\n", hres);
4312 ok(!unk, "unk = %p\n", unk);
4313
4314 IClassFactory_Release(class_factory);
4315}
4316
4318{
4319 HMODULE hurlmon;
4320
4321 hurlmon = GetModuleHandleA("urlmon.dll");
4322 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
4323 pReleaseBindInfo = (void*) GetProcAddress(hurlmon, "ReleaseBindInfo");
4324 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
4325
4326 if(!GetProcAddress(hurlmon, "CompareSecurityIds")) {
4327 win_skip("Various needed functions not present, too old IE\n");
4328 return;
4329 }
4330
4331 if(!pCreateUri)
4332 win_skip("CreateUri not supported\n");
4333
4335
4341
4344#ifdef __REACTOS__
4346 {
4347 win_skip("Skipping test that runs forever on Windows Vista\n");
4348 }
4349 else
4350 {
4351#endif
4352 if(pCreateUri)
4354 else
4355 win_skip("Skipping https tests on too old platform\n");
4356#ifdef __REACTOS__
4357 }
4358#endif
4366
4367 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_NOWRITECACHE | BINDF_PULLDATA;
4368 trace("Testing file binding (mime verification, emulate prot)...\n");
4369 test_binding(FILE_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT);
4370 trace("Testing http binding (mime verification, emulate prot)...\n");
4371 test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT);
4372 trace("Testing its binding (mime verification, emulate prot)...\n");
4373 test_binding(ITS_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT);
4374 trace("Testing http binding (mime verification, emulate prot, short read, direct read)...\n");
4376 trace("Testing http binding (mime verification, redirect, emulate prot)...\n");
4378 trace("Testing http binding (mime verification, redirect, disable auto redirect, emulate prot)...\n");
4380 trace("Testing file binding (mime verification, emulate prot, mime filter)...\n");
4381 test_binding(FILE_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_FILTER);
4382 trace("Testing http binding (mime verification, emulate prot, mime filter)...\n");
4383 test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_FILTER);
4384 trace("Testing http binding (mime verification, emulate prot, mime filter, no mime)...\n");
4386 trace("Testing http binding (mime verification, emulate prot, direct read)...\n");
4388 trace("Testing http binding (mime verification, emulate prot, abort)...\n");
4389 test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_ABORT);
4390 trace("Testing its binding (mime verification, emulate prot, apartment thread)...\n");
4391 test_binding(ITS_TEST, PI_MIMEVERIFICATION | PI_APARTMENTTHREADED, TEST_EMULATEPROT | TEST_RESULTFROMLOCK);
4392 if(pCreateUri) {
4393 trace("Testing file binding (use IUri, mime verification, emulate prot)...\n");
4394 test_binding(FILE_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_USEIURI);
4395 trace("Testing file binding (use IUri, impl StartEx, mime verification, emulate prot)...\n");
4397 trace("Testing file binding (impl StartEx, mime verification, emulate prot)...\n");
4399 }
4400
4405
4406 test_com_aggregation(&CLSID_FileProtocol);
4407 test_com_aggregation(&CLSID_HttpProtocol);
4408 test_com_aggregation(&CLSID_HttpSProtocol);
4409 test_com_aggregation(&CLSID_FtpProtocol);
4410 test_com_aggregation(&CLSID_MkProtocol);
4411
4413}
static _Out_opt_ PULONGLONG Start
#define read
Definition: acwin.h:97
#define GetNTVersion()
Definition: apitest.h:17
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ARRAY_SIZE(A)
Definition: main.h:20
unsigned long HANDLE_PTR
Definition: basetsd.h:72
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define ERROR_SUCCESS
Definition: deptool.c:10
#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
content
Definition: atl_ax.c:994
INT WINAPI StringFromGUID2(REFGUID guid, LPOLESTR str, INT cmax)
Definition: combase.c:1525
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD clscontext, COSERVERINFO *server_info, REFIID riid, void **obj)
Definition: combase.c:1925
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define CloseHandle
Definition: compat.h:739
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define CP_ACP
Definition: compat.h:109
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
short VARIANT_BOOL
Definition: compat.h:2290
#define lstrlenW
Definition: compat.h:750
static MimeHtmlProtocol * impl_from_IUnknown(IUnknown *iface)
Definition: protocol.c:351
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
Definition: rw.c:25
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
Definition: protocol.c:113
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: protocol.c:107
static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
Definition: protocol.c:83
static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface, LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: protocol.c:72
static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
Definition: protocol.c:60
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: protocol.c:95
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: protocol.c:101
static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
Definition: protocol.c:66
static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface, REFIID riid, void **ppv)
Definition: protocol.c:35
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:162
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:218
BOOL WINAPI CreateUrlCacheEntryA(LPCSTR lpszUrlName, DWORD dwExpectedFileSize, LPCSTR lpszFileExtension, LPSTR lpszFileName, DWORD dwReserved)
Definition: urlcache.c:2796
BOOL WINAPI CommitUrlCacheEntryA(LPCSTR lpszUrlName, LPCSTR lpszLocalFileName, FILETIME ExpireTime, FILETIME LastModifiedTime, DWORD CacheEntryType, LPBYTE lpHeaderInfo, DWORD dwHeaderSize, LPCSTR lpszFileExtension, LPCSTR lpszOriginalUrl)
Definition: urlcache.c:3063
BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
Definition: urlcache.c:3344
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
PVOID LockRequest(PIRP Irp, PIO_STACK_LOCATION IrpSp, BOOLEAN Output, KPROCESSOR_MODE *LockMode)
Definition: lock.c:24
VOID UnlockRequest(PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: lock.c:180
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
time_t now
Definition: finger.c:65
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint res
Definition: glext.h:9613
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
@ SetPriority
Definition: halhw.h:216
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
static CInternetFolder * CreateInstance(void)
Definition: inetfolder.c:330
static TfClientId tid
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define wine_dbgstr_w
Definition: kernel32.h:34
#define is_reactos()
Definition: kmt_test.h:534
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
int winetest_debug
#define win_skip
Definition: minitest.h:67
#define todo_wine_if(is_todo)
Definition: minitest.h:81
#define todo_wine
Definition: minitest.h:80
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CREATE_ALWAYS
Definition: disk.h:72
static const WCHAR url[]
Definition: encode.c:1384
static IInternetProtocolSink protocol_sink
Definition: mimeole.c:1384
static IInternetBindInfo bind_info
Definition: mimeole.c:1246
#define SET_EXPECT(func)
Definition: protocol.c:37
static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: protocol.c:147
static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
Definition: protocol.c:141
static const IUnknownVtbl outer_vtbl
Definition: protocol.c:690
static ULONG WINAPI BindInfo_Release(IInternetBindInfo *iface)
Definition: protocol.c:250
static IInternetBindInfoVtbl bind_info_vtbl
Definition: protocol.c:276
static IInternetProtocolSinkVtbl protocol_sink_vtbl
Definition: protocol.c:222
static ULONG WINAPI outer_AddRef(IUnknown *iface)
Definition: protocol.c:680
HRESULT hres
Definition: protocol.c:465
#define CHECK_EXPECT(func)
Definition: protocol.c:40
static ULONG WINAPI ProtocolSink_Release(IInternetProtocolSink *iface)
Definition: protocol.c:136
#define DEFINE_EXPECT(func)
Definition: protocol.c:34
static const IID outer_test_iid
Definition: protocol.c:667
static HRESULT WINAPI BindInfo_QueryInterface(IInternetBindInfo *iface, REFIID riid, void **ppv)
Definition: protocol.c:236
static HRESULT WINAPI BindInfo_GetBindInfo(IInternetBindInfo *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
Definition: protocol.c:255
static HRESULT WINAPI ProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv)
Definition: protocol.c:122
static void test_mk_protocol(void)
Definition: protocol.c:614
#define protocol_start(p, u, e)
Definition: protocol.c:303
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: protocol.c:669
static HRESULT expect_hrResult
Definition: protocol.c:68
static void test_com_aggregation(const CLSID *clsid)
Definition: protocol.c:696
#define CHECK_CALLED(func)
Definition: protocol.c:50
static DWORD bindf
Definition: protocol.c:70
static HRESULT WINAPI ProtocolSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
Definition: protocol.c:210
static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
Definition: protocol.c:185
static HRESULT WINAPI BindInfo_GetBindString(IInternetBindInfo *iface, ULONG ulStringType, LPOLESTR *ppwzStr, ULONG cEl, ULONG *pcElFetched)
Definition: protocol.c:269
static ULONG WINAPI BindInfo_AddRef(IInternetBindInfo *iface)
Definition: protocol.c:245
static ULONG WINAPI ProtocolSink_AddRef(IInternetProtocolSink *iface)
Definition: protocol.c:131
static ULONG WINAPI outer_Release(IUnknown *iface)
Definition: protocol.c:685
static BOOL report_mime
Definition: htmldoc.c:202
IHTMLDocument2 * html_doc
Definition: xmlview.c:53
static IUnknown * outer
Definition: compobj.c:82
static IInternetProtocolInfo protocol_info
Definition: misc.c:929
static PARSEACTION
Definition: misc.c:71
static const WCHAR wszFile[]
Definition: misc.c:301
static QUERYOPTION
Definition: misc.c:72
#define TEST_USEBINDING
Definition: protocol.c:2715
static void test_file_protocol(void)
Definition: protocol.c:3094
static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
Definition: protocol.c:445
static void test_protocol_terminate(IInternetProtocol *protocol)
Definition: protocol.c:3328
#define TEST_REDIRECT
Definition: protocol.c:2705
static const WCHAR pjpegW[]
Definition: protocol.c:145
#define TEST_FIRST_HTTP
Definition: protocol.c:2700
static LPCWSTR expect_wsz
Definition: protocol.c:152
static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData)
Definition: protocol.c:1967
static ULONG WINAPI Stream_AddRef(IStream *iface)
Definition: protocol.c:508
#define CLEAR_CALLED(func)
Definition: protocol.c:68
static void test_file_protocol_fail(void)
Definition: protocol.c:3020
static const CHAR post_data[]
Definition: protocol.c:222
static const WCHAR protocol_names[][10]
Definition: protocol.c:198
#define TEST_ASYNCREQ
Definition: protocol.c:2707
static HRESULT WINAPI InternetPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv)
Definition: protocol.c:1545
static ULONG WINAPI ProtocolUnk_AddRef(IUnknown *iface)
Definition: protocol.c:2314
#define TEST_FROMCACHE
Definition: protocol.c:2712
static void register_filter(BOOL do_register)
Definition: protocol.c:2717
static PROTOCOLDATA protocoldata
Definition: protocol.c:163
static HRESULT WINAPI ProtocolEmul_UnlockRequest(IInternetProtocolEx *iface)
Definition: protocol.c:2231
static HRESULT WINAPI MimeProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
Definition: protocol.c:2361
static HRESULT WINAPI MimeProtocol_Read(IInternetProtocolEx *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: protocol.c:2464
static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
Definition: protocol.c:440
static BOOL test_async_req
Definition: protocol.c:165
static BOOL async_read_pending
Definition: protocol.c:166
static HRESULT WINAPI HttpNegotiate_OnResponse(IHttpNegotiate2 *iface, DWORD dwResponseCode, LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders)
Definition: protocol.c:349
static HRESULT WINAPI MimeProtocol_LockRequest(IInternetProtocolEx *iface, DWORD dwOptions)
Definition: protocol.c:2497
static ULONG WINAPI Protocol_AddRef(IInternetProtocolEx *iface)
Definition: protocol.c:1596
static const IInternetProtocolExVtbl MimeProtocolVtbl
Definition: protocol.c:2527
static HRESULT WINAPI InternetPriority_SetPriority(IInternetPriority *iface, LONG nPriority)
Definition: protocol.c:1574
static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tymed)
Definition: protocol.c:3360
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
Definition: protocol.c:2625
static HRESULT WINAPI HttpSecurity_QueryInterface(IHttpSecurity *iface, REFIID riid, void **ppv)
Definition: protocol.c:237
static BOOL wait_for_switch
Definition: protocol.c:166
static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
Definition: protocol.c:558
static void test_http_protocol(void)
Definition: protocol.c:3571
static HRESULT WINAPI Protocol_Abort(IInternetProtocolEx *iface, HRESULT hrReason, DWORD dwOptions)
Definition: protocol.c:1606
static BOOL bind_from_cache
Definition: protocol.c:167
static IInternetProtocolEx MimeProtocol
Definition: protocol.c:2543
static HRESULT WINAPI InternetPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority)
Definition: protocol.c:1581
static void create_cache_entry(const WCHAR *urlw)
Definition: protocol.c:3205
static IInternetProtocol * binding_protocol
Definition: protocol.c:157
static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface, LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
Definition: protocol.c:2584
static const IClassFactoryVtbl ClassFactoryVtbl
Definition: protocol.c:2667
static HRESULT WINAPI Stream_Revert(IStream *iface)
Definition: protocol.c:577
static ULONG WINAPI InternetPriority_Release(IInternetPriority *iface)
Definition: protocol.c:1563
static IHttpSecurity http_security
Definition: protocol.c:292
static ULONG WINAPI HttpNegotiate_Release(IHttpNegotiate2 *iface)
Definition: protocol.c:312
static const WCHAR binding_urls[][130]
Definition: protocol.c:208
static BOOL emulate_prot
Definition: protocol.c:166
static const WCHAR text_htmlW[]
Definition: protocol.c:141
static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg, DWORD dwStatFlag)
Definition: protocol.c:597
@ FTP_TEST
Definition: protocol.c:181
@ FILE_TEST
Definition: protocol.c:178
@ HTTPS_TEST
Definition: protocol.c:180
@ HTTP_TEST
Definition: protocol.c:179
@ MK_TEST
Definition: protocol.c:182
@ ITS_TEST
Definition: protocol.c:183
@ BIND_TEST
Definition: protocol.c:184
static HRESULT WINAPI HttpSecurity_GetWindow(IHttpSecurity *iface, REFGUID rguidReason, HWND *phwnd)
Definition: protocol.c:259
static HRESULT WINAPI ProtocolUnk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: protocol.c:2269
static HRESULT WINAPI MimeProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
Definition: protocol.c:2344
static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
Definition: protocol.c:564
static IClassFactory mimefilter_cf
Definition: protocol.c:2696
static HRESULT QueryInterface(REFIID, void **)
Definition: protocol.c:1376
static const char * w2a(LPCWSTR str)
Definition: protocol.c:230
static const IBindCallbackRedirectVtbl BindCallbackRedirectVtbl
Definition: protocol.c:419
static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
Definition: protocol.c:4098
static HRESULT WINAPI ProtocolEmul_LockRequest(IInternetProtocolEx *iface, DWORD dwOptions)
Definition: protocol.c:2219
static int post_stream_read
Definition: protocol.c:155
static const WCHAR acc_mimeW[]
Definition: protocol.c:139
static IStream Stream
Definition: protocol.c:627
static void call_continue(PROTOCOLDATA *protocol_data)
Definition: protocol.c:644
static HANDLE event_continue_done
Definition: protocol.c:161
static BOOL no_aggregation
Definition: protocol.c:168
static DWORD filter_state
Definition: protocol.c:164
static IInternetBindInfo * prot_bind_info
Definition: protocol.c:158
#define TEST_BINDING
Definition: protocol.c:2698
static void test_file_protocol_url(LPCWSTR url)
Definition: protocol.c:2881
enum @1896 state
static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
Definition: protocol.c:583
static IHttpNegotiate2 http_negotiate
Definition: protocol.c:393
#define TEST_EMPTY
Definition: protocol.c:2710
static BOOL file_with_hash
Definition: protocol.c:167
#define TEST_SHORT_READ
Definition: protocol.c:2704
static DWORD_PTR
Definition: protocol.c:34
static IServiceProvider service_provider
Definition: protocol.c:495
static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
Definition: protocol.c:497
static const IClassFactoryVtbl MimeFilterCFVtbl
Definition: protocol.c:2688
static const WCHAR wszIndexHtml[]
Definition: protocol.c:135
static IBindCallbackRedirect redirect_callback
Definition: protocol.c:426
static const WCHAR hostW[]
Definition: protocol.c:142
static HANDLE event_continue
Definition: protocol.c:161
static DWORD pi
Definition: protocol.c:156
static IInternetProtocolSink mime_protocol_sink
Definition: protocol.c:1374
static IInternetProtocol * async_protocol
Definition: protocol.c:153
#define TEST_RESULTFROMLOCK
Definition: protocol.c:2714
static IHttpNegotiate2Vtbl HttpNegotiateVtbl
Definition: protocol.c:384
static BOOL redirect_on_continue
Definition: protocol.c:154
static ULONG WINAPI HttpSecurity_Release(IHttpSecurity *iface)
Definition: protocol.c:254
static HRESULT WINAPI ProtocolEmul_StartEx(IInternetProtocolEx *iface, IUri *pUri, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE *dwReserved)
Definition: protocol.c:2237
static WCHAR protocol_clsid[CHARS_IN_GUID]
Definition: protocol.c:149
static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
Definition: protocol.c:604
static BOOL test_abort
Definition: protocol.c:166
static HRESULT WINAPI BindCallbackRedirect_QueryInterface(IBindCallbackRedirect *iface, REFIID riid, void **ppv)
Definition: protocol.c:395
static IHttpSecurityVtbl HttpSecurityVtbl
Definition: protocol.c:284
static HRESULT WINAPI ProtocolEmul_Terminate(IInternetProtocolEx *iface, DWORD dwOptions)
Definition: protocol.c:2114
#define TEST_POST
Definition: protocol.c:2702
static BOOL result_from_lock
Definition: protocol.c:168
static BOOL impl_protex
Definition: protocol.c:165
static HRESULT WINAPI HttpSecurity_OnSecurityProblem(IHttpSecurity *iface, DWORD dwProblem)
Definition: protocol.c:266
static DWORD http_post_test
Definition: protocol.c:164
static DWORD WINAPI thread_proc(PVOID arg)
Definition: protocol.c:1692
static void test_CreateBinding(void)
Definition: protocol.c:3866
static BOOL direct_read
Definition: protocol.c:166
static ULONG WINAPI BindCallbackRedirect_Release(IBindCallbackRedirect *iface)
Definition: protocol.c:407
static PROTOCOLDATA continue_protdata
Definition: protocol.c:163
static PROTOCOLDATA * pdata
Definition: protocol.c:163
static LPCWSTR file_name
Definition: protocol.c:152
static HRESULT WINAPI HttpNegotiate_GetRootSecurityId(IHttpNegotiate2 *iface, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
Definition: protocol.c:362
#define TEST_EMULATEPROT
Definition: protocol.c:2703
static HRESULT WINAPI Stream_UnlockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
Definition: protocol.c:590
static HRESULT WINAPI Protocol_Resume(IInternetProtocolEx *iface)
Definition: protocol.c:1627
static void test_ftp_protocol(void)
Definition: protocol.c:3660
#define CHARS_IN_GUID
Definition: protocol.c:36
#define CHECK_EXPECT2(func)
Definition: protocol.c:44
static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate2 *iface, LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
Definition: protocol.c:317
static BOOL no_mime
Definition: protocol.c:167
static ULONG WINAPI BindCallbackRedirect_AddRef(IBindCallbackRedirect *iface)
Definition: protocol.c:402
static BOOL http_protocol_start(LPCWSTR url, BOOL use_iuri)
Definition: protocol.c:3250
#define TEST_DISABLEAUTOREDIRECT
Definition: protocol.c:2713
static ULONG WINAPI ProtocolUnk_Release(IUnknown *iface)
Definition: protocol.c:2320
static HRESULT WINAPI MimeFilter_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
Definition: protocol.c:2677
static void * expect_pv
Definition: protocol.c:160
static BOOL empty_file
Definition: protocol.c:167
static const WCHAR emptyW[]
Definition: protocol.c:144
static int read_report_data
Definition: protocol.c:155
static DWORD prot_read
Definition: protocol.c:164
#define TEST_NOMIME
Definition: protocol.c:2711
static BOOL http_is_first
Definition: protocol.c:154
static ULONG WINAPI Protocol_Release(IInternetProtocolEx *iface)
Definition: protocol.c:1601
static void test_early_abort(const CLSID *clsid)
Definition: protocol.c:2811
static ULONG WINAPI MimeProtocolSink_AddRef(IInternetProtocolSink *iface)
Definition: protocol.c:1242
static HRESULT WINAPI ProtocolEmul_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
Definition: protocol.c:1645
static HRESULT WINAPI MimeProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
Definition: protocol.c:1252
static DWORD bindinfo_options
Definition: protocol.c:156
static const IUnknownVtbl ProtocolUnkVtbl
Definition: protocol.c:2338
static DWORD ex_priority
Definition: protocol.c:156
static void test_https_protocol(void)
Definition: protocol.c:3648
#define TEST_DIRECT_READ
Definition: protocol.c:2701
static BOOL first_data_notif
Definition: protocol.c:154
static const WCHAR winehq_ipW[]
Definition: protocol.c:143
static void test_gopher_protocol(void)
Definition: protocol.c:3759
static BOOL reuse_protocol_thread
Definition: protocol.c:167
static BOOL binding_test
Definition: protocol.c:162
static const IInternetProtocolExVtbl ProtocolVtbl
Definition: protocol.c:2247
static BOOL security_problem
Definition: protocol.c:165
static const WCHAR user_agentW[]
Definition: protocol.c:140
static ULONG WINAPI HttpNegotiate_AddRef(IHttpNegotiate2 *iface)
Definition: protocol.c:307
static Protocol * protocol_emul
Definition: protocol.c:196
static const char * status_names[]
Definition: protocol.c:769
static BOOL short_read
Definition: protocol.c:166
static ULONG WINAPI Stream_Release(IStream *iface)
Definition: protocol.c:513
static int prot_state
Definition: protocol.c:155
static const IStreamVtbl StreamVtbl
Definition: protocol.c:610
static void test_http_info(IInternetProtocol *protocol)
Definition: protocol.c:966
static HRESULT WINAPI Protocol_Suspend(IInternetProtocolEx *iface)
Definition: protocol.c:1621
static ULONG WINAPI ProtocolEmul_AddRef(IInternetProtocolEx *iface)
Definition: protocol.c:1670
static BOOL mimefilter_test
Definition: protocol.c:166
static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
Definition: protocol.c:571
static const IInternetPriorityVtbl InternetPriorityVtbl
Definition: protocol.c:1588
static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
Definition: protocol.c:546
static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv, ULONG cb, ULONG *pcbWritten)
Definition: protocol.c:539
static HRESULT WINAPI MimeProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
Definition: protocol.c:1286
#define TEST_IMPLPROTEX
Definition: protocol.c:2709
static HANDLE event_complete
Definition: protocol.c:161
@ STATE_SENDINGREQUEST
Definition: protocol.c:172
@ STATE_CONNECTING
Definition: protocol.c:171
@ STATE_DOWNLOADING
Definition: protocol.c:174
@ STATE_STARTDOWNLOADING
Definition: protocol.c:173
static enum @1897 tested_protocol
static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: protocol.c:2561
static HRESULT WINAPI HttpNegotiate_QueryInterface(IHttpNegotiate2 *iface, REFIID riid, void **ppv)
Definition: protocol.c:294
static HRESULT WINAPI Stream_Read(IStream *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: protocol.c:518
static HRESULT WINAPI MimeProtocolSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
Definition: protocol.c:1345
static ULONG WINAPI InternetPriority_AddRef(IInternetPriority *iface)
Definition: protocol.c:1552
static HRESULT WINAPI Protocol_Seek(IInternetProtocolEx *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
Definition: protocol.c:1633
static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
Definition: protocol.c:430
static HRESULT WINAPI Protocol_Continue(IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData)
Definition: protocol.c:2441
static ULONG WINAPI MimeProtocolSink_Release(IInternetProtocolSink *iface)
Definition: protocol.c:1247
static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
Definition: protocol.c:435
#define CHECK_NOT_CALLED(func)
Definition: protocol.c:62
static const IServiceProviderVtbl ServiceProviderVtbl
Definition: protocol.c:488
static BOOL file_protocol_start(IInternetProtocol *protocol, LPCWSTR url, IInternetProtocolEx *protocolex, IUri *uri, BOOL is_first)
Definition: protocol.c:2829
#define TEST_FILTER
Definition: protocol.c:2699
static Protocol * impl_from_IInternetProtocolEx(IInternetProtocolEx *iface)
Definition: protocol.c:1640
#define TEST_ABORT
Definition: protocol.c:2706
static const WCHAR gifW[]
Definition: protocol.c:146
static IInternetProtocolSink * binding_sink
Definition: protocol.c:159
static BOOL test_redirect
Definition: protocol.c:154
static const WCHAR index_url[]
Definition: protocol.c:136
static HRESULT WINAPI ProtocolEmul_Read(IInternetProtocolEx *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: protocol.c:2121
static Protocol * impl_from_IInternetPriority(IInternetPriority *iface)
Definition: protocol.c:1540
static ULONG WINAPI ProtocolEmul_Release(IInternetProtocolEx *iface)
Definition: protocol.c:1681
static HRESULT WINAPI ProtocolEmul_Start(IInternetProtocolEx *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
Definition: protocol.c:1956
static LPCWSTR http_url
Definition: protocol.c:152
static HRESULT WINAPI MimeProtocolSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: protocol.c:1266
#define TEST_USEIURI
Definition: protocol.c:2708
static HRESULT WINAPI MimeProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv)
Definition: protocol.c:1230
static HANDLE event_complete2
Definition: protocol.c:161
static HRESULT WINAPI MimeProtocol_Terminate(IInternetProtocolEx *iface, DWORD dwOptions)
Definition: protocol.c:2448
static HRESULT WINAPI BindCallbackRedirect_Redirect(IBindCallbackRedirect *iface, const WCHAR *url, VARIANT_BOOL *cancel)
Definition: protocol.c:412
static ULONG WINAPI HttpSecurity_AddRef(IHttpSecurity *iface)
Definition: protocol.c:249
static IInternetProtocolSink * filtered_sink
Definition: protocol.c:159
static HRESULT WINAPI MimeProtocol_UnlockRequest(IInternetProtocolEx *iface)
Definition: protocol.c:2513
static LONG obj_refcount(void *obj)
Definition: protocol.c:224
static IInternetProtocolSinkVtbl mime_protocol_sink_vtbl
Definition: protocol.c:1364
static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl
Definition: protocol.c:2592
static DWORD thread_id
Definition: protocol.c:164
static IInternetProtocol * filtered_protocol
Definition: protocol.c:157
static const WCHAR null_guid[]
Definition: protocol.c:147
const WCHAR * uri
Definition: sec_mgr.c:1564
static DWORD tymed
Definition: url.c:172
static const char test_url[]
Definition: urlcache.c:37
static void test_priority(void)
Definition: timer.c:174
static int priority
Definition: timer.c:163
const CLSID * clsid
Definition: msctf.cpp:50
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
#define DWORD
Definition: nt_native.h:44
#define GENERIC_WRITE
Definition: nt_native.h:90
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
char CHAR
Definition: pedump.c:57
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define IID_NULL
Definition: guiddef.h:98
PVOID pBuffer
const WCHAR * str
strcpy
Definition: string.h:131
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:171
#define memset(x, y, z)
Definition: compat.h:39
#define _WIN32_WINNT_WIN7
Definition: sdkddkver.h:28
static void init_test(void)
Definition: shlexec.c:2649
TCHAR file_path[MAX_PATH]
Definition: sndrec32.cpp:57
DWORD dwOptions
Definition: solitaire.cpp:25
_In_ BOOLEAN Read
Definition: strmini.h:479
IUnknown IUnknown_inner
Definition: protocol.c:188
LONG outer_ref
Definition: protocol.c:193
IInternetPriority IInternetPriority_iface
Definition: protocol.c:190
IInternetProtocolEx IInternetProtocolEx_iface
Definition: protocol.c:189
LONG inner_ref
Definition: protocol.c:192
IUnknown * outer
Definition: protocol.c:191
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65
Definition: scsiwmi.h:51
Definition: main.c:439
Definition: fci.c:127
Definition: send.c:48
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:726
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:669
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:650
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint32_t DWORD_PTR
Definition: typedefs.h:65
uint16_t * LPWSTR
Definition: typedefs.h:56
int64_t LONGLONG
Definition: typedefs.h:68
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
struct _LARGE_INTEGER::@2524 u
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
#define GPTR
Definition: winbase.h:320
#define WAIT_OBJECT_0
Definition: winbase.h:383
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:3801
#define S_FALSE
Definition: winerror.h:3451
#define RPC_E_RETRY
Definition: winerror.h:3557
#define E_NOINTERFACE
Definition: winerror.h:3479
#define INET_E_INVALID_URL
Definition: winerror.h:4652
#define MK_E_SYNTAX
Definition: winerror.h:3896
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771
#define INET_E_RESOURCE_NOT_FOUND
Definition: winerror.h:4655
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:3772
#define INET_E_REDIRECT_FAILED
Definition: winerror.h:4667
#define E_ABORT
Definition: winerror.h:3481
#define INTERNET_MAX_URL_LENGTH
Definition: wininet.h:51
#define ERROR_INTERNET_INVALID_CA
Definition: wininet.h:2033
#define NORMAL_CACHE_ENTRY
Definition: wininet.h:2087
#define HTTP_QUERY_CUSTOM
Definition: wininet.h:1603
#define ERROR_INTERNET_SEC_CERT_REV_FAILED
Definition: wininet.h:2044
unsigned char BYTE
Definition: xxhash.c:193