ReactOS 0.4.15-dev-7788-g1ad9096
protocol.c File Reference
#include <wine/test.h>
#include <wine/heap.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 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
 

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 (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 int strcmp_wa (LPCWSTR strw, const char *stra)
 
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 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
 
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

◆ 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:29

Definition at line 55 of file protocol.c.

◆ CHECK_EXPECT

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

Definition at line 49 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 43 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 61 of file protocol.c.

◆ CLEAR_CALLED

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

Definition at line 67 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 37 of file protocol.c.

◆ SET_EXPECT

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

Definition at line 40 of file protocol.c.

◆ TEST_ABORT

#define TEST_ABORT   0x0100

Definition at line 2689 of file protocol.c.

◆ TEST_ASYNCREQ

#define TEST_ASYNCREQ   0x0200

Definition at line 2690 of file protocol.c.

◆ TEST_BINDING

#define TEST_BINDING   0x0001

Definition at line 2681 of file protocol.c.

◆ TEST_DIRECT_READ

#define TEST_DIRECT_READ   0x0008

Definition at line 2684 of file protocol.c.

◆ TEST_DISABLEAUTOREDIRECT

#define TEST_DISABLEAUTOREDIRECT   0x8000

Definition at line 2696 of file protocol.c.

◆ TEST_EMPTY

#define TEST_EMPTY   0x1000

Definition at line 2693 of file protocol.c.

◆ TEST_EMULATEPROT

#define TEST_EMULATEPROT   0x0020

Definition at line 2686 of file protocol.c.

◆ TEST_FILTER

#define TEST_FILTER   0x0002

Definition at line 2682 of file protocol.c.

◆ TEST_FIRST_HTTP

#define TEST_FIRST_HTTP   0x0004

Definition at line 2683 of file protocol.c.

◆ TEST_FROMCACHE

#define TEST_FROMCACHE   0x4000

Definition at line 2695 of file protocol.c.

◆ TEST_IMPLPROTEX

#define TEST_IMPLPROTEX   0x0800

Definition at line 2692 of file protocol.c.

◆ TEST_NOMIME

#define TEST_NOMIME   0x2000

Definition at line 2694 of file protocol.c.

◆ TEST_POST

#define TEST_POST   0x0010

Definition at line 2685 of file protocol.c.

◆ TEST_REDIRECT

#define TEST_REDIRECT   0x0080

Definition at line 2688 of file protocol.c.

◆ TEST_SHORT_READ

#define TEST_SHORT_READ   0x0040

Definition at line 2687 of file protocol.c.

◆ TEST_USEIURI

#define TEST_USEIURI   0x0400

Definition at line 2691 of file protocol.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
STATE_CONNECTING 
STATE_SENDINGREQUEST 
STATE_STARTDOWNLOADING 
STATE_DOWNLOADING 

Definition at line 165 of file protocol.c.

165 {
170} state;
enum @1709 state
@ STATE_SENDINGREQUEST
Definition: protocol.c:167
@ STATE_CONNECTING
Definition: protocol.c:166
@ STATE_DOWNLOADING
Definition: protocol.c:169
@ STATE_STARTDOWNLOADING
Definition: protocol.c:168

◆ anonymous enum

anonymous enum
Enumerator
FILE_TEST 
HTTP_TEST 
HTTPS_TEST 
FTP_TEST 
MK_TEST 
ITS_TEST 
BIND_TEST 

Definition at line 172 of file protocol.c.

172 {
173 FILE_TEST,
174 HTTP_TEST,
176 FTP_TEST,
177 MK_TEST,
178 ITS_TEST,
@ FTP_TEST
Definition: protocol.c:176
@ FILE_TEST
Definition: protocol.c:173
@ HTTPS_TEST
Definition: protocol.c:175
@ HTTP_TEST
Definition: protocol.c:174
@ MK_TEST
Definition: protocol.c:177
@ ITS_TEST
Definition: protocol.c:178
@ BIND_TEST
Definition: protocol.c:179
static enum @1710 tested_protocol

Function Documentation

◆ BindCallbackRedirect_AddRef()

static ULONG WINAPI BindCallbackRedirect_AddRef ( IBindCallbackRedirect iface)
static

Definition at line 404 of file protocol.c.

405{
406 return 2;
407}

◆ BindCallbackRedirect_QueryInterface()

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

Definition at line 397 of file protocol.c.

398{
399 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
400 *ppv = NULL;
401 return E_NOINTERFACE;
402}
#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:197
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ BindCallbackRedirect_Redirect()

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

Definition at line 414 of file protocol.c.

415{
416 CHECK_EXPECT(Redirect);
417 *cancel = VARIANT_FALSE;
418 return S_OK;
419}
#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 409 of file protocol.c.

410{
411 return 1;
412}

◆ BindInfo_AddRef()

static ULONG WINAPI BindInfo_AddRef ( IInternetBindInfo iface)
static

Definition at line 1411 of file protocol.c.

1412{
1413 return 2;
1414}

◆ BindInfo_GetBindInfo()

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

Definition at line 1421 of file protocol.c.

1422{
1423 DWORD cbSize;
1424
1425 CHECK_EXPECT(GetBindInfo);
1426
1427 ok(grfBINDF != NULL, "grfBINDF == NULL\n");
1428 ok(pbindinfo != NULL, "pbindinfo == NULL\n");
1429 ok(pbindinfo->cbSize == sizeof(BINDINFO), "wrong size of pbindinfo: %d\n", pbindinfo->cbSize);
1430
1431 *grfBINDF = bindf;
1432 if(binding_test)
1433 *grfBINDF |= BINDF_FROMURLMON;
1434 cbSize = pbindinfo->cbSize;
1435 memset(pbindinfo, 0, cbSize);
1436 pbindinfo->cbSize = cbSize;
1437 pbindinfo->dwOptions = bindinfo_options;
1438
1439 if(http_post_test)
1440 {
1441 pbindinfo->cbstgmedData = sizeof(post_data)-1;
1442 pbindinfo->dwBindVerb = BINDVERB_POST;
1443 pbindinfo->stgmedData.tymed = http_post_test;
1444
1445 if(http_post_test == TYMED_HGLOBAL) {
1446 HGLOBAL data;
1447
1448 /* Must be GMEM_FIXED, GMEM_MOVABLE does not work properly */
1449 data = GlobalAlloc(GPTR, sizeof(post_data));
1450 memcpy(data, post_data, sizeof(post_data));
1451 U(pbindinfo->stgmedData).hGlobal = data;
1452 }else {
1453 U(pbindinfo->stgmedData).pstm = &Stream;
1454 }
1455 }
1456
1457 return S_OK;
1458}
#define U(x)
Definition: wordpad.c:45
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:217
static IStream Stream
Definition: protocol.c:629
static DWORD http_post_test
Definition: protocol.c:159
static DWORD bindinfo_options
Definition: protocol.c:151
static BOOL binding_test
Definition: protocol.c:157
#define memset(x, y, z)
Definition: compat.h:39
#define GPTR
Definition: winbase.h:296

◆ BindInfo_GetBindString()

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

Definition at line 1460 of file protocol.c.

1462{
1463 ok(ppwzStr != NULL, "ppwzStr == NULL\n");
1464 ok(pcElFetched != NULL, "pcElFetched == NULL\n");
1465
1466 switch(ulStringType) {
1467 case BINDSTRING_ACCEPT_MIMES:
1468 CHECK_EXPECT(GetBindString_ACCEPT_MIMES);
1469 ok(cEl == 256, "cEl=%d, expected 256\n", cEl);
1470 if(pcElFetched) {
1471 ok(*pcElFetched == 256, "*pcElFetched=%d, expected 256\n", *pcElFetched);
1472 *pcElFetched = 1;
1473 }
1474 if(ppwzStr) {
1475 *ppwzStr = CoTaskMemAlloc(sizeof(acc_mimeW));
1476 memcpy(*ppwzStr, acc_mimeW, sizeof(acc_mimeW));
1477 }
1478 return S_OK;
1479 case BINDSTRING_USER_AGENT:
1480 CHECK_EXPECT(GetBindString_USER_AGENT);
1481 ok(cEl == 1, "cEl=%d, expected 1\n", cEl);
1482 if(pcElFetched) {
1483 ok(*pcElFetched == 0, "*pcElFetch=%d, expected 0\n", *pcElFetched);
1484 *pcElFetched = 1;
1485 }
1486 if(ppwzStr) {
1487 *ppwzStr = CoTaskMemAlloc(sizeof(user_agentW));
1488 memcpy(*ppwzStr, user_agentW, sizeof(user_agentW));
1489 }
1490 return S_OK;
1491 case BINDSTRING_POST_COOKIE:
1492 CHECK_EXPECT(GetBindString_POST_COOKIE);
1493 ok(cEl == 1, "cEl=%d, expected 1\n", cEl);
1494 if(pcElFetched)
1495 ok(*pcElFetched == 0, "*pcElFetch=%d, expected 0\n", *pcElFetched);
1496 return S_OK;
1497 case BINDSTRING_URL: {
1498 DWORD size;
1499
1500 CHECK_EXPECT(GetBindString_URL);
1501 ok(cEl == 1, "cEl=%d, expected 1\n", cEl);
1502 ok(*pcElFetched == 0, "*pcElFetch=%d, expected 0\n", *pcElFetched);
1503 *pcElFetched = 1;
1504
1506 *ppwzStr = CoTaskMemAlloc(size);
1508 return S_OK;
1509 }
1510 case BINDSTRING_ROOTDOC_URL:
1511 CHECK_EXPECT(GetBindString_ROOTDOC_URL);
1512 ok(cEl == 1, "cEl=%d, expected 1\n", cEl);
1513 return E_NOTIMPL;
1514 case BINDSTRING_ENTERPRISE_ID:
1515 ok(cEl == 1, "cEl=%d, expected 1\n", cEl);
1516 return E_NOTIMPL;
1517 default:
1518 ok(0, "unexpected ulStringType %d\n", ulStringType);
1519 }
1520
1521 return E_NOTIMPL;
1522}
#define E_NOTIMPL
Definition: ddrawi.h:99
#define lstrlenW
Definition: compat.h:750
GLsizeiptr size
Definition: glext.h:5919
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
static const WCHAR binding_urls[][130]
Definition: protocol.c:203
static const WCHAR acc_mimeW[]
Definition: protocol.c:137
static const WCHAR user_agentW[]
Definition: protocol.c:138
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ BindInfo_QueryInterface()

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

Definition at line 1402 of file protocol.c.

1403{
1404 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetBindInfo, riid)) {
1405 *ppv = iface;
1406 return S_OK;
1407 }
1408 return E_NOINTERFACE;
1409}
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 1416 of file protocol.c.

1417{
1418 return 1;
1419}

◆ call_continue()

static void call_continue ( PROTOCOLDATA *  protocol_data)
static

Definition at line 646 of file protocol.c.

