ReactOS 0.4.15-dev-7961-gdcf9eb0
urlmon_main.h
Go to the documentation of this file.
1/*
2 * Copyright 2002 Huw D M Davies for CodeWeavers
3 * Copyright 2009 Jacek Caban for CodeWeavers
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#ifndef __WINE_URLMON_MAIN_H
21#define __WINE_URLMON_MAIN_H
22
23#include <stdarg.h>
24#ifdef __REACTOS__
25#include <wchar.h>
26#endif
27
28#define COBJMACROS
29
30#include "windef.h"
31#include "winbase.h"
32#include "winuser.h"
33#ifdef __REACTOS__
34#include "winnls.h"
35#endif
36#include "ole2.h"
37#include "urlmon.h"
38#include "wininet.h"
39
40#include "wine/heap.h"
41#include "wine/list.h"
42
43extern HINSTANCE hProxyDll DECLSPEC_HIDDEN;
54extern HRESULT Uri_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN;
55
60
61extern GUID const CLSID_PSFactoryBuffer DECLSPEC_HIDDEN;
62extern GUID const CLSID_CUri DECLSPEC_HIDDEN;
63
64/**********************************************************************
65 * Dll lifetime tracking declaration for urlmon.dll
66 */
70
72
82
84
87
91
92typedef HRESULT (*stop_cache_binding_proc_t)(void*,const WCHAR*,HRESULT,const WCHAR*);
94
96
97typedef struct {
99
102
104 BINDINFO bind_info;
105
110
115
117
119} Protocol;
120
127};
128
129/* Flags are needed for, among other things, return HRESULTs from the Read function
130 * to conform to native. For example, Read returns:
131 *
132 * 1. E_PENDING if called before the request has completed,
133 * (flags = 0)
134 * 2. S_FALSE after all data has been read and S_OK has been reported,
135 * (flags = FLAG_REQUEST_COMPLETE | FLAG_ALL_DATA_READ | FLAG_RESULT_REPORTED)
136 * 3. INET_E_DATA_NOT_AVAILABLE if InternetQueryDataAvailable fails. The first time
137 * this occurs, INET_E_DATA_NOT_AVAILABLE will also be reported to the sink,
138 * (flags = FLAG_REQUEST_COMPLETE)
139 * but upon subsequent calls to Read no reporting will take place, yet
140 * InternetQueryDataAvailable will still be called, and, on failure,
141 * INET_E_DATA_NOT_AVAILABLE will still be returned.
142 * (flags = FLAG_REQUEST_COMPLETE | FLAG_RESULT_REPORTED)
143 *
144 * FLAG_FIRST_DATA_REPORTED and FLAG_LAST_DATA_REPORTED are needed for proper
145 * ReportData reporting. For example, if OnResponse returns S_OK, Continue will
146 * report BSCF_FIRSTDATANOTIFICATION, and when all data has been read Read will
147 * report BSCF_INTERMEDIATEDATANOTIFICATION|BSCF_LASTDATANOTIFICATION. However,
148 * if OnResponse does not return S_OK, Continue will not report data, and Read
149 * will report BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION when all
150 * data has been read.
151 */
152#define FLAG_REQUEST_COMPLETE 0x0001
153#define FLAG_FIRST_CONTINUE_COMPLETE 0x0002
154#define FLAG_FIRST_DATA_REPORTED 0x0004
155#define FLAG_ALL_DATA_READ 0x0008
156#define FLAG_LAST_DATA_REPORTED 0x0010
157#define FLAG_RESULT_REPORTED 0x0020
158#define FLAG_ERROR 0x0040
159#define FLAG_SYNC_READ 0x0080
160
169
171
173
174typedef struct {
180
182
185
190
191 struct {
193 IInternetProtocolSink IInternetProtocolSink_iface;
194 } default_protocol_handler;
197
199
203
207
211
213 task_header_t *task_queue_head, *task_queue_tail;
214
221
224
225typedef struct {
228
229 struct list entry;
230} tls_data_t;
231
233
237
239
240static inline void* __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t size)
241{
243}
244
246{
247 LPWSTR ret = NULL;
248
249 if(str) {
250 DWORD size;
251
252 size = (lstrlenW(str)+1)*sizeof(WCHAR);
254 if(ret)
255 memcpy(ret, str, size);
256 }
257
258 return ret;
259}
260
261static inline LPWSTR heap_strndupW(LPCWSTR str, int len)
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}
275
276static inline LPWSTR heap_strdupAtoW(const char *str)
277{
278 LPWSTR ret = NULL;
279
280 if(str) {
282 ret = heap_alloc(len*sizeof(WCHAR));
283 if(ret)
285 }
286
287 return ret;
288}
289
290static inline char *heap_strdupWtoA(const WCHAR *str)
291{
292 char *ret = NULL;
293
294 if(str) {
295 size_t size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
297 if(ret)
299 }
300
301 return ret;
302}
303
304#endif /* __WINE_URLMON_MAIN_H */
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
Definition: list.h:37
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapReAlloc
Definition: compat.h:734
OLECHAR * BSTR
Definition: compat.h:2293
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define lstrlenW
Definition: compat.h:750
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
GLenum GLsizei len
Definition: glext.h:6722
REFIID LPVOID * ppv
Definition: atlbase.h:39
uint32_t entry
Definition: isohybrid.c:63
static IN DWORD IN LPVOID lpvReserved
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define protocol_start(p, u, e)
Definition: protocol.c:303
static int protocol_read
Definition: htmldoc.c:205
static BOOL bind_to_object
Definition: url.c:173
#define DWORD
Definition: nt_native.h:44
long LONG
Definition: pedump.c:60
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
const WCHAR * str
IInternetProtocolEx IInternetProtocolEx_iface
Definition: urlmon_main.h:175
DWORD buf_size
Definition: urlmon_main.h:216
IInternetProtocol IInternetProtocol_iface
Definition: urlmon_main.h:192
IBindCallbackRedirect * redirect_callback
Definition: urlmon_main.h:189
IServiceProvider * service_provider
Definition: urlmon_main.h:188
BSTR display_uri
Definition: urlmon_main.h:219
DWORD apartment_thread
Definition: urlmon_main.h:208
ULONG progress_max
Definition: urlmon_main.h:206
IInternetProtocol * protocol_handler
Definition: urlmon_main.h:195
IInternetProtocolSink * protocol_sink_handler
Definition: urlmon_main.h:196
BOOL reported_result
Definition: urlmon_main.h:200
IUnknown * protocol_unk
Definition: urlmon_main.h:183
IInternetProtocolSink * protocol_sink
Definition: urlmon_main.h:187
ULONG progress
Definition: urlmon_main.h:205
IInternetProtocol * protocol
Definition: urlmon_main.h:184
IInternetBindInfo * bind_info
Definition: urlmon_main.h:186
IInternetBindInfo IInternetBindInfo_iface
Definition: urlmon_main.h:176
BOOL reported_mime
Definition: urlmon_main.h:201
DWORD continue_call
Definition: urlmon_main.h:210
IInternetPriority IInternetPriority_iface
Definition: urlmon_main.h:177
CRITICAL_SECTION section
Definition: urlmon_main.h:212
IInternetProtocolSink IInternetProtocolSink_iface
Definition: urlmon_main.h:179
IServiceProvider IServiceProvider_iface
Definition: urlmon_main.h:178
task_header_t * task_queue_head
Definition: urlmon_main.h:213
HRESULT(* start_downloading)(Protocol *)
Definition: urlmon_main.h:124
void(* on_error)(Protocol *, DWORD)
Definition: urlmon_main.h:126
void(* close_connection)(Protocol *)
Definition: urlmon_main.h:125
HRESULT(* end_request)(Protocol *)
Definition: urlmon_main.h:123
DWORD bindf
Definition: urlmon_main.h:103
DWORD flags
Definition: urlmon_main.h:108
HINTERNET request
Definition: urlmon_main.h:106
IStream * post_stream
Definition: urlmon_main.h:116
ULONG content_length
Definition: urlmon_main.h:112
HINTERNET connection
Definition: urlmon_main.h:107
const ProtocolVtbl * vtbl
Definition: urlmon_main.h:98
BINDINFO bind_info
Definition: urlmon_main.h:104
ULONG query_available
Definition: urlmon_main.h:114
ULONG available_bytes
Definition: urlmon_main.h:113
IInternetProtocol * protocol
Definition: urlmon_main.h:100
IInternetProtocolSink * protocol_sink
Definition: urlmon_main.h:101
LONG priority
Definition: urlmon_main.h:118
ULONG current_position
Definition: urlmon_main.h:111
HANDLE lock
Definition: urlmon_main.h:109
Definition: mem.c:156
HWND notif_hwnd
Definition: urlmon_main.h:226
DWORD notif_hwnd_cnt
Definition: urlmon_main.h:227
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
LONG URLMON_refCount
Definition: urlmon_main.c:42
HRESULT GopherProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
Definition: gopher.c:312
HRESULT protocol_lock_request(Protocol *) DECLSPEC_HIDDEN
Definition: protocol.c:498
void free_session(void) DECLSPEC_HIDDEN
Definition: session.c:755
static void URLMON_LockModule(void)
Definition: urlmon_main.h:68
HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
Definition: sec_mgr.c:1241
HRESULT create_binding_protocol(BindProtocol **) DECLSPEC_HIDDEN
Definition: bindprot.c:1442
HRESULT find_mime_from_ext(const WCHAR *, WCHAR **) DECLSPEC_HIDDEN
Definition: mimefilter.c:425
HRESULT ZoneMgrImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
Definition: sec_mgr.c:1823
tls_data_t * get_tls_data(void) DECLSPEC_HIDDEN
Definition: urlmon_main.c:62
void update_user_agent(WCHAR *) DECLSPEC_HIDDEN
Definition: protocol.c:307
void find_domain_name(const WCHAR *, DWORD, INT *) DECLSPEC_HIDDEN
Definition: uri.c:520
HINSTANCE hProxyDll DECLSPEC_HIDDEN
Definition: urlmon_main.h:61
HINTERNET get_internet_session(IInternetBindInfo *) DECLSPEC_HIDDEN
Definition: protocol.c:290
const char * debugstr_bindstatus(ULONG) DECLSPEC_HIDDEN
Definition: urlmon_main.c:175
HRESULT HttpSProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
HRESULT register_namespace(IClassFactory *, REFIID, LPCWSTR, BOOL) DECLSPEC_HIDDEN
Definition: session.c:122
static LPWSTR heap_strdupAtoW(const char *str)
Definition: urlmon_main.h:276
static char * heap_strdupWtoA(const WCHAR *str)
Definition: urlmon_main.h:290
HRESULT WINAPI URLMON_DllUnregisterServer(void) DECLSPEC_HIDDEN
HRESULT HttpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
static void URLMON_UnlockModule(void)
Definition: urlmon_main.h:69
void release_notif_hwnd(HWND) DECLSPEC_HIDDEN
Definition: bindprot.c:141
static LPWSTR heap_strdupW(LPCWSTR str)
Definition: urlmon_main.h:245
HRESULT Uri_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
Definition: uri.c:5656
HRESULT protocol_unlock_request(Protocol *) DECLSPEC_HIDDEN
Definition: protocol.c:506
HRESULT(* stop_cache_binding_proc_t)(void *, const WCHAR *, HRESULT, const WCHAR *)
Definition: urlmon_main.h:92
void protocol_close_connection(Protocol *) DECLSPEC_HIDDEN
Definition: protocol.c:531
static LPWSTR heap_strndupW(LPCWSTR str, int len)
Definition: urlmon_main.h:261
HRESULT FtpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
HRESULT create_default_callback(IBindStatusCallback **) DECLSPEC_HIDDEN
Definition: download.c:361
HRESULT protocol_continue(Protocol *, PROTOCOLDATA *) DECLSPEC_HIDDEN
Definition: protocol.c:355
HRESULT WINAPI URLMON_DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) DECLSPEC_HIDDEN
HRESULT StdURLMoniker_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
HRESULT protocol_abort(Protocol *, HRESULT) DECLSPEC_HIDDEN
Definition: protocol.c:518
HWND get_notif_hwnd(void) DECLSPEC_HIDDEN
Definition: bindprot.c:111
BOOL WINAPI URLMON_DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) DECLSPEC_HIDDEN
HRESULT bind_to_storage(IUri *, IBindCtx *, REFIID, void **) DECLSPEC_HIDDEN
Definition: binding.c:1617
HRESULT protocol_syncbinding(Protocol *) DECLSPEC_HIDDEN
Definition: protocol.c:101
HRESULT WINAPI URLMON_DllRegisterServer(void) DECLSPEC_HIDDEN
IBindStatusCallback * bsc_from_bctx(IBindCtx *) DECLSPEC_HIDDEN
Definition: bindctx.c:70
HRESULT get_protocol_handler(IUri *, CLSID *, IClassFactory **) DECLSPEC_HIDDEN
Definition: session.c:220
HINSTANCE urlmon_instance
Definition: urlmon_main.c:43
HRESULT MimeFilter_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
Definition: mimefilter.c:246
HRESULT MkProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
IInternetProtocol * get_mime_filter(LPCWSTR) DECLSPEC_HIDDEN
Definition: session.c:250
HRESULT FileProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN
Definition: file.c:421
BOOL is_registered_protocol(LPCWSTR) DECLSPEC_HIDDEN
Definition: session.c:168
static void size_t size
Definition: urlmon_main.h:241
HRESULT download_to_cache(IUri *, stop_cache_binding_proc_t, void *, IBindStatusCallback *) DECLSPEC_HIDDEN
Definition: download.c:375
WCHAR * get_useragent(void) DECLSPEC_HIDDEN
Definition: session.c:609
void unregister_notif_wnd_class(void) DECLSPEC_HIDDEN
Definition: bindprot.c:105
IInternetProtocolInfo * get_protocol_info(LPCWSTR) DECLSPEC_HIDDEN
Definition: session.c:181
void set_binding_sink(BindProtocol *, IInternetProtocolSink *, IInternetBindInfo *) DECLSPEC_HIDDEN
Definition: bindprot.c:564
HRESULT wrap_callback(IBindStatusCallback *, IBindStatusCallback **) DECLSPEC_HIDDEN
Definition: bindctx.c:578
int ret
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
LPVOID HINTERNET
Definition: winhttp.h:32
#define __WINE_ALLOC_SIZE(x)
Definition: winnt_old.h:84
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193