2 * Copyright 2010 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <wine/test.h>
37 #include "mshtml_test.h"
42 #define DEFINE_EXPECT(func) \
43 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
45 #define SET_EXPECT(func) \
46 do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0)
48 #define CHECK_EXPECT2(func) \
50 ok(expect_ ##func, "unexpected call " #func "\n"); \
51 called_ ## func = TRUE; \
54 #define CHECK_EXPECT(func) \
56 CHECK_EXPECT2(func); \
57 expect_ ## func = FALSE; \
60 #define CHECK_CALLED(func) \
62 ok(called_ ## func, "expected " #func "\n"); \
63 expect_ ## func = called_ ## func = FALSE; \
66 #define CLEAR_CALLED(func) \
67 expect_ ## func = called_ ## func = FALSE
71 DEFINE_EXPECT(CreateInstance
);
72 DEFINE_EXPECT(FreezeEvents_TRUE
);
73 DEFINE_EXPECT(FreezeEvents_FALSE
);
74 DEFINE_EXPECT(QuickActivate
);
75 DEFINE_EXPECT(IPersistPropertyBag_InitNew
);
76 DEFINE_EXPECT(IPersistPropertyBag_Load
);
77 DEFINE_EXPECT(Invoke_READYSTATE
);
78 DEFINE_EXPECT(Invoke_ENABLED
);
79 DEFINE_EXPECT(Invoke_VALID
);
80 DEFINE_EXPECT(Invoke_SECURITYCTX
);
81 DEFINE_EXPECT(Invoke_SCRIPTPROP
);
82 DEFINE_EXPECT(Invoke_SCRIPTCALL
);
83 DEFINE_EXPECT(GetIDsOfNames_scriptprop
);
84 DEFINE_EXPECT(DoVerb
);
85 DEFINE_EXPECT(SetExtent
);
86 DEFINE_EXPECT(GetExtent
);
87 DEFINE_EXPECT(SetClientSite
);
88 DEFINE_EXPECT(SetClientSite_NULL
);
90 DEFINE_EXPECT(InPlaceObject_GetWindow
);
91 DEFINE_EXPECT(SetObjectRects
);
92 DEFINE_EXPECT(InPlaceDeactivate
);
93 DEFINE_EXPECT(UIDeactivate
);
94 DEFINE_EXPECT(QueryService_TestActiveX
);
95 DEFINE_EXPECT(GetMiscStatus
);
96 DEFINE_EXPECT(SetAdvise
);
97 DEFINE_EXPECT(GetViewStatus
);
98 DEFINE_EXPECT(QI_ITestActiveX
);
99 DEFINE_EXPECT(wrapped_AddRef
);
100 DEFINE_EXPECT(wrapped_Release
);
101 DEFINE_EXPECT(wrapped_func
);
102 DEFINE_EXPECT(OnAmbientPropertyChange_UNKNOWN
);
103 DEFINE_EXPECT(GetTypeInfo
);
104 DEFINE_EXPECT(GetClassInfo
);
105 DEFINE_EXPECT(FindConnectionPoint
);
106 DEFINE_EXPECT(Advise
);
107 DEFINE_EXPECT(Unadvise
);
109 #define DISPID_SCRIPTPROP 1000
110 #define DISPID_SCRIPTCALL 1001
118 static ITypeInfo
*actxtest_typeinfo
, *class_typeinfo
;
119 static HWND container_hwnd
, plugin_hwnd
;
120 static int plugin_behavior
;
121 static BOOL no_quickact
;
122 static LONG activex_refcnt
;
124 #define TESTACTIVEX_CLSID "{178fc163-f585-4e24-9c13-4bb7f6680746}"
126 static const GUID CLSID_TestActiveX
=
127 {0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xf6,0x68,0x07,0x46}};
129 static const GUID IID_ITestActiveX
=
130 {0x178fc663,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xf6,0x68,0x07,0x46}};
132 static const char object_ax_str
[] =
133 "<html><head></head><body>"
134 "<object classid=\"clsid:" TESTACTIVEX_CLSID
"\" width=\"300\" height=\"200\" id=\"objid\">"
135 "<param name=\"param_name\" value=\"param_value\">"
136 "<param name=\"num_param\" value=\"3\">"
139 "objid.scriptCall();"
143 static const char event_binding_str
[] =
144 "<html><head></head><body>"
145 "<object classid=\"clsid:" TESTACTIVEX_CLSID
"\" width=\"300\" height=\"200\" id=\"objid\">"
146 "<param name=\"param_name\" value=\"param_value\">"
147 "<param name=\"num_param\" value=\"3\">"
149 "<script for=\"objid\" event=\"testfunc\">return 6;</script>"
150 "<script for=\"objid\" event=\"testfunc2(x,y)\">return x+2*y;</script>"
153 static REFIID pluginhost_iids
[] = {
157 &IID_IPropertyNotifySink
,
160 &IID_IOleInPlaceSite
,
161 &IID_IOleInPlaceSiteEx
,
162 &IID_IOleControlSite
,
164 &IID_IServiceProvider
,
168 static BOOL
iface_cmp(IUnknown
*iface1
, IUnknown
*iface2
)
170 IUnknown
*unk1
, *unk2
;
175 IUnknown_QueryInterface(iface1
, &IID_IUnknown
, (void**)&unk1
);
176 IUnknown_Release(unk1
);
177 IUnknown_QueryInterface(iface2
, &IID_IUnknown
, (void**)&unk2
);
178 IUnknown_Release(unk2
);
183 #define test_ifaces(i,ids) _test_ifaces(__LINE__,i,ids)
184 static void _test_ifaces(unsigned line
, IUnknown
*iface
, REFIID
*iids
)
186 const IID
* const *piid
;
190 for(piid
= iids
; *piid
; piid
++) {
191 hres
= IUnknown_QueryInterface(iface
, *piid
, (void**)&unk
);
192 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get %s interface: %08x\n", wine_dbgstr_guid(*piid
), hres
);
194 IUnknown_Release(unk
);
198 static IOleClientSite
*client_site
;
199 static IDispatch
*sink_disp
;
200 static READYSTATE plugin_readystate
= READYSTATE_UNINITIALIZED
;
201 static BOOL have_container
;
203 static void set_plugin_readystate(READYSTATE state
)
205 IPropertyNotifySink
*prop_notif
;
208 plugin_readystate
= state
;
210 hres
= IOleClientSite_QueryInterface(client_site
, &IID_IPropertyNotifySink
, (void**)&prop_notif
);
211 ok(hres
== S_OK
, "Could not get IPropertyNotifySink iface: %08x\n", hres
);
213 hres
= IPropertyNotifySink_OnChanged(prop_notif
, DISPID_READYSTATE
);
214 ok(hres
== S_OK
, "OnChanged(DISPID_READYSTATE) failed: %08x\n", hres
);
216 IPropertyNotifySink_Release(prop_notif
);
219 static void test_mon_displayname(IMoniker
*mon
, const WCHAR
*exname
, const WCHAR
*broken_name
)
221 LPOLESTR display_name
;
225 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &display_name
);
226 ok(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
227 ok(!lstrcmpW(display_name
, exname
) || broken(broken_name
&& !lstrcmpW(display_name
, broken_name
)),
228 "display_name = %s\n", wine_dbgstr_w(display_name
));
229 CoTaskMemFree(display_name
);
231 hres
= IMoniker_IsSystemMoniker(mon
, &mksys
);
232 ok(hres
== S_OK
, "IsSystemMoniker failed: %08x\n", hres
);
233 ok(mksys
== MKSYS_URLMONIKER
, "mksys = %d\n", mksys
);
236 static LRESULT WINAPI
plugin_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
245 GetClientRect(hwnd
, &rect
);
247 dc
= BeginPaint(hwnd
, &ps
);
248 brush
= CreateSolidBrush(RGB(255,0,0));
249 SelectObject(dc
, brush
);
250 Rectangle(dc
, rect
.left
, rect
.top
, rect
.right
, rect
.bottom
);
257 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
260 static void create_plugin_window(HWND parent
, const RECT
*rect
)
262 static const WCHAR plugin_testW
[] =
263 {'p','l','u','g','i','n',' ','t','e','s','t',0};
264 static WNDCLASSEXW wndclass
= {
268 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
273 RegisterClassExW(&wndclass
);
274 plugin_hwnd
= CreateWindowW(plugin_testW
, plugin_testW
,
275 WS_CHILD
|WS_VISIBLE
|WS_CLIPSIBLINGS
|WS_CLIPCHILDREN
, rect
->left
, rect
->top
,
276 rect
->right
-rect
->left
, rect
->bottom
-rect
->top
, parent
, NULL
, NULL
, NULL
);
279 static HRESULT WINAPI
ConnectionPoint_QueryInterface(IConnectionPoint
*iface
, REFIID riid
, void **ppv
)
281 ok(0, "unexpected QI call %s\n", wine_dbgstr_guid(riid
));
282 return E_NOINTERFACE
;
285 static ULONG WINAPI
ConnectionPoint_AddRef(IConnectionPoint
*iface
)
290 static ULONG WINAPI
ConnectionPoint_Release(IConnectionPoint
*iface
)
295 static HRESULT WINAPI
ConnectionPoint_GetConnectionInterface(IConnectionPoint
*iface
, IID
*pIID
)
297 ok(0, "unexpected call\n");
301 static HRESULT WINAPI
ConnectionPoint_GetConnectionPointContainer(IConnectionPoint
*iface
,
302 IConnectionPointContainer
**ppCPC
)
304 ok(0, "unexpected call\n");
308 static HRESULT WINAPI
ConnectionPoint_Advise(IConnectionPoint
*iface
, IUnknown
*pUnkSink
, DWORD
*pdwCookie
)
310 DispActiveXTest
*ax_test
;
314 CHECK_EXPECT(Advise
);
316 hres
= IUnknown_QueryInterface(pUnkSink
, &IID_IDispatch
, (void**)&sink_disp
);
317 ok(hres
== S_OK
, "Could not get IDispatch iface: %08x\n", hres
);
319 hres
= IUnknown_QueryInterface(pUnkSink
, &IID_IDispatchEx
, (void**)&dispex
);
320 ok(hres
== E_NOINTERFACE
, "QueryInterface(IID_IDispatchEx) returned: %08x\n", hres
);
322 hres
= IUnknown_QueryInterface(pUnkSink
, &DIID_DispActiveXTest
, (void**)&ax_test
);
323 ok(hres
== S_OK
, "Could not get DispActiveXTest iface: %08x\n", hres
);
324 DispActiveXTest_Release(ax_test
);
326 *pdwCookie
= 0xdeadbeef;
330 static HRESULT WINAPI
ConnectionPoint_Unadvise(IConnectionPoint
*iface
, DWORD dwCookie
)
332 CHECK_EXPECT(Unadvise
);
334 ok(dwCookie
== 0xdeadbeef, "dwCookie = %x\n", dwCookie
);
337 IDispatch_Release(sink_disp
);
344 static HRESULT WINAPI
ConnectionPoint_EnumConnections(IConnectionPoint
*iface
, IEnumConnections
**ppEnum
)
346 ok(0, "unexpected call\n");
350 static const IConnectionPointVtbl ConnectionPointVtbl
= {
351 ConnectionPoint_QueryInterface
,
352 ConnectionPoint_AddRef
,
353 ConnectionPoint_Release
,
354 ConnectionPoint_GetConnectionInterface
,
355 ConnectionPoint_GetConnectionPointContainer
,
356 ConnectionPoint_Advise
,
357 ConnectionPoint_Unadvise
,
358 ConnectionPoint_EnumConnections
361 static IConnectionPoint ConnectionPoint
= { &ConnectionPointVtbl
};
363 static HRESULT
ax_qi(REFIID
,void**);
365 static HRESULT WINAPI
OleControl_QueryInterface(IOleControl
*iface
, REFIID riid
, void **ppv
)
367 return ax_qi(riid
, ppv
);
370 static ULONG WINAPI
OleControl_AddRef(IOleControl
*iface
)
372 return ++activex_refcnt
;
375 static ULONG WINAPI
OleControl_Release(IOleControl
*iface
)
377 return --activex_refcnt
;
380 static HRESULT WINAPI
OleControl_GetControlInfo(IOleControl
*iface
, CONTROLINFO
*pCI
)
382 ok(0, "unexpected call\n");
386 static HRESULT WINAPI
OleControl_OnMnemonic(IOleControl
*iface
, MSG
*mMsg
)
388 ok(0, "unexpected call\n");
392 static HRESULT WINAPI
OleControl_OnAmbientPropertyChange(IOleControl
*iface
, DISPID dispID
)
396 CHECK_EXPECT2(OnAmbientPropertyChange_UNKNOWN
);
399 ok(0, "unexpected call %d\n", dispID
);
405 static HRESULT WINAPI
OleControl_FreezeEvents(IOleControl
*iface
, BOOL bFreeze
)
408 CHECK_EXPECT2(FreezeEvents_TRUE
);
410 CHECK_EXPECT2(FreezeEvents_FALSE
);
414 static const IOleControlVtbl OleControlVtbl
= {
415 OleControl_QueryInterface
,
418 OleControl_GetControlInfo
,
419 OleControl_OnMnemonic
,
420 OleControl_OnAmbientPropertyChange
,
421 OleControl_FreezeEvents
424 static IOleControl OleControl
= { &OleControlVtbl
};
426 static HRESULT WINAPI
QuickActivate_QueryInterface(IQuickActivate
*iface
, REFIID riid
, void **ppv
)
428 return ax_qi(riid
, ppv
);
431 static ULONG WINAPI
QuickActivate_AddRef(IQuickActivate
*iface
)
433 return ++activex_refcnt
;
436 static ULONG WINAPI
QuickActivate_Release(IQuickActivate
*iface
)
438 return --activex_refcnt
;
441 static HRESULT WINAPI
QuickActivate_QuickActivate(IQuickActivate
*iface
, QACONTAINER
*container
, QACONTROL
*control
)
443 CHECK_EXPECT(QuickActivate
);
445 ok(container
!= NULL
, "container == NULL\n");
446 ok(container
->cbSize
== sizeof(*container
), "container->cbSize = %d\n", container
->cbSize
);
447 ok(container
->pClientSite
!= NULL
, "container->pClientSite == NULL\n");
448 ok(container
->pAdviseSink
!= NULL
, "container->pAdviseSink == NULL\n");
449 ok(container
->pPropertyNotifySink
!= NULL
, "container->pPropertyNotifySink == NULL\n");
450 ok(!container
->pUnkEventSink
, "container->pUnkEventSink != NULL\n");
451 ok(container
->dwAmbientFlags
== (QACONTAINER_SUPPORTSMNEMONICS
|QACONTAINER_MESSAGEREFLECT
|QACONTAINER_USERMODE
),
452 "container->dwAmbientFlags = %x\n", container
->dwAmbientFlags
);
454 ok(!container
->colorFore
, "container->colorFore = %d\n", container
->colorFore
); /* FIXME */
456 ok(container
->colorBack
, "container->colorBack == 0\n"); /* FIXME */
458 todo_wine
ok(container
->pFont
!= NULL
, "container->pFont == NULL\n");
460 ok(!container
->pFont
, "container->pFont = %p\n", container
->pFont
);
462 ok(container
->pUndoMgr
!= NULL
, "container->pUndoMgr == NULL\n");
463 ok(!container
->dwAppearance
, "container->dwAppearance = %x\n", container
->dwAppearance
);
465 ok(!container
->lcid
, "container->lcid = %x\n", container
->lcid
);
466 ok(!container
->hpal
, "container->hpal = %p\n", container
->hpal
);
467 ok(!container
->pBindHost
, "container->pBindHost != NULL\n");
468 ok(!container
->pOleControlSite
, "container->pOleControlSite != NULL\n");
469 ok(!container
->pServiceProvider
, "container->pServiceProvider != NULL\n");
471 ok(control
->cbSize
== sizeof(*control
), "control->cbSize = %d\n", control
->cbSize
);
472 ok(!control
->dwMiscStatus
, "control->dwMiscStatus = %x\n", control
->dwMiscStatus
);
473 ok(!control
->dwViewStatus
, "control->dwViewStatus = %x\n", control
->dwViewStatus
);
474 ok(!control
->dwEventCookie
, "control->dwEventCookie = %x\n", control
->dwEventCookie
);
475 ok(!control
->dwPropNotifyCookie
, "control->dwPropNotifyCookie = %x\n", control
->dwPropNotifyCookie
);
476 ok(!control
->dwPointerActivationPolicy
, "control->dwPointerActivationPolicy = %x\n", control
->dwPointerActivationPolicy
);
478 ok(iface_cmp((IUnknown
*)container
->pClientSite
, (IUnknown
*)container
->pAdviseSink
),
479 "container->pClientSite != container->pAdviseSink\n");
480 ok(iface_cmp((IUnknown
*)container
->pClientSite
, (IUnknown
*)container
->pPropertyNotifySink
),
481 "container->pClientSite != container->pPropertyNotifySink\n");
482 test_ifaces((IUnknown
*)container
->pClientSite
, pluginhost_iids
);
484 IOleClientSite_AddRef(container
->pClientSite
);
485 client_site
= container
->pClientSite
;
487 control
->dwMiscStatus
= OLEMISC_SETCLIENTSITEFIRST
|OLEMISC_ACTIVATEWHENVISIBLE
|OLEMISC_INSIDEOUT
488 |OLEMISC_CANTLINKINSIDE
|OLEMISC_RECOMPOSEONRESIZE
;
489 control
->dwViewStatus
= 0x18;
490 control
->dwPropNotifyCookie
= 1;
495 static HRESULT WINAPI
QuickActivate_SetContentExtent(IQuickActivate
*iface
, LPSIZEL pSizel
)
497 ok(0, "unexpected call\n");
501 static HRESULT WINAPI
QuickActivate_GetContentExtent(IQuickActivate
*iface
, LPSIZEL pSizel
)
503 ok(0, "unexpected call\n");
507 static const IQuickActivateVtbl QuickActivateVtbl
= {
508 QuickActivate_QueryInterface
,
509 QuickActivate_AddRef
,
510 QuickActivate_Release
,
511 QuickActivate_QuickActivate
,
512 QuickActivate_GetContentExtent
,
513 QuickActivate_SetContentExtent
516 static IQuickActivate QuickActivate
= { &QuickActivateVtbl
};
518 static HRESULT WINAPI
PersistPropertyBag_QueryInterface(IPersistPropertyBag
*iface
, REFIID riid
, void **ppv
)
520 return ax_qi(riid
, ppv
);
523 static ULONG WINAPI
PersistPropertyBag_AddRef(IPersistPropertyBag
*iface
)
525 return ++activex_refcnt
;
528 static ULONG WINAPI
PersistPropertyBag_Release(IPersistPropertyBag
*iface
)
530 return --activex_refcnt
;
533 static HRESULT WINAPI
PersistPropertyBag_GetClassID(IPersistPropertyBag
*face
, CLSID
*pClassID
)
535 ok(0, "unexpected call\n");
539 static HRESULT WINAPI
PersistPropertyBag_InitNew(IPersistPropertyBag
*face
)
541 CHECK_EXPECT(IPersistPropertyBag_InitNew
);
545 static HRESULT WINAPI
PersistPropertyBag_Load(IPersistPropertyBag
*face
, IPropertyBag
*pPropBag
, IErrorLog
*pErrorLog
)
547 IBindHost
*bind_host
, *bind_host2
;
548 IServiceProvider
*sp
;
553 static const WCHAR param_nameW
[] = {'p','a','r','a','m','_','n','a','m','e',0};
554 static const WCHAR num_paramW
[] = {'n','u','m','_','p','a','r','a','m',0};
555 static const WCHAR no_paramW
[] = {'n','o','_','p','a','r','a','m',0};
556 static WCHAR test_swfW
[] = {'t','e','s','t','.','s','w','f',0};
558 static const IID
*propbag_ifaces
[] = {
564 CHECK_EXPECT(IPersistPropertyBag_Load
);
566 ok(pPropBag
!= NULL
, "pPropBag == NULL\n");
567 ok(!pErrorLog
, "pErrorLog != NULL\n");
569 test_ifaces((IUnknown
*)pPropBag
, propbag_ifaces
);
572 hres
= IPropertyBag_Read(pPropBag
, param_nameW
, &v
, NULL
);
573 ok(hres
== S_OK
, "Read failed: %08x\n", hres
);
574 ok(V_VT(&v
) == VT_BSTR
, "V_VT(&v) = %d\n", V_VT(&v
));
575 ok(!lstrcmpW(V_BSTR(&v
), L
"param_value"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
578 V_I4(&v
) = 0xdeadbeef;
579 hres
= IPropertyBag_Read(pPropBag
, param_nameW
, &v
, NULL
);
580 ok(hres
== DISP_E_TYPEMISMATCH
, "Read failed: %08x, expected DISP_E_TYPEMISMATCH\n", hres
);
581 ok(V_VT(&v
) == VT_I4
, "V_VT(&v) = %d\n", V_VT(&v
));
582 ok(V_I4(&v
) == 0xdeadbeef, "V_I4(v) = %x\n", V_I4(&v
));
585 hres
= IPropertyBag_Read(pPropBag
, num_paramW
, &v
, NULL
);
586 ok(hres
== S_OK
, "Read failed: %08x\n", hres
);
587 ok(V_VT(&v
) == VT_BSTR
, "V_VT(&v) = %d\n", V_VT(&v
));
588 ok(!lstrcmpW(V_BSTR(&v
), L
"3"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
589 SysFreeString(V_BSTR(&v
));
592 V_I4(&v
) = 0xdeadbeef;
593 hres
= IPropertyBag_Read(pPropBag
, num_paramW
, &v
, NULL
);
594 ok(hres
== S_OK
, "Read failed: %08x\n", hres
);
595 ok(V_VT(&v
) == VT_I4
, "V_VT(&v) = %d\n", V_VT(&v
));
596 ok(V_I4(&v
) == 3, "V_I4(v) = %x\n", V_I4(&v
));
599 V_BSTR(&v
) = (BSTR
)0xdeadbeef;
600 hres
= IPropertyBag_Read(pPropBag
, no_paramW
, &v
, NULL
);
601 ok(hres
== E_INVALIDARG
, "Read failed: %08x\n", hres
);
602 ok(V_VT(&v
) == VT_BSTR
, "V_VT(&v) = %d\n", V_VT(&v
));
603 ok(V_BSTR(&v
) == (BSTR
)0xdeadbeef, "V_BSTR(v) = %p\n", V_BSTR(&v
));
605 set_plugin_readystate(READYSTATE_INTERACTIVE
);
607 hres
= IOleClientSite_QueryInterface(client_site
, &IID_IBindHost
, (void**)&bind_host
);
608 ok(hres
== S_OK
, "Could not get IBindHost iface: %08x\n", hres
);
610 hres
= IOleClientSite_QueryInterface(client_site
, &IID_IServiceProvider
, (void**)&sp
);
611 ok(hres
== S_OK
, "Could not get IServiceProvider iface: %08x\n", hres
);
613 hres
= IServiceProvider_QueryService(sp
, &SID_SBindHost
, &IID_IBindHost
, (void**)&bind_host2
);
614 ok(hres
== S_OK
, "QueryService(SID_SBindHost) failed: %08x\n", hres
);
615 IServiceProvider_Release(sp
);
617 ok(iface_cmp((IUnknown
*)bind_host
, (IUnknown
*)bind_host2
), "bind_host != bind_host2\n");
618 IBindHost_Release(bind_host2
);
621 hres
= IBindHost_CreateMoniker(bind_host
, test_swfW
, NULL
, &mon
, 0);
622 ok(hres
== S_OK
, "CreateMoniker failed: %08x\n", hres
);
623 ok(mon
!= NULL
, "mon == NULL\n");
624 test_mon_displayname(mon
, L
"about:test.swf", L
"about:blanktest.swf");
625 IMoniker_Release(mon
);
627 IBindHost_Release(bind_host
);
630 hres
= IOleClientSite_GetMoniker(client_site
, OLEGETMONIKER_ONLYIFTHERE
, OLEWHICHMK_CONTAINER
, &mon
);
631 ok(hres
== S_OK
, "GetMoniker failed: %08x\n", hres
);
632 ok(mon
!= NULL
, "mon == NULL\n");
633 test_mon_displayname(mon
, L
"about:blank", NULL
);
634 IMoniker_Release(mon
);
636 set_plugin_readystate(READYSTATE_COMPLETE
);
641 static HRESULT WINAPI
PersistPropertyBag_Save(IPersistPropertyBag
*face
, IPropertyBag
*pPropBag
, BOOL fClearDisrty
, BOOL fSaveAllProperties
)
643 ok(0, "unexpected call\n");
647 static const IPersistPropertyBagVtbl PersistPropertyBagVtbl
= {
648 PersistPropertyBag_QueryInterface
,
649 PersistPropertyBag_AddRef
,
650 PersistPropertyBag_Release
,
651 PersistPropertyBag_GetClassID
,
652 PersistPropertyBag_InitNew
,
653 PersistPropertyBag_Load
,
654 PersistPropertyBag_Save
658 static IPersistPropertyBag PersistPropertyBag
= { &PersistPropertyBagVtbl
};
660 static HRESULT WINAPI
Dispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
662 return ax_qi(riid
, ppv
);
665 static ULONG WINAPI
Dispatch_AddRef(IDispatch
*iface
)
667 return ++activex_refcnt
;
670 static ULONG WINAPI
Dispatch_Release(IDispatch
*iface
)
672 return --activex_refcnt
;
675 static HRESULT WINAPI
Dispatch_GetTypeInfoCount(IDispatch
*iface
, UINT
*pctinfo
)
677 ok(0, "unexpected call\n");
681 static HRESULT WINAPI
Dispatch_GetTypeInfo(IDispatch
*iface
, UINT iTInfo
, LCID lcid
,
684 CHECK_EXPECT(GetTypeInfo
);
686 ITypeInfo_AddRef(actxtest_typeinfo
);
687 *ppTInfo
= actxtest_typeinfo
;
691 static HRESULT WINAPI
Dispatch_GetIDsOfNames(IDispatch
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
692 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
694 ok(IsEqualGUID(riid
, &IID_NULL
), "riid = %s\n", wine_dbgstr_guid(riid
));
695 ok(cNames
== 1, "cNames = %d\n", cNames
);
696 ok(rgszNames
!= NULL
, "rgszNames == NULL\n");
697 ok(rgDispId
!= NULL
, "rgDispId == NULL\n");
699 if(!lstrcmpW(rgszNames
[0], L
"scriptprop")) {
700 CHECK_EXPECT(GetIDsOfNames_scriptprop
);
701 *rgDispId
= DISPID_SCRIPTPROP
;
702 }else if(!lstrcmpW(rgszNames
[0], L
"scriptCall")) {
703 *rgDispId
= DISPID_SCRIPTCALL
;
705 ok(0, "rgszNames[0] = %s\n", wine_dbgstr_w(rgszNames
[0]));
711 static HRESULT WINAPI
Dispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
712 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
713 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
715 ok(IsEqualGUID(riid
, &IID_NULL
), "riid = %s\n", wine_dbgstr_guid(riid
));
716 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
717 ok(!pDispParams
->cNamedArgs
, "pDispParams->cNamedArgs = %d\n", pDispParams
->cNamedArgs
);
718 ok(!pDispParams
->rgdispidNamedArgs
, "pDispParams->rgdispidNamedArgs != NULL\n");
720 switch(dispIdMember
) {
721 case DISPID_READYSTATE
:
722 CHECK_EXPECT2(Invoke_READYSTATE
);
723 ok(wFlags
== DISPATCH_PROPERTYGET
, "wFlags = %x\n", wFlags
);
724 ok(!pDispParams
->cArgs
, "pDispParams->cArgs = %d\n", pDispParams
->cArgs
);
725 ok(!pDispParams
->rgvarg
, "pDispParams->rgvarg != NULL\n");
726 ok(!pExcepInfo
, "pExcepInfo != NULL\n");
727 ok(puArgErr
!= NULL
, "puArgErr == NULL\n");
728 ok(pVarResult
!= NULL
, "pVarResult == NULL\n");
730 V_VT(pVarResult
) = VT_I4
;
731 V_I4(pVarResult
) = plugin_readystate
;
734 CHECK_EXPECT2(Invoke_ENABLED
);
735 ok(wFlags
== DISPATCH_PROPERTYGET
, "wFlags = %x\n", wFlags
);
736 ok(!pDispParams
->cArgs
, "pDispParams->cArgs = %d\n", pDispParams
->cArgs
);
737 ok(!pDispParams
->rgvarg
, "pDispParams->rgvarg != NULL\n");
738 ok(!pExcepInfo
, "pExcepInfo != NULL\n");
739 ok(puArgErr
!= NULL
, "puArgErr == NULL\n");
740 ok(pVarResult
!= NULL
, "pVarResult == NULL\n");
741 return DISP_E_MEMBERNOTFOUND
;
743 CHECK_EXPECT(Invoke_VALID
);
744 ok(wFlags
== DISPATCH_PROPERTYGET
, "wFlags = %x\n", wFlags
);
745 ok(!pDispParams
->cArgs
, "pDispParams->cArgs = %d\n", pDispParams
->cArgs
);
746 ok(!pDispParams
->rgvarg
, "pDispParams->rgvarg != NULL\n");
747 ok(!pExcepInfo
, "pExcepInfo != NULL\n");
748 ok(puArgErr
!= NULL
, "puArgErr == NULL\n");
749 ok(pVarResult
!= NULL
, "pVarResult == NULL\n");
750 return DISP_E_MEMBERNOTFOUND
;
751 case DISPID_SECURITYCTX
:
752 CHECK_EXPECT(Invoke_SECURITYCTX
);
753 ok(wFlags
== DISPATCH_PROPERTYGET
, "wFlags = %x\n", wFlags
);
754 ok(!pDispParams
->cArgs
, "pDispParams->cArgs = %d\n", pDispParams
->cArgs
);
755 ok(!pDispParams
->rgvarg
, "pDispParams->rgvarg != NULL\n");
756 ok(!pExcepInfo
, "pExcepInfo != NULL\n");
757 ok(puArgErr
!= NULL
, "puArgErr == NULL\n");
758 ok(pVarResult
!= NULL
, "pVarResult == NULL\n");
759 return DISP_E_MEMBERNOTFOUND
;
760 case DISPID_SCRIPTPROP
:
761 CHECK_EXPECT(Invoke_SCRIPTPROP
);
762 ok(wFlags
== DISPATCH_PROPERTYGET
, "wFlags = %x\n", wFlags
);
763 ok(!pDispParams
->cArgs
, "pDispParams->cArgs = %d\n", pDispParams
->cArgs
);
764 ok(!pDispParams
->rgvarg
, "pDispParams->rgvarg != NULL\n");
765 ok(pExcepInfo
!= NULL
, "pExcepInfo == NULL\n");
766 ok(!puArgErr
, "puArgErr != NULL\n");
767 ok(pVarResult
!= NULL
, "pVarResult == NULL\n");
769 V_VT(pVarResult
) = VT_I4
;
770 V_I4(pVarResult
) = 4;
772 case DISPID_SCRIPTCALL
:
773 CHECK_EXPECT(Invoke_SCRIPTCALL
);
774 ok(wFlags
== DISPATCH_METHOD
, "wFlags = %x\n", wFlags
);
775 ok(!pDispParams
->cArgs
, "pDispParams->cArgs = %d\n", pDispParams
->cArgs
);
776 ok(pExcepInfo
!= NULL
, "pExcepInfo == NULL\n");
777 ok(!puArgErr
, "puArgErr != NULL\n");
778 ok(!pVarResult
, "pVarResult != NULL\n");
780 V_VT(pVarResult) = VT_I4;
781 V_I4(pVarResult) = 4;
785 ok(0, "unexpected call %d\n", dispIdMember
);
791 static const IDispatchVtbl DispatchVtbl
= {
792 Dispatch_QueryInterface
,
795 Dispatch_GetTypeInfoCount
,
796 Dispatch_GetTypeInfo
,
797 Dispatch_GetIDsOfNames
,
801 static IDispatch Dispatch
= { &DispatchVtbl
};
803 static HRESULT WINAPI
ProvideClassInfo_QueryInterface(IProvideClassInfo
*iface
, REFIID riid
, void **ppv
)
805 return ax_qi(riid
, ppv
);
808 static ULONG WINAPI
ProvideClassInfo_AddRef(IProvideClassInfo
*iface
)
810 return ++activex_refcnt
;
813 static ULONG WINAPI
ProvideClassInfo_Release(IProvideClassInfo
*iface
)
815 return --activex_refcnt
;
818 static HRESULT WINAPI
ProvideClassInfo_GetClassInfo(IProvideClassInfo
*iface
, ITypeInfo
**ppTI
)
820 CHECK_EXPECT(GetClassInfo
);
822 ITypeInfo_AddRef(class_typeinfo
);
823 *ppTI
= class_typeinfo
;
827 static const IProvideClassInfoVtbl ProvideClassInfoVtbl
= {
828 ProvideClassInfo_QueryInterface
,
829 ProvideClassInfo_AddRef
,
830 ProvideClassInfo_Release
,
831 ProvideClassInfo_GetClassInfo
834 static IProvideClassInfo ProvideClassInfo
= { &ProvideClassInfoVtbl
};
836 static HRESULT WINAPI
ConnectionPointContainer_QueryInterface(IConnectionPointContainer
*iface
, REFIID riid
, void **ppv
)
838 return ax_qi(riid
, ppv
);
841 static ULONG WINAPI
ConnectionPointContainer_AddRef(IConnectionPointContainer
*iface
)
843 return ++activex_refcnt
;
846 static ULONG WINAPI
ConnectionPointContainer_Release(IConnectionPointContainer
*iface
)
848 return --activex_refcnt
;
851 static HRESULT WINAPI
ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer
*iface
,
852 IEnumConnectionPoints
**ppEnum
)
854 ok(0, "unexpected call\n");
858 static HRESULT WINAPI
ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer
*iface
,
859 REFIID riid
, IConnectionPoint
**ppCP
)
861 if(IsEqualGUID(riid
, &IID_IPropertyNotifySink
)) {
863 trace("FindConnectionPoint(IID_IPropertyNotifySink)\n");
864 return CONNECT_E_NOCONNECTION
;
867 CHECK_EXPECT(FindConnectionPoint
);
868 ok(IsEqualGUID(riid
, &DIID_DispActiveXTest
), "riid = %s\n", wine_dbgstr_guid(riid
));
870 IConnectionPoint_AddRef(&ConnectionPoint
);
871 *ppCP
= &ConnectionPoint
;
875 static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl
= {
876 ConnectionPointContainer_QueryInterface
,
877 ConnectionPointContainer_AddRef
,
878 ConnectionPointContainer_Release
,
879 ConnectionPointContainer_EnumConnectionPoints
,
880 ConnectionPointContainer_FindConnectionPoint
883 static IConnectionPointContainer ConnectionPointContainer
= { &ConnectionPointContainerVtbl
};
885 static HRESULT WINAPI
ViewObjectEx_QueryInterface(IViewObjectEx
*iface
, REFIID riid
, void **ppv
)
887 return ax_qi(riid
, ppv
);
890 static ULONG WINAPI
ViewObjectEx_AddRef(IViewObjectEx
*iface
)
892 return ++activex_refcnt
;
895 static ULONG WINAPI
ViewObjectEx_Release(IViewObjectEx
*iface
)
897 return --activex_refcnt
;
900 static HRESULT WINAPI
ViewObjectEx_Draw(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
, void *pvAspect
, DVTARGETDEVICE
*ptd
,
901 HDC hdcTargetDev
, HDC hdcDraw
, LPCRECTL lprcBounds
, LPCRECTL lprcWBoungs
, BOOL (WINAPI
*pfnContinue
)(ULONG_PTR
), ULONG_PTR dwContinue
)
903 ok(0, "unexpected call\n");
907 static HRESULT WINAPI
ViewObjectEx_GetColorSet(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
, void *pvAspect
, DVTARGETDEVICE
*ptd
,
908 HDC hicTargetDev
, LOGPALETTE
**ppColorSet
)
910 ok(0, "unexpected call\n");
914 static HRESULT WINAPI
ViewObjectEx_Freeze(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
, void *pvAspect
, DWORD
*pdwFreeze
)
916 ok(0, "unexpected call\n");
920 static HRESULT WINAPI
ViewObjectEx_Unfreeze(IViewObjectEx
*iface
, DWORD dwFreeze
)
922 ok(0, "unexpected call\n");
926 static HRESULT WINAPI
ViewObjectEx_SetAdvise(IViewObjectEx
*iface
, DWORD aspects
, DWORD advf
, IAdviseSink
*pAdvSink
)
928 CHECK_EXPECT(SetAdvise
);
930 ok(aspects
== DVASPECT_CONTENT
, "aspects = %x\n", aspects
);
931 ok(!advf
, "advf = %x\n", advf
);
932 ok(pAdvSink
!= NULL
, "pAdvSink = NULL\n");
937 static HRESULT WINAPI
ViewObjectEx_GetAdvise(IViewObjectEx
*iface
, DWORD
*pAspects
, DWORD
*pAdvf
, IAdviseSink
**ppAdvSink
)
939 ok(0, "unexpected call\n");
943 static HRESULT WINAPI
ViewObjectEx_GetExtent(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
, DVTARGETDEVICE
*ptd
, LPSIZEL lpsizel
)
945 ok(0, "unexpected call\n");
949 static HRESULT WINAPI
ViewObjectEx_GetRect(IViewObjectEx
*iface
, DWORD dwAspect
, LPRECTL pRect
)
951 ok(0, "unexpected call\n");
955 static HRESULT WINAPI
ViewObjectEx_GetViewStatus(IViewObjectEx
*iface
, DWORD
*pdwStatus
)
957 CHECK_EXPECT(GetViewStatus
);
959 *pdwStatus
= VIEWSTATUS_OPAQUE
|VIEWSTATUS_SOLIDBKGND
;
963 static HRESULT WINAPI
ViewObjectEx_QueryHitPoint(IViewObjectEx
*iface
, DWORD dwAspect
, LPCRECT pRectBounds
, POINT ptlLoc
,
964 LONG lCloseHint
, DWORD
*pHitResult
)
966 trace("QueryHitPoint call ignored\n");
970 static HRESULT WINAPI
ViewObjectEx_QueryHitRect(IViewObjectEx
*iface
, DWORD dwAspect
, LPCRECT pRectBounds
, LPCRECT pRectLoc
,
971 LONG lCloseHint
, DWORD
*pHitResult
)
973 ok(0, "unexpected call\n");
977 static HRESULT WINAPI
ViewObjectEx_GetNaturalExtent(IViewObjectEx
*iface
, DWORD dwAspect
, LONG lindex
, DVTARGETDEVICE
*ptd
,
978 HDC hicTargetDev
, DVEXTENTINFO
*pExtentIngo
, LPSIZEL pSizel
)
980 ok(0, "unexpected call\n");
984 static const IViewObjectExVtbl ViewObjectExVtbl
= {
985 ViewObjectEx_QueryInterface
,
987 ViewObjectEx_Release
,
989 ViewObjectEx_GetColorSet
,
991 ViewObjectEx_Unfreeze
,
992 ViewObjectEx_SetAdvise
,
993 ViewObjectEx_GetAdvise
,
994 ViewObjectEx_GetExtent
,
995 ViewObjectEx_GetRect
,
996 ViewObjectEx_GetViewStatus
,
997 ViewObjectEx_QueryHitPoint
,
998 ViewObjectEx_QueryHitRect
,
999 ViewObjectEx_GetNaturalExtent
1002 static IViewObjectEx ViewObjectEx
= { &ViewObjectExVtbl
};
1004 static HRESULT WINAPI
OleObject_QueryInterface(IOleObject
*iface
, REFIID riid
, void **ppv
)
1006 return ax_qi(riid
, ppv
);
1009 static ULONG WINAPI
OleObject_AddRef(IOleObject
*iface
)
1011 return ++activex_refcnt
;
1014 static ULONG WINAPI
OleObject_Release(IOleObject
*iface
)
1016 return --activex_refcnt
;
1019 static HRESULT WINAPI
OleObject_SetClientSite(IOleObject
*iface
, IOleClientSite
*pClientSite
)
1022 CHECK_EXPECT(SetClientSite_NULL
);
1026 CHECK_EXPECT(SetClientSite
);
1028 IOleClientSite_AddRef(pClientSite
);
1029 client_site
= pClientSite
;
1033 static HRESULT WINAPI
OleObject_GetClientSite(IOleObject
*iface
, IOleClientSite
**ppClientSite
)
1035 ok(0, "unexpected call\n");
1039 static HRESULT WINAPI
OleObject_SetHostNames(IOleObject
*iface
, LPCOLESTR szContainerApp
, LPCOLESTR szContainerObj
)
1041 ok(0, "unexpected call\n");
1045 static HRESULT WINAPI
OleObject_Close(IOleObject
*iface
, DWORD dwSaveOption
)
1047 CHECK_EXPECT(Close
);
1049 ok(dwSaveOption
== OLECLOSE_NOSAVE
, "dwSaveOption = %d\n", dwSaveOption
);
1053 static HRESULT WINAPI
OleObject_SetMoniker(IOleObject
*iface
, DWORD dwWhichMoniker
, IMoniker
*pmk
)
1055 ok(0, "unexpected call\n");
1059 static HRESULT WINAPI
OleObject_GetMoniker(IOleObject
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
, IMoniker
**ppmk
)
1061 ok(0, "unexpected call\n");
1065 static HRESULT WINAPI
OleObject_InitFromData(IOleObject
*iface
, IDataObject
*pDataObject
, BOOL fCreation
,
1068 ok(0, "unexpected call\n");
1072 static HRESULT WINAPI
OleObject_GetClipboardData(IOleObject
*iface
, DWORD dwReserved
, IDataObject
**ppDataObject
)
1074 ok(0, "unexpected call\n");
1078 static HRESULT WINAPI
OleObject_DoVerb(IOleObject
*iface
, LONG iVerb
, LPMSG lpmsg
, IOleClientSite
*pActiveSite
,
1079 LONG lindex
, HWND hwndParent
, LPCRECT lprcPosRect
)
1081 OLEINPLACEFRAMEINFO frame_info
= {0xdeadbeef};
1082 IOleInPlaceUIWindow
*ip_uiwindow
;
1083 IOleInPlaceFrame
*ip_frame
;
1084 IOleInPlaceSiteEx
*ip_site
;
1085 RECT pos_rect
, clip_rect
;
1090 CHECK_EXPECT(DoVerb
);
1092 ok(iVerb
== OLEIVERB_INPLACEACTIVATE
, "iVerb = %d\n", iVerb
);
1093 ok(!lpmsg
, "lpmsg != NULL\n");
1094 ok(pActiveSite
!= NULL
, "pActiveSite == NULL\n");
1095 ok(!lindex
, "lindex = %d\n", lindex
);
1096 ok(hwndParent
!= NULL
, "hwndParent == NULL\n");
1097 ok(lprcPosRect
!= NULL
, "lprcPosRect == NULL\n");
1099 hres
= IOleClientSite_QueryInterface(pActiveSite
, &IID_IOleInPlaceSiteEx
, (void**)&ip_site
);
1100 ok(hres
== S_OK
, "Could not get IOleInPlaceSiteEx iface: %08x\n", hres
);
1102 hres
= IOleInPlaceSiteEx_CanInPlaceActivate(ip_site
);
1103 ok(hres
== S_OK
, "CanInPlaceActivate failed: %08x\n", hres
);
1105 SET_EXPECT(InPlaceObject_GetWindow
);
1106 no_redraw
= 0xdeadbeef;
1107 hres
= IOleInPlaceSiteEx_OnInPlaceActivateEx(ip_site
, &no_redraw
, 0);
1108 ok(hres
== S_OK
, "InPlaceActivateEx failed: %08x\n", hres
);
1109 ok(!no_redraw
, "no_redraw = %x\n", no_redraw
);
1110 CHECK_CALLED(InPlaceObject_GetWindow
);
1112 no_redraw
= 0xdeadbeef;
1113 hres
= IOleInPlaceSiteEx_OnInPlaceActivateEx(ip_site
, &no_redraw
, 0);
1114 ok(hres
== S_OK
, "InPlaceActivateEx failed: %08x\n", hres
);
1115 ok(no_redraw
== 0xdeadbeef, "no_redraw = %x\n", no_redraw
);
1118 hres
= IOleInPlaceSiteEx_GetWindow(ip_site
, &hwnd
);
1119 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1120 ok(hwnd
!= NULL
, "hwnd == NULL\n");
1121 ok(hwnd
== hwndParent
, "hwnd != hwndParent\n");
1123 create_plugin_window(hwnd
, lprcPosRect
);
1127 frame_info
.cb
= sizeof(OLEINPLACEFRAMEINFO
);
1128 hres
= IOleInPlaceSiteEx_GetWindowContext(ip_site
, &ip_frame
, &ip_uiwindow
, &pos_rect
, &clip_rect
, &frame_info
);
1129 ok(hres
== S_OK
, "GetWindowContext failed: %08x\n", hres
);
1130 ok(ip_frame
!= NULL
, "ip_frame == NULL\n");
1131 ok(ip_uiwindow
!= NULL
, "ip_uiwindow == NULL\n");
1132 ok((IOleInPlaceUIWindow
*)ip_frame
!= ip_uiwindow
, "ip_frame == ip_uiwindow\n");
1133 ok(EqualRect(&pos_rect
, lprcPosRect
), "pos_rect != lpecPosRect\n");
1134 ok(EqualRect(&clip_rect
, lprcPosRect
), "clip_rect != lpecPosRect\n");
1135 ok(frame_info
.cb
== sizeof(frame_info
), "frame_info.cb = %d\n", frame_info
.cb
);
1136 ok(!frame_info
.fMDIApp
, "frame_info.fMDIApp = %x\n", frame_info
.fMDIApp
);
1137 ok(frame_info
.hwndFrame
!= NULL
, "frame_info.hwnd == NULL\n");
1138 ok(frame_info
.hwndFrame
== container_hwnd
, "frame_info.hwnd != container_hwnd\n");
1139 ok(!frame_info
.haccel
, "frame_info.haccel != 0\n");
1140 ok(!frame_info
.cAccelEntries
, "frame_info.cAccelEntried != 0\n");
1142 IOleInPlaceFrame_Release(ip_frame
);
1143 IOleInPlaceUIWindow_Release(ip_uiwindow
);
1146 IOleInPlaceSiteEx_Release(ip_site
);
1148 hres
= IOleClientSite_ShowObject(client_site
);
1149 ok(hres
== S_OK
, "ShowObject failed: %08x\n", hres
);
1151 SET_EXPECT(InPlaceObject_GetWindow
);
1152 SET_EXPECT(SetObjectRects
);
1157 static HRESULT WINAPI
OleObject_EnumVerbs(IOleObject
*iface
, IEnumOLEVERB
**ppEnumOleVerb
)
1159 ok(0, "unexpected call\n");
1163 static HRESULT WINAPI
OleObject_Update(IOleObject
*iface
)
1165 ok(0, "unexpected call\n");
1169 static HRESULT WINAPI
OleObject_IsUpToDate(IOleObject
*iface
)
1171 ok(0, "unexpected call\n");
1175 static HRESULT WINAPI
OleObject_GetUserClassID(IOleObject
*iface
, CLSID
*pClsid
)
1177 ok(0, "unexpected call\n");
1181 static HRESULT WINAPI
OleObject_GetUserType(IOleObject
*iface
, DWORD dwFormOfType
, LPOLESTR
*pszUserType
)
1183 ok(0, "unexpected call\n");
1187 static HRESULT WINAPI
OleObject_SetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
1189 CHECK_EXPECT(SetExtent
);
1193 static HRESULT WINAPI
OleObject_GetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
1195 CHECK_EXPECT(GetExtent
);
1199 static HRESULT WINAPI
OleObject_Advise(IOleObject
*iface
, IAdviseSink
*pAdvSink
, DWORD
*pdwConnection
)
1201 ok(0, "unexpected call\n");
1205 static HRESULT WINAPI
OleObject_Unadvise(IOleObject
*iface
, DWORD dwConnection
)
1207 ok(0, "unexpected call\n");
1211 static HRESULT WINAPI
OleObject_EnumAdvise(IOleObject
*iface
, IEnumSTATDATA
**ppenumAdvise
)
1213 ok(0, "unexpected call\n");
1217 static HRESULT WINAPI
OleObject_GetMiscStatus(IOleObject
*iface
, DWORD dwAspect
, DWORD
*pdwStatus
)
1219 CHECK_EXPECT(GetMiscStatus
);
1220 ok(dwAspect
== DVASPECT_CONTENT
, "dwAspect = %d\n", dwAspect
);
1221 ok(pdwStatus
!= NULL
, "pdwStatus == NULL\n");
1222 *pdwStatus
= OLEMISC_SETCLIENTSITEFIRST
|OLEMISC_ACTIVATEWHENVISIBLE
1223 |OLEMISC_INSIDEOUT
|OLEMISC_CANTLINKINSIDE
|OLEMISC_RECOMPOSEONRESIZE
;
1227 static HRESULT WINAPI
OleObject_SetColorScheme(IOleObject
*iface
, LOGPALETTE
*pLogpal
)
1229 ok(0, "unexpected call\n");
1233 static const IOleObjectVtbl OleObjectVtbl
= {
1234 OleObject_QueryInterface
,
1237 OleObject_SetClientSite
,
1238 OleObject_GetClientSite
,
1239 OleObject_SetHostNames
,
1241 OleObject_SetMoniker
,
1242 OleObject_GetMoniker
,
1243 OleObject_InitFromData
,
1244 OleObject_GetClipboardData
,
1246 OleObject_EnumVerbs
,
1248 OleObject_IsUpToDate
,
1249 OleObject_GetUserClassID
,
1250 OleObject_GetUserType
,
1251 OleObject_SetExtent
,
1252 OleObject_GetExtent
,
1255 OleObject_EnumAdvise
,
1256 OleObject_GetMiscStatus
,
1257 OleObject_SetColorScheme
1260 static IOleObject OleObject
= { &OleObjectVtbl
};
1262 static HRESULT WINAPI
OleInPlaceObject_QueryInterface(IOleInPlaceObjectWindowless
*iface
,
1263 REFIID riid
, void **ppv
)
1265 return ax_qi(riid
, ppv
);
1268 static ULONG WINAPI
OleInPlaceObject_AddRef(IOleInPlaceObjectWindowless
*iface
)
1270 return ++activex_refcnt
;
1273 static ULONG WINAPI
OleInPlaceObject_Release(IOleInPlaceObjectWindowless
*iface
)
1275 return --activex_refcnt
;
1278 static HRESULT WINAPI
OleInPlaceObject_GetWindow(IOleInPlaceObjectWindowless
*iface
,
1281 CHECK_EXPECT2(InPlaceObject_GetWindow
);
1283 ok(phwnd
!= NULL
, "phwnd == NULL\n");
1285 *phwnd
= plugin_hwnd
;
1286 return *phwnd
? S_OK
: E_UNEXPECTED
;
1289 static HRESULT WINAPI
OleInPlaceObject_ContextSensitiveHelp(IOleInPlaceObjectWindowless
*iface
,
1292 ok(0, "unexpected call\n");
1296 static HRESULT WINAPI
OleInPlaceObject_InPlaceDeactivate(IOleInPlaceObjectWindowless
*iface
)
1298 IOleInPlaceSite
*ip_site
;
1301 CHECK_EXPECT(InPlaceDeactivate
);
1303 hres
= IOleClientSite_QueryInterface(client_site
, &IID_IOleInPlaceSite
, (void**)&ip_site
);
1304 ok(hres
== S_OK
, "Could not get IOleInPlaceSite iface: %08x\n", hres
);
1306 hres
= IOleInPlaceSite_OnInPlaceDeactivate(ip_site
);
1307 ok(hres
== S_OK
, "OnInPlaceDeactivate failed: %08x\n", hres
);
1309 IOleInPlaceSite_Release(ip_site
);
1313 static HRESULT WINAPI
OleInPlaceObject_UIDeactivate(IOleInPlaceObjectWindowless
*iface
)
1315 CHECK_EXPECT2(UIDeactivate
);
1319 static HRESULT WINAPI
OleInPlaceObject_SetObjectRects(IOleInPlaceObjectWindowless
*iface
,
1320 LPCRECT lprcPosRect
, LPCRECT lprcClipRect
)
1322 CHECK_EXPECT2(SetObjectRects
);
1326 static HRESULT WINAPI
OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless
*iface
)
1328 ok(0, "unexpected call\n");
1332 static HRESULT WINAPI
OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless
*iface
,
1333 UINT msg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*lpResult
)
1335 ok(0, "unexpected call\n");
1339 static HRESULT WINAPI
OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless
*iface
,
1340 IDropTarget
**ppDropTarget
)
1342 ok(0, "unexpected call\n");
1346 static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl
= {
1347 OleInPlaceObject_QueryInterface
,
1348 OleInPlaceObject_AddRef
,
1349 OleInPlaceObject_Release
,
1350 OleInPlaceObject_GetWindow
,
1351 OleInPlaceObject_ContextSensitiveHelp
,
1352 OleInPlaceObject_InPlaceDeactivate
,
1353 OleInPlaceObject_UIDeactivate
,
1354 OleInPlaceObject_SetObjectRects
,
1355 OleInPlaceObjectWindowless_ReactivateAndUndo
,
1356 OleInPlaceObjectWindowless_OnWindowMessage
,
1357 OleInPlaceObjectWindowless_GetDropTarget
1360 static IOleInPlaceObjectWindowless OleInPlaceObjectWindowless
= { &OleInPlaceObjectWindowlessVtbl
};
1362 static void *wrapped_iface_vtbl
[100];
1363 static IUnknown wrapped_iface
= { (IUnknownVtbl
*)wrapped_iface_vtbl
};
1365 static HRESULT WINAPI
wrapped_QueryInterface(IUnknown
*iface
, REFIID riid
, void **ppv
)
1367 ok(0, "unexpected wrapped_QueryInterface call\n");
1369 return E_NOINTERFACE
;
1372 static ULONG WINAPI
wrapped_AddRef(IUnknown
*iface
)
1374 CHECK_EXPECT(wrapped_AddRef
);
1378 static ULONG WINAPI
wrapped_Release(IUnknown
*iface
)
1380 CHECK_EXPECT(wrapped_Release
);
1384 static HRESULT WINAPI
wrapped_func_nocall(IUnknown
*iface
, int i
, double d
)
1386 ok(0, "unexpected call\n");
1390 static HRESULT WINAPI
wrapped_func(IUnknown
*iface
, int i
, double d
)
1392 CHECK_EXPECT(wrapped_func
);
1393 ok(iface
== &wrapped_iface
, "iface != wrapped_iface\n");
1394 ok(i
== 10, "i = %d\n", i
);
1395 ok(d
== 32.0, "d = %lf\n", d
);
1399 static void init_wrapped_iface(void)
1403 wrapped_iface_vtbl
[0] = wrapped_QueryInterface
;
1404 wrapped_iface_vtbl
[1] = wrapped_AddRef
;
1405 wrapped_iface_vtbl
[2] = wrapped_Release
;
1407 for(i
=3; i
<100; i
++)
1408 wrapped_iface_vtbl
[i
] = wrapped_func_nocall
;
1410 wrapped_iface_vtbl
[63] = wrapped_func
;
1413 static HRESULT
ax_qi(REFIID riid
, void **ppv
)
1415 if(IsEqualGUID(riid
, &IID_IUnknown
) || IsEqualGUID(riid
, &IID_IOleControl
)) {
1416 *ppv
= plugin_behavior
== TEST_DISPONLY
? NULL
: &OleControl
;
1417 }else if(IsEqualGUID(riid
, &IID_IQuickActivate
)) {
1418 *ppv
= no_quickact
? NULL
: &QuickActivate
;
1419 }else if(IsEqualGUID(riid
, &IID_IPersistPropertyBag
)) {
1420 *ppv
= no_quickact
? NULL
: &PersistPropertyBag
;
1421 }else if(IsEqualGUID(riid
, &IID_IDispatch
)) {
1423 }else if(IsEqualGUID(riid
, &IID_IProvideClassInfo
)) {
1424 *ppv
= &ProvideClassInfo
;
1425 }else if(IsEqualGUID(riid
, &IID_IConnectionPointContainer
)) {
1426 *ppv
= plugin_behavior
!= TEST_DISPONLY
? &ConnectionPointContainer
: NULL
;
1427 }else if(IsEqualGUID(riid
, &IID_IViewObject
) || IsEqualGUID(riid
, &IID_IViewObject2
)
1428 || IsEqualGUID(riid
, &IID_IViewObjectEx
)) {
1429 *ppv
= plugin_behavior
== TEST_DISPONLY
? NULL
: &ViewObjectEx
;
1430 }else if(IsEqualGUID(riid
, &IID_IOleObject
)) {
1431 *ppv
= plugin_behavior
== TEST_DISPONLY
? NULL
: &OleObject
;
1432 }else if(IsEqualGUID(riid
, &IID_ITestActiveX
)) {
1433 CHECK_EXPECT(QI_ITestActiveX
);
1434 *ppv
= &wrapped_iface
;
1436 }else if(IsEqualGUID(riid
, &IID_IOleWindow
) || IsEqualGUID(riid
, &IID_IOleInPlaceObject
)
1437 || IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
)) {
1438 *ppv
= plugin_behavior
== TEST_DISPONLY
? NULL
: &OleInPlaceObjectWindowless
;
1440 trace("QI %s\n", wine_dbgstr_guid(riid
));
1445 return E_NOINTERFACE
;
1447 IUnknown_AddRef((IUnknown
*)*ppv
);
1451 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
1455 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IClassFactory
, riid
)) {
1460 if(IsEqualGUID(&IID_IMarshal
, riid
))
1461 return E_NOINTERFACE
;
1462 if(IsEqualGUID(&CLSID_IdentityUnmarshal
, riid
))
1463 return E_NOINTERFACE
;
1464 if(IsEqualGUID(&IID_IClassFactoryEx
, riid
))
1465 return E_NOINTERFACE
; /* TODO */
1467 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid
));
1471 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
1476 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
1481 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
, REFIID riid
, void **ppv
)
1483 CHECK_EXPECT(CreateInstance
);
1485 ok(!outer
, "outer = %p\n", outer
);
1486 ok(IsEqualGUID(riid
, &IID_IUnknown
), "riid = %s\n", wine_dbgstr_guid(riid
));
1493 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
1495 ok(0, "unexpected call\n");
1499 static const IClassFactoryVtbl ClassFactoryVtbl
= {
1500 ClassFactory_QueryInterface
,
1501 ClassFactory_AddRef
,
1502 ClassFactory_Release
,
1503 ClassFactory_CreateInstance
,
1504 ClassFactory_LockServer
1507 static IClassFactory activex_cf
= { &ClassFactoryVtbl
};
1509 static void test_elem_dispex(IDispatchEx
*dispex
)
1518 str
= SysAllocString(L
"scriptprop");
1519 SET_EXPECT(GetIDsOfNames_scriptprop
);
1520 hres
= IDispatchEx_GetDispID(dispex
, str
, 0, &id
);
1521 CHECK_CALLED(GetIDsOfNames_scriptprop
);
1523 ok(hres
== S_OK
, "GetDispID failed: %08x\n", hres
);
1525 ok(id
== DISPID_SCRIPTPROP
, "id = %d\n", id
);
1527 SET_EXPECT(Invoke_SECURITYCTX
);
1528 SET_EXPECT(Invoke_SCRIPTPROP
);
1529 memset(&dp
, 0, sizeof(dp
));
1530 memset(&ei
, 0, sizeof(ei
));
1531 V_VT(&v
) = VT_EMPTY
;
1532 hres
= IDispatchEx_InvokeEx(dispex
, id
, LOCALE_NEUTRAL
, DISPATCH_PROPERTYGET
, &dp
, &v
, &ei
, NULL
);
1533 ok(hres
== S_OK
, "InvokeEx failed: %08x\n", hres
);
1534 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
1535 ok(V_I4(&v
) == 4, "V_I4(v) = %d\n", V_I4(&v
));
1536 CHECK_CALLED(Invoke_SECURITYCTX
);
1537 CHECK_CALLED(Invoke_SCRIPTPROP
);
1540 static void test_iface_wrapping(IHTMLObjectElement
*elem
)
1542 IHTMLObjectElement
*elem2
;
1543 IUnknown
*unk
, *unk2
;
1548 SET_EXPECT(QI_ITestActiveX
);
1549 SET_EXPECT(wrapped_AddRef
);
1550 SET_EXPECT(wrapped_Release
);
1551 unk
= (void*)0xdeadbeef;
1552 hres
= IHTMLObjectElement_QueryInterface(elem
, &IID_ITestActiveX
, (void**)&unk
);
1553 ok(hres
== S_OK
, "QueryInterface(IID_ITestActiveX failed: %08x\n", hres
);
1554 CHECK_CALLED(QI_ITestActiveX
);
1555 CHECK_CALLED(wrapped_AddRef
);
1556 CHECK_CALLED(wrapped_Release
);
1558 /* See dlls/mshtml/ifacewrap.c */
1559 ok(unk
!= &wrapped_iface
, "Unexpected unk %p, expected %p (%p, %p)\n", unk
, &ViewObjectEx
, unk
->lpVtbl
, &ViewObjectExVtbl
);
1560 ok(unk
->lpVtbl
!= wrapped_iface
.lpVtbl
, "unk->lpVtbl == wrapped_iface->lpVtbl\n");
1561 ok(unk
->lpVtbl
->QueryInterface
!= wrapped_QueryInterface
, "QueryInterface not wrapped\n");
1562 ok(unk
->lpVtbl
->AddRef
!= wrapped_AddRef
, "AddRef not wrapped\n");
1563 ok(unk
->lpVtbl
->Release
!= wrapped_Release
, "Release not wrapped\n");
1565 vtbl
= (void**)unk
->lpVtbl
;
1566 ok(vtbl
[4] != wrapped_func_nocall
, "func not wrapped\n");
1567 ok(vtbl
[63] != wrapped_func
, "func not wrapped\n");
1569 SET_EXPECT(wrapped_func
);
1570 hres
= ((HRESULT (WINAPI
*)(IUnknown
*,int,double))vtbl
[63])(unk
, 10, 32.0);
1571 ok(hres
== S_OK
, "wrapped_func returned %08x\n", hres
);
1572 CHECK_CALLED(wrapped_func
);
1574 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLObjectElement
, (void**)&elem2
);
1575 ok(hres
== S_OK
, "Could not get IHTMLObjectElement from wrapped iface: %08x\n", hres
);
1576 ok(iface_cmp((IUnknown
*)elem2
, (IUnknown
*)elem
), "elem2 != elem\n");
1577 IHTMLObjectElement_Release(elem2
);
1579 SET_EXPECT(wrapped_Release
);
1580 ref
= IUnknown_Release(unk
);
1581 ok(!ref
, "ref=%d\n", ref
);
1582 CHECK_CALLED(wrapped_Release
);
1584 SET_EXPECT(QI_ITestActiveX
);
1585 SET_EXPECT(wrapped_AddRef
);
1586 SET_EXPECT(wrapped_Release
);
1587 unk
= (void*)0xdeadbeef;
1588 hres
= IHTMLObjectElement_QueryInterface(elem
, &IID_ITestActiveX
, (void**)&unk2
);
1589 ok(hres
== S_OK
, "QueryInterface(IID_ITestActiveX failed: %08x\n", hres
);
1590 CHECK_CALLED(QI_ITestActiveX
);
1591 CHECK_CALLED(wrapped_AddRef
);
1592 CHECK_CALLED(wrapped_Release
);
1594 ok(unk
!= unk2
, "unk == unk2\n");
1596 SET_EXPECT(wrapped_Release
);
1597 ref
= IUnknown_Release(unk2
);
1598 ok(!ref
, "ref=%d\n", ref
);
1599 CHECK_CALLED(wrapped_Release
);
1602 static void test_object_elem(IHTMLDocument2
*doc
)
1604 IHTMLObjectElement
*objelem
;
1605 IHTMLDocument3
*doc3
;
1606 IDispatchEx
*dispex
;
1613 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
1614 ok(hres
== S_OK
, "Could not get IHTMLDocument3 iface: %08x\n", hres
);
1616 str
= SysAllocString(L
"objid");
1617 elem
= (void*)0xdeadbeef;
1618 hres
= IHTMLDocument3_getElementById(doc3
, str
, &elem
);
1619 IHTMLDocument3_Release(doc3
);
1621 ok(hres
== S_OK
, "getElementById failed: %08x\n", hres
);
1622 ok(elem
!= NULL
, "elem == NULL\n");
1624 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLObjectElement
, (void**)&objelem
);
1625 IHTMLElement_Release(elem
);
1626 ok(hres
== S_OK
, "Could not get IHTMLObjectElement iface: %08x\n", hres
);
1628 SET_EXPECT(Invoke_SECURITYCTX
);
1629 hres
= IHTMLObjectElement_get_object(objelem
, &disp
);
1630 ok(hres
== S_OK
, "get_object failed: %08x\n", hres
);
1631 ok(disp
== &Dispatch
, "disp != Dispatch\n");
1632 CHECK_CALLED(Invoke_SECURITYCTX
);
1634 hres
= IHTMLObjectElement_QueryInterface(objelem
, &IID_IDispatchEx
, (void**)&dispex
);
1635 ok(hres
== S_OK
, "QueryInterface failed: %08x\n", hres
);
1636 test_elem_dispex(dispex
);
1637 IDispatchEx_Release(dispex
);
1639 test_iface_wrapping(objelem
);
1641 hres
= IHTMLObjectElement_get_width(objelem
, &v
);
1642 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1643 ok(V_VT(&v
) == VT_BSTR
, "V_VT(width) = %d\n", V_VT(&v
));
1644 ok(!lstrcmpW(V_BSTR(&v
), L
"300"), "V_BSTR(width) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1647 hres
= IHTMLObjectElement_get_height(objelem
, &v
);
1648 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1649 ok(V_VT(&v
) == VT_BSTR
, "V_VT(height) = %d\n", V_VT(&v
));
1650 ok(!lstrcmpW(V_BSTR(&v
), L
"200"), "V_BSTR(height) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1655 SET_EXPECT(OnAmbientPropertyChange_UNKNOWN
);
1656 SET_EXPECT(Invoke_ENABLED
);
1657 hres
= IHTMLObjectElement_put_width(objelem
, v
);
1658 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
1659 CHECK_CALLED(OnAmbientPropertyChange_UNKNOWN
);
1660 CLEAR_CALLED(Invoke_ENABLED
); /* Not called on IE10 */
1662 hres
= IHTMLObjectElement_get_width(objelem
, &v
);
1663 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1664 ok(V_VT(&v
) == VT_BSTR
, "V_VT(width) = %d\n", V_VT(&v
));
1665 ok(!lstrcmpW(V_BSTR(&v
), L
"400"), "V_BSTR(width) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1670 SET_EXPECT(OnAmbientPropertyChange_UNKNOWN
);
1671 SET_EXPECT(Invoke_ENABLED
);
1672 hres
= IHTMLObjectElement_put_height(objelem
, v
);
1673 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1674 CHECK_CALLED(OnAmbientPropertyChange_UNKNOWN
);
1675 CLEAR_CALLED(Invoke_ENABLED
); /* Not called on IE10 */
1677 hres
= IHTMLObjectElement_get_height(objelem
, &v
);
1678 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1679 ok(V_VT(&v
) == VT_BSTR
, "V_VT(height) = %d\n", V_VT(&v
));
1680 ok(!lstrcmpW(V_BSTR(&v
), L
"250"), "V_BSTR(height) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1683 IHTMLObjectElement_Release(objelem
);
1686 static void test_container(IHTMLDocument2
*doc_obj
)
1688 IHTMLWindow2
*parent_window
, *html_window
;
1689 IServiceProvider
*serv_prov
;
1690 IOleContainer
*container
;
1691 IHTMLDocument2
*doc
;
1696 hres
= IOleClientSite_GetContainer(client_site
, &container
);
1697 ok(hres
== S_OK
, "GetContainer failed: %08x\n", hres
);
1698 ok(container
!= NULL
, "container == NULL\n");
1700 hres
= IHTMLDocument2_get_parentWindow(doc_obj
, &parent_window
);
1701 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
1702 ok(parent_window
!= NULL
, "parentWindow == NULL\n");
1704 hres
= IHTMLWindow2_get_document(parent_window
, &doc
);
1705 ok(hres
== S_OK
, "get_document failed: %08x\n", hres
);
1706 ok(doc
!= NULL
, "doc == NULL\n");
1707 ok(iface_cmp((IUnknown
*)doc
, (IUnknown
*)container
), "container != doc\n");
1708 IHTMLDocument2_Release(doc
);
1710 hres
= IOleClientSite_QueryInterface(client_site
, &IID_IServiceProvider
, (void**)&serv_prov
);
1711 ok(hres
== S_OK
, "Could not get IServiceProvider iface: %08x\n", hres
);
1713 hres
= IServiceProvider_QueryService(serv_prov
, &IID_IHTMLWindow2
, &IID_IHTMLWindow2
, (void**)&html_window
);
1714 ok(hres
== S_OK
, "Could not get IHTMLWindow2 service: %08x\n", hres
);
1716 ok(!iface_cmp((IUnknown
*)html_window
, (IUnknown
*)parent_window
), "html_window != parent_window\n");
1717 IHTMLWindow2_Release(html_window
);
1719 SET_EXPECT(QueryService_TestActiveX
);
1720 hres
= IServiceProvider_QueryService(serv_prov
, &CLSID_TestActiveX
, &IID_IUnknown
, (void**)&unk
);
1721 ok(hres
== S_OK
, "QueryService(CLSID_TestActiveX) failed: %08x\n", hres
);
1722 ok(unk
== (IUnknown
*)&OleObject
, "unexpected unk %p\n", unk
);
1723 CHECK_CALLED(QueryService_TestActiveX
);
1724 IUnknown_Release(unk
);
1726 IServiceProvider_Release(serv_prov
);
1728 IHTMLWindow2_Release(parent_window
);
1729 IOleContainer_Release(container
);
1732 static void test_ui_activate(void)
1734 IOleInPlaceSite
*ip_site
;
1737 hres
= IOleClientSite_QueryInterface(client_site
, &IID_IOleInPlaceSite
, (void**)&ip_site
);
1738 ok(hres
== S_OK
, "Could not get IOleInPlaceSite iface: %08x\n", hres
);
1740 SET_EXPECT(Invoke_ENABLED
);
1741 hres
= IOleInPlaceSite_OnUIActivate(ip_site
);
1742 ok(hres
== S_OK
, "OnUIActivate failed: %08x\n", hres
);
1743 CLEAR_CALLED(Invoke_ENABLED
); /* Not called on IE10 */
1745 IOleInPlaceSite_Release(ip_site
);
1748 static HRESULT
cs_qi(REFIID
,void **);
1749 static IOleDocumentView
*view
;
1751 static HRESULT WINAPI
InPlaceFrame_QueryInterface(IOleInPlaceFrame
*iface
, REFIID riid
, void **ppv
)
1753 static const GUID undocumented_frame_iid
= {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1755 if(!IsEqualGUID(&undocumented_frame_iid
, riid
))
1756 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid
));
1759 return E_NOINTERFACE
;
1762 static ULONG WINAPI
InPlaceFrame_AddRef(IOleInPlaceFrame
*iface
)
1767 static ULONG WINAPI
InPlaceFrame_Release(IOleInPlaceFrame
*iface
)
1772 static HRESULT WINAPI
InPlaceFrame_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phwnd
)
1777 static HRESULT WINAPI
InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame
*iface
, BOOL fEnterMode
)
1782 static HRESULT WINAPI
InPlaceFrame_GetBorder(IOleInPlaceFrame
*iface
, LPRECT lprectBorder
)
1787 static HRESULT WINAPI
InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame
*iface
,
1788 LPCBORDERWIDTHS pborderwidths
)
1793 static HRESULT WINAPI
InPlaceFrame_SetBorderSpace(IOleInPlaceFrame
*iface
,
1794 LPCBORDERWIDTHS pborderwidths
)
1799 static HRESULT WINAPI
InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame
*iface
,
1800 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1805 static HRESULT WINAPI
InPlaceFrame_SetActiveObject(IOleInPlaceFrame
*iface
,
1806 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1811 static HRESULT WINAPI
InPlaceFrame_InsertMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1812 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
1817 static HRESULT WINAPI
InPlaceFrame_SetMenu(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1818 HOLEMENU holemenu
, HWND hwndActiveObject
)
1820 ok(0, "unexpected call\n");
1824 static HRESULT WINAPI
InPlaceFrame_RemoveMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
)
1826 ok(0, "unexpected call\n");
1830 static HRESULT WINAPI
InPlaceFrame_SetStatusText(IOleInPlaceFrame
*iface
, LPCOLESTR pszStatusText
)
1835 static HRESULT WINAPI
InPlaceFrame_EnableModeless(IOleInPlaceFrame
*iface
, BOOL fEnable
)
1840 static HRESULT WINAPI
InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame
*iface
, LPMSG lpmsg
, WORD wID
)
1842 ok(0, "unexpected call\n");
1846 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl
= {
1847 InPlaceFrame_QueryInterface
,
1848 InPlaceFrame_AddRef
,
1849 InPlaceFrame_Release
,
1850 InPlaceFrame_GetWindow
,
1851 InPlaceFrame_ContextSensitiveHelp
,
1852 InPlaceFrame_GetBorder
,
1853 InPlaceFrame_RequestBorderSpace
,
1854 InPlaceFrame_SetBorderSpace
,
1855 InPlaceFrame_SetActiveObject
,
1856 InPlaceFrame_InsertMenus
,
1857 InPlaceFrame_SetMenu
,
1858 InPlaceFrame_RemoveMenus
,
1859 InPlaceFrame_SetStatusText
,
1860 InPlaceFrame_EnableModeless
,
1861 InPlaceFrame_TranslateAccelerator
1864 static IOleInPlaceFrame InPlaceFrame
= { &InPlaceFrameVtbl
};
1866 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl
= {
1867 InPlaceFrame_QueryInterface
,
1868 InPlaceFrame_AddRef
,
1869 InPlaceFrame_Release
,
1870 InPlaceFrame_GetWindow
,
1871 InPlaceFrame_ContextSensitiveHelp
,
1872 InPlaceFrame_GetBorder
,
1873 InPlaceFrame_RequestBorderSpace
,
1874 InPlaceFrame_SetBorderSpace
,
1875 InPlaceUIWindow_SetActiveObject
,
1878 static IOleInPlaceFrame InPlaceUIWindow
= { &InPlaceUIWindowVtbl
};
1880 static HRESULT WINAPI
InPlaceSite_QueryInterface(IOleInPlaceSite
*iface
, REFIID riid
, void **ppv
)
1882 return cs_qi(riid
, ppv
);
1885 static ULONG WINAPI
InPlaceSite_AddRef(IOleInPlaceSite
*iface
)
1890 static ULONG WINAPI
InPlaceSite_Release(IOleInPlaceSite
*iface
)
1895 static HRESULT WINAPI
InPlaceSite_GetWindow(IOleInPlaceSite
*iface
, HWND
*phwnd
)
1897 *phwnd
= container_hwnd
;
1901 static HRESULT WINAPI
InPlaceSite_ContextSensitiveHelp(IOleInPlaceSite
*iface
, BOOL fEnterMode
)
1903 ok(0, "unexpected call\n");
1907 static HRESULT WINAPI
InPlaceSite_CanInPlaceActivate(IOleInPlaceSite
*iface
)
1912 static HRESULT WINAPI
InPlaceSite_OnInPlaceActivate(IOleInPlaceSite
*iface
)
1917 static HRESULT WINAPI
InPlaceSite_OnUIActivate(IOleInPlaceSite
*iface
)
1922 static HRESULT WINAPI
InPlaceSite_GetWindowContext(IOleInPlaceSite
*iface
,
1923 IOleInPlaceFrame
**ppFrame
, IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1924 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1926 static const RECT rect
= {0,0,500,500};
1928 *ppFrame
= &InPlaceFrame
;
1929 *ppDoc
= (IOleInPlaceUIWindow
*)&InPlaceUIWindow
;
1930 *lprcPosRect
= rect
;
1931 *lprcClipRect
= rect
;
1933 lpFrameInfo
->fMDIApp
= FALSE
;
1934 lpFrameInfo
->hwndFrame
= container_hwnd
;
1935 lpFrameInfo
->haccel
= NULL
;
1936 lpFrameInfo
->cAccelEntries
= 0;
1941 static HRESULT WINAPI
InPlaceSite_Scroll(IOleInPlaceSite
*iface
, SIZE scrollExtant
)
1946 static HRESULT WINAPI
InPlaceSite_OnUIDeactivate(IOleInPlaceSite
*iface
, BOOL fUndoable
)
1951 static HRESULT WINAPI
InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSite
*iface
)
1956 static HRESULT WINAPI
InPlaceSite_DiscardUndoState(IOleInPlaceSite
*iface
)
1961 static HRESULT WINAPI
InPlaceSite_DeactivateAndUndo(IOleInPlaceSite
*iface
)
1966 static HRESULT WINAPI
InPlaceSite_OnPosRectChange(IOleInPlaceSite
*iface
, LPCRECT lprcPosRect
)
1971 static const IOleInPlaceSiteVtbl InPlaceSiteVtbl
= {
1972 InPlaceSite_QueryInterface
,
1974 InPlaceSite_Release
,
1975 InPlaceSite_GetWindow
,
1976 InPlaceSite_ContextSensitiveHelp
,
1977 InPlaceSite_CanInPlaceActivate
,
1978 InPlaceSite_OnInPlaceActivate
,
1979 InPlaceSite_OnUIActivate
,
1980 InPlaceSite_GetWindowContext
,
1982 InPlaceSite_OnUIDeactivate
,
1983 InPlaceSite_OnInPlaceDeactivate
,
1984 InPlaceSite_DiscardUndoState
,
1985 InPlaceSite_DeactivateAndUndo
,
1986 InPlaceSite_OnPosRectChange
,
1989 static IOleInPlaceSite InPlaceSite
= { &InPlaceSiteVtbl
};
1991 static HRESULT WINAPI
ClientSite_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppv
)
1993 return cs_qi(riid
, ppv
);
1996 static ULONG WINAPI
ClientSite_AddRef(IOleClientSite
*iface
)
2001 static ULONG WINAPI
ClientSite_Release(IOleClientSite
*iface
)
2006 static HRESULT WINAPI
ClientSite_SaveObject(IOleClientSite
*iface
)
2008 ok(0, "unexpected call\n");
2012 static HRESULT WINAPI
ClientSite_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
,
2015 ok(0, "unexpected call\n");
2019 static HRESULT WINAPI
ClientSite_GetContainer(IOleClientSite
*iface
, IOleContainer
**ppContainer
)
2024 static HRESULT WINAPI
ClientSite_ShowObject(IOleClientSite
*iface
)
2026 ok(0, "unexpected call\n");
2030 static HRESULT WINAPI
ClientSite_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
2032 ok(0, "unexpected call\n");
2036 static HRESULT WINAPI
ClientSite_RequestNewObjectLayout(IOleClientSite
*iface
)
2038 ok(0, "unexpected call\n");
2042 static const IOleClientSiteVtbl ClientSiteVtbl
= {
2043 ClientSite_QueryInterface
,
2046 ClientSite_SaveObject
,
2047 ClientSite_GetMoniker
,
2048 ClientSite_GetContainer
,
2049 ClientSite_ShowObject
,
2050 ClientSite_OnShowWindow
,
2051 ClientSite_RequestNewObjectLayout
2054 static IOleClientSite ClientSite
= { &ClientSiteVtbl
};
2056 static HRESULT WINAPI
DocumentSite_QueryInterface(IOleDocumentSite
*iface
, REFIID riid
, void **ppv
)
2058 return cs_qi(riid
, ppv
);
2061 static ULONG WINAPI
DocumentSite_AddRef(IOleDocumentSite
*iface
)
2066 static ULONG WINAPI
DocumentSite_Release(IOleDocumentSite
*iface
)
2071 static HRESULT WINAPI
DocumentSite_ActivateMe(IOleDocumentSite
*iface
, IOleDocumentView
*pViewToActivate
)
2073 RECT rect
= {0,0,400,500};
2074 IOleDocument
*document
;
2077 hres
= IOleDocumentView_QueryInterface(pViewToActivate
, &IID_IOleDocument
, (void**)&document
);
2078 ok(hres
== S_OK
, "could not get IOleDocument: %08x\n", hres
);
2080 hres
= IOleDocument_CreateView(document
, &InPlaceSite
, NULL
, 0, &view
);
2081 IOleDocument_Release(document
);
2082 ok(hres
== S_OK
, "CreateView failed: %08x\n", hres
);
2084 hres
= IOleDocumentView_SetInPlaceSite(view
, &InPlaceSite
);
2085 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
2087 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
2088 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
2090 hres
= IOleDocumentView_SetRect(view
, &rect
);
2091 ok(hres
== S_OK
, "SetRect failed: %08x\n", hres
);
2093 hres
= IOleDocumentView_Show(view
, TRUE
);
2094 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
2099 static const IOleDocumentSiteVtbl DocumentSiteVtbl
= {
2100 DocumentSite_QueryInterface
,
2101 DocumentSite_AddRef
,
2102 DocumentSite_Release
,
2103 DocumentSite_ActivateMe
2106 static IOleDocumentSite DocumentSite
= { &DocumentSiteVtbl
};
2108 static HRESULT WINAPI
ServiceProvider_QueryInterface(IServiceProvider
*iface
,
2109 REFIID riid
, void **ppv
)
2111 return cs_qi(riid
, ppv
);
2114 static ULONG WINAPI
ServiceProvider_AddRef(IServiceProvider
*iface
)
2119 static ULONG WINAPI
ServiceProvider_Release(IServiceProvider
*iface
)
2124 static HRESULT WINAPI
ServiceProvider_QueryService(IServiceProvider
*iface
, REFGUID guidService
,
2125 REFIID riid
, void **ppv
)
2127 if(IsEqualGUID(&CLSID_TestActiveX
, guidService
)) {
2128 CHECK_EXPECT(QueryService_TestActiveX
);
2129 ok(IsEqualGUID(&IID_IUnknown
, riid
), "unexpected riid %s\n", wine_dbgstr_guid(riid
));
2135 return E_NOINTERFACE
;
2138 static const IServiceProviderVtbl ServiceProviderVtbl
= {
2139 ServiceProvider_QueryInterface
,
2140 ServiceProvider_AddRef
,
2141 ServiceProvider_Release
,
2142 ServiceProvider_QueryService
2145 static IServiceProvider ServiceProvider
= { &ServiceProviderVtbl
};
2147 static HRESULT
cs_qi(REFIID riid
, void **ppv
)
2151 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IOleClientSite
, riid
))
2153 else if(IsEqualGUID(&IID_IOleDocumentSite
, riid
))
2154 *ppv
= &DocumentSite
;
2155 else if(IsEqualGUID(&IID_IOleWindow
, riid
) || IsEqualGUID(&IID_IOleInPlaceSite
, riid
))
2156 *ppv
= &InPlaceSite
;
2157 else if(IsEqualGUID(riid
, &IID_IServiceProvider
))
2158 *ppv
= &ServiceProvider
;
2160 return *ppv
? S_OK
: E_NOINTERFACE
;
2163 static IHTMLDocument2
*notif_doc
;
2164 static BOOL doc_complete
;
2166 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
2167 REFIID riid
, void**ppv
)
2169 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
2174 ok(0, "unexpected call\n");
2175 return E_NOINTERFACE
;
2178 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
2183 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
2188 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
2190 if(dispID
== DISPID_READYSTATE
){
2194 static const WCHAR completeW
[] = {'c','o','m','p','l','e','t','e',0};
2196 hres
= IHTMLDocument2_get_readyState(notif_doc
, &state
);
2197 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
2199 if(!lstrcmpW(state
, completeW
))
2200 doc_complete
= TRUE
;
2202 SysFreeString(state
);
2208 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
2210 ok(0, "unexpected call\n");
2214 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
2215 PropertyNotifySink_QueryInterface
,
2216 PropertyNotifySink_AddRef
,
2217 PropertyNotifySink_Release
,
2218 PropertyNotifySink_OnChanged
,
2219 PropertyNotifySink_OnRequestEdit
2222 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
2224 static void doc_load_string(IHTMLDocument2
*doc
, const char *str
)
2226 IPersistStreamInit
*init
;
2234 doc_complete
= FALSE
;
2236 mem
= GlobalAlloc(0, len
);
2237 memcpy(mem
, str
, len
);
2238 hr
= CreateStreamOnHGlobal(mem
, TRUE
, &stream
);
2239 ok(hr
== S_OK
, "Failed to create a stream, hr %#x.\n", hr
);
2241 hr
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
2242 ok(hr
== S_OK
, "Failed to get IPersistStreamInit, hr %#x.\n", hr
);
2244 IPersistStreamInit_Load(init
, stream
);
2245 IPersistStreamInit_Release(init
);
2246 IStream_Release(stream
);
2249 static void do_advise(IUnknown
*unk
, REFIID riid
, IUnknown
*unk_advise
)
2251 IConnectionPointContainer
*container
;
2252 IConnectionPoint
*cp
;
2256 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
2257 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
2259 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
2260 IConnectionPointContainer_Release(container
);
2261 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
2263 hres
= IConnectionPoint_Advise(cp
, unk_advise
, &cookie
);
2264 IConnectionPoint_Release(cp
);
2265 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
2268 static void set_client_site(IHTMLDocument2
*doc
, BOOL set
)
2274 IOleDocumentView_Show(view
, FALSE
);
2275 IOleDocumentView_CloseView(view
, 0);
2276 IOleDocumentView_SetInPlaceSite(view
, NULL
);
2277 IOleDocumentView_Release(view
);
2281 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
2282 ok(hres
== S_OK
, "Could not et IOleObject: %08x\n", hres
);
2284 hres
= IOleObject_SetClientSite(oleobj
, set
? &ClientSite
: NULL
);
2285 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
2288 IHlinkTarget
*hlink
;
2290 hres
= IOleObject_QueryInterface(oleobj
, &IID_IHlinkTarget
, (void**)&hlink
);
2291 ok(hres
== S_OK
, "Could not get IHlinkTarget iface: %08x\n", hres
);
2293 hres
= IHlinkTarget_Navigate(hlink
, 0, NULL
);
2294 ok(hres
== S_OK
, "Navgate failed: %08x\n", hres
);
2296 IHlinkTarget_Release(hlink
);
2299 IOleObject_Release(oleobj
);
2301 static IHTMLDocument2
*create_document(void)
2303 IHTMLDocument2
*doc
;
2306 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
2307 &IID_IHTMLDocument2
, (void**)&doc
);
2308 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
2313 static IHTMLDocument2
*create_doc(const char *str
)
2315 IHTMLDocument2
*doc
;
2318 doc
= create_document();
2319 set_client_site(doc
, TRUE
);
2320 doc_load_string(doc
, str
);
2321 do_advise((IUnknown
*)doc
, &IID_IPropertyNotifySink
, (IUnknown
*)&PropertyNotifySink
);
2323 while(!doc_complete
&& GetMessageW(&msg
, NULL
, 0, 0)) {
2324 TranslateMessage(&msg
);
2325 DispatchMessageW(&msg
);
2331 static void release_doc(IHTMLDocument2
*doc
)
2335 set_client_site(doc
, FALSE
);
2336 ref
= IHTMLDocument2_Release(doc
);
2337 ok(!ref
|| broken(ref
== 1) /* Vista */, "ref = %d\n", ref
);
2340 IOleClientSite_Release(client_site
);
2345 DestroyWindow(plugin_hwnd
);
2349 ok(!activex_refcnt
, "activex_refcnt = %d\n", activex_refcnt
);
2352 static void init_test(int behavior
)
2354 plugin_behavior
= behavior
;
2357 no_quickact
= behavior
== TEST_NOQUICKACT
|| behavior
== TEST_DISPONLY
;
2358 have_container
= TRUE
;
2361 static void test_event_call(void)
2363 VARIANT res
, args
[2];
2364 DISPPARAMS dp
= {args
};
2368 V_VT(&res
) = VT_EMPTY
;
2369 hres
= IDispatch_Invoke(sink_disp
, 1, &IID_NULL
, 0, DISPATCH_METHOD
, &dp
, &res
, &ei
, NULL
);
2370 ok(hres
== S_OK
, "Invoke failed: %08x\n", hres
);
2371 ok(V_VT(&res
) == VT_I4
&& V_I4(&res
) == 6, "unexpected result\n");
2375 V_VT(args
+1) = VT_I4
;
2378 V_VT(&res
) = VT_EMPTY
;
2379 hres
= IDispatch_Invoke(sink_disp
, 2, &IID_NULL
, 0, DISPATCH_METHOD
, &dp
, &res
, &ei
, NULL
);
2380 ok(hres
== S_OK
, "Invoke failed: %08x\n", hres
);
2381 ok(V_VT(&res
) == VT_I4
&& V_I4(&res
) == 7, "unexpected result: %d\n", V_I4(&res
));
2383 V_VT(&res
) = VT_ERROR
;
2384 hres
= IDispatch_Invoke(sink_disp
, 10, &IID_NULL
, 0, DISPATCH_METHOD
, &dp
, &res
, &ei
, NULL
);
2385 ok(hres
== S_OK
, "Invoke failed: %08x\n", hres
);
2386 ok(V_VT(&res
) == VT_EMPTY
, "V_VT(res) = %d\n", V_VT(&res
));
2389 static void test_flash_ax(void)
2391 IHTMLDocument2
*doc
;
2394 init_test(TEST_FLASH
);
2396 SET_EXPECT(CreateInstance
);
2397 SET_EXPECT(FreezeEvents_TRUE
);
2398 SET_EXPECT(QuickActivate
);
2399 SET_EXPECT(FreezeEvents_FALSE
);
2400 SET_EXPECT(IPersistPropertyBag_Load
);
2401 SET_EXPECT(Invoke_READYSTATE
);
2402 SET_EXPECT(Invoke_SECURITYCTX
);
2403 SET_EXPECT(Invoke_SCRIPTCALL
);
2404 SET_EXPECT(SetExtent
);
2405 SET_EXPECT(GetExtent
);
2408 doc
= create_doc(object_ax_str
);
2410 CHECK_CALLED(CreateInstance
);
2412 CHECK_CALLED(FreezeEvents_TRUE
);
2413 CHECK_CALLED(QuickActivate
);
2415 CHECK_CALLED(FreezeEvents_FALSE
);
2416 CHECK_CALLED(IPersistPropertyBag_Load
);
2417 CHECK_CALLED(Invoke_READYSTATE
);
2418 CHECK_CALLED(Invoke_SECURITYCTX
);
2419 CHECK_CALLED(Invoke_SCRIPTCALL
);
2421 CHECK_CALLED(SetExtent
);
2423 CHECK_CALLED(GetExtent
);
2424 CHECK_CALLED(DoVerb
);
2427 CHECK_CALLED(InPlaceObject_GetWindow
);
2428 CHECK_CALLED(SetObjectRects
);
2431 test_container(notif_doc
);
2432 test_object_elem(notif_doc
);
2434 IOleClientSite_AddRef(client_site
);
2437 SET_EXPECT(UIDeactivate
);
2438 SET_EXPECT(Invoke_ENABLED
);
2439 SET_EXPECT(Invoke_VALID
);
2440 SET_EXPECT(InPlaceDeactivate
);
2442 SET_EXPECT(SetClientSite_NULL
);
2444 CHECK_CALLED(UIDeactivate
);
2445 CLEAR_CALLED(Invoke_ENABLED
); /* Not called on IE10 */
2447 CHECK_CALLED(Invoke_VALID
);
2448 CHECK_CALLED(InPlaceDeactivate
);
2449 CHECK_CALLED(Close
);
2450 CHECK_CALLED(SetClientSite_NULL
);
2452 IOleClientSite_Release(cs
);
2455 static void test_noquickact_ax(void)
2457 IHTMLDocument2
*doc
;
2459 init_test(TEST_NOQUICKACT
);
2461 SET_EXPECT(CreateInstance
);
2462 SET_EXPECT(FreezeEvents_TRUE
);
2463 SET_EXPECT(GetMiscStatus
);
2464 SET_EXPECT(SetClientSite
);
2465 SET_EXPECT(SetAdvise
);
2466 SET_EXPECT(GetViewStatus
);
2467 SET_EXPECT(FreezeEvents_FALSE
);
2468 SET_EXPECT(Invoke_READYSTATE
);
2469 SET_EXPECT(Invoke_SECURITYCTX
);
2470 SET_EXPECT(Invoke_SCRIPTCALL
);
2471 SET_EXPECT(SetExtent
);
2472 SET_EXPECT(GetExtent
);
2475 doc
= create_doc(object_ax_str
);
2477 CHECK_CALLED(CreateInstance
);
2478 todo_wine
CHECK_CALLED(FreezeEvents_TRUE
);
2479 CHECK_CALLED(GetMiscStatus
);
2480 CHECK_CALLED(SetClientSite
);
2481 CHECK_CALLED(SetAdvise
);
2482 CHECK_CALLED(GetViewStatus
);
2483 todo_wine
CHECK_CALLED(FreezeEvents_FALSE
);
2484 CHECK_CALLED(Invoke_READYSTATE
);
2485 CHECK_CALLED(Invoke_SECURITYCTX
);
2486 CHECK_CALLED(Invoke_SCRIPTCALL
);
2487 todo_wine
CHECK_CALLED(SetExtent
);
2488 todo_wine
CHECK_CALLED(GetExtent
);
2489 CHECK_CALLED(DoVerb
);
2492 CHECK_CALLED(InPlaceObject_GetWindow
);
2493 CHECK_CALLED(SetObjectRects
);
2495 SET_EXPECT(InPlaceDeactivate
);
2497 SET_EXPECT(SetClientSite_NULL
);
2499 CHECK_CALLED(InPlaceDeactivate
);
2500 CHECK_CALLED(Close
);
2501 CHECK_CALLED(SetClientSite_NULL
);
2504 static void test_event_binding(void)
2506 IHTMLDocument2
*doc
;
2508 init_test(TEST_FLASH
);
2510 SET_EXPECT(CreateInstance
);
2511 SET_EXPECT(FreezeEvents_TRUE
);
2512 SET_EXPECT(QuickActivate
);
2513 SET_EXPECT(FreezeEvents_FALSE
);
2514 SET_EXPECT(IPersistPropertyBag_Load
);
2515 SET_EXPECT(Invoke_READYSTATE
);
2516 SET_EXPECT(SetExtent
);
2517 SET_EXPECT(GetExtent
);
2520 SET_EXPECT(GetClassInfo
);
2521 SET_EXPECT(OnAmbientPropertyChange_UNKNOWN
);
2522 SET_EXPECT(FindConnectionPoint
);
2525 doc
= create_doc(event_binding_str
);
2527 CHECK_CALLED(CreateInstance
);
2529 CHECK_CALLED(FreezeEvents_TRUE
);
2530 CHECK_CALLED(QuickActivate
);
2532 CHECK_CALLED(FreezeEvents_FALSE
);
2533 CHECK_CALLED(IPersistPropertyBag_Load
);
2534 CHECK_CALLED(Invoke_READYSTATE
);
2536 CHECK_CALLED(SetExtent
);
2538 CHECK_CALLED(GetExtent
);
2539 CHECK_CALLED(DoVerb
);
2542 CHECK_CALLED(InPlaceObject_GetWindow
);
2543 CHECK_CALLED(SetObjectRects
);
2545 CHECK_CALLED(GetClassInfo
);
2547 CHECK_CALLED(OnAmbientPropertyChange_UNKNOWN
);
2548 CHECK_CALLED(FindConnectionPoint
);
2549 CHECK_CALLED(Advise
);
2553 SET_EXPECT(InPlaceDeactivate
);
2555 SET_EXPECT(SetClientSite_NULL
);
2556 SET_EXPECT(FindConnectionPoint
);
2557 SET_EXPECT(Unadvise
);
2559 CHECK_CALLED(InPlaceDeactivate
);
2560 CHECK_CALLED(Close
);
2561 CHECK_CALLED(SetClientSite_NULL
);
2562 CHECK_CALLED(FindConnectionPoint
);
2563 CHECK_CALLED(Unadvise
);
2566 static void test_nooleobj_ax(void)
2568 IHTMLDocument2
*doc
;
2570 init_test(TEST_DISPONLY
);
2572 SET_EXPECT(CreateInstance
);
2573 SET_EXPECT(Invoke_READYSTATE
);
2574 SET_EXPECT(Invoke_SECURITYCTX
);
2575 SET_EXPECT(Invoke_SCRIPTCALL
);
2577 doc
= create_doc(object_ax_str
);
2579 CHECK_CALLED(CreateInstance
);
2580 CHECK_CALLED(Invoke_READYSTATE
);
2581 CHECK_CALLED(Invoke_SECURITYCTX
);
2582 CHECK_CALLED(Invoke_SCRIPTCALL
);
2587 static void test_exec_script(IHTMLDocument2
*doc
, const WCHAR
*codew
, const WCHAR
*langw
)
2589 IHTMLWindow2
*window
;
2594 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
2595 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
2597 code
= SysAllocString(codew
);
2598 lang
= SysAllocString(langw
);
2600 hres
= IHTMLWindow2_execScript(window
, code
, lang
, &v
);
2601 ok(hres
== S_OK
, "execScript failed: %08x\n", hres
);
2602 SysFreeString(lang
);
2605 IHTMLWindow2_Release(window
);
2608 static void test_create_element(void)
2610 IHTMLDocument2
*doc
;
2612 init_test(TEST_FLASH
);
2614 doc
= create_doc("<html></html>");
2616 have_container
= FALSE
;
2618 SET_EXPECT(CreateInstance
);
2619 SET_EXPECT(FreezeEvents_TRUE
);
2620 SET_EXPECT(QuickActivate
);
2621 SET_EXPECT(IPersistPropertyBag_InitNew
);
2622 SET_EXPECT(Invoke_READYSTATE
);
2623 SET_EXPECT(FreezeEvents_FALSE
);
2625 test_exec_script(doc
,
2626 L
"var test_elem = document.createElement('object');"
2627 "test_elem.classid = 'CLSID:178fc163-f585-4e24-9c13-4bb7f6680746';",
2630 CHECK_CALLED(CreateInstance
);
2631 todo_wine
CHECK_CALLED(FreezeEvents_TRUE
);
2632 CHECK_CALLED(QuickActivate
);
2633 CHECK_CALLED(IPersistPropertyBag_InitNew
);
2634 CHECK_CALLED(Invoke_READYSTATE
);
2635 todo_wine
CHECK_CALLED(FreezeEvents_FALSE
);
2637 have_container
= TRUE
;
2640 test_exec_script(doc
,
2641 L
"document.body.appendChild(test_elem);",
2643 todo_wine
CHECK_CALLED(DoVerb
);
2645 SET_EXPECT(InPlaceDeactivate
);
2647 SET_EXPECT(SetClientSite_NULL
);
2649 todo_wine
CHECK_CALLED(InPlaceDeactivate
);
2650 CHECK_CALLED(Close
);
2651 CHECK_CALLED(SetClientSite_NULL
);
2654 static LRESULT WINAPI
wnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
2656 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
2659 static HWND
create_container_window(void)
2661 static const WCHAR html_document_testW
[] =
2662 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
2663 static WNDCLASSEXW wndclass
= {
2664 sizeof(WNDCLASSEXW
),
2667 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
2668 html_document_testW
,
2672 RegisterClassExW(&wndclass
);
2673 return CreateWindowW(html_document_testW
, html_document_testW
,
2674 WS_OVERLAPPEDWINDOW
, CW_USEDEFAULT
, CW_USEDEFAULT
,
2675 515, 530, NULL
, NULL
, NULL
, NULL
);
2678 static void load_typelib(void)
2680 WCHAR path
[MAX_PATH
];
2684 GetModuleFileNameW(NULL
, path
, MAX_PATH
);
2686 hres
= LoadTypeLib(path
, &typelib
);
2687 ok(hres
== S_OK
, "LoadTypeLib failed: %08x\n", hres
);
2689 hres
= ITypeLib_GetTypeInfoOfGuid(typelib
, &DIID_DispActiveXTest
, &actxtest_typeinfo
);
2690 ok(hres
== S_OK
, "GetTypeInfoOfGuid(DIID_DispActiveXTest) failed: %08x\n", hres
);
2692 hres
= ITypeLib_GetTypeInfoOfGuid(typelib
, &CLSID_ActiveXTest
, &class_typeinfo
);
2693 ok(hres
== S_OK
, "GetTypeInfoOfGuid(CLSID_ActiveXTest) failed: %08x\n", hres
);
2695 ITypeLib_Release(typelib
);
2698 static BOOL
init_key(const char *key_name
, const char *def_value
, BOOL init
)
2704 RegDeleteKeyA(HKEY_CLASSES_ROOT
, key_name
);
2708 res
= RegCreateKeyA(HKEY_CLASSES_ROOT
, key_name
, &hkey
);
2709 if(res
!= ERROR_SUCCESS
)
2713 res
= RegSetValueA(hkey
, NULL
, REG_SZ
, def_value
, strlen(def_value
));
2717 return res
== ERROR_SUCCESS
;
2720 static BOOL
init_registry(BOOL init
)
2722 return init_key("TestActiveX\\CLSID", TESTACTIVEX_CLSID
, init
)
2723 && init_key("CLSID\\"TESTACTIVEX_CLSID
"\\Implemented Categories\\{7dd95801-9882-11cf-9fa9-00aa006c42c4}",
2725 && init_key("CLSID\\"TESTACTIVEX_CLSID
"\\Implemented Categories\\{7dd95802-9882-11cf-9fa9-00aa006c42c4}",
2729 static BOOL
register_activex(void)
2734 if(!init_registry(TRUE
)) {
2735 init_registry(FALSE
);
2739 hres
= CoRegisterClassObject(&CLSID_TestActiveX
, (IUnknown
*)&activex_cf
,
2740 CLSCTX_INPROC_SERVER
, REGCLS_MULTIPLEUSE
, ®id
);
2741 ok(hres
== S_OK
, "Could not register control: %08x\n", hres
);
2746 static BOOL
check_ie(void)
2748 IHTMLDocument5
*doc
;
2751 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
2752 &IID_IHTMLDocument5
, (void**)&doc
);
2756 IHTMLDocument5_Release(doc
);
2766 win_skip("Too old IE\n");
2770 if(is_ie_hardened()) {
2772 win_skip("IE running in Enhanced Security Configuration\n");
2776 init_wrapped_iface();
2778 container_hwnd
= create_container_window();
2779 ShowWindow(container_hwnd
, SW_SHOW
);
2781 if(register_activex()) {
2782 trace("Testing emulated flash embedding...\n");
2784 trace("Testing plugin without IQuickActivate iface...\n");
2785 test_noquickact_ax();
2786 trace("Testing plugin with IDispatch iface only...\n");
2788 trace("Testing event object binding...\n");
2789 test_event_binding();
2790 trace("Testing createElement(object)...\n");
2791 test_create_element();
2792 init_registry(FALSE
);
2794 skip("Could not register ActiveX\n");
2797 if(actxtest_typeinfo
)
2798 ITypeInfo_Release(actxtest_typeinfo
);
2800 ITypeInfo_Release(class_typeinfo
);
2801 DestroyWindow(container_hwnd
);