ReactOS 0.4.17-dev-470-gf9e3448
protocol.c File Reference
#include <wine/test.h>
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "ole2.h"
#include "urlmon.h"
#include "wininet.h"
Include dependency graph for protocol.c:

Go to the source code of this file.

Classes

struct  Protocol
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define CHARS_IN_GUID   39
 
#define DEFINE_EXPECT(func)    static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
 
#define SET_EXPECT(func)    expect_ ## func = TRUE
 
#define CHECK_EXPECT2(func)
 
#define CHECK_EXPECT(func)
 
#define CHECK_CALLED(func)
 
#define CHECK_NOT_CALLED(func)
 
#define CLEAR_CALLED(func)    expect_ ## func = called_ ## func = FALSE
 
#define TEST_BINDING   0x0001
 
#define TEST_FILTER   0x0002
 
#define TEST_FIRST_HTTP   0x0004
 
#define TEST_DIRECT_READ   0x0008
 
#define TEST_POST   0x0010
 
#define TEST_EMULATEPROT   0x0020
 
#define TEST_SHORT_READ   0x0040
 
#define TEST_REDIRECT   0x0080
 
#define TEST_ABORT   0x0100
 
#define TEST_ASYNCREQ   0x0200
 
#define TEST_USEIURI   0x0400
 
#define TEST_IMPLPROTEX   0x0800
 
#define TEST_EMPTY   0x1000
 
#define TEST_NOMIME   0x2000
 
#define TEST_FROMCACHE   0x4000
 
#define TEST_DISABLEAUTOREDIRECT   0x8000
 
#define TEST_RESULTFROMLOCK   0x10000
 
#define TEST_USEBINDING   0x20000
 

Enumerations

enum  { STATE_CONNECTING , STATE_SENDINGREQUEST , STATE_STARTDOWNLOADING , STATE_DOWNLOADING }
 
enum  {
  FILE_TEST , HTTP_TEST , HTTPS_TEST , FTP_TEST ,
  MK_TEST , ITS_TEST , BIND_TEST
}
 

Functions