647{
649
650 if (winetest_debug > 1)
651 trace("continue in state %d\n", state);
652
653 if(state == STATE_CONNECTING) {
655 if (http_is_first){
656 CLEAR_CALLED(ReportProgress_FINDINGRESOURCE);
657 CLEAR_CALLED(ReportProgress_PROXYDETECTING);
658 }
659 CLEAR_CALLED(ReportProgress_CONNECTING);
660 }
662 todo_wine CHECK_CALLED(ReportProgress_SENDINGREQUEST);
663 else if (tested_protocol != HTTPS_TEST)
664 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
665 if(test_redirect && !(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS))
666 CHECK_CALLED(ReportProgress_REDIRECTING);
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: %08x\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
#define SET_EXPECT(func)
Definition: protocol.c:37
HRESULT hres
Definition: protocol.c:465
#define CHECK_CALLED(func)
Definition: protocol.c:50
#define todo_wine
Definition: custom.c:79
#define CLEAR_CALLED(func)
Definition: protocol.c:67
static BOOL test_async_req
Definition: protocol.c:160
static IInternetProtocol * async_protocol
Definition: protocol.c:148
static BOOL test_abort
Definition: protocol.c:161
static BOOL empty_file
Definition: protocol.c:162
static BOOL http_is_first
Definition: protocol.c:149
static BOOL security_problem
Definition: protocol.c:160
static HRESULT WINAPI Stream_Read(IStream *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: protocol.c:520
static BOOL test_redirect
Definition: protocol.c:149
int winetest_debug

Referenced by ProtocolSink_Switch(), and test_http_protocol_url().

◆ ClassFactory_AddRef()

static ULONG WINAPI ClassFactory_AddRef ( IClassFactory iface)
static

Definition at line 2598 of file protocol.c.

2599{
2600 return 2;
2601}

◆ ClassFactory_CreateInstance()

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

Definition at line 2608 of file protocol.c.

2610{
2611 Protocol *ret;
2612
2613 ok(ppv != NULL, "ppv == NULL\n");
2614
2615 if(!pOuter) {
2616 CHECK_EXPECT(CreateInstance_no_aggregation);
2617 ok(IsEqualGUID(&IID_IInternetProtocol, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
2618 }else {
2619 CHECK_EXPECT(CreateInstance);
2620 ok(pOuter == (IUnknown*)prot_bind_info, "pOuter != protocol_unk\n");
2621 ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
2622 if (no_aggregation) {
2623 *ppv = NULL;
2624 return CLASS_E_NOAGGREGATION;
2625 }
2626 }
2627
2628 ret = heap_alloc(sizeof(*ret));
2629 ret->IUnknown_inner.lpVtbl = &ProtocolUnkVtbl;
2630 ret->IInternetProtocolEx_iface.lpVtbl = &ProtocolVtbl;
2631 ret->IInternetPriority_iface.lpVtbl = &InternetPriorityVtbl;
2632 ret->outer = pOuter;
2633 ret->inner_ref = 1;
2634 ret->outer_ref = 0;
2635
2637 if (!pOuter)
2638 *ppv = &ret->IInternetProtocolEx_iface;
2639 else
2640 *ppv = &ret->IUnknown_inner;
2641 return S_OK;
2642}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL no_aggregation
Definition: protocol.c:163
static IInternetBindInfo * prot_bind_info
Definition: protocol.c:153
static const IUnknownVtbl ProtocolUnkVtbl
Definition: protocol.c:2321
static const IInternetProtocolExVtbl ProtocolVtbl
Definition: protocol.c:2230
static Protocol * protocol_emul
Definition: protocol.c:191
static const IInternetPriorityVtbl InternetPriorityVtbl
Definition: protocol.c:1582
int ret
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662

◆ ClassFactory_LockServer()

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

Definition at line 2644 of file protocol.c.

2645{
2646 ok(0, "unexpected call\n");
2647 return S_OK;
2648}

◆ ClassFactory_QueryInterface()

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

Definition at line 2587 of file protocol.c.

2588{
2589 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
2590 *ppv = &protocol_info;
2591 return S_OK;
2592 }
2593
2594 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
2595 return E_NOINTERFACE;
2596}
static IInternetProtocolInfo protocol_info
Definition: misc.c:947

◆ ClassFactory_Release()

static ULONG WINAPI ClassFactory_Release ( IClassFactory iface)
static

Definition at line 2603 of file protocol.c.

2604{
2605 return 1;
2606}

◆ create_cache_entry()

static void create_cache_entry ( const WCHAR urlw)
static

Definition at line 3184 of file protocol.c.

3185{
3186 FILETIME now, tomorrow, yesterday;
3187 char file_path[MAX_PATH];
3188 BYTE content[1000];
3190 const char *url;
3191 HANDLE file;
3192 DWORD size;
3193 unsigned i;
3194 BOOL res;
3195
3196 BYTE cache_headers[] = "HTTP/1.1 200 OK\r\n\r\n";
3197
3198 trace("Testing cache read...\n");
3199
3200 url = w2a(urlw);
3201
3202 for(i = 0; i < sizeof(content); i++)
3203 content[i] = '0' + (i%10);
3204
3206 li.u.HighPart = now.dwHighDateTime;
3207 li.u.LowPart = now.dwLowDateTime;
3208 li.QuadPart += (LONGLONG)10000000 * 3600 * 24;
3209 tomorrow.dwHighDateTime = li.u.HighPart;
3210 tomorrow.dwLowDateTime = li.u.LowPart;
3211 li.QuadPart -= (LONGLONG)10000000 * 3600 * 24 * 2;
3212 yesterday.dwHighDateTime = li.u.HighPart;
3213 yesterday.dwLowDateTime = li.u.LowPart;
3214
3215 res = CreateUrlCacheEntryA(url, sizeof(content), "", file_path, 0);
3216 ok(res, "CreateUrlCacheEntryA failed: %u\n", GetLastError());
3217
3219 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n");
3220
3221 WriteFile(file, content, sizeof(content), &size, NULL);
3223
3224 res = CommitUrlCacheEntryA(url, file_path, tomorrow, yesterday, NORMAL_CACHE_ENTRY,
3225 cache_headers, sizeof(cache_headers)-1, "", 0);
3226 ok(res, "CommitUrlCacheEntryA failed: %u\n", GetLastError());
3227}
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 LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
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:1432
static const char * w2a(LPCWSTR str)
Definition: protocol.c:232
#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::@2290 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/62]

DEFINE_EXPECT ( Abort  )

◆ DEFINE_EXPECT() [2/62]

DEFINE_EXPECT ( BeginningTransaction  )

◆ DEFINE_EXPECT() [3/62]

DEFINE_EXPECT ( Continue  )

◆ DEFINE_EXPECT() [4/62]

DEFINE_EXPECT ( CreateInstance  )

◆ DEFINE_EXPECT() [5/62]

DEFINE_EXPECT ( CreateInstance_no_aggregation  )

◆ DEFINE_EXPECT() [6/62]

DEFINE_EXPECT ( GetBindInfo  )

◆ DEFINE_EXPECT() [7/62]

DEFINE_EXPECT ( GetBindString_ACCEPT_MIMES  )

◆ DEFINE_EXPECT() [8/62]

DEFINE_EXPECT ( GetBindString_POST_COOKIE  )

◆ DEFINE_EXPECT() [9/62]

DEFINE_EXPECT ( GetBindString_ROOTDOC_URL  )

◆ DEFINE_EXPECT() [10/62]

DEFINE_EXPECT ( GetBindString_URL  )

◆ DEFINE_EXPECT() [11/62]

DEFINE_EXPECT ( GetBindString_USER_AGENT  )

◆ DEFINE_EXPECT() [12/62]

DEFINE_EXPECT ( GetRootSecurityId  )

◆ DEFINE_EXPECT() [13/62]

DEFINE_EXPECT ( LockRequest  )

◆ DEFINE_EXPECT() [14/62]

DEFINE_EXPECT ( MimeFilter_Continue  )

◆ DEFINE_EXPECT() [15/62]

DEFINE_EXPECT ( MimeFilter_CreateInstance  )

◆ DEFINE_EXPECT() [16/62]

DEFINE_EXPECT ( MimeFilter_LockRequest  )

◆ DEFINE_EXPECT() [17/62]

DEFINE_EXPECT ( MimeFilter_Read  )

◆ DEFINE_EXPECT() [18/62]

DEFINE_EXPECT ( MimeFilter_ReportData  )

◆ DEFINE_EXPECT() [19/62]

DEFINE_EXPECT ( MimeFilter_ReportResult  )

◆ DEFINE_EXPECT() [20/62]

DEFINE_EXPECT ( MimeFilter_Start  )

◆ DEFINE_EXPECT() [21/62]

DEFINE_EXPECT ( MimeFilter_Switch  )

◆ DEFINE_EXPECT() [22/62]

DEFINE_EXPECT ( MimeFilter_Terminate  )

◆ DEFINE_EXPECT() [23/62]

DEFINE_EXPECT ( MimeFilter_UnlockRequest  )

◆ DEFINE_EXPECT() [24/62]

DEFINE_EXPECT ( OnResponse  )

◆ DEFINE_EXPECT() [25/62]

DEFINE_EXPECT ( outer_QI_test  )

◆ DEFINE_EXPECT() [26/62]

DEFINE_EXPECT ( Protocol_destructor  )

◆ DEFINE_EXPECT() [27/62]

DEFINE_EXPECT ( QueryInterface_IWinInetHttpInfo  )

◆ DEFINE_EXPECT() [28/62]

DEFINE_EXPECT ( QueryInterface_IWinInetInfo  )

◆ DEFINE_EXPECT() [29/62]

DEFINE_EXPECT ( QueryService_HttpNegotiate  )

◆ DEFINE_EXPECT() [30/62]

DEFINE_EXPECT ( QueryService_HttpSecurity  )

◆ DEFINE_EXPECT() [31/62]

DEFINE_EXPECT ( QueryService_IBindCallbackRedirect  )

◆ DEFINE_EXPECT() [32/62]

DEFINE_EXPECT ( QueryService_InternetProtocol  )

◆ DEFINE_EXPECT() [33/62]

DEFINE_EXPECT ( Read  )

◆ DEFINE_EXPECT() [34/62]

DEFINE_EXPECT ( Read2  )

◆ DEFINE_EXPECT() [35/62]

DEFINE_EXPECT ( Redirect  )

◆ DEFINE_EXPECT() [36/62]

DEFINE_EXPECT ( ReportData  )

◆ DEFINE_EXPECT() [37/62]

DEFINE_EXPECT ( ReportData2  )

◆ DEFINE_EXPECT() [38/62]

DEFINE_EXPECT ( ReportProgress_ACCEPTRANGES  )

◆ DEFINE_EXPECT() [39/62]

DEFINE_EXPECT ( ReportProgress_CACHEFILENAMEAVAILABLE  )

◆ DEFINE_EXPECT() [40/62]

DEFINE_EXPECT ( ReportProgress_CONNECTING  )

◆ DEFINE_EXPECT() [41/62]

DEFINE_EXPECT ( ReportProgress_COOKIE_SENT  )

◆ DEFINE_EXPECT() [42/62]

DEFINE_EXPECT ( ReportProgress_DECODING  )

◆ DEFINE_EXPECT() [43/62]

DEFINE_EXPECT ( ReportProgress_DIRECTBIND  )

◆ DEFINE_EXPECT() [44/62]

DEFINE_EXPECT ( ReportProgress_ENCODING  )

◆ DEFINE_EXPECT() [45/62]

DEFINE_EXPECT ( ReportProgress_FINDINGRESOURCE  )

◆ DEFINE_EXPECT() [46/62]

DEFINE_EXPECT ( ReportProgress_LOADINGMIMEHANDLER  )

◆ DEFINE_EXPECT() [47/62]

DEFINE_EXPECT ( ReportProgress_MIMETYPEAVAILABLE  )

◆ DEFINE_EXPECT() [48/62]

DEFINE_EXPECT ( ReportProgress_PROTOCOLCLASSID  )

◆ DEFINE_EXPECT() [49/62]

DEFINE_EXPECT ( ReportProgress_PROXYDETECTING  )

◆ DEFINE_EXPECT() [50/62]

DEFINE_EXPECT ( ReportProgress_RAWMIMETYPE  )

◆ DEFINE_EXPECT() [51/62]

DEFINE_EXPECT ( ReportProgress_REDIRECTING  )

◆ DEFINE_EXPECT() [52/62]

DEFINE_EXPECT ( ReportProgress_SENDINGREQUEST  )

◆ DEFINE_EXPECT() [53/62]

DEFINE_EXPECT ( ReportProgress_VERIFIEDMIMETYPEAVAILABLE  )

◆ DEFINE_EXPECT() [54/62]

DEFINE_EXPECT ( ReportResult  )

◆ DEFINE_EXPECT() [55/62]

DEFINE_EXPECT ( SetPriority  )

◆ DEFINE_EXPECT() [56/62]

DEFINE_EXPECT ( Start  )

◆ DEFINE_EXPECT() [57/62]

DEFINE_EXPECT ( StartEx  )

◆ DEFINE_EXPECT() [58/62]

DEFINE_EXPECT ( Stream_Read  )

◆ DEFINE_EXPECT() [59/62]

DEFINE_EXPECT ( Stream_Seek  )

◆ DEFINE_EXPECT() [60/62]

DEFINE_EXPECT ( Switch  )

◆ DEFINE_EXPECT() [61/62]

DEFINE_EXPECT ( Terminate  )

◆ DEFINE_EXPECT() [62/62]

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 2808 of file protocol.c.

2810{
2811 HRESULT hres;
2812
2813 SET_EXPECT(GetBindInfo);
2814 if(!(bindf & BINDF_FROMURLMON))
2815 SET_EXPECT(ReportProgress_DIRECTBIND);
2816 if(is_first) {
2817 SET_EXPECT(ReportProgress_SENDINGREQUEST);
2818 SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
2819 if(bindf & BINDF_FROMURLMON)
2820 SET_EXPECT(ReportProgress_VERIFIEDMIMETYPEAVAILABLE);
2821 else
2822 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
2823 }
2824 SET_EXPECT(ReportData);
2825 if(is_first)
2826 SET_EXPECT(ReportResult);
2827
2829
2830 if(protocolex) {
2831 hres = IInternetProtocolEx_StartEx(protocolex, uri, &protocol_sink, &bind_info, 0, 0);
2832 ok(hres == S_OK, "StartEx failed: %08x\n", hres);
2833 }else {
2834 hres = IInternetProtocol_Start(protocol, url, &protocol_sink, &bind_info, 0, 0);
2835 if(hres == INET_E_RESOURCE_NOT_FOUND) {
2836 win_skip("Start failed\n");
2837 return FALSE;
2838 }
2839 ok(hres == S_OK, "Start failed: %08x\n", hres);
2840 }
2841
2842 CHECK_CALLED(GetBindInfo);
2843 if(!(bindf & BINDF_FROMURLMON))
2844 CLEAR_CALLED(ReportProgress_DIRECTBIND); /* Not called by IE10 */
2845 if(is_first) {
2846 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
2847 CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
2848 if(bindf & BINDF_FROMURLMON)
2849 CHECK_CALLED(ReportProgress_VERIFIEDMIMETYPEAVAILABLE);
2850 else
2851 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
2852 }
2853 CHECK_CALLED(ReportData);
2854 if(is_first)
2855 CHECK_CALLED(ReportResult);
2856
2857 return TRUE;
2858}
static IInternetProtocolSink protocol_sink
Definition: mimeole.c:1411
static IInternetBindInfo bind_info
Definition: mimeole.c:1273
static HRESULT expect_hrResult
Definition: protocol.c:68
const char * uri
Definition: sec_mgr.c:1588
#define win_skip
Definition: test.h:160

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 3229 of file protocol.c.

3230{
3231 static BOOL got_user_agent = FALSE;
3232 IUri *uri = NULL;
3233 HRESULT hres;
3234
3235 if(use_iuri && pCreateUri) {
3236 hres = pCreateUri(url, 0, 0, &uri);
3237 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
3238 }
3239
3240 SET_EXPECT(GetBindInfo);
3241 if (!(bindf & BINDF_FROMURLMON))
3242 SET_EXPECT(ReportProgress_DIRECTBIND);
3243 if(!got_user_agent)
3244 SET_EXPECT(GetBindString_USER_AGENT);
3245 SET_EXPECT(GetBindString_ROOTDOC_URL);
3246 SET_EXPECT(GetBindString_ACCEPT_MIMES);
3247 SET_EXPECT(QueryService_HttpNegotiate);
3248 SET_EXPECT(BeginningTransaction);
3249 SET_EXPECT(GetRootSecurityId);
3250 if(http_post_test) {
3251 SET_EXPECT(GetBindString_POST_COOKIE);
3252 if(http_post_test == TYMED_ISTREAM)
3254 }
3255 if(bind_from_cache) {
3256 SET_EXPECT(OnResponse);
3257 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
3258 SET_EXPECT(ReportData);
3259 }
3260
3261 if(uri) {
3262 IInternetProtocolEx *protocolex;
3263
3264 hres = IInternetProtocol_QueryInterface(async_protocol, &IID_IInternetProtocolEx, (void**)&protocolex);
3265 ok(hres == S_OK, "Could not get IInternetProtocolEx iface: %08x\n", hres);
3266
3267 hres = IInternetProtocolEx_StartEx(protocolex, uri, &protocol_sink, &bind_info, 0, 0);
3268 ok(hres == S_OK, "Start failed: %08x\n", hres);
3269
3270 IInternetProtocolEx_Release(protocolex);
3271 IUri_Release(uri);
3272 }else {
3273 hres = IInternetProtocol_Start(async_protocol, url, &protocol_sink, &bind_info, 0, 0);
3274 ok(hres == S_OK, "Start failed: %08x\n", hres);
3275 }
3276 if(FAILED(hres))
3277 return FALSE;
3278
3279 CHECK_CALLED(GetBindInfo);
3280 if (!(bindf & BINDF_FROMURLMON))
3281 CHECK_CALLED(ReportProgress_DIRECTBIND);
3282 if (!got_user_agent)
3283 {
3284 CHECK_CALLED(GetBindString_USER_AGENT);
3285 got_user_agent = TRUE;
3286 }
3287 CLEAR_CALLED(GetBindString_ROOTDOC_URL); /* New in IE11 */
3288 CHECK_CALLED(GetBindString_ACCEPT_MIMES);
3289 CHECK_CALLED(QueryService_HttpNegotiate);
3290 CHECK_CALLED(BeginningTransaction);
3291 /* GetRootSecurityId called on WinXP but not on Win98 */
3292 CLEAR_CALLED(GetRootSecurityId);
3293 if(http_post_test) {
3294 CHECK_CALLED(GetBindString_POST_COOKIE);
3295 if(http_post_test == TYMED_ISTREAM)
3297 }
3298 if(bind_from_cache) {
3299 CHECK_CALLED(OnResponse);
3300 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
3301 CHECK_CALLED(ReportData);
3302 }
3303
3304 return TRUE;
3305}
#define FAILED(hr)
Definition: intsafe.h:51
static BOOL bind_from_cache
Definition: protocol.c:162
static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
Definition: protocol.c:548

Referenced by test_http_protocol_url().

◆ HttpNegotiate_AddRef()

static ULONG WINAPI HttpNegotiate_AddRef ( IHttpNegotiate2 iface)
static

Definition at line 309 of file protocol.c.

310{
311 return 2;
312}

◆ HttpNegotiate_BeginningTransaction()

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

Definition at line 319 of file protocol.c.

321{
322 LPWSTR addl_headers;
323
324 static const WCHAR wszHeaders[] =
325 {'C','o','n','t','e','n','t','-','T','y','p','e',':',' ','a','p','p','l','i','c','a','t',
326 'i','o','n','/','x','-','w','w','w','-','f','o','r','m','-','u','r','l','e','n','c','o',
327 'd','e','d','\r','\n',0};
328
329 CHECK_EXPECT(BeginningTransaction);
330
331 if(binding_test)
332 ok(!lstrcmpW(szURL, binding_urls[tested_protocol]), "szURL != http_url\n");
333 else
334 ok(!lstrcmpW(szURL, http_url), "szURL != http_url\n");
335 ok(!dwReserved, "dwReserved=%d, expected 0\n", dwReserved);
336 ok(pszAdditionalHeaders != NULL, "pszAdditionalHeaders == NULL\n");
337 if(pszAdditionalHeaders)
338 {
339 ok(*pszAdditionalHeaders == NULL, "*pszAdditionalHeaders != NULL\n");
340 if (http_post_test)
341 {
342 addl_headers = CoTaskMemAlloc(sizeof(wszHeaders));
343 memcpy(addl_headers, wszHeaders, sizeof(wszHeaders));
344 *pszAdditionalHeaders = addl_headers;
345 }
346 }
347
348 return S_OK;
349}
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static LPCWSTR http_url
Definition: protocol.c:147
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ HttpNegotiate_GetRootSecurityId()

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

Definition at line 364 of file protocol.c.

366{
367 static const BYTE sec_id[] = {'h','t','t','p',':','t','e','s','t',1,0,0,0};
368
369 CHECK_EXPECT(GetRootSecurityId);
370
371 ok(!dwReserved, "dwReserved=%ld, expected 0\n", dwReserved);
372 ok(pbSecurityId != NULL, "pbSecurityId == NULL\n");
373 ok(pcbSecurityId != NULL, "pcbSecurityId == NULL\n");
374
375 if(pcbSecurityId) {
376 ok(*pcbSecurityId == 512, "*pcbSecurityId=%d, expected 512\n", *pcbSecurityId);
377 *pcbSecurityId = sizeof(sec_id);
378 }
379
380 if(pbSecurityId)
381 memcpy(pbSecurityId, sec_id, sizeof(sec_id));
382
383 return E_FAIL;
384}
#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 351 of file protocol.c.

353{
354 CHECK_EXPECT(OnResponse);
355
356 ok(dwResponseCode == 200, "dwResponseCode=%d, expected 200\n", dwResponseCode);
357 ok(szResponseHeaders != NULL, "szResponseHeaders == NULL\n");
358 ok(szRequestHeaders == NULL, "szRequestHeaders != NULL\n");
359 ok(pszAdditionalRequestHeaders == NULL, "pszAdditionalHeaders != NULL\n");
360
361 return S_OK;
362}

◆ HttpNegotiate_QueryInterface()

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

Definition at line 296 of file protocol.c.

297{
299 || IsEqualGUID(&IID_IHttpNegotiate, riid)
300 || IsEqualGUID(&IID_IHttpNegotiate2, riid)) {
301 *ppv = iface;
302 return S_OK;
303 }
304
305 ok(0, "unexpected call\n");
306 return E_NOINTERFACE;
307}

◆ HttpNegotiate_Release()

static ULONG WINAPI HttpNegotiate_Release ( IHttpNegotiate2 iface)
static

Definition at line 314 of file protocol.c.

315{
316 return 1;
317}

◆ HttpSecurity_AddRef()

static ULONG WINAPI HttpSecurity_AddRef ( IHttpSecurity iface)
static

Definition at line 251 of file protocol.c.

252{
253 return 2;
254}

◆ HttpSecurity_GetWindow()

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

Definition at line 261 of file protocol.c.

262{
263 trace("HttpSecurity_GetWindow\n");
264
265 return S_FALSE;
266}
#define S_FALSE
Definition: winerror.h:2357

◆ HttpSecurity_OnSecurityProblem()

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

Definition at line 268 of file protocol.c.

269{
270 win_skip("Security problem: %u\n", dwProblem);
272 "Expected got %u security problem\n", dwProblem);
273
274 /* Only retry once */
276 return E_ABORT;
277
279 if(dwProblem == ERROR_INTERNET_INVALID_CA)
280 return E_ABORT;
281 SET_EXPECT(BeginningTransaction);
282
283 return RPC_E_RETRY;
284}
#define RPC_E_RETRY
Definition: winerror.h:2485
#define E_ABORT
Definition: winerror.h:2366
#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 239 of file protocol.c.

240{
242 || IsEqualGUID(&IID_IHttpSecurity, riid)) {
243 *ppv = iface;
244 return S_OK;
245 }
246
247 ok(0, "unexpected call\n");
248 return E_NOINTERFACE;
249}

◆ HttpSecurity_Release()

static ULONG WINAPI HttpSecurity_Release ( IHttpSecurity iface)
static

Definition at line 256 of file protocol.c.

257{
258 return 1;
259}

◆ impl_from_IInternetPriority()

static Protocol * impl_from_IInternetPriority ( IInternetPriority iface)
static

Definition at line 1534 of file protocol.c.

1535{
1536 return CONTAINING_RECORD(iface, Protocol, IInternetPriority_iface);
1537}
#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 1634 of file protocol.c.

1635{
1636 return CONTAINING_RECORD(iface, Protocol, IInternetProtocolEx_iface);
1637}

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

◆ impl_from_IUnknown()

static Protocol * impl_from_IUnknown ( IUnknown iface)
static

Definition at line 2247 of file protocol.c.

2248{
2249 return CONTAINING_RECORD(iface, Protocol, IUnknown_inner);
2250}

◆ init_test()

static void init_test ( int  prot,
DWORD  flags 
)
static

Definition at line 2721 of file protocol.c.

2722{
2723 tested_protocol = prot;
2724 binding_test = (flags & TEST_BINDING) != 0;
2726 prot_read = 0;
2727 prot_state = 0;
2730 no_mime = (flags & TEST_NOMIME) != 0;
2731 filter_state = 0;
2732 post_stream_read = 0;
2746 short_read = (flags & TEST_SHORT_READ) != 0;
2747 http_post_test = TYMED_NULL;
2749 test_abort = (flags & TEST_ABORT) != 0;
2751 empty_file = (flags & TEST_EMPTY) != 0;
2756
2757 bindinfo_options = 0;
2759 bindinfo_options |= BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS;
2760
2762}
GLbitfield flags
Definition: glext.h:7161
#define TEST_REDIRECT
Definition: protocol.c:2688
#define TEST_FIRST_HTTP
Definition: protocol.c:2683
#define TEST_ASYNCREQ
Definition: protocol.c:2690
#define TEST_FROMCACHE
Definition: protocol.c:2695
static void register_filter(BOOL do_register)
Definition: protocol.c:2698
static BOOL async_read_pending
Definition: protocol.c:161
static BOOL wait_for_switch
Definition: protocol.c:161
static IInternetProtocol * binding_protocol
Definition: protocol.c:152
static BOOL emulate_prot
Definition: protocol.c:161
static int post_stream_read
Definition: protocol.c:150
static HANDLE event_continue_done
Definition: protocol.c:156
static DWORD filter_state
Definition: protocol.c:159
#define TEST_BINDING
Definition: protocol.c:2681
#define TEST_EMPTY
Definition: protocol.c:2693
static BOOL file_with_hash
Definition: protocol.c:162
#define TEST_SHORT_READ
Definition: protocol.c:2687
static HANDLE event_continue
Definition: protocol.c:156
static BOOL redirect_on_continue
Definition: protocol.c:149
static BOOL impl_protex
Definition: protocol.c:160
static BOOL direct_read
Definition: protocol.c:161
#define TEST_EMULATEPROT
Definition: protocol.c:2686
static BOOL no_mime
Definition: protocol.c:162
#define TEST_DISABLEAUTOREDIRECT
Definition: protocol.c:2696
static DWORD prot_read
Definition: protocol.c:159
#define TEST_NOMIME
Definition: protocol.c:2694
#define TEST_DIRECT_READ
Definition: protocol.c:2684
static BOOL first_data_notif
Definition: protocol.c:149
static BOOL reuse_protocol_thread
Definition: protocol.c:162
static BOOL short_read
Definition: protocol.c:161
static int prot_state
Definition: protocol.c:150
static BOOL mimefilter_test
Definition: protocol.c:161
#define TEST_IMPLPROTEX
Definition: protocol.c:2692
static HANDLE event_complete
Definition: protocol.c:156
#define TEST_FILTER
Definition: protocol.c:2682
#define TEST_ABORT
Definition: protocol.c:2689
static HANDLE event_complete2
Definition: protocol.c:156
static IInternetProtocolSink * filtered_sink
Definition: protocol.c:154
static IInternetProtocol * filtered_protocol
Definition: protocol.c:152
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:714

◆ InternetPriority_AddRef()

static ULONG WINAPI InternetPriority_AddRef ( IInternetPriority iface)
static

Definition at line 1546 of file protocol.c.

1547{
1549 if (This->outer)
1550 {
1551 This->outer_ref++;
1552 return IUnknown_AddRef(This->outer);
1553 }
1554 return IUnknown_AddRef(&This->IUnknown_inner);
1555}
static Protocol * impl_from_IInternetPriority(IInternetPriority *iface)
Definition: protocol.c:1534

◆ InternetPriority_GetPriority()

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

Definition at line 1575 of file protocol.c.

1576{
1577 ok(0, "unexpected call\n");
1578 return E_NOTIMPL;
1579}

◆ InternetPriority_QueryInterface()

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

Definition at line 1539 of file protocol.c.

1541{
1542 ok(0, "unexpected call\n");
1543 return E_NOINTERFACE;
1544}

◆ InternetPriority_Release()

static ULONG WINAPI InternetPriority_Release ( IInternetPriority iface)
static

Definition at line 1557 of file protocol.c.

1558{
1560 if (This->outer)
1561 {
1562 This->outer_ref--;
1563 return IUnknown_Release(This->outer);
1564 }
1565 return IUnknown_Release(&This->IUnknown_inner);
1566}

◆ InternetPriority_SetPriority()

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

Definition at line 1568 of file protocol.c.

1569{
1571 ok(nPriority == ex_priority, "nPriority=%d\n", nPriority);
1572 return S_OK;
1573}
@ SetPriority
Definition: halhw.h:216
static DWORD ex_priority
Definition: protocol.c:151

◆ InternetProtocolInfo_AddRef()

static ULONG WINAPI InternetProtocolInfo_AddRef ( IInternetProtocolInfo iface)
static

Definition at line 2534 of file protocol.c.

2535{
2536 return 2;
2537}

◆ 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 2552 of file protocol.c.

2555{
2556 ok(0, "unexpected call\n");
2557 return E_NOTIMPL;
2558}

◆ InternetProtocolInfo_CompareUrl()

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

Definition at line 2560 of file protocol.c.

2562{
2563 ok(0, "unexpected call\n");
2564 return E_NOTIMPL;
2565}

◆ 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 2544 of file protocol.c.

2547{
2548 ok(0, "unexpected call %d\n", ParseAction);
2549 return E_NOTIMPL;
2550}

◆ 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 2567 of file protocol.c.

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

◆ InternetProtocolInfo_QueryInterface()

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

Definition at line 2528 of file protocol.c.

2529{
2530 ok(0, "unexpected call\n");
2531 return E_NOINTERFACE;
2532}

◆ InternetProtocolInfo_Release()

static ULONG WINAPI InternetProtocolInfo_Release ( IInternetProtocolInfo iface)
static

Definition at line 2539 of file protocol.c.

2540{
2541 return 1;
2542}

◆ MimeFilter_CreateInstance()

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

Definition at line 2660 of file protocol.c.

2661{
2663
2664 ok(!outer, "outer = %p\n", outer);
2665 ok(IsEqualGUID(&IID_IInternetProtocol, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
2666
2667 *ppv = &MimeProtocol;
2668 return S_OK;
2669}
static IInternetProtocolEx MimeProtocol
Definition: protocol.c:2526
static HRESULT WINAPI MimeFilter_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
Definition: protocol.c:2660

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

◆ MimeProtocol_LockRequest()

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

Definition at line 2480 of file protocol.c.

2481{
2482 HRESULT hres;
2483
2484 CHECK_EXPECT(MimeFilter_LockRequest);
2485
2486 ok(!dwOptions, "dwOptions = %x\n", dwOptions);
2487
2489 hres = IInternetProtocol_LockRequest(filtered_protocol, dwOptions);
2490 ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
2492
2493 return S_OK;
2494}
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 2327 of file protocol.c.

2328{
2329 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
2330 *ppv = iface;
2331 return S_OK;
2332 }
2333
2334 if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) {
2336 return S_OK;
2337 }
2338
2339 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
2340 *ppv = NULL;
2341 return E_NOINTERFACE;
2342}
static IInternetProtocolSink mime_protocol_sink
Definition: protocol.c:1372

◆ MimeProtocol_Read()

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

Definition at line 2447 of file protocol.c.

2449{
2450 BYTE buf[2096];
2451 DWORD read = 0;
2452 HRESULT hres;
2453
2454 CHECK_EXPECT(MimeFilter_Read);
2455
2456 ok(pv != NULL, "pv == NULL\n");
2457 ok(cb != 0, "cb == 0\n");
2458 ok(pcbRead != NULL, "pcbRead == NULL\n");
2459
2461 SET_EXPECT(Read2);
2462 else
2464 hres = IInternetProtocol_Read(filtered_protocol, buf, sizeof(buf), &read);
2465 ok(hres == S_OK || hres == S_FALSE || hres == E_PENDING, "Read failed: %08x\n", hres);
2467 CHECK_CALLED(Read2);
2468 else
2470
2471 if(pcbRead) {
2472 ok(*pcbRead == 0, "*pcbRead=%d, expected 0\n", *pcbRead);
2473 *pcbRead = read;
2474 }
2475
2476 memset(pv, 'x', read);
2477 return hres;
2478}
#define read
Definition: acwin.h:96
#define E_PENDING
Definition: dinput.h:172
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
static int read_report_data
Definition: protocol.c:150
_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 2344 of file protocol.c.

