ReactOS 0.4.15-dev-7704-gc07eb9f
script.c
Go to the documentation of this file.
1/*
2 * Copyright 2008-2009 Jacek Caban for CodeWeavers
3 *
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.
8 *
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.
13 *
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
17 */
18
19#include "precomp.h"
20
21#include <activdbg.h>
22
23DEFINE_GUID(CLSID_IdentityUnmarshal,0x0000001b,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
24
25/* Defined as extern in urlmon.idl, but not exported by uuid.lib */
27 {0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}};
28
29#ifdef _WIN64
30
31#define CTXARG_T DWORDLONG
32#define IActiveScriptParseVtbl IActiveScriptParse64Vtbl
33#define IActiveScriptParseProcedure2Vtbl IActiveScriptParseProcedure2_64Vtbl
34#define IActiveScriptSiteDebug_Release IActiveScriptSiteDebug64_Release
35
36#else
37
38#define CTXARG_T DWORD
39#define IActiveScriptParseVtbl IActiveScriptParse32Vtbl
40#define IActiveScriptParseProcedure2Vtbl IActiveScriptParseProcedure2_32Vtbl
41#define IActiveScriptSiteDebug_Release IActiveScriptSiteDebug32_Release
42
43#endif
44
45#define DEFINE_EXPECT(func) \
46 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
47
48#define SET_EXPECT(func) \
49 do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0)
50
51#define CHECK_EXPECT2(func) \
52 do { \
53 ok(expect_ ##func, "unexpected call " #func "\n"); \
54 called_ ## func = TRUE; \
55 }while(0)
56
57#define CHECK_EXPECT(func) \
58 do { \
59 CHECK_EXPECT2(func); \
60 expect_ ## func = FALSE; \
61 }while(0)
62
63#define CHECK_CALLED(func) \
64 do { \
65 ok(called_ ## func, "expected " #func "\n"); \
66 expect_ ## func = called_ ## func = FALSE; \
67 }while(0)
68
69#define CHECK_CALLED_BROKEN(func) \
70 do { \
71 ok(called_ ## func || broken(!called_ ## func), "expected " #func "\n"); \
72 expect_ ## func = called_ ## func = FALSE; \
73 }while(0)
74
75#define CHECK_NOT_CALLED(func) \
76 do { \
77 ok(!called_ ## func, "unexpected " #func "\n"); \
78 expect_ ## func = called_ ## func = FALSE; \
79 }while(0)
80
81#define CLEAR_CALLED(func) \
82 expect_ ## func = called_ ## func = FALSE
83
84
85DEFINE_EXPECT(CreateInstance);
86DEFINE_EXPECT(GetInterfaceSafetyOptions);
87DEFINE_EXPECT(SetInterfaceSafetyOptions);
90DEFINE_EXPECT(SetProperty_HACK_TRIDENTEVENTSINK);
91DEFINE_EXPECT(SetProperty_INVOKEVERSIONING);
92DEFINE_EXPECT(SetProperty_ABBREVIATE_GLOBALNAME_RESOLUTION);
93DEFINE_EXPECT(SetScriptSite);
94DEFINE_EXPECT(GetScriptState);
95DEFINE_EXPECT(SetScriptState_STARTED);
96DEFINE_EXPECT(SetScriptState_CONNECTED);
97DEFINE_EXPECT(SetScriptState_DISCONNECTED);
98DEFINE_EXPECT(AddNamedItem);
99DEFINE_EXPECT(ParseScriptText_script);
100DEFINE_EXPECT(ParseScriptText_execScript);
101DEFINE_EXPECT(GetScriptDispatch);
103DEFINE_EXPECT(script_divid_d);
104DEFINE_EXPECT(script_testprop_d);
105DEFINE_EXPECT(script_testprop_i);
106DEFINE_EXPECT(script_testprop2_d);
107DEFINE_EXPECT(AXQueryInterface_IActiveScript);
108DEFINE_EXPECT(AXQueryInterface_IObjectSafety);
109DEFINE_EXPECT(AXGetInterfaceSafetyOptions);
110DEFINE_EXPECT(AXSetInterfaceSafetyOptions_IDispatch_caller);
111DEFINE_EXPECT(AXSetInterfaceSafetyOptions_IDispatch_data);
112DEFINE_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
113DEFINE_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller);
114DEFINE_EXPECT(external_success);
115DEFINE_EXPECT(QS_VariantConversion);
116DEFINE_EXPECT(QS_IActiveScriptSite);
117DEFINE_EXPECT(QS_GetCaller);
118DEFINE_EXPECT(ChangeType);
119
120#define TESTSCRIPT_CLSID "{178fc163-f585-4e24-9c13-4bb7faf80746}"
121#define TESTACTIVEX_CLSID "{178fc163-f585-4e24-9c13-4bb7faf80646}"
122
123#define DISPID_SCRIPT_TESTPROP 0x100000
124#define DISPID_SCRIPT_TESTPROP2 0x100001
125
126#define DISPID_EXTERNAL_OK 0x300000
127#define DISPID_EXTERNAL_TRACE 0x300001
128#define DISPID_EXTERNAL_REPORTSUCCESS 0x300002
129#define DISPID_EXTERNAL_TODO_WINE_OK 0x300003
130#define DISPID_EXTERNAL_BROKEN 0x300004
131
132static const GUID CLSID_TestScript =
133 {0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x07,0x46}};
135 {0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x06,0x46}};
136
138static IHTMLDocument2 *notif_doc;
148
151
152static int strcmp_wa(LPCWSTR strw, const char *stra)
153{
154 CHAR buf[512];
155 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
156 return lstrcmpA(stra, buf);
157}
158
159static BSTR a2bstr(const char *str)
160{
161 BSTR ret;
162 int len;
163
164 if(!str)
165 return NULL;
166
167 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
170
171 return ret;
172}
173
174static BOOL init_key(const char *key_name, const char *def_value, BOOL init)
175{
176 HKEY hkey;
177 DWORD res;
178
179 if(!init) {
181 return TRUE;
182 }
183
185 if(res != ERROR_SUCCESS)
186 return FALSE;
187
188 if(def_value)
189 res = RegSetValueA(hkey, NULL, REG_SZ, def_value, strlen(def_value));
190
191 RegCloseKey(hkey);
192
193 return res == ERROR_SUCCESS;
194}
195
197 REFIID riid, void**ppv)
198{
200 *ppv = iface;
201 return S_OK;
202 }
203
204 return E_NOINTERFACE;
205}
206
208{
209 return 2;
210}
211
213{
214 return 1;
215}
216
218{
219 if(dispID == DISPID_READYSTATE){
220 BSTR state;
222
223 static const WCHAR completeW[] = {'c','o','m','p','l','e','t','e',0};
224
225 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
226 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
227
228 if(!lstrcmpW(state, completeW))
230
232 }
233
234 return S_OK;
235}
236
238{
239 ok(0, "unexpected call\n");
240 return E_NOTIMPL;
241}
242
243static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
249};
250
252
254{
255 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
256 *ppv = NULL;
257 return E_NOINTERFACE;
258}
259
261{
262 return 2;
263}
264
266{
267 return 1;
268}
269
271{
272 CHECK_EXPECT(ChangeType);
273
274 ok(dst != NULL, "dst = NULL\n");
275 ok(V_VT(dst) == VT_EMPTY, "V_VT(dst) = %d\n", V_VT(dst));
276 ok(src != NULL, "src = NULL\n");
277 ok(V_VT(src) == VT_I4, "V_VT(src) = %d\n", V_VT(src));
278 ok(V_I4(src) == 0xf0f0f0, "V_I4(src) = %x\n", V_I4(src));
279 ok(lcid == LOCALE_NEUTRAL, "lcid = %d\n", lcid);
280 ok(vt == VT_BSTR, "vt = %d\n", vt);
281
282 V_VT(dst) = VT_BSTR;
283 V_BSTR(dst) = a2bstr("red");
284 return S_OK;
285}
286
287static const IVariantChangeTypeVtbl VariantChangeTypeVtbl = {
292};
293
295
297{
298 ok(0, "unexpected call\n");
299 return E_NOINTERFACE;
300}
301
303{
304 return 2;
305}
306
308{
309 return 1;
310}
311
313 REFIID riid, void **ppv)
314{
315 if(IsEqualGUID(guidService, &SID_VariantConversion)) {
316 CHECK_EXPECT(QS_VariantConversion);
317 ok(IsEqualGUID(riid, &IID_IVariantChangeType), "unexpected riid %s\n", wine_dbgstr_guid(riid));
318 *ppv = &VChangeType;
319 return S_OK;
320 }
321
322 if(IsEqualGUID(guidService, &IID_IActiveScriptSite)) {
323 CHECK_EXPECT(QS_IActiveScriptSite);
324 ok(IsEqualGUID(riid, &IID_IOleCommandTarget), "unexpected riid %s\n", wine_dbgstr_guid(riid));
325 return IActiveScriptSite_QueryInterface(site, riid, ppv);
326 }
327
328 if(IsEqualGUID(guidService, &SID_GetCaller)) {
329 CHECK_EXPECT(QS_GetCaller);
330 ok(IsEqualGUID(riid, &IID_IServiceProvider), "unexpected riid %s\n", wine_dbgstr_guid(riid));
331 *ppv = NULL;
332 return E_NOINTERFACE;
333 }
334
335 ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService));
336 return E_NOINTERFACE;
337}
338
339static const IServiceProviderVtbl ServiceProviderVtbl = {
344};
345
347
349{
350 *ppv = NULL;
351
354 || IsEqualGUID(riid, &IID_IDispatchEx))
355 *ppv = iface;
356 else
357 return E_NOINTERFACE;
358
359 return S_OK;
360}
361
363{
364 return 2;
365}
366
368{
369 return 1;
370}
371
373{
374 ok(0, "unexpected call\n");
375 return E_NOTIMPL;
376}
377
379 LCID lcid, ITypeInfo **ppTInfo)
380{
381 ok(0, "unexpected call\n");
382 return E_NOTIMPL;
383}
384
386 LPOLESTR *rgszNames, UINT cNames,
387 LCID lcid, DISPID *rgDispId)
388{
389 ok(0, "unexpected call\n");
390 return E_NOTIMPL;
391}
392
394 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
395 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
396{
397 ok(0, "unexpected call\n");
398 return E_NOTIMPL;
399}
400
402{
403 ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex);
404 return E_NOTIMPL;
405}
406
408{
409 ok(0, "unexpected call\n");
410 return E_NOTIMPL;
411}
412
414{
415 ok(0, "unexpected call\n");
416 return E_NOTIMPL;
417}
418
420{
421 ok(0, "unexpected call\n");
422 return E_NOTIMPL;
423}
424
426{
427 ok(0, "unexpected call\n");
428 return E_NOTIMPL;
429}
430
432{
433 ok(0, "unexpected call\n");
434 return E_NOTIMPL;
435}
436
438{
439 ok(0, "unexpected call\n");
440 return E_NOTIMPL;
441}
442
443static HRESULT WINAPI funcDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
444 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
445{
447
448 ok(id == DISPID_VALUE, "id = %d\n", id);
449 ok(lcid == 0, "lcid = %x\n", lcid);
450 ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
451 ok(pdp != NULL, "pdp == NULL\n");
452 ok(pdp->cArgs == 2, "pdp->cArgs = %d\n", pdp->cArgs);
453 ok(pdp->cNamedArgs == 1, "pdp->cNamedArgs = %d\n", pdp->cNamedArgs);
454 ok(pdp->rgdispidNamedArgs[0] == DISPID_THIS, "pdp->rgdispidNamedArgs[0] = %d\n", pdp->rgdispidNamedArgs[0]);
455 ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(rgvarg) = %d\n", V_VT(pdp->rgvarg));
456 ok(V_VT(pdp->rgvarg+1) == VT_BOOL, "V_VT(rgvarg[1]) = %d\n", V_VT(pdp->rgvarg));
457 ok(V_BOOL(pdp->rgvarg+1) == VARIANT_TRUE, "V_BOOL(rgvarg[1]) = %x\n", V_BOOL(pdp->rgvarg));
458 ok(pvarRes != NULL, "pvarRes == NULL\n");
459 ok(pei != NULL, "pei == NULL\n");
460 ok(!pspCaller, "pspCaller != NULL\n");
461
462 V_VT(pvarRes) = VT_I4;
463 V_I4(pvarRes) = 100;
464 return S_OK;
465}
466
467static IDispatchExVtbl testObjVtbl = {
483};
484
486
488{
489 if(!strcmp_wa(bstrName, "testProp")) {
490 CHECK_EXPECT(script_testprop_d);
491 ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex);
493 return S_OK;
494 }
495
496 if(!strcmp_wa(bstrName, "testProp2")) {
497 CHECK_EXPECT(script_testprop2_d);
498 ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex);
500 return S_OK;
501 }
502
503 if(!strcmp_wa(bstrName, "divid")) {
504 CHECK_EXPECT(script_divid_d);
505 ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex);
506 return E_FAIL;
507 }
508
509 ok(0, "unexpected call %s\n", wine_dbgstr_w(bstrName));
510 return E_NOTIMPL;
511}
512
513static HRESULT WINAPI scriptDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
514 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
515{
516 switch(id) {
518 CHECK_EXPECT(script_testprop_i);
519
520 ok(lcid == 0, "lcid = %x\n", lcid);
521 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags = %x\n", wFlags);
522 ok(pdp != NULL, "pdp == NULL\n");
523 ok(pdp->cArgs == 0, "pdp->cArgs = %d\n", pdp->cArgs);
524 ok(pdp->cNamedArgs == 0, "pdp->cNamedArgs = %d\n", pdp->cNamedArgs);
525 ok(!pdp->rgdispidNamedArgs, "pdp->rgdispidNamedArgs != NULL\n");
526 ok(!pdp->rgvarg, "rgvarg != NULL\n");
527 ok(pvarRes != NULL, "pvarRes == NULL\n");
528 ok(pei != NULL, "pei == NULL\n");
529 ok(!pspCaller, "pspCaller != NULL\n");
530
531 V_VT(pvarRes) = VT_NULL;
532 break;
533 default:
534 ok(0, "unexpected call\n");
535 return E_NOTIMPL;
536 }
537
538 return S_OK;
539}
540
541static IDispatchExVtbl scriptDispVtbl = {
557};
558
560
562{
563 if(!strcmp_wa(bstrName, "ok")) {
565 return S_OK;
566 }
567 if(!strcmp_wa(bstrName, "trace")) {
569 return S_OK;
570 }
571 if(!strcmp_wa(bstrName, "reportSuccess")) {
573 return S_OK;
574 }
575 if(!strcmp_wa(bstrName, "todo_wine_ok")) {
577 return S_OK;
578 }
579 if(!strcmp_wa(bstrName, "broken")) {
581 return S_OK;
582 }
583
584 ok(0, "unexpected name %s\n", wine_dbgstr_w(bstrName));
585 return DISP_E_UNKNOWNNAME;
586}
587
588static HRESULT WINAPI externalDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
589 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
590{
591 switch(id) {
592 case DISPID_EXTERNAL_OK: {
593 VARIANT *b, *m;
594
595 ok(wFlags == INVOKE_FUNC || wFlags == (INVOKE_FUNC|INVOKE_PROPERTYGET), "wFlags = %x\n", wFlags);
596 ok(pdp != NULL, "pdp == NULL\n");
597 ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
598 ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
599 ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs);
600 ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
601 ok(pei != NULL, "pei == NULL\n");
602
603 m = pdp->rgvarg;
604 if(V_VT(m) == (VT_BYREF|VT_VARIANT))
605 m = V_BYREF(m);
606 ok(V_VT(m) == VT_BSTR, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg));
607
608 b = pdp->rgvarg+1;
609 if(V_VT(b) == (VT_BYREF|VT_VARIANT))
610 b = V_BYREF(b);
611 ok(V_VT(b) == VT_BOOL, "V_VT(b) = %d\n", V_VT(b));
612
613 ok(V_BOOL(b), "%s\n", wine_dbgstr_w(V_BSTR(m)));
614 return S_OK;
615 }
616
618 ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags);
619 ok(pdp != NULL, "pdp == NULL\n");
620 ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
621 ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
622 ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
623 ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
624 ok(!pvarRes, "pvarRes != NULL\n");
625 ok(pei != NULL, "pei == NULL\n");
626
627 ok(V_VT(pdp->rgvarg) == VT_BSTR, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg));
628 if(V_VT(pdp->rgvarg) == VT_BSTR)
629 trace("%s\n", wine_dbgstr_w(V_BSTR(pdp->rgvarg)));
630
631 return S_OK;
632
634 CHECK_EXPECT(external_success);
635
636 ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags);
637 ok(pdp != NULL, "pdp == NULL\n");
638 ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
639 ok(pdp->cArgs == 0, "cArgs = %d\n", pdp->cArgs);
640 ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
641 ok(!pvarRes, "pvarRes != NULL\n");
642 ok(pei != NULL, "pei == NULL\n");
643
644 return S_OK;
645
647 ok(wFlags == INVOKE_FUNC || wFlags == (INVOKE_FUNC|INVOKE_PROPERTYGET), "wFlags = %x\n", wFlags);
648 ok(pdp != NULL, "pdp == NULL\n");
649 ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
650 ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
651 ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs);
652 ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
653 ok(pei != NULL, "pei == NULL\n");
654
655 ok(V_VT(pdp->rgvarg) == VT_BSTR, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg));
656 ok(V_VT(pdp->rgvarg+1) == VT_BOOL, "V_VT(psp->rgvargs+1) = %d\n", V_VT(pdp->rgvarg));
658 ok(V_BOOL(pdp->rgvarg+1), "%s\n", wine_dbgstr_w(V_BSTR(pdp->rgvarg)));
659
660 return S_OK;
661
663 ok(wFlags == INVOKE_FUNC || wFlags == (INVOKE_FUNC|INVOKE_PROPERTYGET), "wFlags = %x\n", wFlags);
664 ok(pdp != NULL, "pdp == NULL\n");
665 ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
666 ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
667 ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
668 ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
669 ok(pei != NULL, "pei == NULL\n");
670
671 ok(V_VT(pdp->rgvarg) == VT_BOOL, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg));
672 V_VT(pvarRes) = VT_BOOL;
673 V_BOOL(pvarRes) = broken(V_BOOL(pdp->rgvarg)) ? VARIANT_TRUE : VARIANT_FALSE;
674 return S_OK;
675
676 default:
677 ok(0, "unexpected call\n");
678 return E_NOTIMPL;
679 }
680
681 return S_OK;
682}
683
684static IDispatchExVtbl externalDispVtbl = {
700};
701
703
704static HRESULT QueryInterface(REFIID,void**);
705
707{
708 return QueryInterface(riid, ppv);
709}
710
712{
713 return 2;
714}
715
717{
718 return 1;
719}
720
722 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
723{
724 return E_NOTIMPL;
725}
726
728{
729 return E_NOTIMPL;
730}
731
733 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
735{
736 return S_OK;
737}
738
740{
741 return S_OK;
742}
743
745{
746 return S_OK;
747}
748
750{
751 return E_NOTIMPL;
752}
753
755{
756 return E_NOTIMPL;
757}
758
760{
761 return S_OK;
762}
763
765 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
766{
767 return E_NOTIMPL;
768}
769
771 const GUID *pguidCmdGroup, DWORD nCmdID)
772{
773 return E_NOTIMPL;
774}
775
777 LPOLESTR *pchKey, DWORD dw)
778{
779 return S_OK;
780}
781
783 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
784{
785 return E_NOTIMPL;
786}
787
789{
790 *ppDispatch = (IDispatch*)&externalDisp;
791 return S_OK;
792}
793
795 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
796{
797 return S_FALSE;
798}
799
801 IDataObject **ppPORet)
802{
803 return E_NOTIMPL;
804}
805
807 LPOLESTR *pchKey, DWORD dw)
808{
809 return E_NOTIMPL;
810}
811
812static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
832};
833
835
837{
838 return E_NOINTERFACE;
839}
840
842{
843 return 2;
844}
845
847{
848 return 1;
849}
850
852{
853 return E_NOTIMPL;
854}
855
857{
858 return E_NOTIMPL;
859}
860
862{
863 return E_NOTIMPL;
864}
865
867 LPCBORDERWIDTHS pborderwidths)
868{
869 return E_NOTIMPL;
870}
871
873 LPCBORDERWIDTHS pborderwidths)
874{
875 return S_OK;
876}
877
879 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
880{
881 return S_OK;
882}
883
885 LPOLEMENUGROUPWIDTHS lpMenuWidths)
886{
887 return E_NOTIMPL;
888}
889
891 HOLEMENU holemenu, HWND hwndActiveObject)
892{
893 ok(0, "unexpected call\n");
894 return E_NOTIMPL;
895}
896
898{
899 ok(0, "unexpected call\n");
900 return E_NOTIMPL;
901}
902
903static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
904{
905 return S_OK;
906}
907
909{
910 return E_NOTIMPL;
911}
912
914{
915 ok(0, "unexpected call\n");
916 return E_NOTIMPL;
917}
918
919static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
935};
936
938
940{
941 return QueryInterface(riid, ppv);
942}
943
945{
946 return 2;
947}
948
950{
951 return 1;
952}
953
955{
956 *phwnd = container_hwnd;
957 return S_OK;
958}
959
961{
962 ok(0, "unexpected call\n");
963 return E_NOTIMPL;
964}
965
967{
968 return S_OK;
969}
970
972{
973 return S_OK;
974}
975
977{
978 return S_OK;
979}
980
982 IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
983 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
984{
985 static const RECT rect = {0,0,300,300};
986
987 *ppFrame = &InPlaceFrame;
989 *lprcPosRect = rect;
990 *lprcClipRect = rect;
991
992 ok(lpFrameInfo->cb == sizeof(*lpFrameInfo), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo->cb, (unsigned)sizeof(*lpFrameInfo));
993 lpFrameInfo->fMDIApp = FALSE;
994 lpFrameInfo->hwndFrame = container_hwnd;
995 lpFrameInfo->haccel = NULL;
996 lpFrameInfo->cAccelEntries = 0;
997
998 return S_OK;
999}
1000
1002{
1003 return E_NOTIMPL;
1004}
1005
1007{
1008 return S_OK;
1009}
1010
1012{
1013 return S_OK;
1014}
1015
1017{
1018 return E_NOTIMPL;
1019}
1020
1022{
1023 return E_NOTIMPL;
1024}
1025
1027{
1028 return E_NOTIMPL;
1029}
1030
1031static const IOleInPlaceSiteVtbl InPlaceSiteVtbl = {
1047};
1048
1050
1052{
1053 return QueryInterface(riid, ppv);
1054}
1055
1057{
1058 return 2;
1059}
1060
1062{
1063 return 1;
1064}
1065
1067{
1068 ok(0, "unexpected call\n");
1069 return E_NOTIMPL;
1070}
1071
1072static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
1073 IMoniker **ppmon)
1074{
1075 ok(0, "unexpected call\n");
1076 return E_NOTIMPL;
1077}
1078
1080{
1081 return E_NOTIMPL;
1082}
1083
1085{
1086 ok(0, "unexpected call\n");
1087 return E_NOTIMPL;
1088}
1089
1091{
1092 ok(0, "unexpected call\n");
1093 return E_NOTIMPL;
1094}
1095
1097{
1098 ok(0, "unexpected call\n");
1099 return E_NOTIMPL;
1100}
1101
1102static const IOleClientSiteVtbl ClientSiteVtbl = {
1112};
1113
1115
1117{
1118 return QueryInterface(riid, ppv);
1119}
1120
1122{
1123 return 2;
1124}
1125
1127{
1128 return 1;
1129}
1130
1132{
1133 RECT rect = {0,0,300,300};
1134 IOleDocument *document;
1135 HRESULT hres;
1136
1137 hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
1138 ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
1139
1140 hres = IOleDocument_CreateView(document, &InPlaceSite, NULL, 0, &view);
1141 IOleDocument_Release(document);
1142 ok(hres == S_OK, "CreateView failed: %08x\n", hres);
1143
1144 hres = IOleDocumentView_SetInPlaceSite(view, &InPlaceSite);
1145 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
1146
1147 hres = IOleDocumentView_UIActivate(view, TRUE);
1148 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
1149
1150 hres = IOleDocumentView_SetRect(view, &rect);
1151 ok(hres == S_OK, "SetRect failed: %08x\n", hres);
1152
1153 hres = IOleDocumentView_Show(view, TRUE);
1154 ok(hres == S_OK, "Show failed: %08x\n", hres);
1155
1156 return S_OK;
1157}
1158
1159static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
1164};
1165
1167
1169{
1170 *ppv = NULL;
1171
1173 *ppv = &ClientSite;
1174 else if(IsEqualGUID(&IID_IOleDocumentSite, riid))
1175 *ppv = &DocumentSite;
1177 *ppv = &InPlaceSite;
1178 else if(IsEqualGUID(&IID_IDocHostUIHandler, riid) || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
1180
1181 return *ppv ? S_OK : E_NOINTERFACE;
1182}
1183
1184static IHTMLDocument2 *create_document(void)
1185{
1186 IHTMLDocument2 *doc;
1187 HRESULT hres;
1188
1189 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
1190 &IID_IHTMLDocument2, (void**)&doc);
1191 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
1192 return SUCCEEDED(hres) ? doc : NULL;
1193}
1194
1195static void load_string(IHTMLDocument2 *doc, const char *str)
1196{
1198 IStream *stream;
1199 HGLOBAL mem;
1200 SIZE_T len;
1201
1203 len = strlen(str);
1204 mem = GlobalAlloc(0, len);
1205 memcpy(mem, str, len);
1207
1208 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
1209
1210 IPersistStreamInit_Load(init, stream);
1211 IPersistStreamInit_Release(init);
1212 IStream_Release(stream);
1213}
1214
1215static void do_advise(IHTMLDocument2 *doc, REFIID riid, IUnknown *unk_advise)
1216{
1219 DWORD cookie;
1220 HRESULT hres;
1221
1222 hres = IHTMLDocument2_QueryInterface(doc, &IID_IConnectionPointContainer, (void**)&container);
1223 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
1224
1225 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
1226 IConnectionPointContainer_Release(container);
1227 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
1228
1229 notif_doc = doc;
1230
1231 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
1232 IConnectionPoint_Release(cp);
1233 ok(hres == S_OK, "Advise failed: %08x\n", hres);
1234}
1235
1236static void set_client_site(IHTMLDocument2 *doc, BOOL set)
1237{
1238 IOleObject *oleobj;
1239 HRESULT hres;
1240
1241 if(!set && view) {
1242 IOleDocumentView_Show(view, FALSE);
1243 IOleDocumentView_CloseView(view, 0);
1244 IOleDocumentView_SetInPlaceSite(view, NULL);
1245 IOleDocumentView_Release(view);
1246 view = NULL;
1247 }
1248
1249 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
1250 ok(hres == S_OK, "Could not et IOleObject: %08x\n", hres);
1251
1252 hres = IOleObject_SetClientSite(oleobj, set ? &ClientSite : NULL);
1253 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
1254
1255 if(set) {
1256 IHlinkTarget *hlink;
1257
1258 hres = IOleObject_QueryInterface(oleobj, &IID_IHlinkTarget, (void**)&hlink);
1259 ok(hres == S_OK, "Could not get IHlinkTarget iface: %08x\n", hres);
1260
1261 hres = IHlinkTarget_Navigate(hlink, 0, NULL);
1262 ok(hres == S_OK, "Navgate failed: %08x\n", hres);
1263
1264 IHlinkTarget_Release(hlink);
1265 }
1266
1267 IOleObject_Release(oleobj);
1268}
1269
1270typedef void (*domtest_t)(IHTMLDocument2*);
1271
1272static void load_doc(IHTMLDocument2 *doc, const char *str)
1273{
1274 IHTMLElement *body = NULL;
1275 MSG msg;
1276 HRESULT hres;
1277 static const WCHAR ucPtr[] = {'b','a','c','k','g','r','o','u','n','d',0};
1278 DISPID dispID = -1;
1279 OLECHAR *name;
1280
1281 load_string(doc, str);
1283
1284 while(!doc_complete && GetMessageW(&msg, NULL, 0, 0)) {
1287 }
1288
1289 hres = IHTMLDocument2_get_body(doc, &body);
1290 ok(hres == S_OK, "get_body failed: %08x\n", hres);
1291
1292 /* Check we can query for function on the IHTMLElementBody interface */
1293 name = (WCHAR*)ucPtr;
1294 hres = IHTMLElement_GetIDsOfNames(body, &IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispID);
1295 ok(hres == S_OK, "GetIDsOfNames(background) failed %08x\n", hres);
1296 ok(dispID == DISPID_IHTMLBODYELEMENT_BACKGROUND, "Incorrect dispID got (%d)\n", dispID);
1297
1298 IHTMLElement_Release(body);
1299}
1300
1302{
1303 *ppv = NULL;
1304 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
1305 return E_NOINTERFACE;
1306}
1307
1309{
1310 return 2;
1311}
1312
1314{
1315 return 1;
1316}
1317
1319 DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
1320{
1321 CHECK_EXPECT(GetInterfaceSafetyOptions);
1322
1323 ok(IsEqualGUID(&IID_IActiveScriptParse, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
1324 ok(pdwSupportedOptions != NULL, "pdwSupportedOptions == NULL\n");
1325 ok(pdwEnabledOptions != NULL, "pdwEnabledOptions == NULL\n");
1326
1327 *pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER;
1328 *pdwEnabledOptions = INTERFACE_USES_DISPEX;
1329
1330 return S_OK;
1331}
1332
1334 DWORD dwOptionSetMask, DWORD dwEnabledOptions)
1335{
1336 CHECK_EXPECT(SetInterfaceSafetyOptions);
1337
1338 ok(IsEqualGUID(&IID_IActiveScriptParse, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
1339
1340 ok(dwOptionSetMask == (INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER),
1341 "dwOptionSetMask=%x\n", dwOptionSetMask);
1342 ok(dwEnabledOptions == (INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER),
1343 "dwEnabledOptions=%x\n", dwOptionSetMask);
1344
1345 return S_OK;
1346}
1347
1348static const IObjectSafetyVtbl ObjectSafetyVtbl = {
1354};
1355
1357
1359{
1360 *ppv = NULL;
1361
1362 if(IsEqualGUID(&IID_IActiveScript, riid)) {
1363 CHECK_EXPECT(AXQueryInterface_IActiveScript);
1364 return E_NOINTERFACE;
1365 }
1366
1367 if(IsEqualGUID(&IID_IObjectSafety, riid)) {
1368 CHECK_EXPECT2(AXQueryInterface_IObjectSafety);
1369 if(!ax_objsafe)
1370 return E_NOINTERFACE;
1371 *ppv = iface;
1372 return S_OK;
1373 }
1374
1375 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
1376 return E_NOINTERFACE;
1377}
1378
1380 DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
1381{
1382 CHECK_EXPECT(AXGetInterfaceSafetyOptions);
1383
1384 ok(IsEqualGUID(&IID_IDispatchEx, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
1385 ok(pdwSupportedOptions != NULL, "pdwSupportedOptions == NULL\n");
1386 ok(pdwEnabledOptions != NULL, "pdwEnabledOptions == NULL\n");
1387
1389 *pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER;
1390 *pdwEnabledOptions = INTERFACE_USES_DISPEX;
1391 }
1392
1393 return ax_getopt_hres;
1394}
1395
1397 DWORD dwOptionSetMask, DWORD dwEnabledOptions)
1398{
1399 if(IsEqualGUID(&IID_IDispatchEx, riid)) {
1400 switch(dwEnabledOptions) {
1401 case INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACE_USES_SECURITY_MANAGER:
1402 CHECK_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1403 break;
1404 case INTERFACESAFE_FOR_UNTRUSTED_CALLER:
1405 CHECK_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller);
1406 break;
1407 default:
1408 ok(0, "unexpected dwEnabledOptions %x\n", dwEnabledOptions);
1409 }
1410
1411 ok(dwOptionSetMask == dwEnabledOptions, "dwOptionSetMask=%x, expected %x\n", dwOptionSetMask, dwEnabledOptions);
1412 return ax_setopt_dispex_hres;
1413 }
1414
1416 HRESULT hres;
1417
1418 switch(dwEnabledOptions) {
1419 case INTERFACESAFE_FOR_UNTRUSTED_CALLER:
1420 CHECK_EXPECT(AXSetInterfaceSafetyOptions_IDispatch_caller);
1422 break;
1423 case INTERFACESAFE_FOR_UNTRUSTED_DATA:
1424 CHECK_EXPECT(AXSetInterfaceSafetyOptions_IDispatch_data);
1426 break;
1427 default:
1428 ok(0, "unexpected dwEnabledOptions %x\n", dwEnabledOptions);
1429 hres = E_FAIL;
1430 }
1431 ok(dwOptionSetMask == dwEnabledOptions, "dwOptionSetMask=%x, expected %x\n", dwOptionSetMask, dwEnabledOptions);
1432 return hres;
1433 }
1434
1435 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
1436 return E_NOINTERFACE;
1437}
1438
1439static const IObjectSafetyVtbl AXObjectSafetyVtbl = {
1445};
1446
1448
1449static BOOL set_safe_reg(BOOL safe_call, BOOL safe_data)
1450{
1451 return init_key("CLSID\\"TESTACTIVEX_CLSID"\\Implemented Categories\\{7dd95801-9882-11cf-9fa9-00aa006c42c4}",
1452 NULL, safe_call)
1453 && init_key("CLSID\\"TESTACTIVEX_CLSID"\\Implemented Categories\\{7dd95802-9882-11cf-9fa9-00aa006c42c4}",
1454 NULL, safe_data);
1455}
1456
1457#define check_custom_policy(a,b,c,d) _check_custom_policy(__LINE__,a,b,c,d)
1458static void _check_custom_policy(unsigned line, HRESULT hres, BYTE *ppolicy, DWORD policy_size, DWORD expolicy)
1459{
1460 ok_(__FILE__,line)(hres == S_OK, "QueryCusromPolicy failed: %08x\n", hres);
1461 ok_(__FILE__,line)(policy_size == sizeof(DWORD), "policy_size = %d\n", policy_size);
1462 ok_(__FILE__,line)(*(DWORD*)ppolicy == expolicy, "policy = %x, expected %x\n", *(DWORD*)ppolicy, expolicy);
1463 CoTaskMemFree(ppolicy);
1464}
1465
1466static void test_security_reg(IInternetHostSecurityManager *sec_mgr, DWORD policy_caller, DWORD policy_load)
1467{
1468 struct CONFIRMSAFETY cs;
1469 DWORD policy_size;
1470 BYTE *ppolicy;
1471 HRESULT hres;
1472
1473 cs.clsid = CLSID_TestActiveX;
1474 cs.pUnk = (IUnknown*)&AXObjectSafety;
1475
1476 cs.dwFlags = 0;
1477 ax_objsafe = FALSE;
1478 SET_EXPECT(AXQueryInterface_IActiveScript);
1479 SET_EXPECT(AXQueryInterface_IObjectSafety);
1480 hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
1481 &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
1482 CHECK_CALLED(AXQueryInterface_IActiveScript);
1483 CHECK_CALLED(AXQueryInterface_IObjectSafety);
1484 check_custom_policy(hres, ppolicy, policy_size, policy_caller);
1485
1486 ax_objsafe = TRUE;
1487 SET_EXPECT(AXQueryInterface_IActiveScript);
1488 SET_EXPECT(AXQueryInterface_IObjectSafety);
1489 SET_EXPECT(AXGetInterfaceSafetyOptions);
1490 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1491 hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
1492 &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
1493 CHECK_CALLED(AXQueryInterface_IActiveScript);
1494 CHECK_CALLED(AXQueryInterface_IObjectSafety);
1495 CHECK_CALLED(AXGetInterfaceSafetyOptions);
1496 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1497 check_custom_policy(hres, ppolicy, policy_size, URLPOLICY_ALLOW);
1498
1500 return;
1501
1502 cs.dwFlags = CONFIRMSAFETYACTION_LOADOBJECT;
1503 ax_objsafe = FALSE;
1504 SET_EXPECT(AXQueryInterface_IActiveScript);
1505 SET_EXPECT(AXQueryInterface_IObjectSafety);
1506 hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
1507 &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
1508 CHECK_CALLED(AXQueryInterface_IActiveScript);
1509 CHECK_CALLED(AXQueryInterface_IObjectSafety);
1510 check_custom_policy(hres, ppolicy, policy_size, policy_load);
1511
1512 ax_objsafe = TRUE;
1513 SET_EXPECT(AXQueryInterface_IActiveScript);
1514 SET_EXPECT(AXQueryInterface_IObjectSafety);
1515 SET_EXPECT(AXGetInterfaceSafetyOptions);
1516 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1517 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatch_data);
1518 hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
1519 &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
1520 CHECK_CALLED(AXQueryInterface_IActiveScript);
1521 CHECK_CALLED(AXQueryInterface_IObjectSafety);
1522 CHECK_CALLED(AXGetInterfaceSafetyOptions);
1523 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1524 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatch_data);
1525 check_custom_policy(hres, ppolicy, policy_size, URLPOLICY_ALLOW);
1526}
1527
1528static void test_security(void)
1529{
1532 DWORD policy, policy_size;
1533 struct CONFIRMSAFETY cs;
1534 BYTE *ppolicy;
1535 HRESULT hres;
1536
1537 hres = IActiveScriptSite_QueryInterface(site, &IID_IServiceProvider, (void**)&sp);
1538 ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
1539
1540 hres = IServiceProvider_QueryService(sp, &SID_SInternetHostSecurityManager,
1541 &IID_IInternetHostSecurityManager, (void**)&sec_mgr);
1542 IServiceProvider_Release(sp);
1543 ok(hres == S_OK, "QueryService failed: %08x\n", hres);
1544
1545 hres = IInternetHostSecurityManager_ProcessUrlAction(sec_mgr, URLACTION_ACTIVEX_RUN, (BYTE*)&policy, sizeof(policy),
1546 (BYTE*)&CLSID_TestActiveX, sizeof(CLSID), 0, 0);
1547 ok(hres == S_OK, "ProcessUrlAction failed: %08x\n", hres);
1548 ok(policy == URLPOLICY_ALLOW, "policy = %x\n", policy);
1549
1550 cs.clsid = CLSID_TestActiveX;
1551 cs.pUnk = (IUnknown*)&AXObjectSafety;
1552 cs.dwFlags = 0;
1553
1554 ax_objsafe = TRUE;
1555 SET_EXPECT(AXQueryInterface_IActiveScript);
1556 SET_EXPECT(AXQueryInterface_IObjectSafety);
1557 SET_EXPECT(AXGetInterfaceSafetyOptions);
1558 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1559 hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
1560 &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
1561 CHECK_CALLED(AXQueryInterface_IActiveScript);
1562 CHECK_CALLED(AXQueryInterface_IObjectSafety);
1563 CHECK_CALLED(AXGetInterfaceSafetyOptions);
1564 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1565 check_custom_policy(hres, ppolicy, policy_size, URLPOLICY_ALLOW);
1566
1567 cs.dwFlags = CONFIRMSAFETYACTION_LOADOBJECT;
1568 SET_EXPECT(AXQueryInterface_IActiveScript);
1569 SET_EXPECT(AXQueryInterface_IObjectSafety);
1570 SET_EXPECT(AXGetInterfaceSafetyOptions);
1571 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1572 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatch_data);
1573 hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
1574 &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
1575 CHECK_CALLED(AXQueryInterface_IActiveScript);
1576 CHECK_CALLED(AXQueryInterface_IObjectSafety);
1577 CHECK_CALLED(AXGetInterfaceSafetyOptions);
1578 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1579 if(called_AXSetInterfaceSafetyOptions_IDispatch_data) {
1580 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatch_data);
1581 }else {
1582 win_skip("CONFIRMSAFETYACTION_LOADOBJECT flag not supported\n");
1584 CLEAR_CALLED(AXSetInterfaceSafetyOptions_IDispatch_data);
1585 }
1586 check_custom_policy(hres, ppolicy, policy_size, URLPOLICY_ALLOW);
1587
1588 cs.dwFlags = 0;
1589 ax_objsafe = FALSE;
1590 SET_EXPECT(AXQueryInterface_IActiveScript);
1591 SET_EXPECT(AXQueryInterface_IObjectSafety);
1592 hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
1593 &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
1594 CHECK_CALLED(AXQueryInterface_IActiveScript);
1595 CHECK_CALLED(AXQueryInterface_IObjectSafety);
1596 check_custom_policy(hres, ppolicy, policy_size, URLPOLICY_DISALLOW);
1597
1599 cs.dwFlags = CONFIRMSAFETYACTION_LOADOBJECT;
1600 ax_objsafe = FALSE;
1601 SET_EXPECT(AXQueryInterface_IActiveScript);
1602 SET_EXPECT(AXQueryInterface_IObjectSafety);
1603 hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
1604 &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
1605 CHECK_CALLED(AXQueryInterface_IActiveScript);
1606 CHECK_CALLED(AXQueryInterface_IObjectSafety);
1607 check_custom_policy(hres, ppolicy, policy_size, URLPOLICY_DISALLOW);
1608 }
1609
1610 if(set_safe_reg(TRUE, FALSE)) {
1611 test_security_reg(sec_mgr, URLPOLICY_ALLOW, URLPOLICY_DISALLOW);
1612
1614 test_security_reg(sec_mgr, URLPOLICY_DISALLOW, URLPOLICY_DISALLOW);
1615
1617 test_security_reg(sec_mgr, URLPOLICY_ALLOW, URLPOLICY_ALLOW);
1618
1620 }else {
1621 skip("Could not set safety registry\n");
1622 }
1623
1624 ax_objsafe = TRUE;
1625
1626 cs.dwFlags = 0;
1628 SET_EXPECT(AXQueryInterface_IActiveScript);
1629 SET_EXPECT(AXQueryInterface_IObjectSafety);
1630 SET_EXPECT(AXGetInterfaceSafetyOptions);
1631 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1632 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatch_caller);
1633 hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
1634 &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
1635 CHECK_CALLED(AXQueryInterface_IActiveScript);
1636 CHECK_CALLED(AXQueryInterface_IObjectSafety);
1637 CHECK_CALLED(AXGetInterfaceSafetyOptions);
1638 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1639 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatch_caller);
1640 check_custom_policy(hres, ppolicy, policy_size, URLPOLICY_ALLOW);
1641
1644 SET_EXPECT(AXQueryInterface_IActiveScript);
1645 SET_EXPECT(AXQueryInterface_IObjectSafety);
1646 SET_EXPECT(AXGetInterfaceSafetyOptions);
1647 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1648 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatch_caller);
1649 hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
1650 &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
1651 CHECK_CALLED(AXQueryInterface_IActiveScript);
1652 CHECK_CALLED(AXQueryInterface_IObjectSafety);
1653 CHECK_CALLED(AXGetInterfaceSafetyOptions);
1654 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1655 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatch_caller);
1656 check_custom_policy(hres, ppolicy, policy_size, URLPOLICY_DISALLOW);
1657
1659 cs.dwFlags = CONFIRMSAFETYACTION_LOADOBJECT;
1662 SET_EXPECT(AXQueryInterface_IActiveScript);
1663 SET_EXPECT(AXQueryInterface_IObjectSafety);
1664 SET_EXPECT(AXGetInterfaceSafetyOptions);
1665 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1666 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatch_caller);
1667 hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
1668 &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
1669 CHECK_CALLED(AXQueryInterface_IActiveScript);
1670 CHECK_CALLED(AXQueryInterface_IObjectSafety);
1671 CHECK_CALLED(AXGetInterfaceSafetyOptions);
1672 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
1673 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatch_caller);
1674 check_custom_policy(hres, ppolicy, policy_size, URLPOLICY_DISALLOW);
1675 }
1676
1677 cs.dwFlags = 0;
1681 SET_EXPECT(AXQueryInterface_IActiveScript);
1682 SET_EXPECT(AXQueryInterface_IObjectSafety);
1683 SET_EXPECT(AXGetInterfaceSafetyOptions);
1684 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller);
1685 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatch_caller);
1686 hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
1687 &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
1688 CHECK_CALLED(AXQueryInterface_IActiveScript);
1689 CHECK_CALLED(AXQueryInterface_IObjectSafety);
1690 CHECK_CALLED(AXGetInterfaceSafetyOptions);
1691 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatchEx_caller);
1692 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatch_caller);
1693 check_custom_policy(hres, ppolicy, policy_size, URLPOLICY_ALLOW);
1694
1696 cs.dwFlags = CONFIRMSAFETYACTION_LOADOBJECT;
1701 SET_EXPECT(AXQueryInterface_IActiveScript);
1702 SET_EXPECT(AXQueryInterface_IObjectSafety);
1703 SET_EXPECT(AXGetInterfaceSafetyOptions);
1704 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller);
1705 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatch_caller);
1706 SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatch_data);
1707 hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
1708 &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
1709 CHECK_CALLED(AXQueryInterface_IActiveScript);
1710 CHECK_CALLED(AXQueryInterface_IObjectSafety);
1711 CHECK_CALLED(AXGetInterfaceSafetyOptions);
1712 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatchEx_caller);
1713 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatch_caller);
1714 CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatch_data);
1715 check_custom_policy(hres, ppolicy, policy_size, URLPOLICY_DISALLOW);
1716 }
1717
1718 IInternetHostSecurityManager_Release(sec_mgr);
1719}
1720
1722{
1723 *ppv = NULL;
1724 ok(0, "unexpected call\n");
1725 return E_NOINTERFACE;
1726}
1727
1729{
1730 return 2;
1731}
1732
1734{
1735 return 1;
1736}
1737
1739 VARIANT *pvarIndex, VARIANT *pvarValue)
1740{
1741 ok(0, "unexpected call\n");
1742 return E_NOTIMPL;
1743}
1744
1746 VARIANT *pvarIndex, VARIANT *pvarValue)
1747{
1748 switch(dwProperty) {
1749 case SCRIPTPROP_HACK_TRIDENTEVENTSINK:
1750 CHECK_EXPECT(SetProperty_HACK_TRIDENTEVENTSINK);
1751 ok(V_VT(pvarValue) == VT_BOOL, "V_VT(pvarValue)=%d\n", V_VT(pvarValue));
1752 ok(V_BOOL(pvarValue) == VARIANT_TRUE, "V_BOOL(pvarValue)=%x\n", V_BOOL(pvarValue));
1753 break;
1754 case SCRIPTPROP_INVOKEVERSIONING:
1755 CHECK_EXPECT(SetProperty_INVOKEVERSIONING);
1756 ok(V_VT(pvarValue) == VT_I4, "V_VT(pvarValue)=%d\n", V_VT(pvarValue));
1757 ok(V_I4(pvarValue) == 1, "V_I4(pvarValue)=%d\n", V_I4(pvarValue));
1758 break;
1759 case SCRIPTPROP_ABBREVIATE_GLOBALNAME_RESOLUTION:
1760 CHECK_EXPECT(SetProperty_ABBREVIATE_GLOBALNAME_RESOLUTION);
1761 ok(V_VT(pvarValue) == VT_BOOL, "V_VT(pvarValue)=%d\n", V_VT(pvarValue));
1762 ok(V_BOOL(pvarValue) == VARIANT_TRUE, "V_BOOL(pvarValue)=%x\n", V_BOOL(pvarValue));
1763 break;
1764 case 0x70000003: /* Undocumented property set by IE10 */
1765 return E_NOTIMPL;
1766 default:
1767 ok(0, "unexpected property %x\n", dwProperty);
1768 return E_NOTIMPL;
1769 }
1770
1771 ok(!pvarIndex, "pvarIndex != NULL\n");
1772 ok(pvarValue != NULL, "pvarValue == NULL\n");
1773
1774 return S_OK;
1775}
1776
1777static const IActiveScriptPropertyVtbl ActiveScriptPropertyVtbl = {
1783};
1784
1786
1787static HRESULT WINAPI ActiveScriptParseProcedure_QueryInterface(IActiveScriptParseProcedure2 *iface, REFIID riid, void **ppv)
1788{
1789 *ppv = NULL;
1790 ok(0, "unexpected call\n");
1791 return E_NOINTERFACE;
1792}
1793
1794static ULONG WINAPI ActiveScriptParseProcedure_AddRef(IActiveScriptParseProcedure2 *iface)
1795{
1796 return 2;
1797}
1798
1799static ULONG WINAPI ActiveScriptParseProcedure_Release(IActiveScriptParseProcedure2 *iface)
1800{
1801 return 1;
1802}
1803
1804static HRESULT WINAPI ActiveScriptParseProcedure_ParseProcedureText(IActiveScriptParseProcedure2 *iface,
1805 LPCOLESTR pstrCode, LPCOLESTR pstrFormalParams, LPCOLESTR pstrProcedureName,
1806 LPCOLESTR pstrItemName, IUnknown *punkContext, LPCOLESTR pstrDelimiter,
1807 CTXARG_T dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags, IDispatch **ppdisp)
1808{
1809 ok(0, "unexpected call\n");
1810 return E_NOTIMPL;
1811}
1812
1818};
1819
1820static IActiveScriptParseProcedure2 ActiveScriptParseProcedure = { &ActiveScriptParseProcedureVtbl };
1821
1822static HRESULT WINAPI ActiveScriptParse_QueryInterface(IActiveScriptParse *iface, REFIID riid, void **ppv)
1823{
1824 *ppv = NULL;
1825 ok(0, "unexpected call\n");
1826 return E_NOINTERFACE;
1827}
1828
1829static ULONG WINAPI ActiveScriptParse_AddRef(IActiveScriptParse *iface)
1830{
1831 return 2;
1832}
1833
1834static ULONG WINAPI ActiveScriptParse_Release(IActiveScriptParse *iface)
1835{
1836 return 1;
1837}
1838
1839static HRESULT WINAPI ActiveScriptParse_InitNew(IActiveScriptParse *iface)
1840{
1841 CHECK_EXPECT(InitNew);
1842 return S_OK;
1843}
1844
1845static HRESULT WINAPI ActiveScriptParse_AddScriptlet(IActiveScriptParse *iface,
1846 LPCOLESTR pstrDefaultName, LPCOLESTR pstrCode, LPCOLESTR pstrItemName,
1847 LPCOLESTR pstrSubItemName, LPCOLESTR pstrEventName, LPCOLESTR pstrDelimiter,
1848 CTXARG_T dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags,
1849 BSTR *pbstrName, EXCEPINFO *pexcepinfo)
1850{
1851 ok(0, "unexpected call\n");
1852 return E_NOTIMPL;
1853}
1854
1856{
1857 DISPID propput_arg = DISPID_PROPERTYPUT;
1858 DISPPARAMS dp = {var, &propput_arg, 1, 1};
1859 EXCEPINFO ei = {0};
1860
1861 return IDispatchEx_InvokeEx(obj, id, LOCALE_NEUTRAL, DISPATCH_PROPERTYPUT|flags, &dp, NULL, &ei, caller_sp);
1862}
1863
1865{
1866 DISPPARAMS dp = {NULL};
1867 EXCEPINFO ei = {0};
1868
1869 return IDispatchEx_InvokeEx(obj, id, LOCALE_NEUTRAL, DISPATCH_PROPERTYGET, &dp, res, &ei, caller_sp);
1870}
1871
1873{
1874 DISPID id;
1875 IDispatchEx *dispex;
1876 IDispatch *disp;
1877 EXCEPINFO ei;
1878 DISPPARAMS dp;
1879 BSTR str;
1880 VARIANT var;
1881 HRESULT hres;
1882
1883 str = a2bstr("toString");
1884 hres = IDispatchEx_GetDispID(obj, str, fdexNameCaseSensitive, &id);
1886 ok(hres == S_OK, "GetDispID failed: %08x\n", hres);
1887 ok(id == DISPID_IOMNAVIGATOR_TOSTRING, "id = %x\n", id);
1888
1889 memset(&dp, 0, sizeof(dp));
1890 memset(&ei, 0, sizeof(ei));
1891 VariantInit(&var);
1892 hres = IDispatchEx_InvokeEx(obj, id, LOCALE_NEUTRAL, DISPATCH_PROPERTYGET, &dp, &var, &ei, NULL);
1893 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
1894 ok(V_VT(&var) == VT_DISPATCH, "V_VT(var)=%d\n", V_VT(&var));
1895 ok(V_DISPATCH(&var) != NULL, "V_DISPATCH(var) == NULL\n");
1896 disp = V_DISPATCH(&var);
1897
1898 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1899 IDispatch_Release(disp);
1900 ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres);
1901
1902 /* FIXME: Test InvokeEx(DISPATCH_METHOD) */
1903
1904 memset(&dp, 0, sizeof(dp));
1905 memset(&ei, 0, sizeof(ei));
1906 VariantInit(&var);
1907 hres = IDispatchEx_Invoke(dispex, DISPID_VALUE, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dp, &var, &ei, NULL);
1908 ok(hres == S_OK || broken(E_ACCESSDENIED), "InvokeEx failed: %08x\n", hres);
1909 if(SUCCEEDED(hres)) {
1910 ok(V_VT(&var) == VT_BSTR, "V_VT(var)=%d\n", V_VT(&var));
1911 ok(!strcmp_wa(V_BSTR(&var), "[object]"), "V_BSTR(var) = %s\n", wine_dbgstr_w(V_BSTR(&var)));
1912 VariantClear(&var);
1913 }
1914
1915 V_VT(&var) = VT_I4;
1916 V_I4(&var) = 100;
1917 hres = dispex_propput(obj, id, 0, &var, NULL);
1918 todo_wine ok(hres == E_NOTIMPL, "InvokeEx failed: %08x\n", hres);
1919
1920 hres = dispex_propget(dispex, DISPID_VALUE, &var, NULL);
1921 ok(hres == E_ACCESSDENIED, "InvokeEx returned: %08x, expected E_ACCESSDENIED\n", hres);
1922 if(SUCCEEDED(hres))
1923 VariantClear(&var);
1924
1925 SET_EXPECT(QS_IActiveScriptSite);
1926 SET_EXPECT(QS_GetCaller);
1927 hres = dispex_propget(dispex, DISPID_VALUE, &var, &caller_sp);
1928 ok(hres == S_OK, "InvokeEx returned: %08x, expected S_OK\n", hres);
1929 ok(V_VT(&var) == VT_BSTR, "V_VT(var) = %d\n", V_VT(&var));
1930 ok(!strcmp_wa(V_BSTR(&var), "\nfunction toString() {\n [native code]\n}\n"),
1931 "V_BSTR(var) = %s\n", wine_dbgstr_w(V_BSTR(&var)));
1932 VariantClear(&var);
1933 todo_wine CHECK_CALLED(QS_IActiveScriptSite);
1934 todo_wine CHECK_CALLED(QS_GetCaller);
1935
1936 IDispatchEx_Release(dispex);
1937}
1938
1939static void test_nextdispid(IDispatchEx *dispex)
1940{
1941 DISPID last_id = DISPID_STARTENUM, id, dyn_id;
1942 BSTR name;
1943 VARIANT var;
1944 HRESULT hres;
1945
1946 name = a2bstr("dynVal");
1947 hres = IDispatchEx_GetDispID(dispex, name, fdexNameCaseSensitive|fdexNameEnsure, &dyn_id);
1948 ok(hres == S_OK, "GetDispID failed: %08x\n", hres);
1950
1951 V_VT(&var) = VT_EMPTY;
1952 hres = dispex_propput(dispex, dyn_id, 0, &var, NULL);
1953 ok(hres == S_OK, "dispex_propput failed: %08x\n", hres);
1954
1955 while(last_id != dyn_id) {
1956 hres = IDispatchEx_GetNextDispID(dispex, fdexEnumAll, last_id, &id);
1957 ok(hres == S_OK, "GetNextDispID returned: %08x\n", hres);
1958 ok(id != DISPID_STARTENUM, "id == DISPID_STARTENUM\n");
1959 ok(id != DISPID_IOMNAVIGATOR_TOSTRING, "id == DISPID_IOMNAVIGATOR_TOSTRING\n");
1960
1961 hres = IDispatchEx_GetMemberName(dispex, id, &name);
1962 ok(hres == S_OK, "GetMemberName failed: %08x\n", hres);
1963
1964 if(id == dyn_id)
1965 ok(!strcmp_wa(name, "dynVal"), "name = %s\n", wine_dbgstr_w(name));
1966 else if(id == DISPID_IOMNAVIGATOR_PLATFORM)
1967 ok(!strcmp_wa(name, "platform"), "name = %s\n", wine_dbgstr_w(name));
1968
1970 last_id = id;
1971 }
1972
1973 hres = IDispatchEx_GetNextDispID(dispex, 0, id, &id);
1974 ok(hres == S_FALSE, "GetNextDispID returned: %08x\n", hres);
1975 ok(id == DISPID_STARTENUM, "id != DISPID_STARTENUM\n");
1976}
1977
1978static void test_global_id(void)
1979{
1980 VARIANT var;
1981 DISPPARAMS dp;
1982 EXCEPINFO ei;
1983 BSTR tmp;
1984 DISPID id;
1985 HRESULT hres;
1986
1987 SET_EXPECT(GetScriptDispatch);
1988 SET_EXPECT(script_divid_d);
1989 tmp = a2bstr("divid");
1990 hres = IDispatchEx_GetDispID(window_dispex, tmp, fdexNameCaseSensitive, &id);
1991 ok(hres == S_OK, "GetDispID failed: %08x\n", hres);
1992 SysFreeString(tmp);
1993 CHECK_CALLED(GetScriptDispatch);
1994 CHECK_CALLED(script_divid_d);
1995
1996 VariantInit(&var);
1997 memset(&ei, 0, sizeof(ei));
1998 memset(&dp, 0, sizeof(dp));
1999 hres = IDispatchEx_InvokeEx(window_dispex, id, 0, DISPATCH_PROPERTYGET, &dp, &var, &ei, NULL);
2000 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2001 ok(V_VT(&var) == VT_DISPATCH, "V_VT(var) = %d\n", V_VT(&var));
2002 VariantClear(&var);
2003}
2004
2006{
2007 IHTMLDocument2 *doc;
2008 IDispatchEx *dispex;
2009 IHTMLElement *elem;
2010 VARIANT v;
2011 HRESULT hres;
2012
2013 hres = IHTMLWindow2_get_document(window, &doc);
2014 ok(hres == S_OK, "get_document failed: %08x\n", hres);
2015
2016 hres = IHTMLDocument2_get_body(doc, &elem);
2017 IHTMLDocument2_Release(doc);
2018 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2019
2020 hres = IHTMLElement_QueryInterface(elem, &IID_IDispatchEx, (void**)&dispex);
2021 IHTMLElement_Release(elem);
2022 ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres);
2023
2024 SET_EXPECT(QS_VariantConversion);
2025 SET_EXPECT(ChangeType);
2026 V_VT(&v) = VT_I4;
2027 V_I4(&v) = 0xf0f0f0;
2029 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2030 CHECK_CALLED(QS_VariantConversion);
2031 CHECK_CALLED(ChangeType);
2032
2033 V_VT(&v) = VT_EMPTY;
2035 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2036 ok(V_VT(&v) == VT_BSTR, "V_VT(var)=%d\n", V_VT(&v));
2037 ok(!V_BSTR(&v), "V_BSTR(&var) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2038
2039 IDispatchEx_Release(dispex);
2040}
2041
2042#define test_elem_disabled(a,b) _test_elem_disabled(__LINE__,a,b)
2043static void _test_elem_disabled(unsigned line, IHTMLElement *elem, VARIANT_BOOL exb)
2044{
2045 IHTMLElement3 *elem3;
2046 VARIANT_BOOL b = 100;
2047 HRESULT hres;
2048
2049 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement3, (void**)&elem3);
2050 ok_(__FILE__,line)(hres == S_OK, "Could not get IHTMLElement3 iface: %08x\n", hres);
2051
2052 hres = IHTMLElement3_get_disabled(elem3, &b);
2053 ok_(__FILE__,line)(hres == S_OK, "get_disabled failed: %08x\n", hres);
2054 ok_(__FILE__,line)(b == exb, "disabled = %x, expected %x\n", b, exb);
2055
2056 IHTMLElement3_Release(elem3);
2057}
2058
2060{
2061 IHTMLDocument2 *doc;
2062 IDispatchEx *dispex;
2063 IHTMLElement *elem;
2064 VARIANT v;
2065 HRESULT hres;
2066
2067 hres = IHTMLWindow2_get_document(window, &doc);
2068 ok(hres == S_OK, "get_document failed: %08x\n", hres);
2069
2070 hres = IHTMLDocument2_get_body(doc, &elem);
2071 IHTMLDocument2_Release(doc);
2072 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2073
2074 hres = IHTMLElement_QueryInterface(elem, &IID_IDispatchEx, (void**)&dispex);
2075 ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres);
2076
2077 test_elem_disabled(elem, VARIANT_FALSE);
2078
2079 V_VT(&v) = VT_BSTR;
2080 V_BSTR(&v) = a2bstr("test");
2082 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2084
2085 test_elem_disabled(elem, VARIANT_TRUE);
2086
2087 V_VT(&v) = VT_I4;
2088 V_I4(&v) = 0;
2090 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2091
2092 test_elem_disabled(elem, VARIANT_FALSE);
2093
2094 V_VT(&v) = VT_I4;
2095 V_I4(&v) = 1;
2097 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2098
2099 test_elem_disabled(elem, VARIANT_TRUE);
2100
2101 IHTMLElement_Release(elem);
2102 IDispatchEx_Release(dispex);
2103}
2104
2105static void test_ui(void)
2106{
2107 IActiveScriptSiteUIControl *ui_control;
2109 HRESULT hres;
2110
2111 hres = IActiveScriptSite_QueryInterface(site, &IID_IActiveScriptSiteUIControl, (void**)&ui_control);
2112 if(hres == E_NOINTERFACE) {
2113 win_skip("IActiveScriptSiteUIControl not supported\n");
2114 return;
2115 }
2116 ok(hres == S_OK, "Could not get IActiveScriptSiteUIControl: %08x\n", hres);
2117
2118 hres = IActiveScriptSiteUIControl_GetUIBehavior(ui_control, SCRIPTUICITEM_MSGBOX, &uic_handling);
2119 ok(hres == S_OK, "GetUIBehavior failed: %08x\n", hres);
2120 ok(uic_handling == SCRIPTUICHANDLING_ALLOW, "uic_handling = %d\n", uic_handling);
2121
2122 IActiveScriptSiteUIControl_Release(ui_control);
2123}
2124
2125static void test_sp(void)
2126{
2128 IUnknown *unk;
2129 HRESULT hres;
2130
2131 hres = IActiveScriptSite_QueryInterface(site, &IID_IServiceProvider, (void**)&sp);
2132 ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
2133
2134 hres = IServiceProvider_QueryService(sp, &SID_SContainerDispatch, &IID_IHTMLDocument, (void**)&unk);
2135 ok(hres == S_OK, "Could not get SID_SContainerDispatch service: %08x\n", hres);
2136 IUnknown_Release(unk);
2137
2138 IServiceProvider_Release(sp);
2139}
2140
2141static void test_script_run(void)
2142{
2143 IDispatchEx *document, *dispex;
2145 IOmNavigator *navigator;
2146 IUnknown *unk;
2147 VARIANT var, arg;
2148 DISPPARAMS dp;
2149 EXCEPINFO ei;
2150 DISPID id;
2151 BSTR tmp;
2152 HRESULT hres;
2153
2154 static const WCHAR documentW[] = {'d','o','c','u','m','e','n','t',0};
2155 static const WCHAR testW[] = {'t','e','s','t',0};
2156 static const WCHAR funcW[] = {'f','u','n','c',0};
2157
2158 SET_EXPECT(GetScriptDispatch);
2159
2161 hres = IDispatchEx_GetDispID(window_dispex, tmp, fdexNameCaseSensitive, &id);
2162 SysFreeString(tmp);
2163 ok(hres == S_OK, "GetDispID(document) failed: %08x\n", hres);
2164 ok(id == DISPID_IHTMLWINDOW2_DOCUMENT, "id=%x\n", id);
2165
2166 CHECK_CALLED(GetScriptDispatch);
2167
2168 VariantInit(&var);
2169 memset(&dp, 0, sizeof(dp));
2170 memset(&ei, 0, sizeof(ei));
2171
2172 hres = IDispatchEx_InvokeEx(window_dispex, id, LOCALE_NEUTRAL, INVOKE_PROPERTYGET, &dp, &var, &ei, NULL);
2173 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2174 ok(V_VT(&var) == VT_DISPATCH, "V_VT(var)=%d\n", V_VT(&var));
2175 ok(V_DISPATCH(&var) != NULL, "V_DISPATCH(&var) == NULL\n");
2176
2177 hres = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IDispatchEx, (void**)&document);
2178 VariantClear(&var);
2179 ok(hres == S_OK, "Could not get DispatchEx: %08x\n", hres);
2180
2181 tmp = SysAllocString(testW);
2182 hres = IDispatchEx_GetDispID(document, tmp, fdexNameCaseSensitive, &id);
2183 ok(hres == DISP_E_UNKNOWNNAME, "GetDispID(document) failed: %08x, expected DISP_E_UNKNOWNNAME\n", hres);
2184 hres = IDispatchEx_GetDispID(document, tmp, fdexNameCaseSensitive | fdexNameImplicit, &id);
2185 ok(hres == DISP_E_UNKNOWNNAME, "GetDispID(document) failed: %08x, expected DISP_E_UNKNOWNNAME\n", hres);
2186 SysFreeString(tmp);
2187
2188 id = 0;
2189 tmp = SysAllocString(testW);
2190 hres = IDispatchEx_GetDispID(document, tmp, fdexNameCaseSensitive|fdexNameEnsure, &id);
2191 SysFreeString(tmp);
2192 ok(hres == S_OK, "GetDispID(document) failed: %08x\n", hres);
2193 ok(id, "id == 0\n");
2194
2195 V_VT(&var) = VT_I4;
2196 V_I4(&var) = 100;
2197 hres = dispex_propput(document, id, 0, &var, NULL);
2198 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2199
2200 tmp = SysAllocString(testW);
2201 hres = IDispatchEx_GetDispID(document, tmp, fdexNameCaseSensitive, &id);
2202 SysFreeString(tmp);
2203 ok(hres == S_OK, "GetDispID(document) failed: %08x\n", hres);
2204
2205 hres = IDispatchEx_DeleteMemberByDispID(document, id);
2206 ok(hres == E_NOTIMPL, "DeleteMemberByDispID failed = %08x\n", hres);
2207
2208 VariantInit(&var);
2209 memset(&dp, 0, sizeof(dp));
2210 memset(&ei, 0, sizeof(ei));
2211 hres = IDispatchEx_InvokeEx(document, id, LOCALE_NEUTRAL, INVOKE_PROPERTYGET, &dp, &var, &ei, NULL);
2212 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2213 ok(V_VT(&var) == VT_I4, "V_VT(var)=%d\n", V_VT(&var));
2214 ok(V_I4(&var) == 100, "V_I4(&var) = %d\n", V_I4(&var));
2215
2216 V_VT(&var) = VT_I4;
2217 V_I4(&var) = 200;
2219 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2220
2221 VariantInit(&var);
2222 memset(&dp, 0, sizeof(dp));
2223 memset(&ei, 0, sizeof(ei));
2224 hres = IDispatchEx_InvokeEx(document, id, LOCALE_NEUTRAL, INVOKE_PROPERTYGET, &dp, &var, &ei, NULL);
2225 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2226 ok(V_VT(&var) == VT_I4, "V_VT(var)=%d\n", V_VT(&var));
2227 ok(V_I4(&var) == 200, "V_I4(&var) = %d\n", V_I4(&var));
2228
2229 memset(&dp, 0, sizeof(dp));
2230 memset(&ei, 0, sizeof(ei));
2231 V_VT(&var) = VT_I4;
2232 V_I4(&var) = 300;
2233 dp.cArgs = 1;
2234 dp.rgvarg = &var;
2235 hres = IDispatchEx_InvokeEx(document, id, LOCALE_NEUTRAL, INVOKE_PROPERTYPUT, &dp, NULL, &ei, NULL);
2236 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2237
2238 VariantInit(&var);
2239 memset(&dp, 0, sizeof(dp));
2240 memset(&ei, 0, sizeof(ei));
2241 hres = IDispatchEx_InvokeEx(document, id, LOCALE_NEUTRAL, INVOKE_PROPERTYGET, &dp, &var, &ei, NULL);
2242 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2243 ok(V_VT(&var) == VT_I4, "V_VT(var)=%d\n", V_VT(&var));
2244 ok(V_I4(&var) == 300, "V_I4(&var) = %d\n", V_I4(&var));
2245
2246 V_VT(&var) = VT_BSTR;
2247 V_BSTR(&var) = NULL;
2248 dispex_propput(document, id, 0, &var, NULL);
2249
2250 VariantInit(&var);
2251 memset(&dp, 0, sizeof(dp));
2252 memset(&ei, 0, sizeof(ei));
2253 hres = IDispatchEx_InvokeEx(document, id, LOCALE_NEUTRAL, INVOKE_PROPERTYGET, &dp, &var, &ei, NULL);
2254 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2255 ok(V_VT(&var) == VT_BSTR, "V_VT(var)=%d\n", V_VT(&var));
2256 ok(!V_BSTR(&var), "V_BSTR(&var) = %s\n", wine_dbgstr_w(V_BSTR(&var)));
2257
2258 unk = (void*)0xdeadbeef;
2259 hres = IDispatchEx_GetNameSpaceParent(window_dispex, &unk);
2260 ok(hres == S_OK, "GetNameSpaceParent failed: %08x\n", hres);
2261 ok(!unk, "unk=%p, expected NULL\n", unk);
2262
2263 id = 0;
2264 tmp = SysAllocString(funcW);
2265 hres = IDispatchEx_GetDispID(document, tmp, fdexNameCaseSensitive|fdexNameEnsure, &id);
2266 SysFreeString(tmp);
2267 ok(hres == S_OK, "GetDispID(func) failed: %08x\n", hres);
2268 ok(id, "id == 0\n");
2269
2270 dp.cArgs = 1;
2271 dp.rgvarg = &var;
2272 dp.cNamedArgs = 0;
2273 dp.rgdispidNamedArgs = NULL;
2274 V_VT(&var) = VT_DISPATCH;
2276 hres = IDispatchEx_InvokeEx(document, id, LOCALE_NEUTRAL, INVOKE_PROPERTYPUT, &dp, NULL, &ei, NULL);
2277 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2278
2279 VariantInit(&var);
2280 memset(&dp, 0, sizeof(dp));
2281 memset(&ei, 0, sizeof(ei));
2282 V_VT(&arg) = VT_BOOL;
2283 V_BOOL(&arg) = VARIANT_TRUE;
2284 dp.cArgs = 1;
2285 dp.rgvarg = &arg;
2286
2288 hres = IDispatchEx_InvokeEx(document, id, LOCALE_NEUTRAL, INVOKE_FUNC, &dp, &var, &ei, NULL);
2290
2291 ok(hres == S_OK, "InvokeEx(INVOKE_FUNC) failed: %08x\n", hres);
2292 ok(V_VT(&var) == VT_I4, "V_VT(var)=%d\n", V_VT(&var));
2293 ok(V_I4(&var) == 100, "V_I4(&var) == NULL\n");
2294
2295 IDispatchEx_Release(document);
2296
2297 hres = IDispatchEx_QueryInterface(window_dispex, &IID_IHTMLWindow2, (void**)&window);
2298 ok(hres == S_OK, "Could not get IHTMLWindow2 iface: %08x\n", hres);
2299
2300 hres = IHTMLWindow2_get_navigator(window, &navigator);
2301 ok(hres == S_OK, "get_navigator failed: %08x\n", hres);
2302
2303 hres = IOmNavigator_QueryInterface(navigator, &IID_IDispatchEx, (void**)&dispex);
2304 IOmNavigator_Release(navigator);
2305 ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres);
2306
2307 test_func(dispex);
2308 test_nextdispid(dispex);
2309
2312 IHTMLWindow2_Release(window);
2313
2314 tmp = a2bstr("test");
2315 hres = IDispatchEx_DeleteMemberByName(dispex, tmp, fdexNameCaseSensitive);
2316 ok(hres == E_NOTIMPL, "DeleteMemberByName failed: %08x\n", hres);
2317
2318 IDispatchEx_Release(dispex);
2319
2321
2322 SET_EXPECT(GetScriptDispatch);
2323 SET_EXPECT(script_testprop_d);
2324 tmp = a2bstr("testProp");
2325 hres = IDispatchEx_GetDispID(window_dispex, tmp, fdexNameCaseSensitive, &id);
2326 ok(hres == S_OK, "GetDispID failed: %08x\n", hres);
2327 ok(id != DISPID_SCRIPT_TESTPROP, "id == DISPID_SCRIPT_TESTPROP\n");
2328 CHECK_CALLED(GetScriptDispatch);
2329 CHECK_CALLED(script_testprop_d);
2330 SysFreeString(tmp);
2331
2332 tmp = a2bstr("testProp");
2333 hres = IDispatchEx_GetDispID(window_dispex, tmp, fdexNameCaseSensitive, &id);
2334 ok(hres == S_OK, "GetDispID failed: %08x\n", hres);
2335 ok(id != DISPID_SCRIPT_TESTPROP, "id == DISPID_SCRIPT_TESTPROP\n");
2336 SysFreeString(tmp);
2337
2338 SET_EXPECT(GetScriptDispatch);
2339 SET_EXPECT(script_testprop_i);
2340 memset(&ei, 0, sizeof(ei));
2341 memset(&dp, 0, sizeof(dp));
2342 hres = IDispatchEx_InvokeEx(window_dispex, id, 0, DISPATCH_PROPERTYGET, &dp, &var, &ei, NULL);
2343 ok(hres == S_OK, "InvokeEx failed: %08x\n", hres);
2344 ok(V_VT(&var) == VT_NULL, "V_VT(var) = %d\n", V_VT(&var));
2345 CHECK_CALLED(GetScriptDispatch);
2346 CHECK_CALLED(script_testprop_i);
2347
2348 SET_EXPECT(GetScriptDispatch);
2349 SET_EXPECT(script_testprop2_d);
2350 tmp = a2bstr("testProp2");
2351 hres = IDispatchEx_GetDispID(window_dispex, tmp, fdexNameCaseSensitive|fdexNameEnsure, &id);
2352 ok(hres == S_OK, "GetDispID failed: %08x\n", hres);
2353 ok(id != DISPID_SCRIPT_TESTPROP2, "id == DISPID_SCRIPT_TESTPROP2\n");
2354 CHECK_CALLED(GetScriptDispatch);
2355 CHECK_CALLED(script_testprop2_d);
2356 SysFreeString(tmp);
2357
2358 tmp = a2bstr("test");
2359 hres = IDispatchEx_DeleteMemberByName(window_dispex, tmp, fdexNameCaseSensitive);
2360 ok(hres == E_NOTIMPL, "DeleteMemberByName failed: %08x\n", hres);
2361
2363
2364 test_security();
2365 test_ui();
2366 test_sp();
2367}
2368
2369static HRESULT WINAPI ActiveScriptParse_ParseScriptText(IActiveScriptParse *iface,
2370 LPCOLESTR pstrCode, LPCOLESTR pstrItemName, IUnknown *punkContext,
2371 LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLine,
2372 DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
2373{
2374 ok(pvarResult != NULL, "pvarResult == NULL\n");
2375 ok(pexcepinfo != NULL, "pexcepinfo == NULL\n");
2376
2377 if(!strcmp_wa(pstrCode, "execScript call")) {
2378 CHECK_EXPECT(ParseScriptText_execScript);
2379 ok(!pstrItemName, "pstrItemName = %s\n", wine_dbgstr_w(pstrItemName));
2380 ok(!strcmp_wa(pstrDelimiter, "\""), "pstrDelimiter = %s\n", wine_dbgstr_w(pstrDelimiter));
2381 ok(dwFlags == SCRIPTTEXT_ISVISIBLE, "dwFlags = %x\n", dwFlags);
2382
2383 V_VT(pvarResult) = VT_I4;
2384 V_I4(pvarResult) = 10;
2385 return S_OK;
2386 }else if(!strcmp_wa(pstrCode, "simple script")) {
2387 CHECK_EXPECT(ParseScriptText_script);
2388 ok(!strcmp_wa(pstrItemName, "window"), "pstrItemName = %s\n", wine_dbgstr_w(pstrItemName));
2389 ok(!strcmp_wa(pstrDelimiter, "</SCRIPT>"), "pstrDelimiter = %s\n", wine_dbgstr_w(pstrDelimiter));
2390 ok(dwFlags == (SCRIPTTEXT_ISVISIBLE|SCRIPTTEXT_HOSTMANAGESSOURCE), "dwFlags = %x\n", dwFlags);
2391
2393 return S_OK;
2394 }
2395
2396 ok(0, "unexpected script %s\n", wine_dbgstr_w(pstrCode));
2397 return E_FAIL;
2398}
2399
2407};
2408
2409static IActiveScriptParse ActiveScriptParse = { &ActiveScriptParseVtbl };
2410
2412{
2413 *ppv = NULL;
2414
2415 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IActiveScript, riid)) {
2416 *ppv = iface;
2417 return S_OK;
2418 }
2419
2420 if(IsEqualGUID(&IID_IActiveScriptParse, riid)) {
2422 return S_OK;
2423 }
2424
2425 if(IsEqualGUID(&IID_IActiveScriptParseProcedure2, riid)) {
2427 return S_OK;
2428 }
2429
2430 if(IsEqualGUID(&IID_IActiveScriptProperty, riid)) {
2432 return S_OK;
2433 }
2434
2435 if(IsEqualGUID(&IID_IObjectSafety, riid)) {
2436 *ppv = &ObjectSafety;
2437 return S_OK;
2438 }
2439
2440 if(IsEqualGUID(&IID_IActiveScriptDebug, riid))
2441 return E_NOINTERFACE;
2442
2443 trace("QI(%s)\n", wine_dbgstr_guid(riid));
2444 return E_NOINTERFACE;
2445}
2446
2448{
2449 return 2;
2450}
2451
2453{
2454 return 1;
2455}
2456
2458{
2460 IActiveScriptSiteDebug *debug;
2461 IServiceProvider *service;
2462 ICanHandleException *canexpection;
2463 LCID lcid;
2464 HRESULT hres;
2465
2466 CHECK_EXPECT(SetScriptSite);
2467
2468 ok(pass != NULL, "pass == NULL\n");
2469
2470 hres = IActiveScriptSite_QueryInterface(pass, &IID_IActiveScriptSiteInterruptPoll, (void**)&poll);
2471 ok(hres == S_OK, "Could not get IActiveScriptSiteInterruptPoll interface: %08x\n", hres);
2472 if(FAILED(hres))
2473 IActiveScriptSiteInterruptPoll_Release(poll);
2474
2475 hres = IActiveScriptSite_GetLCID(pass, &lcid);
2476 ok(hres == S_OK, "GetLCID failed: %08x\n", hres);
2477
2478 hres = IActiveScriptSite_OnStateChange(pass, (state = SCRIPTSTATE_INITIALIZED));
2479 ok(hres == S_OK, "OnStateChange failed: %08x\n", hres);
2480
2481 hres = IActiveScriptSite_QueryInterface(pass, &IID_IActiveScriptSiteDebug, (void**)&debug);
2482 ok(hres == S_OK, "Could not get IActiveScriptSiteDebug interface: %08x\n", hres);
2483 if(SUCCEEDED(hres))
2485
2486 hres = IActiveScriptSite_QueryInterface(pass, &IID_ICanHandleException, (void**)&canexpection);
2487 ok(hres == E_NOINTERFACE, "Could not get IID_ICanHandleException interface: %08x\n", hres);
2488
2489 hres = IActiveScriptSite_QueryInterface(pass, &IID_IServiceProvider, (void**)&service);
2490 ok(hres == S_OK, "Could not get IServiceProvider interface: %08x\n", hres);
2491 if(SUCCEEDED(hres))
2492 IServiceProvider_Release(service);
2493
2494 site = pass;
2495 IActiveScriptSite_AddRef(site);
2496 return S_OK;
2497}
2498
2500 void **ppvObject)
2501{
2502 ok(0, "unexpected call\n");
2503 return E_NOTIMPL;
2504}
2505
2507{
2508 HRESULT hres;
2509
2510 switch(ss) {
2512 CHECK_EXPECT(SetScriptState_STARTED);
2513 break;
2515 CHECK_EXPECT(SetScriptState_CONNECTED);
2516 break;
2518 CHECK_EXPECT(SetScriptState_DISCONNECTED);
2519 break;
2520 default:
2521 ok(0, "unexpected state %d\n", ss);
2522 return E_NOTIMPL;
2523 }
2524
2525 hres = IActiveScriptSite_OnStateChange(site, (state = ss));
2526 ok(hres == S_OK, "OnStateChange failed: %08x\n", hres);
2527
2528 return S_OK;
2529}
2530
2532{
2533 CHECK_EXPECT(GetScriptState);
2534
2535 *pssState = state;
2536 return S_OK;
2537}
2538
2540{
2542 return E_NOTIMPL;
2543}
2544
2546 LPCOLESTR pstrName, DWORD dwFlags)
2547{
2548 IDispatch *disp;
2549 IUnknown *unk = NULL, *unk2;
2550 HRESULT hres;
2551
2552 static const WCHAR windowW[] = {'w','i','n','d','o','w',0};
2553
2554 static const IID unknown_iid = {0x719C3050,0xF9D3,0x11CF,{0xA4,0x93,0x00,0x40,0x05,0x23,0xA8,0xA0}};
2555
2556 CHECK_EXPECT(AddNamedItem);
2557
2558 ok(!lstrcmpW(pstrName, windowW), "pstrName=%s\n", wine_dbgstr_w(pstrName));
2559 ok(dwFlags == (SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS), "dwFlags=%x\n", dwFlags);
2560
2561 hres = IActiveScriptSite_GetItemInfo(site, windowW, SCRIPTINFO_IUNKNOWN, &unk, NULL);
2562 ok(hres == S_OK, "GetItemInfo failed: %08x\n", hres);
2563 ok(unk != NULL, "unk == NULL\n");
2564
2565 hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&disp);
2566 ok(hres == S_OK, "Could not get IDispatch interface: %08x\n", hres);
2567 if(SUCCEEDED(hres))
2568 IDispatch_Release(disp);
2569
2570 hres = IUnknown_QueryInterface(unk, &unknown_iid, (void**)&unk2);
2571 ok(hres == E_NOINTERFACE, "Got ?? interface: %p\n", unk2);
2572 if(SUCCEEDED(hres))
2573 IUnknown_Release(unk2);
2574
2575 hres = IUnknown_QueryInterface(unk, &IID_IDispatchEx, (void**)&window_dispex);
2576 ok(hres == S_OK, "Could not get IDispatchEx interface: %08x\n", hres);
2577
2578 IUnknown_Release(unk);
2579 return S_OK;
2580}
2581
2583 DWORD dwMajor, DWORD dwMinor, DWORD dwFlags)
2584{
2585 ok(0, "unexpected call\n");
2586 return E_NOTIMPL;
2587}
2588
2589static HRESULT WINAPI ActiveScript_GetScriptDispatch(IActiveScript *iface, LPCOLESTR pstrItemName,
2590 IDispatch **ppdisp)
2591{
2592 CHECK_EXPECT(GetScriptDispatch);
2593
2594 ok(!strcmp_wa(pstrItemName, "window"), "pstrItemName = %s\n", wine_dbgstr_w(pstrItemName));
2595
2596 if(!script_disp)
2597 return E_NOTIMPL;
2598
2599 *ppdisp = script_disp;
2600 return S_OK;
2601}
2602
2604 SCRIPTTHREADID *pstridThread)
2605{
2606 ok(0, "unexpected call\n");
2607 return E_NOTIMPL;
2608}
2609
2611 DWORD dwWin32ThreadId, SCRIPTTHREADID *pstidThread)
2612{
2613 ok(0, "unexpected call\n");
2614 return E_NOTIMPL;
2615}
2616
2618 SCRIPTTHREADID stidThread, SCRIPTTHREADSTATE *pstsState)
2619{
2620 ok(0, "unexpected call\n");
2621 return E_NOTIMPL;
2622}
2623
2625 SCRIPTTHREADID stidThread, const EXCEPINFO *pexcepinfo, DWORD dwFlags)
2626{
2627 ok(0, "unexpected call\n");
2628 return E_NOTIMPL;
2629}
2630
2632{
2633 ok(0, "unexpected call\n");
2634 return E_NOTIMPL;
2635}
2636
2637static const IActiveScriptVtbl ActiveScriptVtbl = {
2654};
2655
2657
2659{
2660 *ppv = NULL;
2661
2663 *ppv = iface;
2664 return S_OK;
2665 }
2666
2667 if(IsEqualGUID(&IID_IMarshal, riid))
2668 return E_NOINTERFACE;
2670 return E_NOINTERFACE;
2671
2672 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
2673 return E_NOTIMPL;
2674}
2675
2677{
2678 return 2;
2679}
2680
2682{
2683 return 1;
2684}
2685
2687{
2688 CHECK_EXPECT(CreateInstance);
2689
2690 ok(!outer, "outer = %p\n", outer);
2691 ok(IsEqualGUID(&IID_IActiveScript, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
2692 *ppv = &ActiveScript;
2693 return S_OK;
2694}
2695
2697{
2698 ok(0, "unexpected call\n");
2699 return S_OK;
2700}
2701
2702static const IClassFactoryVtbl ClassFactoryVtbl = {
2708};
2709
2711
2712static const char simple_script_str[] =
2713 "<html><head></head><body>"
2714 "<div id=\"divid\"></div>"
2715 "<script language=\"TestScript\">simple script</script>"
2716 "</body></html>";
2717
2718static void test_exec_script(IHTMLDocument2 *doc, const char *codea, const char *langa)
2719{
2721 BSTR code, lang;
2722 VARIANT v;
2723 HRESULT hres;
2724
2725 hres = IHTMLDocument2_get_parentWindow(doc, &window);
2726 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
2727
2728 code = a2bstr(codea);
2729 lang = a2bstr(langa);
2730
2731 SET_EXPECT(ParseScriptText_execScript);
2732 hres = IHTMLWindow2_execScript(window, code, lang, &v);
2733 ok(hres == S_OK, "execScript failed: %08x\n", hres);
2734 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2735 ok(V_I4(&v) == 10, "V_I4(v) = %d\n", V_I4(&v));
2736 CHECK_CALLED(ParseScriptText_execScript);
2738
2739 lang = a2bstr("invalid");
2740 V_VT(&v) = 100;
2741 hres = IHTMLWindow2_execScript(window, code, lang, &v);
2742 ok(hres == CO_E_CLASSSTRING, "execScript failed: %08x, expected CO_E_CLASSSTRING\n", hres);
2743 ok(V_VT(&v) == 100, "V_VT(v) = %d\n", V_VT(&v));
2746
2747 IHTMLWindow2_Release(window);
2748}
2749
2750static void test_simple_script(void)
2751{
2752 IHTMLDocument2 *doc;
2753
2754 doc = create_document();
2755 if(!doc)
2756 return;
2757
2758 SET_EXPECT(CreateInstance);
2759 SET_EXPECT(GetInterfaceSafetyOptions);
2760 SET_EXPECT(SetInterfaceSafetyOptions);
2761 SET_EXPECT(SetProperty_INVOKEVERSIONING); /* IE8 */
2762 SET_EXPECT(SetProperty_HACK_TRIDENTEVENTSINK);
2763 SET_EXPECT(InitNew);
2764 SET_EXPECT(SetScriptSite);
2765 SET_EXPECT(GetScriptState);
2766 SET_EXPECT(SetScriptState_STARTED);
2767 SET_EXPECT(AddNamedItem);
2768 SET_EXPECT(SetProperty_ABBREVIATE_GLOBALNAME_RESOLUTION); /* IE8 */
2769 SET_EXPECT(ParseScriptText_script);
2770 SET_EXPECT(SetScriptState_CONNECTED);
2771
2773
2774 CHECK_CALLED(CreateInstance);
2775 CHECK_CALLED(GetInterfaceSafetyOptions);
2776 CHECK_CALLED(SetInterfaceSafetyOptions);
2777 CHECK_CALLED_BROKEN(SetProperty_INVOKEVERSIONING); /* IE8 */
2778 CHECK_CALLED(SetProperty_HACK_TRIDENTEVENTSINK);
2779 CHECK_CALLED(InitNew);
2780 CHECK_CALLED(SetScriptSite);
2781 CHECK_CALLED(GetScriptState);
2782 CHECK_CALLED(SetScriptState_STARTED);
2783 CHECK_CALLED(AddNamedItem);
2784 CHECK_CALLED_BROKEN(SetProperty_ABBREVIATE_GLOBALNAME_RESOLUTION); /* IE8 */
2785 CHECK_CALLED(ParseScriptText_script);
2786 CHECK_CALLED(SetScriptState_CONNECTED);
2787
2788 test_exec_script(doc, "execScript call", "TestScript");
2789
2790 if(site)
2791 IActiveScriptSite_Release(site);
2792 if(window_dispex)
2793 IDispatchEx_Release(window_dispex);
2794
2795 SET_EXPECT(SetScriptState_DISCONNECTED);
2797
2798 IHTMLDocument2_Release(doc);
2799
2800 CHECK_CALLED(SetScriptState_DISCONNECTED);
2802}
2803
2804static void run_js_script(const char *test_name)
2805{
2807 char urlA[INTERNET_MAX_URL_LENGTH];
2808 IPersistMoniker *persist;
2809 IHTMLDocument2 *doc;
2810 IMoniker *mon;
2811 MSG msg;
2812 HRESULT hres;
2813
2814 static const char res[] = "res://";
2815
2816 trace("running %s...\n", test_name);
2817
2818 doc = create_document();
2819 if(!doc)
2820 return;
2821
2822 set_client_site(doc, TRUE);
2824
2825 lstrcpyA(urlA, res);
2826 GetModuleFileNameA(NULL, urlA + lstrlenA(res), sizeof(urlA) - lstrlenA(res));
2827 lstrcatA(urlA, "/");
2828 lstrcatA(urlA, test_name);
2829 MultiByteToWideChar(CP_ACP, 0, urlA, -1, url, sizeof(url)/sizeof(WCHAR));
2830
2831 hres = CreateURLMoniker(NULL, url, &mon);
2832 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
2833
2834 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistMoniker, (void**)&persist);
2835 ok(hres == S_OK, "Could not get IPersistMoniker iface: %08x\n", hres);
2836
2837 hres = IPersistMoniker_Load(persist, FALSE, mon, NULL, 0);
2838 ok(hres == S_OK, "Load failed: %08x\n", hres);
2839
2840 IMoniker_Release(mon);
2841 IPersistMoniker_Release(persist);
2842
2843 SET_EXPECT(external_success);
2844
2845 while(!called_external_success && GetMessageW(&msg, NULL, 0, 0)) {
2848 }
2849
2850 CHECK_CALLED(external_success);
2851
2852 set_client_site(doc, FALSE);
2853 IHTMLDocument2_Release(doc);
2854}
2855
2856static void run_js_tests(void)
2857{
2858 run_js_script("jstest.html");
2859 run_js_script("exectest.html");
2860 run_js_script("vbtest.html");
2861 run_js_script("events.html");
2862 if(is_ie9plus)
2863 run_js_script("nav_test.html");
2864 else
2865 win_skip("Skipping nav_test.html on IE older than 9 (for broken ieframe onload).\n");
2866}
2867
2869{
2870 return init_key("TestScript\\CLSID", TESTSCRIPT_CLSID, init)
2871 && init_key("CLSID\\"TESTSCRIPT_CLSID"\\Implemented Categories\\{F0B7A1A1-9847-11CF-8F20-00805F2CD064}",
2872 NULL, init)
2873 && init_key("CLSID\\"TESTSCRIPT_CLSID"\\Implemented Categories\\{F0B7A1A2-9847-11CF-8F20-00805F2CD064}",
2874 NULL, init);
2875}
2876
2878{
2879 DWORD regid;
2880 HRESULT hres;
2881
2882 if(!init_registry(TRUE)) {
2884 return FALSE;
2885 }
2886
2888 CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &regid);
2889 ok(hres == S_OK, "Could not register script engine: %08x\n", hres);
2890
2891 return TRUE;
2892}
2893
2895{
2896 return DefWindowProcA(hwnd, msg, wParam, lParam);
2897}
2898
2900{
2901 static const CHAR szHTMLDocumentTest[] = "HTMLDocumentTest";
2902 static WNDCLASSEXA wndclass = {
2903 sizeof(WNDCLASSEXA),
2904 0,
2905 wnd_proc,
2906 0, 0, NULL, NULL, NULL, NULL, NULL,
2907 szHTMLDocumentTest,
2908 NULL
2909 };
2910
2911 RegisterClassExA(&wndclass);
2912 return CreateWindowA(szHTMLDocumentTest, szHTMLDocumentTest,
2914 300, 300, NULL, NULL, NULL, NULL);
2915}
2916
2917static BOOL check_ie(void)
2918{
2919 IHTMLDocument2 *doc;
2920 IHTMLDocument5 *doc5;
2921 IHTMLDocument7 *doc7;
2922 HRESULT hres;
2923
2924 doc = create_document();
2925 if(!doc)
2926 return FALSE;
2927
2928 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument7, (void**)&doc7);
2929 if(SUCCEEDED(hres)) {
2930 is_ie9plus = TRUE;
2931 IHTMLDocument7_Release(doc7);
2932 }
2933
2934 trace("is_ie9plus %x\n", is_ie9plus);
2935
2936 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2937 if(SUCCEEDED(hres))
2938 IHTMLDocument5_Release(doc5);
2939
2940 IHTMLDocument2_Release(doc);
2941 return SUCCEEDED(hres);
2942}
2943
2945{
2948
2949 if(check_ie()) {
2954 }else {
2955 skip("Could not register TestScript engine\n");
2956 }
2957 run_js_tests();
2958 }else {
2959 skip("IE running in Enhanced Security Configuration\n");
2960 }
2961 }else {
2962 win_skip("Too old IE.\n");
2963 }
2964
2967}
#define broken(x)
Definition: _sntprintf.h:21
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
enum tagSCRIPTUICHANDLING SCRIPTUICHANDLING
enum tagSCRIPTTHREADSTATE SCRIPTTHREADSTATE
@ SCRIPTUICITEM_MSGBOX
Definition: activscp.idl:72
DWORD SCRIPTTHREADID
Definition: activscp.idl:86
@ SCRIPTUICHANDLING_ALLOW
Definition: activscp.idl:76
@ SCRIPTSTATE_INITIALIZED
Definition: activscp.idl:62
@ SCRIPTSTATE_DISCONNECTED
Definition: activscp.idl:60
@ SCRIPTSTATE_STARTED
Definition: activscp.idl:58
@ SCRIPTSTATE_CONNECTED
Definition: activscp.idl:59
enum tagSCRIPTSTATE SCRIPTSTATE
static int state
Definition: maze.c:121
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
#define msg(x)
Definition: auth_time.c:54
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define RegCloseKey(hKey)
Definition: registry.h:49
const CLSID CLSID_IdentityUnmarshal
Definition: _set.h:50
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegCreateKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1179
LONG WINAPI RegSetValueA(HKEY hKeyOriginal, LPCSTR lpSubKey, DWORD dwType, LPCSTR lpData, DWORD cbData)
Definition: reg.c:4983
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1224
#define CP_ACP
Definition: compat.h:109
WCHAR OLECHAR
Definition: compat.h:2292
OLECHAR * BSTR
Definition: compat.h:2293
unsigned short VARTYPE
Definition: compat.h:2254
#define WideCharToMultiByte
Definition: compat.h:111
short VARIANT_BOOL
Definition: compat.h:2290
#define MultiByteToWideChar
Definition: compat.h:110
@ VT_BSTR
Definition: compat.h:2303
@ VT_NULL
Definition: compat.h:2296
@ VT_BYREF
Definition: compat.h:2342
@ VT_VARIANT
Definition: compat.h:2307
@ VT_I4
Definition: compat.h:2298
@ VT_BOOL
Definition: compat.h:2306
@ VT_EMPTY
Definition: compat.h:2295
@ VT_DISPATCH
Definition: compat.h:2304
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
static const WCHAR windowW[]
Definition: script.c:48
static const WCHAR documentW[]
Definition: script.c:47
#define CTXARG_T
Definition: script.c:36
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:86
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2897
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1418
#define regid
Definition: ecma_167.h:64
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
WDF_INTERRUPT_POLICY policy
const GLdouble * v
Definition: gl.h:2040
GLuint res
Definition: glext.h:9613
GLenum src
Definition: glext.h:6340
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLenum dst
Definition: glext.h:6340
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
GLuint id
Definition: glext.h:5910
const GLfloat * m
Definition: glext.h:10848
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define ss
Definition: i386-dis.c:441
#define cs
Definition: i386-dis.c:442
#define DISPID_READYSTATE
Definition: idispids.h:22
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
static const WCHAR testW[]
Definition: jsregexp.c:44
#define b
Definition: ke_i.h:79
#define wine_dbgstr_w
Definition: kernel32.h:34
#define debug(msg)
Definition: key_call.c:71
#define REG_SZ
Definition: layer.c:22
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
POINT cp
Definition: magnifier.c:59
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const WCHAR url[]
Definition: encode.c:1432
const char * var
Definition: shader.c:5666
HRESULT hres
Definition: protocol.c:465
static const char * test_name
Definition: run.c:177
static const char * strw(LPCWSTR x)
Definition: actctx.c:49
static IHTMLWindow2 * window
Definition: events.c:77
static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
Definition: script.c:312
static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
Definition: script.c:884
static void test_sp(void)
Definition: script.c:2125
static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl
Definition: script.c:812
#define SET_EXPECT(func)
Definition: script.c:48
static void test_arg_conv(IHTMLWindow2 *window)
Definition: script.c:2005
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
Definition: script.c:2686
static const char simple_script_str[]
Definition: script.c:2712
static void test_security_reg(IInternetHostSecurityManager *sec_mgr, DWORD policy_caller, DWORD policy_load)
Definition: script.c:1466
static BOOL ax_objsafe
Definition: script.c:143
static const IOleInPlaceFrameVtbl InPlaceFrameVtbl
Definition: script.c:919
static const GUID CLSID_TestActiveX
Definition: script.c:134
static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
Definition: script.c:749
static IOleDocumentSite DocumentSite
Definition: script.c:1166
static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
Definition: script.c:243
static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSite *iface, LPCRECT lprcPosRect)
Definition: script.c:1026
#define CLEAR_CALLED(func)
Definition: script.c:81
static HRESULT WINAPI ActiveScript_GetScriptThreadID(IActiveScript *iface, DWORD dwWin32ThreadId, SCRIPTTHREADID *pstidThread)
Definition: script.c:2610
static void test_default_arg_conv(IHTMLWindow2 *window)
Definition: script.c:2059
static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID, IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget, IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
Definition: script.c:732
static HRESULT WINAPI AXObjectSafety_QueryInterface(IObjectSafety *iface, REFIID riid, void **ppv)
Definition: script.c:1358
static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
Definition: script.c:739
static void test_security(void)
Definition: script.c:1528
static IServiceProvider caller_sp
Definition: script.c:346
static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
Definition: script.c:1096
static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
Definition: script.c:908
static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
Definition: script.c:721
static void test_nextdispid(IDispatchEx *dispex)
Definition: script.c:1939
static BOOL skip_loadobject_tests
Definition: script.c:147
static ULONG WINAPI ActiveScript_Release(IActiveScript *iface)
Definition: script.c:2452
static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
Definition: script.c:1126
static ULONG WINAPI ActiveScriptProperty_Release(IActiveScriptProperty *iface)
Definition: script.c:1733
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
Definition: script.c:2696
static HRESULT WINAPI externalDisp_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: script.c:561
static HRESULT WINAPI ActiveScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE ss)
Definition: script.c:2506
static const IOleDocumentSiteVtbl DocumentSiteVtbl
Definition: script.c:1159
static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSite *iface)
Definition: script.c:944
static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
Definition: script.c:307
static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
Definition: script.c:744
static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO, IDataObject **ppPORet)
Definition: script.c:800
#define DISPID_SCRIPT_TESTPROP
Definition: script.c:123
static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
Definition: script.c:217
static const IActiveScriptParseVtbl ActiveScriptParseVtbl
Definition: script.c:2400
static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
Definition: script.c:716
static const GUID CLSID_TestScript
Definition: script.c:132
static IOleInPlaceFrame InPlaceFrame
Definition: script.c:937
static const IOleInPlaceSiteVtbl InPlaceSiteVtbl
Definition: script.c:1031
static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSite *iface, BOOL fUndoable)
Definition: script.c:1006
static IOleClientSite ClientSite
Definition: script.c:1114
static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSite *iface)
Definition: script.c:966
static HRESULT WINAPI ActiveScript_GetScriptDispatch(IActiveScript *iface, LPCOLESTR pstrItemName, IDispatch **ppdisp)
Definition: script.c:2589
#define DISPID_EXTERNAL_TODO_WINE_OK
Definition: script.c:129
static const IClassFactoryVtbl ClassFactoryVtbl
Definition: script.c:2702
static ULONG WINAPI ActiveScriptParseProcedure_AddRef(IActiveScriptParseProcedure2 *iface)
Definition: script.c:1794
static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
Definition: script.c:851
static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
Definition: script.c:1084
static HRESULT WINAPI ActiveScriptProperty_SetProperty(IActiveScriptProperty *iface, DWORD dwProperty, VARIANT *pvarIndex, VARIANT *pvarValue)
Definition: script.c:1745
#define DISPID_SCRIPT_TESTPROP2
Definition: script.c:124
#define TESTSCRIPT_CLSID
Definition: script.c:120
static HRESULT WINAPI ActiveScriptParse_AddScriptlet(IActiveScriptParse *iface, LPCOLESTR pstrDefaultName, LPCOLESTR pstrCode, LPCOLESTR pstrItemName, LPCOLESTR pstrSubItemName, LPCOLESTR pstrEventName, LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags, BSTR *pbstrName, EXCEPINFO *pexcepinfo)
Definition: script.c:1845
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
Definition: script.c:413
static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
Definition: script.c:1056
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
Definition: script.c:367
static ULONG WINAPI ObjectSafety_AddRef(IObjectSafety *iface)
Definition: script.c:1308
static const IActiveScriptPropertyVtbl ActiveScriptPropertyVtbl
Definition: script.c:1777
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: script.c:385
static BOOL is_ie9plus
Definition: script.c:137
static BOOL init_registry(BOOL init)
Definition: script.c:2868
static BOOL set_safe_reg(BOOL safe_call, BOOL safe_data)
Definition: script.c:1449
static IActiveScriptProperty ActiveScriptProperty
Definition: script.c:1785
#define IActiveScriptParseProcedure2Vtbl
Definition: script.c:40
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
Definition: script.c:407
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
Definition: script.c:431
static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: script.c:2894
static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
Definition: script.c:764
static HRESULT ax_setopt_disp_data_hres
Definition: script.c:146
static HRESULT WINAPI ActiveScriptParseProcedure_ParseProcedureText(IActiveScriptParseProcedure2 *iface, LPCOLESTR pstrCode, LPCOLESTR pstrFormalParams, LPCOLESTR pstrProcedureName, LPCOLESTR pstrItemName, IUnknown *punkContext, LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags, IDispatch **ppdisp)
Definition: script.c:1804
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: script.c:437
static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
Definition: script.c:861
static HRESULT QueryInterface(REFIID, void **)
Definition: script.c:1168
#define test_elem_disabled(a, b)
Definition: script.c:2042
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: script.c:393
static HRESULT WINAPI ObjectSafety_QueryInterface(IObjectSafety *iface, REFIID riid, void **ppv)
Definition: script.c:1301
static HRESULT WINAPI ActiveScript_GetCurrentScriptThreadID(IActiveScript *iface, SCRIPTTHREADID *pstridThread)
Definition: script.c:2603
static HRESULT WINAPI scriptDisp_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: script.c:487
static HRESULT WINAPI scriptDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: script.c:513
#define CHECK_EXPECT(func)
Definition: script.c:57
static HRESULT ax_setopt_disp_caller_hres
Definition: script.c:146
static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSite *iface)
Definition: script.c:971
static void load_doc(IHTMLDocument2 *doc, const char *str)
Definition: script.c:1272
static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
Definition: script.c:207
static HRESULT ax_getopt_hres
Definition: script.c:145
void(* domtest_t)(IHTMLDocument2 *)
Definition: script.c:1270
static BOOL check_ie(void)
Definition: script.c:2917
static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
Definition: script.c:846
static void run_js_script(const char *test_name)
Definition: script.c:2804
static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSite *iface, BOOL fEnterMode)
Definition: script.c:960
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: script.c:2681
#define DEFINE_EXPECT(func)
Definition: script.c:45
static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
Definition: script.c:1061
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
Definition: script.c:419
static void test_simple_script(void)
Definition: script.c:2750
static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg, const GUID *pguidCmdGroup, DWORD nCmdID)
Definition: script.c:770
static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
Definition: script.c:788
static HRESULT WINAPI funcDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: script.c:443
static IDispatchEx externalDisp
Definition: script.c:702
static HRESULT WINAPI ActiveScriptParse_InitNew(IActiveScriptParse *iface)
Definition: script.c:1839
static ULONG WINAPI ActiveScript_AddRef(IActiveScript *iface)
Definition: script.c:2447
static HRESULT WINAPI ActiveScriptParse_ParseScriptText(IActiveScriptParse *iface, LPCOLESTR pstrCode, LPCOLESTR pstrItemName, IUnknown *punkContext, LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLine, DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
Definition: script.c:2369
static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
Definition: script.c:711
static BSTR a2bstr(const char *str)
Definition: script.c:159
static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface, IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
Definition: script.c:878
#define DISPID_EXTERNAL_REPORTSUCCESS
Definition: script.c:128
static const IObjectSafetyVtbl ObjectSafetyVtbl
Definition: script.c:1348
static void test_func(IDispatchEx *obj)
Definition: script.c:1872
static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
Definition: script.c:1121
static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
Definition: script.c:856
#define IActiveScriptSiteDebug_Release
Definition: script.c:41
#define IActiveScriptParseVtbl
Definition: script.c:39
static HRESULT WINAPI VariantChangeType_ChangeType(IVariantChangeType *iface, VARIANT *dst, VARIANT *src, LCID lcid, VARTYPE vt)
Definition: script.c:270
static int strcmp_wa(LPCWSTR strw, const char *stra)
Definition: script.c:152
static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate, OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
Definition: script.c:794
static IDispatchEx * window_dispex
Definition: script.c:140
static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
Definition: script.c:237
static IObjectSafety ObjectSafety
Definition: script.c:1356
static HRESULT WINAPI AXObjectSafety_SetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
Definition: script.c:1396
static ULONG WINAPI ActiveScriptParse_AddRef(IActiveScriptParse *iface)
Definition: script.c:1829
static const IVariantChangeTypeVtbl VariantChangeTypeVtbl
Definition: script.c:287
static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSite *iface)
Definition: script.c:976
static IActiveScriptParse ActiveScriptParse
Definition: script.c:2409
static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
Definition: script.c:1116
#define TESTACTIVEX_CLSID
Definition: script.c:121
static BOOL init_key(const char *key_name, const char *def_value, BOOL init)
Definition: script.c:174
static IHTMLDocument2 * create_document(void)
Definition: script.c:1184
static HRESULT WINAPI ActiveScript_Close(IActiveScript *iface)
Definition: script.c:2539
static HRESULT WINAPI ActiveScript_QueryInterface(IActiveScript *iface, REFIID riid, void **ppv)
Definition: script.c:2411
static ULONG WINAPI ObjectSafety_Release(IObjectSafety *iface)
Definition: script.c:1313
#define DISPID_EXTERNAL_OK
Definition: script.c:126
static IDispatchExVtbl scriptDispVtbl
Definition: script.c:541
static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
Definition: script.c:903
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
Definition: script.c:425
static HRESULT WINAPI ActiveScriptParse_QueryInterface(IActiveScriptParse *iface, REFIID riid, void **ppv)
Definition: script.c:1822
static ULONG WINAPI VariantChangeType_Release(IVariantChangeType *iface)
Definition: script.c:265
static IDispatchExVtbl externalDispVtbl
Definition: script.c:684
#define CHECK_EXPECT2(func)
Definition: script.c:51
static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject)
Definition: script.c:890
const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY
Definition: script.c:26
static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
Definition: script.c:1066
static HRESULT dispex_propput(IDispatchEx *obj, DISPID id, DWORD flags, VARIANT *var, IServiceProvider *caller_sp)
Definition: script.c:1855
static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSite *iface, HWND *phwnd)
Definition: script.c:954
static IDispatch * script_disp
Definition: script.c:142
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
Definition: script.c:348
static HRESULT WINAPI ActiveScript_GetScriptThreadState(IActiveScript *iface, SCRIPTTHREADID stidThread, SCRIPTTHREADSTATE *pstsState)
Definition: script.c:2617
static IActiveScriptSite * site
Definition: script.c:149
static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSite *iface, IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
Definition: script.c:981
static void test_script_run(void)
Definition: script.c:2141
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: script.c:2658
static ULONG WINAPI ActiveScriptParse_Release(IActiveScriptParse *iface)
Definition: script.c:1834
static HRESULT WINAPI ActiveScript_Clone(IActiveScript *iface, IActiveScript **ppscript)
Definition: script.c:2631
static IDispatchEx scriptDisp
Definition: script.c:559
static HRESULT WINAPI ActiveScriptProperty_QueryInterface(IActiveScriptProperty *iface, REFIID riid, void **ppv)
Definition: script.c:1721
static const IActiveScriptVtbl ActiveScriptVtbl
Definition: script.c:2637
static HRESULT WINAPI AXObjectSafety_GetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
Definition: script.c:1379
static HWND container_hwnd
Definition: script.c:144
static const IActiveScriptParseProcedure2Vtbl ActiveScriptParseProcedureVtbl
Definition: script.c:1813
static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
Definition: script.c:759
static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSite *iface)
Definition: script.c:1021
static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSite *iface)
Definition: script.c:949
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
Definition: script.c:362
static IOleDocumentView * view
Definition: script.c:139
static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
Definition: script.c:212
static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSite *iface, REFIID riid, void **ppv)
Definition: script.c:939
static void do_advise(IHTMLDocument2 *doc, REFIID riid, IUnknown *unk_advise)
Definition: script.c:1215