static HRESULT (WINAPI *pCoInternetGetSession)(DWORD
 
 DEFINE_EXPECT (GetBindInfo)
 
 DEFINE_EXPECT (ReportProgress_MIMETYPEAVAILABLE)
 
 DEFINE_EXPECT (ReportProgress_DIRECTBIND)
 
 DEFINE_EXPECT (ReportProgress_RAWMIMETYPE)
 
 DEFINE_EXPECT (ReportProgress_FINDINGRESOURCE)
 
 DEFINE_EXPECT (ReportProgress_CONNECTING)
 
 DEFINE_EXPECT (ReportProgress_SENDINGREQUEST)
 
 DEFINE_EXPECT (ReportProgress_CACHEFILENAMEAVAILABLE)
 
 DEFINE_EXPECT (ReportProgress_VERIFIEDMIMETYPEAVAILABLE)
 
 DEFINE_EXPECT (ReportProgress_PROTOCOLCLASSID)
 
 DEFINE_EXPECT (ReportProgress_COOKIE_SENT)
 
 DEFINE_EXPECT (ReportProgress_REDIRECTING)
 
 DEFINE_EXPECT (ReportProgress_ENCODING)
 
 DEFINE_EXPECT (ReportProgress_ACCEPTRANGES)
 
 DEFINE_EXPECT (ReportProgress_PROXYDETECTING)
 
 DEFINE_EXPECT (ReportProgress_LOADINGMIMEHANDLER)
 
 DEFINE_EXPECT (ReportProgress_DECODING)
 
 DEFINE_EXPECT (ReportData)
 
 DEFINE_EXPECT (ReportData2)
 
 DEFINE_EXPECT (ReportResult)
 
 DEFINE_EXPECT (GetBindString_ACCEPT_MIMES)
 
 DEFINE_EXPECT (GetBindString_USER_AGENT)
 
 DEFINE_EXPECT (GetBindString_POST_COOKIE)
 
 DEFINE_EXPECT (GetBindString_URL)
 
 DEFINE_EXPECT (GetBindString_ROOTDOC_URL)
 
 DEFINE_EXPECT (GetBindString_SAMESITE_COOKIE_LEVEL)
 
 DEFINE_EXPECT (QueryService_HttpNegotiate)
 
 DEFINE_EXPECT (QueryService_InternetProtocol)
 
 DEFINE_EXPECT (QueryService_HttpSecurity)
 
 DEFINE_EXPECT (QueryService_IBindCallbackRedirect)
 
 DEFINE_EXPECT (QueryInterface_IWinInetInfo)
 
 DEFINE_EXPECT (QueryInterface_IWinInetHttpInfo)
 
 DEFINE_EXPECT (BeginningTransaction)
 
 DEFINE_EXPECT (GetRootSecurityId)
 
 DEFINE_EXPECT (OnResponse)
 
 DEFINE_EXPECT (Switch)
 
 DEFINE_EXPECT (Continue)
 
 DEFINE_EXPECT (CreateInstance)
 
 DEFINE_EXPECT (CreateInstance_no_aggregation)
 
 DEFINE_EXPECT (Start)
 
 DEFINE_EXPECT (StartEx)
 
 DEFINE_EXPECT (Terminate)
 
 DEFINE_EXPECT (Read)
 
 DEFINE_EXPECT (Read2)
 
 DEFINE_EXPECT (SetPriority)
 
 DEFINE_EXPECT (LockRequest)
 
 DEFINE_EXPECT (UnlockRequest)
 
 DEFINE_EXPECT (Abort)
 
 DEFINE_EXPECT (MimeFilter_CreateInstance)
 
 DEFINE_EXPECT (MimeFilter_Start)
 
 DEFINE_EXPECT (MimeFilter_ReportData)
 
 DEFINE_EXPECT (MimeFilter_ReportResult)
 
 DEFINE_EXPECT (MimeFilter_Terminate)
 
 DEFINE_EXPECT (MimeFilter_LockRequest)
 
 DEFINE_EXPECT (MimeFilter_UnlockRequest)
 
 DEFINE_EXPECT (MimeFilter_Read)
 
 DEFINE_EXPECT (MimeFilter_Switch)
 
 DEFINE_EXPECT (MimeFilter_Continue)
 
 DEFINE_EXPECT (Stream_Seek)
 
 DEFINE_EXPECT (Stream_Read)
 
 DEFINE_EXPECT (Redirect)
 
 DEFINE_EXPECT (outer_QI_test)
 
 DEFINE_EXPECT (Protocol_destructor)
 
static LONG obj_refcount (void *obj)
 
static const charw2a (LPCWSTR str)
 
static HRESULT WINAPI HttpSecurity_QueryInterface (IHttpSecurity *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI HttpSecurity_AddRef (IHttpSecurity *iface)
 
static ULONG WINAPI HttpSecurity_Release (IHttpSecurity *iface)
 
static HRESULT WINAPI HttpSecurity_GetWindow (IHttpSecurity *iface, REFGUID rguidReason, HWND *phwnd)
 
static HRESULT WINAPI HttpSecurity_OnSecurityProblem (IHttpSecurity *iface, DWORD dwProblem)
 
static HRESULT WINAPI HttpNegotiate_QueryInterface (IHttpNegotiate2 *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI HttpNegotiate_AddRef (IHttpNegotiate2 *iface)
 
static ULONG WINAPI HttpNegotiate_Release (IHttpNegotiate2 *iface)
 
static HRESULT WINAPI HttpNegotiate_BeginningTransaction (IHttpNegotiate2 *iface, LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
 
static HRESULT WINAPI HttpNegotiate_OnResponse (IHttpNegotiate2 *iface, DWORD dwResponseCode, LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders)
 
static HRESULT WINAPI HttpNegotiate_GetRootSecurityId (IHttpNegotiate2 *iface, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
 
static HRESULT WINAPI BindCallbackRedirect_QueryInterface (IBindCallbackRedirect *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI BindCallbackRedirect_AddRef (IBindCallbackRedirect *iface)
 
static ULONG WINAPI BindCallbackRedirect_Release (IBindCallbackRedirect *iface)
 
static HRESULT WINAPI BindCallbackRedirect_Redirect (IBindCallbackRedirect *iface, const WCHAR *url, VARIANT_BOOL *cancel)
 
static HRESULT QueryInterface (REFIID, void **)
 
static HRESULT WINAPI ServiceProvider_QueryInterface (IServiceProvider *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ServiceProvider_AddRef (IServiceProvider *iface)
 
static ULONG WINAPI ServiceProvider_Release (IServiceProvider *iface)
 
static HRESULT WINAPI ServiceProvider_QueryService (IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
 
static HRESULT WINAPI Stream_QueryInterface (IStream *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI Stream_AddRef (IStream *iface)
 
static ULONG WINAPI Stream_Release (IStream *iface)
 
static HRESULT WINAPI Stream_Read (IStream *iface, void *pv, ULONG cb, ULONG *pcbRead)
 
static HRESULT WINAPI Stream_Write (IStream *iface, const void *pv, ULONG cb, ULONG *pcbWritten)
 
static HRESULT WINAPI Stream_Seek (IStream *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
 
static HRESULT WINAPI Stream_SetSize (IStream *iface, ULARGE_INTEGER libNewSize)
 
static HRESULT WINAPI Stream_CopyTo (IStream *iface, IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
 
static HRESULT WINAPI Stream_Commit (IStream *iface, DWORD grfCommitFlags)
 
static HRESULT WINAPI Stream_Revert (IStream *iface)
 
static HRESULT WINAPI Stream_LockRegion (IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
 
static HRESULT WINAPI Stream_UnlockRegion (IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
 
static HRESULT WINAPI Stream_Stat (IStream *iface, STATSTG *pstatstg, DWORD dwStatFlag)
 
static HRESULT WINAPI Stream_Clone (IStream *iface, IStream **ppstm)
 
static HRESULT WINAPI ProtocolSink_QueryInterface (IInternetProtocolSink *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ProtocolSink_AddRef (IInternetProtocolSink *iface)
 
static ULONG WINAPI ProtocolSink_Release (IInternetProtocolSink *iface)
 
static void call_continue (PROTOCOLDATA *protocol_data)
 
static HRESULT WINAPI ProtocolSink_Switch (IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
 
static HRESULT WINAPI ProtocolSink_ReportProgress (IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText)
 
static void test_http_info (IInternetProtocol *protocol)
 
static HRESULT WINAPI ProtocolSink_ReportData (IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
 
static HRESULT WINAPI ProtocolSink_ReportResult (IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
 
static HRESULT WINAPI MimeProtocolSink_QueryInterface (IInternetProtocolSink *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI MimeProtocolSink_AddRef (IInternetProtocolSink *iface)
 
static ULONG WINAPI MimeProtocolSink_Release (IInternetProtocolSink *iface)
 
static HRESULT WINAPI MimeProtocolSink_Switch (IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
 
static HRESULT WINAPI MimeProtocolSink_ReportProgress (IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText)
 
static HRESULT WINAPI MimeProtocolSink_ReportData (IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
 
static HRESULT WINAPI MimeProtocolSink_ReportResult (IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
 
static HRESULT WINAPI BindInfo_QueryInterface (IInternetBindInfo *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI BindInfo_AddRef (IInternetBindInfo *iface)
 
static ULONG WINAPI BindInfo_Release (IInternetBindInfo *iface)
 
static HRESULT WINAPI BindInfo_GetBindInfo (IInternetBindInfo *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
 
static HRESULT WINAPI BindInfo_GetBindString (IInternetBindInfo *iface, ULONG ulStringType, LPOLESTR *ppwzStr, ULONG cEl, ULONG *pcElFetched)
 
static Protocolimpl_from_IInternetPriority (IInternetPriority *iface)
 
static HRESULT WINAPI InternetPriority_QueryInterface (IInternetPriority *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI InternetPriority_AddRef (IInternetPriority *iface)
 
static ULONG WINAPI InternetPriority_Release (IInternetPriority *iface)
 
static HRESULT WINAPI InternetPriority_SetPriority (IInternetPriority *iface, LONG nPriority)
 
static HRESULT WINAPI InternetPriority_GetPriority (IInternetPriority *iface, LONG *pnPriority)
 
static ULONG WINAPI Protocol_AddRef (IInternetProtocolEx *iface)
 
static ULONG WINAPI Protocol_Release (IInternetProtocolEx *iface)
 
static HRESULT WINAPI Protocol_Abort (IInternetProtocolEx *iface, HRESULT hrReason, DWORD dwOptions)
 
static HRESULT WINAPI Protocol_Suspend (IInternetProtocolEx *iface)
 
static HRESULT WINAPI Protocol_Resume (IInternetProtocolEx *iface)
 
static HRESULT WINAPI Protocol_Seek (IInternetProtocolEx *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
 
static Protocolimpl_from_IInternetProtocolEx (IInternetProtocolEx *iface)
 
static HRESULT WINAPI ProtocolEmul_QueryInterface (IInternetProtocolEx *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ProtocolEmul_AddRef (IInternetProtocolEx *iface)
 
static ULONG WINAPI ProtocolEmul_Release (IInternetProtocolEx *iface)
 
static DWORD WINAPI thread_proc (PVOID arg)
 
static void protocol_start (IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD pi)
 
static HRESULT WINAPI ProtocolEmul_Start (IInternetProtocolEx *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
 
static HRESULT WINAPI ProtocolEmul_Continue (IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData)
 
static HRESULT WINAPI ProtocolEmul_Terminate (IInternetProtocolEx *iface, DWORD dwOptions)
 
static HRESULT WINAPI ProtocolEmul_Read (IInternetProtocolEx *iface, void *pv, ULONG cb, ULONG *pcbRead)
 
static HRESULT WINAPI ProtocolEmul_LockRequest (IInternetProtocolEx *iface, DWORD dwOptions)
 
static HRESULT WINAPI ProtocolEmul_UnlockRequest (IInternetProtocolEx *iface)
 
static HRESULT WINAPI ProtocolEmul_StartEx (IInternetProtocolEx *iface, IUri *pUri, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE *dwReserved)
 
static Protocolimpl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI ProtocolUnk_QueryInterface (IUnknown *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ProtocolUnk_AddRef (IUnknown *iface)
 
static ULONG WINAPI ProtocolUnk_Release (IUnknown *iface)
 
static HRESULT WINAPI MimeProtocol_QueryInterface (IInternetProtocolEx *iface, REFIID riid, void **ppv)
 
static HRESULT WINAPI MimeProtocol_Start (IInternetProtocolEx *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
 
static HRESULT WINAPI Protocol_Continue (IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData)
 
static HRESULT WINAPI MimeProtocol_Terminate (IInternetProtocolEx *iface, DWORD dwOptions)
 
static HRESULT WINAPI MimeProtocol_Read (IInternetProtocolEx *iface, void *pv, ULONG cb, ULONG *pcbRead)
 
static HRESULT WINAPI MimeProtocol_LockRequest (IInternetProtocolEx *iface, DWORD dwOptions)
 
static HRESULT WINAPI MimeProtocol_UnlockRequest (IInternetProtocolEx *iface)
 
static HRESULT WINAPI InternetProtocolInfo_QueryInterface (IInternetProtocolInfo *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI InternetProtocolInfo_AddRef (IInternetProtocolInfo *iface)
 
static ULONG WINAPI InternetProtocolInfo_Release (IInternetProtocolInfo *iface)
 
static HRESULT WINAPI InternetProtocolInfo_ParseUrl (IInternetProtocolInfo *iface, LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
 
static HRESULT WINAPI InternetProtocolInfo_CombineUrl (IInternetProtocolInfo *iface, LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
 
static HRESULT WINAPI InternetProtocolInfo_CompareUrl (IInternetProtocolInfo *iface, LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
 
static HRESULT WINAPI InternetProtocolInfo_QueryInfo (IInternetProtocolInfo *iface, LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
 
static HRESULT WINAPI ClassFactory_QueryInterface (IClassFactory *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ClassFactory_AddRef (IClassFactory *iface)
 
static ULONG WINAPI ClassFactory_Release (IClassFactory *iface)
 
static HRESULT WINAPI ClassFactory_CreateInstance (IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
 
static HRESULT WINAPI ClassFactory_LockServer (IClassFactory *iface, BOOL dolock)
 
static HRESULT WINAPI MimeFilter_CreateInstance (IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
 
static void register_filter (BOOL do_register)
 
static void init_test (int prot, DWORD flags)
 
static void test_priority (IInternetProtocol *protocol)
 
static void test_early_abort (const CLSID *clsid)
 
static BOOL file_protocol_start (IInternetProtocol *protocol, LPCWSTR url, IInternetProtocolEx *protocolex, IUri *uri, BOOL is_first)
 
static void test_file_protocol_url (LPCWSTR url)
 
static void test_file_protocol_fail (void)
 
static void test_file_protocol (void)
 
static void create_cache_entry (const WCHAR *urlw)
 
static BOOL http_protocol_start (LPCWSTR url, BOOL use_iuri)
 
static void test_protocol_terminate (IInternetProtocol *protocol)
 
static void test_http_protocol_url (LPCWSTR url, int prot, DWORD flags, DWORD tymed)
 
static void test_http_protocol (void)
 
static void test_https_protocol (void)
 
static void test_ftp_protocol (void)
 
static void test_gopher_protocol (void)
 
static void test_mk_protocol (void)
 
static void test_CreateBinding (void)
 
static void test_binding (int prot, DWORD grf_pi, DWORD test_flags)
 
static HRESULT WINAPI outer_QueryInterface (IUnknown *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI outer_AddRef (IUnknown *iface)
 
static ULONG WINAPI outer_Release (IUnknown *iface)
 
static void test_com_aggregation (const CLSID *clsid)
 
 START_TEST (protocol)
 

Variables

static IInternetSession DWORD
 
static DWORD_PTR
 
static const WCHAR wszIndexHtml [] = {'i','n','d','e','x','.','h','t','m','l',0}
 
static const WCHAR index_url []
 
static const WCHAR acc_mimeW [] = {'*','/','*',0}
 
static const WCHAR user_agentW [] = {'W','i','n','e',0}
 
static const WCHAR text_htmlW [] = {'t','e','x','t','/','h','t','m','l',0}
 
static const WCHAR hostW [] = {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}
 
static const WCHAR winehq_ipW [] = {'2','0','9','.','4','6','.','2','5','.','1','3','4',0}
 
static const WCHAR emptyW [] = {0}
 
static const WCHAR pjpegW [] = {'i','m','a','g','e','/','p','j','p','e','g',0}
 
static const WCHAR gifW [] = {'i','m','a','g','e','/','g','i','f',0}
 
static const WCHAR null_guid []
 
static WCHAR protocol_clsid [CHARS_IN_GUID]
 
static HRESULT expect_hrResult
 
static LPCWSTR file_name
 
static LPCWSTR http_url
 
static LPCWSTR expect_wsz
 
static IInternetProtocolasync_protocol = NULL
 
static BOOL first_data_notif
 
static BOOL http_is_first
 
static BOOL test_redirect
 
static BOOL redirect_on_continue
 
static int prot_state
 
static int read_report_data
 
static int post_stream_read
 
static DWORD bindf
 
static DWORD ex_priority
 
static DWORD pi
 
static DWORD bindinfo_options
 
static IInternetProtocolbinding_protocol
 
static IInternetProtocolfiltered_protocol
 
static IInternetBindInfoprot_bind_info
 
static IInternetProtocolSinkbinding_sink
 
static IInternetProtocolSinkfiltered_sink
 
static voidexpect_pv
 
static HANDLE event_complete
 
static HANDLE event_complete2
 
static HANDLE event_continue
 
static HANDLE event_continue_done
 
static BOOL binding_test
 
static PROTOCOLDATA protocoldata
 
static PROTOCOLDATA * pdata
 
static PROTOCOLDATA continue_protdata
 
static DWORD prot_read
 
static DWORD filter_state
 
static DWORD http_post_test
 
static DWORD thread_id
 
static BOOL security_problem
 
static BOOL test_async_req
 
static BOOL impl_protex
 
static BOOL async_read_pending
 
static BOOL mimefilter_test
 
static BOOL direct_read
 
static BOOL wait_for_switch
 
static BOOL emulate_prot
 
static BOOL short_read
 
static BOOL test_abort
 
static BOOL empty_file
 
static BOOL no_mime
 
static BOOL bind_from_cache
 
static BOOL file_with_hash
 
static BOOL reuse_protocol_thread
 
static BOOL no_aggregation
 
static BOOL result_from_lock
 
enum { ... }  state
 
static enum { ... }  tested_protocol
 
static Protocolprotocol_emul
 
static const WCHAR protocol_names [][10]
 
static const WCHAR binding_urls [][130]
 
static const CHAR post_data [] = "mode=Test"
 
static IHttpSecurityVtbl HttpSecurityVtbl
 
static IHttpSecurity http_security = { &HttpSecurityVtbl }
 
static IHttpNegotiate2Vtbl HttpNegotiateVtbl
 
static IHttpNegotiate2 http_negotiate = { &HttpNegotiateVtbl }
 
static const IBindCallbackRedirectVtbl BindCallbackRedirectVtbl
 
static IBindCallbackRedirect redirect_callback = { &BindCallbackRedirectVtbl }
 
static const IServiceProviderVtbl ServiceProviderVtbl
 
static IServiceProvider service_provider = { &ServiceProviderVtbl }
 
static const IStreamVtbl StreamVtbl
 
static IStream Stream = { &StreamVtbl }
 
static const charstatus_names []
 
static IInternetProtocolSinkVtbl protocol_sink_vtbl
 
static IInternetProtocolSink protocol_sink = { &protocol_sink_vtbl }
 
static IInternetProtocolSinkVtbl mime_protocol_sink_vtbl
 
static IInternetProtocolSink mime_protocol_sink = { &mime_protocol_sink_vtbl }
 
static IInternetBindInfoVtbl bind_info_vtbl
 
static IInternetBindInfo bind_info = { &bind_info_vtbl }
 
static const IInternetPriorityVtbl InternetPriorityVtbl
 
static const IInternetProtocolExVtbl ProtocolVtbl
 
static const IUnknownVtbl ProtocolUnkVtbl
 
static const IInternetProtocolExVtbl MimeProtocolVtbl
 
static IInternetProtocolEx MimeProtocol = { &MimeProtocolVtbl }
 
static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl
 
static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl }
 
static const IClassFactoryVtbl ClassFactoryVtbl
 
static IClassFactory ClassFactory = { &ClassFactoryVtbl }
 
static const IClassFactoryVtbl MimeFilterCFVtbl
 
static IClassFactory mimefilter_cf = { &MimeFilterCFVtbl }
 
static const IID outer_test_iid = {0xabcabc00,0,0,{0,0,0,0,0,0,0,0x66}}
 
static const IUnknownVtbl outer_vtbl
 

Macro Definition Documentation

◆ CHARS_IN_GUID

#define CHARS_IN_GUID   39

Definition at line 36 of file protocol.c.

◆ CHECK_CALLED

#define CHECK_CALLED (   func)
Value:
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
#define FALSE
Definition: types.h:117
GLenum func
Definition: glext.h:6028
#define expect_(expected, got, precision)
Definition: font.c:34

Definition at line 56 of file protocol.c.

◆ CHECK_EXPECT

#define CHECK_EXPECT (   func)
Value:
do { \
CHECK_EXPECT2(func); \
expect_ ## func = FALSE; \
}while(0)

Definition at line 50 of file protocol.c.

◆ CHECK_EXPECT2

#define CHECK_EXPECT2 (   func)
Value:
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)
#define TRUE
Definition: types.h:120

Definition at line 44 of file protocol.c.

◆ CHECK_NOT_CALLED

#define CHECK_NOT_CALLED (   func)
Value:
do { \
ok(!called_ ## func, "unexpected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)

Definition at line 62 of file protocol.c.

◆ CLEAR_CALLED

#define CLEAR_CALLED (   func)     expect_ ## func = called_ ## func = FALSE

Definition at line 68 of file protocol.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file protocol.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 20 of file protocol.c.

◆ DEFINE_EXPECT

#define DEFINE_EXPECT (   func)     static BOOL expect_ ## func = FALSE, called_ ## func = FALSE

Definition at line 38 of file protocol.c.

◆ SET_EXPECT

#define SET_EXPECT (   func)     expect_ ## func = TRUE

Definition at line 41 of file protocol.c.

◆ TEST_ABORT

#define TEST_ABORT   0x0100

Definition at line 2706 of file protocol.c.

◆ TEST_ASYNCREQ

#define TEST_ASYNCREQ   0x0200

Definition at line 2707 of file protocol.c.

◆ TEST_BINDING

#define TEST_BINDING   0x0001

Definition at line 2698 of file protocol.c.

◆ TEST_DIRECT_READ

#define TEST_DIRECT_READ   0x0008

Definition at line 2701 of file protocol.c.

◆ TEST_DISABLEAUTOREDIRECT

#define TEST_DISABLEAUTOREDIRECT   0x8000

Definition at line 2713 of file protocol.c.

◆ TEST_EMPTY

#define TEST_EMPTY   0x1000

Definition at line 2710 of file protocol.c.

◆ TEST_EMULATEPROT

#define TEST_EMULATEPROT   0x0020

Definition at line 2703 of file protocol.c.

◆ TEST_FILTER

#define TEST_FILTER   0x0002

Definition at line 2699 of file protocol.c.

◆ TEST_FIRST_HTTP

#define TEST_FIRST_HTTP   0x0004

Definition at line 2700 of file protocol.c.

◆ TEST_FROMCACHE

#define TEST_FROMCACHE   0x4000

Definition at line 2712 of file protocol.c.

◆ TEST_IMPLPROTEX

#define TEST_IMPLPROTEX   0x0800

Definition at line 2709 of file protocol.c.

◆ TEST_NOMIME

#define TEST_NOMIME   0x2000

Definition at line 2711 of file protocol.c.

◆ TEST_POST

#define TEST_POST   0x0010

Definition at line 2702 of file protocol.c.

◆ TEST_REDIRECT

#define TEST_REDIRECT   0x0080

Definition at line 2705 of file protocol.c.

◆ TEST_RESULTFROMLOCK

#define TEST_RESULTFROMLOCK   0x10000

Definition at line 2714 of file protocol.c.

◆ TEST_SHORT_READ

#define TEST_SHORT_READ   0x0040

Definition at line 2704 of file protocol.c.

◆ TEST_USEBINDING

#define TEST_USEBINDING   0x20000

Definition at line 2715 of file protocol.c.

◆ TEST_USEIURI

#define TEST_USEIURI   0x0400

Definition at line 2708 of file protocol.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
STATE_CONNECTING 
STATE_SENDINGREQUEST 
STATE_STARTDOWNLOADING 
STATE_DOWNLOADING 

Definition at line 170 of file protocol.c.

170 {
175} state;
@ STATE_SENDINGREQUEST
Definition: protocol.c:172
@ STATE_CONNECTING
Definition: protocol.c:171
@ STATE_DOWNLOADING
Definition: protocol.c:174
@ STATE_STARTDOWNLOADING
Definition: protocol.c:173
enum @1881 state

◆ anonymous enum

anonymous enum
Enumerator
FILE_TEST 
HTTP_TEST 
HTTPS_TEST 
FTP_TEST 
MK_TEST 
ITS_TEST 
BIND_TEST 

Definition at line 177 of file protocol.c.

177 {
178 FILE_TEST,
179 HTTP_TEST,
181 FTP_TEST,
182 MK_TEST,
183 ITS_TEST,
static enum @1882 tested_protocol
@ 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

Function Documentation

◆ BindCallbackRedirect_AddRef()

static ULONG WINAPI BindCallbackRedirect_AddRef ( IBindCallbackRedirect iface)
static

Definition at line 402 of file protocol.c.

403{
404 return 2;
405}

◆ BindCallbackRedirect_QueryInterface()

static HRESULT WINAPI BindCallbackRedirect_QueryInterface ( IBindCallbackRedirect iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 395 of file protocol.c.

396{
397 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
398 *ppv = NULL;
399 return E_NOINTERFACE;
400}
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:171
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ BindCallbackRedirect_Redirect()

static HRESULT WINAPI BindCallbackRedirect_Redirect ( IBindCallbackRedirect iface,
const WCHAR url,
VARIANT_BOOL cancel 
)
static

Definition at line 412 of file protocol.c.

413{
414 CHECK_EXPECT(Redirect);
415 *cancel = VARIANT_FALSE;
416 return S_OK;
417}
#define S_OK
Definition: intsafe.h:52
#define CHECK_EXPECT(func)
Definition: protocol.c:40

◆ BindCallbackRedirect_Release()

static ULONG WINAPI BindCallbackRedirect_Release ( IBindCallbackRedirect iface)
static

Definition at line 407 of file protocol.c.

408{
409 return 1;
410}

◆ BindInfo_AddRef()

static ULONG WINAPI BindInfo_AddRef ( IInternetBindInfo iface)
static

Definition at line 1413 of file protocol.c.

1414{
1415 return 2;
1416}

◆ BindInfo_GetBindInfo()

static HRESULT WINAPI BindInfo_GetBindInfo ( IInternetBindInfo iface,
DWORD grfBINDF,
BINDINFO *  pbindinfo 
)
static

Definition at line 1423 of file protocol.c.

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}
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static DWORD bindf
Definition: protocol.c:70
static const CHAR post_data[]
Definition: protocol.c:222
static IStream Stream
Definition: protocol.c:627
static DWORD http_post_test
Definition: protocol.c:164
static DWORD bindinfo_options
Definition: protocol.c:156
static BOOL binding_test
Definition: protocol.c:162
#define memset(x, y, z)
Definition: compat.h:39
#define GPTR
Definition: winbase.h:320

◆ BindInfo_GetBindString()

static HRESULT WINAPI BindInfo_GetBindString ( IInternetBindInfo iface,
ULONG  ulStringType,
LPOLESTR *  ppwzStr,
ULONG  cEl,
ULONG pcElFetched 
)
static

Definition at line 1462 of file protocol.c.

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}
#define E_NOTIMPL
Definition: ddrawi.h:99
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
#define lstrlenW
Definition: compat.h:750
GLsizeiptr size
Definition: glext.h:5919
static const WCHAR binding_urls[][130]
Definition: protocol.c:208
static const WCHAR acc_mimeW[]
Definition: protocol.c:139
static const WCHAR user_agentW[]
Definition: protocol.c:140
short WCHAR
Definition: pedump.c:58

◆ BindInfo_QueryInterface()

static HRESULT WINAPI BindInfo_QueryInterface ( IInternetBindInfo iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1404 of file protocol.c.

1405{
1406 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetBindInfo, riid)) {
1407 *ppv = iface;
1408 return S_OK;
1409 }
1410 return E_NOINTERFACE;
1411}
const GUID IID_IUnknown
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

◆ BindInfo_Release()

static ULONG WINAPI BindInfo_Release ( IInternetBindInfo iface)
static

Definition at line 1418 of file protocol.c.

1419{
1420 return 1;
1421}

◆ call_continue()

static void call_continue ( PROTOCOLDATA *  protocol_data)
static

Definition at line 644 of file protocol.c.

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}
#define trace
Definition: atltest.h:70
int winetest_debug
#define todo_wine
Definition: minitest.h:80
#define SET_EXPECT(func)
Definition: protocol.c:37
HRESULT hres
Definition: protocol.c:465
#define CHECK_CALLED(func)
Definition: protocol.c:50
#define CLEAR_CALLED(func)
Definition: protocol.c:68
static BOOL test_async_req
Definition: protocol.c:165
static IInternetProtocol * async_protocol
Definition: protocol.c:153
static BOOL test_abort
Definition: protocol.c:166
static BOOL empty_file
Definition: protocol.c:167
static BOOL http_is_first
Definition: protocol.c:154
static BOOL security_problem
Definition: protocol.c:165
static HRESULT WINAPI Stream_Read(IStream *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: protocol.c:518
static BOOL test_redirect
Definition: protocol.c:154

Referenced by ProtocolSink_Switch(), and test_http_protocol_url().

◆ ClassFactory_AddRef()

static ULONG WINAPI ClassFactory_AddRef ( IClassFactory iface)
static

Definition at line 2615 of file protocol.c.

2616{
2617 return 2;
2618}

◆ ClassFactory_CreateInstance()

static HRESULT WINAPI ClassFactory_CreateInstance ( IClassFactory iface,
IUnknown pOuter,
REFIID  riid,
void **  ppv 
)
static

Definition at line 2625 of file protocol.c.

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}
#define malloc
Definition: debug_ros.c:4
return ret
Definition: mutex.c:146
static CInternetFolder * CreateInstance(void)
Definition: inetfolder.c:330
static BOOL no_aggregation
Definition: protocol.c:168
static IInternetBindInfo * prot_bind_info
Definition: protocol.c:158
static const IUnknownVtbl ProtocolUnkVtbl
Definition: protocol.c:2338
static const IInternetProtocolExVtbl ProtocolVtbl
Definition: protocol.c:2247
static Protocol * protocol_emul
Definition: protocol.c:196
static const IInternetPriorityVtbl InternetPriorityVtbl
Definition: protocol.c:1588
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771

◆ ClassFactory_LockServer()

static HRESULT WINAPI ClassFactory_LockServer ( IClassFactory iface,
BOOL  dolock 
)
static

Definition at line 2661 of file protocol.c.

2662{
2663 ok(0, "unexpected call\n");
2664 return S_OK;
2665}

◆ ClassFactory_QueryInterface()

static HRESULT WINAPI ClassFactory_QueryInterface ( IClassFactory iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 2604 of file protocol.c.

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}
static IInternetProtocolInfo protocol_info
Definition: misc.c:929

◆ ClassFactory_Release()

static ULONG WINAPI ClassFactory_Release ( IClassFactory iface)
static

Definition at line 2620 of file protocol.c.

2621{
2622 return 1;
2623}

◆ create_cache_entry()

static void create_cache_entry ( const WCHAR urlw)
static

Definition at line 3205 of file protocol.c.

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}
content
Definition: atl_ax.c:994
#define CloseHandle
Definition: compat.h:739
#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 FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
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
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
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
unsigned int BOOL
Definition: ntddk_ex.h:94
time_t now
Definition: finger.c:65
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
GLuint res
Definition: glext.h:9613
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
#define CREATE_ALWAYS
Definition: disk.h:72
static const WCHAR url[]
Definition: encode.c:1384
static const char * w2a(LPCWSTR str)
Definition: protocol.c:230
#define GENERIC_WRITE
Definition: nt_native.h:90
TCHAR file_path[MAX_PATH]
Definition: sndrec32.cpp:57
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65
Definition: fci.c:127
int64_t LONGLONG
Definition: typedefs.h:68
LONGLONG QuadPart
Definition: typedefs.h:114
struct _LARGE_INTEGER::@2513 u
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define NORMAL_CACHE_ENTRY
Definition: wininet.h:2087
unsigned char BYTE
Definition: xxhash.c:193

Referenced by test_http_protocol_url().

◆ DEFINE_EXPECT() [1/63]

DEFINE_EXPECT ( Abort  )

◆ DEFINE_EXPECT() [2/63]

DEFINE_EXPECT ( BeginningTransaction  )

◆ DEFINE_EXPECT() [3/63]

DEFINE_EXPECT ( Continue  )

◆ DEFINE_EXPECT() [4/63]

DEFINE_EXPECT ( CreateInstance  )

◆ DEFINE_EXPECT() [5/63]

DEFINE_EXPECT ( CreateInstance_no_aggregation  )

◆ DEFINE_EXPECT() [6/63]

DEFINE_EXPECT ( GetBindInfo  )

◆ DEFINE_EXPECT() [7/63]

DEFINE_EXPECT ( GetBindString_ACCEPT_MIMES  )

◆ DEFINE_EXPECT() [8/63]

DEFINE_EXPECT ( GetBindString_POST_COOKIE  )

◆ DEFINE_EXPECT() [9/63]

DEFINE_EXPECT ( GetBindString_ROOTDOC_URL  )

◆ DEFINE_EXPECT() [10/63]

DEFINE_EXPECT ( GetBindString_SAMESITE_COOKIE_LEVEL  )

◆ DEFINE_EXPECT() [11/63]

DEFINE_EXPECT ( GetBindString_URL  )

◆ DEFINE_EXPECT() [12/63]

DEFINE_EXPECT ( GetBindString_USER_AGENT  )

◆ DEFINE_EXPECT() [13/63]

DEFINE_EXPECT ( GetRootSecurityId  )

◆ DEFINE_EXPECT() [14/63]

DEFINE_EXPECT ( LockRequest  )

◆ DEFINE_EXPECT() [15/63]

DEFINE_EXPECT ( MimeFilter_Continue  )

◆ DEFINE_EXPECT() [16/63]

DEFINE_EXPECT ( MimeFilter_CreateInstance  )

◆ DEFINE_EXPECT() [17/63]

DEFINE_EXPECT ( MimeFilter_LockRequest  )

◆ DEFINE_EXPECT() [18/63]

DEFINE_EXPECT ( MimeFilter_Read  )

◆ DEFINE_EXPECT() [19/63]

DEFINE_EXPECT ( MimeFilter_ReportData  )

◆ DEFINE_EXPECT() [20/63]

DEFINE_EXPECT ( MimeFilter_ReportResult  )

◆ DEFINE_EXPECT() [21/63]

DEFINE_EXPECT ( MimeFilter_Start  )

◆ DEFINE_EXPECT() [22/63]

DEFINE_EXPECT ( MimeFilter_Switch  )

◆ DEFINE_EXPECT() [23/63]

DEFINE_EXPECT ( MimeFilter_Terminate  )

◆ DEFINE_EXPECT() [24/63]

DEFINE_EXPECT ( MimeFilter_UnlockRequest  )

◆ DEFINE_EXPECT() [25/63]

DEFINE_EXPECT ( OnResponse  )

◆ DEFINE_EXPECT() [26/63]

DEFINE_EXPECT ( outer_QI_test  )

◆ DEFINE_EXPECT() [27/63]

DEFINE_EXPECT ( Protocol_destructor  )

◆ DEFINE_EXPECT() [28/63]

DEFINE_EXPECT ( QueryInterface_IWinInetHttpInfo  )

◆ DEFINE_EXPECT() [29/63]

DEFINE_EXPECT ( QueryInterface_IWinInetInfo  )

◆ DEFINE_EXPECT() [30/63]

DEFINE_EXPECT ( QueryService_HttpNegotiate  )

◆ DEFINE_EXPECT() [31/63]

DEFINE_EXPECT ( QueryService_HttpSecurity  )

◆ DEFINE_EXPECT() [32/63]

DEFINE_EXPECT ( QueryService_IBindCallbackRedirect  )

◆ DEFINE_EXPECT() [33/63]

DEFINE_EXPECT ( QueryService_InternetProtocol  )

◆ DEFINE_EXPECT() [34/63]

DEFINE_EXPECT ( Read  )

◆ DEFINE_EXPECT() [35/63]

DEFINE_EXPECT ( Read2  )

◆ DEFINE_EXPECT() [36/63]

DEFINE_EXPECT ( Redirect  )

◆ DEFINE_EXPECT() [37/63]

DEFINE_EXPECT ( ReportData  )

◆ DEFINE_EXPECT() [38/63]

DEFINE_EXPECT ( ReportData2  )

◆ DEFINE_EXPECT() [39/63]

DEFINE_EXPECT ( ReportProgress_ACCEPTRANGES  )

◆ DEFINE_EXPECT() [40/63]

DEFINE_EXPECT ( ReportProgress_CACHEFILENAMEAVAILABLE  )

◆ DEFINE_EXPECT() [41/63]

DEFINE_EXPECT ( ReportProgress_CONNECTING  )

◆ DEFINE_EXPECT() [42/63]

DEFINE_EXPECT ( ReportProgress_COOKIE_SENT  )

◆ DEFINE_EXPECT() [43/63]

DEFINE_EXPECT ( ReportProgress_DECODING  )

◆ DEFINE_EXPECT() [44/63]

DEFINE_EXPECT ( ReportProgress_DIRECTBIND  )

◆ DEFINE_EXPECT() [45/63]

DEFINE_EXPECT ( ReportProgress_ENCODING  )

◆ DEFINE_EXPECT() [46/63]

DEFINE_EXPECT ( ReportProgress_FINDINGRESOURCE  )

◆ DEFINE_EXPECT() [47/63]

DEFINE_EXPECT ( ReportProgress_LOADINGMIMEHANDLER  )

◆ DEFINE_EXPECT() [48/63]

DEFINE_EXPECT ( ReportProgress_MIMETYPEAVAILABLE  )

◆ DEFINE_EXPECT() [49/63]

DEFINE_EXPECT ( ReportProgress_PROTOCOLCLASSID  )

◆ DEFINE_EXPECT() [50/63]

DEFINE_EXPECT ( ReportProgress_PROXYDETECTING  )

◆ DEFINE_EXPECT() [51/63]

DEFINE_EXPECT ( ReportProgress_RAWMIMETYPE  )

◆ DEFINE_EXPECT() [52/63]

DEFINE_EXPECT ( ReportProgress_REDIRECTING  )

◆ DEFINE_EXPECT() [53/63]

DEFINE_EXPECT ( ReportProgress_SENDINGREQUEST  )

◆ DEFINE_EXPECT() [54/63]

DEFINE_EXPECT ( ReportProgress_VERIFIEDMIMETYPEAVAILABLE  )

◆ DEFINE_EXPECT() [55/63]

DEFINE_EXPECT ( ReportResult  )

◆ DEFINE_EXPECT() [56/63]

DEFINE_EXPECT ( SetPriority  )

◆ DEFINE_EXPECT() [57/63]

DEFINE_EXPECT ( Start  )

◆ DEFINE_EXPECT() [58/63]

DEFINE_EXPECT ( StartEx  )

◆ DEFINE_EXPECT() [59/63]

DEFINE_EXPECT ( Stream_Read  )

◆ DEFINE_EXPECT() [60/63]

DEFINE_EXPECT ( Stream_Seek  )

◆ DEFINE_EXPECT() [61/63]

DEFINE_EXPECT ( Switch  )

◆ DEFINE_EXPECT() [62/63]

DEFINE_EXPECT ( Terminate  )

◆ DEFINE_EXPECT() [63/63]

DEFINE_EXPECT ( UnlockRequest  )

◆ file_protocol_start()

static BOOL file_protocol_start ( IInternetProtocol protocol,
LPCWSTR  url,
IInternetProtocolEx protocolex,
IUri uri,
BOOL  is_first 
)
static

Definition at line 2829 of file protocol.c.

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}
#define win_skip
Definition: minitest.h:67
static IInternetProtocolSink protocol_sink
Definition: mimeole.c:1384
static IInternetBindInfo bind_info
Definition: mimeole.c:1246
static HRESULT expect_hrResult
Definition: protocol.c:68
const WCHAR * uri
Definition: sec_mgr.c:1564
#define INET_E_RESOURCE_NOT_FOUND
Definition: winerror.h:4655

Referenced by test_file_protocol_url().

◆ HRESULT()

static HRESULT ( WINAPI pCoInternetGetSession)
static

◆ http_protocol_start()

static BOOL http_protocol_start ( LPCWSTR  url,
BOOL  use_iuri 
)
static

Definition at line 3250 of file protocol.c.

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}
#define FAILED(hr)
Definition: intsafe.h:51
static BOOL bind_from_cache
Definition: protocol.c:167
static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
Definition: protocol.c:546

Referenced by test_http_protocol_url().

◆ HttpNegotiate_AddRef()

static ULONG WINAPI HttpNegotiate_AddRef ( IHttpNegotiate2 iface)
static

Definition at line 307 of file protocol.c.

308{
309 return 2;
310}

◆ HttpNegotiate_BeginningTransaction()

static HRESULT WINAPI HttpNegotiate_BeginningTransaction ( IHttpNegotiate2 iface,
LPCWSTR  szURL,
LPCWSTR  szHeaders,
DWORD  dwReserved,
LPWSTR pszAdditionalHeaders 
)
static

Definition at line 317 of file protocol.c.

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}
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
static LPCWSTR http_url
Definition: protocol.c:152
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
uint16_t * LPWSTR
Definition: typedefs.h:56

◆ HttpNegotiate_GetRootSecurityId()

static HRESULT WINAPI HttpNegotiate_GetRootSecurityId ( IHttpNegotiate2 iface,
BYTE pbSecurityId,
DWORD pcbSecurityId,
DWORD_PTR  dwReserved 
)
static

Definition at line 362 of file protocol.c.

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}
#define E_FAIL
Definition: ddrawi.h:102

◆ HttpNegotiate_OnResponse()

static HRESULT WINAPI HttpNegotiate_OnResponse ( IHttpNegotiate2 iface,
DWORD  dwResponseCode,
LPCWSTR  szResponseHeaders,
LPCWSTR  szRequestHeaders,
LPWSTR pszAdditionalRequestHeaders 
)
static

Definition at line 349 of file protocol.c.

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}

◆ HttpNegotiate_QueryInterface()

static HRESULT WINAPI HttpNegotiate_QueryInterface ( IHttpNegotiate2 iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 294 of file protocol.c.

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}

◆ HttpNegotiate_Release()

static ULONG WINAPI HttpNegotiate_Release ( IHttpNegotiate2 iface)
static

Definition at line 312 of file protocol.c.

313{
314 return 1;
315}

◆ HttpSecurity_AddRef()

static ULONG WINAPI HttpSecurity_AddRef ( IHttpSecurity iface)
static

Definition at line 249 of file protocol.c.

250{
251 return 2;
252}

◆ HttpSecurity_GetWindow()

static HRESULT WINAPI HttpSecurity_GetWindow ( IHttpSecurity iface,
REFGUID  rguidReason,
HWND phwnd 
)
static

Definition at line 259 of file protocol.c.

260{
261 if(winetest_debug > 1) trace("HttpSecurity_GetWindow\n");
262
263 return S_FALSE;
264}
#define S_FALSE
Definition: winerror.h:3451

◆ HttpSecurity_OnSecurityProblem()

static HRESULT WINAPI HttpSecurity_OnSecurityProblem ( IHttpSecurity iface,
DWORD  dwProblem 
)
static

Definition at line 266 of file protocol.c.

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}
#define RPC_E_RETRY
Definition: winerror.h:3557
#define E_ABORT
Definition: winerror.h:3481
#define ERROR_INTERNET_INVALID_CA
Definition: wininet.h:2033
#define ERROR_INTERNET_SEC_CERT_REV_FAILED
Definition: wininet.h:2044

◆ HttpSecurity_QueryInterface()

static HRESULT WINAPI HttpSecurity_QueryInterface ( IHttpSecurity iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 237 of file protocol.c.

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}

◆ HttpSecurity_Release()

static ULONG WINAPI HttpSecurity_Release ( IHttpSecurity iface)
static

Definition at line 254 of file protocol.c.

255{
256 return 1;
257}

◆ impl_from_IInternetPriority()

static Protocol * impl_from_IInternetPriority ( IInternetPriority iface)
static

Definition at line 1540 of file protocol.c.

1541{
1542 return CONTAINING_RECORD(iface, Protocol, IInternetPriority_iface);
1543}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by InternetPriority_AddRef(), and InternetPriority_Release().

◆ impl_from_IInternetProtocolEx()

static Protocol * impl_from_IInternetProtocolEx ( IInternetProtocolEx iface)
static

Definition at line 1640 of file protocol.c.

1641{
1642 return CONTAINING_RECORD(iface, Protocol, IInternetProtocolEx_iface);
1643}

Referenced by ProtocolEmul_AddRef(), ProtocolEmul_QueryInterface(), and ProtocolEmul_Release().

◆ impl_from_IUnknown()

static Protocol * impl_from_IUnknown ( IUnknown iface)
static

Definition at line 2264 of file protocol.c.

2265{
2266 return CONTAINING_RECORD(iface, Protocol, IUnknown_inner);
2267}

◆ init_test()

static void init_test ( int  prot,
DWORD  flags 
)
static

Definition at line 2740 of file protocol.c.

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}
GLbitfield flags
Definition: glext.h:7161
#define TEST_REDIRECT
Definition: protocol.c:2705
#define TEST_FIRST_HTTP
Definition: protocol.c:2700
#define TEST_ASYNCREQ
Definition: protocol.c:2707
#define TEST_FROMCACHE
Definition: protocol.c:2712
static void register_filter(BOOL do_register)
Definition: protocol.c:2717
static BOOL async_read_pending
Definition: protocol.c:166
static BOOL wait_for_switch
Definition: protocol.c:166
static IInternetProtocol * binding_protocol
Definition: protocol.c:157
static BOOL emulate_prot
Definition: protocol.c:166
static int post_stream_read
Definition: protocol.c:155
static HANDLE event_continue_done
Definition: protocol.c:161
static DWORD filter_state
Definition: protocol.c:164
#define TEST_BINDING
Definition: protocol.c:2698
#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 HANDLE event_continue
Definition: protocol.c:161
#define TEST_RESULTFROMLOCK
Definition: protocol.c:2714
static BOOL redirect_on_continue
Definition: protocol.c:154
static WCHAR protocol_clsid[CHARS_IN_GUID]
Definition: protocol.c:149
static BOOL result_from_lock
Definition: protocol.c:168
static BOOL impl_protex
Definition: protocol.c:165
static BOOL direct_read
Definition: protocol.c:166
#define TEST_EMULATEPROT
Definition: protocol.c:2703
static BOOL no_mime
Definition: protocol.c:167
#define TEST_DISABLEAUTOREDIRECT
Definition: protocol.c:2713
static DWORD prot_read
Definition: protocol.c:164
#define TEST_NOMIME
Definition: protocol.c:2711
#define TEST_DIRECT_READ
Definition: protocol.c:2701
static BOOL first_data_notif
Definition: protocol.c:154
static BOOL reuse_protocol_thread
Definition: protocol.c:167
static BOOL short_read
Definition: protocol.c:166
static int prot_state
Definition: protocol.c:155
static BOOL mimefilter_test
Definition: protocol.c:166
#define TEST_IMPLPROTEX
Definition: protocol.c:2709
static HANDLE event_complete
Definition: protocol.c:161
#define TEST_FILTER
Definition: protocol.c:2699
#define TEST_ABORT
Definition: protocol.c:2706
static HANDLE event_complete2
Definition: protocol.c:161
static IInternetProtocolSink * filtered_sink
Definition: protocol.c:159
static IInternetProtocol * filtered_protocol
Definition: protocol.c:157
static const WCHAR null_guid[]
Definition: protocol.c:147
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:650

◆ InternetPriority_AddRef()

static ULONG WINAPI InternetPriority_AddRef ( IInternetPriority iface)
static

Definition at line 1552 of file protocol.c.

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}
static Protocol * impl_from_IInternetPriority(IInternetPriority *iface)
Definition: protocol.c:1540

◆ InternetPriority_GetPriority()

static HRESULT WINAPI InternetPriority_GetPriority ( IInternetPriority iface,
LONG pnPriority 
)
static

Definition at line 1581 of file protocol.c.

1582{
1583 ok(0, "unexpected call\n");
1584 return E_NOTIMPL;
1585}

◆ InternetPriority_QueryInterface()

static HRESULT WINAPI InternetPriority_QueryInterface ( IInternetPriority iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1545 of file protocol.c.

1547{
1548 ok(0, "unexpected call\n");
1549 return E_NOINTERFACE;
1550}

◆ InternetPriority_Release()

static ULONG WINAPI InternetPriority_Release ( IInternetPriority iface)
static

Definition at line 1563 of file protocol.c.

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}

◆ InternetPriority_SetPriority()

static HRESULT WINAPI InternetPriority_SetPriority ( IInternetPriority iface,
LONG  nPriority 
)
static

Definition at line 1574 of file protocol.c.

1575{
1577 ok(nPriority == ex_priority, "nPriority=%ld\n", nPriority);
1578 return S_OK;
1579}
@ SetPriority
Definition: halhw.h:216
static DWORD ex_priority
Definition: protocol.c:156

◆ InternetProtocolInfo_AddRef()

static ULONG WINAPI InternetProtocolInfo_AddRef ( IInternetProtocolInfo iface)
static

Definition at line 2551 of file protocol.c.

2552{
2553 return 2;
2554}

◆ InternetProtocolInfo_CombineUrl()

static HRESULT WINAPI InternetProtocolInfo_CombineUrl ( IInternetProtocolInfo iface,
LPCWSTR  pwzBaseUrl,
LPCWSTR  pwzRelativeUrl,
DWORD  dwCombineFlags,
LPWSTR  pwzResult,
DWORD  cchResult,
DWORD pcchResult,
DWORD  dwReserved 
)
static

Definition at line 2569 of file protocol.c.

2572{
2573 ok(0, "unexpected call\n");
2574 return E_NOTIMPL;
2575}

◆ InternetProtocolInfo_CompareUrl()

static HRESULT WINAPI InternetProtocolInfo_CompareUrl ( IInternetProtocolInfo iface,
LPCWSTR  pwzUrl1,
LPCWSTR  pwzUrl2,
DWORD  dwCompareFlags 
)
static

Definition at line 2577 of file protocol.c.

2579{
2580 ok(0, "unexpected call\n");
2581 return E_NOTIMPL;
2582}

◆ InternetProtocolInfo_ParseUrl()

static HRESULT WINAPI InternetProtocolInfo_ParseUrl ( IInternetProtocolInfo iface,
LPCWSTR  pwzUrl,
PARSEACTION  ParseAction,
DWORD  dwParseFlags,
LPWSTR  pwzResult,
DWORD  cchResult,
DWORD pcchResult,
DWORD  dwReserved 
)
static

Definition at line 2561 of file protocol.c.

2564{
2565 ok(0, "unexpected call %d\n", ParseAction);
2566 return E_NOTIMPL;
2567}

◆ InternetProtocolInfo_QueryInfo()

static HRESULT WINAPI InternetProtocolInfo_QueryInfo ( IInternetProtocolInfo iface,
LPCWSTR  pwzUrl,
QUERYOPTION  OueryOption,
DWORD  dwQueryFlags,
LPVOID  pBuffer,
DWORD  cbBuffer,
DWORD pcbBuf,
DWORD  dwReserved 
)
static

Definition at line 2584 of file protocol.c.

2587{
2588 ok(0, "unexpected call\n");
2589 return E_NOTIMPL;
2590}

◆ InternetProtocolInfo_QueryInterface()

static HRESULT WINAPI InternetProtocolInfo_QueryInterface ( IInternetProtocolInfo iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 2545 of file protocol.c.

2546{
2547 ok(0, "unexpected call\n");
2548 return E_NOINTERFACE;
2549}

◆ InternetProtocolInfo_Release()

static ULONG WINAPI InternetProtocolInfo_Release ( IInternetProtocolInfo iface)
static

Definition at line 2556 of file protocol.c.

2557{
2558 return 1;
2559}

◆ MimeFilter_CreateInstance()

static HRESULT WINAPI MimeFilter_CreateInstance ( IClassFactory iface,
IUnknown outer,
REFIID  riid,
void **  ppv 
)
static

Definition at line 2677 of file protocol.c.

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}
static IUnknown * outer
Definition: compobj.c:82
static IInternetProtocolEx MimeProtocol
Definition: protocol.c:2543
static HRESULT WINAPI MimeFilter_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
Definition: protocol.c:2677

Referenced by MimeFilter_CreateInstance(), protocol_start(), and ProtocolEmul_Continue().

◆ MimeProtocol_LockRequest()

static HRESULT WINAPI MimeProtocol_LockRequest ( IInternetProtocolEx iface,
DWORD  dwOptions 
)
static

Definition at line 2497 of file protocol.c.

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}
PVOID LockRequest(PIRP Irp, PIO_STACK_LOCATION IrpSp, BOOLEAN Output, KPROCESSOR_MODE *LockMode)
Definition: lock.c:24
DWORD dwOptions
Definition: solitaire.cpp:25

◆ MimeProtocol_QueryInterface()

static HRESULT WINAPI MimeProtocol_QueryInterface ( IInternetProtocolEx iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 2344 of file protocol.c.

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}
static IInternetProtocolSink mime_protocol_sink
Definition: protocol.c:1374

◆ MimeProtocol_Read()

static HRESULT WINAPI MimeProtocol_Read ( IInternetProtocolEx iface,
void pv,
ULONG  cb,
ULONG pcbRead 
)
static

Definition at line 2464 of file protocol.c.

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}
#define read
Definition: acwin.h:97
#define E_PENDING
Definition: dinput.h:172
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static int read_report_data
Definition: protocol.c:155
_In_ BOOLEAN Read
Definition: strmini.h:479

◆ MimeProtocol_Start()

static HRESULT WINAPI MimeProtocol_Start ( IInternetProtocolEx iface,
LPCWSTR  szUrl,
IInternetProtocolSink pOIProtSink,
IInternetBindInfo pOIBindInfo,
DWORD  grfPI,
HANDLE_PTR  dwReserved 
)
static

Definition at line 2361 of file protocol.c.

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}
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define wine_dbgstr_w
Definition: kernel32.h:34
static const WCHAR pjpegW[]
Definition: protocol.c:145
static IInternetProtocolSink * binding_sink
Definition: protocol.c:159

◆ MimeProtocol_Terminate()

static HRESULT WINAPI MimeProtocol_Terminate ( IInternetProtocolEx iface,
DWORD  dwOptions 
)
static

Definition at line 2448 of file protocol.c.

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}

◆ MimeProtocol_UnlockRequest()

static HRESULT WINAPI MimeProtocol_UnlockRequest ( IInternetProtocolEx iface)
static

Definition at line 2513 of file protocol.c.

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}
VOID UnlockRequest(PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: lock.c:180

◆ MimeProtocolSink_AddRef()

static ULONG WINAPI MimeProtocolSink_AddRef ( IInternetProtocolSink iface)
static

Definition at line 1242 of file protocol.c.

1243{
1244 return 2;
1245}

◆ MimeProtocolSink_QueryInterface()

static HRESULT WINAPI MimeProtocolSink_QueryInterface ( IInternetProtocolSink iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1230 of file protocol.c.

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}

◆ MimeProtocolSink_Release()

static ULONG WINAPI MimeProtocolSink_Release ( IInternetProtocolSink iface)
static

Definition at line 1247 of file protocol.c.

1248{
1249 return 1;
1250}

◆ MimeProtocolSink_ReportData()

static HRESULT WINAPI MimeProtocolSink_ReportData ( IInternetProtocolSink iface,
DWORD  grfBSCF,
ULONG  ulProgress,
ULONG  ulProgressMax 
)
static

Definition at line 1286 of file protocol.c.

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}
static BOOL report_mime
Definition: htmldoc.c:202
static const WCHAR text_htmlW[]
Definition: protocol.c:141

◆ MimeProtocolSink_ReportProgress()

static HRESULT WINAPI MimeProtocolSink_ReportProgress ( IInternetProtocolSink iface,
ULONG  ulStatusCode,
LPCWSTR  szStatusText 
)
static

Definition at line 1266 of file protocol.c.

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}

◆ MimeProtocolSink_ReportResult()

static HRESULT WINAPI MimeProtocolSink_ReportResult ( IInternetProtocolSink iface,
HRESULT  hrResult,
DWORD  dwError,
LPCWSTR  szResult 
)
static

Definition at line 1345 of file protocol.c.

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}
#define ERROR_SUCCESS
Definition: deptool.c:10
#define SUCCEEDED(hr)
Definition: intsafe.h:50

◆ MimeProtocolSink_Switch()

static HRESULT WINAPI MimeProtocolSink_Switch ( IInternetProtocolSink iface,
PROTOCOLDATA *  pProtocolData 
)
static

Definition at line 1252 of file protocol.c.

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}

◆ obj_refcount()

static LONG obj_refcount ( void obj)
static

Definition at line 224 of file protocol.c.

225{
226 IUnknown_AddRef((IUnknown *)obj);
227 return IUnknown_Release((IUnknown *)obj);
228}

Referenced by test_CreateBinding().

◆ outer_AddRef()

static ULONG WINAPI outer_AddRef ( IUnknown iface)
static

Definition at line 4260 of file protocol.c.

4261{
4262 return 2;
4263}

◆ outer_QueryInterface()

static HRESULT WINAPI outer_QueryInterface ( IUnknown iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 4249 of file protocol.c.

4250{
4252 CHECK_EXPECT(outer_QI_test);
4253 *ppv = (IUnknown*)0xdeadbeef;
4254 return S_OK;
4255 }
4256 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
4257 return E_NOINTERFACE;
4258}
static const IID outer_test_iid
Definition: protocol.c:667

◆ outer_Release()

static ULONG WINAPI outer_Release ( IUnknown iface)
static

Definition at line 4265 of file protocol.c.

4266{
4267 return 1;
4268}

◆ Protocol_Abort()

static HRESULT WINAPI Protocol_Abort ( IInternetProtocolEx iface,
HRESULT  hrReason,
DWORD  dwOptions 
)
static

Definition at line 1606 of file protocol.c.

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}

◆ Protocol_AddRef()

static ULONG WINAPI Protocol_AddRef ( IInternetProtocolEx iface)
static

Definition at line 1596 of file protocol.c.

1597{
1598 return 2;
1599}

◆ Protocol_Continue()

static HRESULT WINAPI Protocol_Continue ( IInternetProtocolEx iface,
PROTOCOLDATA *  pProtocolData 
)
static

Definition at line 2441 of file protocol.c.

2443{
2444 CHECK_EXPECT(MimeFilter_Continue);
2445 return E_NOTIMPL;
2446}

◆ Protocol_Release()

static ULONG WINAPI Protocol_Release ( IInternetProtocolEx iface)
static

Definition at line 1601 of file protocol.c.

1602{
1603 return 1;
1604}

◆ Protocol_Resume()

static HRESULT WINAPI Protocol_Resume ( IInternetProtocolEx iface)
static

Definition at line 1627 of file protocol.c.

1628{
1629 ok(0, "unexpected call\n");
1630 return E_NOTIMPL;
1631}

◆ Protocol_Seek()

static HRESULT WINAPI Protocol_Seek ( IInternetProtocolEx iface,
LARGE_INTEGER  dlibMove,
DWORD  dwOrigin,
ULARGE_INTEGER plibNewPosition 
)
static

Definition at line 1633 of file protocol.c.

1635{
1636 ok(0, "unexpected call\n");
1637 return E_NOTIMPL;
1638}

◆ protocol_start()

static void protocol_start ( IInternetProtocolSink pOIProtSink,
IInternetBindInfo pOIBindInfo,
DWORD  pi 
)
static

Definition at line 1779 of file protocol.c.

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}
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
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
static TfClientId tid
static LPCWSTR expect_wsz
Definition: protocol.c:152
static IHttpNegotiate2 http_negotiate
Definition: protocol.c:393
static IServiceProvider service_provider
Definition: protocol.c:495
static DWORD pi
Definition: protocol.c:156
static DWORD WINAPI thread_proc(PVOID arg)
Definition: protocol.c:1692
static const WCHAR emptyW[]
Definition: protocol.c:144

◆ Protocol_Suspend()

static HRESULT WINAPI Protocol_Suspend ( IInternetProtocolEx iface)
static

Definition at line 1621 of file protocol.c.

1622{
1623 ok(0, "unexpected call\n");
1624 return E_NOTIMPL;
1625}

◆ ProtocolEmul_AddRef()

static ULONG WINAPI ProtocolEmul_AddRef ( IInternetProtocolEx iface)
static

Definition at line 1670 of file protocol.c.

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}
static Protocol * impl_from_IInternetProtocolEx(IInternetProtocolEx *iface)
Definition: protocol.c:1640

◆ ProtocolEmul_Continue()

static HRESULT WINAPI ProtocolEmul_Continue ( IInternetProtocolEx iface,
PROTOCOLDATA *  pProtocolData 
)
static

Definition at line 1967 of file protocol.c.

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}
return pTarget Start()
static PROTOCOLDATA protocoldata
Definition: protocol.c:163
#define CHECK_NOT_CALLED(func)
Definition: protocol.c:62
#define INET_E_REDIRECT_FAILED
Definition: winerror.h:4667

◆ ProtocolEmul_LockRequest()

static HRESULT WINAPI ProtocolEmul_LockRequest ( IInternetProtocolEx iface,
DWORD  dwOptions 
)
static

Definition at line 2219 of file protocol.c.

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}

◆ ProtocolEmul_QueryInterface()

static HRESULT WINAPI ProtocolEmul_QueryInterface ( IInternetProtocolEx iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1645 of file protocol.c.

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}

◆ ProtocolEmul_Read()

static HRESULT WINAPI ProtocolEmul_Read ( IInternetProtocolEx iface,
void pv,
ULONG  cb,
ULONG pcbRead 
)
static

Definition at line 2121 of file protocol.c.

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}
#define CHECK_EXPECT2(func)
Definition: protocol.c:44
static void * expect_pv
Definition: protocol.c:160

◆ ProtocolEmul_Release()

static ULONG WINAPI ProtocolEmul_Release ( IInternetProtocolEx iface)
static

Definition at line 1681 of file protocol.c.

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}

◆ ProtocolEmul_Start()

static HRESULT WINAPI ProtocolEmul_Start ( IInternetProtocolEx iface,
LPCWSTR  szUrl,
IInternetProtocolSink pOIProtSink,
IInternetBindInfo pOIBindInfo,
DWORD  grfPI,
HANDLE_PTR  dwReserved 
)
static

Definition at line 1956 of file protocol.c.

1959{
1961
1962 ok(!dwReserved, "dwReserved = %Ix\n", dwReserved);
1963 protocol_start(pOIProtSink, pOIBindInfo, grfPI);
1964 return S_OK;
1965}
#define protocol_start(p, u, e)
Definition: protocol.c:303

◆ ProtocolEmul_StartEx()

static HRESULT WINAPI ProtocolEmul_StartEx ( IInternetProtocolEx iface,
IUri pUri,
IInternetProtocolSink pOIProtSink,
IInternetBindInfo pOIBindInfo,
DWORD  grfPI,
HANDLE dwReserved 
)
static

Definition at line 2237 of file protocol.c.

2240{
2241 CHECK_EXPECT(StartEx);
2242 ok(!dwReserved, "dwReserved = %p\n", dwReserved);
2243 protocol_start(pOIProtSink, pOIBindInfo, grfPI);
2244 return S_OK;
2245}

◆ ProtocolEmul_Terminate()

static HRESULT WINAPI ProtocolEmul_Terminate ( IInternetProtocolEx iface,
DWORD  dwOptions 
)
static

Definition at line 2114 of file protocol.c.

2115{
2116 CHECK_EXPECT(Terminate);
2117 ok(!dwOptions, "dwOptions=%ld\n", dwOptions);
2118 return S_OK;
2119}

◆ ProtocolEmul_UnlockRequest()

static HRESULT WINAPI ProtocolEmul_UnlockRequest ( IInternetProtocolEx iface)
static

Definition at line 2231 of file protocol.c.

2232{
2234 return S_OK;
2235}

◆ ProtocolSink_AddRef()

static ULONG WINAPI ProtocolSink_AddRef ( IInternetProtocolSink iface)
static

Definition at line 634 of file protocol.c.

635{
636 return 2;
637}

◆ ProtocolSink_QueryInterface()

static HRESULT WINAPI ProtocolSink_QueryInterface ( IInternetProtocolSink iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 629 of file protocol.c.

630{
631 return QueryInterface(riid, ppv);
632}
static HRESULT QueryInterface(REFIID, void **)
Definition: protocol.c:1376

◆ ProtocolSink_Release()

static ULONG WINAPI ProtocolSink_Release ( IInternetProtocolSink iface)
static

Definition at line 639 of file protocol.c.

640{
641 return 1;
642}

◆ ProtocolSink_ReportData()

static HRESULT WINAPI ProtocolSink_ReportData ( IInternetProtocolSink iface,
DWORD  grfBSCF,
ULONG  ulProgress,
ULONG  ulProgressMax 
)
static

Definition at line 999 of file protocol.c.

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}
#define broken(x)
Definition: atltest.h:178
static void test_http_info(IInternetProtocol *protocol)
Definition: protocol.c:966
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:669
uint32_t ULONG
Definition: typedefs.h:59

◆ ProtocolSink_ReportProgress()

static HRESULT WINAPI ProtocolSink_ReportProgress ( IInternetProtocolSink iface,
ULONG  ulStatusCode,
LPCWSTR  szStatusText 
)
static

Definition at line 826 of file protocol.c.

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}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define L(x)
Definition: resources.c:13
static LPCWSTR file_name
Definition: protocol.c:152
static const char * status_names[]
Definition: protocol.c:769
static const WCHAR gifW[]
Definition: protocol.c:146

◆ ProtocolSink_ReportResult()

static HRESULT WINAPI ProtocolSink_ReportResult ( IInternetProtocolSink iface,
HRESULT  hrResult,
DWORD  dwError,
LPCWSTR  szResult 
)
static

Definition at line 1187 of file protocol.c.

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}

◆ ProtocolSink_Switch()

static HRESULT WINAPI ProtocolSink_Switch ( IInternetProtocolSink iface,
PROTOCOLDATA *  pProtocolData 
)
static

Definition at line 731 of file protocol.c.

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}
static void call_continue(PROTOCOLDATA *protocol_data)
Definition: protocol.c:644
static PROTOCOLDATA continue_protdata
Definition: protocol.c:163
static PROTOCOLDATA * pdata
Definition: protocol.c:163
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define WAIT_OBJECT_0
Definition: winbase.h:383

◆ ProtocolUnk_AddRef()

static ULONG WINAPI ProtocolUnk_AddRef ( IUnknown iface)
static

Definition at line 2314 of file protocol.c.

2315{
2317 return ++This->inner_ref;
2318}
static MimeHtmlProtocol * impl_from_IUnknown(IUnknown *iface)
Definition: protocol.c:351

◆ ProtocolUnk_QueryInterface()

static HRESULT WINAPI ProtocolUnk_QueryInterface ( IUnknown iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 2269 of file protocol.c.

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}

◆ ProtocolUnk_Release()

static ULONG WINAPI ProtocolUnk_Release ( IUnknown iface)
static

Definition at line 2320 of file protocol.c.

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}
#define free
Definition: debug_ros.c:5
long LONG
Definition: pedump.c:60
Definition: send.c:48

◆ QueryInterface()

static HRESULT QueryInterface ( REFIID  riid,
void **  ppv 
)
static

Definition at line 1376 of file protocol.c.

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}

Referenced by ProtocolSink_QueryInterface(), and ServiceProvider_QueryInterface().

◆ register_filter()

static void register_filter ( BOOL  do_register)
static

Definition at line 2717 of file protocol.c.

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}
static IClassFactory mimefilter_cf
Definition: protocol.c:2696

Referenced by init_test().

◆ ServiceProvider_AddRef()

static ULONG WINAPI ServiceProvider_AddRef ( IServiceProvider iface)
static

Definition at line 435 of file protocol.c.

436{
437 return 2;
438}

◆ ServiceProvider_QueryInterface()

static HRESULT WINAPI ServiceProvider_QueryInterface ( IServiceProvider iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 430 of file protocol.c.

431{
432 return QueryInterface(riid, ppv);
433}

◆ ServiceProvider_QueryService()

static HRESULT WINAPI ServiceProvider_QueryService ( IServiceProvider iface,
REFGUID  guidService,
REFIID  riid,
void **  ppv 
)
static

Definition at line 445 of file protocol.c.

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}
static IHttpSecurity http_security
Definition: protocol.c:292
static IBindCallbackRedirect redirect_callback
Definition: protocol.c:426

◆ ServiceProvider_Release()

static ULONG WINAPI ServiceProvider_Release ( IServiceProvider iface)
static

Definition at line 440 of file protocol.c.

441{
442 return 1;
443}

◆ START_TEST()

START_TEST ( protocol  )

Definition at line 4309 of file protocol.c.

4310{
4311 HMODULE hurlmon;
4312
4313 hurlmon = GetModuleHandleA("urlmon.dll");
4314 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
4315 pReleaseBindInfo = (void*) GetProcAddress(hurlmon, "ReleaseBindInfo");
4316 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
4317
4318 if(!GetProcAddress(hurlmon, "CompareSecurityIds")) {
4319 win_skip("Various needed functions not present, too old IE\n");
4320 return;
4321 }
4322
4323 if(!pCreateUri)
4324 win_skip("CreateUri not supported\n");
4325
4327
4333
4336#ifdef __REACTOS__
4337 if (!is_reactos() && (GetNTVersion() < _WIN32_WINNT_WIN7))
4338 {
4339 win_skip("Skipping test that runs forever on Windows Vista\n");
4340 }
4341 else
4342 {
4343#endif
4344 if(pCreateUri)
4346 else
4347 win_skip("Skipping https tests on too old platform\n");
4348#ifdef __REACTOS__
4349 }
4350#endif
4358
4359 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_NOWRITECACHE | BINDF_PULLDATA;
4360 trace("Testing file binding (mime verification, emulate prot)...\n");
4361 test_binding(FILE_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT);
4362 trace("Testing http binding (mime verification, emulate prot)...\n");
4363 test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT);
4364 trace("Testing its binding (mime verification, emulate prot)...\n");
4365 test_binding(ITS_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT);
4366 trace("Testing http binding (mime verification, emulate prot, short read, direct read)...\n");
4368 trace("Testing http binding (mime verification, redirect, emulate prot)...\n");
4370 trace("Testing http binding (mime verification, redirect, disable auto redirect, emulate prot)...\n");
4372 trace("Testing file binding (mime verification, emulate prot, mime filter)...\n");
4373 test_binding(FILE_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_FILTER);
4374 trace("Testing http binding (mime verification, emulate prot, mime filter)...\n");
4375 test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_FILTER);
4376 trace("Testing http binding (mime verification, emulate prot, mime filter, no mime)...\n");
4378 trace("Testing http binding (mime verification, emulate prot, direct read)...\n");
4380 trace("Testing http binding (mime verification, emulate prot, abort)...\n");
4381 test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_ABORT);
4382 trace("Testing its binding (mime verification, emulate prot, apartment thread)...\n");
4383 test_binding(ITS_TEST, PI_MIMEVERIFICATION | PI_APARTMENTTHREADED, TEST_EMULATEPROT | TEST_RESULTFROMLOCK);
4384 if(pCreateUri) {
4385 trace("Testing file binding (use IUri, mime verification, emulate prot)...\n");
4386 test_binding(FILE_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_USEIURI);
4387 trace("Testing file binding (use IUri, impl StartEx, mime verification, emulate prot)...\n");
4389 trace("Testing file binding (impl StartEx, mime verification, emulate prot)...\n");
4391 }
4392
4397
4398 test_com_aggregation(&CLSID_FileProtocol);
4399 test_com_aggregation(&CLSID_HttpProtocol);
4400 test_com_aggregation(&CLSID_HttpSProtocol);
4401 test_com_aggregation(&CLSID_FtpProtocol);
4402 test_com_aggregation(&CLSID_MkProtocol);
4403
4405}
#define GetNTVersion()
Definition: apitest.h:17
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:162
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:218
static void test_mk_protocol(void)
Definition: protocol.c:614
static void test_com_aggregation(const CLSID *clsid)
Definition: protocol.c:696
static void test_file_protocol(void)
Definition: protocol.c:3094
static void test_http_protocol(void)
Definition: protocol.c:3563
static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
Definition: protocol.c:4090
static void test_CreateBinding(void)
Definition: protocol.c:3858
static void test_ftp_protocol(void)
Definition: protocol.c:3652
static void test_https_protocol(void)
Definition: protocol.c:3640
static void test_gopher_protocol(void)
Definition: protocol.c:3751
#define TEST_USEIURI
Definition: protocol.c:2708
static DWORD thread_id
Definition: protocol.c:164
#define _WIN32_WINNT_WIN7
Definition: sdkddkver.h:28
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459

◆ Stream_AddRef()

static ULONG WINAPI Stream_AddRef ( IStream iface)
static

Definition at line 508 of file protocol.c.

509{
510 return 2;
511}

◆ Stream_Clone()

static HRESULT WINAPI Stream_Clone ( IStream iface,
IStream **  ppstm 
)
static

Definition at line 604 of file protocol.c.

605{
606 ok(0, "unexpected call\n");
607 return E_NOTIMPL;
608}

◆ Stream_Commit()

static HRESULT WINAPI Stream_Commit ( IStream iface,
DWORD  grfCommitFlags 
)
static

Definition at line 571 of file protocol.c.

572{
573 ok(0, "unexpected call\n");
574 return E_NOTIMPL;
575}

◆ Stream_CopyTo()

static HRESULT WINAPI Stream_CopyTo ( IStream iface,
IStream pstm,
ULARGE_INTEGER  cb,
ULARGE_INTEGER pcbRead,
ULARGE_INTEGER pcbWritten 
)
static

Definition at line 564 of file protocol.c.

566{
567 ok(0, "unexpected call\n");
568 return E_NOTIMPL;
569}

◆ Stream_LockRegion()

static HRESULT WINAPI Stream_LockRegion ( IStream iface,
ULARGE_INTEGER  libOffset,
ULARGE_INTEGER  cb,
DWORD  dwLockType 
)
static

Definition at line 583 of file protocol.c.

585{
586 ok(0, "unexpected call\n");
587 return E_NOTIMPL;
588}

◆ Stream_QueryInterface()

static HRESULT WINAPI Stream_QueryInterface ( IStream iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 497 of file protocol.c.

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}

◆ Stream_Read()

static HRESULT WINAPI Stream_Read ( IStream iface,
void pv,
ULONG  cb,
ULONG pcbRead 
)
static

Definition at line 518 of file protocol.c.

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}

Referenced by call_continue(), and Stream_Read().

◆ Stream_Release()

static ULONG WINAPI Stream_Release ( IStream iface)
static

Definition at line 513 of file protocol.c.

514{
515 return 1;
516}

◆ Stream_Revert()

static HRESULT WINAPI Stream_Revert ( IStream iface)
static

Definition at line 577 of file protocol.c.

578{
579 ok(0, "unexpected call\n");
580 return E_NOTIMPL;
581}

◆ Stream_Seek()

static HRESULT WINAPI Stream_Seek ( IStream iface,
LARGE_INTEGER  dlibMove,
DWORD  dwOrigin,
ULARGE_INTEGER plibNewPosition 
)
static

Definition at line 546 of file protocol.c.

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}

Referenced by http_protocol_start(), and Stream_Seek().

◆ Stream_SetSize()

static HRESULT WINAPI Stream_SetSize ( IStream iface,
ULARGE_INTEGER  libNewSize 
)
static

Definition at line 558 of file protocol.c.

559{
560 ok(0, "unexpected call\n");
561 return E_NOTIMPL;
562}

◆ Stream_Stat()

static HRESULT WINAPI Stream_Stat ( IStream iface,
STATSTG *  pstatstg,
DWORD  dwStatFlag 
)
static

Definition at line 597 of file protocol.c.

599{
600 ok(0, "unexpected call\n");
601 return E_NOTIMPL;
602}

◆ Stream_UnlockRegion()

static HRESULT WINAPI Stream_UnlockRegion ( IStream iface,
ULARGE_INTEGER  libOffset,
ULARGE_INTEGER  cb,
DWORD  dwLockType 
)
static

Definition at line 590 of file protocol.c.

592{
593 ok(0, "unexpected call\n");
594 return E_NOTIMPL;
595}

◆ Stream_Write()

static HRESULT WINAPI Stream_Write ( IStream iface,
const void pv,
ULONG  cb,
ULONG pcbWritten 
)
static

Definition at line 539 of file protocol.c.

541{
542 ok(0, "unexpected call\n");
543 return E_NOTIMPL;
544}

◆ test_binding()

static void test_binding ( int  prot,
DWORD  grf_pi,
DWORD  test_flags 
)
static

Definition at line 4090 of file protocol.c.

4091{
4092 IInternetProtocolEx *protocolex = NULL;
4095 IUri *uri = NULL;
4096 ULONG ref;
4097 HRESULT hres;
4098
4099 pi = grf_pi;
4100
4101 init_test(prot, test_flags|TEST_BINDING);
4102
4103 hres = pCoInternetGetSession(0, &session, 0);
4104 ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
4105
4106 if(test_flags & TEST_EMULATEPROT) {
4107 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL, protocol_names[prot], 0, NULL, 0);
4108 ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
4109 }
4110
4111 hres = IInternetSession_CreateBinding(session, NULL, binding_urls[prot], NULL, NULL, &protocol, 0);
4113 ok(hres == S_OK, "CreateBinding failed: %08lx\n", hres);
4114 ok(protocol != NULL, "protocol == NULL\n");
4115
4116 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetBindInfo, (void**)&prot_bind_info);
4117 ok(hres == S_OK, "QueryInterface(IID_IInternetBindInfo) failed: %08lx\n", hres);
4118
4119 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolSink, (void**)&binding_sink);
4120 ok(hres == S_OK, "QueryInterface(IID_IInternetProtocolSink) failed: %08lx\n", hres);
4121
4122 if(test_flags & TEST_USEIURI) {
4123 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolEx, (void**)&protocolex);
4124 ok(hres == S_OK, "Could not get IInternetProtocolEx iface: %08lx\n", hres);
4125
4126 hres = pCreateUri(binding_urls[prot], Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri);
4127 ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
4128 }
4129
4130 ex_priority = 0;
4131 SET_EXPECT(QueryService_InternetProtocol);
4133 SET_EXPECT(ReportProgress_PROTOCOLCLASSID);
4135 if(impl_protex)
4136 SET_EXPECT(StartEx);
4137 else
4139
4141
4142 if(protocolex) {
4143 hres = IInternetProtocolEx_StartEx(protocolex, uri, &protocol_sink, &bind_info, pi, 0);
4144 ok(hres == S_OK, "StartEx failed: %08lx\n", hres);
4145 }else {
4146 hres = IInternetProtocol_Start(protocol, binding_urls[prot], &protocol_sink, &bind_info, pi, 0);
4147 ok(hres == S_OK, "Start failed: %08lx\n", hres);
4148 }
4149
4150 CHECK_CALLED(QueryService_InternetProtocol);
4152 CHECK_CALLED(ReportProgress_PROTOCOLCLASSID);
4153 CLEAR_CALLED(SetPriority); /* IE11 does not call it. */
4154 if(impl_protex)
4155 CHECK_CALLED(StartEx);
4156 else
4158
4159 if(protocolex)
4160 IInternetProtocolEx_Release(protocolex);
4161 if(uri)
4162 IUri_Release(uri);
4163
4164 if(prot == HTTP_TEST || prot == HTTPS_TEST) {
4165 while(prot_state < 4) {
4166 ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
4168 SET_EXPECT(Continue);
4169 IInternetProtocol_Continue(filtered_protocol, pdata);
4170 CHECK_CALLED(Continue);
4171 }else {
4172 SET_EXPECT(Continue);
4173 IInternetProtocol_Continue(protocol, pdata);
4174 CHECK_CALLED(Continue);
4175 }
4176 if(test_abort && prot_state == 2) {
4177 SET_EXPECT(Abort);
4178 hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
4179 ok(hres == S_OK, "Abort failed: %08lx\n", hres);
4180 CHECK_CALLED(Abort);
4181
4182 hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
4183 ok(hres == S_OK, "Abort failed: %08lx\n", hres);
4185 break;
4186 }
4188 }
4189 if(direct_read)
4190 CHECK_CALLED(ReportData); /* Set in ReportResult */
4191 ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
4192 }else {
4193 if(!result_from_lock) {
4194 if(mimefilter_test)
4195 SET_EXPECT(MimeFilter_LockRequest);
4196 else
4198 hres = IInternetProtocol_LockRequest(protocol, 0);
4199 ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
4200 if(mimefilter_test)
4201 CHECK_CALLED(MimeFilter_LockRequest);
4202 else
4204 }
4205
4206 if(mimefilter_test)
4207 SET_EXPECT(MimeFilter_UnlockRequest);
4208 else
4210 hres = IInternetProtocol_UnlockRequest(protocol);
4211 ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
4212 if(mimefilter_test)
4213 CHECK_CALLED(MimeFilter_UnlockRequest);
4214 else
4216 }
4217
4218 if(mimefilter_test)
4219 SET_EXPECT(MimeFilter_Terminate);
4220 else
4221 SET_EXPECT(Terminate);
4222 hres = IInternetProtocol_Terminate(protocol, 0);
4223 ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
4224 if(mimefilter_test)
4225 CLEAR_CALLED(MimeFilter_Terminate);
4226 else
4227 CHECK_CALLED(Terminate);
4228
4230 IInternetProtocol_Release(filtered_protocol);
4231 IInternetBindInfo_Release(prot_bind_info);
4232 IInternetProtocolSink_Release(binding_sink);
4233
4234 SET_EXPECT(Protocol_destructor);
4235 ref = IInternetProtocol_Release(protocol);
4236 ok(!ref, "ref=%lu, expected 0\n", ref);
4237 CHECK_CALLED(Protocol_destructor);
4238
4239 if(test_flags & TEST_EMULATEPROT) {
4240 hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, protocol_names[prot]);
4241 ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
4242 }
4243
4244 IInternetSession_Release(session);
4245}
static const WCHAR protocol_names[][10]
Definition: protocol.c:198
#define IID_NULL
Definition: guiddef.h:98
static void init_test(void)
Definition: shlexec.c:2649