2347{
2349 LPOLESTR url_str = NULL;
2350 DWORD fetched = 0;
2351 BINDINFO bindinfo;
2352 DWORD cbindf = 0;
2353 HRESULT hres;
2354
2355 CHECK_EXPECT(MimeFilter_Start);
2356
2357 ok(!lstrcmpW(szUrl, pjpegW), "wrong url %s\n", wine_dbgstr_w(szUrl));
2358 ok(grfPI == (PI_FILTER_MODE|PI_FORCE_ASYNC), "grfPI=%x, expected PI_FILTER_MODE|PI_FORCE_ASYNC\n", grfPI);
2359 ok(dwReserved, "dwReserved == 0\n");
2360 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
2361 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
2362
2363 if(binding_test) {
2364 ok(pOIProtSink != binding_sink, "pOIProtSink == protocol_sink\n");
2365 ok(pOIBindInfo == prot_bind_info, "pOIBindInfo != bind_info\n");
2366 }else {
2367 ok(pOIProtSink == &protocol_sink, "pOIProtSink != protocol_sink\n");
2368 ok(pOIBindInfo == &bind_info, "pOIBindInfo != bind_info\n");
2369 }
2370
2371 data = (void*)dwReserved;
2372 ok(data->cbSize == sizeof(*data), "data->cbSize = %d\n", data->cbSize);
2373 ok(!data->pProtocolSink, "data->pProtocolSink != NULL\n");
2374 ok(data->pProtocol != NULL, "data->pProtocol == NULL\n");
2375 ok(!data->pUnk, "data->pUnk != NULL\n");
2376 ok(!data->dwFilterFlags, "data->dwProtocolFlags = %x\n", data->dwFilterFlags);
2377 if(binding_test) {
2378 IInternetProtocolSink *prot_sink;
2379
2380 IInternetProtocol_QueryInterface(data->pProtocol, &IID_IInternetProtocolSink, (void**)&prot_sink);
2381 ok(prot_sink == pOIProtSink, "QI(data->pProtocol, IID_IInternetProtocolSink) != pOIProtSink\n");
2382 IInternetProtocolSink_Release(prot_sink);
2383
2384 ok(data->pProtocol != binding_protocol, "data->pProtocol == binding_protocol\n");
2385
2386 filtered_protocol = data->pProtocol;
2387 IInternetProtocol_AddRef(filtered_protocol);
2388 }else {
2389 IInternetProtocol *prot;
2390
2391 IInternetProtocol_QueryInterface(data->pProtocol, &IID_IInternetProtocol, (void**)&prot);
2392 ok(prot == async_protocol, "QI(data->pProtocol, IID_IInternetProtocol) != async_protocol\n");
2393 IInternetProtocol_Release(prot);
2394
2395 ok(data->pProtocol != async_protocol, "data->pProtocol == async_protocol\n");
2396 }
2397
2398 filtered_sink = pOIProtSink;
2399
2400 SET_EXPECT(ReportProgress_DECODING);
2401 hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_DECODING, pjpegW);
2402 ok(hres == S_OK, "ReportProgress(BINDSTATUS_DECODING) failed: %08x\n", hres);
2403 CHECK_CALLED(ReportProgress_DECODING);
2404
2405 SET_EXPECT(GetBindInfo);
2406 memset(&bindinfo, 0, sizeof(bindinfo));
2407 bindinfo.cbSize = sizeof(bindinfo);
2408 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &cbindf, &bindinfo);
2409 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
2410 ok(cbindf == (bindf|BINDF_FROMURLMON), "cbindf = %x, expected %x\n", cbindf, bindf);
2411 CHECK_CALLED(GetBindInfo);
2412
2413 SET_EXPECT(GetBindString_URL);
2414 hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_URL, &url_str, 1, &fetched);
2415 ok(hres == S_OK, "GetBindString(BINDSTRING_URL) failed: %08x\n", hres);
2416 ok(fetched == 1, "fetched = %d\n", fetched);
2417 ok(!lstrcmpW(url_str, binding_urls[tested_protocol]), "wrong url_str %s\n", wine_dbgstr_w(url_str));
2418 CoTaskMemFree(url_str);
2419 CHECK_CALLED(GetBindString_URL);
2420
2421 return S_OK;
2422}
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define wine_dbgstr_w
Definition: kernel32.h:34
static LPOLESTR
Definition: stg_prop.c:27
static const WCHAR pjpegW[]
Definition: protocol.c:143
static IInternetProtocolSink * binding_sink
Definition: protocol.c:154

◆ MimeProtocol_Terminate()

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

Definition at line 2431 of file protocol.c.

2432{
2433 HRESULT hres;
2434
2435 CHECK_EXPECT(MimeFilter_Terminate);
2436
2437 ok(!dwOptions, "dwOptions = %x\n", dwOptions);
2438
2439 SET_EXPECT(Terminate);
2440 hres = IInternetProtocol_Terminate(filtered_protocol, dwOptions);
2441 ok(hres == S_OK, "Terminate failed: %08x\n", hres);
2442 CHECK_CALLED(Terminate);
2443
2444 return S_OK;
2445}

◆ MimeProtocol_UnlockRequest()

static HRESULT WINAPI MimeProtocol_UnlockRequest ( IInternetProtocolEx iface)
static

Definition at line 2496 of file protocol.c.

2497{
2498 HRESULT hres;
2499
2500 CHECK_EXPECT(MimeFilter_UnlockRequest);
2501
2503 hres = IInternetProtocol_UnlockRequest(filtered_protocol);
2504 ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
2506
2507 return S_OK;
2508}
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 1240 of file protocol.c.

1241{
1242 return 2;
1243}

◆ MimeProtocolSink_QueryInterface()

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

Definition at line 1228 of file protocol.c.

1229{
1231 || IsEqualGUID(&IID_IInternetProtocolSink, riid)) {
1232 *ppv = iface;
1233 return S_OK;
1234 }
1235
1236 ok(0, "unexpected call\n");
1237 return E_NOTIMPL;
1238}

◆ MimeProtocolSink_Release()

static ULONG WINAPI MimeProtocolSink_Release ( IInternetProtocolSink iface)
static

Definition at line 1245 of file protocol.c.

1246{
1247 return 1;
1248}

◆ MimeProtocolSink_ReportData()

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

Definition at line 1284 of file protocol.c.

1286{
1287 DWORD read = 0;
1288 BYTE buf[8192];
1289 HRESULT hres;
1291
1292 CHECK_EXPECT(MimeFilter_ReportData);
1293
1294 if(!filter_state && !no_mime) {
1296 hres = IInternetProtocol_Read(filtered_protocol, buf, sizeof(buf), &read);
1298 ok(hres == S_OK || hres == E_PENDING || hres == S_FALSE, "Read failed: %08x\n", hres);
1299 else
1300 ok(hres == S_OK, "Read failed: %08x\n", hres);
1302
1303 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
1304 hres = IInternetProtocolSink_ReportProgress(filtered_sink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, text_htmlW);
1305 ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
1306 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
1307
1308 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
1309 hres = IInternetProtocolSink_ReportProgress(filtered_sink, BINDSTATUS_MIMETYPEAVAILABLE, text_htmlW);
1310 ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
1311 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
1312
1313 /* FIXME: test BINDSTATUS_CACHEFILENAMEAVAILABLE */
1314 }
1315
1316 if(no_mime && prot_read<200) {
1318 }else if(no_mime && prot_read<300) {
1319 report_mime = TRUE;
1321 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
1322 SET_EXPECT(ReportData);
1323 }else if(!read_report_data) {
1324 SET_EXPECT(ReportData);
1325 }
1326 hres = IInternetProtocolSink_ReportData(filtered_sink, grfBSCF, ulProgress, ulProgressMax);
1327 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
1328 if(no_mime && prot_read<=200) {
1330 }else if(report_mime) {
1331 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
1332 CHECK_CALLED(ReportData);
1333 }else if(!read_report_data) {
1334 CHECK_CALLED(ReportData);
1335 }
1336
1337 if(!filter_state)
1338 filter_state = 1;
1339
1340 return S_OK;
1341}
static BOOL report_mime
Definition: htmldoc.c:202
static const WCHAR text_htmlW[]
Definition: protocol.c:139

◆ MimeProtocolSink_ReportProgress()

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

Definition at line 1264 of file protocol.c.

1266{
1267 switch(ulStatusCode) {
1268 case BINDSTATUS_LOADINGMIMEHANDLER:
1269 /*
1270 * IE9 for some reason (bug?) calls this on mime handler's protocol sink instead of the
1271 * main protocol sink. We check ReportProgress_LOADINGMIMEHANDLER both here and in
1272 * ProtocolSink_ReportProgress to workaround it.
1273 */
1274 CHECK_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
1275 ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
1276 break;
1277 default:
1278 ok(0, "Unexpected status code %d\n", ulStatusCode);
1279 }
1280
1281 return S_OK;
1282}

◆ MimeProtocolSink_ReportResult()

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

Definition at line 1343 of file protocol.c.

1345{
1346 HRESULT hres;
1347
1348 CHECK_EXPECT(MimeFilter_ReportResult);
1349
1350 ok(hrResult == S_OK, "hrResult = %08x\n", hrResult);
1351 ok(dwError == ERROR_SUCCESS, "dwError = %u\n", dwError);
1352 ok(!szResult, "szResult = %s\n", wine_dbgstr_w(szResult));
1353
1354 SET_EXPECT(ReportResult);
1355 hres = IInternetProtocolSink_ReportResult(filtered_sink, hrResult, dwError, szResult);
1356 ok(SUCCEEDED(hres), "ReportResult failed: %08x\n", hres);
1357 CHECK_CALLED(ReportResult);
1358
1359 return S_OK;
1360}
#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 1250 of file protocol.c.

1251{
1252 HRESULT hres;
1253
1254 CHECK_EXPECT(MimeFilter_Switch);
1255
1256 SET_EXPECT(Switch);
1257 hres = IInternetProtocolSink_Switch(filtered_sink, pProtocolData);
1258 ok(hres == S_OK, "Switch failed: %08x\n", hres);
1259 CHECK_CALLED(Switch);
1260
1261 return S_OK;
1262}

◆ obj_refcount()

static LONG obj_refcount ( void obj)
static

Definition at line 219 of file protocol.c.

220{
221 IUnknown_AddRef((IUnknown *)obj);
222 return IUnknown_Release((IUnknown *)obj);
223}

Referenced by test_CreateBinding().

◆ outer_AddRef()

static ULONG WINAPI outer_AddRef ( IUnknown iface)
static

Definition at line 4205 of file protocol.c.

4206{
4207 return 2;
4208}

◆ outer_QueryInterface()

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

Definition at line 4194 of file protocol.c.

4195{
4197 CHECK_EXPECT(outer_QI_test);
4198 *ppv = (IUnknown*)0xdeadbeef;
4199 return S_OK;
4200 }
4201 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
4202 return E_NOINTERFACE;
4203}
static const IID outer_test_iid
Definition: protocol.c:667

◆ outer_Release()

static ULONG WINAPI outer_Release ( IUnknown iface)
static

Definition at line 4210 of file protocol.c.

4211{
4212 return 1;
4213}

◆ Protocol_Abort()

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

Definition at line 1600 of file protocol.c.

1602{
1603 HRESULT hres;
1604
1605 CHECK_EXPECT(Abort);
1606
1607 SET_EXPECT(ReportResult);
1608 hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
1609 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
1610 CHECK_CALLED(ReportResult);
1611
1612 return S_OK;
1613}

◆ Protocol_AddRef()

static ULONG WINAPI Protocol_AddRef ( IInternetProtocolEx iface)
static

Definition at line 1590 of file protocol.c.

1591{
1592 return 2;
1593}

◆ Protocol_Continue()

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

Definition at line 2424 of file protocol.c.

2426{
2427 CHECK_EXPECT(MimeFilter_Continue);
2428 return E_NOTIMPL;
2429}

◆ Protocol_Release()

static ULONG WINAPI Protocol_Release ( IInternetProtocolEx iface)
static

Definition at line 1595 of file protocol.c.

1596{
1597 return 1;
1598}

◆ Protocol_Resume()

static HRESULT WINAPI Protocol_Resume ( IInternetProtocolEx iface)
static

Definition at line 1621 of file protocol.c.

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

◆ Protocol_Seek()

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

Definition at line 1627 of file protocol.c.

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

◆ protocol_start()

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

Definition at line 1773 of file protocol.c.

1774{
1775 BINDINFO bindinfo, exp_bindinfo;
1776 DWORD cbindf = 0;
1777 HRESULT hres;
1778
1779 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
1780 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
1781 ok(pOIProtSink != &protocol_sink, "unexpected pOIProtSink\n");
1782 ok(pOIBindInfo != &bind_info, "unexpected pOIBindInfo\n");
1783 ok(!pi, "pi = %x\n", pi);
1784
1785 if(binding_test)
1786 ok(pOIProtSink == binding_sink, "pOIProtSink != binding_sink\n");
1787
1788 memset(&bindinfo, 0, sizeof(bindinfo));
1789 bindinfo.cbSize = sizeof(bindinfo);
1790 memcpy(&exp_bindinfo, &bindinfo, sizeof(bindinfo));
1791 if(test_redirect)
1792 exp_bindinfo.dwOptions = bindinfo_options;
1793 SET_EXPECT(GetBindInfo);
1794 if(redirect_on_continue && (bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS))
1795 SET_EXPECT(QueryService_IBindCallbackRedirect);
1796 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &cbindf, &bindinfo);
1797 if(redirect_on_continue && (bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS))
1798 CHECK_CALLED(QueryService_IBindCallbackRedirect);
1799 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
1800 CHECK_CALLED(GetBindInfo);
1801 ok(cbindf == (bindf|BINDF_FROMURLMON), "bindf = %x, expected %x\n",
1802 cbindf, (bindf|BINDF_FROMURLMON));
1803 ok(!memcmp(&exp_bindinfo, &bindinfo, sizeof(bindinfo)), "unexpected bindinfo\n");
1804 pReleaseBindInfo(&bindinfo);
1805
1806 SET_EXPECT(ReportProgress_SENDINGREQUEST);
1807 hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, emptyW);
1808 ok(hres == S_OK, "ReportProgress(BINDSTATUS_SENDINGREQUEST) failed: %08x\n", hres);
1809 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
1810
1814 IHttpNegotiate2 *http_negotiate2;
1815 LPWSTR ua = (LPWSTR)0xdeadbeef, accept_mimes[256];
1816 LPWSTR additional_headers = NULL;
1817 BYTE sec_id[100];
1818 DWORD fetched = 0, size = 100;
1819 DWORD tid;
1820
1821 SET_EXPECT(GetBindString_USER_AGENT);
1822 hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_USER_AGENT,
1823 &ua, 1, &fetched);
1824 CHECK_CALLED(GetBindString_USER_AGENT);
1825 ok(hres == S_OK, "GetBindString(BINDSTRING_USER_AGETNT) failed: %08x\n", hres);
1826 ok(fetched == 1, "fetched = %d, expected 254\n", fetched);
1827 ok(ua != NULL, "ua = %p\n", ua);
1828 ok(!lstrcmpW(ua, user_agentW), "unexpected user agent %s\n", wine_dbgstr_w(ua));
1829 CoTaskMemFree(ua);
1830
1831 fetched = 256;
1832 SET_EXPECT(GetBindString_ACCEPT_MIMES);
1833 hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_ACCEPT_MIMES,
1834 accept_mimes, 256, &fetched);
1835 CHECK_CALLED(GetBindString_ACCEPT_MIMES);
1836
1837 ok(hres == S_OK,
1838 "GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08x\n", hres);
1839 ok(fetched == 1, "fetched = %d, expected 1\n", fetched);
1840 ok(!lstrcmpW(acc_mimeW, accept_mimes[0]), "unexpected mimes %s\n", wine_dbgstr_w(accept_mimes[0]));
1841 CoTaskMemFree(accept_mimes[0]);
1842
1843 hres = IInternetBindInfo_QueryInterface(pOIBindInfo, &IID_IServiceProvider,
1844 (void**)&service_provider);
1845 ok(hres == S_OK, "QueryInterface failed: %08x\n", hres);
1846
1847 SET_EXPECT(QueryService_HttpNegotiate);
1848 hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate,
1849 &IID_IHttpNegotiate, (void**)&http_negotiate);
1850 CHECK_CALLED(QueryService_HttpNegotiate);
1851 ok(hres == S_OK, "QueryService failed: %08x\n", hres);
1852
1853 SET_EXPECT(BeginningTransaction);
1854 hres = IHttpNegotiate_BeginningTransaction(http_negotiate, binding_urls[tested_protocol],
1855 NULL, 0, &additional_headers);
1856 CHECK_CALLED(BeginningTransaction);
1857 IHttpNegotiate_Release(http_negotiate);
1858 ok(hres == S_OK, "BeginningTransction failed: %08x\n", hres);
1859 ok(additional_headers == NULL, "additional_headers=%p\n", additional_headers);
1860
1861 SET_EXPECT(QueryService_HttpNegotiate);
1862 hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate2,
1863 &IID_IHttpNegotiate2, (void**)&http_negotiate2);
1864 CHECK_CALLED(QueryService_HttpNegotiate);
1865 ok(hres == S_OK, "QueryService failed: %08x\n", hres);
1866
1867 size = 512;
1868 SET_EXPECT(GetRootSecurityId);
1869 hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, sec_id, &size, 0);
1870 CHECK_CALLED(GetRootSecurityId);
1871 IHttpNegotiate2_Release(http_negotiate2);
1872 ok(hres == E_FAIL, "GetRootSecurityId failed: %08x, expected E_FAIL\n", hres);
1873 ok(size == 13, "size=%d\n", size);
1874
1875 IServiceProvider_Release(service_provider);
1876
1879 return;
1880 }
1881
1882 SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
1883 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
1884 BINDSTATUS_CACHEFILENAMEAVAILABLE, expect_wsz = emptyW);
1885 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
1886 CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
1887
1888 if(mimefilter_test) {
1890 SET_EXPECT(MimeFilter_Start);
1891 SET_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
1892 }
1893 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
1894 hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE,
1896 ok(hres == S_OK,
1897 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
1898 if(mimefilter_test) {
1900 CHECK_CALLED(MimeFilter_Start);
1901 CHECK_CALLED(ReportProgress_LOADINGMIMEHANDLER);
1902 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
1903 }else {
1904 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
1905 }
1906
1907 if(mimefilter_test)
1908 SET_EXPECT(MimeFilter_ReportData);
1909 else
1910 SET_EXPECT(ReportData);
1911 hres = IInternetProtocolSink_ReportData(pOIProtSink,
1912 BSCF_FIRSTDATANOTIFICATION | (tested_protocol == ITS_TEST ? BSCF_DATAFULLYAVAILABLE : BSCF_LASTDATANOTIFICATION),
1913 13, 13);
1914 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
1915 if(mimefilter_test)
1916 CHECK_CALLED(MimeFilter_ReportData);
1917 else
1918 CHECK_CALLED(ReportData);
1919
1920 if(tested_protocol == ITS_TEST) {
1921 SET_EXPECT(ReportData);
1922 hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_BEGINDOWNLOADDATA, NULL);
1923 ok(hres == S_OK, "ReportProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
1924 CHECK_CALLED(ReportData);
1925 }
1926
1927 if(tested_protocol == BIND_TEST) {
1928 hres = IInternetProtocol_Terminate(binding_protocol, 0);
1929 ok(hres == E_FAIL, "Termiante failed: %08x\n", hres);
1930 }
1931
1932 if(mimefilter_test)
1933 SET_EXPECT(MimeFilter_ReportResult);
1934 else
1935 SET_EXPECT(ReportResult);
1936 hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
1937 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
1938 if(mimefilter_test)
1939 CHECK_CALLED(MimeFilter_ReportResult);
1940 else
1941 CHECK_CALLED(ReportResult);
1942}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
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
static TfClientId tid
static LPCWSTR expect_wsz
Definition: protocol.c:147
static IHttpNegotiate2 http_negotiate
Definition: protocol.c:395
static IServiceProvider service_provider
Definition: protocol.c:497
static DWORD pi
Definition: protocol.c:151
static DWORD WINAPI thread_proc(PVOID arg)
Definition: protocol.c:1686
static const WCHAR emptyW[]
Definition: protocol.c:142

◆ Protocol_Suspend()

static HRESULT WINAPI Protocol_Suspend ( IInternetProtocolEx iface)
static

Definition at line 1615 of file protocol.c.

1616{
1617 ok(0, "unexpected call\n");
1618 return E_NOTIMPL;
1619}

◆ ProtocolEmul_AddRef()

static ULONG WINAPI ProtocolEmul_AddRef ( IInternetProtocolEx iface)
static

Definition at line 1664 of file protocol.c.

1665{
1667 if (This->outer)
1668 {
1669 This->outer_ref++;
1670 return IUnknown_AddRef(This->outer);
1671 }
1672 return IUnknown_AddRef(&This->IUnknown_inner);
1673}
static Protocol * impl_from_IInternetProtocolEx(IInternetProtocolEx *iface)
Definition: protocol.c:1634

◆ ProtocolEmul_Continue()

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

Definition at line 1955 of file protocol.c.

