Sync to Wine-0_9_1:
authorGé van Geldorp <ge@gse.nl>
Sun, 20 Nov 2005 14:51:28 +0000 (14:51 +0000)
committerGé van Geldorp <ge@gse.nl>
Sun, 20 Nov 2005 14:51:28 +0000 (14:51 +0000)
Jacek Caban <jack@itma.pwr.wroc.pl>
- Added IInternetPriority implementation to FileProtocol.
- Report BINDSTATUS_SENDINGREQUEST in FileProtocol::Start.
- Added implementation of IInternetPriority in HttpProtocol.

svn path=/trunk/; revision=19367

reactos/lib/urlmon/binding.c [new file with mode: 0644]
reactos/lib/urlmon/file.c
reactos/lib/urlmon/http.c
reactos/lib/urlmon/internet.c
reactos/lib/urlmon/session.c
reactos/lib/urlmon/umon.c
reactos/lib/urlmon/urlmon.spec
reactos/lib/urlmon/urlmon.xml
reactos/lib/urlmon/urlmon_main.h
reactos/w32api/include/urlmon.h

diff --git a/reactos/lib/urlmon/binding.c b/reactos/lib/urlmon/binding.c
new file mode 100644 (file)
index 0000000..6b62c78
--- /dev/null
@@ -0,0 +1,534 @@
+/*
+ * Copyright 2005 Jacek Caban
+ *
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdarg.h>
+
+#define COBJMACROS
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "ole2.h"
+#include "urlmon.h"
+#include "urlmon_main.h"
+
+#include "wine/debug.h"
+#include "wine/unicode.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
+
+typedef struct {
+    const IBindingVtbl               *lpBindingVtbl;
+    const IInternetProtocolSinkVtbl  *lpInternetProtocolSinkVtbl;
+    const IInternetBindInfoVtbl      *lpInternetBindInfoVtbl;
+    const IServiceProviderVtbl       *lpServiceProviderVtbl;
+
+    LONG ref;
+
+    IBindStatusCallback *callback;
+    IInternetProtocol *protocol;
+    IStream *stream;
+
+    BINDINFO bindinfo;
+    DWORD bindf;
+    LPWSTR mime;
+    LPWSTR url;
+} Binding;
+
+#define BINDING(x)   ((IBinding*)               &(x)->lpBindingVtbl)
+#define PROTSINK(x)  ((IInternetProtocolSink*)  &(x)->lpInternetProtocolSinkVtbl)
+#define BINDINF(x)   ((IInternetBindInfo*)      &(x)->lpInternetBindInfoVtbl)
+#define SERVPROV(x)  ((IServiceProvider*)       &(x)->lpServiceProviderVtbl)
+
+
+#define BINDING_THIS(iface) DEFINE_THIS(Binding, Binding, iface)
+
+static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv)
+{
+    Binding *This = BINDING_THIS(iface);
+
+    *ppv = NULL;
+
+    if(IsEqualGUID(&IID_IUnknown, riid)) {
+        TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
+        *ppv = BINDING(This);
+    }else if(IsEqualGUID(&IID_IBinding, riid)) {
+        TRACE("(%p)->(IID_IBinding %p)\n", This, ppv);
+        *ppv = BINDING(This);
+    }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) {
+        TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv);
+        *ppv = PROTSINK(This);
+    }else if(IsEqualGUID(&IID_IInternetBindInfo, riid)) {
+        TRACE("(%p)->(IID_IInternetBindInfo %p)\n", This, ppv);
+        *ppv = BINDINF(This);
+    }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
+        TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
+        *ppv = SERVPROV(This);
+    }
+
+    if(*ppv)
+        return S_OK;
+
+    WARN("Unsupported interface %s\n", debugstr_guid(riid));
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI Binding_AddRef(IBinding *iface)
+{
+    Binding *This = BINDING_THIS(iface);
+    LONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) ref=%ld\n", This, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI Binding_Release(IBinding *iface)
+{
+    Binding *This = BINDING_THIS(iface);
+    LONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) ref=%ld\n", This, ref);
+
+    if(!ref) {
+        if(This->callback)
+            IBindStatusCallback_Release(This->callback);
+        if(This->protocol)
+            IInternetProtocol_Release(This->protocol);
+        if(This->stream)
+            IStream_Release(This->stream);
+
+        ReleaseBindInfo(&This->bindinfo);
+        HeapFree(GetProcessHeap(), 0, This->mime);
+        HeapFree(GetProcessHeap(), 0, This->url);
+
+        HeapFree(GetProcessHeap(), 0, This);
+    }
+
+    return ref;
+}
+
+static HRESULT WINAPI Binding_Abort(IBinding *iface)
+{
+    Binding *This = BINDING_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Binding_Suspend(IBinding *iface)
+{
+    Binding *This = BINDING_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Binding_Resume(IBinding *iface)
+{
+    Binding *This = BINDING_THIS(iface);
+    FIXME("(%p)\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Binding_SetPriority(IBinding *iface, LONG nPriority)
+{
+    Binding *This = BINDING_THIS(iface);
+    FIXME("(%p)->(%ld)\n", This, nPriority);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority)
+{
+    Binding *This = BINDING_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pnPriority);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Binding_GetBindResult(IBinding *iface, CLSID *pclsidProtocol,
+        DWORD *pdwResult, LPOLESTR *pszResult, DWORD *pdwReserved)
+{
+    Binding *This = BINDING_THIS(iface);
+    FIXME("(%p)->(%p %p %p %p)\n", This, pclsidProtocol, pdwResult, pszResult, pdwReserved);
+    return E_NOTIMPL;
+}
+
+#undef BINDING_THIS
+
+static const IBindingVtbl BindingVtbl = {
+    Binding_QueryInterface,
+    Binding_AddRef,
+    Binding_Release,
+    Binding_Abort,
+    Binding_Suspend,
+    Binding_Resume,
+    Binding_SetPriority,
+    Binding_GetPriority,
+    Binding_GetBindResult
+};
+
+#define PROTSINK_THIS(iface) DEFINE_THIS(Binding, InternetProtocolSink, iface)
+
+static HRESULT WINAPI InternetProtocolSink_QueryInterface(IInternetProtocolSink *iface,
+        REFIID riid, void **ppv)
+{
+    Binding *This = PROTSINK_THIS(iface);
+    return IBinding_QueryInterface(BINDING(This), riid, ppv);
+}
+
+static ULONG WINAPI InternetProtocolSink_AddRef(IInternetProtocolSink *iface)
+{
+    Binding *This = PROTSINK_THIS(iface);
+    return IBinding_AddRef(BINDING(This));
+}
+
+static ULONG WINAPI InternetProtocolSink_Release(IInternetProtocolSink *iface)
+{
+    Binding *This = PROTSINK_THIS(iface);
+    return IBinding_Release(BINDING(This));
+}
+
+static HRESULT WINAPI InternetProtocolSink_Switch(IInternetProtocolSink *iface,
+        PROTOCOLDATA *pProtocolData)
+{
+    Binding *This = PROTSINK_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, pProtocolData);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InternetProtocolSink_ReportProgress(IInternetProtocolSink *iface,
+        ULONG ulStatusCode, LPCWSTR szStatusText)
+{
+    Binding *This = PROTSINK_THIS(iface);
+
+    TRACE("(%p)->(%lu %s)\n", This, ulStatusCode, debugstr_w(szStatusText));
+
+    switch(ulStatusCode) {
+    case BINDSTATUS_MIMETYPEAVAILABLE: {
+        int len = strlenW(szStatusText)+1;
+        This->mime = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
+        memcpy(This->mime, szStatusText, len*sizeof(WCHAR));
+        break;
+    }
+    default:
+        FIXME("Unhandled status code %ld\n", ulStatusCode);
+        return E_NOTIMPL;
+    };
+
+    return S_OK;
+}
+
+static HRESULT WINAPI InternetProtocolSink_ReportData(IInternetProtocolSink *iface,
+        DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
+{
+    Binding *This = PROTSINK_THIS(iface);
+    DWORD read = 0, cread;
+    STGMEDIUM stgmed;
+    BYTE buf[1024];
+
+    TRACE("(%p)->(%ld %lu %lu)\n", This, grfBSCF, ulProgress, ulProgressMax);
+
+    if(grfBSCF & BSCF_FIRSTDATANOTIFICATION) {
+        if(This->mime)
+            IBindStatusCallback_OnProgress(This->callback, ulProgress, ulProgressMax,
+                                           BINDSTATUS_MIMETYPEAVAILABLE, This->mime);
+        IBindStatusCallback_OnProgress(This->callback, ulProgress, ulProgressMax,
+                                       BINDSTATUS_BEGINDOWNLOADDATA, This->url);
+    }
+
+    if(grfBSCF & BSCF_LASTDATANOTIFICATION)
+        IBindStatusCallback_OnProgress(This->callback, ulProgress, ulProgressMax,
+                                       BINDSTATUS_ENDDOWNLOADDATA, This->url);
+
+    if(grfBSCF & BSCF_FIRSTDATANOTIFICATION)
+        IInternetProtocol_LockRequest(This->protocol, 0);
+    do {
+        cread = 0;
+        IInternetProtocol_Read(This->protocol, buf, sizeof(buf), &cread);
+        IStream_Write(This->stream, buf, read, NULL);
+        read += cread;
+    }while(cread);
+
+    stgmed.tymed = TYMED_ISTREAM;
+    stgmed.u.pstm = This->stream;
+
+    IBindStatusCallback_OnDataAvailable(This->callback, grfBSCF, read,
+            NULL /* FIXME */, &stgmed);
+
+    if(grfBSCF & BSCF_LASTDATANOTIFICATION)
+        IBindStatusCallback_OnStopBinding(This->callback, S_OK, NULL);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI InternetProtocolSink_ReportResult(IInternetProtocolSink *iface,
+        HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
+{
+    Binding *This = PROTSINK_THIS(iface);
+    FIXME("(%p)->(%08lx %ld %s)\n", This, hrResult, dwError, debugstr_w(szResult));
+    return E_NOTIMPL;
+}
+
+#undef PROTSINK_THIS
+
+static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = {
+    InternetProtocolSink_QueryInterface,
+    InternetProtocolSink_AddRef,
+    InternetProtocolSink_Release,
+    InternetProtocolSink_Switch,
+    InternetProtocolSink_ReportProgress,
+    InternetProtocolSink_ReportData,
+    InternetProtocolSink_ReportResult
+};
+
+#define BINDINF_THIS(iface) DEFINE_THIS(Binding, InternetBindInfo, iface)
+
+static HRESULT WINAPI InternetBindInfo_QueryInterface(IInternetBindInfo *iface,
+        REFIID riid, void **ppv)
+{
+    Binding *This = BINDINF_THIS(iface);
+    return IBinding_QueryInterface(BINDING(This), riid, ppv);
+}
+
+static ULONG WINAPI InternetBindInfo_AddRef(IInternetBindInfo *iface)
+{
+    Binding *This = BINDINF_THIS(iface);
+    return IBinding_AddRef(BINDING(This));
+}
+
+static ULONG WINAPI InternetBindInfo_Release(IInternetBindInfo *iface)
+{
+    Binding *This = BINDINF_THIS(iface);
+    return IBinding_Release(BINDING(This));
+}
+
+static HRESULT WINAPI InternetBindInfo_GetBindInfo(IInternetBindInfo *iface,
+        DWORD *grfBINDF, BINDINFO *pbindinfo)
+{
+    Binding *This = BINDINF_THIS(iface);
+
+    TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo);
+
+    *grfBINDF = This->bindf;
+
+    memcpy(pbindinfo, &This->bindinfo, sizeof(BINDINFO));
+
+    if(pbindinfo->szExtraInfo || pbindinfo->szCustomVerb)
+        FIXME("copy strings\n");
+
+    if(pbindinfo->pUnk)
+        IUnknown_AddRef(pbindinfo->pUnk);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI InternetBindInfo_GetBindString(IInternetBindInfo *iface,
+        ULONG ulStringType, LPOLESTR *ppwzStr, ULONG cEl, ULONG *pcElFetched)
+{
+    Binding *This = BINDINF_THIS(iface);
+    FIXME("(%p)->(%ld %p %ld %p)\n", This, ulStringType, ppwzStr, cEl, pcElFetched);
+    return E_NOTIMPL;
+}
+
+#undef BINDF_THIS
+
+static const IInternetBindInfoVtbl InternetBindInfoVtbl = {
+    InternetBindInfo_QueryInterface,
+    InternetBindInfo_AddRef,
+    InternetBindInfo_Release,
+    InternetBindInfo_GetBindInfo,
+    InternetBindInfo_GetBindString
+};
+
+#define SERVPROV_THIS(iface) DEFINE_THIS(Binding, ServiceProvider, iface)
+
+static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface,
+        REFIID riid, void **ppv)
+{
+    Binding *This = SERVPROV_THIS(iface);
+    return IBinding_QueryInterface(BINDING(This), riid, ppv);
+}
+
+static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
+{
+    Binding *This = SERVPROV_THIS(iface);
+    return IBinding_AddRef(BINDING(This));
+}
+
+static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
+{
+    Binding *This = SERVPROV_THIS(iface);
+    return IBinding_Release(BINDING(This));
+}
+
+static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface,
+        REFGUID guidService, REFIID riid, void **ppv)
+{
+    Binding *This = SERVPROV_THIS(iface);
+    FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
+    return E_NOTIMPL;
+}
+
+#undef SERVPROV_THIS
+
+static const IServiceProviderVtbl ServiceProviderVtbl = {
+    ServiceProvider_QueryInterface,
+    ServiceProvider_AddRef,
+    ServiceProvider_Release,
+    ServiceProvider_QueryService
+};
+
+static HRESULT get_callback(IBindCtx *pbc, IBindStatusCallback **callback)
+{
+    HRESULT hres;
+
+    static WCHAR wszBSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
+
+    hres = IBindCtx_GetObjectParam(pbc, wszBSCBHolder, (IUnknown**)callback);
+    if(FAILED(hres))
+        return INET_E_DATA_NOT_AVAILABLE;
+
+    return S_OK;
+}
+
+static HRESULT get_protocol(Binding *This, LPCWSTR url)
+{
+    IUnknown *unk = NULL;
+    IClassFactory *cf = NULL;
+    HRESULT hres;
+
+    hres = IBindStatusCallback_QueryInterface(This->callback, &IID_IInternetProtocol,
+            (void**)&This->protocol);
+    if(SUCCEEDED(hres))
+        return S_OK;
+
+    hres = get_protocol_iface(url, &unk);
+    if(FAILED(hres))
+        return hres;
+
+    hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&cf);
+    IUnknown_Release(unk);
+    if(FAILED(hres))
+        return hres;
+
+    hres = IClassFactory_CreateInstance(cf, NULL, &IID_IInternetProtocol, (void**)&This->protocol);
+    IClassFactory_Release(cf);
+
+    return hres;
+}
+
+static HRESULT Binding_Create(LPCWSTR url, IBindCtx *pbc, REFIID riid, Binding **binding)
+{
+    Binding *ret;
+    int len;
+    HRESULT hres;
+
+    if(!IsEqualGUID(&IID_IStream, riid)) {
+        FIXME("Unsupported riid %s\n", debugstr_guid(riid));
+        return E_NOTIMPL;
+    }
+
+    ret = HeapAlloc(GetProcessHeap(), 0, sizeof(Binding));
+
+    ret->lpBindingVtbl              = &BindingVtbl;
+    ret->lpInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl;
+    ret->lpInternetBindInfoVtbl     = &InternetBindInfoVtbl;
+    ret->lpServiceProviderVtbl      = &ServiceProviderVtbl;
+
+    ret->ref = 1;
+
+    ret->callback = NULL;
+    ret->protocol = NULL;
+    ret->stream = NULL;
+    ret->mime = NULL;
+    ret->url = NULL;
+
+    memset(&ret->bindinfo, 0, sizeof(BINDINFO));
+    ret->bindinfo.cbSize = sizeof(BINDINFO);
+    ret->bindf = 0;
+
+    hres = get_callback(pbc, &ret->callback);
+    if(FAILED(hres)) {
+        WARN("Could not get IBindStatusCallback\n");
+        IBinding_Release(BINDING(ret));
+        return hres;
+    }
+
+    hres = get_protocol(ret, url);
+    if(FAILED(hres)) {
+        WARN("Could not get protocol handler\n");
+        IBinding_Release(BINDING(ret));
+        return hres;
+    }
+
+    hres = IBindStatusCallback_GetBindInfo(ret->callback, &ret->bindf, &ret->bindinfo);
+    if(FAILED(hres)) {
+        WARN("GetBindInfo failed: %08lx\n", hres);
+        IBinding_Release(BINDING(ret));
+        return hres;
+    }
+
+    ret->bindf |= (BINDF_FROMURLMON|BINDF_NEEDFILE);
+
+    len = strlenW(url)+1;
+    ret->url = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
+    memcpy(ret->url, url, len*sizeof(WCHAR));
+
+    CreateStreamOnHGlobal(NULL, TRUE, &ret->stream);
+
+    *binding = ret;
+    return S_OK;
+}
+
+HRESULT start_binding(LPCWSTR url, IBindCtx *pbc, REFIID riid, void **ppv)
+{
+    Binding *binding = NULL;
+    HRESULT hres;
+
+    *ppv = NULL;
+
+    hres = Binding_Create(url, pbc, riid, &binding);
+    if(FAILED(hres))
+        return hres;
+
+    hres = IBindStatusCallback_OnStartBinding(binding->callback, 0, BINDING(binding));
+    if(FAILED(hres)) {
+        WARN("OnStartBinding failed: %08lx\n", hres);
+        IBindStatusCallback_OnStopBinding(binding->callback, 0x800c0008, NULL);
+        IBinding_Release(BINDING(binding));
+        return hres;
+    }
+
+    hres = IInternetProtocol_Start(binding->protocol, url, PROTSINK(binding),
+             BINDINF(binding), 0, 0);
+    IInternetProtocol_Terminate(binding->protocol, 0);
+
+    if(SUCCEEDED(hres)) {
+        IInternetProtocol_UnlockRequest(binding->protocol);
+    }else {
+        WARN("Start failed: %08lx\n", hres);
+        IBindStatusCallback_OnStopBinding(binding->callback, S_OK, NULL);
+    }
+
+    IStream_AddRef(binding->stream);
+    *ppv = binding->stream;
+
+    IBinding_Release(BINDING(binding));
+
+    return hres;
+}
index be54cea..61c312c 100644 (file)
@@ -33,15 +33,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
 
 typedef struct {
     const IInternetProtocolVtbl  *lpInternetProtocolVtbl;
+    const IInternetPriorityVtbl  *lpInternetPriorityVtbl;
 
     HANDLE file;
+    LONG priority;
 
     LONG ref;
 } FileProtocol;
 