Referenced by START_TEST().

◆ test_com_aggregation()

static void test_com_aggregation ( const CLSID clsid)
static

Definition at line 4276 of file protocol.c.

4277{
4278 IUnknown outer = { &outer_vtbl };
4280 IUnknown *unk, *unk2, *unk3;
4281 HRESULT hres;
4282
4283 hres = CoGetClassObject(clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&class_factory);
4284 ok(hres == S_OK, "CoGetClassObject failed: %08lx\n", hres);
4285
4286 hres = IClassFactory_CreateInstance(class_factory, &outer, &IID_IUnknown, (void**)&unk);
4287 ok(hres == S_OK, "CreateInstance returned: %08lx\n", hres);
4288
4289 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocol, (void**)&unk2);
4290 ok(hres == S_OK, "Could not get IDispatch iface: %08lx\n", hres);
4291
4292 SET_EXPECT(outer_QI_test);
4293 hres = IUnknown_QueryInterface(unk2, &outer_test_iid, (void**)&unk3);
4294 CHECK_CALLED(outer_QI_test);
4295 ok(hres == S_OK, "Could not get IInternetProtocol iface: %08lx\n", hres);
4296 ok(unk3 == (IUnknown*)0xdeadbeef, "unexpected unk2\n");
4297
4298 IUnknown_Release(unk2);
4299 IUnknown_Release(unk);
4300
4301 unk = (void*)0xdeadbeef;
4302 hres = IClassFactory_CreateInstance(class_factory, &outer, &IID_IInternetProtocol, (void**)&unk);
4303 ok(hres == CLASS_E_NOAGGREGATION, "CreateInstance returned: %08lx\n", hres);
4304 ok(!unk, "unk = %p\n", unk);
4305
4306 IClassFactory_Release(class_factory);
4307}
const GUID IID_IClassFactory
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD clscontext, COSERVERINFO *server_info, REFIID riid, void **obj)
Definition: combase.c:1925
static const IUnknownVtbl outer_vtbl
Definition: protocol.c:690
const CLSID * clsid
Definition: msctf.cpp:50

