From 00376b5b72c89fb5cbf2a8e326f97bd5315c561c Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 11 May 2009 22:01:05 +0200 Subject: [PATCH] urlmon: Return E_FAIL in Binding::Switch implementation. --- dlls/urlmon/binding.c | 27 ++------------------------- dlls/urlmon/tests/url.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/dlls/urlmon/binding.c b/dlls/urlmon/binding.c index cd843b42e3d..2e07f96a002 100644 --- a/dlls/urlmon/binding.c +++ b/dlls/urlmon/binding.c @@ -1127,37 +1127,14 @@ static ULONG WINAPI InternetProtocolSink_Release(IInternetProtocolSink *iface) return IBinding_Release(BINDING(This)); } -typedef struct { - task_header_t header; - PROTOCOLDATA data; -} switch_task_t; - -static void switch_proc(Binding *binding, task_header_t *t) -{ - switch_task_t *task = (switch_task_t*)t; - - IInternetProtocol_Continue(binding->protocol, &task->data); - - heap_free(task); -} - static HRESULT WINAPI InternetProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData) { Binding *This = PROTSINK_THIS(iface); - switch_task_t *task; - TRACE("(%p)->(%p)\n", This, pProtocolData); + WARN("(%p)->(%p)\n", This, pProtocolData); - task = heap_alloc(sizeof(switch_task_t)); - task->data = *pProtocolData; - - push_task(This, &task->header, switch_proc); - - IBinding_AddRef(BINDING(This)); - PostMessageW(This->notif_hwnd, WM_MK_CONTINUE, 0, (LPARAM)This); - - return S_OK; + return E_FAIL; } typedef struct { diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c index 6d3832edf60..7b9c89fdebf 100644 --- a/dlls/urlmon/tests/url.c +++ b/dlls/urlmon/tests/url.c @@ -324,6 +324,28 @@ static ULONG WINAPI Protocol_Release(IInternetProtocol *iface) return 1; } +static void test_switch_fail(void) +{ + IInternetProtocolSink *binding_sink; + PROTOCOLDATA protocoldata; + HRESULT hres; + + static BOOL tested_switch_fail; + + if(tested_switch_fail) + return; + + tested_switch_fail = TRUE; + + hres = IBinding_QueryInterface(current_binding, &IID_IInternetProtocolSink, (void**)&binding_sink); + ok(hres == S_OK, "Could not get IInternetProtocolSink iface: %08x\n", hres); + if(SUCCEEDED(hres)) { + hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata); + ok(hres == E_FAIL, "Switch failed: %08x, expected E_FAIL\n", hres); + IInternetProtocolSink_Release(binding_sink); + } +} + static DWORD WINAPI thread_proc(PVOID arg) { PROTOCOLDATA protocoldata; @@ -368,6 +390,8 @@ static DWORD WINAPI thread_proc(PVOID arg) else CHECK_CALLED(OnProgress_SENDINGREQUEST); + test_switch_fail(); + SET_EXPECT(Continue); prot_state = 1; hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);