-#define PROTOCOL_THIS(iface) DEFINE_THIS(FileProtocol, InternetProtocol, iface)
-
 #define PROTOCOL(x)  ((IInternetProtocol*)  &(x)->lpInternetProtocolVtbl)
+#define PRIORITY(x)  ((IInternetPriority*)  &(x)->lpInternetPriorityVtbl)
+
+#define PROTOCOL_THIS(iface) DEFINE_THIS(FileProtocol, InternetProtocol, iface)
 
 static HRESULT WINAPI FileProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
 {
@@ -57,6 +60,9 @@ static HRESULT WINAPI FileProtocol_QueryInterface(IInternetProtocol *iface, REFI
     }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
         TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
         *ppv = PROTOCOL(This);
+    }else if(IsEqualGUID(&IID_IInternetPriority, riid)) {
+        TRACE("(%p)->(IID_IInternetPriority %p)\n", This, ppv);
+        *ppv = PRIORITY(This);
     }
 
     if(*ppv) {
@@ -104,6 +110,7 @@ static HRESULT WINAPI FileProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl
     LARGE_INTEGER size;
     DWORD len;
     LPWSTR url, mime = NULL;
+    WCHAR null_char = 0;
     HRESULT hres;
 
     static const WCHAR wszFile[]  = {'f','i','l','e',':'};
@@ -132,6 +139,8 @@ static HRESULT WINAPI FileProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl
         IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_DIRECTBIND, mime);
 
     if(!This->file) {
+        IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, &null_char);
+
         This->file = CreateFileW(url+sizeof(wszFile)/sizeof(WCHAR), GENERIC_READ, FILE_SHARE_READ,
                 NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
 
@@ -263,6 +272,57 @@ static const IInternetProtocolVtbl FileProtocolVtbl = {
     FileProtocol_UnlockRequest
 };
 
+#define PRIORITY_THIS(iface) DEFINE_THIS(FileProtocol, InternetPriority, iface)
+
+static HRESULT WINAPI FilePriority_QueryInterface(IInternetPriority *iface,
+                                                  REFIID riid, void **ppv)
+{
+    FileProtocol *This = PRIORITY_THIS(iface);
+    return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv);
+}
+
+static ULONG WINAPI FilePriority_AddRef(IInternetPriority *iface)
+{
+    FileProtocol *This = PRIORITY_THIS(iface);
+    return IInternetProtocol_AddRef(PROTOCOL(This));
+}
+
+static ULONG WINAPI FilePriority_Release(IInternetPriority *iface)
+{
+    FileProtocol *This = PRIORITY_THIS(iface);
+    return IInternetProtocol_Release(PROTOCOL(This));
+}
+
+static HRESULT WINAPI FilePriority_SetPriority(IInternetPriority *iface, LONG nPriority)
+{
+    FileProtocol *This = PRIORITY_THIS(iface);
+
+    TRACE("(%p)->(%ld)\n", This, nPriority);
+
+    This->priority = nPriority;
+    return S_OK;
+}
+
+static HRESULT WINAPI FilePriority_GetPriority(IInternetPriority *iface, LONG *pnPriority)
+{
+    FileProtocol *This = PRIORITY_THIS(iface);
+
+    TRACE("(%p)->(%p)\n", This, pnPriority);
+
+    *pnPriority = This->priority;
+    return S_OK;
+}
+
+#undef PRIORITY_THIS
+
+static const IInternetPriorityVtbl FilePriorityVtbl = {
+    FilePriority_QueryInterface,
+    FilePriority_AddRef,
+    FilePriority_Release,
+    FilePriority_SetPriority,
+    FilePriority_GetPriority
+};
+
 HRESULT FileProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
 {
     FileProtocol *ret;
@@ -274,7 +334,9 @@ HRESULT FileProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
     ret = HeapAlloc(GetProcessHeap(), 0, sizeof(FileProtocol));
 
     ret->lpInternetProtocolVtbl = &FileProtocolVtbl;
+    ret->lpInternetPriorityVtbl = &FilePriorityVtbl;
     ret->file = NULL;
+    ret->priority = 0;
     ret->ref = 1;
 
     *ppobj = PROTOCOL(ret);
index fd69d6b..4f33572 100644 (file)
 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
 
 typedef struct {
-    const IInternetProtocolVtbl  *lpInternetProtocolVtbl;
+    const IInternetProtocolVtbl *lpInternetProtocolVtbl;
+    const IInternetPriorityVtbl *lpInternetPriorityVtbl;
+
+    LONG priority;
+
     LONG ref;
 } HttpProtocol;
 
-#define PROTOCOL_THIS(iface) DEFINE_THIS(HttpProtocol, InternetProtocol, iface)
-
 #define PROTOCOL(x)  ((IInternetProtocol*)  &(x)->lpInternetProtocolVtbl)
+#define PRIORITY(x)  ((IInternetPriority*)  &(x)->lpInternetPriorityVtbl)
+
+#define PROTOCOL_THIS(iface) DEFINE_THIS(HttpProtocol, InternetProtocol, iface)
 
 static HRESULT WINAPI HttpProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
 {
@@ -54,6 +59,9 @@ static HRESULT WINAPI HttpProtocol_QueryInterface(IInternetProtocol *iface, REFI
     }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
         TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
         *ppv = PROTOCOL(This);
+    }else if(IsEqualGUID(&IID_IInternetPriority, riid)) {
+        TRACE("(%p)->(IID_IInternetPriority %p)\n", This, ppv);
+        *ppv = PRIORITY(This);
     }
 
     if(*ppv) {
@@ -167,6 +175,56 @@ static HRESULT WINAPI HttpProtocol_UnlockRequest(IInternetProtocol *iface)
 
 #undef PROTOCOL_THIS
 
+#define PRIORITY_THIS(iface) DEFINE_THIS(HttpProtocol, InternetPriority, iface)
+
+static HRESULT WINAPI HttpPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv)
+{
+    HttpProtocol *This = PRIORITY_THIS(iface);
+    return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv);
+}
+
+static ULONG WINAPI HttpPriority_AddRef(IInternetPriority *iface)
+{
+    HttpProtocol *This = PRIORITY_THIS(iface);
+    return IInternetProtocol_AddRef(PROTOCOL(This));
+}
+
+static ULONG WINAPI HttpPriority_Release(IInternetPriority *iface)
+{
+    HttpProtocol *This = PRIORITY_THIS(iface);
+    return IInternetProtocol_Release(PROTOCOL(This));
+}
+
+static HRESULT WINAPI HttpPriority_SetPriority(IInternetPriority *iface, LONG nPriority)
+{
+    HttpProtocol *This = PRIORITY_THIS(iface);
+
+    TRACE("(%p)->(%ld)\n", This, nPriority);
+
+    This->priority = nPriority;
+    return S_OK;
+}
+
+static HRESULT WINAPI HttpPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority)
+{
+    HttpProtocol *This = PRIORITY_THIS(iface);
+
+    TRACE("(%p)->(%p)\n", This, pnPriority);
+
+    *pnPriority = This->priority;
+    return S_OK;
+}
+
+#undef PRIORITY_THIS
+
+static const IInternetPriorityVtbl HttpPriorityVtbl = {
+    HttpPriority_QueryInterface,
+    HttpPriority_AddRef,
+    HttpPriority_Release,
+    HttpPriority_SetPriority,
+    HttpPriority_GetPriority
+};
+
 static const IInternetProtocolVtbl HttpProtocolVtbl = {
     HttpProtocol_QueryInterface,
     HttpProtocol_AddRef,
@@ -194,8 +252,12 @@ HRESULT HttpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
     ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HttpProtocol));
 
     ret->lpInternetProtocolVtbl = &HttpProtocolVtbl;
+    ret->lpInternetPriorityVtbl = &HttpPriorityVtbl;
+
     ret->ref = 1;
 
+    ret->priority = 0;
+
     *ppobj = PROTOCOL(ret);
     
     return S_OK;
index e1ce837..7f5253b 100644 (file)
@@ -64,47 +64,16 @@ static HRESULT parse_schema(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size,
 static IInternetProtocolInfo *get_protocol_info(LPCWSTR url)
 {
     IInternetProtocolInfo *ret = NULL;
-    WCHAR schema[64], str_clsid[64];
-    HKEY hkey = NULL;
-    DWORD res, type, size, schema_len;
-    CLSID clsid;
-    LPWSTR wszKey;
+    IUnknown *unk;
     HRESULT hres;
 
-    static const WCHAR wszProtocolsKey[] =
-        {'P','R','O','T','O','C','O','L','S','\\','H','a','n','d','l','e','r','\\'};
-    static const WCHAR wszCLSID[] = {'C','L','S','I','D',0};
-
-    hres = parse_schema(url, 0, schema, sizeof(schema)/sizeof(schema[0]), &schema_len);
-    if(FAILED(hres) || !schema_len)
-        return NULL;
-
-    wszKey = HeapAlloc(GetProcessHeap(), 0, sizeof(wszProtocolsKey)+(schema_len+1)*sizeof(WCHAR));
-    memcpy(wszKey, wszProtocolsKey, sizeof(wszProtocolsKey));
-    memcpy(wszKey + sizeof(wszProtocolsKey)/sizeof(WCHAR), schema, (schema_len+1)*sizeof(WCHAR));
-
-    res = RegOpenKeyW(HKEY_CLASSES_ROOT, wszKey, &hkey);
-    HeapFree(GetProcessHeap(), 0, wszKey);
-    if(res != ERROR_SUCCESS) {
-        TRACE("Could not open key %s\n", debugstr_w(wszKey));
-        return NULL;
-    }
-    
-    size = sizeof(str_clsid);
-    res = RegQueryValueExW(hkey, wszCLSID, NULL, &type, (LPBYTE)str_clsid, &size);
-    RegCloseKey(hkey);
-    if(res != ERROR_SUCCESS || type != REG_SZ) {
-        WARN("Could not get protocol CLSID res=%ld\n", res);
+    hres = get_protocol_iface(url, &unk);
+    if(FAILED(hres))
         return NULL;
-    }
 
-    hres = CLSIDFromString(str_clsid, &clsid);
-    if(FAILED(hres)) {
-        WARN("CLSIDFromString failed: %08lx\n", hres);
-        return NULL;
-    }
+    IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&ret);
+    IUnknown_Release(unk);
 
-    CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IInternetProtocolInfo, (void**)&ret);
     return ret;
 }
 