◆ test_CreateBinding()

static void test_CreateBinding ( void  )
static

Definition at line 3858 of file protocol.c.

3859{
3863 IWinInetHttpInfo *http_info;
3864 IWinInetInfo *inet_info;
3865 LONG p;
3866 BYTE buf[1000];
3867 DWORD read;
3868 HRESULT hres;
3869
3870 static const WCHAR test_url[] =
3871 {'t','e','s','t',':','/','/','f','i','l','e','.','h','t','m','l',0};
3872 static const WCHAR wsz_test[] = {'t','e','s','t',0};
3873
3874 trace("Testing CreateBinding%s...\n", no_aggregation ? "(no aggregation)" : "");
3876
3877 hres = pCoInternetGetSession(0, &session, 0);
3878 ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
3879
3880 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL, wsz_test, 0, NULL, 0);
3881 ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
3882
3883 hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0);
3885 ok(hres == S_OK, "CreateBinding failed: %08lx\n", hres);
3886 ok(protocol != NULL, "protocol == NULL\n");
3887
3888 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetBindInfo, (void**)&prot_bind_info);
3889 ok(hres == S_OK, "QueryInterface(IID_IInternetBindInfo) failed: %08lx\n", hres);
3890
3891 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolSink, (void**)&binding_sink);
3892 ok(hres == S_OK, "Could not get IInternetProtocolSink: %08lx\n", hres);
3893
3894 hres = IInternetProtocol_Start(protocol, test_url, NULL, &bind_info, 0, 0);
3895 ok(hres == E_INVALIDARG, "Start failed: %08lx, expected E_INVALIDARG\n", hres);
3896 hres = IInternetProtocol_Start(protocol, test_url, &protocol_sink, NULL, 0, 0);
3897 ok(hres == E_INVALIDARG, "Start failed: %08lx, expected E_INVALIDARG\n", hres);
3898 hres = IInternetProtocol_Start(protocol, NULL, &protocol_sink, &bind_info, 0, 0);
3899 ok(hres == E_INVALIDARG, "Start failed: %08lx, expected E_INVALIDARG\n", hres);
3900
3901 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority, (void**)&priority);
3902 ok(hres == S_OK, "QueryInterface(IID_IInternetPriority) failed: %08lx\n", hres);
3903
3904 p = 0xdeadbeef;
3905 hres = IInternetPriority_GetPriority(priority, &p);
3906 ok(hres == S_OK, "GetPriority failed: %08lx\n", hres);
3907 ok(!p, "p=%ld\n", p);
3908
3909 ex_priority = 100;
3910 hres = IInternetPriority_SetPriority(priority, 100);
3911 ok(hres == S_OK, "SetPriority failed: %08lx\n", hres);
3912
3913 p = 0xdeadbeef;
3914 hres = IInternetPriority_GetPriority(priority, &p);
3915 ok(hres == S_OK, "GetPriority failed: %08lx\n", hres);
3916 ok(p == 100, "p=%ld\n", p);
3917
3918 hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
3919 ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08lx\n", hres);
3920
3921 SET_EXPECT(QueryService_InternetProtocol);
3922
3924 if(no_aggregation) {
3925 SET_EXPECT(CreateInstance_no_aggregation);
3926 SET_EXPECT(StartEx);
3927 }else {
3929 }
3930
3931 SET_EXPECT(ReportProgress_PROTOCOLCLASSID);
3933
3934 ok(obj_refcount(protocol) == 4, "wrong protocol refcount %ld\n", obj_refcount(protocol));
3935
3937 hres = IInternetProtocol_Start(protocol, test_url, &protocol_sink, &bind_info, 0, 0);
3938 ok(hres == S_OK, "Start failed: %08lx\n", hres);
3939
3940 CHECK_CALLED(QueryService_InternetProtocol);
3941
3943 if(no_aggregation) {
3944 CHECK_CALLED(CreateInstance_no_aggregation);
3945 ok(obj_refcount(protocol) == 4, "wrong protocol refcount %ld\n", obj_refcount(protocol));
3946 ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %lu\n", protocol_emul->outer_ref);
3947 }else {
3948 ok(obj_refcount(protocol) == 5 || broken(obj_refcount(protocol) == 4) /* before win7 */, "wrong protocol refcount %ld\n",
3950 ok(protocol_emul->outer_ref == 1 || broken(protocol_emul->outer_ref == 0) /* before win7 */, "protocol_outer_ref = %lu\n",
3952 }
3953
3954 CHECK_CALLED(ReportProgress_PROTOCOLCLASSID);
3956 if(no_aggregation)
3957 CHECK_CALLED(StartEx);
3958 else
3960
3961 if(!no_aggregation)
3962 SET_EXPECT(QueryInterface_IWinInetInfo);
3963 hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
3964 ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08lx\n", hres);
3965 if(!no_aggregation)
3966 CHECK_CALLED(QueryInterface_IWinInetInfo);
3967
3968 if(!no_aggregation)
3969 SET_EXPECT(QueryInterface_IWinInetInfo);
3970 hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
3971 ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08lx\n", hres);
3972 if(!no_aggregation)
3973 CHECK_CALLED(QueryInterface_IWinInetInfo);
3974
3975 if(!no_aggregation)
3976 SET_EXPECT(QueryInterface_IWinInetHttpInfo);
3977 hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&http_info);
3978 ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08lx\n", hres);
3979 if(!no_aggregation)
3980 CHECK_CALLED(QueryInterface_IWinInetHttpInfo);
3981
3983 read = 0xdeadbeef;
3984 hres = IInternetProtocol_Read(protocol, expect_pv = buf, sizeof(buf), &read);
3985 ok(hres == S_OK, "Read failed: %08lx\n", hres);
3986 ok(read == 100, "read = %ld\n", read);
3988
3990 read = 0xdeadbeef;
3991 hres = IInternetProtocol_Read(protocol, expect_pv = buf, sizeof(buf), &read);
3992 ok(hres == S_FALSE, "Read failed: %08lx\n", hres);
3993 ok(!read, "read = %ld\n", read);
3995
3996 p = 0xdeadbeef;
3997 hres = IInternetPriority_GetPriority(priority, &p);
3998 ok(hres == S_OK, "GetPriority failed: %08lx\n", hres);
3999 ok(p == 100, "p=%ld\n", p);
4000
4001 hres = IInternetPriority_SetPriority(priority, 101);
4002 ok(hres == S_OK, "SetPriority failed: %08lx\n", hres);
4003
4004 if(no_aggregation) {
4005 ok(obj_refcount(protocol) == 4, "wrong protocol refcount %ld\n", obj_refcount(protocol));
4006 ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %lu\n", protocol_emul->outer_ref);
4007 }else {
4008 ok(obj_refcount(protocol) == 5 || broken(obj_refcount(protocol) == 4) /* before win7 */, "wrong protocol refcount %ld\n", obj_refcount(protocol));
4009 ok(protocol_emul->outer_ref == 1 || broken(protocol_emul->outer_ref == 0) /* before win7 */, "protocol_outer_ref = %lu\n", protocol_emul->outer_ref);
4010 }
4011
4012 SET_EXPECT(Terminate);
4013 hres = IInternetProtocol_Terminate(protocol, 0xdeadbeef);
4014 ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
4015 CHECK_CALLED(Terminate);
4016
4017 ok(obj_refcount(protocol) == 4, "wrong protocol refcount %ld\n", obj_refcount(protocol));
4018 ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %lu\n", protocol_emul->outer_ref);
4019
4020 SET_EXPECT(Continue);
4021 hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
4022 ok(hres == S_OK, "Switch failed: %08lx\n", hres);
4023 CHECK_CALLED(Continue);
4024
4026 read = 0xdeadbeef;
4027 hres = IInternetProtocol_Read(protocol, expect_pv = buf, sizeof(buf), &read);
4028 if(no_aggregation) {
4029 ok(hres == S_OK, "Read failed: %08lx\n", hres);
4030 ok(read == 100, "read = %ld\n", read);
4032 }else {
4033 todo_wine
4034 ok(hres == E_ABORT, "Read failed: %08lx\n", hres);
4035 todo_wine
4036 ok(read == 0, "read = %ld\n", read);
4037 todo_wine
4039 }
4040
4041 hres = IInternetProtocolSink_ReportProgress(binding_sink,
4042 BINDSTATUS_CACHEFILENAMEAVAILABLE, expect_wsz = emptyW);
4043 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08lx\n", hres);
4044
4045 hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
4046 ok(hres == E_FAIL, "ReportResult failed: %08lx, expected E_FAIL\n", hres);
4047
4048 hres = IInternetProtocolSink_ReportData(binding_sink, 0, 0, 0);
4049 ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
4050
4051 IInternetProtocolSink_Release(binding_sink);
4052 IInternetPriority_Release(priority);
4053 IInternetBindInfo_Release(prot_bind_info);
4054
4055 ok(obj_refcount(protocol) == 1, "wrong protocol refcount %ld\n", obj_refcount(protocol));
4056
4057 SET_EXPECT(Protocol_destructor);
4058 IInternetProtocol_Release(protocol);
4059 CHECK_CALLED(Protocol_destructor);
4060
4061 hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0);
4062 ok(hres == S_OK, "CreateBinding failed: %08lx\n", hres);
4063 ok(protocol != NULL, "protocol == NULL\n");
4064
4065 hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
4066 ok(hres == S_OK, "Abort failed: %08lx\n", hres);
4067
4068 hres = IInternetProtocol_Abort(protocol, E_FAIL, 0);
4069 ok(hres == S_OK, "Abort failed: %08lx\n", hres);
4070
4071 IInternetProtocol_Release(protocol);
4072
4073 hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, wsz_test);
4074 ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
4075
4076 hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0);
4077 ok(hres == S_OK, "CreateBinding failed: %08lx\n", hres);
4078 ok(protocol != NULL, "protocol == NULL\n");
4079
4080 SET_EXPECT(QueryService_InternetProtocol);
4081 hres = IInternetProtocol_Start(protocol, test_url, &protocol_sink, &bind_info, 0, 0);
4082 ok(hres == MK_E_SYNTAX, "Start failed: %08lx, expected MK_E_SYNTAX\n", hres);
4083 CHECK_CALLED(QueryService_InternetProtocol);
4084
4085 IInternetProtocol_Release(protocol);
4086
4087 IInternetSession_Release(session);
4088}
#define E_INVALIDARG
Definition: ddrawi.h:101
GLfloat GLfloat p
Definition: glext.h:8902
static LONG obj_refcount(void *obj)
Definition: protocol.c:224
static const char test_url[]
Definition: urlcache.c:37
static int priority
Definition: timer.c:163
LONG outer_ref
Definition: protocol.c:193
#define MK_E_SYNTAX
Definition: winerror.h:3896

Referenced by START_TEST().

◆ test_early_abort()

static void test_early_abort ( const CLSID clsid)
static

Definition at line 2811 of file protocol.c.

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}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685

Referenced by test_ftp_protocol(), test_gopher_protocol(), and test_http_protocol().

◆ test_file_protocol()

static void test_file_protocol ( void  )
static

Definition at line 3094 of file protocol.c.

3094 {
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}
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define SetLastError(x)
Definition: compat.h:752
#define CreateFileW
Definition: compat.h:741
#define lstrcpyW
Definition: compat.h:749
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
GLenum GLsizei len
Definition: glext.h:6722
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
IHTMLDocument2 * html_doc
Definition: xmlview.c:53
static void test_file_protocol_fail(void)
Definition: protocol.c:3020
static void test_file_protocol_url(LPCWSTR url)
Definition: protocol.c:2881
static const WCHAR wszIndexHtml[]
Definition: protocol.c:135
static const WCHAR index_url[]
Definition: protocol.c:136
static const WCHAR wszFile[]
Definition: urlmon_main.c:386
#define INTERNET_MAX_URL_LENGTH
Definition: wininet.h:51

Referenced by START_TEST().

◆ test_file_protocol_fail()

static void test_file_protocol_fail ( void  )
static

Definition at line 3020 of file protocol.c.

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}

