2002-08-13 18:20:24 +00:00
|
|
|
/*
|
2003-09-08 19:38:45 +00:00
|
|
|
* Copyright 2002 Huw D M Davies for CodeWeavers
|
2009-03-02 02:19:00 +00:00
|
|
|
* Copyright 2009 Jacek Caban for CodeWeavers
|
2002-08-13 18:20:24 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-08-13 18:20:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_URLMON_MAIN_H
|
|
|
|
#define __WINE_URLMON_MAIN_H
|
|
|
|
|
2003-09-05 23:08:26 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2007-12-13 19:26:51 +00:00
|
|
|
#define COBJMACROS
|
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
|
|
|
|
2002-08-13 18:20:24 +00:00
|
|
|
#include "windef.h"
|
2003-09-05 23:08:26 +00:00
|
|
|
#include "winbase.h"
|
2007-12-13 19:26:51 +00:00
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
#include "urlmon.h"
|
2009-03-02 02:19:00 +00:00
|
|
|
#include "wininet.h"
|
2002-08-13 18:20:24 +00:00
|
|
|
|
2007-12-13 19:25:59 +00:00
|
|
|
#include "wine/unicode.h"
|
2009-05-11 11:14:45 +00:00
|
|
|
#include "wine/list.h"
|
2007-12-13 19:25:59 +00:00
|
|
|
|
2010-04-08 17:24:04 +00:00
|
|
|
extern HINSTANCE hProxyDll DECLSPEC_HIDDEN;
|
2004-09-28 19:18:52 +00:00
|
|
|
extern HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2004-11-30 21:14:21 +00:00
|
|
|
extern HRESULT ZoneMgrImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2009-03-23 17:30:47 +00:00
|
|
|
extern HRESULT StdURLMoniker_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2005-09-06 09:27:04 +00:00
|
|
|
extern HRESULT FileProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2005-09-14 15:38:26 +00:00
|
|
|
extern HRESULT HttpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2007-11-04 16:09:20 +00:00
|
|
|
extern HRESULT HttpSProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2005-09-14 15:38:26 +00:00
|
|
|
extern HRESULT FtpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2009-03-04 18:06:42 +00:00
|
|
|
extern HRESULT GopherProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2007-01-12 11:31:54 +00:00
|
|
|
extern HRESULT MkProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2009-04-06 22:14:26 +00:00
|
|
|
extern HRESULT MimeFilter_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2002-08-13 18:20:24 +00:00
|
|
|
|
2010-04-08 17:24:04 +00:00
|
|
|
extern BOOL WINAPI URLMON_DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) DECLSPEC_HIDDEN;
|
2009-12-08 15:02:19 +00:00
|
|
|
extern HRESULT WINAPI URLMON_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI URLMON_DllRegisterServer(void) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT WINAPI URLMON_DllUnregisterServer(void) DECLSPEC_HIDDEN;
|
|
|
|
|
|
|
|
extern GUID const CLSID_PSFactoryBuffer DECLSPEC_HIDDEN;
|
|
|
|
|
2005-02-03 19:38:37 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* Dll lifetime tracking declaration for urlmon.dll
|
|
|
|
*/
|
|
|
|
extern LONG URLMON_refCount;
|
2005-06-21 20:53:13 +00:00
|
|
|
static inline void URLMON_LockModule(void) { InterlockedIncrement( &URLMON_refCount ); }
|
|
|
|
static inline void URLMON_UnlockModule(void) { InterlockedDecrement( &URLMON_refCount ); }
|
2005-02-03 19:38:37 +00:00
|
|
|
|
2009-03-02 02:19:00 +00:00
|
|
|
#define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
|
|
|
|
#define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
|
2004-08-13 00:44:22 +00:00
|
|
|
|
2009-03-29 19:31:15 +00:00
|
|
|
IInternetProtocolInfo *get_protocol_info(LPCWSTR);
|
|
|
|
HRESULT get_protocol_handler(LPCWSTR,CLSID*,BOOL*,IClassFactory**);
|
2009-05-18 16:35:32 +00:00
|
|
|
IInternetProtocol *get_mime_filter(LPCWSTR);
|
2008-01-28 23:18:33 +00:00
|
|
|
BOOL is_registered_protocol(LPCWSTR);
|
2008-02-21 12:07:41 +00:00
|
|
|
void register_urlmon_namespace(IClassFactory*,REFIID,LPCWSTR,BOOL);
|
2009-08-01 22:11:46 +00:00
|
|
|
HINTERNET get_internet_session(IInternetBindInfo*);
|
|
|
|
LPWSTR get_useragent(void);
|
2009-06-26 22:31:39 +00:00
|
|
|
void free_session(void);
|
2005-11-14 12:28:18 +00:00
|
|
|
|
2007-12-30 16:42:17 +00:00
|
|
|
HRESULT bind_to_storage(LPCWSTR url, IBindCtx *pbc, REFIID riid, void **ppv);
|
2007-12-30 16:45:00 +00:00
|
|
|
HRESULT bind_to_object(IMoniker *mon, LPCWSTR url, IBindCtx *pbc, REFIID riid, void **ppv);
|
2005-11-14 15:12:43 +00:00
|
|
|
|
2007-12-30 16:40:26 +00:00
|
|
|
HRESULT create_binding_protocol(LPCWSTR url, BOOL from_urlmon, IInternetProtocol **protocol);
|
2007-12-28 13:53:25 +00:00
|
|
|
void set_binding_sink(IInternetProtocol *bind_protocol, IInternetProtocolSink *sink);
|
2009-03-29 19:31:15 +00:00
|
|
|
IWinInetInfo *get_wininet_info(IInternetProtocol*);
|
2007-01-23 18:33:30 +00:00
|
|
|
|
2009-03-02 02:20:09 +00:00
|
|
|
typedef struct ProtocolVtbl ProtocolVtbl;
|
|
|
|
|
2009-03-02 02:19:00 +00:00
|
|
|
typedef struct {
|
2009-03-02 02:20:09 +00:00
|
|
|
const ProtocolVtbl *vtbl;
|
|
|
|
|
2009-03-02 02:19:00 +00:00
|
|
|
IInternetProtocol *protocol;
|
|
|
|
IInternetProtocolSink *protocol_sink;
|
|
|
|
|
|
|
|
DWORD bindf;
|
|
|
|
BINDINFO bind_info;
|
|
|
|
|
|
|
|
HINTERNET request;
|
2009-03-02 02:21:07 +00:00
|
|
|
HINTERNET connection;
|
2009-03-02 02:19:00 +00:00
|
|
|
DWORD flags;
|
|
|
|
HANDLE lock;
|
|
|
|
|
|
|
|
ULONG current_position;
|
|
|
|
ULONG content_length;
|
|
|
|
ULONG available_bytes;
|
|
|
|
|
|
|
|
LONG priority;
|
|
|
|
} Protocol;
|
|
|
|
|
2009-03-02 02:20:09 +00:00
|
|
|
struct ProtocolVtbl {
|
2010-09-20 18:00:52 +00:00
|
|
|
HRESULT (*open_request)(Protocol*,IUri*,DWORD,HINTERNET,IInternetBindInfo*);
|
2009-03-02 02:20:46 +00:00
|
|
|
HRESULT (*start_downloading)(Protocol*);
|
2009-03-02 02:20:09 +00:00
|
|
|
void (*close_connection)(Protocol*);
|
|
|
|
};
|
|
|
|
|
2010-09-20 18:00:52 +00:00
|
|
|
HRESULT protocol_start(Protocol*,IInternetProtocol*,IUri*,IInternetProtocolSink*,IInternetBindInfo*);
|
2009-03-02 02:20:46 +00:00
|
|
|
HRESULT protocol_continue(Protocol*,PROTOCOLDATA*);
|
2009-03-02 02:20:26 +00:00
|
|
|
HRESULT protocol_read(Protocol*,void*,ULONG,ULONG*);
|
2009-03-02 02:19:44 +00:00
|
|
|
HRESULT protocol_lock_request(Protocol*);
|
|
|
|
HRESULT protocol_unlock_request(Protocol*);
|
2009-03-02 02:20:09 +00:00
|
|
|
void protocol_close_connection(Protocol*);
|
2009-03-02 02:19:44 +00:00
|
|
|
|
2009-05-18 16:35:32 +00:00
|
|
|
typedef struct {
|
|
|
|
const IInternetProtocolVtbl *lpIInternetProtocolVtbl;
|
|
|
|
const IInternetProtocolSinkVtbl *lpIInternetProtocolSinkVtbl;
|
|
|
|
|
|
|
|
LONG ref;
|
|
|
|
|
|
|
|
IInternetProtocolSink *protocol_sink;
|
|
|
|
IInternetProtocol *protocol;
|
|
|
|
} ProtocolProxy;
|
|
|
|
|
2009-05-18 16:31:03 +00:00
|
|
|
#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpIInternetProtocolVtbl)
|
|
|
|
#define PROTSINK(x) ((IInternetProtocolSink*) &(x)->lpIInternetProtocolSinkVtbl)
|
|
|
|
|
2009-05-18 16:35:32 +00:00
|
|
|
HRESULT create_protocol_proxy(IInternetProtocol*,IInternetProtocolSink*,ProtocolProxy**);
|
|
|
|
|
2009-05-11 11:14:45 +00:00
|
|
|
typedef struct {
|
|
|
|
HWND notif_hwnd;
|
|
|
|
DWORD notif_hwnd_cnt;
|
|
|
|
|
|
|
|
struct list entry;
|
|
|
|
} tls_data_t;
|
|
|
|
|
|
|
|
tls_data_t *get_tls_data(void);
|
|
|
|
|
2009-05-11 19:59:31 +00:00
|
|
|
HWND get_notif_hwnd(void);
|
|
|
|
void release_notif_hwnd(HWND);
|
|
|
|
|
2007-11-29 21:12:34 +00:00
|
|
|
static inline void *heap_alloc(size_t len)
|
2007-11-25 18:07:54 +00:00
|
|
|
{
|
|
|
|
return HeapAlloc(GetProcessHeap(), 0, len);
|
|
|
|
}
|
|
|
|
|
2007-11-29 21:12:34 +00:00
|
|
|
static inline void *heap_alloc_zero(size_t len)
|
2007-11-25 18:07:54 +00:00
|
|
|
{
|
|
|
|
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
|
|
|
}
|
|
|
|
|
2007-11-29 21:12:34 +00:00
|
|
|
static inline void *heap_realloc(void *mem, size_t len)
|
2007-11-25 18:07:54 +00:00
|
|
|
{
|
|
|
|
return HeapReAlloc(GetProcessHeap(), 0, mem, len);
|
|
|
|
}
|
|
|
|
|
2009-07-02 20:04:43 +00:00
|
|
|
static inline void *heap_realloc_zero(void *mem, size_t len)
|
|
|
|
{
|
|
|
|
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
|
|
|
|
}
|
|
|
|
|
2007-11-29 21:12:34 +00:00
|
|
|
static inline BOOL heap_free(void *mem)
|
2007-11-25 18:07:54 +00:00
|
|
|
{
|
|
|
|
return HeapFree(GetProcessHeap(), 0, mem);
|
|
|
|
}
|
|
|
|
|
2007-12-13 19:25:59 +00:00
|
|
|
static inline LPWSTR heap_strdupW(LPCWSTR str)
|
|
|
|
{
|
|
|
|
LPWSTR ret = NULL;
|
|
|
|
|
|
|
|
if(str) {
|
|
|
|
DWORD size;
|
|
|
|
|
|
|
|
size = (strlenW(str)+1)*sizeof(WCHAR);
|
|
|
|
ret = heap_alloc(size);
|
|
|
|
memcpy(ret, str, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-03-02 02:19:18 +00:00
|
|
|
static inline LPWSTR heap_strndupW(LPCWSTR str, int len)
|
|
|
|
{
|
|
|
|
LPWSTR ret = NULL;
|
|
|
|
|
|
|
|
if(str) {
|
|
|
|
ret = heap_alloc((len+1)*sizeof(WCHAR));
|
|
|
|
if(ret) {
|
|
|
|
memcpy(ret, str, len*sizeof(WCHAR));
|
|
|
|
ret[len] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-02-18 00:03:54 +00:00
|
|
|
static inline LPWSTR heap_strdupAtoW(const char *str)
|
|
|
|
{
|
|
|
|
LPWSTR ret = NULL;
|
|
|
|
|
|
|
|
if(str) {
|
|
|
|
DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
|
|
|
|
ret = heap_alloc(len*sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2002-08-13 18:20:24 +00:00
|
|
|
#endif /* __WINE_URLMON_MAIN_H */
|