1957{
1958 DWORD bscf = 0, pr;
1959 HRESULT hres;
1960
1961 CHECK_EXPECT(Continue);
1962
1963 ok(pProtocolData != NULL, "pProtocolData == NULL\n");
1964 if(!pProtocolData || tested_protocol == BIND_TEST)
1965 return S_OK;
1966 if(binding_test) {
1967 ok(pProtocolData != &protocoldata, "pProtocolData == &protocoldata\n");
1968 ok(pProtocolData->grfFlags == protocoldata.grfFlags, "grfFlags wrong %x/%x\n",
1969 pProtocolData->grfFlags, protocoldata.grfFlags );
1970 ok(pProtocolData->dwState == protocoldata.dwState, "dwState wrong %x/%x\n",
1971 pProtocolData->dwState, protocoldata.dwState );
1972 ok(pProtocolData->pData == protocoldata.pData, "pData wrong %p/%p\n",
1973 pProtocolData->pData, protocoldata.pData );
1974 ok(pProtocolData->cbData == protocoldata.cbData, "cbData wrong %x/%x\n",
1975 pProtocolData->cbData, protocoldata.cbData );
1976 }
1977
1978 switch(prot_state) {
1979 case 1: {
1982 static const WCHAR header[] = {'?',0};
1983 static const WCHAR redirect_urlW[] = {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',
1984 '/','t','e','s','t','s','/','h','e','l','l','o','.','h','t','m','l',0};
1985
1989
1990 if(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS)
1991 SET_EXPECT(Redirect);
1992 SET_EXPECT(ReportProgress_REDIRECTING);
1993 SET_EXPECT(Terminate);
1994 SET_EXPECT(Protocol_destructor);
1995 SET_EXPECT(QueryService_InternetProtocol);
1996 SET_EXPECT(CreateInstance);
1997 SET_EXPECT(ReportProgress_PROTOCOLCLASSID);
2000 hres = IInternetProtocolSink_ReportResult(binding_sink, INET_E_REDIRECT_FAILED, ERROR_SUCCESS, redirect_urlW);
2001 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
2002 if(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS)
2003 CHECK_CALLED(Redirect);
2004 CHECK_CALLED(ReportProgress_REDIRECTING);
2005 CHECK_CALLED(Terminate);
2006 CHECK_CALLED(Protocol_destructor);
2007 CHECK_CALLED(QueryService_InternetProtocol);
2008 CHECK_CALLED(CreateInstance);
2009 CHECK_CALLED(ReportProgress_PROTOCOLCLASSID);
2012
2013 return S_OK;
2014 }
2015
2016 hres = IInternetProtocolSink_QueryInterface(binding_sink, &IID_IServiceProvider,
2017 (void**)&service_provider);
2018 ok(hres == S_OK, "Could not get IServiceProvicder\n");
2019
2020 SET_EXPECT(QueryService_HttpNegotiate);
2021 hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate,
2022 &IID_IHttpNegotiate, (void**)&http_negotiate);
2023 IServiceProvider_Release(service_provider);
2024 CHECK_CALLED(QueryService_HttpNegotiate);
2025 ok(hres == S_OK, "Could not get IHttpNegotiate\n");
2026
2027 SET_EXPECT(OnResponse);
2028 hres = IHttpNegotiate_OnResponse(http_negotiate, 200, header, NULL, NULL);
2029 IHttpNegotiate_Release(http_negotiate);
2030 CHECK_CALLED(OnResponse);
2031 IHttpNegotiate_Release(http_negotiate);
2032 ok(hres == S_OK, "OnResponse failed: %08x\n", hres);
2033
2034 if(mimefilter_test) {
2036 SET_EXPECT(MimeFilter_Start);
2037 SET_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
2038 }else if(!(pi & PI_MIMEVERIFICATION)) {
2039 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
2040 }
2041 hres = IInternetProtocolSink_ReportProgress(binding_sink,
2042 BINDSTATUS_MIMETYPEAVAILABLE, mimefilter_test ? pjpegW : text_htmlW);
2043 if(mimefilter_test) {
2045 CHECK_CALLED(MimeFilter_Start);
2046 CHECK_CALLED(ReportProgress_LOADINGMIMEHANDLER);
2047 }else if(!(pi & PI_MIMEVERIFICATION)) {
2048 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
2049 }
2050 ok(hres == S_OK,
2051 "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
2052
2053 bscf |= BSCF_FIRSTDATANOTIFICATION;
2054 break;
2055 }
2056 case 2:
2057 case 3:
2058 bscf = BSCF_INTERMEDIATEDATANOTIFICATION;
2059 break;
2060 }
2061
2062 pr = prot_read;
2063 if(mimefilter_test)
2064 SET_EXPECT(MimeFilter_ReportData);
2065 if((!mimefilter_test || no_mime) && (pi & PI_MIMEVERIFICATION)) {
2066 if(pr < 200)
2067 SET_EXPECT(Read); /* checked in ReportData for short_read */
2068 if(pr == 200) {
2069 if(!mimefilter_test)
2070 SET_EXPECT(Read); /* checked in BINDSTATUS_MIMETYPEAVAILABLE or ReportData */
2071 SET_EXPECT(GetBindInfo);
2072 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
2073 }
2074 if(pr >= 200)
2075 SET_EXPECT(ReportData);
2076 }else {
2077 SET_EXPECT(ReportData);
2078 }
2079
2080 hres = IInternetProtocolSink_ReportData(binding_sink, bscf, pr, 400);
2081 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
2082
2083 if(mimefilter_test) {
2084 SET_EXPECT(MimeFilter_ReportData);
2085 }else if(pi & PI_MIMEVERIFICATION) {
2086 if(!short_read && pr < 200)
2088 if(pr == 200) {
2089 CLEAR_CALLED(GetBindInfo); /* IE9 */
2090 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
2091 }
2092 }else {
2093 CHECK_CALLED(ReportData);
2094 }
2095
2096 if(prot_state == 3)
2097 prot_state = 4;
2098
2099 return S_OK;
2100}
static PROTOCOLDATA protocoldata
Definition: protocol.c:158
#define CHECK_NOT_CALLED(func)
Definition: protocol.c:61
@ Start
Definition: partlist.h:33

◆ ProtocolEmul_LockRequest()

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

Definition at line 2207 of file protocol.c.

2208{
2210 ok(dwOptions == 0, "dwOptions=%x\n", dwOptions);
2211 return S_OK;
2212}

◆ ProtocolEmul_QueryInterface()

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

Definition at line 1639 of file protocol.c.

1640{
1642
1643 static const IID unknown_iid = {0x7daf9908,0x8415,0x4005,{0x95,0xae, 0xbd,0x27,0xf6,0xe3,0xdc,0x00}};
1644 static const IID unknown_iid2 = {0x5b7ebc0c,0xf630,0x4cea,{0x89,0xd3,0x5a,0xf0,0x38,0xed,0x05,0x5c}};
1645
1646 if(IsEqualGUID(riid, &IID_IInternetProtocolEx)) {
1647 *ppv = &This->IInternetProtocolEx_iface;
1648 IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface);
1649 return S_OK;
1650 }
1651
1652 /* FIXME: Why is it calling here instead of outer IUnknown? */
1653 if(IsEqualGUID(riid, &IID_IInternetPriority)) {
1654 *ppv = &This->IInternetPriority_iface;
1655 IInternetPriority_AddRef(&This->IInternetPriority_iface);
1656 return S_OK;
1657 }
1658 if(!IsEqualGUID(riid, &unknown_iid) && !IsEqualGUID(riid, &unknown_iid2)) /* IE10 */
1659 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
1660 *ppv = NULL;
1661 return E_NOINTERFACE;
1662}

◆ ProtocolEmul_Read()

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

Definition at line 2109 of file protocol.c.

2111{
2113 CHECK_EXPECT2(Read2);
2114
2116 if(!read_report_data)
2118 }else if((pi & PI_MIMEVERIFICATION)) {
2119 if(!read_report_data)
2121
2122 if(prot_read < 300) {
2123 ok(pv != expect_pv, "pv == expect_pv\n");
2124 if(prot_read < 300)
2125 ok(cb == 2048-prot_read, "cb=%d\n", cb);
2126 else
2127 ok(cb == 700, "cb=%d\n", cb);
2128 }else {
2129 ok(expect_pv <= pv && (BYTE*)pv < (BYTE*)expect_pv + cb, "pv != expect_pv\n");
2130 }
2131 }else {
2132 if(!read_report_data)
2134
2135 ok(pv == expect_pv, "pv != expect_pv\n");
2136 ok(cb == 1000, "cb=%d\n", cb);
2137 ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
2138 }
2139 ok(pcbRead != NULL, "pcbRead == NULL\n");
2140
2141 if(prot_state == 3 || (short_read && prot_state != 4)) {
2142 HRESULT hres;
2143
2144 prot_state = 4;
2145 if(short_read) {
2146 SET_EXPECT(Read2); /* checked in BINDSTATUS_MIMETYPEAVAILABLE */
2147 SET_EXPECT(GetBindInfo);
2148 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
2149 }
2150 if(mimefilter_test)
2151 SET_EXPECT(MimeFilter_ReportData);
2152 else if(direct_read)
2153 SET_EXPECT(ReportData2);
2155 hres = IInternetProtocolSink_ReportData(binding_sink,
2156 BSCF_LASTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION, 0, 0);
2158 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
2159 if(short_read) {
2160 CLEAR_CALLED(GetBindInfo); /* IE9 */
2161 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
2162 }
2163 if(mimefilter_test)
2164 CHECK_CALLED(MimeFilter_ReportData);
2165 else if(direct_read)
2166 CHECK_CALLED(ReportData2);
2167
2168 if(mimefilter_test)
2169 SET_EXPECT(MimeFilter_ReportResult);
2170 else
2171 SET_EXPECT(ReportResult);
2172 hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
2173 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
2174 if(mimefilter_test)
2175 CHECK_CALLED(MimeFilter_ReportResult);
2176 else
2177 CHECK_CALLED(ReportResult);
2178
2179 if(cb > 100)
2180 cb = 100;
2181 memset(pv, 'x', cb);
2182 if(cb>6)
2183 memcpy(pv, "gif87a", 6);
2184 prot_read += *pcbRead = cb;
2185 return S_OK;
2186 }
2187
2188 if(prot_state == 4) {
2189 *pcbRead = 0;
2190 return S_FALSE;
2191 }
2192
2194 *pcbRead = 0;
2196 }
2197
2198 if(cb > 100)
2199 cb = 100;
2200 memset(pv, 'x', cb);
2201 if(cb>6)
2202 memcpy(pv, "gif87a", 6);
2203 prot_read += *pcbRead = cb;
2204 return S_OK;
2205}
#define CHECK_EXPECT2(func)
Definition: protocol.c:43
static void * expect_pv
Definition: protocol.c:155

◆ ProtocolEmul_Release()

static ULONG WINAPI ProtocolEmul_Release ( IInternetProtocolEx iface)
static

Definition at line 1675 of file protocol.c.

1676{
1678 if (This->outer)
1679 {
1680 This->outer_ref--;
1681 return IUnknown_Release(This->outer);
1682 }
1683 return IUnknown_Release(&This->IUnknown_inner);
1684}

◆ ProtocolEmul_Start()

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

Definition at line 1944 of file protocol.c.

1947{
1949
1950 ok(!dwReserved, "dwReserved = %lx\n", dwReserved);
1951 protocol_start(pOIProtSink, pOIBindInfo, grfPI);
1952 return S_OK;
1953}
#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 2220 of file protocol.c.

2223{
2224 CHECK_EXPECT(StartEx);
2225 ok(!dwReserved, "dwReserved = %p\n", dwReserved);
2226 protocol_start(pOIProtSink, pOIBindInfo, grfPI);
2227 return S_OK;
2228}

◆ ProtocolEmul_Terminate()

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

Definition at line 2102 of file protocol.c.

2103{
2104 CHECK_EXPECT(Terminate);
2105 ok(!dwOptions, "dwOptions=%d\n", dwOptions);
2106 return S_OK;
2107}

◆ ProtocolEmul_UnlockRequest()

static HRESULT WINAPI ProtocolEmul_UnlockRequest ( IInternetProtocolEx iface)
static

Definition at line 2214 of file protocol.c.

2215{
2217 return S_OK;
2218}

◆ ProtocolSink_AddRef()

static ULONG WINAPI ProtocolSink_AddRef ( IInternetProtocolSink iface)
static

Definition at line 636 of file protocol.c.

637{
638 return 2;
639}

◆ ProtocolSink_QueryInterface()

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

Definition at line 631 of file protocol.c.

632{
633 return QueryInterface(riid, ppv);
634}
static HRESULT QueryInterface(REFIID, void **)
Definition: protocol.c:1374

◆ ProtocolSink_Release()

static ULONG WINAPI ProtocolSink_Release ( IInternetProtocolSink iface)
static

Definition at line 641 of file protocol.c.

642{
643 return 1;
644}

◆ ProtocolSink_ReportData()

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

Definition at line 1001 of file protocol.c.