Referenced by test_file_protocol().

◆ test_file_protocol_url()

static void test_file_protocol_url ( LPCWSTR  url)
static

Definition at line 2881 of file protocol.c.

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}
#define todo_wine_if(is_todo)
Definition: minitest.h:81
static BOOL file_protocol_start(IInternetProtocol *protocol, LPCWSTR url, IInternetProtocolEx *protocolex, IUri *uri, BOOL is_first)
Definition: protocol.c:2829
Definition: main.c:439

Referenced by test_file_protocol().

◆ test_ftp_protocol()

static void test_ftp_protocol ( void  )
static

Definition at line 3652 of file protocol.c.

3653{
3656 IUnknown *unk;
3657 BYTE buf[4096];
3658 ULONG ref;
3659 DWORD cb, ret;
3660 HRESULT hres;
3661
3662 static const WCHAR ftp_urlW[] = {'f','t','p',':','/','/','f','t','p','.','w','i','n','e','h','q','.','o','r','g',
3663 '/','p','u','b','/','o','t','h','e','r','/',
3664 'w','i','n','e','l','o','g','o','.','x','c','f','.','t','a','r','.','b','z','2',0};
3665
3666 trace("Testing ftp protocol...\n");
3667
3668 init_test(FTP_TEST, 0);
3669
3670 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3673
3674 hres = CoGetClassObject(&CLSID_FtpProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
3675 ok(hres == S_OK, "CoGetClassObject failed: %08lx\n", hres);
3676 if(FAILED(hres))
3677 return;
3678
3679 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
3680 ok(hres == E_NOINTERFACE, "Could not get IInternetProtocolInfo interface: %08lx, expected E_NOINTERFACE\n", hres);
3681
3682 hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
3683 ok(hres == S_OK, "Could not get IClassFactory interface\n");
3684 IUnknown_Release(unk);
3685 if(FAILED(hres))
3686 return;
3687
3688 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
3689 (void**)&async_protocol);
3690 IClassFactory_Release(factory);
3691 ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
3692
3694
3695 SET_EXPECT(GetBindInfo);
3696 SET_EXPECT(ReportProgress_FINDINGRESOURCE);
3697 SET_EXPECT(ReportProgress_CONNECTING);
3698 SET_EXPECT(ReportProgress_SENDINGREQUEST);
3699 SET_EXPECT(Switch);
3700
3701 hres = IInternetProtocol_Start(async_protocol, ftp_urlW, &protocol_sink, &bind_info, 0, 0);
3702 ok(hres == S_OK, "Start failed: %08lx\n", hres);
3703 CHECK_CALLED(GetBindInfo);
3704
3705 SET_EXPECT(ReportResult);
3706
3707 hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
3708 ok((hres == E_PENDING && cb==0) ||
3709 (hres == S_OK && cb==1), "Read failed: %08lx (%ld bytes)\n", hres, cb);
3710
3712 if (ret != WAIT_OBJECT_0)
3713 {
3714 skip( "FTP protocol timed out\n" );
3715 IInternetProtocol_Release(async_protocol);
3716 return;
3717 }
3718
3719 while(1) {
3720 hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
3721 if(hres == E_PENDING)
3722 {
3724 ok( ret == WAIT_OBJECT_0, "wait timed out\n" );
3725 if (ret != WAIT_OBJECT_0) break;
3726 }
3727 else
3728 if(cb == 0) break;
3729 }
3730
3731 ok(hres == S_FALSE, "Read failed: %08lx\n", hres);
3732 CHECK_CALLED(ReportResult);
3733 CHECK_CALLED(Switch);
3734
3736
3737 if(pCreateUri) {
3738 IInternetProtocolEx *protocolex;
3739
3740 hres = IInternetProtocol_QueryInterface(async_protocol, &IID_IInternetProtocolEx, (void**)&protocolex);
3741 ok(hres == S_OK, "Could not get IInternetProtocolEx iface: %08lx\n", hres);
3742 IInternetProtocolEx_Release(protocolex);
3743 }
3744
3745 ref = IInternetProtocol_Release(async_protocol);
3746 ok(!ref, "ref=%ld\n", ref);
3747
3748 test_early_abort(&CLSID_FtpProtocol);
3749}
#define skip(...)
Definition: atltest.h:64
static void test_protocol_terminate(IInternetProtocol *protocol)
Definition: protocol.c:3328
static void test_early_abort(const CLSID *clsid)
Definition: protocol.c:2811
static void test_priority(void)
Definition: timer.c:174

Referenced by START_TEST().

◆ test_gopher_protocol()

static void test_gopher_protocol ( void  )
static

Definition at line 3751 of file protocol.c.

3752{
3755 IUnknown *unk;
3756 HRESULT hres;
3757
3758 trace("Testing gopher protocol...\n");
3759
3760 hres = CoGetClassObject(&CLSID_GopherProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
3761 ok(hres == S_OK ||
3762 broken(hres == REGDB_E_CLASSNOTREG || hres == CLASS_E_CLASSNOTAVAILABLE), /* Gopher protocol has been removed as of Vista */
3763 "CoGetClassObject failed: %08lx\n", hres);
3764 if(FAILED(hres))
3765 return;
3766
3767 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
3768 ok(hres == E_NOINTERFACE, "Could not get IInternetProtocolInfo interface: %08lx, expected E_NOINTERFACE\n", hres);
3769
3770 hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
3771 ok(hres == S_OK, "Could not get IClassFactory interface\n");
3772 IUnknown_Release(unk);
3773 if(FAILED(hres))
3774 return;
3775
3776 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
3777 (void**)&async_protocol);
3778 IClassFactory_Release(factory);
3779 ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
3780
3782
3783 IInternetProtocol_Release(async_protocol);
3784
3785 test_early_abort(&CLSID_GopherProtocol);
3786}
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:3801
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:3772

Referenced by START_TEST().

◆ test_http_info()

static void test_http_info ( IInternetProtocol protocol)
static

Definition at line 966 of file protocol.c.

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}
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
strcpy
Definition: string.h:131
#define HTTP_QUERY_CUSTOM
Definition: wininet.h:1603

Referenced by ProtocolSink_ReportData().

◆ test_http_protocol()

static void test_http_protocol ( void  )
static

Definition at line 3563 of file protocol.c.

