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
9debcb8f
Commit
9debcb8f
authored
Aug 03, 2007
by
Rob Shearman
Committed by
Alexandre Julliard
Aug 08, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Implement URLOpenBlockingStreamA/W and URLOpenStreamA/W.
parent
25b2bff9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
227 additions
and
14 deletions
+227
-14
umstream.c
dlls/urlmon/umstream.c
+227
-14
No files found.
dlls/urlmon/umstream.c
View file @
9debcb8f
...
...
@@ -379,6 +379,173 @@ static const IStreamVtbl stvt =
};
typedef
struct
ProxyBindStatusCallback
{
const
IBindStatusCallbackVtbl
*
lpVtbl
;
IBindStatusCallback
*
pBSC
;
}
ProxyBindStatusCallback
;
static
HRESULT
WINAPI
ProxyBindStatusCallback_QueryInterface
(
IBindStatusCallback
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
if
(
IsEqualGUID
(
&
IID_IBindStatusCallback
,
riid
)
||
IsEqualGUID
(
&
IID_IUnknown
,
riid
))
{
*
ppv
=
iface
;
IUnknown_AddRef
(
iface
);
return
S_OK
;
}
*
ppv
=
NULL
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
ProxyBindStatusCallback_AddRef
(
IBindStatusCallback
*
iface
)
{
return
2
;
}
static
ULONG
WINAPI
ProxyBindStatusCallback_Release
(
IBindStatusCallback
*
iface
)
{
return
1
;
}
static
HRESULT
WINAPI
ProxyBindStatusCallback_OnStartBinding
(
IBindStatusCallback
*
iface
,
DWORD
dwReserved
,
IBinding
*
pib
)
{
ProxyBindStatusCallback
*
This
=
(
ProxyBindStatusCallback
*
)
iface
;
return
IBindStatusCallback_OnStartBinding
(
This
->
pBSC
,
dwReserved
,
pib
);
}
static
HRESULT
WINAPI
ProxyBindStatusCallback_GetPriority
(
IBindStatusCallback
*
iface
,
LONG
*
pnPriority
)
{
ProxyBindStatusCallback
*
This
=
(
ProxyBindStatusCallback
*
)
iface
;
return
IBindStatusCallback_GetPriority
(
This
->
pBSC
,
pnPriority
);
}
static
HRESULT
WINAPI
ProxyBindStatusCallback_OnLowResource
(
IBindStatusCallback
*
iface
,
DWORD
reserved
)
{
ProxyBindStatusCallback
*
This
=
(
ProxyBindStatusCallback
*
)
iface
;
return
IBindStatusCallback_OnLowResource
(
This
->
pBSC
,
reserved
);
}
static
HRESULT
WINAPI
ProxyBindStatusCallback_OnProgress
(
IBindStatusCallback
*
iface
,
ULONG
ulProgress
,
ULONG
ulProgressMax
,
ULONG
ulStatusCode
,
LPCWSTR
szStatusText
)
{
ProxyBindStatusCallback
*
This
=
(
ProxyBindStatusCallback
*
)
iface
;
return
IBindStatusCallback_OnProgress
(
This
->
pBSC
,
ulProgress
,
ulProgressMax
,
ulStatusCode
,
szStatusText
);
}
static
HRESULT
WINAPI
ProxyBindStatusCallback_OnStopBinding
(
IBindStatusCallback
*
iface
,
HRESULT
hresult
,
LPCWSTR
szError
)
{
ProxyBindStatusCallback
*
This
=
(
ProxyBindStatusCallback
*
)
iface
;
return
IBindStatusCallback_OnStopBinding
(
This
->
pBSC
,
hresult
,
szError
);
}
static
HRESULT
WINAPI
ProxyBindStatusCallback_GetBindInfo
(
IBindStatusCallback
*
iface
,
DWORD
*
grfBINDF
,
BINDINFO
*
pbindinfo
)
{
ProxyBindStatusCallback
*
This
=
(
ProxyBindStatusCallback
*
)
iface
;
return
IBindStatusCallback_GetBindInfo
(
This
->
pBSC
,
grfBINDF
,
pbindinfo
);
}
static
HRESULT
WINAPI
ProxyBindStatusCallback_OnDataAvailable
(
IBindStatusCallback
*
iface
,
DWORD
grfBSCF
,
DWORD
dwSize
,
FORMATETC
*
pformatetc
,
STGMEDIUM
*
pstgmed
)
{
ProxyBindStatusCallback
*
This
=
(
ProxyBindStatusCallback
*
)
iface
;
return
IBindStatusCallback_OnDataAvailable
(
This
->
pBSC
,
grfBSCF
,
dwSize
,
pformatetc
,
pstgmed
);
}
static
HRESULT
WINAPI
ProxyBindStatusCallback_OnObjectAvailable
(
IBindStatusCallback
*
iface
,
REFIID
riid
,
IUnknown
*
punk
)
{
ProxyBindStatusCallback
*
This
=
(
ProxyBindStatusCallback
*
)
iface
;
return
IBindStatusCallback_OnObjectAvailable
(
This
->
pBSC
,
riid
,
punk
);
}
static
HRESULT
WINAPI
BlockingBindStatusCallback_OnDataAvailable
(
IBindStatusCallback
*
iface
,
DWORD
grfBSCF
,
DWORD
dwSize
,
FORMATETC
*
pformatetc
,
STGMEDIUM
*
pstgmed
)
{
return
S_OK
;
}
static
const
IBindStatusCallbackVtbl
BlockingBindStatusCallbackVtbl
=
{
ProxyBindStatusCallback_QueryInterface
,
ProxyBindStatusCallback_AddRef
,
ProxyBindStatusCallback_Release
,
ProxyBindStatusCallback_OnStartBinding
,
ProxyBindStatusCallback_GetPriority
,
ProxyBindStatusCallback_OnLowResource
,
ProxyBindStatusCallback_OnProgress
,
ProxyBindStatusCallback_OnStopBinding
,
ProxyBindStatusCallback_GetBindInfo
,
BlockingBindStatusCallback_OnDataAvailable
,
ProxyBindStatusCallback_OnObjectAvailable
};
static
HRESULT
WINAPI
AsyncBindStatusCallback_GetBindInfo
(
IBindStatusCallback
*
iface
,
DWORD
*
grfBINDF
,
BINDINFO
*
pbindinfo
)
{
ProxyBindStatusCallback
*
This
=
(
ProxyBindStatusCallback
*
)
iface
;
HRESULT
hr
=
IBindStatusCallback_GetBindInfo
(
This
->
pBSC
,
grfBINDF
,
pbindinfo
);
*
grfBINDF
|=
BINDF_PULLDATA
|
BINDF_ASYNCHRONOUS
|
BINDF_ASYNCSTORAGE
;
return
hr
;
}
static
const
IBindStatusCallbackVtbl
AsyncBindStatusCallbackVtbl
=
{
ProxyBindStatusCallback_QueryInterface
,
ProxyBindStatusCallback_AddRef
,
ProxyBindStatusCallback_Release
,
ProxyBindStatusCallback_OnStartBinding
,
ProxyBindStatusCallback_GetPriority
,
ProxyBindStatusCallback_OnLowResource
,
ProxyBindStatusCallback_OnProgress
,
ProxyBindStatusCallback_OnStopBinding
,
AsyncBindStatusCallback_GetBindInfo
,
ProxyBindStatusCallback_OnDataAvailable
,
ProxyBindStatusCallback_OnObjectAvailable
};
static
HRESULT
URLStartDownload
(
LPCWSTR
szURL
,
LPSTREAM
*
ppStream
,
IBindStatusCallback
*
pBSC
)
{
HRESULT
hr
;
IMoniker
*
pMoniker
;
IBindCtx
*
pbc
;
*
ppStream
=
NULL
;
hr
=
CreateURLMoniker
(
NULL
,
szURL
,
&
pMoniker
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
CreateBindCtx
(
0
,
&
pbc
);
if
(
FAILED
(
hr
))
{
IMoniker_Release
(
pMoniker
);
return
hr
;
}
hr
=
RegisterBindStatusCallback
(
pbc
,
pBSC
,
NULL
,
0
);
if
(
FAILED
(
hr
))
{
IBindCtx_Release
(
pbc
);
IMoniker_Release
(
pMoniker
);
return
hr
;
}
hr
=
IMoniker_BindToStorage
(
pMoniker
,
pbc
,
NULL
,
&
IID_IStream
,
(
void
**
)
ppStream
);
/* BindToStorage returning E_PENDING because it's asynchronous is not an error */
if
(
hr
==
E_PENDING
)
hr
=
S_OK
;
IBindCtx_Release
(
pbc
);
IMoniker_Release
(
pMoniker
);
return
hr
;
}
/***********************************************************************
* URLOpenBlockingStreamA (URLMON.@)
*/
...
...
@@ -386,9 +553,23 @@ HRESULT WINAPI URLOpenBlockingStreamA(LPUNKNOWN pCaller, LPCSTR szURL,
LPSTREAM
*
ppStream
,
DWORD
dwReserved
,
LPBINDSTATUSCALLBACK
lpfnCB
)
{
FIXME
(
"(%p, %s, %p, 0x%x, %p): stub
\n
"
,
pCaller
,
szURL
,
ppStream
,
dwReserved
,
lpfnCB
);
*
ppStream
=
NULL
;
return
E_NOTIMPL
;
LPWSTR
szURLW
;
int
len
;
HRESULT
hr
;
TRACE
(
"(%p, %s, %p, 0x%x, %p)
\n
"
,
pCaller
,
szURL
,
ppStream
,
dwReserved
,
lpfnCB
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
szURL
,
-
1
,
NULL
,
0
);
szURLW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
if
(
!
szURLW
)
return
E_OUTOFMEMORY
;
MultiByteToWideChar
(
CP_ACP
,
0
,
szURL
,
-
1
,
szURLW
,
len
);
hr
=
URLOpenBlockingStreamW
(
pCaller
,
szURLW
,
ppStream
,
dwReserved
,
lpfnCB
);
HeapFree
(
GetProcessHeap
(),
0
,
szURLW
);
return
hr
;
}
/***********************************************************************
...
...
@@ -398,29 +579,61 @@ HRESULT WINAPI URLOpenBlockingStreamW(LPUNKNOWN pCaller, LPCWSTR szURL,
LPSTREAM
*
ppStream
,
DWORD
dwReserved
,
LPBINDSTATUSCALLBACK
lpfnCB
)
{
FIXME
(
"(%p, %s, %p, 0x%x, %p): stub
\n
"
,
pCaller
,
debugstr_w
(
szURL
),
ppStream
,
ProxyBindStatusCallback
blocking_bsc
;
TRACE
(
"(%p, %s, %p, 0x%x, %p)
\n
"
,
pCaller
,
debugstr_w
(
szURL
),
ppStream
,
dwReserved
,
lpfnCB
);
*
ppStream
=
NULL
;
return
E_NOTIMPL
;
blocking_bsc
.
lpVtbl
=
&
BlockingBindStatusCallbackVtbl
;
blocking_bsc
.
pBSC
=
lpfnCB
;
return
URLStartDownload
(
szURL
,
ppStream
,
(
IBindStatusCallback
*
)
&
blocking_bsc
);
}
/***********************************************************************
* URLOpenStreamA (URLMON.@)
*/
* URLOpenStreamA (URLMON.@)
*/
HRESULT
WINAPI
URLOpenStreamA
(
LPUNKNOWN
pCaller
,
LPCSTR
szURL
,
DWORD
dwReserved
,
LPBINDSTATUSCALLBACK
lpfnCB
)
{
FIXME
(
"(%p, %s, 0x%x, %p): stub
\n
"
,
pCaller
,
szURL
,
dwReserved
,
lpfnCB
);
return
E_NOTIMPL
;
LPWSTR
szURLW
;
int
len
;
HRESULT
hr
;
TRACE
(
"(%p, %s, 0x%x, %p)
\n
"
,
pCaller
,
szURL
,
dwReserved
,
lpfnCB
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
szURL
,
-
1
,
NULL
,
0
);
szURLW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
if
(
!
szURLW
)
return
E_OUTOFMEMORY
;
MultiByteToWideChar
(
CP_ACP
,
0
,
szURL
,
-
1
,
szURLW
,
len
);
hr
=
URLOpenStreamW
(
pCaller
,
szURLW
,
dwReserved
,
lpfnCB
);
HeapFree
(
GetProcessHeap
(),
0
,
szURLW
);
return
hr
;
}
/***********************************************************************
* URLOpenStreamW (URLMON.@)
*/
* URLOpenStreamW (URLMON.@)
*/
HRESULT
WINAPI
URLOpenStreamW
(
LPUNKNOWN
pCaller
,
LPCWSTR
szURL
,
DWORD
dwReserved
,
LPBINDSTATUSCALLBACK
lpfnCB
)
{
FIXME
(
"(%p, %s, 0x%x, %p): stub
\n
"
,
pCaller
,
debugstr_w
(
szURL
),
dwReserved
,
HRESULT
hr
;
ProxyBindStatusCallback
async_bsc
;
IStream
*
pStream
;
TRACE
(
"(%p, %s, 0x%x, %p)
\n
"
,
pCaller
,
debugstr_w
(
szURL
),
dwReserved
,
lpfnCB
);
return
E_NOTIMPL
;
async_bsc
.
lpVtbl
=
&
AsyncBindStatusCallbackVtbl
;
async_bsc
.
pBSC
=
lpfnCB
;
hr
=
URLStartDownload
(
szURL
,
&
pStream
,
(
IBindStatusCallback
*
)
&
async_bsc
);
if
(
SUCCEEDED
(
hr
)
&&
pStream
)
IStream_Release
(
pStream
);
return
hr
;
}
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