ReactOS  0.4.13-dev-544-gede3fdd
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 
23 DEFINE_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 
85 DEFINE_EXPECT(CreateInstance);
86 DEFINE_EXPECT(GetInterfaceSafetyOptions);
87 DEFINE_EXPECT(SetInterfaceSafetyOptions);
88 DEFINE_EXPECT(InitNew);
90 DEFINE_EXPECT(SetProperty_HACK_TRIDENTEVENTSINK);
91 DEFINE_EXPECT(SetProperty_INVOKEVERSIONING);
92 DEFINE_EXPECT(SetProperty_ABBREVIATE_GLOBALNAME_RESOLUTION);
93 DEFINE_EXPECT(SetScriptSite);
94 DEFINE_EXPECT(GetScriptState);
95 DEFINE_EXPECT(SetScriptState_STARTED);
96 DEFINE_EXPECT(SetScriptState_CONNECTED);
97 DEFINE_EXPECT(SetScriptState_DISCONNECTED);
98 DEFINE_EXPECT(AddNamedItem);
99 DEFINE_EXPECT(ParseScriptText_script);
100 DEFINE_EXPECT(ParseScriptText_execScript);
101 DEFINE_EXPECT(GetScriptDispatch);
103 DEFINE_EXPECT(script_divid_d);
104 DEFINE_EXPECT(script_testprop_d);
105 DEFINE_EXPECT(script_testprop_i);
106 DEFINE_EXPECT(script_testprop2_d);
107 DEFINE_EXPECT(AXQueryInterface_IActiveScript);
108 DEFINE_EXPECT(AXQueryInterface_IObjectSafety);
109 DEFINE_EXPECT(AXGetInterfaceSafetyOptions);
110 DEFINE_EXPECT(AXSetInterfaceSafetyOptions_IDispatch_caller);
111 DEFINE_EXPECT(AXSetInterfaceSafetyOptions_IDispatch_data);
112 DEFINE_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller_secmgr);
113 DEFINE_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx_caller);
114 DEFINE_EXPECT(external_success);
115 DEFINE_EXPECT(QS_VariantConversion);
116 DEFINE_EXPECT(QS_IActiveScriptSite);
117 DEFINE_EXPECT(QS_GetCaller);
118 DEFINE_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 
132 static const GUID CLSID_TestScript =
133  {0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x07,0x46}};
134 static const GUID CLSID_TestActiveX =
135  {0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x06,0x46}};
136 
138 static IHTMLDocument2 *notif_doc;
140 static IDispatchEx *window_dispex;
148 
151 
152 static 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 
159 static 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);
169  MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
170 
171  return ret;
172 }
173 
174 static 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;
221  HRESULT hres;
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))
229  doc_complete = TRUE;
230 
232  }
233 
234  return S_OK;
235 }
236 
238 {
239  ok(0, "unexpected call\n");
240  return E_NOTIMPL;
241 }
242 
243 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
249 };
250 
252 
253 static HRESULT WINAPI VariantChangeType_QueryInterface(IVariantChangeType *iface, REFIID riid, void **ppv)
254 {
255  ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
256  *ppv = NULL;
257  return E_NOINTERFACE;
258 }
259 
260 static ULONG WINAPI VariantChangeType_AddRef(IVariantChangeType *iface)
261 {
262  return 2;
263 }
264 
265 static ULONG WINAPI VariantChangeType_Release(IVariantChangeType *iface)
266 {
267  return 1;
268 }
269 
270 static HRESULT WINAPI VariantChangeType_ChangeType(IVariantChangeType *iface, VARIANT *dst, VARIANT *src, LCID lcid, VARTYPE vt)
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 
287 static const IVariantChangeTypeVtbl VariantChangeTypeVtbl = {
292 };
293 
294 static IVariantChangeType VChangeType = { &VariantChangeTypeVtbl };
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 
339 static const IServiceProviderVtbl ServiceProviderVtbl = {
344 };
345 
347 
348 static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
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 
362 static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
363 {
364  return 2;
365 }
366 
367 static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
368 {
369  return 1;
370 }
371 
372 static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
373 {
374  ok(0, "unexpected call\n");
375  return E_NOTIMPL;
376 }
377 
378 static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
379  LCID lcid, ITypeInfo **ppTInfo)
380 {
381  ok(0, "unexpected call\n");
382  return E_NOTIMPL;
383 }
384 
385 static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
386  LPOLESTR *rgszNames, UINT cNames,
387  LCID lcid, DISPID *rgDispId)
388 {
389  ok(0, "unexpected call\n");
390  return E_NOTIMPL;
391 }
392 
393 static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
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 
401 static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
402 {
403  ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex);
404  return E_NOTIMPL;
405 }
406 
407 static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
408 {
409  ok(0, "unexpected call\n");
410  return E_NOTIMPL;
411 }
412 
413 static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
414 {
415  ok(0, "unexpected call\n");
416  return E_NOTIMPL;
417 }
418 
419 static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
420 {
421  ok(0, "unexpected call\n");
422  return E_NOTIMPL;
423 }
424 
425 static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
426 {
427  ok(0, "unexpected call\n");
428  return E_NOTIMPL;
429 }
430 
431 static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
432 {
433  ok(0, "unexpected call\n");
434  return E_NOTIMPL;
435 }
436 
437 static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
438 {
439  ok(0, "unexpected call\n");
440  return E_NOTIMPL;
441 }
442 
443 static 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 
467 static IDispatchExVtbl testObjVtbl = {
483 };
484 
485 static IDispatchEx funcDisp = { &testObjVtbl };
486 
487 static HRESULT WINAPI scriptDisp_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
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 
513 static 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 
541 static IDispatchExVtbl scriptDispVtbl = {
557 };
558 
559 static IDispatchEx scriptDisp = { &scriptDispVtbl };
560 
561 static HRESULT WINAPI externalDisp_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
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 
588 static 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));
657  todo_wine
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 
684 static IDispatchExVtbl externalDispVtbl = {
700 };
701 
702 static IDispatchEx externalDisp = { &externalDispVtbl };
703 
704 static 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 
727 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
728 {
729  return E_NOTIMPL;
730 }
731 
733  IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
734  IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
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 
812 static 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 
903 static 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 
919 static 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;
988  *ppDoc = (IOleInPlaceUIWindow*)&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 
1031 static 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 
1072 static 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 
1102 static 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 
1159 static 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))
1179  *ppv = &DocHostUIHandler;
1180 
1181  return *ppv ? S_OK : E_NOINTERFACE;
1182 }
1183 
1184 static 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 
1195 static void load_string(IHTMLDocument2 *doc, const char *str)
1196 {
1198  IStream *stream;
1199  HGLOBAL mem;
1200  SIZE_T len;
1201 
1202  doc_complete = FALSE;
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 
1215 static 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 
1236 static 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 
1270 typedef void (*domtest_t)(IHTMLDocument2*);
1271 
1272 static 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 
1348 static 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 
1388  if(SUCCEEDED(ax_getopt_hres)) {
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 
1415  if(IsEqualGUID(&IID_IDispatch, riid)) {
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 
1439 static const IObjectSafetyVtbl AXObjectSafetyVtbl = {
1445 };
1446 
1448 
1449 static 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)
1458 static 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 
1466 static 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 
1528 static 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 
1598  if(!skip_loadobject_tests) {
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 
1658  if(!skip_loadobject_tests) {
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 
1695  if(!skip_loadobject_tests) {
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 
1777 static const IActiveScriptPropertyVtbl ActiveScriptPropertyVtbl = {
1783 };
1784 
1786 
1787 static 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 
1794 static ULONG WINAPI ActiveScriptParseProcedure_AddRef(IActiveScriptParseProcedure2 *iface)
1795 {
1796  return 2;
1797 }
1798 
1799 static ULONG WINAPI ActiveScriptParseProcedure_Release(IActiveScriptParseProcedure2 *iface)
1800 {
1801  return 1;
1802 }
1803 
1804 static 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 
1820 static IActiveScriptParseProcedure2 ActiveScriptParseProcedure = { &ActiveScriptParseProcedureVtbl };
1821 
1822 static 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 
1829 static ULONG WINAPI ActiveScriptParse_AddRef(IActiveScriptParse *iface)
1830 {
1831  return 2;
1832 }
1833 
1834 static ULONG WINAPI ActiveScriptParse_Release(IActiveScriptParse *iface)
1835 {
1836  return 1;
1837 }
1838 
1839 static HRESULT WINAPI ActiveScriptParse_InitNew(IActiveScriptParse *iface)
1840 {
1841  CHECK_EXPECT(InitNew);
1842  return S_OK;
1843 }
1844 
1845 static 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 
1872 static void test_func(IDispatchEx *obj)
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);
1885  SysFreeString(str);
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 
1939 static 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 
1978 static 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)
2043 static 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);
2083  SysFreeString(V_BSTR(&v));
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 
2105 static 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 
2125 static 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 
2141 static 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 
2160  tmp = SysAllocString(documentW);
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;
2218  hres = dispex_propput(document, id, DISPATCH_PROPERTYPUTREF, &var, NULL);
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;
2275  V_DISPATCH(&var) = (IDispatch*)&funcDisp;
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 
2362  test_global_id();
2363 
2364  test_security();
2365  test_ui();
2366  test_sp();
2367 }
2368 
2369 static 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 
2392  test_script_run();
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 
2409 static 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)) {
2421  *ppv = &ActiveScriptParse;
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) {
2511  case SCRIPTSTATE_STARTED:
2512  CHECK_EXPECT(SetScriptState_STARTED);
2513  break;
2514  case SCRIPTSTATE_CONNECTED:
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 
2589 static 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 
2637 static 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 
2702 static const IClassFactoryVtbl ClassFactoryVtbl = {
2708 };
2709 
2711 
2712 static 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 
2718 static 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 
2750 static 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);
2796  SET_EXPECT(Close);
2797 
2798  IHTMLDocument2_Release(doc);
2799 
2800  CHECK_CALLED(SetScriptState_DISCONNECTED);
2802 }
2803 
2804 static 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 
2856 static 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 
2917 static 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 {
2946  CoInitialize(NULL);
2948 
2949  if(check_ie()) {
2951  if(register_script_engine()) {
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 
2966  CoUninitialize();
2967 }
const CLSID CLSID_IdentityUnmarshal
static IDispatchEx funcDisp
Definition: script.c:485
static ULONG WINAPI ActiveScriptProperty_Release(IActiveScriptProperty *iface)
Definition: script.c:1733
static IClassFactory script_cf
Definition: script.c:2710
#define DISPID_SCRIPT_TESTPROP2
Definition: script.c:124
static const IOleInPlaceFrameVtbl InPlaceFrameVtbl
Definition: script.c:919
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
WCHAR OLECHAR
Definition: compat.h:1933
struct _WNDCLASSEXA WNDCLASSEXA
static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
Definition: script.c:1131
static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSite *iface)
Definition: script.c:944
static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
Definition: script.c:908
static IDispatchEx scriptDisp
Definition: script.c:559
disp
Definition: i386-dis.c:3181
static HRESULT WINAPI ActiveScriptParseProcedure_QueryInterface(IActiveScriptParseProcedure2 *iface, REFIID riid, void **ppv)
Definition: script.c:1787
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
Definition: script.c:207
static IOleInPlaceSite InPlaceSite
Definition: script.c:1049
#define trace(...)
Definition: kmt_test.h:217
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
static HRESULT WINAPI ObjectSafety_QueryInterface(IObjectSafety *iface, REFIID riid, void **ppv)
Definition: script.c:1301
#define DISPID_EXTERNAL_TODO_WINE_OK
Definition: script.c:129
static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface, LPCBORDERWIDTHS pborderwidths)
Definition: script.c:872
static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate, OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
Definition: script.c:794
#define E_ACCESSDENIED
Definition: winerror.h:2849
BOOL WINAPI TranslateMessage(_In_ const MSG *)
static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
Definition: script.c:1090
static const WCHAR windowW[]
Definition: script.c:48
static HRESULT WINAPI ActiveScriptProperty_SetProperty(IActiveScriptProperty *iface, DWORD dwProperty, VARIANT *pvarIndex, VARIANT *pvarValue)
Definition: script.c:1745
static HRESULT dispex_propget(IDispatchEx *obj, DISPID id, VARIANT *res, IServiceProvider *caller_sp)
Definition: script.c:1864
#define REFIID
Definition: guiddef.h:113
#define TRUE
Definition: types.h:120
static HRESULT WINAPI ObjectSafety_SetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
Definition: script.c:1333
static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
Definition: script.c:861
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define E_NOINTERFACE
Definition: winerror.h:2364
Definition: compat.h:1939
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
static void _check_custom_policy(unsigned line, HRESULT hres, BYTE *ppolicy, DWORD policy_size, DWORD expolicy)
Definition: script.c:1458
static IDispatchExVtbl testObjVtbl
Definition: script.c:467
static BOOL init_key(const char *key_name, const char *def_value, BOOL init)
Definition: script.c:174
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define CHECK_EXPECT(func)
Definition: script.c:57
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
static const IOleDocumentSiteVtbl DocumentSiteVtbl
Definition: script.c:1159
#define ERROR_SUCCESS
Definition: deptool.c:10
static const IObjectSafetyVtbl AXObjectSafetyVtbl
Definition: script.c:1439
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: script.c:2658
#define WideCharToMultiByte
Definition: compat.h:101
static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface, LPCBORDERWIDTHS pborderwidths)
Definition: script.c:866
#define IActiveScriptSiteDebug_Release
Definition: script.c:41
Definition: scsiwmi.h:51
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
static IActiveScriptSite * site
Definition: script.c:149
static BOOL ax_objsafe
Definition: script.c:143
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: script.c:2676
#define ok_(x1, x2)
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
Definition: script.c:237
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define CHECK_EXPECT2(func)
Definition: script.c:51
static HRESULT WINAPI ActiveScript_GetScriptThreadID(IActiveScript *iface, DWORD dwWin32ThreadId, SCRIPTTHREADID *pstidThread)
Definition: script.c:2610
static IHTMLDocument2 * notif_doc
Definition: script.c:138
REFIID riid
Definition: precomp.h:44
const GUID IID_IOleInPlaceSite
static HRESULT WINAPI ActiveScript_GetScriptDispatch(IActiveScript *iface, LPCOLESTR pstrItemName, IDispatch **ppdisp)
Definition: script.c:2589
const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY
Definition: script.c:26
static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSite *iface, LPCRECT lprcPosRect)
Definition: script.c:1026
#define DISPID_EXTERNAL_OK
Definition: script.c:126
static void load_doc(IHTMLDocument2 *doc, const char *str)
Definition: script.c:1272
DEFINE_GUID(CLSID_IdentityUnmarshal, 0x0000001b, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
#define CP_ACP
Definition: compat.h:99
const GUID IID_IOleClientSite
static HRESULT WINAPI ActiveScript_GetScriptSite(IActiveScript *iface, REFIID riid, void **ppvObject)
Definition: script.c:2499
#define LOCALE_USER_DEFAULT
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static HRESULT ax_setopt_disp_data_hres
Definition: script.c:146
static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
Definition: script.c:749
static HRESULT WINAPI externalDisp_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: script.c:561
char CHAR
Definition: xmlstorage.h:175
static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
Definition: script.c:1116
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface, IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
Definition: script.c:782
static HRESULT WINAPI scriptDisp_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: script.c:487
#define test_elem_disabled(a, b)
Definition: script.c:2042
static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSite *iface, REFIID riid, void **ppv)
Definition: script.c:939
START_TEST(script)
Definition: script.c:2944
#define CLEAR_CALLED(func)
Definition: script.c:81
static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
Definition: script.c:217
static void test_security(void)
Definition: script.c:1528
static HRESULT WINAPI ActiveScript_GetScriptThreadState(IActiveScript *iface, SCRIPTTHREADID stidThread, SCRIPTTHREADSTATE *pstsState)
Definition: script.c:2617
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
Definition: script.c:419
REFIID LPVOID * ppv
Definition: atlbase.h:39
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
Definition: script.c:367
const GUID IID_IConnectionPointContainer
static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
Definition: script.c:897
#define wine_dbgstr_w
Definition: kernel32.h:34
static BOOL is_ie9plus
Definition: script.c:137
static void test_default_arg_conv(IHTMLWindow2 *window)
Definition: script.c:2059
const char * wine_dbgstr_guid(const GUID *guid)
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
Definition: script.c:401
static HRESULT WINAPI ActiveScript_Close(IActiveScript *iface)
Definition: script.c:2539
static void test_nextdispid(IDispatchEx *dispex)
Definition: script.c:1939
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
static HRESULT WINAPI ActiveScriptProperty_QueryInterface(IActiveScriptProperty *iface, REFIID riid, void **ppv)
Definition: script.c:1721
DWORD SCRIPTTHREADID
Definition: activscp.idl:74
void * arg
Definition: msvc.h:12
LONG WINAPI RegSetValueA(HKEY hKeyOriginal, LPCSTR lpSubKey, DWORD dwType, LPCSTR lpData, DWORD cbData)
Definition: reg.c:4968
#define IActiveScriptParseProcedure2Vtbl
Definition: script.c:40
DWORD LCID
Definition: nls.h:13
UINT_PTR WPARAM
Definition: windef.h:207
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: script.c:437
static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
Definition: script.c:836
OLECHAR * BSTR
Definition: compat.h:1934
static const GUID CLSID_TestScript
Definition: script.c:132
static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
Definition: script.c:1066
__IHTMLWindow2_FWD_DEFINED__ typedef interface IHTMLWindow2 IHTMLWindow2
Definition: mshtmhst.idl:64
int winetest_interactive
static const IObjectSafetyVtbl ObjectSafetyVtbl
Definition: script.c:1348
static HRESULT WINAPI ActiveScript_InterruptScriptThread(IActiveScript *iface, SCRIPTTHREADID stidThread, const EXCEPINFO *pexcepinfo, DWORD dwFlags)
Definition: script.c:2624
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:571
static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
Definition: script.c:307
static const IActiveScriptParseProcedure2Vtbl ActiveScriptParseProcedureVtbl
Definition: script.c:1813
static HRESULT ax_setopt_disp_caller_hres
Definition: script.c:146
static LPOLESTR
Definition: stg_prop.c:27
static HRESULT WINAPI ActiveScript_QueryInterface(IActiveScript *iface, REFIID riid, void **ppv)
Definition: script.c:2411
static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
Definition: script.c:1084
static HRESULT WINAPI ActiveScript_AddTypeLib(IActiveScript *iface, REFGUID rguidTypeLib, DWORD dwMajor, DWORD dwMinor, DWORD dwFlags)
Definition: script.c:2582
#define IActiveScriptParseVtbl
Definition: script.c:39
#define E_FAIL
Definition: ddrawi.h:102
static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface, REFIID riid, void **ppv)
Definition: script.c:196
BOOL WINAPI DestroyWindow(_In_ HWND)
static const IActiveScriptParseVtbl ActiveScriptParseVtbl
Definition: script.c:2400
static void test_security_reg(IInternetHostSecurityManager *sec_mgr, DWORD policy_caller, DWORD policy_load)
Definition: script.c:1466
#define DWORD
Definition: nt_native.h:44
static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
Definition: script.c:711
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: script.c:2681
short VARIANT_BOOL
Definition: compat.h:1931
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:546
& rect
Definition: startmenu.cpp:1413
static int init
Definition: wintirpc.c:33
WPARAM wParam
Definition: combotst.c:138
static IDispatch * script_disp
Definition: script.c:142
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 HRESULT WINAPI AXObjectSafety_QueryInterface(IObjectSafety *iface, REFIID riid, void **ppv)
Definition: script.c:1358
const GLfloat * m
Definition: glext.h:10848
#define CTXARG_T
Definition: script.c:38
static ULONG WINAPI ObjectSafety_Release(IObjectSafety *iface)
Definition: script.c:1313
static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSite *iface, HWND *phwnd)
Definition: script.c:954
#define V_I4(A)
Definition: oleauto.h:247
static HRESULT WINAPI ActiveScriptParse_QueryInterface(IActiveScriptParse *iface, REFIID riid, void **ppv)
Definition: script.c:1822
static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
Definition: script.c:744
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define regid
Definition: ecma_167.h:64
static ULONG WINAPI ActiveScriptParse_AddRef(IActiveScriptParse *iface)
Definition: script.c:1829
#define V_DISPATCH(A)
Definition: oleauto.h:239
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 DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg, const GUID *pguidCmdGroup, DWORD nCmdID)
Definition: script.c:770
struct container container
static IDispatchExVtbl externalDispVtbl
Definition: script.c:684
pass
Definition: typegen.h:24
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
uint32_t cs
Definition: isohybrid.c:75
static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID, IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget, IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
Definition: script.c:732
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
Definition: script.c:1056
static HRESULT WINAPI ActiveScript_GetScriptState(IActiveScript *iface, SCRIPTSTATE *pssState)
Definition: script.c:2531
static HRESULT WINAPI ActiveScript_GetCurrentScriptThreadID(IActiveScript *iface, SCRIPTTHREADID *pstridThread)
Definition: script.c:2603
static IOleDocumentView * view
Definition: script.c:139
static const GUID CLSID_TestActiveX
Definition: script.c:134
static BOOL is_ie_hardened(void)
Definition: mshtml_test.h:23
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
Definition: script.c:1079
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DISPID_IHTMLWINDOW2_DOCUMENT
Definition: mshtmdid.h:1860
static ULONG WINAPI ActiveScript_Release(IActiveScript *iface)
Definition: script.c:2452
static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
Definition: script.c:903
static IActiveScriptParse ActiveScriptParse
Definition: script.c:2409
static HRESULT WINAPI ObjectSafety_GetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
Definition: script.c:1318
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
Definition: script.c:425
static ULONG WINAPI VariantChangeType_AddRef(IVariantChangeType *iface)
Definition: script.c:260
static void test_exec_script(IHTMLDocument2 *doc, const char *codea, const char *langa)
Definition: script.c:2718
static size_t elem
Definition: string.c:68
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: script.c:385
static ULONG WINAPI ActiveScriptParseProcedure_AddRef(IActiveScriptParseProcedure2 *iface)
Definition: script.c:1794
static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
Definition: script.c:727
#define ok(value,...)
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 CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
#define V_BYREF(A)
Definition: oleauto.h:228
#define CW_USEDEFAULT
Definition: winuser.h:225
#define S_FALSE
Definition: winerror.h:2357
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: script.c:378
static void test_sp(void)
Definition: script.c:2125
const WCHAR * str
static BOOL doc_complete
Definition: script.c:141
static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: script.c:2894
static IDispatchEx * window_dispex
Definition: script.c:140
static void test_global_id(void)
Definition: script.c:1978
smooth NULL
Definition: ftsmooth.c:416
#define DEFINE_EXPECT(func)
Definition: script.c:45
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1380
static void load_string(IHTMLDocument2 *doc, const char *str)
Definition: script.c:1195
static IDispatchEx externalDisp
Definition: script.c:702
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
script
Definition: msipriv.h:374
LONG_PTR LPARAM
Definition: windef.h:208
Definition: parser.c:48
static void set_client_site(IHTMLDocument2 *doc, BOOL set)
Definition: script.c:1236
static const IVariantChangeTypeVtbl VariantChangeTypeVtbl
Definition: script.c:287
static void test_ui(void)
Definition: script.c:2105
static IOleClientSite ClientSite
Definition: script.c:1114
#define DISPID_SCRIPT_TESTPROP
Definition: script.c:123
static void _test_elem_disabled(unsigned line, IHTMLElement *elem, VARIANT_BOOL exb)
Definition: script.c:2043
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
LONG WINAPI RegCreateKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1177
static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
Definition: script.c:706
#define b
Definition: ke_i.h:79
static const char simple_script_str[]
Definition: script.c:2712
const GUID IID_IOleObject
#define DISPID_IHTMLBODYELEMENT_BGCOLOR
Definition: mshtmdid.h:2436
static const WCHAR lang[]
Definition: wbemdisp.c:287
static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
Definition: script.c:754
static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSite *iface, IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
Definition: script.c:981
static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSite *iface, BOOL fEnterMode)
Definition: script.c:960
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
static HRESULT WINAPI ActiveScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE ss)
Definition: script.c:2506
static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO, IDataObject **ppPORet)
Definition: script.c:800
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
Definition: script.c:721
static HRESULT dispex_propput(IDispatchEx *obj, DISPID id, DWORD flags, VARIANT *var, IServiceProvider *caller_sp)
Definition: script.c:1855
HRESULT hres
Definition: protocol.c:465
IID_IMsoCommandTarget(OLECMDERR_E_FIRST+4) EXTERN_C const GUID SID_SContainerDispatch
Definition: docobj.idl:420
static ULONG WINAPI ActiveScript_AddRef(IActiveScript *iface)
Definition: script.c:2447
static HRESULT WINAPI ActiveScriptParse_InitNew(IActiveScriptParse *iface)
Definition: script.c:1839
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static const IActiveScriptPropertyVtbl ActiveScriptPropertyVtbl
Definition: script.c:1777
static const WCHAR url[]
Definition: encode.c:1432
static ULONG WINAPI ActiveScriptParseProcedure_Release(IActiveScriptParseProcedure2 *iface)
Definition: script.c:1799
const GUID IID_IUnknown
static HRESULT WINAPI ActiveScript_Clone(IActiveScript *iface, IActiveScript **ppscript)
Definition: script.c:2631
static int strcmp_wa(LPCWSTR strw, const char *stra)
Definition: script.c:152
int poll(struct pollfd *ufds, int nfds, int timeout)
Definition: adnstest.c:68
#define WINAPI
Definition: msvc.h:8
enum tagSCRIPTTHREADSTATE SCRIPTTHREADSTATE
#define V_BOOL(A)
Definition: oleauto.h:224
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
static HRESULT ax_getopt_hres
Definition: script.c:145
static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
Definition: script.c:302
REFIID LPVOID DWORD dw
Definition: atlbase.h:40
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
GLbitfield flags
Definition: glext.h:7161
static const IServiceProviderVtbl ServiceProviderVtbl
Definition: script.c:339
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
Definition: script.c:2696
static IOleInPlaceFrame InPlaceFrame
Definition: script.c:937
#define DISPID_EXTERNAL_TRACE
Definition: script.c:127
const GUID IID_IDispatch
int ret
static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface, LPOLESTR *pchKey, DWORD dw)
Definition: script.c:776
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
static BOOL register_script_engine(void)
Definition: script.c:2877
#define IID_NULL
Definition: guiddef.h:93
#define todo_wine
Definition: test.h:154
Definition: parse.h:22
const GUID IID_IPersistStreamInit
static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
Definition: script.c:1121
GLuint GLuint stream
Definition: glext.h:7522
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static void do_advise(IHTMLDocument2 *doc, REFIID riid, IUnknown *unk_advise)
Definition: script.c:1215
static IVariantChangeType VChangeType
Definition: script.c:294
#define V_VT(A)
Definition: oleauto.h:211
static ULONG WINAPI VariantChangeType_Release(IVariantChangeType *iface)
Definition: script.c:265
static const WCHAR documentW[]
Definition: script.c:47
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const IClassFactoryVtbl ClassFactoryVtbl
Definition: script.c:2702
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSite *iface)
Definition: script.c:1021
REFIID LPVOID * ppvObject
Definition: precomp.h:44
static BSTR a2bstr(const char *str)
Definition: script.c:159
static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
Definition: script.c:856
static BOOL skip_loadobject_tests
Definition: script.c:147
GLenum src
Definition: glext.h:6340
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSite *iface, BOOL fUndoable)
Definition: script.c:1006
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
static IHTMLWindow2 * window
Definition: events.c:77
enum tagSCRIPTUICHANDLING SCRIPTUICHANDLING
static const IOleInPlaceSiteVtbl InPlaceSiteVtbl
Definition: script.c:1031
static BOOL init_registry(BOOL init)
Definition: script.c:2868
int code
Definition: i386-dis.c:3591
#define DISPID_EXTERNAL_BROKEN
Definition: script.c:130
static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl
Definition: script.c:812
#define V_BSTR(A)
Definition: oleauto.h:226
static IPropertyNotifySink PropertyNotifySink
Definition: script.c:251
#define DISPATCH_PROPERTYPUTREF
Definition: oleauto.h:1009
#define TESTSCRIPT_CLSID
Definition: script.c:120
#define broken(x)
Definition: _sntprintf.h:21
static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
Definition: script.c:739
static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
Definition: script.c:372
static const IOleClientSiteVtbl ClientSiteVtbl
Definition: script.c:1102
static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
Definition: script.c:846
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
static const char * test_name
Definition: run.c:166
ULONG_PTR SIZE_T
Definition: typedefs.h:78
static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSite *iface)
Definition: script.c:971
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2806
struct stdole::EXCEPINFO EXCEPINFO
static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSite *iface)
Definition: script.c:966
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define S_OK
Definition: intsafe.h:59
static void test_arg_conv(IHTMLWindow2 *window)
Definition: script.c:2005
#define DISPID_THIS
Definition: olectl.h:395
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static HRESULT WINAPI InPlaceSite_Scroll(IOleInPlaceSite *iface, SIZE scrollExtant)
Definition: script.c:1001
const GLdouble * v
Definition: gl.h:2040
static HRESULT WINAPI VariantChangeType_QueryInterface(IVariantChangeType *iface, REFIID riid, void **ppv)
Definition: script.c:253
static HRESULT WINAPI ActiveScript_AddNamedItem(IActiveScript *iface, LPCOLESTR pstrName, DWORD dwFlags)
Definition: script.c:2545
static void test_func(IDispatchEx *obj)
Definition: script.c:1872
Definition: sacdrv.h:267
static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
Definition: script.c:1061
static BOOL check_ie(void)
Definition: script.c:2917
static ULONG WINAPI ActiveScriptProperty_AddRef(IActiveScriptProperty *iface)
Definition: script.c:1728
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
static IDocHostUIHandler2 DocHostUIHandler
Definition: script.c:834
#define DISPID_IHTMLELEMENT3_DISABLED
Definition: mshtmdid.h:1488
static HRESULT WINAPI VariantChangeType_ChangeType(IVariantChangeType *iface, VARIANT *dst, VARIANT *src, LCID lcid, VARTYPE vt)
Definition: script.c:270
static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
Definition: script.c:913
#define E_NOTIMPL
Definition: ddrawi.h:99
GLenum GLenum dst
Definition: glext.h:6340
static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject)
Definition: script.c:890
unsigned short VARTYPE
Definition: compat.h:1895
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
Definition: md5.c:100
#define check_custom_policy(a, b, c, d)
Definition: script.c:1457
const GUID IID_IPropertyNotifySink
SCRIPTPROP_ABBREVIATE_GLOBALNAME_RESOLUTION enum tagSCRIPTSTATE SCRIPTSTATE
#define DISPID_READYSTATE
Definition: idispids.h:22
static IOleDocumentSite DocumentSite
Definition: script.c:1166
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
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
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static IActiveScriptProperty ActiveScriptProperty
Definition: script.c:1785
static HWND container_hwnd
Definition: script.c:144
static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
Definition: script.c:1051
#define DISPID_IHTMLBODYELEMENT_BACKGROUND
Definition: mshtmdid.h:2429
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
#define MultiByteToWideChar
Definition: compat.h:100
static HRESULT WINAPI AXObjectSafety_SetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
Definition: script.c:1396
static const IActiveScriptVtbl ActiveScriptVtbl
Definition: script.c:2637
static HRESULT WINAPI externalDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: script.c:588
static void test_script_run(void)
Definition: script.c:2141
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
Definition: script.c:2686
static SCRIPTSTATE state
Definition: script.c:150
#define skip(...)
static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
Definition: script.c:312
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1897
static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
Definition: script.c:1126
#define msg(x)
Definition: auth_time.c:54
Definition: mem.c:156
static HWND create_container_window(void)
Definition: script.c:2899
POINT cp
Definition: magnifier.c:59
Definition: name.c:36
static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSite *iface)
Definition: script.c:1011
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
Definition: script.c:413
GLuint res
Definition: glext.h:9613
struct stdole::DISPPARAMS DISPPARAMS
static BOOL set_safe_reg(BOOL safe_call, BOOL safe_data)
Definition: script.c:1449
const GUID IID_IOleWindow
#define DISPID_IOMNAVIGATOR_PLATFORM
Definition: mshtmdid.h:2005
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
static HRESULT QueryInterface(REFIID, void **)
Definition: script.c:1168
unsigned int ULONG
Definition: retypes.h:1
GLenum GLuint id
Definition: glext.h:5579
#define TESTACTIVEX_CLSID
Definition: script.c:121
static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
Definition: script.c:764
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 IDispatchExVtbl scriptDispVtbl
Definition: script.c:541
HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
Definition: umon.c:732
#define LOCALE_NEUTRAL
static SCRIPTUICHANDLING uic_handling
Definition: run.c:143
#define debug(msg)
Definition: key_call.c:71
static const WCHAR sp[]
Definition: suminfo.c:288
static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmon)
Definition: script.c:1072
static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
Definition: script.c:841
static ULONG WINAPI ActiveScriptParse_Release(IActiveScriptParse *iface)
Definition: script.c:1834
static void test_simple_script(void)
Definition: script.c:2750
#define CO_E_CLASSSTRING
Definition: winerror.h:2806
static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
Definition: script.c:788
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
static HRESULT ax_setopt_dispex_hres
Definition: script.c:145
static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
Definition: script.c:1096
#define CHECK_CALLED(func)
Definition: script.c:63
static IActiveScriptParseProcedure2 ActiveScriptParseProcedure
Definition: script.c:1820
static ULONG WINAPI ObjectSafety_AddRef(IObjectSafety *iface)
Definition: script.c:1308
static void run_js_tests(void)
Definition: script.c:2856
LONG_PTR LRESULT
Definition: windef.h:209
#define ss
Definition: i386-dis.c:432
static IObjectSafety ObjectSafety
Definition: script.c:1356
#define DISPID_EXTERNAL_REPORTSUCCESS
Definition: script.c:128
static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
Definition: script.c:759
static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
Definition: script.c:296
static HRESULT WINAPI ActiveScriptProperty_GetProperty(IActiveScriptProperty *iface, DWORD dwProperty, VARIANT *pvarIndex, VARIANT *pvarValue)
Definition: script.c:1738
static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
Definition: script.c:884
static IObjectSafety AXObjectSafety
Definition: script.c:1447
static void run_js_script(const char *test_name)
Definition: script.c:2804
const GUID IID_IClassFactory
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
Definition: _set.h:46
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
Definition: script.c:348
#define memset(x, y, z)
Definition: compat.h:39
static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
Definition: script.c:243
static const char * strw(LPCWSTR x)
Definition: actctx.c:49
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define SET_EXPECT(func)
Definition: script.c:48
static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface, IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
Definition: script.c:878
#define win_skip
Definition: test.h:141
LPARAM lParam
Definition: combotst.c:139
static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSite *iface)
Definition: script.c:949
static HRESULT WINAPI InPlaceSite_DiscardUndoState(IOleInPlaceSite *iface)
Definition: script.c:1016
static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
Definition: script.c:212
void(* domtest_t)(IHTMLDocument2 *)
Definition: script.c:1270
#define CHECK_CALLED_BROKEN(func)
Definition: script.c:69
static const WCHAR testW[]
Definition: jsregexp.c:44
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
Definition: script.c:362
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define DISPID_IOMNAVIGATOR_TOSTRING
Definition: mshtmdid.h:2000
static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface, LPOLESTR *pchKey, DWORD dw)
Definition: script.c:806