Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
0dbbd90c
Commit
0dbbd90c
authored
Feb 15, 2006
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 15, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shdocvw: Navigate2 rewrite.
parent
f98843e8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
296 additions
and
47 deletions
+296
-47
navigate.c
dlls/shdocvw/navigate.c
+272
-2
shdocvw.h
dlls/shdocvw/shdocvw.h
+1
-0
webbrowser.c
dlls/shdocvw/webbrowser.c
+23
-45
No files found.
dlls/shdocvw/navigate.c
View file @
0dbbd90c
...
...
@@ -28,6 +28,20 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
shdocvw
);
typedef
struct
{
const
IBindStatusCallbackVtbl
*
lpBindStatusCallbackVtbl
;
const
IHttpNegotiateVtbl
*
lpHttpNegotiateVtbl
;
LONG
ref
;
HGLOBAL
post_data
;
LPWSTR
headers
;
ULONG
post_data_len
;
}
BindStatusCallback
;
#define BINDSC(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
#define HTTPNEG(x) ((IHttpNegotiate*) &(x)->lpHttpNegotiateVtbl)
static
void
dump_BINDINFO
(
BINDINFO
*
bi
)
{
static
const
char
*
BINDINFOF_str
[]
=
{
...
...
@@ -72,6 +86,234 @@ static void dump_BINDINFO(BINDINFO *bi)
);
}
#define BINDSC_THIS(iface) DEFINE_THIS(BindStatusCallback, BindStatusCallback, iface)
static
HRESULT
WINAPI
BindStatusCallback_QueryInterface
(
IBindStatusCallback
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
BindStatusCallback
*
This
=
BINDSC_THIS
(
iface
);
*
ppv
=
NULL
;
if
(
IsEqualGUID
(
&
IID_IUnknown
,
riid
))
{
TRACE
(
"(%p)->(IID_IUnknown %p)
\n
"
,
This
,
ppv
);
*
ppv
=
BINDSC
(
This
);
}
else
if
(
IsEqualGUID
(
&
IID_IBindStatusCallback
,
riid
))
{
TRACE
(
"(%p)->(IID_IBindStatusCallback %p)
\n
"
,
This
,
ppv
);
*
ppv
=
BINDSC
(
This
);
}
else
if
(
IsEqualGUID
(
&
IID_IHttpNegotiate
,
riid
))
{
TRACE
(
"(%p)->(IID_IHttpNegotiate %p)
\n
"
,
This
,
ppv
);
*
ppv
=
HTTPNEG
(
This
);
}
if
(
*
ppv
)
{
IBindStatusCallback_AddRef
(
BINDSC
(
This
));
return
S_OK
;
}
WARN
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_guid
(
riid
),
ppv
);
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
BindStatusCallback_AddRef
(
IBindStatusCallback
*
iface
)
{
BindStatusCallback
*
This
=
BINDSC_THIS
(
iface
);
LONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
BindStatusCallback_Release
(
IBindStatusCallback
*
iface
)
{
BindStatusCallback
*
This
=
BINDSC_THIS
(
iface
);
LONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
if
(
This
->
post_data
)
GlobalFree
(
This
->
post_data
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
headers
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
}
static
HRESULT
WINAPI
BindStatusCallback_OnStartBinding
(
IBindStatusCallback
*
iface
,
DWORD
dwReserved
,
IBinding
*
pbind
)
{
BindStatusCallback
*
This
=
BINDSC_THIS
(
iface
);
FIXME
(
"(%p)->(%ld %p)
\n
"
,
This
,
dwReserved
,
pbind
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
BindStatusCallback_GetPriority
(
IBindStatusCallback
*
iface
,
LONG
*
pnPriority
)
{
BindStatusCallback
*
This
=
BINDSC_THIS
(
iface
);
FIXME
(
"(%p)->(%p)
\n
"
,
This
,
pnPriority
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
BindStatusCallback_OnLowResource
(
IBindStatusCallback
*
iface
,
DWORD
reserved
)
{
BindStatusCallback
*
This
=
BINDSC_THIS
(
iface
);
FIXME
(
"(%p)->(%ld)
\n
"
,
This
,
reserved
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
BindStatusCallback_OnProgress
(
IBindStatusCallback
*
iface
,
ULONG
ulProgress
,
ULONG
ulProgressMax
,
ULONG
ulStatusCode
,
LPCWSTR
szStatusText
)
{
BindStatusCallback
*
This
=
BINDSC_THIS
(
iface
);
FIXME
(
"(%p)->(%ld %ld %ld %s)
\n
"
,
This
,
ulProgress
,
ulProgressMax
,
ulStatusCode
,
debugstr_w
(
szStatusText
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
BindStatusCallback_OnStopBinding
(
IBindStatusCallback
*
iface
,
HRESULT
hresult
,
LPCWSTR
szError
)
{
BindStatusCallback
*
This
=
BINDSC_THIS
(
iface
);
FIXME
(
"(%p)->(%08lx %s)
\n
"
,
This
,
hresult
,
debugstr_w
(
szError
));
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
BindStatusCallback_GetBindInfo
(
IBindStatusCallback
*
iface
,
DWORD
*
grfBINDF
,
BINDINFO
*
pbindinfo
)
{
BindStatusCallback
*
This
=
BINDSC_THIS
(
iface
);
FIXME
(
"(%p)->(%p %p)
\n
"
,
This
,
grfBINDF
,
pbindinfo
);
memset
(
pbindinfo
,
0
,
sizeof
(
BINDINFO
));
pbindinfo
->
cbSize
=
sizeof
(
BINDINFO
);
pbindinfo
->
cbStgmedData
=
This
->
post_data_len
;
if
(
This
->
post_data
)
{
pbindinfo
->
dwBindVerb
=
BINDVERB_POST
;
pbindinfo
->
stgmedData
.
tymed
=
TYMED_HGLOBAL
;
pbindinfo
->
stgmedData
.
u
.
hGlobal
=
This
->
post_data
;
pbindinfo
->
stgmedData
.
pUnkForRelease
=
(
IUnknown
*
)
BINDSC
(
This
);
IBindStatusCallback_AddRef
(
BINDSC
(
This
));
}
return
S_OK
;
}
static
HRESULT
WINAPI
BindStatusCallback_OnDataAvailable
(
IBindStatusCallback
*
iface
,
DWORD
grfBSCF
,
DWORD
dwSize
,
FORMATETC
*
pformatetc
,
STGMEDIUM
*
pstgmed
)
{
BindStatusCallback
*
This
=
BINDSC_THIS
(
iface
);
FIXME
(
"(%p)->(%08lx %ld %p %p)
\n
"
,
This
,
grfBSCF
,
dwSize
,
pformatetc
,
pstgmed
);
return
E_NOTIMPL
;
}
#undef BSC_THIS
static
const
IBindStatusCallbackVtbl
BindStatusCallbackVtbl
=
{
BindStatusCallback_QueryInterface
,
BindStatusCallback_AddRef
,
BindStatusCallback_Release
,
BindStatusCallback_OnStartBinding
,
BindStatusCallback_GetPriority
,
BindStatusCallback_OnLowResource
,
BindStatusCallback_OnProgress
,
BindStatusCallback_OnStopBinding
,
BindStatusCallback_GetBindInfo
,
BindStatusCallback_OnDataAvailable
};
#define HTTPNEG_THIS(iface) DEFINE_THIS(BindStatusCallback, HttpNegotiate, iface)
static
HRESULT
WINAPI
HttpNegotiate_QueryInterface
(
IHttpNegotiate
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
BindStatusCallback
*
This
=
HTTPNEG_THIS
(
iface
);
return
IBindStatusCallback_QueryInterface
(
BINDSC
(
This
),
riid
,
ppv
);
}
static
ULONG
WINAPI
HttpNegotiate_AddRef
(
IHttpNegotiate
*
iface
)
{
BindStatusCallback
*
This
=
HTTPNEG_THIS
(
iface
);
return
IBindStatusCallback_AddRef
(
BINDSC
(
This
));
}
static
ULONG
WINAPI
HttpNegotiate_Release
(
IHttpNegotiate
*
iface
)
{
BindStatusCallback
*
This
=
HTTPNEG_THIS
(
iface
);
return
IBindStatusCallback_Release
(
BINDSC
(
This
));
}
static
HRESULT
WINAPI
HttpNegotiate_BeginningTransaction
(
IHttpNegotiate
*
iface
,
LPCWSTR
szURL
,
LPCWSTR
szHeaders
,
DWORD
dwReserved
,
LPWSTR
*
pszAdditionalHeaders
)
{
BindStatusCallback
*
This
=
HTTPNEG_THIS
(
iface
);
FIXME
(
"(%p)->(%s %s %ld %p)
\n
"
,
This
,
debugstr_w
(
szURL
),
debugstr_w
(
szHeaders
),
dwReserved
,
pszAdditionalHeaders
);
if
(
This
->
headers
)
{
int
size
=
(
strlenW
(
This
->
headers
)
+
1
)
*
sizeof
(
WCHAR
);
*
pszAdditionalHeaders
=
CoTaskMemAlloc
(
size
);
memcpy
(
*
pszAdditionalHeaders
,
This
->
headers
,
size
);
}
return
S_OK
;
}
static
HRESULT
WINAPI
HttpNegotiate_OnResponse
(
IHttpNegotiate
*
iface
,
DWORD
dwResponseCode
,
LPCWSTR
szResponseHeaders
,
LPCWSTR
szRequestHeaders
,
LPWSTR
*
pszAdditionalRequestHeaders
)
{
BindStatusCallback
*
This
=
HTTPNEG_THIS
(
iface
);
FIXME
(
"(%p)->(%ld %s %s %p)
\n
"
,
This
,
dwResponseCode
,
debugstr_w
(
szResponseHeaders
),
debugstr_w
(
szRequestHeaders
),
pszAdditionalRequestHeaders
);
return
E_NOTIMPL
;
}
#undef HTTPNEG_THIS
static
const
IHttpNegotiateVtbl
HttpNegotiateVtbl
=
{
HttpNegotiate_QueryInterface
,
HttpNegotiate_AddRef
,
HttpNegotiate_Release
,
HttpNegotiate_BeginningTransaction
,
HttpNegotiate_OnResponse
};
static
IBindStatusCallback
*
create_callback
(
WebBrowser
*
This
,
PBYTE
post_data
,
ULONG
post_data_len
,
LPWSTR
headers
,
VARIANT_BOOL
*
cancel
)
{
BindStatusCallback
*
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BindStatusCallback
));
ret
->
lpBindStatusCallbackVtbl
=
&
BindStatusCallbackVtbl
;
ret
->
lpHttpNegotiateVtbl
=
&
HttpNegotiateVtbl
;
ret
->
ref
=
1
;
ret
->
post_data
=
NULL
;
ret
->
post_data_len
=
post_data_len
;
ret
->
headers
=
NULL
;
if
(
post_data
)
{
ret
->
post_data
=
GlobalAlloc
(
0
,
post_data_len
);
memcpy
(
ret
->
post_data
,
post_data
,
post_data_len
);
}
if
(
headers
)
{
int
size
=
(
strlenW
(
headers
)
+
1
)
*
sizeof
(
WCHAR
);
ret
->
headers
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
memcpy
(
ret
->
headers
,
headers
,
size
);
}
return
BINDSC
(
ret
);
}
static
void
on_before_navigate2
(
WebBrowser
*
This
,
PBYTE
post_data
,
ULONG
post_data_len
,
LPWSTR
headers
,
VARIANT_BOOL
*
cancel
)
...
...
@@ -133,7 +375,6 @@ static void on_before_navigate2(WebBrowser *This, PBYTE post_data, ULONG post_da
if
(
post_data_len
)
SafeArrayDestroy
(
V_ARRAY
(
&
var_post_data
));
}
static
HRESULT
navigate
(
WebBrowser
*
This
,
IMoniker
*
mon
,
IBindCtx
*
bindctx
,
...
...
@@ -166,7 +407,7 @@ static HRESULT navigate(WebBrowser *This, IMoniker *mon, IBindCtx *bindctx,
&
IID_IUnknown
,
(
void
**
)
&
This
->
document
);
if
(
FAILED
(
hres
))
{
WARN
(
"Could not create HTMLDocument: %08lx
\n
"
,
hres
);
ERR
(
"Could not create HTMLDocument: %08lx
\n
"
,
hres
);
return
hres
;
}
...
...
@@ -196,6 +437,35 @@ static HRESULT navigate(WebBrowser *This, IMoniker *mon, IBindCtx *bindctx,
PostMessageW
(
This
->
doc_view_hwnd
,
WB_WM_NAVIGATE2
,
0
,
0
);
return
hres
;
}
HRESULT
navigate_url
(
WebBrowser
*
This
,
LPCWSTR
url
,
PBYTE
post_data
,
ULONG
post_data_len
,
LPWSTR
headers
)
{
IBindStatusCallback
*
callback
;
IMoniker
*
mon
;
IBindCtx
*
bindctx
;
VARIANT_BOOL
cancel
=
VARIANT_FALSE
;
HRESULT
hres
;
hres
=
CreateURLMoniker
(
NULL
,
url
,
&
mon
);
if
(
FAILED
(
hres
))
{
WARN
(
"CreateURLMoniker failed: %08lx
\n
"
,
hres
);
return
hres
;
}
IMoniker_GetDisplayName
(
mon
,
NULL
,
NULL
,
&
This
->
url
);
TRACE
(
"navigating to %s
\n
"
,
debugstr_w
(
This
->
url
));
callback
=
create_callback
(
This
,
post_data
,
post_data_len
,
(
LPWSTR
)
headers
,
&
cancel
);
CreateAsyncBindCtx
(
0
,
callback
,
0
,
&
bindctx
);
hres
=
navigate
(
This
,
mon
,
bindctx
,
callback
);
IMoniker_Release
(
mon
);
return
hres
;
}
HRESULT
navigate_hlink
(
WebBrowser
*
This
,
IMoniker
*
mon
,
IBindCtx
*
bindctx
,
...
...
dlls/shdocvw/shdocvw.h
View file @
0dbbd90c
...
...
@@ -169,6 +169,7 @@ HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
void
create_doc_view_hwnd
(
WebBrowser
*
This
);
void
deactivate_document
(
WebBrowser
*
);
void
call_sink
(
ConnectionPoint
*
,
DISPID
,
DISPPARAMS
*
);
HRESULT
navigate_url
(
WebBrowser
*
,
LPCWSTR
,
PBYTE
,
ULONG
,
LPWSTR
);
#define WB_WM_NAVIGATE2 (WM_USER+100)
...
...
dlls/shdocvw/webbrowser.c
View file @
0dbbd90c
...
...
@@ -21,8 +21,6 @@
#include "wine/debug.h"
#include "shdocvw.h"
#include "mshtml.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
shdocvw
);
...
...
@@ -508,9 +506,9 @@ static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VA
VARIANT
*
TargetFrameName
,
VARIANT
*
PostData
,
VARIANT
*
Headers
)
{
WebBrowser
*
This
=
WEBBROWSER_THIS
(
iface
);
IPersistMoniker
*
persist
;
IOleObject
*
oleobj
;
IMoniker
*
mon
;
PBYTE
post_data
=
NULL
;
ULONG
post_data_len
=
0
;
LPWSTR
headers
=
NULL
;
HRESULT
hres
;
TRACE
(
"(%p)->(%p %p %p %p %p)
\n
"
,
This
,
URL
,
Flags
,
TargetFrameName
,
PostData
,
Headers
);
...
...
@@ -519,61 +517,41 @@ static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VA
return
E_FAIL
;
if
((
Flags
&&
V_VT
(
Flags
)
!=
VT_EMPTY
)
||
(
TargetFrameName
&&
V_VT
(
TargetFrameName
)
!=
VT_EMPTY
)
||
(
PostData
&&
V_VT
(
PostData
)
!=
VT_EMPTY
)
||
(
Headers
&&
V_VT
(
Headers
)
!=
VT_EMPTY
))
||
(
TargetFrameName
&&
V_VT
(
TargetFrameName
)
!=
VT_EMPTY
))
FIXME
(
"Unsupported arguments
\n
"
);
if
(
!
URL
)
return
S_OK
;
if
(
V_VT
(
URL
)
!=
VT_BSTR
)
return
E_INVALIDARG
;
if
(
!
This
->
doc_view_hwnd
)
create_doc_view_hwnd
(
This
);
if
(
PostData
&&
V_VT
(
PostData
)
!=
VT_EMPTY
)
{
if
(
V_VT
(
PostData
)
!=
(
VT_ARRAY
|
VT_UI1
)
||
V_ARRAY
(
PostData
)
->
cDims
!=
1
)
{
WARN
(
"Invalid PostData
\n
"
);
return
E_INVALIDARG
;
}
/*
* FIXME:
* We should use URLMoniker's BindToObject instead creating HTMLDocument here.
* This should be fixed when mshtml.dll and urlmon.dll will be good enough.
*/
if
(
!
This
->
document
)
{
hres
=
CoCreateInstance
(
&
CLSID_HTMLDocument
,
NULL
,
CLSCTX_INPROC_SERVER
|
CLSCTX_INPROC_HANDLER
,
&
IID_IUnknown
,
(
void
**
)
&
This
->
document
);
if
(
FAILED
(
hres
))
return
hres
;
SafeArrayAccessData
(
V_ARRAY
(
PostData
),
(
void
**
)
&
post_data
);
post_data_len
=
V_ARRAY
(
PostData
)
->
rgsabound
[
0
].
cElements
;
}
hres
=
IUnknown_QueryInterface
(
This
->
document
,
&
IID_IPersistMoniker
,
(
void
**
)
&
persist
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
CreateURLMoniker
(
NULL
,
V_BSTR
(
URL
),
&
mon
);
if
(
FAILED
(
hres
))
{
IPersistMoniker_Release
(
persist
);
return
hres
;
}
if
(
Headers
&&
V_VT
(
Headers
)
!=
VT_EMPTY
)
{
if
(
V_VT
(
Headers
)
!=
VT_BSTR
)
return
E_INVALIDARG
;
hres
=
IPersistMoniker_Load
(
persist
,
FALSE
,
mon
,
NULL
/* FIXME */
,
0
);
IMoniker_Release
(
mon
);
IPersistMoniker_Release
(
persist
);
if
(
FAILED
(
hres
))
{
WARN
(
"Load failed: %08lx
\n
"
,
hres
);
return
hres
;
headers
=
V_BSTR
(
Headers
);
FIXME
(
"Headers: %s
\n
"
,
debugstr_w
(
headers
));
}
This
->
url
=
SysAllocString
(
V_BSTR
(
URL
));
hres
=
IUnknown_QueryInterface
(
This
->
document
,
&
IID_IOleObject
,
(
void
**
)
&
oleobj
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
!
This
->
doc_view_hwnd
)
create_doc_view_hwnd
(
This
);
hres
=
IOleObject_SetClientSite
(
oleobj
,
CLIENTSITE
(
This
));
IOleObject_Release
(
oleobj
);
hres
=
navigate_url
(
This
,
V_BSTR
(
URL
),
post_data
,
post_data_len
,
headers
);
PostMessageW
(
This
->
doc_view_hwnd
,
WB_WM_NAVIGATE2
,
0
,
0
);
SafeArrayUnaccessData
(
V_ARRAY
(
PostData
)
);
return
hres
;
}
...
...
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