1003{
1004 HRESULT hres;
1005
1006 static int rec_depth;
1007 rec_depth++;
1008
1010 CHECK_EXPECT2(ReportData);
1011
1012 ok(ulProgress == ulProgressMax, "ulProgress (%d) != ulProgressMax (%d)\n",
1013 ulProgress, ulProgressMax);
1014 if(!file_with_hash)
1015 ok(ulProgressMax == 13, "ulProgressMax=%d, expected 13\n", ulProgressMax);
1016 /* BSCF_SKIPDRAINDATAFORFILEURLS added in IE8 */
1018 ok((grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION)) ||
1019 (grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION | BSCF_SKIPDRAINDATAFORFILEURLS)),
1020 "grcfBSCF = %08x\n", grfBSCF);
1021 else
1022 ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE), "grcfBSCF = %08x\n", grfBSCF);
1023 }else if(bind_from_cache) {
1024 CHECK_EXPECT(ReportData);
1025
1026 ok(grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE), "grcfBSCF = %08x\n", grfBSCF);
1027 ok(ulProgress == 1000, "ulProgress = %u\n", ulProgress);
1028 ok(!ulProgressMax, "ulProgressMax = %u\n", ulProgressMax);
1029 }else if(direct_read) {
1030 BYTE buf[14096];
1031 ULONG read;
1032
1033 if(!read_report_data && rec_depth == 1) {
1034 BOOL reported_all_data = called_ReportData2;
1035
1036 CHECK_EXPECT2(ReportData);
1037
1038 if(short_read) {
1039 ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE)
1040 || grfBSCF == BSCF_FIRSTDATANOTIFICATION, /* < IE8 */
1041 "grcfBSCF = %08x\n", grfBSCF);
1042 CHECK_CALLED(Read); /* Set in Continue */
1044 }else if(first_data_notif) {
1045 ok(grfBSCF == BSCF_FIRSTDATANOTIFICATION, "grcfBSCF = %08x\n", grfBSCF);
1047 }else if(reported_all_data) {
1048 ok(grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION),
1049 "grcfBSCF = %08x\n", grfBSCF);
1050 }else if(!direct_read) {
1051 ok(grfBSCF == BSCF_INTERMEDIATEDATANOTIFICATION, "grcfBSCF = %08x\n", grfBSCF);
1052 }
1053
1054 do {
1055 read = 0;
1056 if(emulate_prot)
1058 else
1059 SET_EXPECT(ReportData2);
1060 SET_EXPECT(ReportResult);
1061 if(!emulate_prot)
1062 SET_EXPECT(Switch);
1063 hres = IInternetProtocol_Read(binding_test ? binding_protocol : async_protocol, expect_pv = buf, sizeof(buf), &read);
1064 ok(hres == E_PENDING || hres == S_FALSE || hres == S_OK, "Read failed: %08x\n", hres);
1065 if(hres == S_OK)
1066 ok(read, "read == 0\n");
1067 if(reported_all_data)
1068 ok(hres == S_FALSE, "Read failed: %08x, expected S_FALSE\n", hres);
1069 if(!emulate_prot && hres != E_PENDING)
1070 CHECK_NOT_CALLED(Switch); /* otherwise checked in wait_for_switch loop */
1071 if(emulate_prot)
1073 if(!reported_all_data && called_ReportData2) {
1074 if(!emulate_prot)
1075 CHECK_CALLED(ReportData2);
1076 CHECK_CALLED(ReportResult);
1077 reported_all_data = TRUE;
1078 }else {
1079 if(!emulate_prot)
1080 CHECK_NOT_CALLED(ReportData2);
1081 CHECK_NOT_CALLED(ReportResult);
1082 }
1083 }while(hres == S_OK);
1084 if(hres == S_FALSE)
1086 }else {
1087 CHECK_EXPECT(ReportData2);
1088
1089 ok(grfBSCF & BSCF_LASTDATANOTIFICATION, "grfBSCF = %08x\n", grfBSCF);
1090
1091 read = 0xdeadbeef;
1092 if(emulate_prot)
1093 SET_EXPECT(Read2);
1094 hres = IInternetProtocol_Read(binding_test ? binding_protocol : async_protocol, expect_pv = buf, sizeof(buf), &read);
1095 if(emulate_prot)
1096 CHECK_CALLED(Read2);
1097 ok(hres == S_FALSE, "Read returned: %08x, expected E_FALSE\n", hres);
1098 ok(!read, "read = %d\n", read);
1099 }
1101 || tested_protocol == FTP_TEST)) {
1102 if(empty_file)
1103 CHECK_EXPECT2(ReportData);
1104 else if(!(grfBSCF & BSCF_LASTDATANOTIFICATION) || (grfBSCF & BSCF_DATAFULLYAVAILABLE))
1105 CHECK_EXPECT(ReportData);
1106 else if (http_post_test)
1107 ok(ulProgress == 13, "Read %u bytes instead of 13\n", ulProgress);
1108
1109 if(empty_file) {
1110 ok(!ulProgress, "ulProgress = %d\n", ulProgress);
1111 ok(!ulProgressMax, "ulProgressMax = %d\n", ulProgressMax);
1112 }else {
1113 ok(ulProgress, "ulProgress == 0\n");
1114 }
1115
1116 if(empty_file) {
1117 ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION),
1118 "grcfBSCF = %08x\n", grfBSCF);
1120 }else if(first_data_notif) {
1121 ok(grfBSCF == BSCF_FIRSTDATANOTIFICATION
1122 || grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE),
1123 "grcfBSCF = %08x\n", grfBSCF);
1125 } else {
1126 ok(grfBSCF == BSCF_INTERMEDIATEDATANOTIFICATION
1127 || grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION)
1128 || broken(grfBSCF == (BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION)),
1129 "grcfBSCF = %08x\n", grfBSCF);
1130 }
1131
1132 if((grfBSCF & BSCF_FIRSTDATANOTIFICATION) && !binding_test)
1134
1135 if(!(bindf & BINDF_FROMURLMON) &&
1136 !(grfBSCF & BSCF_LASTDATANOTIFICATION)) {
1137 if(state == STATE_CONNECTING) {
1139 if(http_is_first) {
1140 CHECK_CALLED(ReportProgress_FINDINGRESOURCE);
1141 CHECK_CALLED(ReportProgress_CONNECTING);
1142 }
1143 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
1144 CHECK_CALLED(OnResponse);
1145 CHECK_CALLED(ReportProgress_RAWMIMETYPE);
1146 }
1148 }
1149 }else if(!read_report_data) {
1150 BYTE buf[1000];
1151 ULONG read;
1152 HRESULT hres;
1153
1154 CHECK_EXPECT(ReportData);
1155
1156 if(tested_protocol != BIND_TEST) {
1157 do {
1158 if(mimefilter_test)
1159 SET_EXPECT(MimeFilter_Read);
1160 else if(rec_depth > 1)
1161 SET_EXPECT(Read2);
1162 else
1164 hres = IInternetProtocol_Read(binding_protocol, expect_pv=buf, sizeof(buf), &read);
1165 if(mimefilter_test)
1166 CHECK_CALLED(MimeFilter_Read);
1167 else if(rec_depth > 1)
1168 CHECK_CALLED(Read2);
1169 else
1171 }while(hres == S_OK);
1172 }
1173 }
1174
1175 rec_depth--;
1176 return S_OK;
1177}
#define broken(x)
Definition: _sntprintf.h:21
static void test_http_info(IInternetProtocol *protocol)
Definition: protocol.c:968
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
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 null_guid[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-',
830 '0','0','0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0','0','}',0};
831 static const WCHAR text_plain[] = {'t','e','x','t','/','p','l','a','i','n',0};
832
833 if (winetest_debug > 1)
834 {
835 if (ulStatusCode < ARRAY_SIZE(status_names))
836 trace( "progress: %s %s\n", status_names[ulStatusCode], wine_dbgstr_w(szStatusText) );
837 else
838 trace( "progress: %u %s\n", ulStatusCode, wine_dbgstr_w(szStatusText) );
839 }
840
841 switch(ulStatusCode) {
842 case BINDSTATUS_MIMETYPEAVAILABLE:
843 CHECK_EXPECT2(ReportProgress_MIMETYPEAVAILABLE);
844 if(tested_protocol != FILE_TEST && tested_protocol != ITS_TEST && !mimefilter_test && (pi & PI_MIMEVERIFICATION)) {
845 if(!short_read || !direct_read)
846 CHECK_CALLED(Read); /* set in Continue */
847 else if(short_read)
848 CHECK_CALLED(Read2); /* set in Read */
849 }
850 ok(szStatusText != NULL, "szStatusText == NULL\n");
851 if(szStatusText) {
853 ok(!lstrcmpW(szStatusText, expect_wsz), "unexpected szStatusText %s\n", wine_dbgstr_w(szStatusText));
854 else if (http_post_test)
855 ok(lstrlenW(text_plain) <= lstrlenW(szStatusText) &&
856 !memcmp(szStatusText, text_plain, lstrlenW(text_plain)*sizeof(WCHAR)),
857 "szStatusText != text/plain\n");
858 else if(empty_file)
859 ok(!strcmp_wa(szStatusText, "application/javascript"), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
860 else if((pi & PI_MIMEVERIFICATION) && emulate_prot && !mimefilter_test
862 ok(lstrlenW(gifW) <= lstrlenW(szStatusText) &&
863 !memcmp(szStatusText, gifW, lstrlenW(gifW)*sizeof(WCHAR)),
864 "szStatusText != image/gif\n");
865 else if(!mimefilter_test)
866 ok(lstrlenW(text_htmlW) <= lstrlenW(szStatusText) &&
867 !memcmp(szStatusText, text_htmlW, lstrlenW(text_htmlW)*sizeof(WCHAR)),
868 "szStatusText != text/html\n");
869 }
870 break;
871 case BINDSTATUS_DIRECTBIND:
872 CHECK_EXPECT2(ReportProgress_DIRECTBIND);
873 ok(szStatusText == NULL, "szStatusText != NULL\n");
874 break;
875 case BINDSTATUS_RAWMIMETYPE:
876 CHECK_EXPECT2(ReportProgress_RAWMIMETYPE);
877 ok(szStatusText != NULL, "szStatusText == NULL\n");
878 if(szStatusText)
879 ok(lstrlenW(szStatusText) < lstrlenW(text_htmlW) ||
880 !memcmp(szStatusText, text_htmlW, lstrlenW(text_htmlW)*sizeof(WCHAR)),
881 "szStatusText != text/html\n");
882 break;
883 case BINDSTATUS_CACHEFILENAMEAVAILABLE:
884 CHECK_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
885 ok(szStatusText != NULL, "szStatusText == NULL\n");
886 if(szStatusText) {
887 if(binding_test)
888 ok(!lstrcmpW(szStatusText, expect_wsz), "unexpected szStatusText\n");
889 else if(tested_protocol == FILE_TEST)
890 ok(!lstrcmpW(szStatusText, file_name), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
891 else
892 ok(szStatusText != NULL, "szStatusText == NULL\n");
893 }
894 break;
895 case BINDSTATUS_FINDINGRESOURCE:
896 CHECK_EXPECT2(ReportProgress_FINDINGRESOURCE);
897 ok(szStatusText != NULL, "szStatusText == NULL\n");
898 break;
899 case BINDSTATUS_CONNECTING:
900 CHECK_EXPECT2(ReportProgress_CONNECTING);
901 ok(szStatusText != NULL, "szStatusText == NULL\n");
902 break;
903 case BINDSTATUS_SENDINGREQUEST:
904 CHECK_EXPECT2(ReportProgress_SENDINGREQUEST);
906 ok(szStatusText != NULL, "szStatusText == NULL\n");
907 if(szStatusText)
908 ok(!*szStatusText, "wrong szStatusText\n");
909 }
910 break;
911 case BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE:
912 CHECK_EXPECT(ReportProgress_VERIFIEDMIMETYPEAVAILABLE);
913 ok(szStatusText != NULL, "szStatusText == NULL\n");
914 if(szStatusText)
915 ok(!strcmp_wa(szStatusText, "text/html"), "szStatusText != text/html\n");
916 break;
917 case BINDSTATUS_PROTOCOLCLASSID:
918 CHECK_EXPECT(ReportProgress_PROTOCOLCLASSID);
919 ok(szStatusText != NULL, "szStatusText == NULL\n");
920 ok(!lstrcmpW(szStatusText, null_guid), "unexpected classid %s\n", wine_dbgstr_w(szStatusText));
921 break;
922 case BINDSTATUS_COOKIE_SENT:
923 CHECK_EXPECT2(ReportProgress_COOKIE_SENT);
924 ok(szStatusText == NULL, "szStatusText != NULL\n");
925 break;
926 case BINDSTATUS_REDIRECTING:
927 CHECK_EXPECT(ReportProgress_REDIRECTING);
928 if(test_redirect)
929 ok(!strcmp_wa(szStatusText, "http://test.winehq.org/tests/hello.html"), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
930 else
931 ok(szStatusText == NULL, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
932 break;
933 case BINDSTATUS_ENCODING:
934 CHECK_EXPECT(ReportProgress_ENCODING);
935 ok(!strcmp_wa(szStatusText, "gzip"), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
936 break;
937 case BINDSTATUS_ACCEPTRANGES:
938 CHECK_EXPECT(ReportProgress_ACCEPTRANGES);
939 ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
940 break;
941 case BINDSTATUS_PROXYDETECTING:
942 if(!called_ReportProgress_PROXYDETECTING)
943 SET_EXPECT(ReportProgress_CONNECTING);
944 CHECK_EXPECT2(ReportProgress_PROXYDETECTING);
945 ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
946 break;
947 case BINDSTATUS_LOADINGMIMEHANDLER:
948 CHECK_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
949 ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
950 break;
951 case BINDSTATUS_DECODING:
952 CHECK_EXPECT(ReportProgress_DECODING);
953 ok(!lstrcmpW(szStatusText, pjpegW), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
954 break;
955 case BINDSTATUS_RESERVED_7:
956 trace("BINDSTATUS_RESERVED_7\n");
957 break;
958 case BINDSTATUS_RESERVED_8:
959 trace("BINDSTATUS_RESERVED_8\n");
960 break;
961 default:
962 ok(0, "Unexpected status %d (%d)\n", ulStatusCode, ulStatusCode-BINDSTATUS_LAST);
963 };
964
965 return S_OK;
966}
#define ARRAY_SIZE(A)
Definition: main.h:33
static int strcmp_wa(const WCHAR *str1, const char *str2)
Definition: protocol.c:117
static LPCWSTR file_name
Definition: protocol.c:147
static const char * status_names[]
Definition: protocol.c:769
static const WCHAR gifW[]
Definition: protocol.c:144

◆ ProtocolSink_ReportResult()

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

Definition at line 1179 of file protocol.c.

1181{
1182 CHECK_EXPECT(ReportResult);
1183
1185 return S_OK;
1186
1188 ok(hrResult == E_PENDING || hrResult == S_OK, "hrResult = %08x, expected E_PENDING or S_OK\n", hrResult);
1189 else
1190 ok(hrResult == expect_hrResult, "hrResult = %08x, expected: %08x\n",
1191 hrResult, expect_hrResult);
1192#ifdef __REACTOS__
1194 skip("CORE-10360/ROSTESTS-192: Test might hang, skipping the rest!\n");
1195 exit(1);
1196 }
1197#endif
1198 if(SUCCEEDED(hrResult) || tested_protocol == FTP_TEST || test_abort || hrResult == INET_E_REDIRECT_FAILED)
1199 ok(dwError == ERROR_SUCCESS, "dwError = %d, expected ERROR_SUCCESS\n", dwError);
1200 else
1201 ok(dwError != ERROR_SUCCESS ||
1202 broken(tested_protocol == MK_TEST), /* WinME and NT4 */
1203 "dwError == ERROR_SUCCESS\n");
1204
1205 if(hrResult == INET_E_REDIRECT_FAILED)
1206 ok(!strcmp_wa(szResult, "http://test.winehq.org/tests/hello.html"), "szResult = %s\n", wine_dbgstr_w(szResult));
1207 else
1208 ok(!szResult, "szResult = %s\n", wine_dbgstr_w(szResult));
1209
1210 if(direct_read)
1211 SET_EXPECT(ReportData); /* checked after main loop */
1212
1213 return S_OK;
1214}
#define skip(...)
Definition: atltest.h:64
int winetest_interactive
#define exit(n)
Definition: config.h:202

◆ 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 %x/%x\n",
742 pProtocolData->grfFlags, protocoldata.grfFlags );
743 ok(pProtocolData->dwState == protocoldata.dwState, "dwState wrong %x/%x\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 %x/%x\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:646
static PROTOCOLDATA continue_protdata
Definition: protocol.c:158
static PROTOCOLDATA * pdata
Definition: protocol.c:158
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define WAIT_OBJECT_0
Definition: winbase.h:406

◆ ProtocolUnk_AddRef()

static ULONG WINAPI ProtocolUnk_AddRef ( IUnknown iface)
static

Definition at line 2297 of file protocol.c.

2298{
2300 return ++This->inner_ref;
2301}
static MimeHtmlProtocol * impl_from_IUnknown(IUnknown *iface)
Definition: protocol.c:369

◆ ProtocolUnk_QueryInterface()

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

Definition at line 2252 of file protocol.c.

2253{
2254 static const IID IID_undocumentedIE10 = {0x7daf9908,0x8415,0x4005,{0x95,0xae,0xbd,0x27,0xf6,0xe3,0xdc,0x00}};
2256
2258 trace("QI(IUnknown)\n");
2259 *ppv = &This->IUnknown_inner;
2260 }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
2261 trace("QI(InternetProtocol)\n");
2262 *ppv = &This->IInternetProtocolEx_iface;
2263 }else if(IsEqualGUID(&IID_IInternetProtocolEx, riid)) {
2264 trace("QI(InternetProtocolEx)\n");
2265 if(!impl_protex) {
2266 *ppv = NULL;
2267 return E_NOINTERFACE;
2268 }
2269 *ppv = &This->IInternetProtocolEx_iface;
2270 }else if(IsEqualGUID(&IID_IInternetPriority, riid)) {
2271 trace("QI(InternetPriority)\n");
2272 *ppv = &This->IInternetPriority_iface;
2273 }else if(IsEqualGUID(&IID_IWinInetInfo, riid)) {
2274 trace("QI(IWinInetInfo)\n");
2275 CHECK_EXPECT(QueryInterface_IWinInetInfo);
2276 *ppv = NULL;
2277 return E_NOINTERFACE;
2278 }else if(IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
2279 trace("QI(IWinInetHttpInfo)\n");
2280 CHECK_EXPECT(QueryInterface_IWinInetHttpInfo);
2281 *ppv = NULL;
2282 return E_NOINTERFACE;
2283 }else if(IsEqualGUID(&IID_undocumentedIE10, riid)) {
2284 trace("QI(%s)\n", wine_dbgstr_guid(riid));
2285 *ppv = NULL;
2286 return E_NOINTERFACE;
2287 }else {
2288 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
2289 *ppv = NULL;
2290 return E_NOINTERFACE;
2291 }
2292
2293 IUnknown_AddRef((IUnknown*)*ppv);
2294 return S_OK;
2295}

◆ ProtocolUnk_Release()

static ULONG WINAPI ProtocolUnk_Release ( IUnknown iface)
static

Definition at line 2303 of file protocol.c.

2304{
2306 LONG ref = --This->inner_ref;
2307 if(!ref) {
2308 /* IE9 is broken on redirects. It will cause -1 outer_ref on original protocol handler
2309 * and 1 on redirected handler. */
2310 ok(!This->outer_ref
2311 || broken(test_redirect && (This->outer_ref == -1 || This->outer_ref == 1)),
2312 "outer_ref = %d\n", This->outer_ref);
2313 if(This->outer_ref)
2314 trace("outer_ref %d\n", This->outer_ref);
2315 CHECK_EXPECT(Protocol_destructor);
2316 heap_free(This);
2317 }
2318 return ref;
2319}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
long LONG
Definition: pedump.c:60
Definition: send.c:48

◆ QueryInterface()

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

Definition at line 1374 of file protocol.c.

1375{
1376 static const IID IID_undocumented = {0x58DFC7D0,0x5381,0x43E5,{0x9D,0x72,0x4C,0xDD,0xE4,0xCB,0x0F,0x1A}};
1377 static const IID IID_undocumentedIE10 = {0xc28722e5,0xbc1a,0x4c55,{0xa6,0x8d,0x33,0x21,0x9f,0x69,0x89,0x10}};
1378
1379 *ppv = NULL;
1380
1381 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocolSink, riid))
1382 *ppv = &protocol_sink;
1383 if(IsEqualGUID(&IID_IServiceProvider, riid))
1385 if(IsEqualGUID(&IID_IUriContainer, riid))
1386 return E_NOINTERFACE; /* TODO */
1387
1388 /* NOTE: IE8 queries for undocumented {58DFC7D0-5381-43E5-9D72-4CDDE4CB0F1A} interface. */
1389 if(IsEqualGUID(&IID_undocumented, riid))
1390 return E_NOINTERFACE;
1391 /* NOTE: IE10 queries for undocumented {c28722e5-bc1a-4c55-a68d-33219f698910} interface. */
1392 if(IsEqualGUID(&IID_undocumentedIE10, riid))
1393 return E_NOINTERFACE;
1394
1395 if(*ppv)
1396 return S_OK;
1397
1398 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
1399 return E_NOINTERFACE;
1400}

Referenced by ProtocolSink_QueryInterface(), and ServiceProvider_QueryInterface().

◆ register_filter()

static void register_filter ( BOOL  do_register)
static

Definition at line 2698 of file protocol.c.

2699{
2701 HRESULT hres;
2702
2703 hres = pCoInternetGetSession(0, &session, 0);
2704 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
2705
2706 if(do_register) {
2707 hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, pjpegW);
2708 ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
2709 hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, gifW);
2710 ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
2711 }else {
2712 hres = IInternetSession_UnregisterMimeFilter(session, &mimefilter_cf, pjpegW);
2713 ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
2714 hres = IInternetSession_UnregisterMimeFilter(session, &mimefilter_cf, gifW);
2715 ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
2716 }
2717
2718 IInternetSession_Release(session);
2719}
static IClassFactory mimefilter_cf
Definition: protocol.c:2679

Referenced by init_test().

◆ ServiceProvider_AddRef()

static ULONG WINAPI ServiceProvider_AddRef ( IServiceProvider iface)
static

Definition at line 437 of file protocol.c.

438{
439 return 2;
440}

◆ ServiceProvider_QueryInterface()

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

Definition at line 432 of file protocol.c.

433{
434 return QueryInterface(riid, ppv);
435}

◆ ServiceProvider_QueryService()

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

Definition at line 447 of file protocol.c.

449{
450 if(IsEqualGUID(&IID_IHttpNegotiate, guidService) || IsEqualGUID(&IID_IHttpNegotiate2, riid)) {
451 CHECK_EXPECT2(QueryService_HttpNegotiate);
452 return IHttpNegotiate2_QueryInterface(&http_negotiate, riid, ppv);
453 }
454
455 if(IsEqualGUID(&IID_IInternetProtocol, guidService)) {
456 ok(IsEqualGUID(&IID_IInternetProtocol, riid), "unexpected riid\n");
457 CHECK_EXPECT(QueryService_InternetProtocol);
458 return E_NOINTERFACE;
459 }
460
461 if(IsEqualGUID(&IID_IHttpSecurity, guidService)) {
462 ok(IsEqualGUID(&IID_IHttpSecurity, riid), "unexpected riid\n");
463 CHECK_EXPECT(QueryService_HttpSecurity);
464 return IHttpSecurity_QueryInterface(&http_security, riid, ppv);
465 }
466
467 if(IsEqualGUID(&IID_IBindCallbackRedirect, guidService)) {
468 CHECK_EXPECT(QueryService_IBindCallbackRedirect);
469 ok(IsEqualGUID(&IID_IBindCallbackRedirect, riid), "riid = %s\n", wine_dbgstr_guid(riid));
471 return S_OK;
472 }
473
474 if(IsEqualGUID(&IID_IGetBindHandle, guidService)) {
475 trace("QueryService(IID_IGetBindHandle)\n");
476 *ppv = NULL;
477 return E_NOINTERFACE;
478 }
479
480 if(IsEqualGUID(&IID_IWindowForBindingUI, guidService)) {
481 trace("QueryService(IID_IWindowForBindingUI)\n");
482 *ppv = NULL;
483 return E_NOINTERFACE;
484 }
485
486 ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService));
487 return E_FAIL;
488}
static IHttpSecurity http_security
Definition: protocol.c:294
static IBindCallbackRedirect redirect_callback
Definition: protocol.c:428

◆ ServiceProvider_Release()

static ULONG WINAPI ServiceProvider_Release ( IServiceProvider iface)
static

Definition at line 442 of file protocol.c.

443{
444 return 1;
445}

◆ START_TEST()

START_TEST ( protocol  )

Definition at line 4254 of file protocol.c.

4255{
4256 HMODULE hurlmon;
4257
4258 hurlmon = GetModuleHandleA("urlmon.dll");
4259 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
4260 pReleaseBindInfo = (void*) GetProcAddress(hurlmon, "ReleaseBindInfo");
4261 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
4262
4263 if(!GetProcAddress(hurlmon, "CompareSecurityIds")) {
4264 win_skip("Various needed functions not present, too old IE\n");
4265 return;
4266 }
4267
4268 if(!pCreateUri)
4269 win_skip("CreateUri not supported\n");
4270
4272
4278
4281 if(pCreateUri)
4283 else
4284 win_skip("Skipping https tests on too old platform\n");
4292
4293 bindf &= ~BINDF_FROMURLMON;
4294 trace("Testing file binding (mime verification, emulate prot)...\n");
4295 test_binding(FILE_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT);
4296 trace("Testing http binding (mime verification, emulate prot)...\n");
4297 test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT);
4298 trace("Testing its binding (mime verification, emulate prot)...\n");
4299 test_binding(ITS_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT);
4300 trace("Testing http binding (mime verification, emulate prot, short read, direct read)...\n");
4302 trace("Testing http binding (mime verification, redirect, emulate prot)...\n");
4304 trace("Testing http binding (mime verification, redirect, disable auto redirect, emulate prot)...\n");
4306 trace("Testing file binding (mime verification, emulate prot, mime filter)...\n");
4307 test_binding(FILE_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_FILTER);
4308 trace("Testing http binding (mime verification, emulate prot, mime filter)...\n");
4309 test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_FILTER);
4310 trace("Testing http binding (mime verification, emulate prot, mime filter, no mime)...\n");
4312 trace("Testing http binding (mime verification, emulate prot, direct read)...\n");
4314 trace("Testing http binding (mime verification, emulate prot, abort)...\n");
4315 test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_ABORT);
4316 if(pCreateUri) {
4317 trace("Testing file binding (use IUri, mime verification, emulate prot)...\n");
4318 test_binding(FILE_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_USEIURI);
4319 trace("Testing file binding (use IUri, impl StartEx, mime verification, emulate prot)...\n");
4321 trace("Testing file binding (impl StartEx, mime verification, emulate prot)...\n");
4323 }
4324
4329
4330 test_com_aggregation(&CLSID_FileProtocol);
4331 test_com_aggregation(&CLSID_HttpProtocol);
4332 test_com_aggregation(&CLSID_HttpSProtocol);
4333 test_com_aggregation(&CLSID_FtpProtocol);
4334 test_com_aggregation(&CLSID_MkProtocol);
4335
4337}
#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:169
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
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:3073
static void test_http_protocol(void)
Definition: protocol.c:3518
static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
Definition: protocol.c:4037
static void test_CreateBinding(void)
Definition: protocol.c:3803
static void test_ftp_protocol(void)
Definition: protocol.c:3603
static void test_https_protocol(void)
Definition: protocol.c:3591
static void test_gopher_protocol(void)
Definition: protocol.c:3696
#define TEST_USEIURI
Definition: protocol.c:2691
static DWORD thread_id
Definition: protocol.c:159
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459

◆ strcmp_wa()

static int strcmp_wa ( LPCWSTR  strw,
const char stra 
)
static

Definition at line 225 of file protocol.c.

226{
227 CHAR buf[512];
228 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
229 return lstrcmpA(stra, buf);
230}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
static const char * strw(LPCWSTR x)
Definition: actctx.c:49
char CHAR
Definition: xmlstorage.h:175

◆ Stream_AddRef()

static ULONG WINAPI Stream_AddRef ( IStream iface)
static

Definition at line 510 of file protocol.c.

511{
512 return 2;
513}

◆ Stream_Clone()

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

Definition at line 606 of file protocol.c.

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

◆ Stream_Commit()

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

Definition at line 573 of file protocol.c.

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

◆ Stream_CopyTo()

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

Definition at line 566 of file protocol.c.

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

◆ Stream_LockRegion()

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

Definition at line 585 of file protocol.c.

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

◆ Stream_QueryInterface()

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

Definition at line 499 of file protocol.c.

500{
501 static const IID IID_strm_unknown = {0x2f68429a,0x199a,0x4043,{0x93,0x11,0xf2,0xfe,0x7c,0x13,0xcc,0xb9}};
502
503 if(!IsEqualGUID(&IID_strm_unknown, riid)) /* IE11 */
504 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
505
506 *ppv = NULL;
507 return E_NOINTERFACE;
508}

◆ Stream_Read()

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

Definition at line 520 of file protocol.c.

522{
524
525 ok(GetCurrentThreadId() != thread_id, "wrong thread %d\n", GetCurrentThreadId());
526
527 ok(pv != NULL, "pv == NULL\n");
528 ok(cb == 0x20000 || broken(cb == 0x2000), "cb = %d\n", cb);
529 ok(pcbRead != NULL, "pcbRead == NULL\n");
530
531 if(post_stream_read) {
532 *pcbRead = 0;
533 return S_FALSE;
534 }
535
536 memcpy(pv, post_data, sizeof(post_data)-1);
537 post_stream_read += *pcbRead = sizeof(post_data)-1;
538 return S_OK;
539}

Referenced by call_continue(), and Stream_Read().

◆ Stream_Release()

static ULONG WINAPI Stream_Release ( IStream iface)
static

Definition at line 515 of file protocol.c.

516{
517 return 1;
518}

◆ Stream_Revert()

static HRESULT WINAPI Stream_Revert ( IStream iface)
static

Definition at line 579 of file protocol.c.

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

◆ Stream_Seek()

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

Definition at line 548 of file protocol.c.

550{
552
553 ok(!dlibMove.QuadPart, "dlibMove != 0\n");
554 ok(dwOrigin == STREAM_SEEK_SET, "dwOrigin = %d\n", dwOrigin);
555 ok(!plibNewPosition, "plibNewPosition == NULL\n");
556
557 return S_OK;
558}

Referenced by http_protocol_start(), and Stream_Seek().

◆ Stream_SetSize()

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

Definition at line 560 of file protocol.c.

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

◆ Stream_Stat()

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

Definition at line 599 of file protocol.c.

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

◆ Stream_UnlockRegion()

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

Definition at line 592 of file protocol.c.

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

◆ Stream_Write()

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

Definition at line 541 of file protocol.c.

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

◆ test_binding()

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

Definition at line 4037 of file protocol.c.

