2002-08-13 20:20:24 +02:00
|
|
|
/*
|
2003-09-08 21:38:45 +02:00
|
|
|
* Copyright 2002 Huw D M Davies for CodeWeavers
|
2002-08-13 20:20:24 +02: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 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-08-13 20:20:24 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_URLMON_MAIN_H
|
|
|
|
#define __WINE_URLMON_MAIN_H
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2007-12-13 20:26:51 +01:00
|
|
|
#define COBJMACROS
|
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
|
|
|
|
2002-08-13 20:20:24 +02:00
|
|
|
#include "windef.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winbase.h"
|
2007-12-13 20:26:51 +01:00
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
#include "urlmon.h"
|
2002-08-13 20:20:24 +02:00
|
|
|
|
2007-12-13 20:25:59 +01:00
|
|
|
#include "wine/unicode.h"
|
|
|
|
|
2002-08-13 20:20:24 +02:00
|
|
|
extern HINSTANCE URLMON_hInstance;
|
2004-09-28 21:18:52 +02:00
|
|
|
extern HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2004-11-30 22:14:21 +01:00
|
|
|
extern HRESULT ZoneMgrImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2005-09-06 11:27:04 +02:00
|
|
|
extern HRESULT FileProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2005-09-14 17:38:26 +02:00
|
|
|
extern HRESULT HttpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2007-11-04 17:09:20 +01:00
|
|
|
extern HRESULT HttpSProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2005-09-14 17:38:26 +02:00
|
|
|
extern HRESULT FtpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2007-01-12 12:31:54 +01:00
|
|
|
extern HRESULT MkProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
|
2002-08-13 20:20:24 +02:00
|
|
|
|
2005-02-03 20:38:37 +01:00
|
|
|
/**********************************************************************
|
|
|
|
* Dll lifetime tracking declaration for urlmon.dll
|
|
|
|
*/
|
|
|
|
extern LONG URLMON_refCount;
|
2005-06-21 22:53:13 +02:00
|
|
|
static inline void URLMON_LockModule(void) { InterlockedIncrement( &URLMON_refCount ); }
|
|
|
|
static inline void URLMON_UnlockModule(void) { InterlockedDecrement( &URLMON_refCount ); }
|
2005-02-03 20:38:37 +01:00
|
|
|
|
2004-08-13 02:44:22 +02:00
|
|
|
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
|
2005-09-06 11:27:04 +02:00
|
|
|
#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
|
2004-08-13 02:44:22 +02:00
|
|
|
|
2005-05-04 12:36:54 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const IStreamVtbl *lpVtbl;
|
2005-07-03 14:05:03 +02:00
|
|
|
LONG ref;
|
2005-05-04 12:36:54 +02:00
|
|
|
HANDLE handle;
|
|
|
|
BOOL closed;
|
|
|
|
WCHAR *pszFileName;
|
|
|
|
WCHAR *pszURL;
|
|
|
|
} IUMCacheStream;
|
|
|
|
|
|
|
|
HRESULT UMCreateStreamOnCacheFile(LPCWSTR pszURL, DWORD dwSize, LPWSTR pszFileName, HANDLE *phfile, IUMCacheStream **ppstr);
|
|
|
|
void UMCloseCacheFileStream(IUMCacheStream *pstr);
|
|
|
|
|
2006-05-24 18:00:08 +02:00
|
|
|
IInternetProtocolInfo *get_protocol_info(LPCWSTR url);
|
2007-01-23 19:35:35 +01:00
|
|
|
HRESULT get_protocol_handler(LPCWSTR url, CLSID *clsid, IClassFactory **ret);
|
2008-01-29 00:18:33 +01:00
|
|
|
BOOL is_registered_protocol(LPCWSTR);
|
2008-02-21 13:07:41 +01:00
|
|
|
void register_urlmon_namespace(IClassFactory*,REFIID,LPCWSTR,BOOL);
|
2005-11-14 13:28:18 +01:00
|
|
|
|
2007-12-30 17:42:17 +01:00
|
|
|
HRESULT bind_to_storage(LPCWSTR url, IBindCtx *pbc, REFIID riid, void **ppv);
|
2007-12-30 17:45:00 +01:00
|
|
|
HRESULT bind_to_object(IMoniker *mon, LPCWSTR url, IBindCtx *pbc, REFIID riid, void **ppv);
|
2005-11-14 16:12:43 +01:00
|
|
|
|
2007-12-30 17:40:26 +01:00
|
|
|
HRESULT create_binding_protocol(LPCWSTR url, BOOL from_urlmon, IInternetProtocol **protocol);
|
2007-12-28 14:53:25 +01:00
|
|
|
void set_binding_sink(IInternetProtocol *bind_protocol, IInternetProtocolSink *sink);
|
2007-01-23 19:33:30 +01:00
|
|
|
|
2007-11-29 22:12:34 +01:00
|
|
|
static inline void *heap_alloc(size_t len)
|
2007-11-25 19:07:54 +01:00
|
|
|
{
|
|
|
|
return HeapAlloc(GetProcessHeap(), 0, len);
|
|
|
|
}
|
|
|
|
|
2007-11-29 22:12:34 +01:00
|
|
|
static inline void *heap_alloc_zero(size_t len)
|
2007-11-25 19:07:54 +01:00
|
|
|
{
|
|
|
|
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
|
|
|
}
|
|
|
|
|
2007-11-29 22:12:34 +01:00
|
|
|
static inline void *heap_realloc(void *mem, size_t len)
|
2007-11-25 19:07:54 +01:00
|
|
|
{
|
|
|
|
return HeapReAlloc(GetProcessHeap(), 0, mem, len);
|
|
|
|
}
|
|
|
|
|
2007-11-29 22:12:34 +01:00
|
|
|
static inline BOOL heap_free(void *mem)
|
2007-11-25 19:07:54 +01:00
|
|
|
{
|
|
|
|
return HeapFree(GetProcessHeap(), 0, mem);
|
|
|
|
}
|
|
|
|
|
2007-12-13 20:25:59 +01: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;
|
|
|
|
}
|
|
|
|
|
2008-02-18 01:03:54 +01: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 20:20:24 +02:00
|
|
|
#endif /* __WINE_URLMON_MAIN_H */
|