Jacek Caban : urlmon: Added IInternetPriority implementation for gopher protocol.

Alexandre Julliard julliard at winehq.org
Thu Mar 5 10:31:00 CST 2009


Module: wine
Branch: master
Commit: 44149b8a8c209ebf28a141db23f666caf95a8c80
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=44149b8a8c209ebf28a141db23f666caf95a8c80

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Mar  4 19:07:05 2009 +0100

urlmon: Added IInternetPriority implementation for gopher protocol.

---

 dlls/urlmon/gopher.c         |   58 ++++++++++++++++++++++++++++++++++++++++++
 dlls/urlmon/tests/protocol.c |    2 +
 2 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/dlls/urlmon/gopher.c b/dlls/urlmon/gopher.c
index d34ef5c..6614a6d 100644
--- a/dlls/urlmon/gopher.c
+++ b/dlls/urlmon/gopher.c
@@ -22,12 +22,16 @@
 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
 
 typedef struct {
+    Protocol base;
+
     const IInternetProtocolVtbl  *lpInternetProtocolVtbl;
+    const IInternetPriorityVtbl  *lpInternetPriorityVtbl;
 
     LONG ref;
 } GopherProtocol;
 
 #define PROTOCOL(x)  ((IInternetProtocol*)  &(x)->lpInternetProtocolVtbl)
+#define PRIORITY(x)  ((IInternetPriority*)  &(x)->lpInternetPriorityVtbl)
 
 #define PROTOCOL_THIS(iface) DEFINE_THIS(GopherProtocol, InternetProtocol, iface)
 
@@ -45,6 +49,9 @@ static HRESULT WINAPI GopherProtocol_QueryInterface(IInternetProtocol *iface, RE
     }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) {
@@ -174,6 +181,56 @@ static const IInternetProtocolVtbl GopherProtocolVtbl = {
     GopherProtocol_UnlockRequest
 };
 
+#define PRIORITY_THIS(iface) DEFINE_THIS(GopherProtocol, InternetPriority, iface)
+
+static HRESULT WINAPI GopherPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv)
+{
+    GopherProtocol *This = PRIORITY_THIS(iface);
+    return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv);
+}
+
+static ULONG WINAPI GopherPriority_AddRef(IInternetPriority *iface)
+{
+    GopherProtocol *This = PRIORITY_THIS(iface);
+    return IInternetProtocol_AddRef(PROTOCOL(This));
+}
+
+static ULONG WINAPI GopherPriority_Release(IInternetPriority *iface)
+{
+    GopherProtocol *This = PRIORITY_THIS(iface);
+    return IInternetProtocol_Release(PROTOCOL(This));
+}
+
+static HRESULT WINAPI GopherPriority_SetPriority(IInternetPriority *iface, LONG nPriority)
+{
+    GopherProtocol *This = PRIORITY_THIS(iface);
+
+    TRACE("(%p)->(%d)\n", This, nPriority);
+
+    This->base.priority = nPriority;
+    return S_OK;
+}
+
+static HRESULT WINAPI GopherPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority)
+{
+    GopherProtocol *This = PRIORITY_THIS(iface);
+
+    TRACE("(%p)->(%p)\n", This, pnPriority);
+
+    *pnPriority = This->base.priority;
+    return S_OK;
+}
+
+#undef PRIORITY_THIS
+
+static const IInternetPriorityVtbl GopherPriorityVtbl = {
+    GopherPriority_QueryInterface,
+    GopherPriority_AddRef,
+    GopherPriority_Release,
+    GopherPriority_SetPriority,
+    GopherPriority_GetPriority
+};
+
 HRESULT GopherProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
 {
     GopherProtocol *ret;
@@ -185,6 +242,7 @@ HRESULT GopherProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
     ret = heap_alloc_zero(sizeof(GopherProtocol));
 
     ret->lpInternetProtocolVtbl = &GopherProtocolVtbl;
+    ret->lpInternetPriorityVtbl = &GopherPriorityVtbl;
     ret->ref = 1;
 
     *ppobj = PROTOCOL(ret);
diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c
index 9759df6..c9c42e8 100644
--- a/dlls/urlmon/tests/protocol.c
+++ b/dlls/urlmon/tests/protocol.c
@@ -1872,6 +1872,8 @@ static void test_gopher_protocol(void)
     IClassFactory_Release(factory);
     ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
 
+    test_priority(async_protocol);
+
     IInternetProtocol_Release(async_protocol);
 }
 




More information about the wine-cvs mailing list