4038{
4039 IInternetProtocolEx *protocolex = NULL;
4042 IUri *uri = NULL;
4043 ULONG ref;
4044 HRESULT hres;
4045
4046 pi = grf_pi;
4047
4048 init_test(prot, test_flags|TEST_BINDING);
4049
4050 hres = pCoInternetGetSession(0, &session, 0);
4051 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
4052
4053 if(test_flags & TEST_EMULATEPROT) {
4054 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL, protocol_names[prot], 0, NULL, 0);
4055 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
4056 }
4057
4058 hres = IInternetSession_CreateBinding(session, NULL, binding_urls[prot], NULL, NULL, &protocol, 0);
4060 ok(hres == S_OK, "CreateBinding failed: %08x\n", hres);
4061 ok(protocol != NULL, "protocol == NULL\n");
4062
4063 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetBindInfo, (void**)&prot_bind_info);
4064 ok(hres == S_OK, "QueryInterface(IID_IInternetBindInfo) failed: %08x\n", hres);
4065
4066 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolSink, (void**)&binding_sink);
4067 ok(hres == S_OK, "QueryInterface(IID_IInternetProtocolSink) failed: %08x\n", hres);
4068
4069 if(test_flags & TEST_USEIURI) {
4070 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolEx, (void**)&protocolex);
4071 ok(hres == S_OK, "Could not get IInternetProtocolEx iface: %08x\n", hres);
4072
4073 hres = pCreateUri(binding_urls[prot], Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri);
4074 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
4075 }
4076
4077 ex_priority = 0;
4078 SET_EXPECT(QueryService_InternetProtocol);
4079 SET_EXPECT(CreateInstance);
4080 SET_EXPECT(ReportProgress_PROTOCOLCLASSID);
4082 if(impl_protex)
4083 SET_EXPECT(StartEx);
4084 else
4086
4088
4089 if(protocolex) {
4090 hres = IInternetProtocolEx_StartEx(protocolex, uri, &protocol_sink, &bind_info, pi, 0);
4091 ok(hres == S_OK, "StartEx failed: %08x\n", hres);
4092 }else {
4093 hres = IInternetProtocol_Start(protocol, binding_urls[prot], &protocol_sink, &bind_info, pi, 0);
4094 ok(hres == S_OK, "Start failed: %08x\n", hres);
4095 }
4096
4097 CHECK_CALLED(QueryService_InternetProtocol);
4098 CHECK_CALLED(CreateInstance);
4099 CHECK_CALLED(ReportProgress_PROTOCOLCLASSID);
4100 CLEAR_CALLED(SetPriority); /* IE11 does not call it. */
4101 if(impl_protex)
4102 CHECK_CALLED(StartEx);
4103 else
4105
4106 if(protocolex)
4107 IInternetProtocolEx_Release(protocolex);
4108 if(uri)
4109 IUri_Release(uri);
4110
4111 if(prot == HTTP_TEST || prot == HTTPS_TEST) {
4112 while(prot_state < 4) {
4113 ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
4115 SET_EXPECT(Continue);
4116 IInternetProtocol_Continue(filtered_protocol, pdata);
4117 CHECK_CALLED(Continue);
4118 }else {
4119 SET_EXPECT(Continue);
4120 IInternetProtocol_Continue(protocol, pdata);
4121 CHECK_CALLED(Continue);
4122 }
4123 if(test_abort && prot_state == 2) {
4124 SET_EXPECT(Abort);
4125 hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
4126 ok(hres == S_OK, "Abort failed: %08x\n", hres);
4127 CHECK_CALLED(Abort);
4128
4129 hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
4130 ok(hres == S_OK, "Abort failed: %08x\n", hres);
4132 break;
4133 }
4135 }
4136 if(direct_read)
4137 CHECK_CALLED(ReportData); /* Set in ReportResult */
4138 ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
4139 }else {
4140 if(mimefilter_test)
4141 SET_EXPECT(MimeFilter_LockRequest);
4142 else
4144 hres = IInternetProtocol_LockRequest(protocol, 0);
4145 ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
4146 if(mimefilter_test)
4147 CHECK_CALLED(MimeFilter_LockRequest);
4148 else
4150
4151 if(mimefilter_test)
4152 SET_EXPECT(MimeFilter_UnlockRequest);
4153 else
4155 hres = IInternetProtocol_UnlockRequest(protocol);
4156 ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
4157 if(mimefilter_test)
4158 CHECK_CALLED(MimeFilter_UnlockRequest);
4159 else
4161 }
4162
4163 if(mimefilter_test)
4164 SET_EXPECT(MimeFilter_Terminate);
4165 else
4166 SET_EXPECT(Terminate);
4167 hres = IInternetProtocol_Terminate(protocol, 0);
4168 ok(hres == S_OK, "Terminate failed: %08x\n", hres);
4169 if(mimefilter_test)
4170 CLEAR_CALLED(MimeFilter_Terminate);
4171 else
4172 CHECK_CALLED(Terminate);
4173
4175 IInternetProtocol_Release(filtered_protocol);
4176 IInternetBindInfo_Release(prot_bind_info);
4177 IInternetProtocolSink_Release(binding_sink);
4178
4179 SET_EXPECT(Protocol_destructor);
4180 ref = IInternetProtocol_Release(protocol);
4181 ok(!ref, "ref=%u, expected 0\n", ref);
4182 CHECK_CALLED(Protocol_destructor);
4183
4184 if(test_flags & TEST_EMULATEPROT) {
4185 hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, protocol_names[prot]);
4186 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
4187 }
4188
4189 IInternetSession_Release(session);
4190}
static const WCHAR protocol_names[][10]
Definition: protocol.c:193
#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 4221 of file protocol.c.

4222{
4223 IUnknown outer = { &outer_vtbl };
4225 IUnknown *unk, *unk2, *unk3;
4226 HRESULT hres;
4227
4228 hres = CoGetClassObject(clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&class_factory);
4229 ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
4230
4231 hres = IClassFactory_CreateInstance(class_factory, &outer, &IID_IUnknown, (void**)&unk);
4232 ok(hres == S_OK, "CreateInstance returned: %08x\n", hres);
4233
4234 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocol, (void**)&unk2);
4235 ok(hres == S_OK, "Could not get IDispatch iface: %08x\n", hres);
4236
4237 SET_EXPECT(outer_QI_test);
4238 hres = IUnknown_QueryInterface(unk2, &outer_test_iid, (void**)&unk3);
4239 CHECK_CALLED(outer_QI_test);
4240 ok(hres == S_OK, "Could not get IInternetProtocol iface: %08x\n", hres);
4241 ok(unk3 == (IUnknown*)0xdeadbeef, "unexpected unk2\n");
4242
4243 IUnknown_Release(unk2);
4244 IUnknown_Release(unk);
4245
4246 unk = (void*)0xdeadbeef;
4247 hres = IClassFactory_CreateInstance(class_factory, &outer, &IID_IInternetProtocol, (void**)&unk);
4248 ok(hres == CLASS_E_NOAGGREGATION, "CreateInstance returned: %08x\n", hres);
4249 ok(!unk, "unk = %p\n", unk);
4250
4251 IClassFactory_Release(class_factory);
4252}
const GUID IID_IClassFactory
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3103
static const IUnknownVtbl outer_vtbl
Definition: protocol.c:690
REFCLSID clsid
Definition: msctf.c:82

◆ test_CreateBinding()

static void test_CreateBinding ( void  )
static

Definition at line 3803 of file protocol.c.

3804{
3808 IWinInetHttpInfo *http_info;
3809 IWinInetInfo *inet_info;
3810 LONG p;
3811 BYTE buf[1000];
3812 DWORD read;
3813 HRESULT hres;
3814
3815 static const WCHAR test_url[] =
3816 {'t','e','s','t',':','/','/','f','i','l','e','.','h','t','m','l',0};
3817 static const WCHAR wsz_test[] = {'t','e','s','t',0};
3818
3819 trace("Testing CreateBinding%s...\n", no_aggregation ? "(no aggregation)" : "");
3821
3822 hres = pCoInternetGetSession(0, &session, 0);
3823 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
3824
3825 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL, wsz_test, 0, NULL, 0);
3826 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
3827
3828 hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0);
3830 ok(hres == S_OK, "CreateBinding failed: %08x\n", hres);
3831 ok(protocol != NULL, "protocol == NULL\n");
3832
3833 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetBindInfo, (void**)&prot_bind_info);
3834 ok(hres == S_OK, "QueryInterface(IID_IInternetBindInfo) failed: %08x\n", hres);
3835
3836 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolSink, (void**)&binding_sink);
3837 ok(hres == S_OK, "Could not get IInternetProtocolSink: %08x\n", hres);
3838
3839 hres = IInternetProtocol_Start(protocol, test_url, NULL, &bind_info, 0, 0);
3840 ok(hres == E_INVALIDARG, "Start failed: %08x, expected E_INVALIDARG\n", hres);
3841 hres = IInternetProtocol_Start(protocol, test_url, &protocol_sink, NULL, 0, 0);
3842 ok(hres == E_INVALIDARG, "Start failed: %08x, expected E_INVALIDARG\n", hres);
3843 hres = IInternetProtocol_Start(protocol, NULL, &protocol_sink, &bind_info, 0, 0);
3844 ok(hres == E_INVALIDARG, "Start failed: %08x, expected E_INVALIDARG\n", hres);
3845
3846 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority, (void**)&priority);
3847 ok(hres == S_OK, "QueryInterface(IID_IInternetPriority) failed: %08x\n", hres);
3848
3849 p = 0xdeadbeef;
3850 hres = IInternetPriority_GetPriority(priority, &p);
3851 ok(hres == S_OK, "GetPriority failed: %08x\n", hres);
3852 ok(!p, "p=%d\n", p);
3853
3854 ex_priority = 100;
3855 hres = IInternetPriority_SetPriority(priority, 100);
3856 ok(hres == S_OK, "SetPriority failed: %08x\n", hres);
3857
3858 p = 0xdeadbeef;
3859 hres = IInternetPriority_GetPriority(priority, &p);
3860 ok(hres == S_OK, "GetPriority failed: %08x\n", hres);
3861 ok(p == 100, "p=%d\n", p);
3862
3863 hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
3864 ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08x\n", hres);
3865
3866 SET_EXPECT(QueryService_InternetProtocol);
3867
3868 SET_EXPECT(CreateInstance);
3869 if(no_aggregation) {
3870 SET_EXPECT(CreateInstance_no_aggregation);
3871 SET_EXPECT(StartEx);
3872 }else {
3874 }
3875
3876 SET_EXPECT(ReportProgress_PROTOCOLCLASSID);
3878
3879 ok(obj_refcount(protocol) == 4, "wrong protocol refcount %d\n", obj_refcount(protocol));
3880
3881 trace("Start >\n");
3883 hres = IInternetProtocol_Start(protocol, test_url, &protocol_sink, &bind_info, 0, 0);
3884 ok(hres == S_OK, "Start failed: %08x\n", hres);
3885 trace("Start <\n");
3886
3887 CHECK_CALLED(QueryService_InternetProtocol);
3888
3889 CHECK_CALLED(CreateInstance);
3890 if(no_aggregation) {
3891 CHECK_CALLED(CreateInstance_no_aggregation);
3892 ok(obj_refcount(protocol) == 4, "wrong protocol refcount %d\n", obj_refcount(protocol));
3893 ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %u\n", protocol_emul->outer_ref);
3894 }else {
3895 ok(obj_refcount(protocol) == 5 || broken(obj_refcount(protocol) == 4) /* before win7 */, "wrong protocol refcount %d\n",
3897 ok(protocol_emul->outer_ref == 1 || broken(protocol_emul->outer_ref == 0) /* before win7 */, "protocol_outer_ref = %u\n",
3899 }
3900
3901 CHECK_CALLED(ReportProgress_PROTOCOLCLASSID);
3903 if(no_aggregation)
3904 CHECK_CALLED(StartEx);
3905 else
3907
3908 if(!no_aggregation)
3909 SET_EXPECT(QueryInterface_IWinInetInfo);
3910 hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
3911 ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08x\n", hres);
3912 if(!no_aggregation)
3913 CHECK_CALLED(QueryInterface_IWinInetInfo);
3914
3915 if(!no_aggregation)
3916 SET_EXPECT(QueryInterface_IWinInetInfo);
3917 hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
3918 ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08x\n", hres);
3919 if(!no_aggregation)
3920 CHECK_CALLED(QueryInterface_IWinInetInfo);
3921
3922 if(!no_aggregation)
3923 SET_EXPECT(QueryInterface_IWinInetHttpInfo);
3924 hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&http_info);
3925 ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08x\n", hres);
3926 if(!no_aggregation)
3927 CHECK_CALLED(QueryInterface_IWinInetHttpInfo);
3928
3930 read = 0xdeadbeef;
3931 hres = IInternetProtocol_Read(protocol, expect_pv = buf, sizeof(buf), &read);
3932 ok(hres == S_OK, "Read failed: %08x\n", hres);
3933 ok(read == 100, "read = %d\n", read);
3935
3937 read = 0xdeadbeef;
3938 hres = IInternetProtocol_Read(protocol, expect_pv = buf, sizeof(buf), &read);
3939 ok(hres == S_FALSE, "Read failed: %08x\n", hres);
3940 ok(!read, "read = %d\n", read);
3942
3943 p = 0xdeadbeef;
3944 hres = IInternetPriority_GetPriority(priority, &p);
3945 ok(hres == S_OK, "GetPriority failed: %08x\n", hres);
3946 ok(p == 100, "p=%d\n", p);
3947
3948 hres = IInternetPriority_SetPriority(priority, 101);
3949 ok(hres == S_OK, "SetPriority failed: %08x\n", hres);
3950
3951 if(no_aggregation) {
3952 ok(obj_refcount(protocol) == 4, "wrong protocol refcount %d\n", obj_refcount(protocol));
3953 ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %u\n", protocol_emul->outer_ref);
3954 }else {
3955 ok(obj_refcount(protocol) == 5 || broken(obj_refcount(protocol) == 4) /* before win7 */, "wrong protocol refcount %d\n", obj_refcount(protocol));
3956 ok(protocol_emul->outer_ref == 1 || broken(protocol_emul->outer_ref == 0) /* before win7 */, "protocol_outer_ref = %u\n", protocol_emul->outer_ref);
3957 }
3958
3959 SET_EXPECT(Terminate);
3960 hres = IInternetProtocol_Terminate(protocol, 0xdeadbeef);
3961 ok(hres == S_OK, "Terminate failed: %08x\n", hres);
3962 CHECK_CALLED(Terminate);
3963
3964 ok(obj_refcount(protocol) == 4, "wrong protocol refcount %d\n", obj_refcount(protocol));
3965 ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %u\n", protocol_emul->outer_ref);
3966
3967 SET_EXPECT(Continue);
3968 hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
3969 ok(hres == S_OK, "Switch failed: %08x\n", hres);
3970 CHECK_CALLED(Continue);
3971
3973 read = 0xdeadbeef;
3974 hres = IInternetProtocol_Read(protocol, expect_pv = buf, sizeof(buf), &read);
3975 if(no_aggregation) {
3976 ok(hres == S_OK, "Read failed: %08x\n", hres);
3977 ok(read == 100, "read = %d\n", read);
3979 }else {
3980 todo_wine
3981 ok(hres == E_ABORT, "Read failed: %08x\n", hres);
3982 todo_wine
3983 ok(read == 0, "read = %d\n", read);
3984 todo_wine
3986 }
3987
3988 hres = IInternetProtocolSink_ReportProgress(binding_sink,
3989 BINDSTATUS_CACHEFILENAMEAVAILABLE, expect_wsz = emptyW);
3990 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
3991
3992 hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
3993 ok(hres == E_FAIL, "ReportResult failed: %08x, expected E_FAIL\n", hres);
3994
3995 hres = IInternetProtocolSink_ReportData(binding_sink, 0, 0, 0);
3996 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
3997
3998 IInternetProtocolSink_Release(binding_sink);
3999 IInternetPriority_Release(priority);
4000 IInternetBindInfo_Release(prot_bind_info);
4001
4002 ok(obj_refcount(protocol) == 1, "wrong protocol refcount %d\n", obj_refcount(protocol));
4003
4004 SET_EXPECT(Protocol_destructor);
4005 IInternetProtocol_Release(protocol);
4006 CHECK_CALLED(Protocol_destructor);
4007
4008 hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0);
4009 ok(hres == S_OK, "CreateBinding failed: %08x\n", hres);
4010 ok(protocol != NULL, "protocol == NULL\n");
4011
4012 hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
4013 ok(hres == S_OK, "Abort failed: %08x\n", hres);
4014
4015 hres = IInternetProtocol_Abort(protocol, E_FAIL, 0);
4016 ok(hres == S_OK, "Abort failed: %08x\n", hres);
4017
4018 IInternetProtocol_Release(protocol);
4019
4020 hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, wsz_test);
4021 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
4022
4023 hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0);
4024 ok(hres == S_OK, "CreateBinding failed: %08x\n", hres);
4025 ok(protocol != NULL, "protocol == NULL\n");
4026
4027 SET_EXPECT(QueryService_InternetProtocol);
4028 hres = IInternetProtocol_Start(protocol, test_url, &protocol_sink, &bind_info, 0, 0);
4029 ok(hres == MK_E_SYNTAX, "Start failed: %08x, expected MK_E_SYNTAX\n", hres);
4030 CHECK_CALLED(QueryService_InternetProtocol);
4031
4032 IInternetProtocol_Release(protocol);
4033
4034 IInternetSession_Release(session);
4035}
#define E_INVALIDARG
Definition: ddrawi.h:101
GLfloat GLfloat p
Definition: glext.h:8902
static LONG obj_refcount(void *obj)
Definition: protocol.c:219
static const char test_url[]
Definition: urlcache.c:37
static int priority
Definition: timer.c:163
LONG outer_ref
Definition: protocol.c:188
#define MK_E_SYNTAX
Definition: winerror.h:2785

Referenced by START_TEST().

◆ test_early_abort()

static void test_early_abort ( const CLSID clsid)
static

Definition at line 2790 of file protocol.c.

2791{
2793 HRESULT hres;
2794
2795 hres = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2796 &IID_IInternetProtocol, (void**)&protocol);
2797 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2798
2799 hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
2800 ok(hres == S_OK, "Abort failed: %08x\n", hres);
2801
2802 hres = IInternetProtocol_Abort(protocol, E_FAIL, 0);
2803 ok(hres == S_OK, "Abort failed: %08x\n", hres);
2804
2805 IInternetProtocol_Release(protocol);
2806}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325

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 3073 of file protocol.c.

3073 {
3074 WCHAR buf[INTERNET_MAX_URL_LENGTH], file_name_buf[MAX_PATH];
3075 DWORD size;
3076 ULONG len;
3077 HANDLE file;
3078
3079 static const WCHAR wszFile[] = {'f','i','l','e',':',0};
3080 static const WCHAR wszFile2[] = {'f','i','l','e',':','/','/',0};
3081 static const WCHAR wszFile3[] = {'f','i','l','e',':','/','/','/',0};
3082 static const WCHAR wszFile4[] = {'f','i','l','e',':','\\','\\',0};
3083 static const char html_doc[] = "<HTML></HTML>";
3084 static const WCHAR fragmentW[] = {'#','f','r','a','g',0};
3085
3086 trace("Testing file protocol...\n");
3087 init_test(FILE_TEST, 0);
3088
3089 SetLastError(0xdeadbeef);
3092 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n");
3094 return;
3095 WriteFile(file, html_doc, sizeof(html_doc)-1, &size, NULL);
3097
3099 bindf = 0;
3101 bindf = BINDF_FROMURLMON;
3103 bindf = BINDF_FROMURLMON | BINDF_NEEDFILE;
3105
3106 memcpy(buf, wszFile, sizeof(wszFile));
3107 len = ARRAY_SIZE(wszFile)-1;
3109 buf[len++] = '\\';
3111
3113 bindf = 0;
3115 bindf = BINDF_FROMURLMON;
3117
3118 memcpy(buf, wszFile2, sizeof(wszFile2));
3119 len = GetCurrentDirectoryW(ARRAY_SIZE(file_name_buf), file_name_buf);
3120 file_name_buf[len++] = '\\';
3121 memcpy(file_name_buf+len, wszIndexHtml, sizeof(wszIndexHtml));
3122 lstrcpyW(buf+ARRAY_SIZE(wszFile2)-1, file_name_buf);
3123 file_name = file_name_buf;
3124 bindf = 0;
3126 bindf = BINDF_FROMURLMON;
3128
3129 buf[ARRAY_SIZE(wszFile2)] = '|';
3131
3132 memcpy(buf, wszFile3, sizeof(wszFile3));
3133 len = ARRAY_SIZE(wszFile3)-1;
3135 buf[len++] = '\\';
3137
3138 file_name = buf + ARRAY_SIZE(wszFile3)-1;
3139 bindf = 0;
3141 bindf = BINDF_FROMURLMON;
3143
3144 memcpy(buf, wszFile4, sizeof(wszFile4));
3145 len = GetCurrentDirectoryW(ARRAY_SIZE(file_name_buf), file_name_buf);
3146 file_name_buf[len++] = '\\';
3147 memcpy(file_name_buf+len, wszIndexHtml, sizeof(wszIndexHtml));
3148 lstrcpyW(buf+ARRAY_SIZE(wszFile4)-1, file_name_buf);
3149 file_name = file_name_buf;
3150 bindf = 0;
3152 bindf = BINDF_FROMURLMON;
3154
3155 buf[ARRAY_SIZE(wszFile4)] = '|';
3157
3158 /* Fragment part of URL is skipped if the file doesn't exist. */
3159 lstrcatW(buf, fragmentW);
3161
3162 /* Fragment part is considered a part of the file name, if the file exsists. */
3163 len = lstrlenW(file_name_buf);
3164 lstrcpyW(file_name_buf+len, fragmentW);
3167 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n");
3168 WriteFile(file, "XXX", 3, &size, NULL);
3170 file_name_buf[len] = 0;
3171
3174
3176 DeleteFileW(file_name_buf);
3177
3178 bindf = 0;
3180 bindf = BINDF_FROMURLMON;
3182}
#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
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1418
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:2999
static void test_file_protocol_url(LPCWSTR url)
Definition: protocol.c:2860
static const WCHAR wszIndexHtml[]
Definition: protocol.c:133
static const WCHAR index_url[]
Definition: protocol.c:134
static const WCHAR wszFile[]
Definition: urlmon_main.c:386

Referenced by START_TEST().

◆ test_file_protocol_fail()

static void test_file_protocol_fail ( void  )
static

Definition at line 2999 of file protocol.c.