3564{
3565 static const WCHAR posttest_url[] =
3566 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3567 't','e','s','t','s','/','p','o','s','t','.','p','h','p',0};
3568 static const WCHAR redirect_url[] =
3569 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3570 't','e','s','t','s','/','r','e','d','i','r','e','c','t',0};
3571 static const WCHAR winetest_url[] =
3572 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3573 't','e','s','t','s','/','d','a','t','a','.','p','h','p',0};
3574 static const WCHAR empty_url[] =
3575 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3576 't','e','s','t','s','/','e','m','p','t','y','.','j','s',0};
3577 static const WCHAR cache_only_url[] =
3578 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3579 't','e','s','t','s','/','c','a','c','h','e','-','o','n','l','y',0};
3580
3581
3582 trace("Testing http protocol (not from urlmon)...\n");
3583 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
3584 test_http_protocol_url(winetest_url, HTTP_TEST, TEST_FIRST_HTTP, TYMED_NULL);
3585
3586 trace("Testing http protocol (from urlmon)...\n");
3587 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
3588 test_http_protocol_url(winetest_url, HTTP_TEST, 0, TYMED_NULL);
3589
3590 trace("Testing http protocol (to file)...\n");
3591 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NEEDFILE;
3592 test_http_protocol_url(winetest_url, HTTP_TEST, 0, TYMED_NULL);
3593
3594 trace("Testing http protocol (post data)...\n");
3595 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
3596 test_http_protocol_url(posttest_url, HTTP_TEST, TEST_FIRST_HTTP|TEST_POST, TYMED_HGLOBAL);
3597
3598 trace("Testing http protocol (post data stream)...\n");
3600
3601 trace("Testing http protocol (direct read)...\n");
3602 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
3604
3605 trace("Testing http protocol (redirected)...\n");
3606 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3607 test_http_protocol_url(redirect_url, HTTP_TEST, TEST_REDIRECT, TYMED_NULL);
3608
3609 trace("Testing http protocol (redirected, disable auto redirect)...\n");
3610 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3612
3613 trace("Testing http protocol empty file...\n");
3614 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3615 test_http_protocol_url(empty_url, HTTP_TEST, TEST_EMPTY, TYMED_NULL);
3616
3617 trace("Testing http protocol (redirected, binding)...\n");
3618 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3620
3621 /* This is a bit ugly. We unconditionally disable this test on Wine. This won't work until we have
3622 * support for reading from cache via HTTP layer in wininet. Until then, Wine will fail badly, affecting
3623 * other, unrelated, tests. Working around it is not worth the trouble, we may simply make sure those
3624 * tests work on Windows and have them around for the future.
3625 */
3626 if(broken(1)) {
3627 trace("Testing http protocol (from cache)...\n");
3628 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
3629 test_http_protocol_url(cache_only_url, HTTP_TEST, TEST_FROMCACHE, TYMED_NULL);
3630 }
3631
3632 trace("Testing http protocol abort...\n");
3633 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3634 test_http_protocol_url(winetest_url, HTTP_TEST, TEST_ABORT, TYMED_NULL);
3635
3636 test_early_abort(&CLSID_HttpProtocol);
3637 test_early_abort(&CLSID_HttpSProtocol);
3638}
#define TEST_USEBINDING
Definition: protocol.c:2715
static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tymed)
Definition: protocol.c:3360
#define TEST_POST
Definition: protocol.c:2702

Referenced by START_TEST().

◆ test_http_protocol_url()

static void test_http_protocol_url ( LPCWSTR  url,
int  prot,
DWORD  flags,
DWORD  tymed 
)
static

Definition at line 3360 of file protocol.c.

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 ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
3505 if(bindf & BINDF_FROMURLMON)
3506 CHECK_CALLED(Switch);
3507 else
3508 CHECK_CALLED(ReportData);
3509
3510 if(test_abort) {
3511 HRESULT hres;
3512
3513 SET_EXPECT(ReportResult);
3514 hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
3515 ok(hres == S_OK, "Abort failed: %08lx\n", hres);
3516 CHECK_CALLED(ReportResult);
3517
3518 hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
3519 ok(hres == INET_E_RESULT_DISPATCHED || hres == S_OK /* IE10 */, "Abort failed: %08lx\n", hres);
3520 break;
3521 }
3522 }else {
3523 if(bindf & BINDF_FROMURLMON)
3524 CHECK_NOT_CALLED(Switch);
3525 else
3526 CHECK_NOT_CALLED(ReportData);
3527 if(cb == 0) break;
3528 }
3529 }
3530 if(!test_abort) {
3531 ok(hres == S_FALSE, "Read failed: %08lx\n", hres);
3532 CHECK_CALLED(ReportResult);
3533 }
3534 }
3535 if(prot == HTTPS_TEST)
3536 CLEAR_CALLED(ReportProgress_SENDINGREQUEST);
3537
3538 if (prot == HTTP_TEST || prot == HTTPS_TEST)
3539 CLEAR_CALLED(ReportProgress_COOKIE_SENT);
3540
3541 hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
3542 ok(hres == INET_E_RESULT_DISPATCHED || hres == S_OK /* IE10 */, "Abort failed: %08lx\n", hres);
3543
3545
3546 hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
3547 ok(hres == S_OK, "Abort failed: %08lx\n", hres);
3548
3549 ref = IInternetProtocol_Release(async_protocol);
3550 ok(!ref, "ref=%lx\n", ref);
3551 }
3552
3553 IClassFactory_Release(factory);
3554
3555 if(flags & TEST_FROMCACHE) {
3556 BOOL res;
3557
3559 ok(res, "DeleteUrlCacheEntryA failed: %lu\n", GetLastError());
3560 }
3561}
INT WINAPI StringFromGUID2(REFGUID guid, LPOLESTR str, INT cmax)
Definition: combase.c:1525
BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
Definition: urlcache.c:3344
static void create_cache_entry(const WCHAR *urlw)
Definition: protocol.c:3205
static BOOL http_protocol_start(LPCWSTR url, BOOL use_iuri)
Definition: protocol.c:3250
static DWORD tymed
Definition: url.c:172

Referenced by test_http_protocol(), and test_https_protocol().

◆ test_https_protocol()

static void test_https_protocol ( void  )
static

Definition at line 3640 of file protocol.c.

3641{
3642 static const WCHAR https_winehq_url[] =
3643 {'h','t','t','p','s',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3644 't','e','s','t','s','/','h','e','l','l','o','.','h','t','m','l',0};
3645
3646 trace("Testing https protocol (from urlmon)...\n");
3647 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3648 test_http_protocol_url(https_winehq_url, HTTPS_TEST, TEST_FIRST_HTTP, TYMED_NULL);
3649}

Referenced by START_TEST().

◆ test_mk_protocol()

static void test_mk_protocol ( void  )
static

Definition at line 3788 of file protocol.c.

3789{
3793 IUnknown *unk;
3794 HRESULT hres;
3795
3796 static const WCHAR wrong_url1[] = {'t','e','s','t',':','@','M','S','I','T','S','t','o','r','e',
3797 ':',':','/','t','e','s','t','.','h','t','m','l',0};
3798 static const WCHAR wrong_url2[] = {'m','k',':','/','t','e','s','t','.','h','t','m','l',0};
3799
3800 trace("Testing mk protocol...\n");
3801 init_test(MK_TEST, 0);
3802
3803 hres = CoGetClassObject(&CLSID_MkProtocol, CLSCTX_INPROC_SERVER, NULL,
3804 &IID_IUnknown, (void**)&unk);
3805 ok(hres == S_OK, "CoGetClassObject failed: %08lx\n", hres);
3806
3807 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
3809 "Could not get IInternetProtocolInfo interface: %08lx, expected E_NOINTERFACE\n",
3810 hres);
3811
3812 hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
3813 ok(hres == S_OK, "Could not get IClassFactory interface\n");
3814 IUnknown_Release(unk);
3815 if(FAILED(hres))
3816 return;
3817
3818 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
3819 (void**)&protocol);
3820 IClassFactory_Release(factory);
3821 ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
3822
3823 SET_EXPECT(GetBindInfo);
3824 hres = IInternetProtocol_Start(protocol, wrong_url1, &protocol_sink, &bind_info, 0, 0);
3826 "Start failed: %08lx, expected MK_E_SYNTAX or INET_E_INVALID_URL\n", hres);
3827 CLEAR_CALLED(GetBindInfo);
3828
3829 SET_EXPECT(GetBindInfo);
3830 SET_EXPECT(ReportProgress_DIRECTBIND);
3831 SET_EXPECT(ReportProgress_SENDINGREQUEST);
3832 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
3833 SET_EXPECT(ReportResult);
3835
3836 hres = IInternetProtocol_Start(protocol, wrong_url2, &protocol_sink, &bind_info, 0, 0);
3838 hres == INET_E_INVALID_URL, /* win2k3 */
3839 "Start failed: %08lx, expected INET_E_RESOURCE_NOT_FOUND or INET_E_INVALID_URL\n", hres);
3840
3842 CHECK_CALLED(GetBindInfo);
3843 CLEAR_CALLED(ReportProgress_DIRECTBIND);
3844 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
3845 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
3846 CHECK_CALLED(ReportResult);
3847 }else {
3848 CLEAR_CALLED(GetBindInfo);
3849 CLEAR_CALLED(ReportProgress_DIRECTBIND);
3850 CLEAR_CALLED(ReportProgress_SENDINGREQUEST);
3851 CLEAR_CALLED(ReportProgress_MIMETYPEAVAILABLE);
3852 CLEAR_CALLED(ReportResult);
3853 }
3854
3855 IInternetProtocol_Release(protocol);
3856}
#define INET_E_INVALID_URL
Definition: winerror.h:4652

◆ test_priority()

static void test_priority ( IInternetProtocol protocol)
static

Definition at line 2785 of file protocol.c.

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}

◆ test_protocol_terminate()

static void test_protocol_terminate ( IInternetProtocol protocol)
static

Definition at line 3328 of file protocol.c.

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}
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:726

Referenced by test_ftp_protocol(), and test_http_protocol_url().

◆ thread_proc()

static DWORD WINAPI thread_proc ( PVOID  arg)
static

Definition at line 1692 of file protocol.c.

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}
static const WCHAR hostW[]
Definition: protocol.c:142
static const WCHAR winehq_ipW[]
Definition: protocol.c:143

Referenced by protocol_start().

◆ w2a()

static const char * w2a ( LPCWSTR  str)
static

Definition at line 230 of file protocol.c.

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}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
const WCHAR * str

Referenced by create_cache_entry(), and START_TEST().

Variable Documentation

◆ acc_mimeW

const WCHAR acc_mimeW[] = {'*','/','*',0}
static

Definition at line 139 of file protocol.c.

Referenced by BindInfo_GetBindString(), and protocol_start().

◆ async_protocol

◆ async_read_pending

BOOL async_read_pending
static

Definition at line 166 of file protocol.c.

Referenced by init_test(), and ProtocolEmul_Read().

◆ bind_from_cache

BOOL bind_from_cache
static

◆ bind_info

IInternetBindInfo bind_info = { &bind_info_vtbl }
static

Definition at line 1538 of file protocol.c.

◆ bind_info_vtbl

IInternetBindInfoVtbl bind_info_vtbl
static
Initial value:
= {
}
static ULONG WINAPI BindInfo_Release(IInternetBindInfo *iface)
Definition: protocol.c:250
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 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

Definition at line 1530 of file protocol.c.

◆ BindCallbackRedirectVtbl

const IBindCallbackRedirectVtbl BindCallbackRedirectVtbl
static
Initial value:
= {
}
static HRESULT WINAPI BindCallbackRedirect_QueryInterface(IBindCallbackRedirect *iface, REFIID riid, void **ppv)
Definition: protocol.c:395
static ULONG WINAPI BindCallbackRedirect_Release(IBindCallbackRedirect *iface)
Definition: protocol.c:407
static ULONG WINAPI BindCallbackRedirect_AddRef(IBindCallbackRedirect *iface)
Definition: protocol.c:402
static HRESULT WINAPI BindCallbackRedirect_Redirect(IBindCallbackRedirect *iface, const WCHAR *url, VARIANT_BOOL *cancel)
Definition: protocol.c:412

Definition at line 419 of file protocol.c.

◆ bindf

DWORD bindf
static

Definition at line 156 of file protocol.c.

◆ bindinfo_options

DWORD bindinfo_options
static

◆ binding_protocol

◆ binding_sink

◆ binding_test

◆ binding_urls

