Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9f2ede8d
Commit
9f2ede8d
authored
Oct 06, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 07, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Added IInternetProtocolEx support to ftp protocol handler.
parent
72c8b283
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
34 deletions
+66
-34
ftp.c
dlls/urlmon/ftp.c
+58
-34
protocol.c
dlls/urlmon/tests/protocol.c
+8
-0
No files found.
dlls/urlmon/ftp.c
View file @
9f2ede8d
...
...
@@ -17,6 +17,10 @@
*/
#include "urlmon_main.h"
#define NO_SHLWAPI_REG
#include "shlwapi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
urlmon
);
...
...
@@ -24,13 +28,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
typedef
struct
{
Protocol
base
;
const
IInternetProtocol
Vtbl
*
lpIInternetProtocol
Vtbl
;
const
IInternetProtocol
ExVtbl
*
lpIInternetProtocolEx
Vtbl
;
const
IInternetPriorityVtbl
*
lpInternetPriorityVtbl
;
const
IWinInetHttpInfoVtbl
*
lpWinInetHttpInfoVtbl
;
LONG
ref
;
}
FtpProtocol
;
#define PROTOCOLEX(x) ((IInternetProtocolEx*)&(x)->lpIInternetProtocolExVtbl)
#define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl)
#define INETHTTPINFO(x) ((IWinInetHttpInfo*) &(x)->lpWinInetHttpInfoVtbl)
...
...
@@ -92,22 +97,25 @@ static const ProtocolVtbl AsyncProtocolVtbl = {
FtpProtocol_close_connection
};
#define PROTOCOL_THIS(iface) DEFINE_THIS(FtpProtocol, IInternetProtocol, iface)
#define PROTOCOL_THIS(iface) DEFINE_THIS(FtpProtocol, IInternetProtocol
Ex
, iface)
static
HRESULT
WINAPI
FtpProtocol_QueryInterface
(
IInternetProtocol
*
iface
,
REFIID
riid
,
void
**
ppv
)
static
HRESULT
WINAPI
FtpProtocol_QueryInterface
(
IInternetProtocol
Ex
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
FtpProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
*
ppv
=
NULL
;
if
(
IsEqualGUID
(
&
IID_IUnknown
,
riid
))
{
TRACE
(
"(%p)->(IID_IUnknown %p)
\n
"
,
This
,
ppv
);
*
ppv
=
PROTOCOL
(
This
);
*
ppv
=
PROTOCOL
EX
(
This
);
}
else
if
(
IsEqualGUID
(
&
IID_IInternetProtocolRoot
,
riid
))
{
TRACE
(
"(%p)->(IID_IInternetProtocolRoot %p)
\n
"
,
This
,
ppv
);
*
ppv
=
PROTOCOL
(
This
);
*
ppv
=
PROTOCOL
EX
(
This
);
}
else
if
(
IsEqualGUID
(
&
IID_IInternetProtocol
,
riid
))
{
TRACE
(
"(%p)->(IID_IInternetProtocol %p)
\n
"
,
This
,
ppv
);
*
ppv
=
PROTOCOL
(
This
);
*
ppv
=
PROTOCOLEX
(
This
);
}
else
if
(
IsEqualGUID
(
&
IID_IInternetProtocolEx
,
riid
))
{
TRACE
(
"(%p)->(IID_IInternetProtocolEx %p)
\n
"
,
This
,
ppv
);
*
ppv
=
PROTOCOLEX
(
This
);
}
else
if
(
IsEqualGUID
(
&
IID_IInternetPriority
,
riid
))
{
TRACE
(
"(%p)->(IID_IInternetPriority %p)
\n
"
,
This
,
ppv
);
*
ppv
=
PRIORITY
(
This
);
...
...
@@ -128,7 +136,7 @@ static HRESULT WINAPI FtpProtocol_QueryInterface(IInternetProtocol *iface, REFII
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
FtpProtocol_AddRef
(
IInternetProtocol
*
iface
)
static
ULONG
WINAPI
FtpProtocol_AddRef
(
IInternetProtocol
Ex
*
iface
)
{
FtpProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
LONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
...
...
@@ -136,7 +144,7 @@ static ULONG WINAPI FtpProtocol_AddRef(IInternetProtocol *iface)
return
ref
;
}
static
ULONG
WINAPI
FtpProtocol_Release
(
IInternetProtocol
*
iface
)
static
ULONG
WINAPI
FtpProtocol_Release
(
IInternetProtocol
Ex
*
iface
)
{
FtpProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
LONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
...
...
@@ -153,7 +161,7 @@ static ULONG WINAPI FtpProtocol_Release(IInternetProtocol *iface)
return
ref
;
}
static
HRESULT
WINAPI
FtpProtocol_Start
(
IInternetProtocol
*
iface
,
LPCWSTR
szUrl
,
static
HRESULT
WINAPI
FtpProtocol_Start
(
IInternetProtocol
Ex
*
iface
,
LPCWSTR
szUrl
,
IInternetProtocolSink
*
pOIProtSink
,
IInternetBindInfo
*
pOIBindInfo
,
DWORD
grfPI
,
HANDLE_PTR
dwReserved
)
{
...
...
@@ -161,25 +169,21 @@ static HRESULT WINAPI FtpProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
IUri
*
uri
;
HRESULT
hres
;
static
const
WCHAR
ftpW
[]
=
{
'f'
,
't'
,
'p'
,
':'
};
TRACE
(
"(%p)->(%s %p %p %08x %lx)
\n
"
,
This
,
debugstr_w
(
szUrl
),
pOIProtSink
,
pOIBindInfo
,
grfPI
,
dwReserved
);
if
(
strncmpW
(
szUrl
,
ftpW
,
sizeof
(
ftpW
)
/
sizeof
(
WCHAR
)))
return
MK_E_SYNTAX
;
hres
=
CreateUri
(
szUrl
,
0
,
0
,
&
uri
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
protocol_start
(
&
This
->
base
,
PROTOCOL
(
This
),
uri
,
pOIProtSink
,
pOIBindInfo
);
hres
=
IInternetProtocolEx_StartEx
(
PROTOCOLEX
(
This
),
uri
,
pOIProtSink
,
pOIBindInfo
,
grfPI
,
(
HANDLE
*
)
dwReserved
);
IUri_Release
(
uri
);
return
hres
;
}
static
HRESULT
WINAPI
FtpProtocol_Continue
(
IInternetProtocol
*
iface
,
PROTOCOLDATA
*
pProtocolData
)
static
HRESULT
WINAPI
FtpProtocol_Continue
(
IInternetProtocol
Ex
*
iface
,
PROTOCOLDATA
*
pProtocolData
)
{
FtpProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
...
...
@@ -188,7 +192,7 @@ static HRESULT WINAPI FtpProtocol_Continue(IInternetProtocol *iface, PROTOCOLDAT
return
protocol_continue
(
&
This
->
base
,
pProtocolData
);
}
static
HRESULT
WINAPI
FtpProtocol_Abort
(
IInternetProtocol
*
iface
,
HRESULT
hrReason
,
static
HRESULT
WINAPI
FtpProtocol_Abort
(
IInternetProtocol
Ex
*
iface
,
HRESULT
hrReason
,
DWORD
dwOptions
)
{
FtpProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
...
...
@@ -198,7 +202,7 @@ static HRESULT WINAPI FtpProtocol_Abort(IInternetProtocol *iface, HRESULT hrReas
return
protocol_abort
(
&
This
->
base
,
hrReason
);
}
static
HRESULT
WINAPI
FtpProtocol_Terminate
(
IInternetProtocol
*
iface
,
DWORD
dwOptions
)
static
HRESULT
WINAPI
FtpProtocol_Terminate
(
IInternetProtocol
Ex
*
iface
,
DWORD
dwOptions
)
{
FtpProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
...
...
@@ -208,21 +212,21 @@ static HRESULT WINAPI FtpProtocol_Terminate(IInternetProtocol *iface, DWORD dwOp
return
S_OK
;
}
static
HRESULT
WINAPI
FtpProtocol_Suspend
(
IInternetProtocol
*
iface
)
static
HRESULT
WINAPI
FtpProtocol_Suspend
(
IInternetProtocol
Ex
*
iface
)
{
FtpProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
FIXME
(
"(%p)
\n
"
,
This
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
FtpProtocol_Resume
(
IInternetProtocol
*
iface
)
static
HRESULT
WINAPI
FtpProtocol_Resume
(
IInternetProtocol
Ex
*
iface
)
{
FtpProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
FIXME
(
"(%p)
\n
"
,
This
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
FtpProtocol_Read
(
IInternetProtocol
*
iface
,
void
*
pv
,
static
HRESULT
WINAPI
FtpProtocol_Read
(
IInternetProtocol
Ex
*
iface
,
void
*
pv
,
ULONG
cb
,
ULONG
*
pcbRead
)
{
FtpProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
...
...
@@ -232,7 +236,7 @@ static HRESULT WINAPI FtpProtocol_Read(IInternetProtocol *iface, void *pv,
return
protocol_read
(
&
This
->
base
,
pv
,
cb
,
pcbRead
);
}
static
HRESULT
WINAPI
FtpProtocol_Seek
(
IInternetProtocol
*
iface
,
LARGE_INTEGER
dlibMove
,
static
HRESULT
WINAPI
FtpProtocol_Seek
(
IInternetProtocol
Ex
*
iface
,
LARGE_INTEGER
dlibMove
,
DWORD
dwOrigin
,
ULARGE_INTEGER
*
plibNewPosition
)
{
FtpProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
...
...
@@ -240,7 +244,7 @@ static HRESULT WINAPI FtpProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER d
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
FtpProtocol_LockRequest
(
IInternetProtocol
*
iface
,
DWORD
dwOptions
)
static
HRESULT
WINAPI
FtpProtocol_LockRequest
(
IInternetProtocol
Ex
*
iface
,
DWORD
dwOptions
)
{
FtpProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
...
...
@@ -249,7 +253,7 @@ static HRESULT WINAPI FtpProtocol_LockRequest(IInternetProtocol *iface, DWORD dw
return
protocol_lock_request
(
&
This
->
base
);
}
static
HRESULT
WINAPI
FtpProtocol_UnlockRequest
(
IInternetProtocol
*
iface
)
static
HRESULT
WINAPI
FtpProtocol_UnlockRequest
(
IInternetProtocol
Ex
*
iface
)
{
FtpProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
...
...
@@ -258,9 +262,28 @@ static HRESULT WINAPI FtpProtocol_UnlockRequest(IInternetProtocol *iface)
return
protocol_unlock_request
(
&
This
->
base
);
}
static
HRESULT
WINAPI
FtpProtocol_StartEx
(
IInternetProtocolEx
*
iface
,
IUri
*
pUri
,
IInternetProtocolSink
*
pOIProtSink
,
IInternetBindInfo
*
pOIBindInfo
,
DWORD
grfPI
,
HANDLE
*
dwReserved
)
{
FtpProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
DWORD
scheme
=
0
;
HRESULT
hres
;
TRACE
(
"(%p)->(%p %p %p %08x %p)
\n
"
,
This
,
pUri
,
pOIProtSink
,
pOIBindInfo
,
grfPI
,
dwReserved
);
hres
=
IUri_GetScheme
(
pUri
,
&
scheme
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
scheme
!=
URL_SCHEME_FTP
)
return
MK_E_SYNTAX
;
return
protocol_start
(
&
This
->
base
,
(
IInternetProtocol
*
)
PROTOCOLEX
(
This
),
pUri
,
pOIProtSink
,
pOIBindInfo
);
}
#undef PROTOCOL_THIS
static
const
IInternetProtocolVtbl
FtpProtocolVtbl
=
{
static
const
IInternetProtocol
Ex
Vtbl
FtpProtocolVtbl
=
{
FtpProtocol_QueryInterface
,
FtpProtocol_AddRef
,
FtpProtocol_Release
,
...
...
@@ -273,7 +296,8 @@ static const IInternetProtocolVtbl FtpProtocolVtbl = {
FtpProtocol_Read
,
FtpProtocol_Seek
,
FtpProtocol_LockRequest
,
FtpProtocol_UnlockRequest
FtpProtocol_UnlockRequest
,
FtpProtocol_StartEx
};
#define PRIORITY_THIS(iface) DEFINE_THIS(FtpProtocol, InternetPriority, iface)
...
...
@@ -281,19 +305,19 @@ static const IInternetProtocolVtbl FtpProtocolVtbl = {
static
HRESULT
WINAPI
FtpPriority_QueryInterface
(
IInternetPriority
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
FtpProtocol
*
This
=
PRIORITY_THIS
(
iface
);
return
IInternetProtocol
_QueryInterface
(
PROTOCOL
(
This
),
riid
,
ppv
);
return
IInternetProtocol
Ex_QueryInterface
(
PROTOCOLEX
(
This
),
riid
,
ppv
);
}
static
ULONG
WINAPI
FtpPriority_AddRef
(
IInternetPriority
*
iface
)
{
FtpProtocol
*
This
=
PRIORITY_THIS
(
iface
);
return
IInternetProtocol
_AddRef
(
PROTOCOL
(
This
));
return
IInternetProtocol
Ex_AddRef
(
PROTOCOLEX
(
This
));
}
static
ULONG
WINAPI
FtpPriority_Release
(
IInternetPriority
*
iface
)
{
FtpProtocol
*
This
=
PRIORITY_THIS
(
iface
);
return
IInternetProtocol
_Release
(
PROTOCOL
(
This
));
return
IInternetProtocol
Ex_Release
(
PROTOCOLEX
(
This
));
}
static
HRESULT
WINAPI
FtpPriority_SetPriority
(
IInternetPriority
*
iface
,
LONG
nPriority
)
...
...
@@ -331,19 +355,19 @@ static const IInternetPriorityVtbl FtpPriorityVtbl = {
static
HRESULT
WINAPI
HttpInfo_QueryInterface
(
IWinInetHttpInfo
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
FtpProtocol
*
This
=
INETINFO_THIS
(
iface
);
return
I
Binding_QueryInterface
(
PROTOCOL
(
This
),
riid
,
ppv
);
return
I
InternetProtocolEx_QueryInterface
(
PROTOCOLEX
(
This
),
riid
,
ppv
);
}
static
ULONG
WINAPI
HttpInfo_AddRef
(
IWinInetHttpInfo
*
iface
)
{
FtpProtocol
*
This
=
INETINFO_THIS
(
iface
);
return
I
Binding_AddRef
(
PROTOCOL
(
This
));
return
I
InternetProtocolEx_AddRef
(
PROTOCOLEX
(
This
));
}
static
ULONG
WINAPI
HttpInfo_Release
(
IWinInetHttpInfo
*
iface
)
{
FtpProtocol
*
This
=
INETINFO_THIS
(
iface
);
return
I
Binding_Release
(
PROTOCOL
(
This
));
return
I
InternetProtocolEx_Release
(
PROTOCOLEX
(
This
));
}
static
HRESULT
WINAPI
HttpInfo_QueryOption
(
IWinInetHttpInfo
*
iface
,
DWORD
dwOption
,
...
...
@@ -383,12 +407,12 @@ HRESULT FtpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
ret
=
heap_alloc_zero
(
sizeof
(
FtpProtocol
));
ret
->
base
.
vtbl
=
&
AsyncProtocolVtbl
;
ret
->
lpIInternetProtocolVtbl
=
&
FtpProtocolVtbl
;
ret
->
lpIInternetProtocol
Ex
Vtbl
=
&
FtpProtocolVtbl
;
ret
->
lpInternetPriorityVtbl
=
&
FtpPriorityVtbl
;
ret
->
lpWinInetHttpInfoVtbl
=
&
WinInetHttpInfoVtbl
;
ret
->
ref
=
1
;
*
ppobj
=
PROTOCOL
(
ret
);
*
ppobj
=
PROTOCOL
EX
(
ret
);
return
S_OK
;
}
dlls/urlmon/tests/protocol.c
View file @
9f2ede8d
...
...
@@ -2958,6 +2958,14 @@ static void test_ftp_protocol(void)
test_protocol_terminate
(
async_protocol
);
if
(
pCreateUri
)
{
IInternetProtocolEx
*
protocolex
;
hres
=
IInternetProtocol_QueryInterface
(
async_protocol
,
&
IID_IInternetProtocolEx
,
(
void
**
)
&
protocolex
);
ok
(
hres
==
S_OK
,
"Could not get IInternetProtocolEx iface: %08x
\n
"
,
hres
);
IInternetProtocolEx_Release
(
protocolex
);
}
ref
=
IInternetProtocol_Release
(
async_protocol
);
ok
(
!
ref
,
"ref=%d
\n
"
,
ref
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment