Commit e18e6ba3 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Use pluggable protocol for ftp binding.

parent ad4a21bc
...@@ -532,8 +532,6 @@ static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName, IBindCtx* pbc, ...@@ -532,8 +532,6 @@ static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName, IBindCtx* pbc,
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
URL_COMPONENTSW url; URL_COMPONENTSW url;
WCHAR *host, *path, *user, *pass; WCHAR *host, *path, *user, *pass;
DWORD dwService = 0;
BOOL bSuccess;
TRACE("got bindinfo. bindf = %08x extrainfo = %s bindinfof = %08x bindverb = %08x iid %s\n", TRACE("got bindinfo. bindf = %08x extrainfo = %s bindinfof = %08x bindverb = %08x iid %s\n",
bindf, debugstr_w(bi.szExtraInfo), bi.grfBindInfoF, bi.dwBindVerb, debugstr_guid(&bi.iid)); bindf, debugstr_w(bi.szExtraInfo), bi.grfBindInfoF, bi.dwBindVerb, debugstr_guid(&bi.iid));
...@@ -583,23 +581,10 @@ static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName, IBindCtx* pbc, ...@@ -583,23 +581,10 @@ static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName, IBindCtx* pbc,
break; break;
} }
switch ((DWORD) url.nScheme) if (!url.nPort)
{ url.nPort = INTERNET_DEFAULT_GOPHER_PORT;
case INTERNET_SCHEME_FTP:
if (!url.nPort)
url.nPort = INTERNET_DEFAULT_FTP_PORT;
dwService = INTERNET_SERVICE_FTP;
break;
case INTERNET_SCHEME_GOPHER:
if (!url.nPort)
url.nPort = INTERNET_DEFAULT_GOPHER_PORT;
dwService = INTERNET_SERVICE_GOPHER;
break;
}
bind->hconnect = InternetConnectW(bind->hinternet, host, url.nPort, user, pass, bind->hconnect = InternetConnectW(bind->hinternet, host, url.nPort, user, pass,
dwService, 0, (DWORD_PTR)bind); INTERNET_SERVICE_GOPHER, 0, (DWORD_PTR)bind);
if (!bind->hconnect) if (!bind->hconnect)
{ {
hres = HRESULT_FROM_WIN32(GetLastError()); hres = HRESULT_FROM_WIN32(GetLastError());
...@@ -612,37 +597,12 @@ static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName, IBindCtx* pbc, ...@@ -612,37 +597,12 @@ static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName, IBindCtx* pbc,
hres = IBindStatusCallback_OnProgress(bind->pbscb, 0, 0, BINDSTATUS_CONNECTING, NULL); hres = IBindStatusCallback_OnProgress(bind->pbscb, 0, 0, BINDSTATUS_CONNECTING, NULL);
hres = IBindStatusCallback_OnProgress(bind->pbscb, 0, 0, BINDSTATUS_SENDINGREQUEST, NULL); hres = IBindStatusCallback_OnProgress(bind->pbscb, 0, 0, BINDSTATUS_SENDINGREQUEST, NULL);
bSuccess = FALSE; bind->hrequest = GopherOpenFileW(bind->hconnect,
path,
switch (dwService) 0,
{ INTERNET_FLAG_RELOAD,
case INTERNET_SERVICE_GOPHER: 0);
bind->hrequest = GopherOpenFileW(bind->hconnect, if (bind->hrequest)
path,
0,
INTERNET_FLAG_RELOAD,
0);
if (bind->hrequest)
bSuccess = TRUE;
else
hres = HRESULT_FROM_WIN32(GetLastError());
break;
case INTERNET_SERVICE_FTP:
bind->hrequest = FtpOpenFileW(bind->hconnect,
path,
GENERIC_READ,
FTP_TRANSFER_TYPE_BINARY |
INTERNET_FLAG_TRANSFER_BINARY |
INTERNET_FLAG_RELOAD,
0);
if (bind->hrequest)
bSuccess = TRUE;
else
hres = HRESULT_FROM_WIN32(GetLastError());
break;
}
if(bSuccess)
{ {
TRACE("res = %d gle = %u url len = %d\n", hres, GetLastError(), bind->expected_size); TRACE("res = %d gle = %u url len = %d\n", hres, GetLastError(), bind->expected_size);
...@@ -660,7 +620,10 @@ static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName, IBindCtx* pbc, ...@@ -660,7 +620,10 @@ static HRESULT URLMonikerImpl_BindToStorage_hack(LPCWSTR URLName, IBindCtx* pbc,
} }
InternetCloseHandle(bind->hrequest); InternetCloseHandle(bind->hrequest);
hres = S_OK; hres = S_OK;
}else {
hres = HRESULT_FROM_WIN32(GetLastError());
} }
InternetCloseHandle(bind->hconnect); InternetCloseHandle(bind->hconnect);
InternetCloseHandle(bind->hinternet); InternetCloseHandle(bind->hinternet);
...@@ -704,9 +667,7 @@ static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface, ...@@ -704,9 +667,7 @@ static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,
return E_FAIL; return E_FAIL;
} }
if(IsEqualGUID(&IID_IStream, riid) && if(IsEqualGUID(&IID_IStream, riid) && url.nScheme == INTERNET_SCHEME_GOPHER)
( url.nScheme == INTERNET_SCHEME_FTP
|| url.nScheme == INTERNET_SCHEME_GOPHER))
return URLMonikerImpl_BindToStorage_hack(This->URLName, pbc, ppvObject); return URLMonikerImpl_BindToStorage_hack(This->URLName, pbc, ppvObject);
TRACE("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObject); TRACE("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObject);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment