urlmon: Fixed synchronous binding to file.
This commit is contained in:
parent
d5672fee0a
commit
3886d7f805
|
@ -57,7 +57,7 @@ typedef struct _stgmed_obj_t stgmed_obj_t;
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void (*release)(stgmed_obj_t*);
|
void (*release)(stgmed_obj_t*);
|
||||||
HRESULT (*fill_stgmed)(stgmed_obj_t*,STGMEDIUM*);
|
HRESULT (*fill_stgmed)(stgmed_obj_t*,STGMEDIUM*);
|
||||||
void *(*get_result)(stgmed_obj_t*);
|
HRESULT (*get_result)(stgmed_obj_t*,DWORD,void**);
|
||||||
} stgmed_obj_vtbl;
|
} stgmed_obj_vtbl;
|
||||||
|
|
||||||
struct _stgmed_obj_t {
|
struct _stgmed_obj_t {
|
||||||
|
@ -637,12 +637,13 @@ static HRESULT stgmed_stream_fill_stgmed(stgmed_obj_t *obj, STGMEDIUM *stgmed)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *stgmed_stream_get_result(stgmed_obj_t *obj)
|
static HRESULT stgmed_stream_get_result(stgmed_obj_t *obj, DWORD bindf, void **result)
|
||||||
{
|
{
|
||||||
ProtocolStream *stream = (ProtocolStream*)obj;
|
ProtocolStream *stream = (ProtocolStream*)obj;
|
||||||
|
|
||||||
IStream_AddRef(STREAM(stream));
|
IStream_AddRef(STREAM(stream));
|
||||||
return STREAM(stream);
|
*result = STREAM(stream);
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const stgmed_obj_vtbl stgmed_stream_vtbl = {
|
static const stgmed_obj_vtbl stgmed_stream_vtbl = {
|
||||||
|
@ -707,9 +708,9 @@ static HRESULT stgmed_file_fill_stgmed(stgmed_obj_t *obj, STGMEDIUM *stgmed)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *stgmed_file_get_result(stgmed_obj_t *obj)
|
static HRESULT stgmed_file_get_result(stgmed_obj_t *obj, DWORD bindf, void **result)
|
||||||
{
|
{
|
||||||
return NULL;
|
return bindf & BINDF_ASYNCHRONOUS ? MK_S_ASYNCHRONOUS : S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const stgmed_obj_vtbl stgmed_file_vtbl = {
|
static const stgmed_obj_vtbl stgmed_file_vtbl = {
|
||||||
|
@ -1530,12 +1531,14 @@ HRESULT bind_to_storage(LPCWSTR url, IBindCtx *pbc, REFIID riid, void **ppv)
|
||||||
if((binding->state & BINDING_STOPPED) && (binding->state & BINDING_LOCKED))
|
if((binding->state & BINDING_STOPPED) && (binding->state & BINDING_LOCKED))
|
||||||
IInternetProtocol_UnlockRequest(binding->protocol);
|
IInternetProtocol_UnlockRequest(binding->protocol);
|
||||||
|
|
||||||
*ppv = binding->stgmed_obj->vtbl->get_result(binding->stgmed_obj);
|
hres = binding->stgmed_obj->vtbl->get_result(binding->stgmed_obj, binding->bindf, ppv);
|
||||||
|
}else {
|
||||||
|
hres = MK_S_ASYNCHRONOUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
IBinding_Release(BINDING(binding));
|
IBinding_Release(BINDING(binding));
|
||||||
|
|
||||||
return *ppv ? S_OK : MK_S_ASYNCHRONOUS;
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT bind_to_object(IMoniker *mon, LPCWSTR url, IBindCtx *pbc, REFIID riid, void **ppv)
|
HRESULT bind_to_object(IMoniker *mon, LPCWSTR url, IBindCtx *pbc, REFIID riid, void **ppv)
|
||||||
|
|
|
@ -479,7 +479,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
|
||||||
DWORD grfPI, HANDLE_PTR dwReserved)
|
DWORD grfPI, HANDLE_PTR dwReserved)
|
||||||
{
|
{
|
||||||
BINDINFO bindinfo;
|
BINDINFO bindinfo;
|
||||||
DWORD bindf, bscf = BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION;
|
DWORD bind_info, bscf = BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
static const STGMEDIUM stgmed_zero = {0};
|
static const STGMEDIUM stgmed_zero = {0};
|
||||||
|
@ -509,20 +509,21 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
|
||||||
|
|
||||||
memset(&bindinfo, 0, sizeof(bindinfo));
|
memset(&bindinfo, 0, sizeof(bindinfo));
|
||||||
bindinfo.cbSize = sizeof(bindinfo);
|
bindinfo.cbSize = sizeof(bindinfo);
|
||||||
hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
|
hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bind_info, &bindinfo);
|
||||||
ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
|
ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
|
||||||
|
|
||||||
if(filedwl_api) {
|
if(filedwl_api) {
|
||||||
ok(bindf == (BINDF_PULLDATA|BINDF_FROMURLMON|BINDF_NEEDFILE), "bindf=%08x\n", bindf);
|
ok(bind_info == (BINDF_PULLDATA|BINDF_FROMURLMON|BINDF_NEEDFILE), "bind_info=%08x\n", bind_info);
|
||||||
}else if(tymed == TYMED_ISTREAM && is_urlmon_protocol(test_protocol)) {
|
}else if(tymed == TYMED_ISTREAM && is_urlmon_protocol(test_protocol)) {
|
||||||
ok(bindf == (BINDF_ASYNCHRONOUS|BINDF_ASYNCSTORAGE|BINDF_PULLDATA
|
ok(bind_info == (BINDF_ASYNCHRONOUS|BINDF_ASYNCSTORAGE|BINDF_PULLDATA
|
||||||
|BINDF_FROMURLMON),
|
|BINDF_FROMURLMON),
|
||||||
"bindf=%08x\n", bindf);
|
"bind_info=%08x\n", bind_info);
|
||||||
}else {
|
}else if(bindf&BINDF_ASYNCHRONOUS) {
|
||||||
ok(bindf == (BINDF_ASYNCHRONOUS|BINDF_ASYNCSTORAGE|BINDF_PULLDATA
|
ok(bind_info == (BINDF_ASYNCHRONOUS|BINDF_ASYNCSTORAGE|BINDF_PULLDATA
|
||||||
|BINDF_FROMURLMON|BINDF_NEEDFILE),
|
|BINDF_FROMURLMON|BINDF_NEEDFILE),
|
||||||
"bindf=%08x\n", bindf);
|
"bind_info=%08x\n", bind_info);
|
||||||
}
|
}else
|
||||||
|
ok(bind_info == (BINDF_FROMURLMON|BINDF_NEEDFILE), "bind_info=%08x\n", bind_info);
|
||||||
|
|
||||||
ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize = %d\n", bindinfo.cbSize);
|
ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize = %d\n", bindinfo.cbSize);
|
||||||
ok(!bindinfo.szExtraInfo, "bindinfo.szExtraInfo = %p\n", bindinfo.szExtraInfo);
|
ok(!bindinfo.szExtraInfo, "bindinfo.szExtraInfo = %p\n", bindinfo.szExtraInfo);
|
||||||
|
@ -1283,7 +1284,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
|
||||||
todo_wine CHECK_EXPECT(OnProgress_FINDINGRESOURCE);
|
todo_wine CHECK_EXPECT(OnProgress_FINDINGRESOURCE);
|
||||||
else
|
else
|
||||||
CHECK_EXPECT(OnProgress_FINDINGRESOURCE);
|
CHECK_EXPECT(OnProgress_FINDINGRESOURCE);
|
||||||
if((bindf & BINDF_ASYNCHRONOUS) && emulate_protocol)
|
if(emulate_protocol && (test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST))
|
||||||
SetEvent(complete_event);
|
SetEvent(complete_event);
|
||||||
break;
|
break;
|
||||||
case BINDSTATUS_CONNECTING:
|
case BINDSTATUS_CONNECTING:
|
||||||
|
@ -1293,7 +1294,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
|
||||||
todo_wine CHECK_EXPECT(OnProgress_CONNECTING);
|
todo_wine CHECK_EXPECT(OnProgress_CONNECTING);
|
||||||
else
|
else
|
||||||
CHECK_EXPECT(OnProgress_CONNECTING);
|
CHECK_EXPECT(OnProgress_CONNECTING);
|
||||||
if((bindf & BINDF_ASYNCHRONOUS) && emulate_protocol)
|
if(emulate_protocol && (test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST))
|
||||||
SetEvent(complete_event);
|
SetEvent(complete_event);
|
||||||
break;
|
break;
|
||||||
case BINDSTATUS_REDIRECTING:
|
case BINDSTATUS_REDIRECTING:
|
||||||
|
@ -1303,7 +1304,8 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
|
||||||
CHECK_EXPECT(OnProgress_REDIRECTING);
|
CHECK_EXPECT(OnProgress_REDIRECTING);
|
||||||
ok(!lstrcmpW(szStatusText, WINE_ABOUT_URL), "unexpected status text %s\n",
|
ok(!lstrcmpW(szStatusText, WINE_ABOUT_URL), "unexpected status text %s\n",
|
||||||
wine_dbgstr_w(szStatusText));
|
wine_dbgstr_w(szStatusText));
|
||||||
if(!bind_to_object || iface == &objbsc)
|
if(emulate_protocol && (test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
|
||||||
|
&& (!bind_to_object || iface == &objbsc))
|
||||||
SetEvent(complete_event);
|
SetEvent(complete_event);
|
||||||
break;
|
break;
|
||||||
case BINDSTATUS_SENDINGREQUEST:
|
case BINDSTATUS_SENDINGREQUEST:
|
||||||
|
@ -1313,7 +1315,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
|
||||||
CHECK_EXPECT2(OnProgress_SENDINGREQUEST);
|
CHECK_EXPECT2(OnProgress_SENDINGREQUEST);
|
||||||
else
|
else
|
||||||
CHECK_EXPECT(OnProgress_SENDINGREQUEST);
|
CHECK_EXPECT(OnProgress_SENDINGREQUEST);
|
||||||
if((bindf & BINDF_ASYNCHRONOUS) && emulate_protocol)
|
if(emulate_protocol && (test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST))
|
||||||
SetEvent(complete_event);
|
SetEvent(complete_event);
|
||||||
break;
|
break;
|
||||||
case BINDSTATUS_MIMETYPEAVAILABLE:
|
case BINDSTATUS_MIMETYPEAVAILABLE:
|
||||||
|
@ -2353,7 +2355,10 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(((bindf & BINDF_ASYNCHRONOUS) && !data_available)
|
if(!(bindf & BINDF_ASYNCHRONOUS) && tymed == TYMED_FILE) {
|
||||||
|
ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres);
|
||||||
|
ok(unk == NULL, "unk != NULL\n");
|
||||||
|
}else if(((bindf & BINDF_ASYNCHRONOUS) && !data_available)
|
||||||
|| (tymed == TYMED_FILE && test_protocol == FILE_TEST)) {
|
|| (tymed == TYMED_FILE && test_protocol == FILE_TEST)) {
|
||||||
ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToStorage failed: %08x\n", hres);
|
ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToStorage failed: %08x\n", hres);
|
||||||
ok(unk == NULL, "istr should be NULL\n");
|
ok(unk == NULL, "istr should be NULL\n");
|
||||||
|
@ -2906,12 +2911,18 @@ START_TEST(url)
|
||||||
trace("synchronous http test...\n");
|
trace("synchronous http test...\n");
|
||||||
test_BindToStorage(HTTP_TEST, 0, TYMED_ISTREAM);
|
test_BindToStorage(HTTP_TEST, 0, TYMED_ISTREAM);
|
||||||
|
|
||||||
|
trace("emulated synchronous http test (to file)...\n");
|
||||||
|
test_BindToStorage(HTTP_TEST, BINDTEST_EMULATE, TYMED_FILE);
|
||||||
|
|
||||||
trace("synchronous http test (to object)...\n");
|
trace("synchronous http test (to object)...\n");
|
||||||
test_BindToObject(HTTP_TEST, 0);
|
test_BindToObject(HTTP_TEST, 0);
|
||||||
|
|
||||||
trace("synchronous file test...\n");
|
trace("synchronous file test...\n");
|
||||||
test_BindToStorage(FILE_TEST, 0, TYMED_ISTREAM);
|
test_BindToStorage(FILE_TEST, 0, TYMED_ISTREAM);
|
||||||
|
|
||||||
|
trace("emulated synchronous file test (to file)...\n");
|
||||||
|
test_BindToStorage(FILE_TEST, BINDTEST_EMULATE, TYMED_FILE);
|
||||||
|
|
||||||
trace("synchronous file test (to object)...\n");
|
trace("synchronous file test (to object)...\n");
|
||||||
test_BindToObject(FILE_TEST, 0);
|
test_BindToObject(FILE_TEST, 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue