Module: wine Branch: master Commit: 42dda83b3fd6adb34da9760eac45872adc9e4122 URL: http://source.winehq.org/git/wine.git/?a=commit;h=42dda83b3fd6adb34da9760eac...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Feb 6 20:49:02 2007 +0100
itss: Allow reading from ReportData call.
---
dlls/itss/protocol.c | 8 ++++---- dlls/itss/tests/protocol.c | 26 ++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/dlls/itss/protocol.c b/dlls/itss/protocol.c index 51fad3c..2d7cd98 100644 --- a/dlls/itss/protocol.c +++ b/dlls/itss/protocol.c @@ -195,6 +195,10 @@ static HRESULT WINAPI ITSProtocol_Start( CoTaskMemFree(mime); }
+ release_chm(This); /* Native leaks handle here */ + This->chm_file = chm_file; + memcpy(&This->chm_object, &chm_object, sizeof(chm_object)); + hres = IInternetProtocolSink_ReportData(pOIProtSink, BSCF_FIRSTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE, chm_object.length, chm_object.length); @@ -206,10 +210,6 @@ static HRESULT WINAPI ITSProtocol_Start(
hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_BEGINDOWNLOADDATA, NULL);
- release_chm(This); /* Native leaks handle here */ - This->chm_file = chm_file; - memcpy(&This->chm_object, &chm_object, sizeof(chm_object)); - return report_result(pOIProtSink, hres); }
diff --git a/dlls/itss/tests/protocol.c b/dlls/itss/tests/protocol.c index 4b594b2..70f22b9 100644 --- a/dlls/itss/tests/protocol.c +++ b/dlls/itss/tests/protocol.c @@ -66,6 +66,7 @@ DEFINE_EXPECT(ReportData); DEFINE_EXPECT(ReportResult);
static HRESULT expect_hrResult; +static IInternetProtocol *read_protocol = NULL;
static enum { ITS_PROTOCOL, @@ -148,11 +149,22 @@ static HRESULT WINAPI ProtocolSink_Repor else ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION), "grcf = %08x\n", grfBSCF);
+ if(read_protocol) { + BYTE buf[100]; + DWORD cb = 0xdeadbeef; + HRESULT hres; + + hres = IInternetProtocol_Read(read_protocol, buf, sizeof(buf), &cb); + ok(hres == S_OK, "Read failed: %08x\n", hres); + ok(cb == 13, "cb=%u expected 13\n", cb); + ok(!memcmp(buf, "<html></html>", 13), "unexpected data\n"); + } + return S_OK; }
-static HRESULT WINAPI ProtocolSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, - LPCWSTR szResult) +static HRESULT WINAPI ProtocolSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, + DWORD dwError, LPCWSTR szResult) { CHECK_EXPECT(ReportResult);
@@ -365,6 +377,16 @@ static void test_protocol_url(IClassFact ok(cb == 2, "cb=%u expected 2\n", cb); ref = IInternetProtocol_Release(protocol); ok(!ref, "protocol ref=%d\n", ref); + + hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&read_protocol); + ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres); + if(FAILED(hres)) + return; + + protocol_start(read_protocol, url); + ref = IInternetProtocol_Release(read_protocol); + ok(!ref, "protocol ref=%d\n", ref); + read_protocol = NULL; }
static void test_its_protocol(void)