const WCHAR binding_urls[][130]
static
Initial value:
= {
{'f','i','l','e',':','t','e','s','t','.','h','t','m','l',0},
{'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.',
'o','r','g','/','s','i','t','e','/','a','b','o','u','t',0},
{'h','t','t','p','s',':','/','/','w','w','w','.','c','o','d','e','w','e','a','v','e','r','s',
'.','c','o','m','/','t','e','s','t','.','h','t','m','l',0},
{'f','t','p',':','/','/','f','t','p','.','w','i','n','e','h','q','.','o','r','g',
'/','p','u','b','/','o','t','h','e','r',
'/','w','i','n','e','l','o','g','o','.','x','c','f','.','t','a','r','.','b','z','2',0},
{'m','k',':','t','e','s','t',0},
{'i','t','s',':','t','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0},
{'t','e','s','t',':','/','/','f','i','l','e','.','h','t','m','l',0}
}

Definition at line 208 of file protocol.c.

Referenced by BindInfo_GetBindString(), HttpNegotiate_BeginningTransaction(), MimeProtocol_Start(), protocol_start(), and test_binding().

◆ ClassFactory

Definition at line 2675 of file protocol.c.

◆ ClassFactoryVtbl

const IClassFactoryVtbl ClassFactoryVtbl
static
Initial value:
= {
}
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 ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: protocol.c:95
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: protocol.c:101
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
Definition: protocol.c:2625

Definition at line 2667 of file protocol.c.

◆ continue_protdata

PROTOCOLDATA continue_protdata
static

Definition at line 163 of file protocol.c.

Referenced by ProtocolSink_Switch(), and test_http_protocol_url().

◆ direct_read

◆ DWORD

Definition at line 32 of file protocol.c.

◆ DWORD_PTR

Definition at line 34 of file protocol.c.

◆ empty_file

BOOL empty_file
static

◆ emptyW

const WCHAR emptyW[] = {0}
static

Definition at line 144 of file protocol.c.

Referenced by protocol_start(), test_CreateBinding(), and test_file_protocol_fail().

◆ emulate_prot

BOOL emulate_prot
static

Definition at line 166 of file protocol.c.

Referenced by init_test(), ProtocolSink_ReportData(), and ProtocolSink_ReportProgress().

◆ event_complete

◆ event_complete2

HANDLE event_complete2
static

Definition at line 161 of file protocol.c.

Referenced by init_test(), ProtocolSink_Switch(), START_TEST(), and test_binding().

◆ event_continue

HANDLE event_continue
static

Definition at line 161 of file protocol.c.

Referenced by init_test(), ProtocolSink_Switch(), START_TEST(), and test_http_protocol_url().

◆ event_continue_done

HANDLE event_continue_done
static

Definition at line 161 of file protocol.c.

Referenced by init_test(), ProtocolSink_Switch(), START_TEST(), and test_http_protocol_url().

◆ ex_priority

DWORD ex_priority
static

Definition at line 156 of file protocol.c.

Referenced by InternetPriority_SetPriority(), test_binding(), and test_CreateBinding().

◆ expect_hrResult

HRESULT expect_hrResult
static

Definition at line 151 of file protocol.c.

◆ expect_pv

void* expect_pv
static

Definition at line 160 of file protocol.c.

Referenced by ProtocolEmul_Read(), ProtocolSink_ReportData(), and test_CreateBinding().

◆ expect_wsz

LPCWSTR expect_wsz
static

Definition at line 152 of file protocol.c.

Referenced by protocol_start(), ProtocolSink_ReportProgress(), and test_CreateBinding().

◆ file_name

LPCWSTR file_name
static

Definition at line 152 of file protocol.c.

Referenced by __acrt_MessageWindowA(), __acrt_MessageWindowW(), __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0(), _CrtDbgReport(), _CrtDbgReportW(), _CrtDefaultAllocHook(), _execl(), _execle(), _execlp(), _execlpe(), _execv(), _execve(), _execvp(), _execvpe(), _invalid_parameter(), _invoke_watson_if_error(), _invoke_watson_if_oneof(), _makepath(), _makepath_s(), _openfile(), _searchenv(), _searchenv_s(), _spawnl(), _spawnle(), _spawnlp(), _spawnlpe(), _spawnv(), _spawnve(), _spawnvp(), _spawnvpe(), _splitpath(), _splitpath_s(), _strdup(), _utime32(), _utime64(), _wcsdup(), _wexecl(), _wexecle(), _wexeclp(), _wexeclpe(), _wexecv(), _wexecve(), _wexecvp(), _wexecvpe(), _wfreopen(), _wfreopen_s(), _wmakepath(), _wmakepath_s(), _wopenfile(), _wsearchenv(), _wsearchenv_s(), _wspawnl(), _wspawnle(), _wspawnlp(), _wspawnlpe(), _wspawnv(), _wspawnve(), _wspawnvp(), _wspawnvpe(), _wsplitpath(), _wsplitpath_s(), _wutime32(), _wutime64(), add_file(), cache_file_available(), check_dir(), check_file_size(), check_version(), CommitUrlCacheEntryA(), common_fopen_s(), common_freopen(), common_fsopen(), common_makepath_s(), common_message_window(), common_openfile(), common_searchenv_s(), common_spawnl(), common_spawnlp(), common_spawnv(), common_spawnvp(), common_splitpath(), common_utime(), copy_and_add_argument_to_buffer(), create_cache_entry(), create_file(), create_output_file(), create_req_file(), create_test_file(), CreateUrlCacheEntryA(), DownloadBSC_Create(), downloadcb_create(), elf_load_cb(), elf_load_module(), elf_search_and_load_file(), execute_command(), expand_argument_wildcards(), export_all(), export_key(), export_registry_key(), ExtractZipImage(), file_exists(), file_modify(), find_and_map_dsym(), FindFirstFileNameW(), FindNextFileW(), freopen(), freopen_s(), get_file_nameA(), get_file_version(), GetHostnameFromCommand(), handle_dot(), HandleCommandLine(), install_file(), install_from_unix_file(), InternetLockRequestFile_test(), ITSProtocol_Start(), lfn_get(), load_file(), load_font(), load_mui_string(), load_xul(), macho_load_cb(), macho_load_module(), macho_search_and_load_file(), map_file(), OnControl(), OnOK(), Open(), path_find_symbol_file(), path_name(), pdb_process_internal(), print_something(), PrintImageInfo(), process_file(), ProtocolSink_ReportProgress(), read_file_to_bstr(), reg_mui_cache_get(), reg_mui_cache_put(), REGPROC_open_export_file(), report_unused(), run_from_file(), run_script(), run_script_file(), Save(), SdbGetMatchingExe(), search_dll_path(), search_unix_path(), sha_check(), SymFindFileInPathW(), test_binary_fileio(), test_CreateFile(), test_CreateFileMapping_protection(), test_DuplicateHandle(), test_file_all_name_information(), test_file_mode(), test_file_name_information(), test_file_protocol(), test_file_readonly_access(), test_file_security(), test_file_truncate(), test_filemap_security(), test_fprintf(), test_fscanf(), test_fwprintf(), test_GetMappedFileName(), test_GetVolumePathNameA(), test_http_cache(), test_mappings(), test_mhtml_protocol_binding(), test_overlapped_read(), test_text_fileio(), throw(), txt_export_all(), txt_export_key(), txt_export_registry_key(), txt_open_export_file(), urlcache_copy_entry(), urlcache_entry_commit(), urlcache_entry_create(), URLDownloadToCacheFileA(), verify_output_file(), VfdInstallDriver(), and FstreamTest::win32_file_format().

◆ file_with_hash

BOOL file_with_hash
static

◆ filter_state

DWORD filter_state
static

Definition at line 164 of file protocol.c.

Referenced by init_test(), and MimeProtocolSink_ReportData().

◆ filtered_protocol

◆ filtered_sink

◆ first_data_notif

BOOL first_data_notif
static

Definition at line 154 of file protocol.c.

Referenced by init_test(), and ProtocolSink_ReportData().

◆ gifW

const WCHAR gifW[] = {'i','m','a','g','e','/','g','i','f',0}
static

Definition at line 146 of file protocol.c.

Referenced by ProtocolSink_ReportProgress(), and register_filter().

◆ hostW

const WCHAR hostW[] = {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}
static

◆ http_is_first

BOOL http_is_first
static

◆ http_negotiate

◆ http_post_test

◆ http_security

IHttpSecurity http_security = { &HttpSecurityVtbl }
static

Definition at line 292 of file protocol.c.

Referenced by handle_http_error(), Protocol_Start(), and ServiceProvider_QueryService().

◆ http_url

LPCWSTR http_url
static

Definition at line 152 of file protocol.c.

Referenced by HttpNegotiate_BeginningTransaction(), and test_http_protocol_url().

◆ HttpNegotiateVtbl

IHttpNegotiate2Vtbl HttpNegotiateVtbl
static
Initial value:
= {
}
static HRESULT WINAPI HttpNegotiate_OnResponse(IHttpNegotiate2 *iface, DWORD dwResponseCode, LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders)
Definition: protocol.c:349
static ULONG WINAPI HttpNegotiate_Release(IHttpNegotiate2 *iface)
Definition: protocol.c:312
static HRESULT WINAPI HttpNegotiate_GetRootSecurityId(IHttpNegotiate2 *iface, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
Definition: protocol.c:362
static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate2 *iface, LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
Definition: protocol.c:317
static ULONG WINAPI HttpNegotiate_AddRef(IHttpNegotiate2 *iface)
Definition: protocol.c:307
static HRESULT WINAPI HttpNegotiate_QueryInterface(IHttpNegotiate2 *iface, REFIID riid, void **ppv)
Definition: protocol.c:294

Definition at line 384 of file protocol.c.

◆ HttpSecurityVtbl

IHttpSecurityVtbl HttpSecurityVtbl
static
Initial value:
= {
}
static HRESULT WINAPI HttpSecurity_QueryInterface(IHttpSecurity *iface, REFIID riid, void **ppv)
Definition: protocol.c:237
static HRESULT WINAPI HttpSecurity_GetWindow(IHttpSecurity *iface, REFGUID rguidReason, HWND *phwnd)
Definition: protocol.c:259
static ULONG WINAPI HttpSecurity_Release(IHttpSecurity *iface)
Definition: protocol.c:254
static HRESULT WINAPI HttpSecurity_OnSecurityProblem(IHttpSecurity *iface, DWORD dwProblem)
Definition: protocol.c:266
static ULONG WINAPI HttpSecurity_AddRef(IHttpSecurity *iface)
Definition: protocol.c:249

Definition at line 284 of file protocol.c.

◆ impl_protex

BOOL impl_protex
static

Definition at line 165 of file protocol.c.

Referenced by init_test(), ProtocolUnk_QueryInterface(), and test_binding().

◆ index_url

const WCHAR index_url[]
static
Initial value:
=
{'f','i','l','e',':','i','n','d','e','x','.','h','t','m','l',0}

Definition at line 136 of file protocol.c.

Referenced by test_file_protocol(), and test_file_protocol_fail().

◆ InternetPriorityVtbl

const IInternetPriorityVtbl InternetPriorityVtbl
static
Initial value:
= {
}
static HRESULT WINAPI InternetPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv)
Definition: protocol.c:1545
static HRESULT WINAPI InternetPriority_SetPriority(IInternetPriority *iface, LONG nPriority)
Definition: protocol.c:1574
static HRESULT WINAPI InternetPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority)
Definition: protocol.c:1581
static ULONG WINAPI InternetPriority_Release(IInternetPriority *iface)
Definition: protocol.c:1563
static ULONG WINAPI InternetPriority_AddRef(IInternetPriority *iface)
Definition: protocol.c:1552

Definition at line 1588 of file protocol.c.

Referenced by ClassFactory_CreateInstance().

◆ InternetProtocolInfoVtbl

const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl
static
Initial value:
= {
}
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 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
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 HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: protocol.c:2561

Definition at line 2592 of file protocol.c.

◆ mime_protocol_sink

IInternetProtocolSink mime_protocol_sink = { &mime_protocol_sink_vtbl }
static

Definition at line 1374 of file protocol.c.

Referenced by MimeProtocol_QueryInterface().

◆ mime_protocol_sink_vtbl

IInternetProtocolSinkVtbl mime_protocol_sink_vtbl
static
Initial value:
= {
}
static ULONG WINAPI MimeProtocolSink_AddRef(IInternetProtocolSink *iface)
Definition: protocol.c:1242
static HRESULT WINAPI MimeProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
Definition: protocol.c:1252
static HRESULT WINAPI MimeProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
Definition: protocol.c:1286
static HRESULT WINAPI MimeProtocolSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
Definition: protocol.c:1345
static ULONG WINAPI MimeProtocolSink_Release(IInternetProtocolSink *iface)
Definition: protocol.c:1247
static HRESULT WINAPI MimeProtocolSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: protocol.c:1266
static HRESULT WINAPI MimeProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv)
Definition: protocol.c:1230

Definition at line 1364 of file protocol.c.

◆ mimefilter_cf

IClassFactory mimefilter_cf = { &MimeFilterCFVtbl }
static

Definition at line 2696 of file protocol.c.

Referenced by register_filter().

◆ mimefilter_test

◆ MimeFilterCFVtbl

const IClassFactoryVtbl MimeFilterCFVtbl
static

◆ MimeProtocol

IInternetProtocolEx MimeProtocol = { &MimeProtocolVtbl }
static

Definition at line 2543 of file protocol.c.

Referenced by MimeFilter_CreateInstance().

◆ MimeProtocolVtbl

const IInternetProtocolExVtbl MimeProtocolVtbl
static
Initial value:
= {
}
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 HRESULT WINAPI MimeProtocol_LockRequest(IInternetProtocolEx *iface, DWORD dwOptions)
Definition: protocol.c:2497
static ULONG WINAPI Protocol_AddRef(IInternetProtocolEx *iface)
Definition: protocol.c:1596
static HRESULT WINAPI Protocol_Abort(IInternetProtocolEx *iface, HRESULT hrReason, DWORD dwOptions)
Definition: protocol.c:1606
static HRESULT WINAPI MimeProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
Definition: protocol.c:2344
static HRESULT WINAPI Protocol_Resume(IInternetProtocolEx *iface)
Definition: protocol.c:1627
static ULONG WINAPI Protocol_Release(IInternetProtocolEx *iface)
Definition: protocol.c:1601
static HRESULT WINAPI Protocol_Suspend(IInternetProtocolEx *iface)
Definition: protocol.c:1621
static HRESULT WINAPI Protocol_Seek(IInternetProtocolEx *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
Definition: protocol.c:1633
static HRESULT WINAPI Protocol_Continue(IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData)
Definition: protocol.c:2441
static HRESULT WINAPI MimeProtocol_Terminate(IInternetProtocolEx *iface, DWORD dwOptions)
Definition: protocol.c:2448
static HRESULT WINAPI MimeProtocol_UnlockRequest(IInternetProtocolEx *iface)
Definition: protocol.c:2513

Definition at line 2527 of file protocol.c.

◆ no_aggregation

BOOL no_aggregation
static

Definition at line 168 of file protocol.c.

Referenced by ClassFactory_CreateInstance(), START_TEST(), and test_CreateBinding().

◆ no_mime

BOOL no_mime
static

Definition at line 167 of file protocol.c.

Referenced by init_test(), MimeProtocolSink_ReportData(), and ProtocolEmul_Continue().

◆ null_guid

const WCHAR null_guid[]
static
Initial value:
= {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-',
'0','0','0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0','0','}',0}

Definition at line 147 of file protocol.c.

Referenced by init_test().

◆ outer_test_iid

const IID outer_test_iid = {0xabcabc00,0,0,{0,0,0,0,0,0,0,0x66}}
static

Definition at line 4247 of file protocol.c.

◆ outer_vtbl

const IUnknownVtbl outer_vtbl
static
Initial value:
= {
}
static ULONG WINAPI outer_AddRef(IUnknown *iface)
Definition: protocol.c:680
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: protocol.c:669
static ULONG WINAPI outer_Release(IUnknown *iface)
Definition: protocol.c:685

Definition at line 4270 of file protocol.c.

◆ pdata

◆ pi

◆ pjpegW

const WCHAR pjpegW[] = {'i','m','a','g','e','/','p','j','p','e','g',0}
static

◆ post_data

◆ post_stream_read

int post_stream_read
static

Definition at line 155 of file protocol.c.

Referenced by init_test(), and Stream_Read().

◆ prot_bind_info

IInternetBindInfo* prot_bind_info
static

◆ prot_read

DWORD prot_read
static

◆ prot_state

int prot_state
static

◆ protocol_clsid

WCHAR protocol_clsid[CHARS_IN_GUID]
static

Definition at line 149 of file protocol.c.

Referenced by init_test(), ProtocolSink_ReportProgress(), and test_http_protocol_url().

◆ protocol_emul

Protocol* protocol_emul
static

Definition at line 196 of file protocol.c.

Referenced by ClassFactory_CreateInstance(), and test_CreateBinding().

◆ protocol_info

IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl }
static

Definition at line 2602 of file protocol.c.

◆ protocol_names

const WCHAR protocol_names[][10]
static
Initial value:
= {
{'f','i','l','e',0},
{'h','t','t','p',0},
{'h','t','t','p','s',0},
{'f','t','p',0},
{'m','k',0},
{'i','t','s',0},
{'t','e','s','t',0}
}

Definition at line 198 of file protocol.c.

Referenced by test_binding().

◆ protocol_sink

IInternetProtocolSink protocol_sink = { &protocol_sink_vtbl }
static

Definition at line 1228 of file protocol.c.

◆ protocol_sink_vtbl

IInternetProtocolSinkVtbl protocol_sink_vtbl
static
Initial value:
= {
}
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 ULONG WINAPI ProtocolSink_Release(IInternetProtocolSink *iface)
Definition: protocol.c:136
static HRESULT WINAPI ProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv)
Definition: protocol.c:122
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 ULONG WINAPI ProtocolSink_AddRef(IInternetProtocolSink *iface)
Definition: protocol.c:131

Definition at line 1218 of file protocol.c.

◆ protocoldata

PROTOCOLDATA protocoldata
static

◆ ProtocolUnkVtbl

const IUnknownVtbl ProtocolUnkVtbl
static
Initial value:
= {
}
static ULONG WINAPI ProtocolUnk_AddRef(IUnknown *iface)
Definition: protocol.c:2314
static HRESULT WINAPI ProtocolUnk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: protocol.c:2269
static ULONG WINAPI ProtocolUnk_Release(IUnknown *iface)
Definition: protocol.c:2320

Definition at line 2338 of file protocol.c.

Referenced by ClassFactory_CreateInstance().

◆ ProtocolVtbl

const IInternetProtocolExVtbl ProtocolVtbl
static
Initial value:
= {
}
static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData)
Definition: protocol.c:1967
static HRESULT WINAPI ProtocolEmul_UnlockRequest(IInternetProtocolEx *iface)
Definition: protocol.c:2231
static HRESULT WINAPI ProtocolEmul_LockRequest(IInternetProtocolEx *iface, DWORD dwOptions)
Definition: protocol.c:2219
static HRESULT WINAPI ProtocolEmul_StartEx(IInternetProtocolEx *iface, IUri *pUri, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE *dwReserved)
Definition: protocol.c:2237
static HRESULT WINAPI ProtocolEmul_Terminate(IInternetProtocolEx *iface, DWORD dwOptions)
Definition: protocol.c:2114
static HRESULT WINAPI ProtocolEmul_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
Definition: protocol.c:1645
static ULONG WINAPI ProtocolEmul_AddRef(IInternetProtocolEx *iface)
Definition: protocol.c:1670
static HRESULT WINAPI ProtocolEmul_Read(IInternetProtocolEx *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: protocol.c:2121
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

Definition at line 2247 of file protocol.c.

Referenced by ClassFactory_CreateInstance().

◆ read_report_data

int read_report_data
static

◆ redirect_callback

IBindCallbackRedirect redirect_callback = { &BindCallbackRedirectVtbl }
static

Definition at line 426 of file protocol.c.

Referenced by ServiceProvider_QueryService().

◆ redirect_on_continue

BOOL redirect_on_continue
static

Definition at line 154 of file protocol.c.

Referenced by init_test(), protocol_start(), ProtocolEmul_Continue(), and thread_proc().

◆ result_from_lock

BOOL result_from_lock
static

◆ reuse_protocol_thread

BOOL reuse_protocol_thread
static

Definition at line 167 of file protocol.c.

Referenced by init_test(), protocol_start(), and ProtocolEmul_Continue().

◆ security_problem

BOOL security_problem
static

◆ service_provider

IServiceProvider service_provider = { &ServiceProviderVtbl }
static

Definition at line 495 of file protocol.c.

Referenced by protocol_start(), ProtocolEmul_Continue(), and QueryInterface().

◆ ServiceProviderVtbl

const IServiceProviderVtbl ServiceProviderVtbl
static
Initial value:
= {
}
static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
Definition: protocol.c:445
static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
Definition: protocol.c:440
static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
Definition: protocol.c:430
static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
Definition: protocol.c:435

Definition at line 488 of file protocol.c.

◆ short_read

◆ 

◆ status_names

const char* status_names[]
static

Definition at line 769 of file protocol.c.

Referenced by ProtocolSink_ReportProgress().

◆ Stream

IStream Stream = { &StreamVtbl }
static

Definition at line 627 of file protocol.c.

Referenced by BindInfo_GetBindInfo().

◆ StreamVtbl

const IStreamVtbl StreamVtbl
static
Initial value:
= {
}
static ULONG WINAPI Stream_AddRef(IStream *iface)
Definition: protocol.c:508
static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
Definition: protocol.c:558
static HRESULT WINAPI Stream_Revert(IStream *iface)
Definition: protocol.c:577
static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg, DWORD dwStatFlag)
Definition: protocol.c:597
static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
Definition: protocol.c:564
static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
Definition: protocol.c:583
static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
Definition: protocol.c:497
static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
Definition: protocol.c:604
static HRESULT WINAPI Stream_UnlockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
Definition: protocol.c:590
static ULONG WINAPI Stream_Release(IStream *iface)
Definition: protocol.c:513
static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
Definition: protocol.c:571
static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv, ULONG cb, ULONG *pcbWritten)
Definition: protocol.c:539

Definition at line 610 of file protocol.c.

◆ test_abort

◆ test_async_req

BOOL test_async_req
static

Definition at line 165 of file protocol.c.

Referenced by call_continue(), and init_test().

◆ test_redirect

◆ 

◆ text_htmlW

const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0}
static

◆ thread_id

◆ user_agentW

const WCHAR user_agentW[] = {'W','i','n','e',0}
static

Definition at line 140 of file protocol.c.

Referenced by BindInfo_GetBindString(), protocol_start(), and winhttp_request_Open().

◆ wait_for_switch

BOOL wait_for_switch
static

Definition at line 166 of file protocol.c.

Referenced by init_test(), ProtocolSink_ReportData(), and test_http_protocol_url().

◆ winehq_ipW

const WCHAR winehq_ipW[] = {'2','0','9','.','4','6','.','2','5','.','1','3','4',0}
static

Definition at line 143 of file protocol.c.

Referenced by thread_proc().

◆ wszIndexHtml

const WCHAR wszIndexHtml[] = {'i','n','d','e','x','.','h','t','m','l',0}
static

Definition at line 135 of file protocol.c.

Referenced by test_file_protocol(), and test_file_protocol_fail().