ReactOS  0.4.14-dev-49-gfb4591c
activex.c
Go to the documentation of this file.
1 /*
2  * Copyright 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 <stdio.h>
20 
21 #define COBJMACROS
22 #define CONST_VTABLE
23 
24 #include <ole2.h>
25 #include <dispex.h>
26 #include <activscp.h>
27 #include <objsafe.h>
28 #include <urlmon.h>
29 #include <mshtmhst.h>
30 
31 #include "wine/test.h"
32 
33 #ifdef _WIN64
34 
35 #define IActiveScriptParse_QueryInterface IActiveScriptParse64_QueryInterface
36 #define IActiveScriptParse_Release IActiveScriptParse64_Release
37 #define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
38 #define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
39 #define IActiveScriptParseProcedure2_Release \
40  IActiveScriptParseProcedure2_64_Release
41 #define IActiveScriptParseProcedure2_ParseProcedureText \
42  IActiveScriptParseProcedure2_64_ParseProcedureText
43 
44 #else
45 
46 #define IActiveScriptParse_QueryInterface IActiveScriptParse32_QueryInterface
47 #define IActiveScriptParse_Release IActiveScriptParse32_Release
48 #define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
49 #define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
50 #define IActiveScriptParseProcedure2_Release \
51  IActiveScriptParseProcedure2_32_Release
52 #define IActiveScriptParseProcedure2_ParseProcedureText \
53  IActiveScriptParseProcedure2_32_ParseProcedureText
54 
55 #endif
56 
57 static const CLSID CLSID_JScript =
58  {0xf414c260,0x6ac0,0x11cf,{0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58}};
59 
60 #define DEFINE_EXPECT(func) \
61  static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
62 
63 #define SET_EXPECT(func) \
64  expect_ ## func = TRUE
65 
66 #define CHECK_EXPECT2(func) \
67  do { \
68  ok(expect_ ##func, "unexpected call " #func "\n"); \
69  called_ ## func = TRUE; \
70  }while(0)
71 
72 #define CHECK_EXPECT(func) \
73  do { \
74  CHECK_EXPECT2(func); \
75  expect_ ## func = FALSE; \
76  }while(0)
77 
78 #define CHECK_CALLED(func) \
79  do { \
80  ok(called_ ## func, "expected " #func "\n"); \
81  expect_ ## func = called_ ## func = FALSE; \
82  }while(0)
83 
84 DEFINE_EXPECT(CreateInstance);
85 DEFINE_EXPECT(ProcessUrlAction);
86 DEFINE_EXPECT(QueryCustomPolicy);
87 DEFINE_EXPECT(reportSuccess);
88 DEFINE_EXPECT(Host_QS_SecMgr);
89 DEFINE_EXPECT(Caller_QS_SecMgr);
90 DEFINE_EXPECT(QI_IObjectWithSite);
91 DEFINE_EXPECT(SetSite);
92 
93 static const WCHAR testW[] = {'t','e','s','t',0};
94 
105 
106 #define TESTOBJ_CLSID "{178fc163-f585-4e24-9c13-4bb7faf80646}"
107 
108 static const GUID CLSID_TestObj =
109  {0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x06,0x46}};
110 
111 /* Defined as extern in urlmon.idl, but not exported by uuid.lib */
113  {0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}};
114 
115 #define DISPID_TEST_REPORTSUCCESS 0x1000
116 
117 #define DISPID_GLOBAL_OK 0x2000
118 
119 static BSTR a2bstr(const char *str)
120 {
121  BSTR ret;
122  int len;
123 
124  len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
126  MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
127 
128  return ret;
129 }
130 
131 static int strcmp_wa(LPCWSTR strw, const char *stra)
132 {
133  CHAR buf[512];
134  WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), 0, 0);
135  return lstrcmpA(buf, stra);
136 }
137 
139 {
140  ok(0, "unexpected call\n");
141  return E_NOTIMPL;
142 }
143 
145 {
146  return 2;
147 }
148 
150 {
151  return 1;
152 }
153 
155 {
157  HRESULT hres;
158 
159 
160  CHECK_EXPECT(SetSite);
161  ok(pUnkSite != NULL, "pUnkSite == NULL\n");
162 
163  hres = IUnknown_QueryInterface(pUnkSite, &IID_IServiceProvider, (void**)&sp);
164  ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
165  IServiceProvider_Release(sp);
166 
167  return SetSite_hres;
168 }
169 
171 {
172  ok(0, "unexpected call\n");
173  return E_NOTIMPL;
174 }
175 
176 static const IObjectWithSiteVtbl ObjectWithSiteVtbl = {
182 };
183 
185 
187 
188 static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
189 {
190  *ppv = NULL;
191 
192  if(IsEqualGUID(riid, &IID_IUnknown)) {
193  *ppv = iface;
194  }else if(IsEqualGUID(riid, &IID_IDispatch) || IsEqualGUID(riid, &IID_IDispatchEx)) {
196  return QI_IDispatch_hres;
197  *ppv = iface;
198  }else if(IsEqualGUID(&IID_IObjectWithSite, riid)) {
199  CHECK_EXPECT(QI_IObjectWithSite);
201  }else if(IsEqualGUID(&IID_IObjectSafety, riid)) {
202  ok(0, "Unexpected IID_IObjectSafety query\n");
203  }
204 
205  return *ppv ? S_OK : E_NOINTERFACE;
206 }
207 
208 static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
209 {
210  return 2;
211 }
212 
213 static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
214 {
215  return 1;
216 }
217 
218 static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
219 {
220  ok(0, "unexpected call\n");
221  return E_NOTIMPL;
222 }
223 
224 static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
225  LCID lcid, ITypeInfo **ppTInfo)
226 {
227  ok(0, "unexpected call\n");
228  return E_NOTIMPL;
229 }
230 
231 static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
232  LPOLESTR *rgszNames, UINT cNames,
233  LCID lcid, DISPID *rgDispId)
234 {
235  ok(0, "unexpected call\n");
236  return E_NOTIMPL;
237 }
238 
239 static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
240  REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
241  VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
242 {
243  ok(0, "unexpected call\n");
244  return E_NOTIMPL;
245 }
246 
247 static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
248 {
249  ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex);
250  return E_NOTIMPL;
251 }
252 
253 static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
254 {
255  ok(0, "unexpected call\n");
256  return E_NOTIMPL;
257 }
258 
259 static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
260 {
261  ok(0, "unexpected call\n");
262  return E_NOTIMPL;
263 }
264 
265 static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
266 {
267  ok(0, "unexpected call\n");
268  return E_NOTIMPL;
269 }
270 
271 static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
272 {
273  ok(0, "unexpected call\n");
274  return E_NOTIMPL;
275 }
276 
277 static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
278 {
279  ok(0, "unexpected call\n");
280  return E_NOTIMPL;
281 }
282 
283 static HRESULT WINAPI Test_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
284 {
285  if(!strcmp_wa(bstrName, "reportSuccess")) {
286  ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex);
288  return S_OK;
289  }
290 
291  ok(0, "unexpected name %s\n", wine_dbgstr_w(bstrName));
292  return E_NOTIMPL;
293 }
294 
295 static HRESULT WINAPI Test_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
296  VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
297 {
298  switch(id) {
300  CHECK_EXPECT(reportSuccess);
301 
302  ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags);
303  ok(pdp != NULL, "pdp == NULL\n");
304  ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
305  ok(pdp->cArgs == 0, "cArgs = %d\n", pdp->cArgs);
306  ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
307  ok(!pvarRes, "pvarRes != NULL\n");
308  ok(pei != NULL, "pei == NULL\n");
309  break;
310 
311  default:
312  ok(0, "unexpected call\n");
313  return E_NOTIMPL;
314  }
315 
316  return S_OK;
317 }
318 
319 static IDispatchExVtbl testObjVtbl = {
335 };
336 
337 static IDispatchEx testObj = { &testObjVtbl };
338 
339 static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
340 {
341  if(!strcmp_wa(bstrName, "ok")) {
342  ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex);
344  return S_OK;
345  }
346 
347  ok(0, "unexpected name %s\n", wine_dbgstr_w(bstrName));
348  return E_NOTIMPL;
349 }
350 
351 static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
352  VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
353 {
354  switch(id) {
355  case DISPID_GLOBAL_OK:
356  ok(wFlags == INVOKE_FUNC || wFlags == (INVOKE_FUNC|INVOKE_PROPERTYGET), "wFlags = %x\n", wFlags);
357  ok(pdp != NULL, "pdp == NULL\n");
358  ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
359  ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
360  ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs);
361  ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
362  ok(pei != NULL, "pei == NULL\n");
363 
364  ok(V_VT(pdp->rgvarg) == VT_BSTR, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg));
365  ok(V_VT(pdp->rgvarg+1) == VT_BOOL, "V_VT(psp->rgvargs+1) = %d\n", V_VT(pdp->rgvarg));
366  ok(V_BOOL(pdp->rgvarg+1), "%s\n", wine_dbgstr_w(V_BSTR(pdp->rgvarg)));
367  break;
368 
369  default:
370  ok(0, "unexpected call\n");
371  return E_NOTIMPL;
372  }
373 
374  return S_OK;
375 }
376 
377 static IDispatchExVtbl globalObjVtbl = {
393 };
394 
395 static IDispatchEx globalObj = { &globalObjVtbl };
396 
398 {
400  *ppv = iface;
401  return S_OK;
402  }
403 
404  /* TODO: IClassFactoryEx */
405  *ppv = NULL;
406  return E_NOINTERFACE;
407 }
408 
410 {
411  return 2;
412 }
413 
415 {
416  return 1;
417 }
418 
420 {
421  CHECK_EXPECT(CreateInstance);
422 
423  ok(!outer, "outer = %p\n", outer);
424  ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
425 
427  *ppv = &testObj;
428  return CreateInstance_hres;
429 }
430 
432 {
433  ok(0, "unexpected call\n");
434  return S_OK;
435 }
436 
437 static const IClassFactoryVtbl ClassFactoryVtbl = {
443 };
444 
446 
448 {
449  ok(0, "unexpected call\n");
450  return E_NOINTERFACE;
451 }
452 
454 {
455  return 2;
456 }
457 
459 {
460  return 1;
461 }
462 
464  DWORD *pcbSecurityId, DWORD_PTR dwReserved)
465 {
466  ok(0, "unexpected call\n");
467  return E_NOTIMPL;
468 }
469 
471  BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved)
472 {
473  CHECK_EXPECT(ProcessUrlAction);
474 
475  ok(dwAction == URLACTION_ACTIVEX_RUN, "dwAction = %x\n", dwAction);
476  ok(pPolicy != NULL, "pPolicy == NULL\n");
477  ok(cbPolicy == sizeof(DWORD), "cbPolicy = %d\n", cbPolicy);
478  ok(pContext != NULL, "pContext == NULL\n");
479  ok(cbContext == sizeof(GUID), "cbContext = %d\n", cbContext);
480  ok(IsEqualGUID(pContext, &CLSID_TestObj), "pContext = %s\n", wine_dbgstr_guid((const IID*)pContext));
481  ok(!dwFlags, "dwFlags = %x\n", dwFlags);
482  ok(!dwReserved, "dwReserved = %x\n", dwReserved);
483 
485  *(DWORD*)pPolicy = ProcessUrlAction_policy;
486  return ProcessUrlAction_hres;
487 }
488 
490  BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwReserved)
491 {
492  const struct CONFIRMSAFETY *cs = (const struct CONFIRMSAFETY*)pContext;
493  DWORD *ret;
494 
495  CHECK_EXPECT(QueryCustomPolicy);
496 
497  ok(IsEqualGUID(&GUID_CUSTOM_CONFIRMOBJECTSAFETY, guidKey), "guidKey = %s\n", wine_dbgstr_guid(guidKey));
498 
499  ok(ppPolicy != NULL, "ppPolicy == NULL\n");
500  ok(pcbPolicy != NULL, "pcbPolicy == NULL\n");
501  ok(pContext != NULL, "pContext == NULL\n");
502  ok(cbContext == sizeof(struct CONFIRMSAFETY), "cbContext = %d\n", cbContext);
503  ok(!dwReserved, "dwReserved = %x\n", dwReserved);
504 
505  /* TODO: CLSID */
506  ok(cs->pUnk != NULL, "cs->pUnk == NULL\n");
507  ok(!cs->dwFlags, "dwFlags = %x\n", cs->dwFlags);
508 
510  return QueryCustomPolicy_hres;
511 
513  *ppPolicy = (BYTE*)ret;
514  *pcbPolicy = QueryCustomPolicy_psize;
516  if(QueryCustomPolicy_psize >= sizeof(DWORD))
518 
519  return QueryCustomPolicy_hres;
520 }
521 
522 static const IInternetHostSecurityManagerVtbl InternetHostSecurityManagerVtbl = {
529 };
530 
532 
534 
536 {
537  ok(0, "unexpected call\n");
538  return E_NOINTERFACE;
539 }
540 
542 {
543  return 2;
544 }
545 
547 {
548  return 1;
549 }
550 
552  REFGUID guidService, REFIID riid, void **ppv)
553 {
554  if(IsEqualGUID(&SID_GetCaller, guidService))
555  return E_NOINTERFACE;
556 
557  if(IsEqualGUID(&SID_SInternetHostSecurityManager, guidService)) {
558  if(iface == &ServiceProvider)
559  CHECK_EXPECT(Host_QS_SecMgr);
560  else
561  CHECK_EXPECT(Caller_QS_SecMgr);
562  ok(IsEqualGUID(&IID_IInternetHostSecurityManager, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
565  return QS_SecMgr_hres;
566  }
567 
568  ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService));
569  return E_NOINTERFACE;
570 }
571 
572 static IServiceProviderVtbl ServiceProviderVtbl = {
577 };
578 
581 
583 {
584  if(IsEqualGUID(&IID_IUnknown, riid)) {
585  *ppv = iface;
586  }else if(IsEqualGUID(&IID_IActiveScriptSite, riid)) {
587  *ppv = iface;
588  }else if(IsEqualGUID(&IID_IServiceProvider, riid) && AllowIServiceProvider) {
589  *ppv = &ServiceProvider;
590  }else {
591  *ppv = NULL;
592  return E_NOINTERFACE;
593  }
594 
595  IUnknown_AddRef((IUnknown*)*ppv);
596  return S_OK;
597 }
598 
600 {
601  return 2;
602 }
603 
605 {
606  return 1;
607 }
608 
610 {
611  *plcid = GetUserDefaultLCID();
612  return S_OK;
613 }
614 
616  DWORD dwReturnMask, IUnknown **ppiunkItem, ITypeInfo **ppti)
617 {
618  ok(dwReturnMask == SCRIPTINFO_IUNKNOWN, "unexpected dwReturnMask %x\n", dwReturnMask);
619  ok(!ppti, "ppti != NULL\n");
620  ok(!strcmp_wa(pstrName, "test"), "pstrName = %s\n", wine_dbgstr_w(pstrName));
621 
622  *ppiunkItem = (IUnknown*)&globalObj;
623  return S_OK;
624 }
625 
627 {
628  return E_NOTIMPL;
629 }
630 
632  const VARIANT *pvarResult, const EXCEPINFO *pexcepinfo)
633 {
634  return E_NOTIMPL;
635 }
636 
638 {
639  return E_NOTIMPL;
640 }
641 
643 {
644  return E_NOTIMPL;
645 }
646 
648 {
649  return E_NOTIMPL;
650 }
651 
653 {
654  return E_NOTIMPL;
655 }
656 
657 #undef ACTSCPSITE_THIS
658 
659 static const IActiveScriptSiteVtbl ActiveScriptSiteVtbl = {
671 };
672 
674 
675 static void set_safety_options(IUnknown *unk, BOOL use_sec_mgr)
676 {
677  IObjectSafety *safety;
678  DWORD supported, enabled, options_all, options_set;
679  HRESULT hres;
680 
681  hres = IUnknown_QueryInterface(unk, &IID_IObjectSafety, (void**)&safety);
682  ok(hres == S_OK, "Could not get IObjectSafety: %08x\n", hres);
683  if(FAILED(hres))
684  return;
685 
686  options_all = INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER;
687  if(use_sec_mgr)
688  options_set = options_all;
689  else
690  options_set = INTERFACE_USES_DISPEX;
691 
692  hres = IObjectSafety_SetInterfaceSafetyOptions(safety, &IID_IActiveScriptParse, options_all, options_set);
693  ok(hres == S_OK, "SetInterfaceSafetyOptions failed: %08x\n", hres);
694 
695  supported = enabled = 0xdeadbeef;
696  hres = IObjectSafety_GetInterfaceSafetyOptions(safety, &IID_IActiveScriptParse, &supported, &enabled);
697  ok(hres == S_OK, "GetInterfaceSafetyOptions failed: %08x\n", hres);
698  ok(supported == options_all, "supported=%x, expected %x\n", supported, options_all);
699  ok(enabled == options_set, "enabled=%x, expected %x\n", enabled, options_set);
700 
701  IObjectSafety_Release(safety);
702 }
703 
704 #define parse_script_a(p,s) _parse_script_a(__LINE__,p,s)
705 static void _parse_script_a(unsigned line, IActiveScriptParse *parser, const char *script)
706 {
707  BSTR str;
708  HRESULT hres;
709 
710  str = a2bstr(script);
713  ok_(__FILE__,line)(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
714 }
715 
716 static IActiveScriptParse *create_script(BOOL skip_tests, BOOL use_sec_mgr)
717 {
718  IActiveScriptParse *parser;
720  HRESULT hres;
721 
724  ProcessUrlAction_policy = URLPOLICY_ALLOW;
727  QueryCustomPolicy_psize = sizeof(DWORD);
728  QueryCustomPolicy_policy = URLPOLICY_ALLOW;
730  SetSite_hres = S_OK;
732 
733  hres = CoCreateInstance(&CLSID_JScript, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
734  &IID_IActiveScript, (void**)&script);
735  if(!skip_tests)
736  ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
737  if(FAILED(hres))
738  return NULL;
739 
740  if(!skip_tests)
741  set_safety_options((IUnknown*)script, use_sec_mgr);
742 
743  hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParse, (void**)&parser);
744  ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
745 
747  ok(hres == S_OK, "InitNew failed: %08x\n", hres);
748 
749  hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite);
750  ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
751 
752  hres = IActiveScript_AddNamedItem(script, testW,
753  SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS);
754  ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres);
755 
756  hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_STARTED);
757  ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
758 
759  IActiveScript_Release(script);
760 
761  if(!skip_tests) {
763  "function testException(func, type, number) {\n"
764  " try {\n"
765  " func();\n"
766  " }catch(e) {\n"
767  " ok(e.name === type, 'e.name = ' + e.name + ', expected ' + type)\n"
768  " ok(e.number === number, 'e.number = ' + e.number + ', expected ' + number);\n"
769  " return;\n"
770  " }\n"
771  " ok(false, 'exception expected');\n"
772  "}");
773  }
774 
775  return parser;
776 }
777 
778 static IDispatchEx *parse_procedure_a(IActiveScriptParse *parser, const char *src)
779 {
780  IActiveScriptParseProcedure2 *parse_proc;
781  IDispatchEx *dispex;
782  IDispatch *disp;
783  BSTR str;
784  HRESULT hres;
785 
786  hres = IActiveScriptParse_QueryInterface(parser, &IID_IActiveScriptParseProcedure2, (void**)&parse_proc);
787  ok(hres == S_OK, "Could not get IActiveScriptParseProcedure2: %08x\n", hres);
788 
789  str = a2bstr(src);
793  ok(hres == S_OK, "ParseProcedureText failed: %08x\n", hres);
794  ok(disp != NULL, "disp == NULL\n");
795 
796  hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
797  IDispatch_Release(disp);
798  ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres);
799 
800  return dispex;
801 }
802 
803 #define call_procedure(p,c) _call_procedure(__LINE__,p,c)
804 static void _call_procedure(unsigned line, IDispatchEx *proc, IServiceProvider *caller)
805 {
806  DISPPARAMS dp = {NULL,NULL,0,0};
807  EXCEPINFO ei = {0};
808  HRESULT hres;
809 
810  hres = IDispatchEx_InvokeEx(proc, DISPID_VALUE, 0, DISPATCH_METHOD, &dp, NULL, &ei, caller);
811  ok_(__FILE__,line)(hres == S_OK, "InvokeEx failed: %08x\n", hres);
812 
813 }
814 
815 static void test_ActiveXObject(void)
816 {
817  IActiveScriptParse *parser;
818  IDispatchEx *proc;
819 
821 
822  SET_EXPECT(Host_QS_SecMgr);
823  SET_EXPECT(ProcessUrlAction);
824  SET_EXPECT(CreateInstance);
825  SET_EXPECT(QueryCustomPolicy);
826  SET_EXPECT(QI_IObjectWithSite);
827  SET_EXPECT(reportSuccess);
828  parse_script_a(parser, "(new ActiveXObject('Wine.Test')).reportSuccess();");
829  CHECK_CALLED(Host_QS_SecMgr);
830  CHECK_CALLED(ProcessUrlAction);
831  CHECK_CALLED(CreateInstance);
832  CHECK_CALLED(QueryCustomPolicy);
833  CHECK_CALLED(QI_IObjectWithSite);
834  CHECK_CALLED(reportSuccess);
835 
836  proc = parse_procedure_a(parser, "(new ActiveXObject('Wine.Test')).reportSuccess();");
837 
838  SET_EXPECT(ProcessUrlAction);
839  SET_EXPECT(CreateInstance);
840  SET_EXPECT(QueryCustomPolicy);
841  SET_EXPECT(QI_IObjectWithSite);
842  SET_EXPECT(reportSuccess);
844  CHECK_CALLED(ProcessUrlAction);
845  CHECK_CALLED(CreateInstance);
846  CHECK_CALLED(QueryCustomPolicy);
847  CHECK_CALLED(QI_IObjectWithSite);
848  CHECK_CALLED(reportSuccess);
849 
850  SET_EXPECT(ProcessUrlAction);
851  SET_EXPECT(CreateInstance);
852  SET_EXPECT(QueryCustomPolicy);
853  SET_EXPECT(QI_IObjectWithSite);
854  SET_EXPECT(reportSuccess);
856  CHECK_CALLED(ProcessUrlAction);
857  CHECK_CALLED(CreateInstance);
858  CHECK_CALLED(QueryCustomPolicy);
859  CHECK_CALLED(QI_IObjectWithSite);
860  CHECK_CALLED(reportSuccess);
861 
862  IDispatchEx_Release(proc);
864 
866  proc = parse_procedure_a(parser, "(new ActiveXObject('Wine.Test')).reportSuccess();");
867 
868  SET_EXPECT(Host_QS_SecMgr);
869  SET_EXPECT(ProcessUrlAction);
870  SET_EXPECT(CreateInstance);
871  SET_EXPECT(QueryCustomPolicy);
872  SET_EXPECT(QI_IObjectWithSite);
873  SET_EXPECT(reportSuccess);
875  CHECK_CALLED(Host_QS_SecMgr);
876  CHECK_CALLED(ProcessUrlAction);
877  CHECK_CALLED(CreateInstance);
878  CHECK_CALLED(QueryCustomPolicy);
879  CHECK_CALLED(QI_IObjectWithSite);
880  CHECK_CALLED(reportSuccess);
881 
882  parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.TestABC'); }, 'Error', -2146827859);");
883 
884  IDispatchEx_Release(proc);
886 
889 
890  SET_EXPECT(Host_QS_SecMgr);
891  parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);");
892  CHECK_CALLED(Host_QS_SecMgr);
893 
895 
898 
899  SET_EXPECT(Host_QS_SecMgr);
900  SET_EXPECT(ProcessUrlAction);
901  parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);");
902  CHECK_CALLED(Host_QS_SecMgr);
903  CHECK_CALLED(ProcessUrlAction);
904 
906 
908  ProcessUrlAction_policy = URLPOLICY_DISALLOW;
909 
910  SET_EXPECT(Host_QS_SecMgr);
911  SET_EXPECT(ProcessUrlAction);
912  parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);");
913  CHECK_CALLED(Host_QS_SecMgr);
914  CHECK_CALLED(ProcessUrlAction);
915 
917 
920 
921  SET_EXPECT(Host_QS_SecMgr);
922  SET_EXPECT(ProcessUrlAction);
923  SET_EXPECT(CreateInstance);
924  parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);");
925  CHECK_CALLED(Host_QS_SecMgr);
926  CHECK_CALLED(ProcessUrlAction);
927  CHECK_CALLED(CreateInstance);
928 
930 
933 
934  SET_EXPECT(Host_QS_SecMgr);
935  SET_EXPECT(ProcessUrlAction);
936  SET_EXPECT(CreateInstance);
937  SET_EXPECT(QueryCustomPolicy);
938  parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);");
939  CHECK_CALLED(Host_QS_SecMgr);
940  CHECK_CALLED(ProcessUrlAction);
941  CHECK_CALLED(CreateInstance);
942  CHECK_CALLED(QueryCustomPolicy);
943 
945 
948 
949  SET_EXPECT(Host_QS_SecMgr);
950  SET_EXPECT(ProcessUrlAction);
951  SET_EXPECT(CreateInstance);
952  SET_EXPECT(QueryCustomPolicy);
953  SET_EXPECT(QI_IObjectWithSite);
954  SET_EXPECT(reportSuccess);
955  parse_script_a(parser, "(new ActiveXObject('Wine.Test')).reportSuccess();");
956  CHECK_CALLED(Host_QS_SecMgr);
957  CHECK_CALLED(ProcessUrlAction);
958  CHECK_CALLED(CreateInstance);
959  CHECK_CALLED(QueryCustomPolicy);
960  CHECK_CALLED(QI_IObjectWithSite);
961  CHECK_CALLED(reportSuccess);
962 
964 
966  QueryCustomPolicy_policy = URLPOLICY_DISALLOW;
967 
968  SET_EXPECT(Host_QS_SecMgr);
969  SET_EXPECT(ProcessUrlAction);
970  SET_EXPECT(CreateInstance);
971  SET_EXPECT(QueryCustomPolicy);
972  parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);");
973  CHECK_CALLED(Host_QS_SecMgr);
974  CHECK_CALLED(ProcessUrlAction);
975  CHECK_CALLED(CreateInstance);
976  CHECK_CALLED(QueryCustomPolicy);
977 
979 
980  SET_EXPECT(ProcessUrlAction);
981  SET_EXPECT(CreateInstance);
982  SET_EXPECT(QueryCustomPolicy);
983  parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);");
984  CHECK_CALLED(ProcessUrlAction);
985  CHECK_CALLED(CreateInstance);
986  CHECK_CALLED(QueryCustomPolicy);
987 
988  QueryCustomPolicy_policy = URLPOLICY_ALLOW;
990 
991  SET_EXPECT(ProcessUrlAction);
992  SET_EXPECT(CreateInstance);
993  SET_EXPECT(QueryCustomPolicy);
994  parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);");
995  CHECK_CALLED(ProcessUrlAction);
996  CHECK_CALLED(CreateInstance);
997  CHECK_CALLED(QueryCustomPolicy);
998 
1000 
1002 
1003  SET_EXPECT(CreateInstance);
1004  SET_EXPECT(QI_IObjectWithSite);
1005  SET_EXPECT(reportSuccess);
1006  parse_script_a(parser, "(new ActiveXObject('Wine.Test')).reportSuccess();");
1007  CHECK_CALLED(CreateInstance);
1008  CHECK_CALLED(QI_IObjectWithSite);
1009  CHECK_CALLED(reportSuccess);
1010 
1012 
1015 
1016  SET_EXPECT(Host_QS_SecMgr);
1017  SET_EXPECT(ProcessUrlAction);
1018  SET_EXPECT(CreateInstance);
1019  SET_EXPECT(QueryCustomPolicy);
1020  SET_EXPECT(QI_IObjectWithSite);
1021  SET_EXPECT(SetSite);
1022  SET_EXPECT(reportSuccess);
1023  parse_script_a(parser, "(new ActiveXObject('Wine.Test')).reportSuccess();");
1024  CHECK_CALLED(Host_QS_SecMgr);
1025  CHECK_CALLED(ProcessUrlAction);
1026  CHECK_CALLED(CreateInstance);
1027  CHECK_CALLED(QueryCustomPolicy);
1028  CHECK_CALLED(QI_IObjectWithSite);
1029  CHECK_CALLED(SetSite);
1030  CHECK_CALLED(reportSuccess);
1031 
1032  SetSite_hres = E_FAIL;
1033  SET_EXPECT(ProcessUrlAction);
1034  SET_EXPECT(CreateInstance);
1035  SET_EXPECT(QueryCustomPolicy);
1036  SET_EXPECT(QI_IObjectWithSite);
1037  SET_EXPECT(SetSite);
1038  parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);");
1039  CHECK_CALLED(ProcessUrlAction);
1040  CHECK_CALLED(CreateInstance);
1041  CHECK_CALLED(QueryCustomPolicy);
1042  CHECK_CALLED(QI_IObjectWithSite);
1043  CHECK_CALLED(SetSite);
1044 
1046 
1047  /* No IServiceProvider Interface */
1051 
1052  SET_EXPECT(CreateInstance);
1053  SET_EXPECT(QI_IObjectWithSite);
1054  SET_EXPECT(reportSuccess);
1055  SET_EXPECT(SetSite);
1056  parse_script_a(parser, "(new ActiveXObject('Wine.Test')).reportSuccess();");
1057  CHECK_CALLED(CreateInstance);
1058  CHECK_CALLED(QI_IObjectWithSite);
1059  CHECK_CALLED(reportSuccess);
1060  CHECK_CALLED(SetSite);
1061 
1063 
1067 
1068  parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);");
1069 
1071 }
1072 
1073 static BOOL init_key(const char *key_name, const char *def_value, BOOL init)
1074 {
1075  HKEY hkey;
1076  DWORD res;
1077 
1078  if(!init) {
1080  return TRUE;
1081  }
1082 
1084  if(res != ERROR_SUCCESS)
1085  return FALSE;
1086 
1087  if(def_value)
1088  res = RegSetValueA(hkey, NULL, REG_SZ, def_value, strlen(def_value));
1089 
1090  RegCloseKey(hkey);
1091 
1092  return res == ERROR_SUCCESS;
1093 }
1094 
1096 {
1097  return init_key("Wine.Test\\CLSID", TESTOBJ_CLSID, init);
1098 }
1099 
1101 {
1102  DWORD regid;
1103  HRESULT hres;
1104 
1105  if(!init_registry(TRUE)) {
1107  return FALSE;
1108  }
1109 
1111  CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &regid);
1112  ok(hres == S_OK, "Could not register script engine: %08x\n", hres);
1113 
1114  return TRUE;
1115 }
1116 
1117 static BOOL check_jscript(void)
1118 {
1119  IActiveScriptProperty *script_prop;
1120  IActiveScriptParse *parser;
1121  BSTR str;
1122  HRESULT hres;
1123 
1125  if(!parser)
1126  return FALSE;
1127 
1128  str = a2bstr("if(!('localeCompare' in String.prototype)) throw 1;");
1130  SysFreeString(str);
1131 
1132  if(hres == S_OK)
1133  hres = IActiveScriptParse_QueryInterface(parser, &IID_IActiveScriptProperty, (void**)&script_prop);
1135  if(hres == S_OK)
1136  IActiveScriptProperty_Release(script_prop);
1137 
1138  return hres == S_OK;
1139 }
1140 
1141 START_TEST(activex)
1142 {
1143  CoInitialize(NULL);
1144 
1145  if(check_jscript()) {
1146  if(register_activex()) {
1149  }else {
1150  skip("Could not register ActiveX object\n");
1151  }
1152  }else {
1153  win_skip("Broken engine, probably too old\n");
1154  }
1155 
1156  CoUninitialize();
1157 }
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
Definition: activex.c:259
#define IActiveScriptParse_ParseScriptText
Definition: activex.c:49
static IDispatchEx globalObj
Definition: activex.c:395
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: activex.c:409
static IObjectWithSite * object_with_site
Definition: activex.c:186
static IDispatchEx * parse_procedure_a(IActiveScriptParse *parser, const char *src)
Definition: activex.c:778
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
Definition: activex.c:271
disp
Definition: i386-dis.c:3181
#define parse_script_a(p, s)
Definition: activex.c:704
static DWORD QueryCustomPolicy_policy
Definition: activex.c:101
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown **ppiunkItem, ITypeInfo **ppti)
Definition: activex.c:615
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
#define E_NOINTERFACE
Definition: winerror.h:2364
static void _call_procedure(unsigned line, IDispatchEx *proc, IServiceProvider *caller)
Definition: activex.c:804
#define ERROR_SUCCESS
Definition: deptool.c:10
static ULONG WINAPI InternetHostSecurityManager_Release(IInternetHostSecurityManager *iface)
Definition: activex.c:458
#define WideCharToMultiByte
Definition: compat.h:101
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 HRESULT QueryCustomPolicy_hres
Definition: activex.c:99
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static HRESULT SetSite_hres
Definition: activex.c:103
static BOOL init_key(const char *key_name, const char *def_value, BOOL init)
Definition: activex.c:1073
REFIID riid
Definition: precomp.h:44
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define CP_ACP
Definition: compat.h:99
static const IObjectWithSiteVtbl ObjectWithSiteVtbl
Definition: activex.c:176
char CHAR
Definition: xmlstorage.h:175
static const GUID CLSID_TestObj
Definition: activex.c:108
REFIID LPVOID * ppv
Definition: atlbase.h:39
static const CLSID CLSID_JScript
Definition: activex.c:57
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: activex.c:397
const char * wine_dbgstr_guid(const GUID *guid)
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
static ULONG WINAPI InternetHostSecurityManager_AddRef(IInternetHostSecurityManager *iface)
Definition: activex.c:453
static HRESULT WINAPI ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID riid, void **ppv)
Definition: activex.c:138
static BOOL AllowIServiceProvider
Definition: activex.c:104
LONG WINAPI RegSetValueA(HKEY hKeyOriginal, LPCSTR lpSubKey, DWORD dwType, LPCSTR lpData, DWORD cbData)
Definition: reg.c:4968
DWORD LCID
Definition: nls.h:13
static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, REFIID riid, void **ppv)
Definition: activex.c:582
static HANDLE proc()
Definition: pdb.c:32
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:768
OLECHAR * BSTR
Definition: compat.h:1934
static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: activex.c:351
static const IInternetHostSecurityManagerVtbl InternetHostSecurityManagerVtbl
Definition: activex.c:522
static IServiceProvider caller_sp
Definition: activex.c:580
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
#define DWORD
Definition: nt_native.h:44
#define DISPID_GLOBAL_OK
Definition: activex.c:117
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY
Definition: activex.c:31
static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
Definition: activex.c:535
static IServiceProviderVtbl ServiceProviderVtbl
Definition: activex.c:572
static int init
Definition: wintirpc.c:33
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define regid
Definition: ecma_167.h:64
static HRESULT WINAPI Test_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: activex.c:295
static ULONG WINAPI ObjectWithSite_Release(IObjectWithSite *iface)
Definition: activex.c:149
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
Definition: activex.c:188
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
Definition: activex.c:265
uint32_t cs
Definition: isohybrid.c:75
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static IClassFactory activex_cf
Definition: activex.c:445
static IDispatchEx testObj
Definition: activex.c:337
static HRESULT ProcessUrlAction_hres
Definition: activex.c:96
static IDispatchExVtbl testObjVtbl
Definition: activex.c:319
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
unsigned int BOOL
Definition: ntddk_ex.h:94
static HRESULT WINAPI ActiveScriptSite_GetDocVersionString(IActiveScriptSite *iface, BSTR *pbstrVersion)
Definition: activex.c:626
static HRESULT WINAPI InternetHostSecurityManager_GetSecurityId(IInternetHostSecurityManager *iface, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
Definition: activex.c:463
#define IActiveScriptParseProcedure2_ParseProcedureText
Definition: activex.c:52
const WCHAR * str
static IObjectWithSite ObjectWithSite
Definition: activex.c:184
smooth NULL
Definition: ftsmooth.c:416
static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHostSecurityManager *iface, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwReserved)
Definition: activex.c:489
#define IActiveScriptParse_InitNew
Definition: activex.c:48
script
Definition: msipriv.h:374
Definition: parser.c:48
static IServiceProvider ServiceProvider
Definition: activex.c:533
static DWORD QueryCustomPolicy_psize
Definition: activex.c:100
static void set_safety_options(IUnknown *unk, BOOL use_sec_mgr)
Definition: activex.c:675
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
Definition: activex.c:247
static void _parse_script_a(unsigned line, IActiveScriptParse *parser, const char *script)
Definition: activex.c:705
#define DEFINE_EXPECT(func)
Definition: activex.c:60
LONG WINAPI RegCreateKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1177
#define DISPID_TEST_REPORTSUCCESS
Definition: activex.c:115
#define IActiveScriptParse_Release
Definition: activex.c:47
static const WCHAR testW[]
Definition: activex.c:93
#define IActiveScriptParse_QueryInterface
Definition: activex.c:46
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: activex.c:231
static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface)
Definition: activex.c:604
static ULONG WINAPI ActiveScriptSite_AddRef(IActiveScriptSite *iface)
Definition: activex.c:599
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
Definition: activex.c:213
HRESULT hres
Definition: protocol.c:465
static int strcmp_wa(LPCWSTR strw, const char *stra)
Definition: activex.c:131
static HRESULT QS_SecMgr_hres
Definition: activex.c:95
static HRESULT WINAPI Test_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: activex.c:283
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: activex.c:224
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static const IClassFactoryVtbl ClassFactoryVtbl
Definition: activex.c:437
const GUID IID_IUnknown
static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
Definition: activex.c:551
#define CHECK_CALLED(func)
Definition: activex.c:78
#define WINAPI
Definition: msvc.h:8
static BSTR a2bstr(const char *str)
Definition: activex.c:119
static DWORD ProcessUrlAction_policy
Definition: activex.c:97
const IID IID_IObjectWithSite
#define V_BOOL(A)
Definition: oleauto.h:224
unsigned short WORD
Definition: ntddk_ex.h:93
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: activex.c:239
static void test_ActiveXObject(void)
Definition: activex.c:815
unsigned long DWORD
Definition: ntddk_ex.h:95
static HRESULT WINAPI ActiveScriptSite_OnScriptTerminate(IActiveScriptSite *iface, const VARIANT *pvarResult, const EXCEPINFO *pexcepinfo)
Definition: activex.c:631
static IInternetHostSecurityManager InternetHostSecurityManager
Definition: activex.c:531
#define SET_EXPECT(func)
Definition: activex.c:63
static HRESULT CreateInstance_hres
Definition: activex.c:98
const GUID IID_IDispatch
int ret
static HRESULT WINAPI ActiveScriptSite_OnScriptError(IActiveScriptSite *iface, IActiveScriptError *pscripterror)
Definition: activex.c:642
static IDispatchExVtbl globalObjVtbl
Definition: activex.c:377
static HRESULT WINAPI InternetHostSecurityManager_ProcessUrlAction(IInternetHostSecurityManager *iface, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved)
Definition: activex.c:470
static HRESULT WINAPI ObjectWithSite_SetSite(IObjectWithSite *iface, IUnknown *pUnkSite)
Definition: activex.c:154
static ULONG WINAPI ObjectWithSite_AddRef(IObjectWithSite *iface)
Definition: activex.c:144
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define V_VT(A)
Definition: oleauto.h:211
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
Definition: activex.c:431
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
#define CHECK_EXPECT(func)
Definition: activex.c:72
static HRESULT WINAPI ActiveScriptSite_OnEnterScript(IActiveScriptSite *iface)
Definition: activex.c:647
GLenum src
Definition: glext.h:6340
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define V_BSTR(A)
Definition: oleauto.h:226
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 BOOL register_activex(void)
Definition: activex.c:1100
#define IActiveScriptParseProcedure2_Release
Definition: activex.c:50
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2806
struct stdole::EXCEPINFO EXCEPINFO
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
static HRESULT WINAPI ActiveScriptSite_GetLCID(IActiveScriptSite *iface, LCID *plcid)
Definition: activex.c:609
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT QI_IDispatch_hres
Definition: activex.c:102
static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
Definition: activex.c:546
SCRIPTPROP_ABBREVIATE_GLOBALNAME_RESOLUTION enum tagSCRIPTSTATE SCRIPTSTATE
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
static BOOL check_jscript(void)
Definition: activex.c:1117
unsigned int UINT
Definition: ndis.h:50
static HRESULT WINAPI InternetHostSecurityManager_QueryInterface(IInternetHostSecurityManager *iface, REFIID riid, void **ppv)
Definition: activex.c:447
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static IActiveScriptParse * create_script(BOOL skip_tests, BOOL use_sec_mgr)
Definition: activex.c:716
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
Definition: activex.c:277
static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
Definition: activex.c:218
static BOOL init_registry(BOOL init)
Definition: activex.c:1095
static HRESULT WINAPI ActiveScriptSite_OnLeaveScript(IActiveScriptSite *iface)
Definition: activex.c:652
#define MultiByteToWideChar
Definition: compat.h:100
#define skip(...)
Definition: atltest.h:64
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1897
Definition: import.c:86
START_TEST(activex)
Definition: activex.c:1141
GLuint res
Definition: glext.h:9613
struct stdole::DISPPARAMS DISPPARAMS
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: activex.c:414
unsigned int ULONG
Definition: retypes.h:1
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
Definition: activex.c:253
static const WCHAR sp[]
Definition: suminfo.c:288
static HRESULT WINAPI ActiveScriptSite_OnStateChange(IActiveScriptSite *iface, SCRIPTSTATE ssScriptState)
Definition: activex.c:637
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
static HRESULT WINAPI ObjectWithSite_GetSite(IObjectWithSite *iface, REFIID riid, void **ppvSite)
Definition: activex.c:170
static IActiveScriptSite ActiveScriptSite
Definition: activex.c:673
#define TESTOBJ_CLSID
Definition: activex.c:106
static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
Definition: activex.c:541
const GUID IID_IClassFactory
#define call_procedure(p, c)
Definition: activex.c:803
#define memset(x, y, z)
Definition: compat.h:39
static const char * strw(LPCWSTR x)
Definition: actctx.c:49
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
Definition: activex.c:419
#define win_skip
Definition: test.h:141
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
Definition: activex.c:208
static const IActiveScriptSiteVtbl ActiveScriptSiteVtbl
Definition: activex.c:659
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: activex.c:339
#define ok_(x1, x2)
Definition: atltest.h:61
#define REG_SZ
Definition: layer.c:22