index c516b7e..e4ea061 100644 (file)
@@ -23,6 +23,7 @@
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
+#include "winreg.h"
 #include "ole2.h"
 #include "urlmon.h"
 #include "urlmon_main.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
 
+HRESULT get_protocol_iface(LPCWSTR url, IUnknown **ret)
+{
+    WCHAR schema[64], str_clsid[64];
+    HKEY hkey = NULL;
+    DWORD res, type, size, schema_len;
+    CLSID clsid;
+    LPWSTR wszKey;
+    HRESULT hres;
+
+    static const WCHAR wszProtocolsKey[] =
+        {'P','R','O','T','O','C','O','L','S','\\','H','a','n','d','l','e','r','\\'};
+    static const WCHAR wszCLSID[] = {'C','L','S','I','D',0};
+
+    hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, sizeof(schema)/sizeof(schema[0]),
+            &schema_len, 0);
+    if(FAILED(hres) || !schema_len)
+        return E_FAIL;
+
+    wszKey = HeapAlloc(GetProcessHeap(), 0, sizeof(wszProtocolsKey)+(schema_len+1)*sizeof(WCHAR));
+    memcpy(wszKey, wszProtocolsKey, sizeof(wszProtocolsKey));
+    memcpy(wszKey + sizeof(wszProtocolsKey)/sizeof(WCHAR), schema, (schema_len+1)*sizeof(WCHAR));
+
+    res = RegOpenKeyW(HKEY_CLASSES_ROOT, wszKey, &hkey);
+    HeapFree(GetProcessHeap(), 0, wszKey);
+    if(res != ERROR_SUCCESS) {
+        TRACE("Could not open key %s\n", debugstr_w(wszKey));
+        return E_FAIL;
+    }
+    
+    size = sizeof(str_clsid);
+    res = RegQueryValueExW(hkey, wszCLSID, NULL, &type, (LPBYTE)str_clsid, &size);
+    RegCloseKey(hkey);
+    if(res != ERROR_SUCCESS || type != REG_SZ) {
+        WARN("Could not get protocol CLSID res=%ld\n", res);
+        return E_FAIL;
+    }
+
+    hres = CLSIDFromString(str_clsid, &clsid);
+    if(FAILED(hres)) {
+        WARN("CLSIDFromString failed: %08lx\n", hres);
+        return hres;
+    }
+
+    return CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)ret);
+}
+
 static HRESULT WINAPI InternetSession_QueryInterface(IInternetSession *iface,
         REFIID riid, void **ppv)
 {
index 6bc28ac..cbf70de 100644 (file)
@@ -198,7 +198,7 @@ static HRESULT Binding_MoreCacheData(Binding *This, char *buf, DWORD dwBytes)
                                            (This->total_read == written) ?
                                                BINDSTATUS_BEGINDOWNLOADDATA :
                                                BINDSTATUS_DOWNLOADINGDATA,
-                                           NULL);
+                                           This->URLName);
        if (!hr)
        {
            STGMEDIUM stg;
@@ -244,7 +244,8 @@ static void Binding_FinishedDownload(Binding *This, HRESULT hr)
     stg.u.pstm = (IStream *)This->pstrCache;
     stg.pUnkForRelease = NULL;
 
-    IBindStatusCallback_OnProgress(This->pbscb, This->total_read, This->expected_size, BINDSTATUS_ENDDOWNLOADDATA, NULL);
+    IBindStatusCallback_OnProgress(This->pbscb, This->total_read, This->expected_size,
+                                   BINDSTATUS_ENDDOWNLOADDATA, This->URLName);
     IBindStatusCallback_OnDataAvailable(This->pbscb, BSCF_LASTDATANOTIFICATION, This->total_read, &fmt, &stg);
     if (hr)
     {
@@ -547,13 +548,12 @@ static void CALLBACK URLMON_InternetCallback(HINTERNET hinet, /*DWORD_PTR*/ DWOR
 /******************************************************************************
  *        URLMoniker_BindToStorage
  ******************************************************************************/
-static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,
+static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName,
                                                   IBindCtx* pbc,
                                                   IMoniker* pmkToLeft,
                                                   REFIID riid,
                                                   VOID** ppvObject)
 {
-    URLMonikerImpl *This = (URLMonikerImpl *)iface;
     HRESULT hres;
     BINDINFO bi;
     DWORD bindf;
@@ -561,6 +561,9 @@ static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,
     Binding *bind;
     int len;
 
+    WARN("(%s %p %p %s %p)\n", debugstr_w(URLName), pbc, pmkToLeft, debugstr_guid(riid),
+            ppvObject);
+
     if(pmkToLeft) {
        FIXME("pmkToLeft != NULL\n");
        return E_NOTIMPL;
@@ -575,9 +578,9 @@ static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,
     bind->ref = 1;
     URLMON_LockModule();
 
-    len = lstrlenW(This->URLName)+1;
+    len = lstrlenW(URLName)+1;
     bind->URLName = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
-    memcpy(bind->URLName, This->URLName, len*sizeof(WCHAR));
+    memcpy(bind->URLName, URLName, len*sizeof(WCHAR));
 
     hres = UMCreateStreamOnCacheFile(bind->URLName, 0, szFileName, &bind->hCacheFile, &bind->pstrCache);
 
@@ -855,6 +858,37 @@ static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,
     return hres;
 }
 
+static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,
+                                                   IBindCtx* pbc,
+                                                  IMoniker* pmkToLeft,
+                                                  REFIID riid,
+                                                  VOID** ppvObject)
+{
+    URLMonikerImpl *This = (URLMonikerImpl*)iface;
+    WCHAR schema[64];
+    BOOL bret;
+
+    URL_COMPONENTSW url = {sizeof(URL_COMPONENTSW), schema,
+        sizeof(schema)/sizeof(WCHAR), 0, NULL, 0, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0};
+
+    bret = InternetCrackUrlW(This->URLName, 0, ICU_ESCAPE, &url);
+    if(!bret) {
+        ERR("InternetCrackUrl failed: %ld\n", GetLastError());
+        return E_FAIL;
+    }
+
+    if(url.nScheme == INTERNET_SCHEME_HTTP
+       || url.nScheme== INTERNET_SCHEME_HTTPS
+       || url.nScheme== INTERNET_SCHEME_FTP
+       || url.nScheme == INTERNET_SCHEME_GOPHER
+       || url.nScheme == INTERNET_SCHEME_FILE)
+        return URLMonikerImpl_BindToStorage_hack(This->URLName, pbc, pmkToLeft, riid, ppvObject);
+
+    TRACE("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObject);
+
+    return start_binding(This->URLName, pbc, riid, ppvObject);
+}
+
 /******************************************************************************
  *        URLMoniker_Reduce
  ******************************************************************************/
@@ -1608,6 +1642,51 @@ HRESULT WINAPI URLDownloadToFileW(LPUNKNOWN pCaller,
     return S_OK;
 }
 
+/***********************************************************************
+ *           URLDownloadToCacheFileA (URLMON.@)
+ */
+HRESULT WINAPI URLDownloadToCacheFileA(LPUNKNOWN lpUnkCaller, LPCSTR szURL, LPSTR szFileName,
+        DWORD dwBufLength, DWORD dwReserved, LPBINDSTATUSCALLBACK pBSC)
+{
+    LPWSTR url = NULL, file_name = NULL;
+    int len;
+    HRESULT hres;
+
+    TRACE("(%p %s %p %ld %ld %p)\n", lpUnkCaller, debugstr_a(szURL), szFileName,
+            dwBufLength, dwReserved, pBSC);
+
+    if(szURL) {
+        len = MultiByteToWideChar(CP_ACP, 0, szURL, -1, NULL, 0);
+        url = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
+        MultiByteToWideChar(CP_ACP, 0, szURL, -1, url, -1);
+    }
+
+    if(szFileName)
+        file_name = HeapAlloc(GetProcessHeap(), 0, dwBufLength*sizeof(WCHAR));
+
+    hres = URLDownloadToCacheFileW(lpUnkCaller, url, file_name, dwBufLength*sizeof(WCHAR),
+            dwReserved, pBSC);
+
+    if(SUCCEEDED(hres) && file_name)
+        WideCharToMultiByte(CP_ACP, 0, file_name, -1, szFileName, dwBufLength, NULL, NULL);
+
+    HeapFree(GetProcessHeap(), 0, url);
+    HeapFree(GetProcessHeap(), 0, file_name);
+
+    return hres;
+}
+
+/***********************************************************************
+ *           URLDownloadToCacheFileW (URLMON.@)
+ */
+HRESULT WINAPI URLDownloadToCacheFileW(LPUNKNOWN lpUnkCaller, LPCWSTR szURL, LPWSTR szFileName,
+                DWORD dwBufLength, DWORD dwReserved, LPBINDSTATUSCALLBACK pBSC)
+{
+    FIXME("(%p %s %p %ld %ld %p)\n", lpUnkCaller, debugstr_w(szURL), szFileName,
+            dwBufLength, dwReserved, pBSC);
+    return E_NOTIMPL;
+}
+
 /***********************************************************************
  *           HlinkSimpleNavigateToString (URLMON.@)
  */
index 143c180..639675e 100644 (file)
@@ -64,8 +64,8 @@
 @ stdcall RevokeFormatEnumerator(ptr ptr)
 @ stub SetSoftwareUpdateAdvertisementState
 @ stub URLDownloadA
-@ stub URLDownloadToCacheFileA
-@ stub URLDownloadToCacheFileW
+@ stdcall URLDownloadToCacheFileA(ptr str str long long ptr)
+@ stdcall URLDownloadToCacheFileW(ptr wstr wstr long long ptr)
 @ stdcall URLDownloadToFileA(ptr str str long ptr)
 @ stdcall URLDownloadToFileW(ptr wstr wstr long ptr)
 @ stub URLDownloadW
index b082bce..3cf8cd0 100644 (file)
@@ -18,6 +18,7 @@
        <library>shlwapi</library>
        <library>cabinet</library>
        <library>wininet</library>
+       <file>binding.c</file>
        <file>file.c</file>
        <file>format.c</file>
        <file>ftp.c</file>
index 9a012d2..97197ad 100644 (file)
@@ -54,4 +54,8 @@ typedef struct
 HRESULT        UMCreateStreamOnCacheFile(LPCWSTR pszURL, DWORD dwSize, LPWSTR pszFileName, HANDLE *phfile, IUMCacheStream **ppstr);
 void   UMCloseCacheFileStream(IUMCacheStream *pstr);
 
+HRESULT get_protocol_iface(LPCWSTR url, IUnknown **ret);
+
+HRESULT start_binding(LPCWSTR url, IBindCtx *pbc, REFIID riid, void **ppv);
+
 #endif /* __WINE_URLMON_MAIN_H */
index b0b32c6..251ba62 100644 (file)
@@ -1,4 +1,4 @@
-/*** Autogenerated by WIDL 0.1 from urlmon.idl - Do not edit ***/
+/*** Autogenerated by WIDL 0.9.1 from urlmon.idl - Do not edit ***/
 #include <rpc.h>
 #include <rpcndr.h>
 
@@ -22,7 +22,6 @@ typedef struct IBinding IBinding;
 #endif
 
 typedef IBinding *LPBINDING;
-
 /*****************************************************************************
  * IBinding interface
  */
@@ -188,14 +187,12 @@ typedef struct IBindStatusCallback IBindStatusCallback;
 #endif
 
 typedef IBindStatusCallback *LPBINDSTATUSCALLBACK;
-
 typedef enum {
     BINDVERB_GET = 0x0,
     BINDVERB_POST = 0x1,
     BINDVERB_PUT = 0x2,
     BINDVERB_CUSTOM = 0x3
 } BINDVERB;
-
 typedef enum {
     BINDF_ASYNCHRONOUS = 0x1,
     BINDF_ASYNCSTORAGE = 0x2,
@@ -222,7 +219,6 @@ typedef enum {
     BINDF_PREFERDEFAULTHANDLER = 0x400000,
     BINDF_ENFORCERESTRICTED = 0x800000
 } BINDF;
-
 typedef struct _tagBINDINFO {
     ULONG cbSize;
     LPWSTR szExtraInfo;
@@ -239,13 +235,11 @@ typedef struct _tagBINDINFO {
     IUnknown *pUnk;
     DWORD dwReserved;
 } BINDINFO;
-
 typedef struct _REMSECURITY_ATTRIBUTES {
     DWORD nLength;
     DWORD lpSecurityDescriptor;
     BOOL bInheritHandle;
 } REMSECURITY_ATTRIBUTES, *PREMSECURITY_ATTRIBUTES, *LPREMSECURITY_ATTRIBUTES;
-
 typedef struct _tagRemBINDINFO {
     ULONG cbSize;
     LPWSTR szExtraInfo;
@@ -261,7 +255,6 @@ typedef struct _tagRemBINDINFO {
     IUnknown *pUnk;
     DWORD dwReserved;
 } RemBINDINFO;
-
 typedef struct tagRemFORMATETC {
     DWORD cfFormat;
     DWORD ptd;
@@ -269,7 +262,6 @@ typedef struct tagRemFORMATETC {
     LONG lindex;
     DWORD tymed;
 } RemFORMATETC, *LPREMFORMATETC;
-
 typedef enum {
     BSCF_FIRSTDATANOTIFICATION = 0x1,
     BSCF_INTERMEDIATEDATANOTIFICATION = 0x2,
@@ -277,7 +269,6 @@ typedef enum {
     BSCF_DATAFULLYAVAILABLE = 0x8,
     BSCF_AVAILABLEDATASIZEUNKNOWN = 0x10
 } BSCF;
-
 typedef enum BINDSTATUS {
     BINDSTATUS_FINDINGRESOURCE = 1,
     BINDSTATUS_CONNECTING,
@@ -328,7 +319,6 @@ typedef enum BINDSTATUS {
     BINDSTATUS_SESSION_COOKIES_ALLOWED,
     BINDSTATUS_CACHECONTROL
 } BINDSTATUS;
-
 /*****************************************************************************
  * IBindStatusCallback interface
  */
@@ -563,7 +553,6 @@ typedef struct IAuthenticate IAuthenticate;
 #endif
 
 typedef IAuthenticate *LPAUTHENTICATION;
-
 /*****************************************************************************
  * IAuthenticate interface
  */
@@ -634,6 +623,204 @@ void __RPC_STUB IAuthenticate_Authenticate_Stub(
 
 #endif  /* __IAuthenticate_INTERFACE_DEFINED__ */
 
+#ifndef __IHttpNegotiate_FWD_DEFINED__
+#define __IHttpNegotiate_FWD_DEFINED__
+typedef struct IHttpNegotiate IHttpNegotiate;
+#endif
+
+typedef IHttpNegotiate *LPHTTPNEGOTIATE;
+/*****************************************************************************
+ * IHttpNegotiate interface
+ */
+#ifndef __IHttpNegotiate_INTERFACE_DEFINED__
+#define __IHttpNegotiate_INTERFACE_DEFINED__
+
+DEFINE_GUID(IID_IHttpNegotiate, 0x79eac9d2, 0xbaf9, 0x11ce, 0x8c,0x82, 0x00,0xaa,0x00,0x4b,0xa9,0x0b);
+#if defined(__cplusplus) && !defined(CINTERFACE)
+struct IHttpNegotiate : public IUnknown
+{
+    virtual HRESULT STDMETHODCALLTYPE BeginningTransaction(
+        LPCWSTR szURL,
+        LPCWSTR szHeaders,
+        DWORD dwReserved,
+        LPWSTR* pszAdditionalHeaders) = 0;
+
+    virtual HRESULT STDMETHODCALLTYPE OnResponse(
+        DWORD dwResponseCode,
+        LPCWSTR szResponseHeaders,
+        LPCWSTR szRequestHeaders,
+        LPWSTR* pszAdditionalRequestHeaders) = 0;
+
+};
+#else
+typedef struct IHttpNegotiateVtbl IHttpNegotiateVtbl;
+struct IHttpNegotiate {
+    const IHttpNegotiateVtbl* lpVtbl;
+};
+struct IHttpNegotiateVtbl {
+    BEGIN_INTERFACE
+
+    /*** IUnknown methods ***/
+    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
+        IHttpNegotiate* This,
+        REFIID riid,
+        void** ppvObject);
+
+    ULONG (STDMETHODCALLTYPE *AddRef)(
+        IHttpNegotiate* This);
+
+    ULONG (STDMETHODCALLTYPE *Release)(
+        IHttpNegotiate* This);
+
+    /*** IHttpNegotiate methods ***/
+    HRESULT (STDMETHODCALLTYPE *BeginningTransaction)(
+        IHttpNegotiate* This,
+        LPCWSTR szURL,
+        LPCWSTR szHeaders,
+        DWORD dwReserved,
+        LPWSTR* pszAdditionalHeaders);
+
+    HRESULT (STDMETHODCALLTYPE *OnResponse)(
+        IHttpNegotiate* This,
+        DWORD dwResponseCode,
+        LPCWSTR szResponseHeaders,
+        LPCWSTR szRequestHeaders,
+        LPWSTR* pszAdditionalRequestHeaders);
+
+    END_INTERFACE
+};
+
+#ifdef COBJMACROS
+/*** IUnknown methods ***/
+#define IHttpNegotiate_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IHttpNegotiate_AddRef(p) (p)->lpVtbl->AddRef(p)
+#define IHttpNegotiate_Release(p) (p)->lpVtbl->Release(p)
+/*** IHttpNegotiate methods ***/
+#define IHttpNegotiate_BeginningTransaction(p,a,b,c,d) (p)->lpVtbl->BeginningTransaction(p,a,b,c,d)
+#define IHttpNegotiate_OnResponse(p,a,b,c,d) (p)->lpVtbl->OnResponse(p,a,b,c,d)
+#endif
+
+#endif
+
+HRESULT CALLBACK IHttpNegotiate_BeginningTransaction_Proxy(
+    IHttpNegotiate* This,
+    LPCWSTR szURL,
+    LPCWSTR szHeaders,
+    DWORD dwReserved,
+    LPWSTR* pszAdditionalHeaders);
+void __RPC_STUB IHttpNegotiate_BeginningTransaction_Stub(
+    struct IRpcStubBuffer* This,
+    struct IRpcChannelBuffer* pRpcChannelBuffer,
+    PRPC_MESSAGE pRpcMessage,
+    DWORD* pdwStubPhase);
+HRESULT CALLBACK IHttpNegotiate_OnResponse_Proxy(
+    IHttpNegotiate* This,
+    DWORD dwResponseCode,
+    LPCWSTR szResponseHeaders,
+    LPCWSTR szRequestHeaders,
+    LPWSTR* pszAdditionalRequestHeaders);
+void __RPC_STUB IHttpNegotiate_OnResponse_Stub(
+    struct IRpcStubBuffer* This,
+    struct IRpcChannelBuffer* pRpcChannelBuffer,
+    PRPC_MESSAGE pRpcMessage,
+    DWORD* pdwStubPhase);
+
+#endif  /* __IHttpNegotiate_INTERFACE_DEFINED__ */
+
+#ifndef __IHttpNegotiate2_FWD_DEFINED__
+#define __IHttpNegotiate2_FWD_DEFINED__
+typedef struct IHttpNegotiate2 IHttpNegotiate2;
+#endif
+
+typedef IHttpNegotiate2 *LPHTTPNEGOTIATE2;
+/*****************************************************************************
+ * IHttpNegotiate2 interface
+ */
+#ifndef __IHttpNegotiate2_INTERFACE_DEFINED__
+#define __IHttpNegotiate2_INTERFACE_DEFINED__
+
+DEFINE_GUID(IID_IHttpNegotiate2, 0x4f9f9fcb, 0xe0f4, 0x48eb, 0xb7,0xab, 0xfa,0x2e,0xa9,0x36,0x5c,0xb4);
+#if defined(__cplusplus) && !defined(CINTERFACE)
+struct IHttpNegotiate2 : public IHttpNegotiate
+{
+    virtual HRESULT STDMETHODCALLTYPE GetRootSecurityId(
+        BYTE* pbSecurityId,
+        DWORD* pcbSecurityId,
+        DWORD_PTR dwReserved) = 0;
+
+};
+#else
+typedef struct IHttpNegotiate2Vtbl IHttpNegotiate2Vtbl;
+struct IHttpNegotiate2 {
+    const IHttpNegotiate2Vtbl* lpVtbl;
+};
+struct IHttpNegotiate2Vtbl {
+    BEGIN_INTERFACE
+
+    /*** IUnknown methods ***/
+    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
+        IHttpNegotiate2* This,
+        REFIID riid,
+        void** ppvObject);
+
+    ULONG (STDMETHODCALLTYPE *AddRef)(
+        IHttpNegotiate2* This);
+
+    ULONG (STDMETHODCALLTYPE *Release)(
+        IHttpNegotiate2* This);
+
+    /*** IHttpNegotiate methods ***/
+    HRESULT (STDMETHODCALLTYPE *BeginningTransaction)(
+        IHttpNegotiate2* This,
+        LPCWSTR szURL,
+        LPCWSTR szHeaders,
+        DWORD dwReserved,
+        LPWSTR* pszAdditionalHeaders);
+
+    HRESULT (STDMETHODCALLTYPE *OnResponse)(
+        IHttpNegotiate2* This,
+        DWORD dwResponseCode,
+        LPCWSTR szResponseHeaders,
+        LPCWSTR szRequestHeaders,
+        LPWSTR* pszAdditionalRequestHeaders);
+
+    /*** IHttpNegotiate2 methods ***/
+    HRESULT (STDMETHODCALLTYPE *GetRootSecurityId)(
+        IHttpNegotiate2* This,
+        BYTE* pbSecurityId,
+        DWORD* pcbSecurityId,
+        DWORD_PTR dwReserved);
+
+    END_INTERFACE
+};
+
+#ifdef COBJMACROS
+/*** IUnknown methods ***/
+#define IHttpNegotiate2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IHttpNegotiate2_AddRef(p) (p)->lpVtbl->AddRef(p)
+#define IHttpNegotiate2_Release(p) (p)->lpVtbl->Release(p)
+/*** IHttpNegotiate methods ***/
+#define IHttpNegotiate2_BeginningTransaction(p,a,b,c,d) (p)->lpVtbl->BeginningTransaction(p,a,b,c,d)
+#define IHttpNegotiate2_OnResponse(p,a,b,c,d) (p)->lpVtbl->OnResponse(p,a,b,c,d)
+/*** IHttpNegotiate2 methods ***/
+#define IHttpNegotiate2_GetRootSecurityId(p,a,b,c) (p)->lpVtbl->GetRootSecurityId(p,a,b,c)
+#endif
+
+#endif
+
+HRESULT CALLBACK IHttpNegotiate2_GetRootSecurityId_Proxy(
+    IHttpNegotiate2* This,
+    BYTE* pbSecurityId,
+    DWORD* pcbSecurityId,
+    DWORD_PTR dwReserved);
+void __RPC_STUB IHttpNegotiate2_GetRootSecurityId_Stub(
+    struct IRpcStubBuffer* This,
+    struct IRpcChannelBuffer* pRpcChannelBuffer,
+    PRPC_MESSAGE pRpcMessage,
+    DWORD* pdwStubPhase);
+
+#endif  /* __IHttpNegotiate2_INTERFACE_DEFINED__ */
+
 #define SID_IBindHost IID_IBindHost
 #define SID_SBindHost IID_IBindHost
 #ifndef __IBindHost_FWD_DEFINED__
@@ -642,7 +829,6 @@ typedef struct IBindHost IBindHost;
 #endif
 
 typedef IBindHost *LPBINDHOST;
-
 /*****************************************************************************
  * IBindHost interface
  */
@@ -806,7 +992,6 @@ typedef struct IWinInetInfo IWinInetInfo;
 #endif
 
 typedef IWinInetInfo *LPWININETINFO;
-
 /*****************************************************************************
  * IWinInetInfo interface
  */
@@ -893,7 +1078,6 @@ typedef struct IWinInetHttpInfo IWinInetHttpInfo;
 #endif
 
 typedef IWinInetHttpInfo *LPWININETHTTPINFO;
-
 /*****************************************************************************
  * IWinInetHttpInfo interface
  */
@@ -999,7 +1183,6 @@ typedef struct IPersistMoniker IPersistMoniker;
 #endif
 
 typedef IPersistMoniker *LPPERSISTMONIKER;
-
 /*****************************************************************************
  * IPersistMoniker interface
  */
@@ -1166,12 +1349,10 @@ typedef struct IMonikerProp IMonikerProp;
 #endif
 
 typedef IMonikerProp *LPMONIKERPROP;
-
 typedef enum {
     MIMETYPEPROP = 0x0,
     USE_SRC_URL = 0x1
 } MONIKERPROPERTY;
-
 /*****************************************************************************
  * IMonikerProp interface
  */
@@ -1245,7 +1426,6 @@ typedef struct IInternetBindInfo IInternetBindInfo;
 #endif
 
 typedef IInternetBindInfo *LPIINTERNETBINDINFO;
-
 typedef enum tagBINDSTRING {
     BINDSTRING_HEADERS = 1,
     BINDSTRING_ACCEPT_MIMES,
@@ -1260,9 +1440,11 @@ typedef enum tagBINDSTRING {
     BINDSTRING_ACCEPT_ENCODINGS,
     BINDSTRING_POST_COOKIE,
     BINDSTRING_POST_DATA_MIME,
-    BINDSTRING_URL
+    BINDSTRING_URL,
+    BINDSTRING_IID,
+    BINDSTRING_FLAG_BIND_TO_OBJECT,
+    BINDSTRING_PTR_BIND_CONTEXT
 } BINDSTRING;
-
 /*****************************************************************************
  * IInternetBindInfo interface
  */
@@ -1361,7 +1543,6 @@ typedef struct IInternetPriority IInternetPriority;
 #endif
 
 typedef IInternetPriority *LPIINTERNETPRIORITY;
-
 /*****************************************************************************
  * IInternetPriority interface
  */
@@ -1448,7 +1629,6 @@ typedef struct IInternetProtocolRoot IInternetProtocolRoot;
 #endif
 
 typedef IInternetProtocolRoot *LPIINTERNETPROTOCOLROOT;
-
 typedef enum _tagPI_FLAGS {
     PI_PARSE_URL = 0x1,
     PI_FILTER_MODE = 0x2,
@@ -1462,14 +1642,12 @@ typedef enum _tagPI_FLAGS {
     PI_CLASSINSTALL = 0x200,
     PD_FORCE_SWITCH = 0x10000
 } PI_FLAGS;
-
 typedef struct _tagPROTOCOLDATA {
     DWORD grfFlags;
     DWORD dwState;
     LPVOID pData;
     ULONG cbData;
 } PROTOCOLDATA;
-
 /*****************************************************************************
  * IInternetProtocolRoot interface
  */
@@ -1626,7 +1804,6 @@ void __RPC_STUB IInternetProtocolRoot_Resume_Stub(
 #endif  /* __IInternetProtocolRoot_INTERFACE_DEFINED__ */
 
 typedef IInternetProtocolSink *LPIINTERNETPROTOCOLSINK;
-
 /*****************************************************************************
  * IInternetProtocolSink interface
  */
@@ -1760,7 +1937,6 @@ typedef struct IInternetProtocol IInternetProtocol;
 #endif
 
 typedef IInternetProtocol *LPIINTERNETPROTOCOL;
-
 /*****************************************************************************
  * IInternetProtocol interface
  */
@@ -1924,7 +2100,6 @@ typedef struct IInternetProtocolInfo IInternetProtocolInfo;
 #endif
 
 typedef IInternetProtocolInfo *LPIINTERNETPROTOCOLINFO;
-
 typedef enum _tagPARSEACTION {
     PARSE_CANONICALIZE = 1,
     PARSE_FRIENDLY,
@@ -1946,12 +2121,10 @@ typedef enum _tagPARSEACTION {
     PARSE_ESCAPE,
     PARSE_UNESCAPE
 } PARSEACTION;
-
 typedef enum _tagPSUACTION {
     PSU_DEFAULT = 1,
     PSU_SECURITY_URL_ONLY
 } PSUACTION;
-
 typedef enum _tagQUERYOPTION {
     QUERY_EXPIRATION_DATE = 1,
     QUERY_TIME_OF_LAST_CHANGE,
@@ -1968,7 +2141,6 @@ typedef enum _tagQUERYOPTION {
     QUERY_IS_SECURE,
     QUERY_IS_SAFE
 } QUERYOPTION;
-
 /*****************************************************************************
  * IInternetProtocolInfo interface
  */
@@ -2147,12 +2319,10 @@ typedef struct IInternetSession IInternetSession;
 #endif
 
 typedef IInternetSession *LPIINTERNETSESSION;
-
 typedef enum _tagOIBDG_FLAGS {
     OIBDG_APARTMENTTHREADED = 0x100,
     OIBDG_DATAONLY = 0x1000
 } OIBDG_FLAGS;
-
 /*****************************************************************************
  * IInternetSession interface
  */
@@ -2189,7 +2359,7 @@ struct IInternetSession : public IUnknown
         LPCWSTR szUrl,
         IUnknown* pUnkOuter,
         IUnknown** ppUnk,
-        void** ppOInetProt,
+        IInternetProtocol** ppOInetProt,
         DWORD dwOption) = 0;
 
     virtual HRESULT STDMETHODCALLTYPE SetSessionOption(
@@ -2251,7 +2421,7 @@ struct IInternetSessionVtbl {
         LPCWSTR szUrl,
         IUnknown* pUnkOuter,
         IUnknown** ppUnk,
-        void** ppOInetProt,
+        IInternetProtocol** ppOInetProt,
         DWORD dwOption);
 
     HRESULT (STDMETHODCALLTYPE *SetSessionOption)(
@@ -2327,7 +2497,7 @@ HRESULT CALLBACK IInternetSession_CreateBinding_Proxy(
     LPCWSTR szUrl,
     IUnknown* pUnkOuter,
     IUnknown** ppUnk,
-    void** ppOInetProt,
+    IInternetProtocol** ppOInetProt,
     DWORD dwOption);
 void __RPC_STUB IInternetSession_CreateBinding_Stub(
     struct IRpcStubBuffer* This,
@@ -2448,12 +2618,10 @@ typedef enum {
     PUAF_FORCEUI_FOREGROUND = 0x8,
     PUAF_CHECK_TIPS = 0x10
 } PUAF;
-
 typedef enum {
     SZM_CREATE = 0x0,
     SZM_DELETE = 0x1
 } SZM_FLAGS;
-
 /*****************************************************************************
  * IInternetSecurityManager interface
  */
@@ -2479,7 +2647,7 @@ struct IInternetSecurityManager : public IUnknown
         LPCWSTR pwszUrl,
         BYTE* pbSecurityId,
         DWORD* pcbSecurityId,
-        DWORD dwReserved) = 0;
+        DWORD_PTR dwReserved) = 0;
 
     virtual HRESULT STDMETHODCALLTYPE ProcessUrlAction(
         LPCWSTR pwszUrl,
@@ -2551,7 +2719,7 @@ struct IInternetSecurityManagerVtbl {
         LPCWSTR pwszUrl,
         BYTE* pbSecurityId,
         DWORD* pcbSecurityId,
-        DWORD dwReserved);
+        DWORD_PTR dwReserved);
 
     HRESULT (STDMETHODCALLTYPE *ProcessUrlAction)(
         IInternetSecurityManager* This,
@@ -2638,7 +2806,7 @@ HRESULT CALLBACK IInternetSecurityManager_GetSecurityId_Proxy(
     LPCWSTR pwszUrl,
     BYTE* pbSecurityId,
     DWORD* pcbSecurityId,
-    DWORD dwReserved);
+    DWORD_PTR dwReserved);
 void __RPC_STUB IInternetSecurityManager_GetSecurityId_Stub(
     struct IRpcStubBuffer* This,
     struct IRpcChannelBuffer* pRpcChannelBuffer,
@@ -2702,7 +2870,6 @@ typedef struct IInternetZoneManager IInternetZoneManager;
 #endif
 
 typedef IInternetZoneManager *LPURLZONEMANAGER;
-
 typedef enum tagURLZONE {
     URLZONE_PREDEFINED_MIN = 0,
     URLZONE_LOCAL_MACHINE = 0,
@@ -2714,7 +2881,6 @@ typedef enum tagURLZONE {
     URLZONE_USER_MIN = 1000,
     URLZONE_USER_MAX = 10000
 } URLZONE;
-
 typedef enum tagURLTEMPLATE {
     URLTEMPLATE_CUSTOM = 0x0,
     URLTEMPLATE_PREDEFINED_MIN = 0x10000,
@@ -2723,7 +2889,6 @@ typedef enum tagURLTEMPLATE {
     URLTEMPLATE_HIGH = 0x12000,
     URLTEMPLATE_PREDEFINED_MAX = 0x20000
 } URLTEMPLATE;
-
 typedef enum {
     ZAFLAGS_CUSTOM_EDIT = 0x1,
     ZAFLAGS_ADD_SITES = 0x2,
@@ -2734,7 +2899,6 @@ typedef enum {
     ZAFLAGS_SUPPORTS_VERIFICATION = 0x40,
     ZAFLAGS_UNC_AS_INTRANET = 0x80
 } ZAFLAGS;
-
 enum {
     MAX_ZONE_PATH = 260,
     MAX_ZONE_DESCRIPTION = 200
@@ -2750,13 +2914,11 @@ typedef struct _ZONEATTRIBUTES {
     DWORD dwTemplateCurrentLevel;
     DWORD dwFlags;
 } ZONEATTRIBUTES, *LPZONEATTRIBUTES;
-
 typedef enum _URLZONEREG {
     URLZONEREG_DEFAULT,
     URLZONEREG_HKLM,
     URLZONEREG_HKCU
 } URLZONEREG;
-
 /*****************************************************************************
  * IInternetZoneManager interface
  */
@@ -3105,7 +3267,6 @@ typedef struct _tagSOFTDISTINFO {
     DWORD dwAdvertisedVersionLS;
     DWORD dwReserved;
 } SOFTDISTINFO, *LPSOFTDISTINFO;
-
 typedef struct _tagCODEBASEHOLD {
     DWORD cbSize;
     LPWSTR szDistUnit;
@@ -3114,7 +3275,6 @@ typedef struct _tagCODEBASEHOLD {
     DWORD dwVersionLS;
     DWORD dwStyle;
 } CODEBASEHOLD, *LPCODEBASEHOLD;
-
 #ifndef __ISoftDistExt_FWD_DEFINED__
 #define __ISoftDistExt_FWD_DEFINED__
 typedef struct ISoftDistExt ISoftDistExt;
@@ -3267,35 +3427,37 @@ DEFINE_GUID(CLSID_HttpSProtocol, 0x79EAC9E5, 0xBAF9, 0x11CE, 0x8C,0x82, 0x00,0xA
 DEFINE_GUID(CLSID_MkProtocol, 0x79EAC9E6, 0xBAF9, 0x11CE, 0x8C,0x82, 0x00,0xAA,0x00,0x4B,0xA9,0x0B);
 #define MK_S_ASYNCHRONOUS                0x000401E8
 #define S_ASYNCHRONOUS                   MK_S_ASYNCHRONOUS
-#define INET_E_ERROR_FIRST               0x800C0002L
-#define INET_E_INVALID_URL               0x800C0002L
-#define INET_E_NO_SESSION                0x800C0003L
-#define INET_E_CANNOT_CONNECT            0x800C0004L
-#define INET_E_RESOURCE_NOT_FOUND        0x800C0005L
-#define INET_E_OBJECT_NOT_FOUND          0x800C0006L
-#define INET_E_DATA_NOT_AVAILABLE        0x800C0007L
-#define INET_E_DOWNLOAD_FAILURE          0x800C0008L
-#define INET_E_AUTHENTICATION_REQUIRED   0x800C0009L
-#define INET_E_NO_VALID_MEDIA            0x800C000AL
-#define INET_E_CONNECTION_TIMEOUT        0x800C000BL
-#define INET_E_INVALID_REQUEST           0x800C000CL
-#define INET_E_UNKNOWN_PROTOCOL          0x800C000DL
-#define INET_E_SECURITY_PROBLEM          0x800C000EL
-#define INET_E_CANNOT_LOAD_DATA          0x800C000FL
-#define INET_E_CANNOT_INSTANTIATE_OBJECT 0x800C0010L
-#define INET_E_USE_DEFAULT_PROTOCOLHANDLER 0x800C0011L
-#define INET_E_QUERYOPTION_UNKNOWN       0x800C0013L
-#define INET_E_REDIRECT_FAILED           0x800C0014L
-#define INET_E_REDIRECT_TO_DIR           0x800C0015L
-#define INET_E_CANNOT_LOCK_REQUEST       0x800C0016L
+#define INET_E_ERROR_FIRST               0x800C0002
+#define INET_E_INVALID_URL               0x800C0002
+#define INET_E_NO_SESSION                0x800C0003
+#define INET_E_CANNOT_CONNECT            0x800C0004
+#define INET_E_RESOURCE_NOT_FOUND        0x800C0005
+#define INET_E_OBJECT_NOT_FOUND          0x800C0006
+#define INET_E_DATA_NOT_AVAILABLE        0x800C0007
+#define INET_E_DOWNLOAD_FAILURE          0x800C0008
+#define INET_E_AUTHENTICATION_REQUIRED   0x800C0009
+#define INET_E_NO_VALID_MEDIA            0x800C000A
+#define INET_E_CONNECTION_TIMEOUT        0x800C000B
+#define INET_E_INVALID_REQUEST           0x800C000C
+#define INET_E_UNKNOWN_PROTOCOL          0x800C000D
+#define INET_E_SECURITY_PROBLEM          0x800C000E
+#define INET_E_CANNOT_LOAD_DATA          0x800C000F
+#define INET_E_CANNOT_INSTANTIATE_OBJECT 0x800C0010
+#define INET_E_USE_DEFAULT_PROTOCOLHANDLER 0x800C0011
+#define INET_E_QUERYOPTION_UNKNOWN       0x800C0013
+#define INET_E_REDIRECT_FAILED           0x800C0014
+#define INET_E_REDIRECT_TO_DIR           0x800C0015
+#define INET_E_CANNOT_LOCK_REQUEST       0x800C0016
 #define INET_E_ERROR_LAST                INET_E_REDIRECT_TO_DIR
 #define INET_E_DEFAULT_ACTION            INET_E_USE_DEFAULT_PROTOCOLHANDLER
 HRESULT WINAPI CoGetClassObjectFromURL(REFCLSID, LPCWSTR, DWORD, DWORD, LPCWSTR, LPBINDCTX, DWORD, LPVOID, REFIID, LPVOID*);
 HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk);
 HRESULT WINAPI RegisterBindStatusCallback(IBindCtx *pbc, IBindStatusCallback *pbsc, IBindStatusCallback **ppbsc, DWORD dwReserved);
 HRESULT WINAPI CompareSecurityIds(BYTE*,DWORD,BYTE*,DWORD,DWORD);
-HRESULT WINAPI URLDownloadToFileA(LPUNKNOWN pCaller, LPCSTR szURL,  LPCSTR  szFileName, DWORD dwReserved, LPBINDSTATUSCALLBACK lpfnCB);
-HRESULT WINAPI URLDownloadToFileW(LPUNKNOWN pCaller, LPCWSTR szURL, LPCWSTR szFileName, DWORD dwReserved, LPBINDSTATUSCALLBACK lpfnCB);
+HRESULT WINAPI URLDownloadToFileA(LPUNKNOWN,LPCSTR,LPCSTR,DWORD,LPBINDSTATUSCALLBACK);
+HRESULT WINAPI URLDownloadToFileW(LPUNKNOWN,LPCWSTR,LPCWSTR,DWORD,LPBINDSTATUSCALLBACK);
+HRESULT WINAPI URLDownloadToCacheFileA(LPUNKNOWN,LPCSTR,LPSTR,DWORD,DWORD,LPBINDSTATUSCALLBACK);
+HRESULT WINAPI URLDownloadToCacheFileW(LPUNKNOWN,LPCWSTR,LPWSTR,DWORD,DWORD,LPBINDSTATUSCALLBACK);
 HRESULT WINAPI CoInternetGetSession(DWORD,IInternetSession**,DWORD);
 HRESULT WINAPI MkParseDisplayNameEx(IBindCtx*,LPCWSTR,ULONG*,IMoniker**);
 HRESULT WINAPI IsAsyncMoniker(IMoniker* pmk);
@@ -3307,6 +3469,7 @@ HRESULT WINAPI CoInternetCompareUrl(LPCWSTR,LPCWSTR,DWORD);
 HRESULT WINAPI CoInternetCreateZoneManager(IServiceProvider*, IInternetZoneManager**, DWORD);
 HRESULT WINAPI CoInternetParseUrl(LPCWSTR,PARSEACTION,DWORD,LPWSTR,DWORD,DWORD*,DWORD);
 HRESULT WINAPI CoInternetQueryInfo(LPCWSTR,QUERYOPTION,DWORD,LPVOID,DWORD,DWORD*,DWORD);
+HRESULT WINAPI CreateFormatEnumerator(UINT,FORMATETC*,IEnumFORMATETC**);
 HRESULT WINAPI GetSoftwareUpdateInfo( LPCWSTR szDistUnit, LPSOFTDISTINFO psdi);
 HRESULT WINAPI FaultInIEFeature(HWND,uCLSSPEC*,QUERYCONTEXT*,DWORD);
 HRESULT WINAPI FindMimeFromData(LPBC,LPCWSTR,LPVOID,DWORD,LPCWSTR,DWORD,LPWSTR*,DWORD);
@@ -3318,6 +3481,8 @@ HRESULT WINAPI HlinkSimpleNavigateToMoniker(IMoniker*,LPCWSTR,LPCWSTR,IUnknown*,
 HRESULT WINAPI HlinkSimpleNavigateToString(LPCWSTR,LPCWSTR,LPCWSTR,IUnknown*,IBindCtx*,IBindStatusCallback*,DWORD,DWORD);
 HRESULT WINAPI IsValidURL(LPBC,LPCWSTR,DWORD);
 HRESULT WINAPI ObtainUserAgentString(DWORD,LPSTR,DWORD*);
+HRESULT WINAPI RegisterFormatEnumerator(LPBC,IEnumFORMATETC*,DWORD);
+HRESULT WINAPI RevokeFormatEnumerator(LPBC,IEnumFORMATETC*);
 HRESULT WINAPI RevokeBindStatusCallback(LPBC,IBindStatusCallback*);
 void WINAPI ReleaseBindInfo(BINDINFO*);
 HRESULT WINAPI UrlMkGetSessionOption(DWORD,LPVOID,DWORD,DWORD*,DWORD);
@@ -3326,6 +3491,19 @@ HRESULT WINAPI UrlMkSetSessionOption(DWORD,LPVOID,DWORD,DWORD);
 #define OInetCompareUrl CoInternetCompareUrl
 #define OInetGetSession CoInternetGetSession
 #define MKSYS_URLMONIKER 6
+/* Begin additional prototypes for all interfaces */
+
+unsigned long   __RPC_USER STGMEDIUM_UserSize     (unsigned long *, unsigned long,   STGMEDIUM *);
+unsigned char * __RPC_USER STGMEDIUM_UserMarshal  (unsigned long *, unsigned char *, STGMEDIUM *);
+unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(unsigned long *, unsigned char *, STGMEDIUM *);
+void            __RPC_USER STGMEDIUM_UserFree     (unsigned long *, STGMEDIUM *);
+unsigned long   __RPC_USER HWND_UserSize     (unsigned long *, unsigned long,   HWND *);
+unsigned char * __RPC_USER HWND_UserMarshal  (unsigned long *, unsigned char *, HWND *);
+unsigned char * __RPC_USER HWND_UserUnmarshal(unsigned long *, unsigned char *, HWND *);
+void            __RPC_USER HWND_UserFree     (unsigned long *, HWND *);
+
+/* End additional prototypes */
+
 #ifdef __cplusplus
 }
 #endif