3000{
3002 HRESULT hres;
3003
3004 static const WCHAR index_url2[] =
3005 {'f','i','l','e',':','/','/','i','n','d','e','x','.','h','t','m','l',0};
3006
3007 hres = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
3008 &IID_IInternetProtocol, (void**)&protocol);
3009 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
3010 if(FAILED(hres))
3011 return;
3012
3013 SET_EXPECT(GetBindInfo);
3015 hres = IInternetProtocol_Start(protocol, wszIndexHtml, &protocol_sink, &bind_info, 0, 0);
3016 ok(hres == MK_E_SYNTAX ||
3017 hres == E_INVALIDARG,
3018 "Start failed: %08x, expected MK_E_SYNTAX or E_INVALIDARG\n", hres);
3019 CLEAR_CALLED(GetBindInfo); /* GetBindInfo not called in IE7 */
3020
3021 SET_EXPECT(GetBindInfo);
3022 if(!(bindf & BINDF_FROMURLMON))
3023 SET_EXPECT(ReportProgress_DIRECTBIND);
3024 SET_EXPECT(ReportProgress_SENDINGREQUEST);
3025 SET_EXPECT(ReportResult);
3026 expect_hrResult = INET_E_RESOURCE_NOT_FOUND;
3027 hres = IInternetProtocol_Start(protocol, index_url, &protocol_sink, &bind_info, 0, 0);
3028 ok(hres == INET_E_RESOURCE_NOT_FOUND,
3029 "Start failed: %08x expected INET_E_RESOURCE_NOT_FOUND\n", hres);
3030 CHECK_CALLED(GetBindInfo);
3031 if(!(bindf & BINDF_FROMURLMON))
3032 CHECK_CALLED(ReportProgress_DIRECTBIND);
3033 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
3034 CHECK_CALLED(ReportResult);
3035
3036 IInternetProtocol_Release(protocol);
3037
3038 hres = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
3039 &IID_IInternetProtocol, (void**)&protocol);
3040 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
3041 if(FAILED(hres))
3042 return;
3043
3044 SET_EXPECT(GetBindInfo);
3045 if(!(bindf & BINDF_FROMURLMON))
3046 SET_EXPECT(ReportProgress_DIRECTBIND);
3047 SET_EXPECT(ReportProgress_SENDINGREQUEST);
3048 SET_EXPECT(ReportResult);
3049 expect_hrResult = INET_E_RESOURCE_NOT_FOUND;
3050
3051 hres = IInternetProtocol_Start(protocol, index_url2, &protocol_sink, &bind_info, 0, 0);
3052 ok(hres == INET_E_RESOURCE_NOT_FOUND,
3053 "Start failed: %08x, expected INET_E_RESOURCE_NOT_FOUND\n", hres);
3054 CHECK_CALLED(GetBindInfo);
3055 if(!(bindf & BINDF_FROMURLMON))
3056 CHECK_CALLED(ReportProgress_DIRECTBIND);
3057 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
3058 CHECK_CALLED(ReportResult);
3059
3060 SET_EXPECT(GetBindInfo);
3061 hres = IInternetProtocol_Start(protocol, NULL, &protocol_sink, &bind_info, 0, 0);
3062 ok(hres == E_INVALIDARG, "Start failed: %08x, expected E_INVALIDARG\n", hres);
3063 CLEAR_CALLED(GetBindInfo); /* GetBindInfo not called in IE7 */
3064
3065 SET_EXPECT(GetBindInfo);
3066 hres = IInternetProtocol_Start(protocol, emptyW, &protocol_sink, &bind_info, 0, 0);
3067 ok(hres == E_INVALIDARG, "Start failed: %08x, expected E_INVALIDARG\n", hres);
3068 CLEAR_CALLED(GetBindInfo); /* GetBindInfo not called in IE7 */
3069
3070 IInternetProtocol_Release(protocol);
3071}

Referenced by test_file_protocol().

◆ test_file_protocol_url()

static void test_file_protocol_url ( LPCWSTR  url)
static

Definition at line 2860 of file protocol.c.

2861{
2863 IUnknown *unk;
2866 BYTE buf[512];
2867 ULONG cb;
2868 HRESULT hres;
2869
2870 hres = CoGetClassObject(&CLSID_FileProtocol, CLSCTX_INPROC_SERVER, NULL,
2871 &IID_IUnknown, (void**)&unk);
2872 ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
2873 if(FAILED(hres))
2874 return;
2875
2876 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
2878 "Could not get IInternetProtocolInfo interface: %08x, expected E_NOINTERFACE\n", hres);
2879
2880 hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
2881 ok(hres == S_OK, "Could not get IClassFactory interface\n");
2882 IUnknown_Release(unk);
2883 if(FAILED(hres))
2884 return;
2885
2886 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&protocol);
2887 ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
2888
2889 if(SUCCEEDED(hres)) {
2891 hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
2892 ok(hres == S_OK, "Read failed: %08x\n", hres);
2893 ok(cb == 2, "cb=%u expected 2\n", cb);
2894 buf[2] = 0;
2895 ok(!memcmp(buf, file_with_hash ? "XX" : "<H", 2), "Unexpected data %s\n", buf);
2896 hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
2897 ok(hres == S_FALSE, "Read failed: %08x\n", hres);
2898 hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
2899 ok(hres == S_FALSE, "Read failed: %08x expected S_FALSE\n", hres);
2900 ok(cb == 0, "cb=%u expected 0\n", cb);
2901 hres = IInternetProtocol_UnlockRequest(protocol);
2902 ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
2903 }
2904
2906 hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
2907 ok(hres == S_FALSE, "Read failed: %08x\n", hres);
2908 hres = IInternetProtocol_LockRequest(protocol, 0);
2909 ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
2910 hres = IInternetProtocol_UnlockRequest(protocol);
2911 ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
2912 }
2913
2914 IInternetProtocol_Release(protocol);
2915 }
2916
2917 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&protocol);
2918 ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
2919 if(SUCCEEDED(hres)) {
2921 hres = IInternetProtocol_LockRequest(protocol, 0);
2922 ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
2923 hres = IInternetProtocol_Terminate(protocol, 0);
2924 ok(hres == S_OK, "Terminate failed: %08x\n", hres);
2925 hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
2926 ok(hres == S_OK, "Read failed: %08x\n\n", hres);
2927 hres = IInternetProtocol_UnlockRequest(protocol);
2928 ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
2929 hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
2930 todo_wine_if(file_with_hash) /* FIXME: An effect of UnlockRequest call? */
2931 ok(hres == S_OK, "Read failed: %08x\n", hres);
2932 hres = IInternetProtocol_Terminate(protocol, 0);
2933 ok(hres == S_OK, "Terminate failed: %08x\n", hres);
2934 }
2935
2936 IInternetProtocol_Release(protocol);
2937 }
2938
2939 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&protocol);
2940 ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
2941 if(SUCCEEDED(hres)) {
2943 hres = IInternetProtocol_Terminate(protocol, 0);
2944 ok(hres == S_OK, "Terminate failed: %08x\n", hres);
2945 hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
2946 ok(hres == S_OK, "Read failed: %08x\n", hres);
2947 ok(cb == 2, "cb=%u expected 2\n", cb);
2948 }
2949
2950 IInternetProtocol_Release(protocol);
2951 }
2952
2953 if(pCreateUri) {
2954 IInternetProtocolEx *protocolex;
2955 IUri *uri;
2956
2957 hres = pCreateUri(url, Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri);
2958 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
2959
2960 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocolEx, (void**)&protocolex);
2961 ok(hres == S_OK, "Could not get IInternetProtocolEx: %08x\n", hres);
2962
2963 if(file_protocol_start(NULL, NULL, protocolex, uri, TRUE)) {
2964 hres = IInternetProtocolEx_Read(protocolex, buf, 2, &cb);
2965 ok(hres == S_OK, "Read failed: %08x\n", hres);
2966 hres = IInternetProtocolEx_LockRequest(protocolex, 0);
2967 ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
2968 hres = IInternetProtocolEx_UnlockRequest(protocolex);
2969 ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
2970 }
2971
2972 IUri_Release(uri);
2973 IInternetProtocolEx_Release(protocolex);
2974
2975 hres = pCreateUri(url, 0, 0, &uri);
2976 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
2977
2978 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocolEx, (void**)&protocolex);
2979 ok(hres == S_OK, "Could not get IInternetProtocolEx: %08x\n", hres);
2980
2981 if(file_protocol_start(NULL, NULL, protocolex, uri, TRUE)) {
2982 hres = IInternetProtocolEx_Read(protocolex, buf, 2, &cb);
2983 ok(hres == S_OK, "Read failed: %08x\n", hres);
2984 hres = IInternetProtocolEx_LockRequest(protocolex, 0);
2985 ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
2986 hres = IInternetProtocolEx_UnlockRequest(protocolex);
2987 ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
2988 }
2989
2990 IUri_Release(uri);
2991 IInternetProtocolEx_Release(protocolex);
2992 }else {
2993 win_skip("Skipping file protocol StartEx tests\n");
2994 }
2995
2996 IClassFactory_Release(factory);
2997}
#define todo_wine_if(is_todo)
Definition: custom.c:76
static BOOL file_protocol_start(IInternetProtocol *protocol, LPCWSTR url, IInternetProtocolEx *protocolex, IUri *uri, BOOL is_first)
Definition: protocol.c:2808
Definition: main.c:439

Referenced by test_file_protocol().

◆ test_ftp_protocol()

static void test_ftp_protocol ( void  )
static

Definition at line 3603 of file protocol.c.

3604{
3607 IUnknown *unk;
3608 BYTE buf[4096];
3609 ULONG ref;
3610 DWORD cb;
3611 HRESULT hres;
3612
3613 static const WCHAR ftp_urlW[] = {'f','t','p',':','/','/','f','t','p','.','w','i','n','e','h','q','.','o','r','g',
3614 '/','p','u','b','/','o','t','h','e','r','/',
3615 'w','i','n','e','l','o','g','o','.','x','c','f','.','t','a','r','.','b','z','2',0};
3616
3617 trace("Testing ftp protocol...\n");
3618
3619 init_test(FTP_TEST, 0);
3620
3621 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3624
3625 hres = CoGetClassObject(&CLSID_FtpProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
3626 ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
3627 if(FAILED(hres))
3628 return;
3629
3630 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
3631 ok(hres == E_NOINTERFACE, "Could not get IInternetProtocolInfo interface: %08x, expected E_NOINTERFACE\n", hres);
3632
3633 hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
3634 ok(hres == S_OK, "Could not get IClassFactory interface\n");
3635 IUnknown_Release(unk);
3636 if(FAILED(hres))
3637 return;
3638
3639 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
3640 (void**)&async_protocol);
3641 IClassFactory_Release(factory);
3642 ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
3643
3645
3646 SET_EXPECT(GetBindInfo);
3647 SET_EXPECT(ReportProgress_FINDINGRESOURCE);
3648 SET_EXPECT(ReportProgress_CONNECTING);
3649 SET_EXPECT(ReportProgress_SENDINGREQUEST);
3650 SET_EXPECT(Switch);
3651
3652 hres = IInternetProtocol_Start(async_protocol, ftp_urlW, &protocol_sink, &bind_info, 0, 0);
3653 ok(hres == S_OK, "Start failed: %08x\n", hres);
3654 CHECK_CALLED(GetBindInfo);
3655
3656 SET_EXPECT(ReportResult);
3657
3658 hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
3659 ok((hres == E_PENDING && cb==0) ||
3660 (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
3661
3662 ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
3663
3664 while(1) {
3665 hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
3666 if(hres == E_PENDING)
3667 {
3669 ok( ret == WAIT_OBJECT_0, "wait timed out\n" );
3670 if (ret != WAIT_OBJECT_0) break;
3671 }
3672 else
3673 if(cb == 0) break;
3674 }
3675
3676 ok(hres == S_FALSE, "Read failed: %08x\n", hres);
3677 CHECK_CALLED(ReportResult);
3678 CHECK_CALLED(Switch);
3679
3681
3682 if(pCreateUri) {
3683 IInternetProtocolEx *protocolex;
3684
3685 hres = IInternetProtocol_QueryInterface(async_protocol, &IID_IInternetProtocolEx, (void**)&protocolex);
3686 ok(hres == S_OK, "Could not get IInternetProtocolEx iface: %08x\n", hres);
3687 IInternetProtocolEx_Release(protocolex);
3688 }
3689
3690 ref = IInternetProtocol_Release(async_protocol);
3691 ok(!ref, "ref=%d\n", ref);
3692
3693 test_early_abort(&CLSID_FtpProtocol);
3694}
static void test_protocol_terminate(IInternetProtocol *protocol)
Definition: protocol.c:3307
static void test_early_abort(const CLSID *clsid)
Definition: protocol.c:2790
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 3696 of file protocol.c.

3697{
3700 IUnknown *unk;
3701 HRESULT hres;
3702
3703 trace("Testing gopher protocol...\n");
3704
3705 hres = CoGetClassObject(&CLSID_GopherProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
3706 ok(hres == S_OK ||
3707 broken(hres == REGDB_E_CLASSNOTREG || hres == CLASS_E_CLASSNOTAVAILABLE), /* Gopher protocol has been removed as of Vista */
3708 "CoGetClassObject failed: %08x\n", hres);
3709 if(FAILED(hres))
3710 return;
3711
3712 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
3713 ok(hres == E_NOINTERFACE, "Could not get IInternetProtocolInfo interface: %08x, expected E_NOINTERFACE\n", hres);
3714
3715 hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
3716 ok(hres == S_OK, "Could not get IClassFactory interface\n");
3717 IUnknown_Release(unk);
3718 if(FAILED(hres))
3719 return;
3720
3721 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
3722 (void**)&async_protocol);
3723 IClassFactory_Release(factory);
3724 ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
3725
3727
3728 IInternetProtocol_Release(async_protocol);
3729
3730 test_early_abort(&CLSID_GopherProtocol);
3731}
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663

Referenced by START_TEST().

◆ test_http_info()

static void test_http_info ( IInternetProtocol protocol)
static

Definition at line 968 of file protocol.c.

969{
971 char buf[1024];
972 DWORD size, len;
974
975 static const WCHAR connectionW[] = {'c','o','n','n','e','c','t','i','o','n',0};
976
977 hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&info);
978 ok(hres == S_OK, "Could not get IWinInterHttpInfo iface: %08x\n", hres);
979
980 size = sizeof(buf);
981 strcpy(buf, "connection");
982 hres = IWinInetHttpInfo_QueryInfo(info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL);
984 ok(hres == S_OK, "QueryInfo failed: %08x\n", hres);
985
986 ok(!strcmp(buf, "Keep-Alive"), "buf = %s\n", buf);
987 len = strlen(buf);
988 ok(size == len, "size = %u, expected %u\n", size, len);
989
990 size = sizeof(buf);
991 memcpy(buf, connectionW, sizeof(connectionW));
992 hres = IWinInetHttpInfo_QueryInfo(info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL);
993 ok(hres == S_FALSE, "QueryInfo returned %08x\n", hres);
994 }else {
995 ok(hres == S_FALSE, "QueryInfo failed: %08x\n", hres);
996 }
997
998 IWinInetHttpInfo_Release(info);
999}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#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 3518 of file protocol.c.

3519{
3520 static const WCHAR posttest_url[] =
3521 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3522 't','e','s','t','s','/','p','o','s','t','.','p','h','p',0};
3523 static const WCHAR redirect_url[] =
3524 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3525 't','e','s','t','s','/','r','e','d','i','r','e','c','t',0};
3526 static const WCHAR winetest_url[] =
3527 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3528 't','e','s','t','s','/','d','a','t','a','.','p','h','p',0};
3529 static const WCHAR empty_url[] =
3530 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3531 't','e','s','t','s','/','e','m','p','t','y','.','j','s',0};
3532 static const WCHAR cache_only_url[] =
3533 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3534 't','e','s','t','s','/','c','a','c','h','e','-','o','n','l','y',0};
3535
3536
3537 trace("Testing http protocol (not from urlmon)...\n");
3538 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
3539 test_http_protocol_url(winetest_url, HTTP_TEST, TEST_FIRST_HTTP, TYMED_NULL);
3540
3541 trace("Testing http protocol (from urlmon)...\n");
3542 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
3543 test_http_protocol_url(winetest_url, HTTP_TEST, 0, TYMED_NULL);
3544
3545 trace("Testing http protocol (to file)...\n");
3546 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NEEDFILE;
3547 test_http_protocol_url(winetest_url, HTTP_TEST, 0, TYMED_NULL);
3548
3549 trace("Testing http protocol (post data)...\n");
3550 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
3551 test_http_protocol_url(posttest_url, HTTP_TEST, TEST_FIRST_HTTP|TEST_POST, TYMED_HGLOBAL);
3552
3553 trace("Testing http protocol (post data stream)...\n");
3555
3556 trace("Testing http protocol (direct read)...\n");
3557 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
3559
3560 trace("Testing http protocol (redirected)...\n");
3561 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3562 test_http_protocol_url(redirect_url, HTTP_TEST, TEST_REDIRECT, TYMED_NULL);
3563
3564 trace("Testing http protocol (redirected, disable auto redirect)...\n");
3565 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3567
3568 trace("Testing http protocol empty file...\n");
3569 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3570 test_http_protocol_url(empty_url, HTTP_TEST, TEST_EMPTY, TYMED_NULL);
3571
3572 /* This is a bit ugly. We unconditionally disable this test on Wine. This won't work until we have
3573 * support for reading from cache via HTTP layer in wininet. Until then, Wine will fail badly, affecting
3574 * other, unrelated, tests. Working around it is not worth the trouble, we may simply make sure those
3575 * tests work on Windows and have them around for the future.
3576 */
3577 if(broken(1)) {
3578 trace("Testing http protocol (from cache)...\n");
3579 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
3580 test_http_protocol_url(cache_only_url, HTTP_TEST, TEST_FROMCACHE, TYMED_NULL);
3581 }
3582
3583 trace("Testing http protocol abort...\n");
3584 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3585 test_http_protocol_url(winetest_url, HTTP_TEST, TEST_ABORT, TYMED_NULL);
3586
3587 test_early_abort(&CLSID_HttpProtocol);
3588 test_early_abort(&CLSID_HttpSProtocol);
3589}
static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tymed)
Definition: protocol.c:3338
#define TEST_POST
Definition: protocol.c:2685

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 3338 of file protocol.c.

