ReactOS  0.4.14-dev-583-g2a1ba2c
urlmon_main.h File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "urlmon.h"
#include "wininet.h"
#include "wine/heap.h"
#include "wine/list.h"
Include dependency graph for urlmon_main.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Protocol
 
struct  ProtocolVtbl
 
struct  BindProtocol
 
struct  tls_data_t
 

Macros

#define COBJMACROS
 
#define FLAG_REQUEST_COMPLETE   0x0001
 
#define FLAG_FIRST_CONTINUE_COMPLETE   0x0002
 
#define FLAG_FIRST_DATA_REPORTED   0x0004
 
#define FLAG_ALL_DATA_READ   0x0008
 
#define FLAG_LAST_DATA_REPORTED   0x0010
 
#define FLAG_RESULT_REPORTED   0x0020
 
#define FLAG_ERROR   0x0040
 
#define FLAG_SYNC_READ   0x0080
 

Typedefs

typedef HRESULT(* stop_cache_binding_proc_t) (void *, const WCHAR *, HRESULT, const WCHAR *)
 
typedef struct ProtocolVtbl ProtocolVtbl
 
typedef struct _task_header_t task_header_t
 

Functions

HRESULT SecManagerImpl_Construct (IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
 
HRESULT ZoneMgrImpl_Construct (IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
 
HRESULT StdURLMoniker_Construct (IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
 
HRESULT FileProtocol_Construct (IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
 
HRESULT HttpProtocol_Construct (IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
 
HRESULT HttpSProtocol_Construct (IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
 
HRESULT FtpProtocol_Construct (IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
 
HRESULT GopherProtocol_Construct (IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
 
HRESULT MkProtocol_Construct (IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
 
HRESULT MimeFilter_Construct (IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
 
HRESULT Uri_Construct (IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
 
BOOL WINAPI URLMON_DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) DECLSPEC_HIDDEN
 
HRESULT WINAPI URLMON_DllGetClassObject (REFCLSID rclsid, REFIID iid, LPVOID *ppv) DECLSPEC_HIDDEN
 
HRESULT WINAPI URLMON_DllRegisterServer (void) DECLSPEC_HIDDEN
 
HRESULT WINAPI URLMON_DllUnregisterServer (void) DECLSPEC_HIDDEN
 
static void URLMON_LockModule (void)
 
static void URLMON_UnlockModule (void)
 
IInternetProtocolInfoget_protocol_info (LPCWSTR) DECLSPEC_HIDDEN
 
HRESULT get_protocol_handler (IUri *, CLSID *, IClassFactory **) DECLSPEC_HIDDEN
 
IInternetProtocolget_mime_filter (LPCWSTR) DECLSPEC_HIDDEN
 
BOOL is_registered_protocol (LPCWSTR) DECLSPEC_HIDDEN
 
HRESULT register_namespace (IClassFactory *, REFIID, LPCWSTR, BOOL) DECLSPEC_HIDDEN
 
HINTERNET get_internet_session (IInternetBindInfo *) DECLSPEC_HIDDEN
 
WCHARget_useragent (void) DECLSPEC_HIDDEN
 
void update_user_agent (WCHAR *) DECLSPEC_HIDDEN
 
void free_session (void) DECLSPEC_HIDDEN
 
HRESULT find_mime_from_ext (const WCHAR *, WCHAR **) DECLSPEC_HIDDEN
 
HRESULT bind_to_storage (IUri *, IBindCtx *, REFIID, void **) DECLSPEC_HIDDEN
 
HRESULT bind_to_object (IMoniker *, IUri *, IBindCtx *, REFIID, void **ppv) DECLSPEC_HIDDEN
 
HRESULT create_default_callback (IBindStatusCallback **) DECLSPEC_HIDDEN
 
HRESULT wrap_callback (IBindStatusCallback *, IBindStatusCallback **) DECLSPEC_HIDDEN
 
IBindStatusCallbackbsc_from_bctx (IBindCtx *) DECLSPEC_HIDDEN
 
HRESULT download_to_cache (IUri *, stop_cache_binding_proc_t, void *, IBindStatusCallback *) DECLSPEC_HIDDEN
 
HRESULT protocol_start (Protocol *, IInternetProtocol *, IUri *, IInternetProtocolSink *, IInternetBindInfo *) DECLSPEC_HIDDEN
 
HRESULT protocol_continue (Protocol *, PROTOCOLDATA *) DECLSPEC_HIDDEN
 
HRESULT protocol_read (Protocol *, void *, ULONG, ULONG *) DECLSPEC_HIDDEN
 
HRESULT protocol_lock_request (Protocol *) DECLSPEC_HIDDEN
 
HRESULT protocol_unlock_request (Protocol *) DECLSPEC_HIDDEN
 
HRESULT protocol_abort (Protocol *, HRESULT) DECLSPEC_HIDDEN
 
HRESULT protocol_syncbinding (Protocol *) DECLSPEC_HIDDEN
 
void protocol_close_connection (Protocol *) DECLSPEC_HIDDEN
 
void find_domain_name (const WCHAR *, DWORD, INT *) DECLSPEC_HIDDEN
 
HRESULT create_binding_protocol (BindProtocol **) DECLSPEC_HIDDEN
 
void set_binding_sink (BindProtocol *, IInternetProtocolSink *, IInternetBindInfo *) DECLSPEC_HIDDEN
 
tls_data_tget_tls_data (void) DECLSPEC_HIDDEN
 
void unregister_notif_wnd_class (void) DECLSPEC_HIDDEN
 
HWND get_notif_hwnd (void) DECLSPEC_HIDDEN
 
void release_notif_hwnd (HWND) DECLSPEC_HIDDEN
 
const chardebugstr_bindstatus (ULONG) DECLSPEC_HIDDEN
 
static void__WINE_ALLOC_SIZE (2) heap_realloc_zero(void *mem
 
static LPWSTR heap_strdupW (LPCWSTR str)
 
static LPWSTR heap_strndupW (LPCWSTR str, int len)
 
static LPWSTR heap_strdupAtoW (const char *str)
 
static charheap_strdupWtoA (const WCHAR *str)
 

Variables

HINSTANCE hProxyDll DECLSPEC_HIDDEN
 
HINSTANCE urlmon_instance
 
static void size_t size
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 28 of file urlmon_main.h.

◆ FLAG_ALL_DATA_READ

#define FLAG_ALL_DATA_READ   0x0008

Definition at line 155 of file urlmon_main.h.

◆ FLAG_ERROR

#define FLAG_ERROR   0x0040

Definition at line 158 of file urlmon_main.h.

◆ FLAG_FIRST_CONTINUE_COMPLETE

#define FLAG_FIRST_CONTINUE_COMPLETE   0x0002

Definition at line 153 of file urlmon_main.h.

◆ FLAG_FIRST_DATA_REPORTED

#define FLAG_FIRST_DATA_REPORTED   0x0004

Definition at line 154 of file urlmon_main.h.

◆ FLAG_LAST_DATA_REPORTED

#define FLAG_LAST_DATA_REPORTED   0x0010

Definition at line 156 of file urlmon_main.h.

◆ FLAG_REQUEST_COMPLETE

#define FLAG_REQUEST_COMPLETE   0x0001

Definition at line 152 of file urlmon_main.h.

◆ FLAG_RESULT_REPORTED

#define FLAG_RESULT_REPORTED   0x0020

Definition at line 157 of file urlmon_main.h.

◆ FLAG_SYNC_READ

#define FLAG_SYNC_READ   0x0080

Definition at line 159 of file urlmon_main.h.

Typedef Documentation

◆ ProtocolVtbl

Definition at line 95 of file urlmon_main.h.

◆ stop_cache_binding_proc_t

typedef HRESULT(* stop_cache_binding_proc_t) (void *, const WCHAR *, HRESULT, const WCHAR *)

Definition at line 92 of file urlmon_main.h.

◆ task_header_t

Definition at line 172 of file urlmon_main.h.

Function Documentation

◆ __WINE_ALLOC_SIZE()

static void* __WINE_ALLOC_SIZE ( )
inlinestatic

◆ bind_to_object()

HRESULT bind_to_object ( IMoniker ,
IUri ,
IBindCtx ,
REFIID  ,
void **  ppv 
)

Definition at line 1646 of file binding.c.

1647 {
1648  Binding *binding;
1649  HRESULT hres;
1650 
1651  *ppv = NULL;
1652 
1653  hres = start_binding(mon, NULL, uri, pbc, TRUE, riid, &binding);
1654  if(FAILED(hres))
1655  return hres;
1656 
1657  if(binding->hres != S_OK) {
1658  hres = SUCCEEDED(binding->hres) ? S_OK : binding->hres;
1659  }else if(binding->bindf & BINDF_ASYNCHRONOUS) {
1660  hres = MK_S_ASYNCHRONOUS;
1661  }else {
1662  *ppv = binding->obj;
1663  IUnknown_AddRef(binding->obj);
1664  hres = S_OK;
1665  }
1666 
1667  IBinding_Release(&binding->IBinding_iface);
1668 
1669  return hres;
1670 }
#define TRUE
Definition: types.h:120
const char * uri
Definition: sec_mgr.c:1594
REFIID riid
Definition: precomp.h:44
IUnknown * obj
Definition: binding.c:99
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT hres
Definition: binding.c:96
IBinding IBinding_iface
Definition: binding.c:69
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
DWORD bindf
Definition: binding.c:86
#define S_OK
Definition: intsafe.h:59
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static HRESULT start_binding(IMoniker *mon, Binding *binding_ctx, IUri *uri, IBindCtx *pbc, BOOL to_obj, REFIID riid, Binding **ret)
Definition: binding.c:1560

◆ bind_to_storage()

HRESULT bind_to_storage ( IUri ,
IBindCtx ,
REFIID  ,
void **   
)

Definition at line 1617 of file binding.c.

1618 {
1619  Binding *binding = NULL, *binding_ctx;
1620  HRESULT hres;
1621 
1622  binding_ctx = get_bctx_binding(pbc);
1623 
1624  hres = start_binding(NULL, binding_ctx, uri, pbc, FALSE, riid, &binding);
1625  if(binding_ctx)
1626  IBinding_Release(&binding_ctx->IBinding_iface);
1627  if(FAILED(hres))
1628  return hres;
1629 
1630  if(binding->hres == S_OK && binding->download_state != BEFORE_DOWNLOAD /* FIXME */) {
1631  if((binding->state & BINDING_STOPPED) && (binding->state & BINDING_LOCKED))
1632  IInternetProtocolEx_UnlockRequest(&binding->protocol->IInternetProtocolEx_iface);
1633 
1634  hres = binding->stgmed_obj->vtbl->get_result(binding->stgmed_obj, binding->bindf, ppv);
1635  }else if(binding->bindf & BINDF_ASYNCHRONOUS) {
1636  hres = MK_S_ASYNCHRONOUS;
1637  }else {
1638  hres = FAILED(binding->hres) ? binding->hres : S_OK;
1639  }
1640 
1641  IBinding_Release(&binding->IBinding_iface);
1642 
1643  return hres;
1644 }
#define BINDING_STOPPED
Definition: binding.c:64
const char * uri
Definition: sec_mgr.c:1594
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
DWORD state
Definition: binding.c:95
HRESULT hres
Definition: binding.c:96
HRESULT(* get_result)(stgmed_obj_t *, DWORD, void **)
Definition: binding.c:50
#define BINDING_LOCKED
Definition: binding.c:63
const stgmed_obj_vtbl * vtbl
Definition: binding.c:54
IBinding IBinding_iface
Definition: binding.c:69
smooth NULL
Definition: ftsmooth.c:416
download_state_t download_state
Definition: binding.c:98
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
BindProtocol * protocol
Definition: binding.c:80
IInternetProtocolEx IInternetProtocolEx_iface
Definition: urlmon_main.h:175
DWORD bindf
Definition: binding.c:86
#define S_OK
Definition: intsafe.h:59
static Binding * get_bctx_binding(IBindCtx *bctx)
Definition: binding.c:964
stgmed_obj_t * stgmed_obj
Definition: binding.c:83
static HRESULT start_binding(IMoniker *mon, Binding *binding_ctx, IUri *uri, IBindCtx *pbc, BOOL to_obj, REFIID riid, Binding **ret)
Definition: binding.c:1560

Referenced by URLMoniker_BindToStorage().

◆ bsc_from_bctx()

IBindStatusCallback* bsc_from_bctx ( IBindCtx )

Definition at line 70 of file bindctx.c.

71 {
72  BindStatusCallback *holder;
74  HRESULT hres;
75 
76  bsc = bsch_from_bctx(bctx);
77  if(!bsc)
78  return NULL;
79 
80  hres = IBindStatusCallback_QueryInterface(bsc, &IID_IBindStatusCallbackHolder, (void**)&holder);
81  if(FAILED(hres))
82  return bsc;
83 
84  if(holder->callback) {
85  IBindStatusCallback_Release(bsc);
86  bsc = holder->callback;
87  IBindStatusCallback_AddRef(bsc);
88  }
89 
90  IBindStatusCallbackEx_Release(&holder->IBindStatusCallbackEx_iface);
91  return bsc;
92 }
IBindStatusCallbackEx IBindStatusCallbackEx_iface
Definition: bindctx.c:31
IID IID_IBindStatusCallbackHolder
static IBindStatusCallbackEx bsc
Definition: url.c:2150
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
IBindStatusCallback * callback
Definition: bindctx.c:39
static IBindStatusCallback * bsch_from_bctx(IBindCtx *bctx)
Definition: bindctx.c:55

Referenced by AsyncInstallDistributionUnit(), and RevokeBindStatusCallback().

◆ create_binding_protocol()

HRESULT create_binding_protocol ( BindProtocol **  )

Definition at line 1442 of file bindprot.c.

1443 {
1444  BindProtocol *ret = heap_alloc_zero(sizeof(BindProtocol));
1445 
1446  ret->IInternetProtocolEx_iface.lpVtbl = &BindProtocolVtbl;
1447  ret->IInternetBindInfo_iface.lpVtbl = &InternetBindInfoVtbl;
1448  ret->IInternetPriority_iface.lpVtbl = &InternetPriorityVtbl;
1449  ret->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
1450  ret->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl;
1451 
1452  ret->default_protocol_handler.IInternetProtocol_iface.lpVtbl = &InternetProtocolHandlerVtbl;
1453  ret->default_protocol_handler.IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkHandlerVtbl;
1454 
1455  ret->ref = 1;
1456  ret->apartment_thread = GetCurrentThreadId();
1457  ret->notif_hwnd = get_notif_hwnd();
1458  ret->protocol_handler = &ret->default_protocol_handler.IInternetProtocol_iface;
1459  ret->protocol_sink_handler = &ret->default_protocol_handler.IInternetProtocolSink_iface;
1460  InitializeCriticalSection(&ret->section);
1461  ret->section.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": BindProtocol.section");
1462 
1464 
1465  *protocol = ret;
1466  return S_OK;
1467 }
static const IInternetProtocolExVtbl BindProtocolVtbl
Definition: bindprot.c:588
#define DWORD_PTR
Definition: treelist.c:76
static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl
Definition: bindprot.c:1388
static const IInternetPriorityVtbl InternetPriorityVtbl
Definition: bindprot.c:1172
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
static const IInternetBindInfoVtbl InternetBindInfoVtbl
Definition: bindprot.c:1120
HWND get_notif_hwnd(void)
Definition: bindprot.c:111
int ret
static const IInternetProtocolVtbl InternetProtocolHandlerVtbl
Definition: bindprot.c:825
#define S_OK
Definition: intsafe.h:59
static const IServiceProviderVtbl ServiceProviderVtbl
Definition: bindprot.c:1435
static const IInternetProtocolSinkVtbl InternetProtocolSinkHandlerVtbl
Definition: bindprot.c:1047
static void URLMON_LockModule(void)
Definition: urlmon_main.h:68

Referenced by Binding_Create(), and InternetSession_CreateBinding().

◆ create_default_callback()

HRESULT create_default_callback ( IBindStatusCallback **  )

Definition at line 361 of file download.c.

362 {
364  HRESULT hres;
365 
367  if(FAILED(hres))
368  return hres;
369 
370  hres = wrap_callback(&callback->IBindStatusCallback_iface, ret);
371  IBindStatusCallback_Release(&callback->IBindStatusCallback_iface);
372  return hres;
373 }
HRESULT wrap_callback(IBindStatusCallback *bsc, IBindStatusCallback **ret_iface)
Definition: bindctx.c:578
static HRESULT DownloadBSC_Create(IBindStatusCallback *callback, LPCWSTR file_name, DownloadBSC **ret_callback)
Definition: download.c:333
smooth NULL
Definition: ftsmooth.c:416
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
int ret

Referenced by get_callback().

◆ debugstr_bindstatus()

const char* debugstr_bindstatus ( ULONG  )

Definition at line 175 of file urlmon_main.c.

176 {
177  switch(status) {
178 #define X(x) case x: return #x
179  X(BINDSTATUS_FINDINGRESOURCE);
180  X(BINDSTATUS_CONNECTING);
181  X(BINDSTATUS_REDIRECTING);
182  X(BINDSTATUS_BEGINDOWNLOADDATA);
183  X(BINDSTATUS_DOWNLOADINGDATA);
184  X(BINDSTATUS_ENDDOWNLOADDATA);
185  X(BINDSTATUS_BEGINDOWNLOADCOMPONENTS);
186  X(BINDSTATUS_INSTALLINGCOMPONENTS);
187  X(BINDSTATUS_ENDDOWNLOADCOMPONENTS);
188  X(BINDSTATUS_USINGCACHEDCOPY);
189  X(BINDSTATUS_SENDINGREQUEST);
190  X(BINDSTATUS_CLASSIDAVAILABLE);
191  X(BINDSTATUS_MIMETYPEAVAILABLE);
192  X(BINDSTATUS_CACHEFILENAMEAVAILABLE);
193  X(BINDSTATUS_BEGINSYNCOPERATION);
194  X(BINDSTATUS_ENDSYNCOPERATION);
195  X(BINDSTATUS_BEGINUPLOADDATA);
196  X(BINDSTATUS_UPLOADINGDATA);
197  X(BINDSTATUS_ENDUPLOADINGDATA);
198  X(BINDSTATUS_PROTOCOLCLASSID);
199  X(BINDSTATUS_ENCODING);
200  X(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE);
201  X(BINDSTATUS_CLASSINSTALLLOCATION);
202  X(BINDSTATUS_DECODING);
203  X(BINDSTATUS_LOADINGMIMEHANDLER);
204  X(BINDSTATUS_CONTENTDISPOSITIONATTACH);
205  X(BINDSTATUS_FILTERREPORTMIMETYPE);
206  X(BINDSTATUS_CLSIDCANINSTANTIATE);
207  X(BINDSTATUS_IUNKNOWNAVAILABLE);
208  X(BINDSTATUS_DIRECTBIND);
209  X(BINDSTATUS_RAWMIMETYPE);
210  X(BINDSTATUS_PROXYDETECTING);
211  X(BINDSTATUS_ACCEPTRANGES);
212  X(BINDSTATUS_COOKIE_SENT);
213  X(BINDSTATUS_COMPACT_POLICY_RECEIVED);
214  X(BINDSTATUS_COOKIE_SUPPRESSED);
215  X(BINDSTATUS_COOKIE_STATE_UNKNOWN);
216  X(BINDSTATUS_COOKIE_STATE_ACCEPT);
217  X(BINDSTATUS_COOKIE_STATE_REJECT);
218  X(BINDSTATUS_COOKIE_STATE_PROMPT);
219  X(BINDSTATUS_COOKIE_STATE_LEASH);
220  X(BINDSTATUS_COOKIE_STATE_DOWNGRADE);
221  X(BINDSTATUS_POLICY_HREF);
222  X(BINDSTATUS_P3P_HEADER);
223  X(BINDSTATUS_SESSION_COOKIE_RECEIVED);
224  X(BINDSTATUS_PERSISTENT_COOKIE_RECEIVED);
225  X(BINDSTATUS_SESSION_COOKIES_ALLOWED);
226  X(BINDSTATUS_CACHECONTROL);
227  X(BINDSTATUS_CONTENTDISPOSITIONFILENAME);
228  X(BINDSTATUS_MIMETEXTPLAINMISMATCH);
229  X(BINDSTATUS_PUBLISHERAVAILABLE);
230  X(BINDSTATUS_DISPLAYNAMEAVAILABLE);
231 #undef X
232  default:
233  return wine_dbg_sprintf("(invalid status %u)", status);
234  }
235 }
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271
#define X(x)
Definition: ps.c:97

Referenced by BindStatusCallback_OnProgress(), InternetProtocolSink_ReportProgress(), and ProtocolSinkHandler_ReportProgress().

◆ download_to_cache()

HRESULT download_to_cache ( IUri ,
stop_cache_binding_proc_t  ,
void ,
IBindStatusCallback  
)

Definition at line 375 of file download.c.

376 {
377  DownloadBSC *dwl_bsc;
378  IBindCtx *bindctx;
379  IMoniker *mon;
380  IUnknown *unk;
381  HRESULT hres;
382 
383  hres = DownloadBSC_Create(callback, NULL, &dwl_bsc);
384  if(FAILED(hres))
385  return hres;
386 
387  dwl_bsc->onstop_proc = proc;
388  dwl_bsc->ctx = ctx;
389  dwl_bsc->bindf = BINDF_ASYNCHRONOUS;
390 
391  hres = CreateAsyncBindCtx(0, &dwl_bsc->IBindStatusCallback_iface, NULL, &bindctx);
392  IBindStatusCallback_Release(&dwl_bsc->IBindStatusCallback_iface);
393  if(FAILED(hres))
394  return hres;
395 
396  hres = CreateURLMonikerEx2(NULL, uri, &mon, 0);
397  if(FAILED(hres)) {
398  IBindCtx_Release(bindctx);
399  return hres;
400  }
401 
402  hres = IMoniker_BindToStorage(mon, bindctx, NULL, &IID_IUnknown, (void**)&unk);
403  IMoniker_Release(mon);
404  IBindCtx_Release(bindctx);
405  if(SUCCEEDED(hres) && unk)
406  IUnknown_Release(unk);
407  return hres;
408 
409 }
stop_cache_binding_proc_t onstop_proc
Definition: download.c:36
const char * uri
Definition: sec_mgr.c:1594
static HRESULT DownloadBSC_Create(IBindStatusCallback *callback, LPCWSTR file_name, DownloadBSC **ret_callback)
Definition: download.c:333
static HANDLE proc()
Definition: pdb.c:32
DWORD bindf
Definition: download.c:34
void * ctx
Definition: download.c:37
smooth NULL
Definition: ftsmooth.c:416
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
HRESULT WINAPI CreateURLMonikerEx2(IMoniker *pmkContext, IUri *pUri, IMoniker **ppmk, DWORD dwFlags)
Definition: umon.c:668
HRESULT WINAPI CreateAsyncBindCtx(DWORD reserved, IBindStatusCallback *callback, IEnumFORMATETC *format, IBindCtx **pbind)
Definition: bindctx.c:899
IBindStatusCallback IBindStatusCallback_iface
Definition: download.c:25
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by AsyncInstallDistributionUnit().

◆ FileProtocol_Construct()

HRESULT FileProtocol_Construct ( IUnknown pUnkOuter,
LPVOID ppobj 
)

Definition at line 421 of file file.c.

422 {
423  FileProtocol *ret;
424 
425  TRACE("(%p %p)\n", outer, ppobj);
426 
428 
429  ret = heap_alloc(sizeof(FileProtocol));
430 
431  ret->IUnknown_inner.lpVtbl = &FileProtocolUnkVtbl;
432  ret->IInternetProtocolEx_iface.lpVtbl = &FileProtocolExVtbl;
433  ret->IInternetPriority_iface.lpVtbl = &FilePriorityVtbl;
434  ret->file = INVALID_HANDLE_VALUE;
435  ret->priority = 0;
436  ret->ref = 1;
437  ret->outer = outer ? outer : &ret->IUnknown_inner;
438 
439  *ppobj = &ret->IUnknown_inner;
440  return S_OK;
441 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static const IInternetProtocolExVtbl FileProtocolExVtbl
Definition: file.c:357
#define TRACE(s)
Definition: solgame.cpp:4
int ret
#define S_OK
Definition: intsafe.h:59
static const IInternetPriorityVtbl FilePriorityVtbl
Definition: file.c:413
static void URLMON_LockModule(void)
Definition: urlmon_main.h:68
static const IUnknownVtbl FileProtocolUnkVtbl
Definition: file.c:113

◆ find_domain_name()

void find_domain_name ( const WCHAR ,
DWORD  ,
INT  
)

Definition at line 520 of file uri.c.

521  {
522  const WCHAR *last_tld, *sec_last_tld, *end, *p;
523 
524  end = host+host_len-1;
525 
526  *domain_start = -1;
527 
528  /* There has to be at least enough room for a '.' followed by a
529  * 3-character TLD for a domain to even exist in the host name.
530  */
531  if(host_len < 4)
532  return;
533 
534  for (last_tld = sec_last_tld = NULL, p = host; p <= end; p++)
535  {
536  if (*p == '.')
537  {
538  sec_last_tld = last_tld;
539  last_tld = p;
540  }
541  }
542  if(!last_tld)
543  /* http://hostname -> has no domain name. */
544  return;
545 
546  if(!sec_last_tld) {
547  /* If the '.' is at the beginning of the host there
548  * has to be at least 3 characters in the TLD for it
549  * to be valid.
550  * Ex: .com -> .com as the domain name.
551  * .co -> has no domain name.
552  */
553  if(last_tld-host == 0) {
554  if(end-(last_tld-1) < 3)
555  return;
556  } else if(last_tld-host == 3) {
557  DWORD i;
558 
559  /* If there are three characters in front of last_tld and
560  * they are on the list of recognized TLDs, then this
561  * host doesn't have a domain (since the host only contains
562  * a TLD name.
563  * Ex: edu.uk -> has no domain name.
564  * foo.uk -> foo.uk as the domain name.
565  */
566  for(i = 0; i < ARRAY_SIZE(recognized_tlds); ++i) {
568  return;
569  }
570  } else if(last_tld-host < 3)
571  /* Anything less than 3 characters is considered part
572  * of the TLD name.
573  * Ex: ak.uk -> Has no domain name.
574  */
575  return;
576 
577  /* Otherwise the domain name is the whole host name. */
578  *domain_start = 0;
579  } else if(end+1-last_tld > 3) {
580  /* If the last_tld has more than 3 characters, then it's automatically
581  * considered the TLD of the domain name.
582  * Ex: www.winehq.org.uk.test -> uk.test as the domain name.
583  */
584  *domain_start = (sec_last_tld+1)-host;
585  } else if(last_tld - (sec_last_tld+1) < 4) {
586  DWORD i;
587  /* If the sec_last_tld is 3 characters long it HAS to be on the list of
588  * recognized to still be considered part of the TLD name, otherwise
589  * it's considered the domain name.
590  * Ex: www.google.com.uk -> google.com.uk as the domain name.
591  * www.google.foo.uk -> foo.uk as the domain name.
592  */
593  if(last_tld - (sec_last_tld+1) == 3) {
594  for(i = 0; i < ARRAY_SIZE(recognized_tlds); ++i) {
595  if(!StrCmpNIW(sec_last_tld+1, recognized_tlds[i].tld_name, 3)) {
596  for (p = sec_last_tld; p > host; p--) if (p[-1] == '.') break;
597  *domain_start = p - host;
598  TRACE("Found domain name %s\n", debugstr_wn(host+*domain_start,
599  (host+host_len)-(host+*domain_start)));
600  return;
601  }
602  }
603 
604  *domain_start = (sec_last_tld+1)-host;
605  } else {
606  /* Since the sec_last_tld is less than 3 characters it's considered
607  * part of the TLD.
608  * Ex: www.google.fo.uk -> google.fo.uk as the domain name.
609  */
610  for (p = sec_last_tld; p > host; p--) if (p[-1] == '.') break;
611  *domain_start = p - host;
612  }
613  } else {
614  /* The second to last TLD has more than 3 characters making it
615  * the domain name.
616  * Ex: www.google.test.us -> test.us as the domain name.
617  */
618  *domain_start = (sec_last_tld+1)-host;
619  }
620 
621  TRACE("Found domain name %s\n", debugstr_wn(host+*domain_start,
622  (host+host_len)-(host+*domain_start)));
623 }
char * host
Definition: whois.c:55
GLuint GLuint end
Definition: gl.h:1545
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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const struct @547 recognized_tlds[]
#define debugstr_wn
Definition: kernel32.h:33
#define ARRAY_SIZE(a)
Definition: main.h:24
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR tld_name[4]
Definition: uri.c:243
INT WINAPI StrCmpNIW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
Definition: string.c:311

Referenced by canonicalize_reg_name(), and search_domain_for_zone().

◆ find_mime_from_ext()

HRESULT find_mime_from_ext ( const WCHAR ,
WCHAR **   
)

Definition at line 425 of file mimefilter.c.

426 {
427  DWORD res, size;
428  WCHAR mime[64];
429  HKEY hkey;
430 
431  static const WCHAR content_typeW[] = {'C','o','n','t','e','n','t',' ','T','y','p','e','\0'};
432 
434  if(res != ERROR_SUCCESS)
435  return HRESULT_FROM_WIN32(res);
436 
437  size = sizeof(mime);
438  res = RegQueryValueExW(hkey, content_typeW, NULL, NULL, (LPBYTE)mime, &size);
439  RegCloseKey(hkey);
440  if(res != ERROR_SUCCESS)
441  return HRESULT_FROM_WIN32(res);
442 
443  TRACE("found MIME %s\n", debugstr_w(mime));
444 
445  *ret = CoTaskMemAlloc(size);
446  memcpy(*ret, mime, size);
447  return S_OK;
448 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * mime
Definition: mimefilter.c:512
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
GLuint res
Definition: glext.h:9613
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

Referenced by FileProtocol_StartEx(), and find_mime_from_url().

◆ free_session()

void free_session ( void  )

Definition at line 755 of file session.c.

756 {
757  name_space *ns_iter, *ns_last;
758  mime_filter *mf_iter, *mf_last;
759 
761  if(!ns_iter->urlmon)
762  IClassFactory_Release(ns_iter->cf);
763  heap_free(ns_iter->protocol);
764  heap_free(ns_iter);
765  }
766 
768  IClassFactory_Release(mf_iter->cf);
769  heap_free(mf_iter->mime);
770  heap_free(mf_iter);
771  }
772 
774 }
IClassFactory * cf
Definition: session.c:28
IClassFactory * cf
Definition: session.c:36
BOOL urlmon
Definition: session.c:30
static struct list mime_filter_list
Definition: session.c:44
static LPWSTR user_agent
Definition: session.c:520
LPWSTR mime
Definition: session.c:38
LPWSTR protocol
Definition: session.c:27
uint32_t entry
Definition: isohybrid.c:63
static struct list name_space_list
Definition: session.c:43
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by process_detach().

◆ FtpProtocol_Construct()

HRESULT FtpProtocol_Construct ( IUnknown pUnkOuter,
LPVOID ppobj 
)

◆ get_internet_session()

HINTERNET get_internet_session ( IInternetBindInfo )

Definition at line 290 of file protocol.c.

291 {
292  HINTERNET new_session;
293 
294  if(internet_session)
295  return internet_session;
296 
297  if(!bind_info)
298  return NULL;
299 
300  new_session = create_internet_session(bind_info);
301  if(new_session && InterlockedCompareExchangePointer((void**)&internet_session, new_session, NULL))
302  InternetCloseHandle(new_session);
303 
304  return internet_session;
305 }
static HINTERNET internet_session
Definition: protocol.c:288
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1436
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
smooth NULL
Definition: ftsmooth.c:416
static IInternetBindInfo bind_info
Definition: protocol.c:284
static HINTERNET create_internet_session(IInternetBindInfo *bind_info)
Definition: protocol.c:264

Referenced by process_detach(), and protocol_start().

◆ get_mime_filter()

IInternetProtocol* get_mime_filter ( LPCWSTR  )

Definition at line 250 of file session.c.

251 {
252  static const WCHAR filtersW[] = {'P','r','o','t','o','c','o','l','s',
253  '\\','F','i','l','t','e','r',0 };
254  static const WCHAR CLSIDW[] = {'C','L','S','I','D',0};
255 
256  IClassFactory *cf = NULL;
258  mime_filter *iter;
259  HKEY hlist, hfilter;
260  WCHAR clsidw[64];
261  CLSID clsid;
262  DWORD res, type, size;
263  HRESULT hres;
264 
266 
268  if(!wcscmp(iter->mime, mime)) {
269  cf = iter->cf;
270  break;
271  }
272  }
273 
275 
276  if(cf) {
277  hres = IClassFactory_CreateInstance(cf, NULL, &IID_IInternetProtocol, (void**)&ret);
278  if(FAILED(hres)) {
279  WARN("CreateInstance failed: %08x\n", hres);
280  return NULL;
281  }
282 
283  return ret;
284  }
285 
286  res = RegOpenKeyW(HKEY_CLASSES_ROOT, filtersW, &hlist);
287  if(res != ERROR_SUCCESS) {
288  TRACE("Could not open MIME filters key\n");
289  return NULL;
290  }
291 
292  res = RegOpenKeyW(hlist, mime, &hfilter);
293  CloseHandle(hlist);
294  if(res != ERROR_SUCCESS)
295  return NULL;
296 
297  size = sizeof(clsidw);
298  res = RegQueryValueExW(hfilter, CLSIDW, NULL, &type, (LPBYTE)clsidw, &size);
299  CloseHandle(hfilter);
300  if(res!=ERROR_SUCCESS || type!=REG_SZ) {
301  WARN("Could not get filter CLSID for %s\n", debugstr_w(mime));
302  return NULL;
303  }
304 
305  hres = CLSIDFromString(clsidw, &clsid);
306  if(FAILED(hres)) {
307  WARN("CLSIDFromString failed for %s (%x)\n", debugstr_w(mime), hres);
308  return NULL;
309  }
310 
311  hres = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void**)&ret);
312  if(FAILED(hres)) {
313  WARN("CoCreateInstance failed: %08x\n", hres);
314  return NULL;
315  }
316 
317  return ret;
318 }
#define CloseHandle
Definition: compat.h:406
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * mime
Definition: mimefilter.c:512
#define WARN(fmt,...)
Definition: debug.h:111
IClassFactory * cf
Definition: session.c:36
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
unsigned char * LPBYTE
Definition: typedefs.h:52
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static struct list mime_filter_list
Definition: session.c:44
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
LPWSTR mime
Definition: session.c:38
unsigned long DWORD
Definition: ntddk_ex.h:95
static CRITICAL_SECTION session_cs
Definition: session.c:46
int ret
REFCLSID clsid
Definition: msctf.c:82
uint32_t entry
Definition: isohybrid.c:63
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
GLuint res
Definition: glext.h:9613
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define REG_SZ
Definition: layer.c:22

Referenced by mime_available().

◆ get_notif_hwnd()

HWND get_notif_hwnd ( void  )

Definition at line 111 of file bindprot.c.

112 {
113  tls_data_t *tls_data;
114 
115  static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
116 
117  tls_data = get_tls_data();
118  if(!tls_data)
119  return NULL;
120 
121  if(tls_data->notif_hwnd_cnt) {
122  tls_data->notif_hwnd_cnt++;
123  return tls_data->notif_hwnd;
124  }
125 
127  if(!notif_wnd_class)
128  return NULL;
129 
132  NULL, hProxyDll, NULL);
133  if(tls_data->notif_hwnd)
134  tls_data->notif_hwnd_cnt++;
135 
136  TRACE("hwnd = %p\n", tls_data->notif_hwnd);
137 
138  return tls_data->notif_hwnd;
139 }
static const WCHAR wszURLMonikerNotificationWindow[]
Definition: bindprot.c:86
static ATOM notif_wnd_class
Definition: bindprot.c:90
HWND notif_hwnd
Definition: urlmon_main.h:226
#define INIT_ONCE_STATIC_INIT
Definition: winbase.h:593
#define HWND_MESSAGE
Definition: winuser.h:1196
smooth NULL
Definition: ftsmooth.c:416
BOOL NTAPI InitOnceExecuteOnce(INIT_ONCE *once, PINIT_ONCE_FN func, void *param, void **context)
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL WINAPI register_notif_wnd_class(INIT_ONCE *once, void *param, void **context)
Definition: bindprot.c:92
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
DWORD notif_hwnd_cnt
Definition: urlmon_main.h:227
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
tls_data_t * get_tls_data(void)
Definition: urlmon_main.c:62

Referenced by Binding_Create(), and create_binding_protocol().

◆ get_protocol_handler()

HRESULT get_protocol_handler ( IUri ,
CLSID ,
IClassFactory **   
)

Definition at line 220 of file session.c.

221 {
222  name_space *ns;
223  BSTR scheme;
224  HRESULT hres;
225 
226  *ret = NULL;
227 
228  /* FIXME: Avoid GetSchemeName call for known schemes */
229  hres = IUri_GetSchemeName(uri, &scheme);
230  if(FAILED(hres))
231  return hres;
232 
234 
236  if(ns) {
237  *ret = ns->cf;
238  IClassFactory_AddRef(*ret);
239  if(clsid)
240  *clsid = ns->clsid;
241  }
242 
244 
247  return hres;
248 }
const char * uri
Definition: sec_mgr.c:1594
DWORD scheme
OLECHAR * BSTR
Definition: compat.h:1942
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
smooth NULL
Definition: ftsmooth.c:416
static name_space * find_name_space(LPCWSTR protocol)
Definition: session.c:62
static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid, IClassFactory **ret)
Definition: session.c:74
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static CRITICAL_SECTION session_cs
Definition: session.c:46
int ret
REFCLSID clsid
Definition: msctf.c:82
Definition: mxnamespace.c:44
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by BindProtocol_StartEx().

◆ get_protocol_info()

IInternetProtocolInfo* get_protocol_info ( LPCWSTR  )

Definition at line 181 of file session.c.

182 {
184  IClassFactory *cf;
185  name_space *ns;
186  WCHAR schema[64];
187  DWORD schema_len;
188  HRESULT hres;
189 
190  hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, ARRAY_SIZE(schema), &schema_len, 0);
191  if(FAILED(hres) || !schema_len)
192  return NULL;
193 
195 
197  if(ns && !ns->urlmon) {
198  hres = IClassFactory_QueryInterface(ns->cf, &IID_IInternetProtocolInfo, (void**)&ret);
199  if(FAILED(hres))
200  hres = IClassFactory_CreateInstance(ns->cf, NULL, &IID_IInternetProtocolInfo, (void**)&ret);
201  }
202 
204 
205  if(ns && SUCCEEDED(hres))
206  return ret;
207 
208  hres = get_protocol_cf(schema, schema_len, NULL, &cf);
209  if(FAILED(hres))
210  return NULL;
211 
212  hres = IClassFactory_QueryInterface(cf, &IID_IInternetProtocolInfo, (void**)&ret);
213  if(FAILED(hres))
214  IClassFactory_CreateInstance(cf, NULL, &IID_IInternetProtocolInfo, (void**)&ret);
215  IClassFactory_Release(cf);
216 
217  return ret;
218 }
static IClassFactory * cf
HRESULT WINAPI CoInternetParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwFlags, LPWSTR pszResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: internet.c:392
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
smooth NULL
Definition: ftsmooth.c:416
static name_space * find_name_space(LPCWSTR protocol)
Definition: session.c:62
static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid, IClassFactory **ret)
Definition: session.c:74
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR url[]
Definition: encode.c:1432
unsigned long DWORD
Definition: ntddk_ex.h:95
static CRITICAL_SECTION session_cs
Definition: session.c:46
int ret
Definition: mxnamespace.c:44
#define ARRAY_SIZE(a)
Definition: main.h:24
const WCHAR * schema
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CoInternetCombineIUri(), CoInternetCombineUrl(), CoInternetCombineUrlEx(), CoInternetCompareUrl(), CoInternetParseIUri(), CoInternetQueryInfo(), parse_canonicalize_url(), parse_domain(), parse_encode(), parse_path_from_url(), parse_rootdocument(), parse_security_domain(), and parse_security_url().

◆ get_tls_data()

tls_data_t* get_tls_data ( void  )

Definition at line 62 of file urlmon_main.c.

63 {
65 
67  DWORD tls = TlsAlloc();
68  if(tls == TLS_OUT_OF_INDEXES)
69  return NULL;
70 
72  if(tls != urlmon_tls)
73  TlsFree(tls);
74  }
75 
77  if(!data) {
78  data = heap_alloc_zero(sizeof(tls_data_t));
79  if(!data)
80  return NULL;
81 
83  list_add_tail(&tls_list, &data->entry);
85 
87  }
88 
89  return data;
90 }
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1264
static CRITICAL_SECTION tls_cs
Definition: urlmon_main.c:52
#define InterlockedCompareExchange
Definition: interlocked.h:104
static struct list tls_list
Definition: urlmon_main.c:50
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static DWORD urlmon_tls
Definition: urlmon_main.c:46
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1154
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
DWORD WINAPI TlsAlloc(VOID)
Definition: thread.c:1088
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:530
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
static DWORD tls
Definition: sock.c:230
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by get_notif_hwnd(), notif_wnd_proc(), and release_notif_hwnd().

◆ get_useragent()

WCHAR* get_useragent ( void  )

Definition at line 609 of file session.c.

610 {
611  LPWSTR ret;
612 
614 
618 
619  return ret;
620 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
static LPWSTR user_agent
Definition: session.c:520
static void ensure_useragent(void)
Definition: session.c:522
static CRITICAL_SECTION session_cs
Definition: session.c:46
int ret
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by create_internet_session().

◆ GopherProtocol_Construct()

HRESULT GopherProtocol_Construct ( IUnknown pUnkOuter,
LPVOID ppobj 
)

Definition at line 312 of file gopher.c.

313 {
315 
316  TRACE("(%p %p)\n", pUnkOuter, ppobj);
317 
319 
320  ret = heap_alloc_zero(sizeof(GopherProtocol));
321 
322  ret->base.vtbl = &AsyncProtocolVtbl;
323  ret->IInternetProtocol_iface.lpVtbl = &GopherProtocolVtbl;
324  ret->IInternetPriority_iface.lpVtbl = &GopherPriorityVtbl;
325  ret->ref = 1;
326 
327  *ppobj = &ret->IInternetProtocol_iface;
328 
329  return S_OK;
330 }
static const IInternetPriorityVtbl GopherPriorityVtbl
Definition: gopher.c:304
static const IInternetProtocolVtbl GopherProtocolVtbl
Definition: gopher.c:245
#define TRACE(s)
Definition: solgame.cpp:4
int ret
static const ProtocolVtbl AsyncProtocolVtbl
Definition: gopher.c:79
#define S_OK
Definition: intsafe.h:59
static void URLMON_LockModule(void)
Definition: urlmon_main.h:68

◆ heap_strdupAtoW()

static LPWSTR heap_strdupAtoW ( const char str)
inlinestatic

Definition at line 276 of file urlmon_main.h.

277 {
278  LPWSTR ret = NULL;
279 
280  if(str) {
281  DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
282  ret = heap_alloc(len*sizeof(WCHAR));
283  if(ret)
284  MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
285  }
286 
287  return ret;
288 }
#define CP_ACP
Definition: compat.h:99
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ heap_strdupW()

static LPWSTR heap_strdupW ( LPCWSTR  str)
inlinestatic

Definition at line 245 of file urlmon_main.h.

246 {
247  LPWSTR ret = NULL;
248 
249  if(str) {
250  DWORD size;
251 
252  size = (lstrlenW(str)+1)*sizeof(WCHAR);
253  ret = heap_alloc(size);
254  if(ret)
255  memcpy(ret, str, size);
256  }
257 
258  return ret;
259 }
#define lstrlenW
Definition: compat.h:415
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static void size_t size
Definition: urlmon_main.h:241
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ heap_strdupWtoA()

static char* heap_strdupWtoA ( const WCHAR str)
inlinestatic

Definition at line 290 of file urlmon_main.h.

291 {
292  char *ret = NULL;
293 
294  if(str) {
295  size_t size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
296  ret = heap_alloc(size);
297  if(ret)
299  }
300 
301  return ret;
302 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
int ret

◆ heap_strndupW()

static LPWSTR heap_strndupW ( LPCWSTR  str,
int  len 
)
inlinestatic

Definition at line 261 of file urlmon_main.h.

262 {
263  LPWSTR ret = NULL;
264 
265  if(str) {
266  ret = heap_alloc((len+1)*sizeof(WCHAR));
267  if(ret) {
268  memcpy(ret, str, len*sizeof(WCHAR));
269  ret[len] = 0;
270  }
271  }
272 
273  return ret;
274 }
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ HttpProtocol_Construct()

HRESULT HttpProtocol_Construct ( IUnknown pUnkOuter,
LPVOID ppobj 
)

◆ HttpSProtocol_Construct()

HRESULT HttpSProtocol_Construct ( IUnknown pUnkOuter,
LPVOID ppobj 
)

◆ is_registered_protocol()

BOOL is_registered_protocol ( LPCWSTR  )

Definition at line 168 of file session.c.

169 {
170  DWORD schema_len;
171  WCHAR schema[64];
172  HRESULT hres;
173 
174  hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, ARRAY_SIZE(schema), &schema_len, 0);
175  if(FAILED(hres))
176  return FALSE;
177 
178  return get_protocol_cf(schema, schema_len, NULL, NULL) == S_OK;
179 }
HRESULT WINAPI CoInternetParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwFlags, LPWSTR pszResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: internet.c:392
smooth NULL
Definition: ftsmooth.c:416
static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid, IClassFactory **ret)
Definition: session.c:74
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR url[]
Definition: encode.c:1432
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
const WCHAR * schema

Referenced by MkParseDisplayNameEx().

◆ MimeFilter_Construct()

HRESULT MimeFilter_Construct ( IUnknown pUnkOuter,
LPVOID ppobj 
)

Definition at line 246 of file mimefilter.c.

247 {
248  MimeFilter *ret;
249 
250  TRACE("(%p %p)\n", pUnkOuter, ppobj);
251 
253 
254  ret = heap_alloc_zero(sizeof(MimeFilter));
255 
256  ret->IInternetProtocol_iface.lpVtbl = &MimeFilterProtocolVtbl;
257  ret->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl;
258  ret->ref = 1;
259 
260  *ppobj = &ret->IInternetProtocol_iface;
261  return S_OK;
262 }
static const IInternetProtocolVtbl MimeFilterProtocolVtbl
Definition: mimefilter.c:164
static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl
Definition: mimefilter.c:236
#define TRACE(s)
Definition: solgame.cpp:4
int ret
#define S_OK
Definition: intsafe.h:59
static void URLMON_LockModule(void)
Definition: urlmon_main.h:68

◆ MkProtocol_Construct()

HRESULT MkProtocol_Construct ( IUnknown pUnkOuter,
LPVOID ppobj 
)

◆ protocol_abort()

HRESULT protocol_abort ( Protocol ,
HRESULT   
)

Definition at line 518 of file protocol.c.

519 {
520  if(!protocol->protocol_sink)
521  return S_OK;
522 
523  /* NOTE: IE10 returns S_OK here */
524  if(protocol->flags & FLAG_RESULT_REPORTED)
525  return INET_E_RESULT_DISPATCHED;
526 
528  return S_OK;
529 }
static HRESULT report_result(Protocol *protocol, HRESULT hres)
Definition: protocol.c:31
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
#define FLAG_RESULT_REPORTED
Definition: urlmon_main.h:157
#define S_OK
Definition: intsafe.h:59

Referenced by FtpProtocol_Abort(), GopherProtocol_Abort(), HttpProtocol_Abort(), and HttpProtocol_on_error().

◆ protocol_close_connection()

void protocol_close_connection ( Protocol )

Definition at line 531 of file protocol.c.

532 {
533  protocol->vtbl->close_connection(protocol);
534 
535  if(protocol->request)
536  InternetCloseHandle(protocol->request);
537 
538  if(protocol->connection)
539  InternetCloseHandle(protocol->connection);
540 
541  if(protocol->post_stream) {
542  IStream_Release(protocol->post_stream);
543  protocol->post_stream = NULL;
544  }
545 
546  protocol->flags = 0;
547 }
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1436
smooth NULL
Definition: ftsmooth.c:416

Referenced by FtpProtocol_Terminate(), FtpProtocolUnk_Release(), GopherProtocol_Terminate(), HttpProtocol_on_error(), HttpProtocol_Terminate(), HttpProtocolUnk_Release(), protocol_start(), and start_downloading().

◆ protocol_continue()

HRESULT protocol_continue ( Protocol ,
PROTOCOLDATA *   
)

Definition at line 355 of file protocol.c.

356 {
357  BOOL is_start;
358  HRESULT hres;
359 
360  is_start = !data || data->pData == UlongToPtr(BINDSTATUS_DOWNLOADINGDATA);
361 
362  if(!protocol->request) {
363  WARN("Expected request to be non-NULL\n");
364  return S_OK;
365  }
366 
367  if(!protocol->protocol_sink) {
368  WARN("Expected IInternetProtocolSink pointer to be non-NULL\n");
369  return S_OK;
370  }
371 
372  if(protocol->flags & FLAG_ERROR) {
373  protocol->flags &= ~FLAG_ERROR;
374  protocol->vtbl->on_error(protocol, PtrToUlong(data->pData));
375  return S_OK;
376  }
377 
378  if(protocol->post_stream)
379  return write_post_stream(protocol);
380 
381  if(is_start) {
383  if(FAILED(hres))
384  return S_OK;
385  }
386 
387  if(!data || data->pData >= UlongToPtr(BINDSTATUS_DOWNLOADINGDATA)) {
388  if(!protocol->available_bytes) {
389  if(protocol->query_available) {
390  protocol->available_bytes = protocol->query_available;
391  }else {
392  BOOL res;
393 
394  /* InternetQueryDataAvailable may immediately fork and perform its asynchronous
395  * read, so clear the flag _before_ calling so it does not incorrectly get cleared
396  * after the status callback is called */
397  protocol->flags &= ~FLAG_REQUEST_COMPLETE;
398  res = InternetQueryDataAvailable(protocol->request, &protocol->query_available, 0, 0);
399  if(res) {
400  TRACE("available %u bytes\n", protocol->query_available);
401  if(!protocol->query_available) {
403  return S_OK;
404  }
405  protocol->available_bytes = protocol->query_available;
406  }else if(GetLastError() != ERROR_IO_PENDING) {
408  WARN("InternetQueryDataAvailable failed: %d\n", GetLastError());
409  report_result(protocol, INET_E_DATA_NOT_AVAILABLE);
410  return S_OK;
411  }
412  }
413 
415  }
416 
418  }
419 
420  return S_OK;
421 }
static void report_data(Protocol *protocol)
Definition: protocol.c:41
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ERROR_IO_PENDING
Definition: dderror.h:15
static HRESULT write_post_stream(Protocol *protocol)
Definition: protocol.c:228
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI InternetQueryDataAvailable(HINTERNET hFile, LPDWORD lpdwNumberOfBytesAvailable, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3842
#define UlongToPtr(u)
Definition: config.h:106
#define PtrToUlong(u)
Definition: config.h:107
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static HRESULT report_result(Protocol *protocol, HRESULT hres)
Definition: protocol.c:31
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define S_OK
Definition: intsafe.h:59
static HRESULT start_downloading(Protocol *protocol)
Definition: protocol.c:73
GLuint res
Definition: glext.h:9613
#define FLAG_ERROR
Definition: urlmon_main.h:158
#define FLAG_REQUEST_COMPLETE
Definition: urlmon_main.h:152
static void all_data_read(Protocol *protocol)
Definition: protocol.c:65

Referenced by FtpProtocol_Continue(), GopherProtocol_Continue(), HttpProtocol_Continue(), and request_complete().

◆ protocol_lock_request()

HRESULT protocol_lock_request ( Protocol )

Definition at line 498 of file protocol.c.

499 {
500  if (!InternetLockRequestFile(protocol->request, &protocol->lock))
501  WARN("InternetLockRequest failed: %d\n", GetLastError());
502 
503  return S_OK;
504 }
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI InternetLockRequestFile(HINTERNET hInternet, HANDLE *lphLockReqHandle)
Definition: internet.c:3915
#define S_OK
Definition: intsafe.h:59

Referenced by FtpProtocol_LockRequest(), GopherProtocol_LockRequest(), and HttpProtocol_LockRequest().

◆ protocol_read()

HRESULT protocol_read ( Protocol ,
void ,
ULONG  ,
ULONG  
)

Definition at line 423 of file protocol.c.

424 {
425  ULONG read = 0;
426  BOOL res;
427  HRESULT hres = S_FALSE;
428 
429  if(protocol->flags & FLAG_ALL_DATA_READ) {
430  *read_ret = 0;
431  return S_FALSE;
432  }
433 
434  if(!(protocol->flags & FLAG_SYNC_READ) && (!(protocol->flags & FLAG_REQUEST_COMPLETE) || !protocol->available_bytes)) {
435  *read_ret = 0;
436  return E_PENDING;
437  }
438 
439  while(read < size && protocol->available_bytes) {
440  ULONG len;
441 
442  res = InternetReadFile(protocol->request, ((BYTE *)buf)+read,
443  protocol->available_bytes > size-read ? size-read : protocol->available_bytes, &len);
444  if(!res) {
445  WARN("InternetReadFile failed: %d\n", GetLastError());
446  hres = INET_E_DOWNLOAD_FAILURE;
448  break;
449  }
450 
451  if(!len) {
453  break;
454  }
455 
456  read += len;
457  protocol->current_position += len;
458  protocol->available_bytes -= len;
459 
460  TRACE("current_position %d, available_bytes %d\n", protocol->current_position, protocol->available_bytes);
461 
462  if(!protocol->available_bytes) {
463  /* InternetQueryDataAvailable may immediately fork and perform its asynchronous
464  * read, so clear the flag _before_ calling so it does not incorrectly get cleared
465  * after the status callback is called */
466  protocol->flags &= ~FLAG_REQUEST_COMPLETE;
467  res = InternetQueryDataAvailable(protocol->request, &protocol->query_available, 0, 0);
468  if(!res) {
469  if (GetLastError() == ERROR_IO_PENDING) {
470  hres = E_PENDING;
471  }else {
472  WARN("InternetQueryDataAvailable failed: %d\n", GetLastError());
473  hres = INET_E_DATA_NOT_AVAILABLE;
475  }
476  break;
477  }
478 
479  if(!protocol->query_available) {
481  break;
482  }
483 
484  protocol->available_bytes = protocol->query_available;
485  }
486  }
487 
488  *read_ret = read;
489 
490  if (hres != E_PENDING)
492  if(FAILED(hres))
493  return hres;
494 
495  return read ? S_OK : S_FALSE;
496 }
#define FLAG_ALL_DATA_READ
Definition: urlmon_main.h:155
#define FLAG_SYNC_READ
Definition: urlmon_main.h:159
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ERROR_IO_PENDING
Definition: dderror.h:15
unsigned int BOOL
Definition: ntddk_ex.h:94
#define S_FALSE
Definition: winerror.h:2357
BOOL WINAPI InternetQueryDataAvailable(HINTERNET hFile, LPDWORD lpdwNumberOfBytesAvailable, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3842
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static HRESULT report_result(Protocol *protocol, HRESULT hres)
Definition: protocol.c:31
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
Definition: internet.c:2174
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
#define E_PENDING
Definition: dinput.h:172
#define FLAG_REQUEST_COMPLETE
Definition: urlmon_main.h:152
static void all_data_read(Protocol *protocol)
Definition: protocol.c:65
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)

◆ protocol_start()

HRESULT protocol_start ( Protocol ,
IInternetProtocol ,
IUri ,
IInternetProtocolSink ,
IInternetBindInfo  
)

Definition at line 313 of file protocol.c.

315 {
316  DWORD request_flags;
317  HRESULT hres;
318 
319  protocol->protocol = prot;
320 
321  IInternetProtocolSink_AddRef(protocol_sink);
322  protocol->protocol_sink = protocol_sink;
323 
324  memset(&protocol->bind_info, 0, sizeof(protocol->bind_info));
325  protocol->bind_info.cbSize = sizeof(BINDINFO);
326  hres = IInternetBindInfo_GetBindInfo(bind_info, &protocol->bindf, &protocol->bind_info);
327  if(hres != S_OK) {
328  WARN("GetBindInfo failed: %08x\n", hres);
329  return report_result(protocol, hres);
330  }
331 
332  if(!(protocol->bindf & BINDF_FROMURLMON))
333  report_progress(protocol, BINDSTATUS_DIRECTBIND, NULL);
334 
336  return report_result(protocol, INET_E_NO_SESSION);
337 
338  request_flags = INTERNET_FLAG_KEEP_CONNECTION;
339  if(protocol->bindf & BINDF_NOWRITECACHE)
340  request_flags |= INTERNET_FLAG_NO_CACHE_WRITE;
341  if(protocol->bindf & BINDF_NEEDFILE)
342  request_flags |= INTERNET_FLAG_NEED_FILE;
343  if(protocol->bind_info.dwOptions & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS)
344  request_flags |= INTERNET_FLAG_NO_AUTO_REDIRECT;
345 
346  hres = protocol->vtbl->open_request(protocol, uri, request_flags, internet_session, bind_info);
347  if(FAILED(hres)) {
349  return report_result(protocol, hres);
350  }
351 
352  return S_OK;
353 }
#define INTERNET_FLAG_NO_CACHE_WRITE
Definition: wininet.h:66
#define INTERNET_FLAG_NEED_FILE
Definition: wininet.h:88
const char * uri
Definition: sec_mgr.c:1594
#define WARN(fmt,...)
Definition: debug.h:111
static HINTERNET internet_session
Definition: protocol.c:288
void protocol_close_connection(Protocol *protocol)
Definition: protocol.c:531
static IInternetProtocolSink protocol_sink
Definition: protocol.c:232
smooth NULL
Definition: ftsmooth.c:416
static IInternetBindInfo bind_info
Definition: protocol.c:284
HRESULT hres
Definition: protocol.c:465
#define INTERNET_FLAG_NO_AUTO_REDIRECT
Definition: wininet.h:73
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
static HRESULT report_result(Protocol *protocol, HRESULT hres)
Definition: protocol.c:31
HINTERNET get_internet_session(IInternetBindInfo *bind_info)
Definition: protocol.c:290
#define S_OK
Definition: intsafe.h:59
#define memset(x, y, z)
Definition: compat.h:39
static HRESULT report_progress(Protocol *protocol, ULONG status_code, LPCWSTR status_text)
Definition: protocol.c:26
#define INTERNET_FLAG_KEEP_CONNECTION
Definition: wininet.h:72

Referenced by do_test_about_protocol(), ProtocolEmul_Start(), ProtocolEmul_StartEx(), test_res_protocol(), and test_res_url().

◆ protocol_syncbinding()

HRESULT protocol_syncbinding ( Protocol )

Definition at line 101 of file protocol.c.

102 {
103  BOOL res;
104  HRESULT hres;
105 
106  protocol->flags |= FLAG_SYNC_READ;
107 
109  if(FAILED(hres))
110  return hres;
111 
112  res = InternetQueryDataAvailable(protocol->request, &protocol->query_available, 0, 0);
113  if(res)
114  protocol->available_bytes = protocol->query_available;
115  else
116  WARN("InternetQueryDataAvailable failed: %u\n", GetLastError());
117 
119  IInternetProtocolSink_ReportData(protocol->protocol_sink, BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE,
120  protocol->available_bytes, protocol->content_length);
121  return S_OK;
122 }
#define FLAG_SYNC_READ
Definition: urlmon_main.h:159
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI InternetQueryDataAvailable(HINTERNET hFile, LPDWORD lpdwNumberOfBytesAvailable, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3842
HRESULT hres
Definition: protocol.c:465
#define FLAG_FIRST_DATA_REPORTED
Definition: urlmon_main.h:154
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
static HRESULT start_downloading(Protocol *protocol)
Definition: protocol.c:73
GLuint res
Definition: glext.h:9613
#define FLAG_LAST_DATA_REPORTED
Definition: urlmon_main.h:156

Referenced by HttpProtocol_open_request().

◆ protocol_unlock_request()

HRESULT protocol_unlock_request ( Protocol )

Definition at line 506 of file protocol.c.

507 {
508  if(!protocol->lock)
509  return S_OK;
510 
512  WARN("InternetUnlockRequest failed: %d\n", GetLastError());
513  protocol->lock = 0;
514 
515  return S_OK;
516 }
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI InternetUnlockRequestFile(HANDLE hLockHandle)
Definition: internet.c:3944
#define S_OK
Definition: intsafe.h:59

Referenced by FtpProtocol_UnlockRequest(), GopherProtocol_UnlockRequest(), and HttpProtocol_UnlockRequest().

◆ register_namespace()

HRESULT register_namespace ( IClassFactory ,
REFIID  ,
LPCWSTR  ,
BOOL   
)

Definition at line 122 of file session.c.

123 {
124  name_space *new_name_space;
125 
126  new_name_space = heap_alloc(sizeof(name_space));
127 
128  if(!urlmon_protocol)
129  IClassFactory_AddRef(cf);
130  new_name_space->cf = cf;
131  new_name_space->clsid = *clsid;
132  new_name_space->urlmon = urlmon_protocol;
133  new_name_space->protocol = heap_strdupW(protocol);
134 
136 
137  list_add_head(&name_space_list, &new_name_space->entry);
138 
140 
141  return S_OK;
142 }
static IClassFactory * cf
IClassFactory * cf
Definition: session.c:28
CLSID clsid
Definition: session.c:29
struct list entry
Definition: session.c:32
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
BOOL urlmon
Definition: session.c:30
LPWSTR protocol
Definition: session.c:27
static CRITICAL_SECTION session_cs
Definition: session.c:46
REFCLSID clsid
Definition: msctf.c:82
static struct list name_space_list
Definition: session.c:43
#define S_OK
Definition: intsafe.h:59
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by init_session(), and InternetSession_RegisterNameSpace().

◆ release_notif_hwnd()

void release_notif_hwnd ( HWND  )

Definition at line 141 of file bindprot.c.

142 {
144 
145  if(!data)
146  return;
147 
148  if(data->notif_hwnd != hwnd) {
149  PostMessageW(data->notif_hwnd, WM_MK_RELEASE, 0, 0);
150  return;
151  }
152 
153  if(!--data->notif_hwnd_cnt) {
154  DestroyWindow(data->notif_hwnd);
155  data->notif_hwnd = NULL;
156  }
157 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WM_MK_RELEASE
Definition: bindprot.c:35
smooth NULL
Definition: ftsmooth.c:416
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
tls_data_t * get_tls_data(void)
Definition: urlmon_main.c:62

Referenced by Binding_Release(), and BindProtocol_Release().

◆ SecManagerImpl_Construct()

HRESULT SecManagerImpl_Construct ( IUnknown pUnkOuter,
LPVOID ppobj 
)

Definition at line 1241 of file sec_mgr.c.

1242 {
1244 
1245  TRACE("(%p,%p)\n",pUnkOuter,ppobj);
1246  This = heap_alloc(sizeof(*This));
1247 
1248  /* Initialize the virtual function table. */
1249  This->IInternetSecurityManagerEx2_iface.lpVtbl = &VT_SecManagerImpl;
1250 
1251  This->ref = 1;
1252  This->mgrsite = NULL;
1253  This->custom_manager = NULL;
1254 
1255  *ppobj = This;
1256 
1258 
1259  return S_OK;
1260 }
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
static const IInternetSecurityManagerEx2Vtbl VT_SecManagerImpl
Definition: sec_mgr.c:1221
static void URLMON_LockModule(void)
Definition: urlmon_main.h:68

Referenced by CoInternetCreateSecurityManager().

◆ set_binding_sink()

void set_binding_sink ( BindProtocol ,
IInternetProtocolSink ,
IInternetBindInfo  
)

Definition at line 564 of file bindprot.c.

565 {
566  IInternetProtocolSink *prev_sink;
568 
569  if(sink)
570  IInternetProtocolSink_AddRef(sink);
571  prev_sink = InterlockedExchangePointer((void**)&This->protocol_sink, sink);
572  if(prev_sink)
573  IInternetProtocolSink_Release(prev_sink);
574 
575  if(sink)
576  IInternetProtocolSink_QueryInterface(sink, &IID_IServiceProvider, (void**)&service_provider);
577  service_provider = InterlockedExchangePointer((void**)&This->service_provider, service_provider);
578  if(service_provider)
579  IServiceProvider_Release(service_provider);
580 
581  if(bind_info)
582  IInternetBindInfo_AddRef(bind_info);
583  bind_info = InterlockedExchangePointer((void**)&This->bind_info, bind_info);
584  if(bind_info)
585  IInternetBindInfo_Release(bind_info);
586 }
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
smooth NULL
Definition: ftsmooth.c:416
static IServiceProvider service_provider
Definition: mimeole.c:1313
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
static IInternetBindInfo bind_info
Definition: mimeole.c:1273

Referenced by BindProtocol_Release(), BindProtocol_StartEx(), ProtocolHandler_Terminate(), and start_binding().

◆ StdURLMoniker_Construct()

HRESULT StdURLMoniker_Construct ( IUnknown pUnkOuter,
LPVOID ppobj 
)

◆ unregister_notif_wnd_class()

void unregister_notif_wnd_class ( void  )

Definition at line 105 of file bindprot.c.

106 {
107  if(notif_wnd_class)
109 }
static ATOM notif_wnd_class
Definition: bindprot.c:90
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by process_detach().

◆ update_user_agent()

void update_user_agent ( WCHAR )

Definition at line 307 of file protocol.c.

308 {
309  if(internet_session)
311 }
BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
Definition: internet.c:2714
static HINTERNET internet_session
Definition: protocol.c:288
#define lstrlenW
Definition: compat.h:415
static LPWSTR user_agent
Definition: session.c:520
#define INTERNET_OPTION_USER_AGENT
Definition: wininet.h:735

Referenced by UrlMkSetSessionOption().

◆ Uri_Construct()

HRESULT Uri_Construct ( IUnknown pUnkOuter,
LPVOID ppobj 
)

Definition at line 5656 of file uri.c.

5657 {
5658  Uri *ret = heap_alloc_zero(sizeof(Uri));
5659 
5660  TRACE("(%p %p)\n", pUnkOuter, ppobj);
5661 
5662  *ppobj = ret;
5663  if(!ret)
5664  return E_OUTOFMEMORY;
5665 
5666  ret->IUri_iface.lpVtbl = &UriVtbl;
5667  ret->IUriBuilderFactory_iface.lpVtbl = &UriBuilderFactoryVtbl;
5668  ret->IPersistStream_iface.lpVtbl = &PersistStreamVtbl;
5669  ret->IMarshal_iface.lpVtbl = &MarshalVtbl;
5670  ret->ref = 1;
5671 
5672  *ppobj = &ret->IUri_iface;
5673  return S_OK;
5674 }
static const IMarshalVtbl MarshalVtbl
Definition: uri.c:5644
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
static const IUriBuilderFactoryVtbl UriBuilderFactoryVtbl
Definition: uri.c:5119
int ret
#define S_OK
Definition: intsafe.h:59
Definition: uri.c:50
static const IPersistStreamVtbl PersistStreamVtbl
Definition: uri.c:5409
static const IUriVtbl UriVtbl
Definition: uri.c:5027

Referenced by build_uri(), combine_uri(), and CreateUri().

◆ URLMON_DllGetClassObject()

HRESULT WINAPI URLMON_DllGetClassObject ( REFCLSID  rclsid,
REFIID  iid,
LPVOID ppv 
)

Referenced by DllGetClassObject().

◆ URLMON_DllMain()

BOOL WINAPI URLMON_DllMain ( HINSTANCE  hinstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Referenced by DllMain().

◆ URLMON_DllRegisterServer()

HRESULT WINAPI URLMON_DllRegisterServer ( void  )

Referenced by DllRegisterServer().

◆ URLMON_DllUnregisterServer()

HRESULT WINAPI URLMON_DllUnregisterServer ( void  )

Referenced by DllUnregisterServer().

◆ URLMON_LockModule()

◆ URLMON_UnlockModule()

◆ wrap_callback()

HRESULT wrap_callback ( IBindStatusCallback ,
IBindStatusCallback **   
)

Definition at line 578 of file bindctx.c.

579 {
581 
582  ret = heap_alloc_zero(sizeof(BindStatusCallback));
583  if(!ret)
584  return E_OUTOFMEMORY;
585 
586  ret->IBindStatusCallbackEx_iface.lpVtbl = &BindStatusCallbackExVtbl;
587  ret->IInternetBindInfo_iface.lpVtbl = &BSCInternetBindInfoVtbl;
588  ret->IServiceProvider_iface.lpVtbl = &BSCServiceProviderVtbl;
589  ret->IHttpNegotiate2_iface.lpVtbl = &BSCHttpNegotiateVtbl;
590  ret->IAuthenticate_iface.lpVtbl = &BSCAuthenticateVtbl;
591 
592  ret->ref = 1;
593  set_callback(ret, bsc);
594 
595  *ret_iface = (IBindStatusCallback*)&ret->IBindStatusCallbackEx_iface;
596  return S_OK;
597 }
static void set_callback(BindStatusCallback *This, IBindStatusCallback *bsc)
Definition: bindctx.c:561
static const IHttpNegotiate2Vtbl BSCHttpNegotiateVtbl
Definition: bindctx.c:457
static const IServiceProviderVtbl BSCServiceProviderVtbl
Definition: bindctx.c:358
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const IAuthenticateVtbl BSCAuthenticateVtbl
Definition: bindctx.c:497
static IBindStatusCallbackEx bsc
Definition: url.c:2150
static IInternetBindInfoVtbl BSCInternetBindInfoVtbl
Definition: bindctx.c:553
int ret
static const IBindStatusCallbackExVtbl BindStatusCallbackExVtbl
Definition: bindctx.c:283
#define S_OK
Definition: intsafe.h:59

Referenced by create_default_callback(), and RegisterBindStatusCallback().

◆ ZoneMgrImpl_Construct()

HRESULT ZoneMgrImpl_Construct ( IUnknown pUnkOuter,
LPVOID ppobj 
)

Definition at line 1823 of file sec_mgr.c.

1824 {
1825  ZoneMgrImpl* ret = heap_alloc_zero(sizeof(ZoneMgrImpl));
1826 
1827  TRACE("(%p %p)\n", pUnkOuter, ppobj);
1828  ret->IInternetZoneManagerEx2_iface.lpVtbl = &ZoneMgrImplVtbl;
1829  ret->ref = 1;
1830  *ppobj = &ret->IInternetZoneManagerEx2_iface;
1831 
1833 
1834  return S_OK;
1835 }
#define TRACE(s)
Definition: solgame.cpp:4
static const IInternetZoneManagerEx2Vtbl ZoneMgrImplVtbl
Definition: sec_mgr.c:1796
int ret
#define S_OK
Definition: intsafe.h:59
static void URLMON_LockModule(void)
Definition: urlmon_main.h:68

Referenced by CoInternetCreateZoneManager().

Variable Documentation

◆ DECLSPEC_HIDDEN

LONG URLMON_refCount DECLSPEC_HIDDEN

Definition at line 61 of file urlmon_main.h.

◆ size

Initial value:
{
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
#define HeapReAlloc
Definition: compat.h:401
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
Definition: mem.c:156

Definition at line 241 of file urlmon_main.h.

Referenced by heap_strdupW().

◆ urlmon_instance

HINSTANCE urlmon_instance

Definition at line 43 of file urlmon_main.c.

Referenced by DllMain(), failure_msgbox(), install_warning(), and update_counter().