3339{
3342 IUnknown *unk;
3343 HRESULT hres;
3344
3345 init_test(prot, flags);
3346 http_url = url;
3348 if(flags & TEST_FROMCACHE)
3350
3351 hres = CoGetClassObject(prot == HTTPS_TEST ? &CLSID_HttpSProtocol : &CLSID_HttpProtocol,
3352 CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
3353 ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
3354 if(FAILED(hres))
3355 return;
3356
3357 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
3359 "Could not get IInternetProtocolInfo interface: %08x, expected E_NOINTERFACE\n",
3360 hres);
3361
3362 hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
3363 ok(hres == S_OK, "Could not get IClassFactory interface\n");
3364 IUnknown_Release(unk);
3365 if(FAILED(hres))
3366 return;
3367
3368 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
3369 (void**)&async_protocol);
3370 ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
3371 if(SUCCEEDED(hres)) {
3372 BYTE buf[3600];
3373 DWORD cb;
3374 ULONG ref;
3375
3377
3378 SET_EXPECT(ReportProgress_COOKIE_SENT);
3379 if(http_is_first) {
3380 SET_EXPECT(ReportProgress_FINDINGRESOURCE);
3381 SET_EXPECT(ReportProgress_CONNECTING);
3382 }
3383 SET_EXPECT(ReportProgress_SENDINGREQUEST);
3384 if(test_redirect && !(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS))
3385 SET_EXPECT(ReportProgress_REDIRECTING);
3386 SET_EXPECT(ReportProgress_PROXYDETECTING);
3387 if(prot == HTTP_TEST)
3388 SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
3389 else
3390 SET_EXPECT(QueryService_HttpSecurity);
3391 if(!(bindf & BINDF_FROMURLMON)) {
3392 SET_EXPECT(OnResponse);
3393 SET_EXPECT(ReportProgress_RAWMIMETYPE);
3394 SET_EXPECT(ReportData);
3395 } else {
3396 SET_EXPECT(Switch);
3397 }
3398
3399 if(!http_protocol_start(url, (flags & TEST_USEIURI) != 0)) {
3400 IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
3401 IInternetProtocol_Release(async_protocol);
3402 return;
3403 }
3404
3406 SET_EXPECT(ReportResult);
3407
3409 expect_hrResult = INET_E_REDIRECT_FAILED;
3410 else if(test_abort)
3412 else
3414
3415 if(direct_read) {
3416 SET_EXPECT(Switch);
3417 while(wait_for_switch) {
3418 ok( WaitForSingleObject(event_continue, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
3419 CHECK_CALLED(Switch); /* Set in ReportData */
3422 }
3423 }else if(bind_from_cache) {
3424 BYTE buf[1500];
3425
3426 hres = IInternetProtocol_Read(async_protocol, buf, 100, &cb);
3427 ok(hres == S_OK && cb == 100, "Read failed: %08x (%d bytes)\n", hres, cb);
3428
3429 SET_EXPECT(ReportResult);
3430 hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
3431 ok(hres == S_OK && cb == 900, "Read failed: %08x (%d bytes)\n", hres, cb);
3432 CHECK_CALLED(ReportResult);
3433
3434 hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
3435 ok(hres == S_FALSE && !cb, "Read failed: %08x (%d bytes)\n", hres, cb);
3436 }else {
3437 hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
3438 ok((hres == E_PENDING && cb==0) ||
3439 (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
3440
3441 ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
3442 if(bindf & BINDF_FROMURLMON)
3443 CHECK_CALLED(Switch);
3444 else
3445 CHECK_CALLED(ReportData);
3446 if(prot == HTTPS_TEST)
3447 CLEAR_CALLED(QueryService_HttpSecurity);
3448
3449 while(1) {
3450 if(bindf & BINDF_FROMURLMON)
3451 SET_EXPECT(Switch);
3452 else
3453 SET_EXPECT(ReportData);
3454 hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
3455 if(hres == E_PENDING) {
3456 hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
3457 ok((hres == E_PENDING && cb==0) ||
3458 (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
3459 ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
3460 if(bindf & BINDF_FROMURLMON)
3461 CHECK_CALLED(Switch);
3462 else
3463 CHECK_CALLED(ReportData);
3464
3465 if(test_abort) {
3466 HRESULT hres;
3467
3468 SET_EXPECT(ReportResult);
3469 hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
3470 ok(hres == S_OK, "Abort failed: %08x\n", hres);
3471 CHECK_CALLED(ReportResult);
3472
3473 hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
3474 ok(hres == INET_E_RESULT_DISPATCHED || hres == S_OK /* IE10 */, "Abort failed: %08x\n", hres);
3475 break;
3476 }
3477 }else {
3478 if(bindf & BINDF_FROMURLMON)
3479 CHECK_NOT_CALLED(Switch);
3480 else
3481 CHECK_NOT_CALLED(ReportData);
3482 if(cb == 0) break;
3483 }
3484 }
3485 if(!test_abort) {
3486 ok(hres == S_FALSE, "Read failed: %08x\n", hres);
3487 CHECK_CALLED(ReportResult);
3488 }
3489 }
3490 if(prot == HTTPS_TEST)
3491 CLEAR_CALLED(ReportProgress_SENDINGREQUEST);
3492
3493 if (prot == HTTP_TEST || prot == HTTPS_TEST)
3494 CLEAR_CALLED(ReportProgress_COOKIE_SENT);
3495
3496 hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
3497 ok(hres == INET_E_RESULT_DISPATCHED || hres == S_OK /* IE10 */, "Abort failed: %08x\n", hres);
3498
3500
3501 hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
3502 ok(hres == S_OK, "Abort failed: %08x\n", hres);
3503
3504 ref = IInternetProtocol_Release(async_protocol);
3505 ok(!ref, "ref=%x\n", ref);
3506 }
3507
3508 IClassFactory_Release(factory);
3509
3510 if(flags & TEST_FROMCACHE) {
3511 BOOL res;
3512
3514 ok(res, "DeleteUrlCacheEntryA failed: %u\n", GetLastError());
3515 }
3516}
BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
Definition: urlcache.c:3344
static void create_cache_entry(const WCHAR *urlw)
Definition: protocol.c:3184
static BOOL http_protocol_start(LPCWSTR url, BOOL use_iuri)
Definition: protocol.c:3229
static DWORD tymed
Definition: url.c:174

Referenced by test_http_protocol(), and test_https_protocol().

◆ test_https_protocol()

static void test_https_protocol ( void  )
static

Definition at line 3591 of file protocol.c.

3592{
3593 static const WCHAR https_winehq_url[] =
3594 {'h','t','t','p','s',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
3595 't','e','s','t','s','/','h','e','l','l','o','.','h','t','m','l',0};
3596
3597 trace("Testing https protocol (from urlmon)...\n");
3598 bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
3599 test_http_protocol_url(https_winehq_url, HTTPS_TEST, TEST_FIRST_HTTP, TYMED_NULL);
3600}

Referenced by START_TEST().

◆ test_mk_protocol()

static void test_mk_protocol ( void  )
static

Definition at line 3733 of file protocol.c.

3734{
3738 IUnknown *unk;
3739 HRESULT hres;
3740
3741 static const WCHAR wrong_url1[] = {'t','e','s','t',':','@','M','S','I','T','S','t','o','r','e',
3742 ':',':','/','t','e','s','t','.','h','t','m','l',0};
3743 static const WCHAR wrong_url2[] = {'m','k',':','/','t','e','s','t','.','h','t','m','l',0};
3744
3745 trace("Testing mk protocol...\n");
3746 init_test(MK_TEST, 0);
3747
3748 hres = CoGetClassObject(&CLSID_MkProtocol, CLSCTX_INPROC_SERVER, NULL,
3749 &IID_IUnknown, (void**)&unk);
3750 ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
3751
3752 hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
3754 "Could not get IInternetProtocolInfo interface: %08x, expected E_NOINTERFACE\n",
3755 hres);
3756
3757 hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
3758 ok(hres == S_OK, "Could not get IClassFactory interface\n");
3759 IUnknown_Release(unk);
3760 if(FAILED(hres))
3761 return;
3762
3763 hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
3764 (void**)&protocol);
3765 IClassFactory_Release(factory);
3766 ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
3767
3768 SET_EXPECT(GetBindInfo);
3769 hres = IInternetProtocol_Start(protocol, wrong_url1, &protocol_sink, &bind_info, 0, 0);
3770 ok(hres == MK_E_SYNTAX || hres == INET_E_INVALID_URL,
3771 "Start failed: %08x, expected MK_E_SYNTAX or INET_E_INVALID_URL\n", hres);
3772 CLEAR_CALLED(GetBindInfo);
3773
3774 SET_EXPECT(GetBindInfo);
3775 SET_EXPECT(ReportProgress_DIRECTBIND);
3776 SET_EXPECT(ReportProgress_SENDINGREQUEST);
3777 SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
3778 SET_EXPECT(ReportResult);
3779 expect_hrResult = INET_E_RESOURCE_NOT_FOUND;
3780
3781 hres = IInternetProtocol_Start(protocol, wrong_url2, &protocol_sink, &bind_info, 0, 0);
3782 ok(hres == INET_E_RESOURCE_NOT_FOUND ||
3783 hres == INET_E_INVALID_URL, /* win2k3 */
3784 "Start failed: %08x, expected INET_E_RESOURCE_NOT_FOUND or INET_E_INVALID_URL\n", hres);
3785
3786 if (hres == INET_E_RESOURCE_NOT_FOUND) {
3787 CHECK_CALLED(GetBindInfo);
3788 CLEAR_CALLED(ReportProgress_DIRECTBIND);
3789 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
3790 CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
3791 CHECK_CALLED(ReportResult);
3792 }else {
3793 CLEAR_CALLED(GetBindInfo);
3794 CLEAR_CALLED(ReportProgress_DIRECTBIND);
3795 CLEAR_CALLED(ReportProgress_SENDINGREQUEST);
3796 CLEAR_CALLED(ReportProgress_MIMETYPEAVAILABLE);
3797 CLEAR_CALLED(ReportResult);
3798 }
3799
3800 IInternetProtocol_Release(protocol);
3801}

◆ test_priority()

static void test_priority ( IInternetProtocol protocol)
static

Definition at line 2764 of file protocol.c.

2765{
2767 LONG pr;
2768 HRESULT hres;
2769
2770 hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority,
2771 (void**)&priority);
2772 ok(hres == S_OK, "QueryInterface(IID_IInternetPriority) failed: %08x\n", hres);
2773 if(FAILED(hres))
2774 return;
2775
2776 hres = IInternetPriority_GetPriority(priority, &pr);
2777 ok(hres == S_OK, "GetPriority failed: %08x\n", hres);
2778 ok(pr == 0, "pr=%d, expected 0\n", pr);
2779
2780 hres = IInternetPriority_SetPriority(priority, 1);
2781 ok(hres == S_OK, "SetPriority failed: %08x\n", hres);
2782
2783 hres = IInternetPriority_GetPriority(priority, &pr);
2784 ok(hres == S_OK, "GetPriority failed: %08x\n", hres);
2785 ok(pr == 1, "pr=%d, expected 1\n", pr);
2786
2787 IInternetPriority_Release(priority);
2788}

◆ test_protocol_terminate()

static void test_protocol_terminate ( IInternetProtocol protocol)
static

Definition at line 3307 of file protocol.c.

3308{
3309 BYTE buf[3600];
3310 DWORD cb;
3311 HRESULT hres;
3312
3313 hres = IInternetProtocol_LockRequest(protocol, 0);
3314 ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
3315
3316 hres = IInternetProtocol_Read(protocol, buf, 1, &cb);
3317 ok(hres == (test_abort ? S_OK : S_FALSE), "Read failed: %08x\n", hres);
3318
3319 hres = IInternetProtocol_Terminate(protocol, 0);
3320 ok(hres == S_OK, "Terminate failed: %08x\n", hres);
3321
3322 /* This wait is to give the internet handles being freed in Terminate
3323 * enough time to actually terminate in all cases. Internet handles
3324 * terminate asynchronously and native reuses the main InternetOpen
3325 * handle. The only case in which this seems to be necessary is on
3326 * wine with native wininet and urlmon, resulting in the next time
3327 * test_http_protocol_url being called the first data notification actually
3328 * being an extra last data notification from the previous connection
3329 * about once out of every ten times. */
3330 Sleep(100);
3331
3332 hres = IInternetProtocol_UnlockRequest(protocol);
3333 ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
3334}
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790

Referenced by test_ftp_protocol(), and test_http_protocol_url().

◆ thread_proc()

static DWORD WINAPI thread_proc ( PVOID  arg)
static

Definition at line 1686 of file protocol.c.

1687{
1688 BOOL redirect = redirect_on_continue;
1689 HRESULT hres;
1690
1691 memset(&protocoldata, -1, sizeof(protocoldata));
1692
1693 while(1) {
1694 prot_state = 0;
1695
1696 SET_EXPECT(ReportProgress_FINDINGRESOURCE);
1697 hres = IInternetProtocolSink_ReportProgress(binding_sink,
1698 BINDSTATUS_FINDINGRESOURCE, hostW);
1699 CHECK_CALLED(ReportProgress_FINDINGRESOURCE);
1700 ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
1701
1702 SET_EXPECT(ReportProgress_CONNECTING);
1703 hres = IInternetProtocolSink_ReportProgress(binding_sink,
1704 BINDSTATUS_CONNECTING, winehq_ipW);
1705 CHECK_CALLED(ReportProgress_CONNECTING);
1706 ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
1707
1708 SET_EXPECT(ReportProgress_SENDINGREQUEST);
1709 hres = IInternetProtocolSink_ReportProgress(binding_sink,
1710 BINDSTATUS_SENDINGREQUEST, NULL);
1711 CHECK_CALLED(ReportProgress_SENDINGREQUEST);
1712 ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
1713
1714 prot_state = 1;
1715 SET_EXPECT(Switch);
1716 hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
1717 CHECK_CALLED(Switch);
1718 ok(hres == S_OK, "Switch failed: %08x\n", hres);
1719
1720 if(!redirect)
1721 break;
1722 redirect = FALSE;
1723 }
1724
1725 if(!short_read) {
1726 prot_state = 2;
1727 if(mimefilter_test)
1728 SET_EXPECT(MimeFilter_Switch);
1729 else
1730 SET_EXPECT(Switch);
1731 hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
1732 ok(hres == S_OK, "Switch failed: %08x\n", hres);
1733 if(mimefilter_test)
1734 CHECK_CALLED(MimeFilter_Switch);
1735 else
1736 CHECK_CALLED(Switch);
1737
1738 if(test_abort) {
1740 return 0;
1741 }
1742
1743 prot_state = 2;
1744 if(mimefilter_test)
1745 SET_EXPECT(MimeFilter_Switch);
1746 else
1747 SET_EXPECT(Switch);
1748 hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
1749 ok(hres == S_OK, "Switch failed: %08x\n", hres);
1750 if(mimefilter_test)
1751 CHECK_CALLED(MimeFilter_Switch);
1752 else
1753 CHECK_CALLED(Switch);
1754
1755 prot_state = 3;
1756 if(mimefilter_test)
1757 SET_EXPECT(MimeFilter_Switch);
1758 else
1759 SET_EXPECT(Switch);
1760 hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
1761 ok(hres == S_OK, "Switch failed: %08x\n", hres);
1762 if(mimefilter_test)
1763 CHECK_CALLED(MimeFilter_Switch);
1764 else
1765 CHECK_CALLED(Switch);
1766 }
1767
1769
1770 return 0;
1771}
static const WCHAR hostW[]
Definition: protocol.c:140
static const WCHAR winehq_ipW[]
Definition: protocol.c:141

Referenced by protocol_start().

◆ w2a()

static const char * w2a ( LPCWSTR  str)
static

Definition at line 232 of file protocol.c.

233{
234 static char buf[INTERNET_MAX_URL_LENGTH];
235 WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
236 return buf;
237}
const WCHAR * str

Referenced by create_cache_entry(), and START_TEST().

Variable Documentation

◆ acc_mimeW

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

Definition at line 137 of file protocol.c.

Referenced by BindInfo_GetBindString(), and protocol_start().

◆ async_protocol

◆ async_read_pending

BOOL async_read_pending
static

Definition at line 161 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 1532 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 1524 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:397
static ULONG WINAPI BindCallbackRedirect_Release(IBindCallbackRedirect *iface)
Definition: protocol.c:409
static ULONG WINAPI BindCallbackRedirect_AddRef(IBindCallbackRedirect *iface)
Definition: protocol.c:404
static HRESULT WINAPI BindCallbackRedirect_Redirect(IBindCallbackRedirect *iface, const WCHAR *url, VARIANT_BOOL *cancel)
Definition: protocol.c:414

Definition at line 421 of file protocol.c.

◆ bindf

DWORD bindf
static

Definition at line 151 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 203 of file protocol.c.

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

◆ ClassFactory

Definition at line 2658 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:2608

Definition at line 2650 of file protocol.c.

◆ continue_protdata

PROTOCOLDATA continue_protdata
static

Definition at line 158 of file protocol.c.

Referenced by ProtocolSink_Switch(), and test_http_protocol_url().

◆ direct_read

◆ DWORD

Definition at line 33 of file protocol.c.

◆ DWORD_PTR

Definition at line 35 of file protocol.c.

◆ empty_file

BOOL empty_file
static

◆ emptyW

const WCHAR emptyW[] = {0}
static

Definition at line 142 of file protocol.c.

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

◆ emulate_prot

BOOL emulate_prot
static

Definition at line 161 of file protocol.c.

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

◆ event_complete

◆ event_complete2

HANDLE event_complete2
static

Definition at line 156 of file protocol.c.

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

◆ event_continue

HANDLE event_continue
static

Definition at line 156 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 156 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 151 of file protocol.c.

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

◆ expect_hrResult

HRESULT expect_hrResult
static

Definition at line 146 of file protocol.c.

◆ expect_pv

void* expect_pv
static

Definition at line 155 of file protocol.c.

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

◆ expect_wsz

LPCWSTR expect_wsz
static

Definition at line 147 of file protocol.c.

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

◆ file_name

LPCWSTR file_name
static

Definition at line 147 of file protocol.c.

Referenced by add_file(), cache_file_available(), check_dir(), check_file_size(), check_version(), CommitUrlCacheEntryA(), 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(), export_all(), export_key(), export_registry_key(), ExtractZipImage(), file_exists(), file_modify(), find_and_map_dsym(), 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_xul(), macho_load_cb(), macho_load_module(), macho_search_and_load_file(), map_file(), OnControl(), OnOK(), Open(), open_typelib(), path_find_symbol_file(), path_name(), pdb_process_internal(), print_something(), PrintImageInfo(), process_file(), ProtocolSink_ReportProgress(), read_file_to_bstr(), 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_name_information(), test_file_protocol(), test_file_security(), test_file_truncate(), test_filemap_security(), test_fprintf(), test_GetMappedFileName(), test_GetVolumePathNameA(), test_http_cache(), test_mapping(), test_mhtml_protocol_binding(), test_text_fileio(), 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 159 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 149 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 144 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 294 of file protocol.c.

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

◆ http_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:351
static ULONG WINAPI HttpNegotiate_Release(IHttpNegotiate2 *iface)
Definition: protocol.c:314
static HRESULT WINAPI HttpNegotiate_GetRootSecurityId(IHttpNegotiate2 *iface, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
Definition: protocol.c:364
static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate2 *iface, LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
Definition: protocol.c:319
static ULONG WINAPI HttpNegotiate_AddRef(IHttpNegotiate2 *iface)
Definition: protocol.c:309
static HRESULT WINAPI HttpNegotiate_QueryInterface(IHttpNegotiate2 *iface, REFIID riid, void **ppv)
Definition: protocol.c:296

Definition at line 386 of file protocol.c.

◆ HttpSecurityVtbl

IHttpSecurityVtbl HttpSecurityVtbl
static
Initial value:
= {
}
static HRESULT WINAPI HttpSecurity_QueryInterface(IHttpSecurity *iface, REFIID riid, void **ppv)
Definition: protocol.c:239
static HRESULT WINAPI HttpSecurity_GetWindow(IHttpSecurity *iface, REFGUID rguidReason, HWND *phwnd)
Definition: protocol.c:261
static ULONG WINAPI HttpSecurity_Release(IHttpSecurity *iface)
Definition: protocol.c:256
static HRESULT WINAPI HttpSecurity_OnSecurityProblem(IHttpSecurity *iface, DWORD dwProblem)
Definition: protocol.c:268
static ULONG WINAPI HttpSecurity_AddRef(IHttpSecurity *iface)
Definition: protocol.c:251

Definition at line 286 of file protocol.c.

◆ impl_protex

BOOL impl_protex
static

Definition at line 160 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 134 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:1539
static HRESULT WINAPI InternetPriority_SetPriority(IInternetPriority *iface, LONG nPriority)
Definition: protocol.c:1568
static HRESULT WINAPI InternetPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority)
Definition: protocol.c:1575
static ULONG WINAPI InternetPriority_Release(IInternetPriority *iface)
Definition: protocol.c:1557
static ULONG WINAPI InternetPriority_AddRef(IInternetPriority *iface)
Definition: protocol.c:1546

Definition at line 1582 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:2567
static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: protocol.c:2544

Definition at line 2575 of file protocol.c.

◆ mime_protocol_sink

IInternetProtocolSink mime_protocol_sink = { &mime_protocol_sink_vtbl }
static

Definition at line 1372 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:1240
static HRESULT WINAPI MimeProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
Definition: protocol.c:1250
static HRESULT WINAPI MimeProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
Definition: protocol.c:1284
static HRESULT WINAPI MimeProtocolSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
Definition: protocol.c:1343
static ULONG WINAPI MimeProtocolSink_Release(IInternetProtocolSink *iface)
Definition: protocol.c:1245
static HRESULT WINAPI MimeProtocolSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: protocol.c:1264
static HRESULT WINAPI MimeProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv)
Definition: protocol.c:1228

Definition at line 1362 of file protocol.c.

◆ mimefilter_cf

IClassFactory mimefilter_cf = { &MimeFilterCFVtbl }
static

Definition at line 2679 of file protocol.c.

Referenced by register_filter().

◆ mimefilter_test

◆ MimeFilterCFVtbl

const IClassFactoryVtbl MimeFilterCFVtbl
static

◆ MimeProtocol

IInternetProtocolEx MimeProtocol = { &MimeProtocolVtbl }
static

Definition at line 2526 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:2344
static HRESULT WINAPI MimeProtocol_Read(IInternetProtocolEx *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: protocol.c:2447
static HRESULT WINAPI MimeProtocol_LockRequest(IInternetProtocolEx *iface, DWORD dwOptions)
Definition: protocol.c:2480
static ULONG WINAPI Protocol_AddRef(IInternetProtocolEx *iface)
Definition: protocol.c:1590
static HRESULT WINAPI Protocol_Abort(IInternetProtocolEx *iface, HRESULT hrReason, DWORD dwOptions)
Definition: protocol.c:1600
static HRESULT WINAPI MimeProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
Definition: protocol.c:2327
static HRESULT WINAPI Protocol_Resume(IInternetProtocolEx *iface)
Definition: protocol.c:1621
static ULONG WINAPI Protocol_Release(IInternetProtocolEx *iface)
Definition: protocol.c:1595
static HRESULT WINAPI Protocol_Suspend(IInternetProtocolEx *iface)
Definition: protocol.c:1615
static HRESULT WINAPI Protocol_Seek(IInternetProtocolEx *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
Definition: protocol.c:1627
static HRESULT WINAPI Protocol_Continue(IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData)
Definition: protocol.c:2424
static HRESULT WINAPI MimeProtocol_Terminate(IInternetProtocolEx *iface, DWORD dwOptions)
Definition: protocol.c:2431
static HRESULT WINAPI MimeProtocol_UnlockRequest(IInternetProtocolEx *iface)
Definition: protocol.c:2496

Definition at line 2510 of file protocol.c.

◆ no_aggregation

BOOL no_aggregation
static

Definition at line 163 of file protocol.c.

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

◆ no_mime

BOOL no_mime
static

Definition at line 162 of file protocol.c.

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

◆ outer_test_iid

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

Definition at line 4192 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 4215 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 150 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_emul

Protocol* protocol_emul
static

Definition at line 191 of file protocol.c.

Referenced by ClassFactory_CreateInstance(), and test_CreateBinding().

◆ protocol_info

IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl }
static

Definition at line 2585 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 193 of file protocol.c.

Referenced by test_binding().

◆ protocol_sink

IInternetProtocolSink protocol_sink = { &protocol_sink_vtbl }
static

Definition at line 1226 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 1216 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:2297
static HRESULT WINAPI ProtocolUnk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: protocol.c:2252
static ULONG WINAPI ProtocolUnk_Release(IUnknown *iface)
Definition: protocol.c:2303

Definition at line 2321 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:1955
static HRESULT WINAPI ProtocolEmul_UnlockRequest(IInternetProtocolEx *iface)
Definition: protocol.c:2214
static HRESULT WINAPI ProtocolEmul_LockRequest(IInternetProtocolEx *iface, DWORD dwOptions)
Definition: protocol.c:2207
static HRESULT WINAPI ProtocolEmul_StartEx(IInternetProtocolEx *iface, IUri *pUri, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE *dwReserved)
Definition: protocol.c:2220
static HRESULT WINAPI ProtocolEmul_Terminate(IInternetProtocolEx *iface, DWORD dwOptions)
Definition: protocol.c:2102
static HRESULT WINAPI ProtocolEmul_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
Definition: protocol.c:1639
static ULONG WINAPI ProtocolEmul_AddRef(IInternetProtocolEx *iface)
Definition: protocol.c:1664
static HRESULT WINAPI ProtocolEmul_Read(IInternetProtocolEx *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: protocol.c:2109
static ULONG WINAPI ProtocolEmul_Release(IInternetProtocolEx *iface)
Definition: protocol.c:1675
static HRESULT WINAPI ProtocolEmul_Start(IInternetProtocolEx *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
Definition: protocol.c:1944

Definition at line 2230 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 428 of file protocol.c.

Referenced by ServiceProvider_QueryService().

◆ redirect_on_continue

BOOL redirect_on_continue
static

Definition at line 149 of file protocol.c.

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

◆ reuse_protocol_thread

BOOL reuse_protocol_thread
static

Definition at line 162 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 497 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:447
static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
Definition: protocol.c:442
static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
Definition: protocol.c:432
static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
Definition: protocol.c:437

Definition at line 490 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 629 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:510
static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
Definition: protocol.c:560
static HRESULT WINAPI Stream_Revert(IStream *iface)
Definition: protocol.c:579
static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg, DWORD dwStatFlag)
Definition: protocol.c:599
static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
Definition: protocol.c:566
static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
Definition: protocol.c:585
static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
Definition: protocol.c:499
static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
Definition: protocol.c:606
static HRESULT WINAPI Stream_UnlockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
Definition: protocol.c:592
static ULONG WINAPI Stream_Release(IStream *iface)
Definition: protocol.c:515
static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
Definition: protocol.c:573
static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv, ULONG cb, ULONG *pcbWritten)
Definition: protocol.c:541

Definition at line 612 of file protocol.c.

◆ test_abort

◆ test_async_req

BOOL test_async_req
static

Definition at line 160 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 138 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 161 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 141 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 133 of file protocol.c.

Referenced by test_file_protocol(), and test_file_protocol_fail().