ReactOS  0.4.13-dev-479-gec9c8fd
activex.c File Reference
#include <stdio.h>
#include <ole2.h>
#include <dispex.h>
#include <activscp.h>
#include <objsafe.h>
#include <urlmon.h>
#include <mshtmhst.h>
#include "wine/test.h"
Include dependency graph for activex.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define IActiveScriptParse_QueryInterface   IActiveScriptParse32_QueryInterface
 
#define IActiveScriptParse_Release   IActiveScriptParse32_Release
 
#define IActiveScriptParse_InitNew   IActiveScriptParse32_InitNew
 
#define IActiveScriptParse_ParseScriptText   IActiveScriptParse32_ParseScriptText
 
#define IActiveScriptParseProcedure2_Release   IActiveScriptParseProcedure2_32_Release
 
#define IActiveScriptParseProcedure2_ParseProcedureText   IActiveScriptParseProcedure2_32_ParseProcedureText
 
#define DEFINE_EXPECT(func)   static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
 
#define SET_EXPECT(func)   expect_ ## func = TRUE
 
#define CHECK_EXPECT2(func)
 
#define CHECK_EXPECT(func)
 
#define CHECK_CALLED(func)
 
#define TESTOBJ_CLSID   "{178fc163-f585-4e24-9c13-4bb7faf80646}"
 
#define DISPID_TEST_REPORTSUCCESS   0x1000
 
#define DISPID_GLOBAL_OK   0x2000
 
#define parse_script_a(p, s)   _parse_script_a(__LINE__,p,s)
 
#define call_procedure(p, c)   _call_procedure(__LINE__,p,c)
 

Functions

 DEFINE_EXPECT (CreateInstance)
 
 DEFINE_EXPECT (ProcessUrlAction)
 
 DEFINE_EXPECT (QueryCustomPolicy)
 
 DEFINE_EXPECT (reportSuccess)
 
 DEFINE_EXPECT (Host_QS_SecMgr)
 
 DEFINE_EXPECT (Caller_QS_SecMgr)
 
 DEFINE_EXPECT (QI_IObjectWithSite)
 
 DEFINE_EXPECT (SetSite)
 
static BSTR a2bstr (const char *str)
 
static int strcmp_wa (LPCWSTR strw, const char *stra)
 
static HRESULT WINAPI ObjectWithSite_QueryInterface (IObjectWithSite *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ObjectWithSite_AddRef (IObjectWithSite *iface)
 
static ULONG WINAPI ObjectWithSite_Release (IObjectWithSite *iface)
 
static HRESULT WINAPI ObjectWithSite_SetSite (IObjectWithSite *iface, IUnknown *pUnkSite)
 
static HRESULT WINAPI ObjectWithSite_GetSite (IObjectWithSite *iface, REFIID riid, void **ppvSite)
 
static HRESULT WINAPI DispatchEx_QueryInterface (IDispatchEx *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI DispatchEx_AddRef (IDispatchEx *iface)
 
static ULONG WINAPI DispatchEx_Release (IDispatchEx *iface)
 
static HRESULT WINAPI DispatchEx_GetTypeInfoCount (IDispatchEx *iface, UINT *pctinfo)
 
static HRESULT WINAPI DispatchEx_GetTypeInfo (IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI DispatchEx_GetIDsOfNames (IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI DispatchEx_Invoke (IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI DispatchEx_DeleteMemberByName (IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
 
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID (IDispatchEx *iface, DISPID id)
 
static HRESULT WINAPI DispatchEx_GetMemberProperties (IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
 
static HRESULT WINAPI DispatchEx_GetMemberName (IDispatchEx *iface, DISPID id, BSTR *pbstrName)
 
static HRESULT WINAPI DispatchEx_GetNextDispID (IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
 
static HRESULT WINAPI DispatchEx_GetNameSpaceParent (IDispatchEx *iface, IUnknown **ppunk)
 
static HRESULT WINAPI Test_GetDispID (IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
 
static HRESULT WINAPI Test_InvokeEx (IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
 
static HRESULT WINAPI Global_GetDispID (IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
 
static HRESULT WINAPI Global_InvokeEx (IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
 
static HRESULT WINAPI ClassFactory_QueryInterface (IClassFactory *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ClassFactory_AddRef (IClassFactory *iface)
 
static ULONG WINAPI ClassFactory_Release (IClassFactory *iface)
 
static HRESULT WINAPI ClassFactory_CreateInstance (IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
 
static HRESULT WINAPI ClassFactory_LockServer (IClassFactory *iface, BOOL dolock)
 
static HRESULT WINAPI InternetHostSecurityManager_QueryInterface (IInternetHostSecurityManager *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI InternetHostSecurityManager_AddRef (IInternetHostSecurityManager *iface)
 
static ULONG WINAPI InternetHostSecurityManager_Release (IInternetHostSecurityManager *iface)
 
static HRESULT WINAPI InternetHostSecurityManager_GetSecurityId (IInternetHostSecurityManager *iface, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
 
static HRESULT WINAPI InternetHostSecurityManager_ProcessUrlAction (IInternetHostSecurityManager *iface, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved)
 
static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy (IInternetHostSecurityManager *iface, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwReserved)
 
static HRESULT WINAPI ServiceProvider_QueryInterface (IServiceProvider *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ServiceProvider_AddRef (IServiceProvider *iface)
 
static ULONG WINAPI ServiceProvider_Release (IServiceProvider *iface)
 
static HRESULT WINAPI ServiceProvider_QueryService (IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
 
static HRESULT WINAPI ActiveScriptSite_QueryInterface (IActiveScriptSite *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ActiveScriptSite_AddRef (IActiveScriptSite *iface)
 
static ULONG WINAPI ActiveScriptSite_Release (IActiveScriptSite *iface)
 
static HRESULT WINAPI ActiveScriptSite_GetLCID (IActiveScriptSite *iface, LCID *plcid)
 
static HRESULT WINAPI ActiveScriptSite_GetItemInfo (IActiveScriptSite *iface, LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown **ppiunkItem, ITypeInfo **ppti)
 
static HRESULT WINAPI ActiveScriptSite_GetDocVersionString (IActiveScriptSite *iface, BSTR *pbstrVersion)
 
static HRESULT WINAPI ActiveScriptSite_OnScriptTerminate (IActiveScriptSite *iface, const VARIANT *pvarResult, const EXCEPINFO *pexcepinfo)
 
static HRESULT WINAPI ActiveScriptSite_OnStateChange (IActiveScriptSite *iface, SCRIPTSTATE ssScriptState)
 
static HRESULT WINAPI ActiveScriptSite_OnScriptError (IActiveScriptSite *iface, IActiveScriptError *pscripterror)
 
static HRESULT WINAPI ActiveScriptSite_OnEnterScript (IActiveScriptSite *iface)
 
static HRESULT WINAPI ActiveScriptSite_OnLeaveScript (IActiveScriptSite *iface)
 
static void set_safety_options (IUnknown *unk, BOOL use_sec_mgr)
 
static void _parse_script_a (unsigned line, IActiveScriptParse *parser, const char *script)
 
static IActiveScriptParse * create_script (BOOL skip_tests, BOOL use_sec_mgr)
 
static IDispatchEx * parse_procedure_a (IActiveScriptParse *parser, const char *src)
 
static void _call_procedure (unsigned line, IDispatchEx *proc, IServiceProvider *caller)
 
static void test_ActiveXObject (void)
 
static BOOL init_key (const char *key_name, const char *def_value, BOOL init)
 
static BOOL init_registry (BOOL init)
 
static BOOL register_activex (void)
 
static BOOL check_jscript (void)
 
 START_TEST (activex)
 

Variables

static const CLSID CLSID_JScript
 
static const WCHAR testW [] = {'t','e','s','t',0}
 
static HRESULT QS_SecMgr_hres
 
static HRESULT ProcessUrlAction_hres
 
static DWORD ProcessUrlAction_policy
 
static HRESULT CreateInstance_hres
 
static HRESULT QueryCustomPolicy_hres
 
static DWORD QueryCustomPolicy_psize
 
static DWORD QueryCustomPolicy_policy
 
static HRESULT QI_IDispatch_hres
 
static HRESULT SetSite_hres
 
static BOOL AllowIServiceProvider
 
static const GUID CLSID_TestObj
 
const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY
 
static const IObjectWithSiteVtbl ObjectWithSiteVtbl
 
static IObjectWithSite ObjectWithSite = { &ObjectWithSiteVtbl }
 
static IObjectWithSiteobject_with_site
 
static IDispatchExVtbl testObjVtbl
 
static IDispatchEx testObj = { &testObjVtbl }
 
static IDispatchExVtbl globalObjVtbl
 
static IDispatchEx globalObj = { &globalObjVtbl }
 
static const IClassFactoryVtbl ClassFactoryVtbl
 
static IClassFactory activex_cf = { &ClassFactoryVtbl }
 
static const IInternetHostSecurityManagerVtbl InternetHostSecurityManagerVtbl
 
static IInternetHostSecurityManager InternetHostSecurityManager = { &InternetHostSecurityManagerVtbl }
 
static IServiceProvider ServiceProvider = { &ServiceProviderVtbl }
 
static IServiceProviderVtbl ServiceProviderVtbl
 
static IServiceProvider caller_sp = { &ServiceProviderVtbl }
 
static const IActiveScriptSiteVtbl ActiveScriptSiteVtbl
 
static IActiveScriptSite ActiveScriptSite = { &ActiveScriptSiteVtbl }
 

Macro Definition Documentation

◆ call_procedure

#define call_procedure (   p,
  c 
)    _call_procedure(__LINE__,p,c)

Definition at line 803 of file activex.c.

◆ CHECK_CALLED

#define CHECK_CALLED (   func)
Value:
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
GLenum func
Definition: glext.h:6028

Definition at line 78 of file activex.c.

◆ CHECK_EXPECT

#define CHECK_EXPECT (   func)
Value:
do { \
CHECK_EXPECT2(func); \
expect_ ## func = FALSE; \
}while(0)
GLenum func
Definition: glext.h:6028

Definition at line 72 of file activex.c.

◆ CHECK_EXPECT2

#define CHECK_EXPECT2 (   func)
Value:
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)
GLenum func
Definition: glext.h:6028
#define TRUE
Definition: types.h:120
#define expect_(expected, got, precision)
Definition: font.c:29

Definition at line 66 of file activex.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file activex.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 22 of file activex.c.

◆ DEFINE_EXPECT

#define DEFINE_EXPECT (   func)    static BOOL expect_ ## func = FALSE, called_ ## func = FALSE

Definition at line 60 of file activex.c.

◆ DISPID_GLOBAL_OK

#define DISPID_GLOBAL_OK   0x2000

Definition at line 117 of file activex.c.

◆ DISPID_TEST_REPORTSUCCESS

#define DISPID_TEST_REPORTSUCCESS   0x1000

Definition at line 115 of file activex.c.

◆ IActiveScriptParse_InitNew

#define IActiveScriptParse_InitNew   IActiveScriptParse32_InitNew

Definition at line 48 of file activex.c.

◆ IActiveScriptParse_ParseScriptText

#define IActiveScriptParse_ParseScriptText   IActiveScriptParse32_ParseScriptText

Definition at line 49 of file activex.c.

◆ IActiveScriptParse_QueryInterface

#define IActiveScriptParse_QueryInterface   IActiveScriptParse32_QueryInterface

Definition at line 46 of file activex.c.

◆ IActiveScriptParse_Release

#define IActiveScriptParse_Release   IActiveScriptParse32_Release

Definition at line 47 of file activex.c.

◆ IActiveScriptParseProcedure2_ParseProcedureText

#define IActiveScriptParseProcedure2_ParseProcedureText   IActiveScriptParseProcedure2_32_ParseProcedureText

Definition at line 52 of file activex.c.

◆ IActiveScriptParseProcedure2_Release

#define IActiveScriptParseProcedure2_Release   IActiveScriptParseProcedure2_32_Release

Definition at line 50 of file activex.c.

◆ parse_script_a

#define parse_script_a (   p,
  s 
)    _parse_script_a(__LINE__,p,s)

Definition at line 704 of file activex.c.

◆ SET_EXPECT

#define SET_EXPECT (   func)    expect_ ## func = TRUE

Definition at line 63 of file activex.c.

◆ TESTOBJ_CLSID

#define TESTOBJ_CLSID   "{178fc163-f585-4e24-9c13-4bb7faf80646}"

Definition at line 106 of file activex.c.

Function Documentation

◆ _call_procedure()

static void _call_procedure ( unsigned  line,
IDispatchEx *  proc,
IServiceProvider caller 
)
static

Definition at line 804 of file activex.c.

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 }
#define ok_(x1, x2)
static HANDLE proc()
Definition: pdb.c:32
#define DISPATCH_METHOD
Definition: oleauto.h:1006
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
struct stdole::EXCEPINFO EXCEPINFO
#define S_OK
Definition: intsafe.h:59
struct stdole::DISPPARAMS DISPPARAMS

◆ _parse_script_a()

static void _parse_script_a ( unsigned  line,
IActiveScriptParse *  parser,
const char script 
)
static

Definition at line 705 of file activex.c.

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 }
#define IActiveScriptParse_ParseScriptText
Definition: activex.c:49
#define ok_(x1, x2)
OLECHAR * BSTR
Definition: compat.h:1934
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
script
Definition: msipriv.h:374
Definition: parser.c:48
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static BSTR a2bstr(const char *str)
Definition: activex.c:119
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
Definition: import.c:86

◆ a2bstr()

static BSTR a2bstr ( const char str)
static

Definition at line 119 of file activex.c.

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 }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
#define CP_ACP
Definition: compat.h:99
OLECHAR * BSTR
Definition: compat.h:1934
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100

Referenced by _parse_script_a(), check_jscript(), and parse_procedure_a().

◆ ActiveScriptSite_AddRef()

static ULONG WINAPI ActiveScriptSite_AddRef ( IActiveScriptSite iface)
static

Definition at line 599 of file activex.c.

600 {
601  return 2;
602 }

◆ ActiveScriptSite_GetDocVersionString()

static HRESULT WINAPI ActiveScriptSite_GetDocVersionString ( IActiveScriptSite iface,
BSTR pbstrVersion 
)
static

Definition at line 626 of file activex.c.

627 {
628  return E_NOTIMPL;
629 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ActiveScriptSite_GetItemInfo()

static HRESULT WINAPI ActiveScriptSite_GetItemInfo ( IActiveScriptSite iface,
LPCOLESTR  pstrName,
DWORD  dwReturnMask,
IUnknown **  ppiunkItem,
ITypeInfo **  ppti 
)
static

Definition at line 615 of file activex.c.

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 }
static IDispatchEx globalObj
Definition: activex.c:395
#define wine_dbgstr_w
Definition: kernel32.h:34
#define ok(value,...)
static int strcmp_wa(LPCWSTR strw, const char *stra)
Definition: activex.c:131
#define S_OK
Definition: intsafe.h:59

◆ ActiveScriptSite_GetLCID()

static HRESULT WINAPI ActiveScriptSite_GetLCID ( IActiveScriptSite iface,
LCID plcid 
)
static

Definition at line 609 of file activex.c.

610 {
611  *plcid = GetUserDefaultLCID();
612  return S_OK;
613 }
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:768
#define S_OK
Definition: intsafe.h:59

◆ ActiveScriptSite_OnEnterScript()

static HRESULT WINAPI ActiveScriptSite_OnEnterScript ( IActiveScriptSite iface)
static

Definition at line 647 of file activex.c.

648 {
649  return E_NOTIMPL;
650 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ActiveScriptSite_OnLeaveScript()

static HRESULT WINAPI ActiveScriptSite_OnLeaveScript ( IActiveScriptSite iface)
static

Definition at line 652 of file activex.c.

653 {
654  return E_NOTIMPL;
655 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ActiveScriptSite_OnScriptError()

static HRESULT WINAPI ActiveScriptSite_OnScriptError ( IActiveScriptSite iface,
IActiveScriptError pscripterror 
)
static

Definition at line 642 of file activex.c.

643 {
644  return E_NOTIMPL;
645 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ActiveScriptSite_OnScriptTerminate()

static HRESULT WINAPI ActiveScriptSite_OnScriptTerminate ( IActiveScriptSite iface,
const VARIANT pvarResult,
const EXCEPINFO *  pexcepinfo 
)
static

Definition at line 631 of file activex.c.

633 {
634  return E_NOTIMPL;
635 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ActiveScriptSite_OnStateChange()

static HRESULT WINAPI ActiveScriptSite_OnStateChange ( IActiveScriptSite iface,
SCRIPTSTATE  ssScriptState 
)
static

Definition at line 637 of file activex.c.

638 {
639  return E_NOTIMPL;
640 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ActiveScriptSite_QueryInterface()

static HRESULT WINAPI ActiveScriptSite_QueryInterface ( IActiveScriptSite iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 582 of file activex.c.

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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static BOOL AllowIServiceProvider
Definition: activex.c:104
smooth NULL
Definition: ftsmooth.c:416
static IServiceProvider ServiceProvider
Definition: activex.c:533
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ ActiveScriptSite_Release()

static ULONG WINAPI ActiveScriptSite_Release ( IActiveScriptSite iface)
static

Definition at line 604 of file activex.c.

605 {
606  return 1;
607 }

◆ check_jscript()

static BOOL check_jscript ( void  )
static

Definition at line 1117 of file activex.c.

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 }
#define IActiveScriptParse_ParseScriptText
Definition: activex.c:49
#define TRUE
Definition: types.h:120
OLECHAR * BSTR
Definition: compat.h:1934
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define IActiveScriptParse_Release
Definition: activex.c:47
#define IActiveScriptParse_QueryInterface
Definition: activex.c:46
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static BSTR a2bstr(const char *str)
Definition: activex.c:119
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
static IActiveScriptParse * create_script(BOOL skip_tests, BOOL use_sec_mgr)
Definition: activex.c:716
Definition: import.c:86

Referenced by START_TEST().

◆ ClassFactory_AddRef()

static ULONG WINAPI ClassFactory_AddRef ( IClassFactory iface)
static

Definition at line 409 of file activex.c.

410 {
411  return 2;
412 }

◆ ClassFactory_CreateInstance()

static HRESULT WINAPI ClassFactory_CreateInstance ( IClassFactory iface,
IUnknown outer,
REFIID  riid,
void **  ppv 
)
static

Definition at line 419 of file activex.c.

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 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
const char * wine_dbgstr_guid(const GUID *guid)
static IDispatchEx testObj
Definition: activex.c:337
#define ok(value,...)
const GUID IID_IUnknown
static HRESULT CreateInstance_hres
Definition: activex.c:98
#define CHECK_EXPECT(func)
Definition: activex.c:72
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ ClassFactory_LockServer()

static HRESULT WINAPI ClassFactory_LockServer ( IClassFactory iface,
BOOL  dolock 
)
static

Definition at line 431 of file activex.c.

432 {
433  ok(0, "unexpected call\n");
434  return S_OK;
435 }
#define ok(value,...)
#define S_OK
Definition: intsafe.h:59

◆ ClassFactory_QueryInterface()

static HRESULT WINAPI ClassFactory_QueryInterface ( IClassFactory iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 397 of file activex.c.

398 {
400  *ppv = iface;
401  return S_OK;
402  }
403 
404  /* TODO: IClassFactoryEx */
405  *ppv = NULL;
406  return E_NOINTERFACE;
407 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
const GUID IID_IClassFactory

◆ ClassFactory_Release()

static ULONG WINAPI ClassFactory_Release ( IClassFactory iface)
static

Definition at line 414 of file activex.c.

415 {
416  return 1;
417 }

◆ create_script()

static IActiveScriptParse* create_script ( BOOL  skip_tests,
BOOL  use_sec_mgr 
)
static

Definition at line 716 of file activex.c.

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 }
#define parse_script_a(p, s)
Definition: activex.c:704
static DWORD QueryCustomPolicy_policy
Definition: activex.c:101
#define TRUE
Definition: types.h:120
static HRESULT QueryCustomPolicy_hres
Definition: activex.c:99
static HRESULT SetSite_hres
Definition: activex.c:103
static const CLSID CLSID_JScript
Definition: activex.c:57
static BOOL AllowIServiceProvider
Definition: activex.c:104
#define DWORD
Definition: nt_native.h:44
static HRESULT ProcessUrlAction_hres
Definition: activex.c:96
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define IActiveScriptParse_InitNew
Definition: activex.c:48
script
Definition: msipriv.h:374
static DWORD QueryCustomPolicy_psize
Definition: activex.c:100
static void set_safety_options(IUnknown *unk, BOOL use_sec_mgr)
Definition: activex.c:675
static const WCHAR testW[]
Definition: activex.c:93
HRESULT hres
Definition: protocol.c:465
static HRESULT QS_SecMgr_hres
Definition: activex.c:95
LONG HRESULT
Definition: typedefs.h:77
static DWORD ProcessUrlAction_policy
Definition: activex.c:97
static HRESULT CreateInstance_hres
Definition: activex.c:98
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#define S_OK
Definition: intsafe.h:59
static HRESULT QI_IDispatch_hres
Definition: activex.c:102
Definition: import.c:86
static IActiveScriptSite ActiveScriptSite
Definition: activex.c:673

Referenced by check_jscript(), and test_ActiveXObject().

◆ DEFINE_EXPECT() [1/8]

DEFINE_EXPECT ( CreateInstance  )

◆ DEFINE_EXPECT() [2/8]

DEFINE_EXPECT ( ProcessUrlAction  )

◆ DEFINE_EXPECT() [3/8]

DEFINE_EXPECT ( QueryCustomPolicy  )

◆ DEFINE_EXPECT() [4/8]

DEFINE_EXPECT ( reportSuccess  )

◆ DEFINE_EXPECT() [5/8]

DEFINE_EXPECT ( Host_QS_SecMgr  )

◆ DEFINE_EXPECT() [6/8]

DEFINE_EXPECT ( Caller_QS_SecMgr  )

◆ DEFINE_EXPECT() [7/8]

DEFINE_EXPECT ( QI_IObjectWithSite  )

◆ DEFINE_EXPECT() [8/8]

DEFINE_EXPECT ( SetSite  )

◆ DispatchEx_AddRef()

static ULONG WINAPI DispatchEx_AddRef ( IDispatchEx *  iface)
static

Definition at line 208 of file activex.c.

209 {
210  return 2;
211 }

◆ DispatchEx_DeleteMemberByDispID()

static HRESULT WINAPI DispatchEx_DeleteMemberByDispID ( IDispatchEx *  iface,
DISPID  id 
)
static

Definition at line 253 of file activex.c.

254 {
255  ok(0, "unexpected call\n");
256  return E_NOTIMPL;
257 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_DeleteMemberByName()

static HRESULT WINAPI DispatchEx_DeleteMemberByName ( IDispatchEx *  iface,
BSTR  bstrName,
DWORD  grfdex 
)
static

Definition at line 247 of file activex.c.

248 {
249  ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex);
250  return E_NOTIMPL;
251 }
#define wine_dbgstr_w
Definition: kernel32.h:34
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_GetIDsOfNames()

static HRESULT WINAPI DispatchEx_GetIDsOfNames ( IDispatchEx *  iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 231 of file activex.c.

234 {
235  ok(0, "unexpected call\n");
236  return E_NOTIMPL;
237 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_GetMemberName()

static HRESULT WINAPI DispatchEx_GetMemberName ( IDispatchEx *  iface,
DISPID  id,
BSTR pbstrName 
)
static

Definition at line 265 of file activex.c.

266 {
267  ok(0, "unexpected call\n");
268  return E_NOTIMPL;
269 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_GetMemberProperties()

static HRESULT WINAPI DispatchEx_GetMemberProperties ( IDispatchEx *  iface,
DISPID  id,
DWORD  grfdexFetch,
DWORD pgrfdex 
)
static

Definition at line 259 of file activex.c.

260 {
261  ok(0, "unexpected call\n");
262  return E_NOTIMPL;
263 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_GetNameSpaceParent()

static HRESULT WINAPI DispatchEx_GetNameSpaceParent ( IDispatchEx *  iface,
IUnknown **  ppunk 
)
static

Definition at line 277 of file activex.c.

278 {
279  ok(0, "unexpected call\n");
280  return E_NOTIMPL;
281 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_GetNextDispID()

static HRESULT WINAPI DispatchEx_GetNextDispID ( IDispatchEx *  iface,
DWORD  grfdex,
DISPID  id,
DISPID pid 
)
static

Definition at line 271 of file activex.c.

272 {
273  ok(0, "unexpected call\n");
274  return E_NOTIMPL;
275 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_GetTypeInfo()

static HRESULT WINAPI DispatchEx_GetTypeInfo ( IDispatchEx *  iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 224 of file activex.c.

226 {
227  ok(0, "unexpected call\n");
228  return E_NOTIMPL;
229 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_GetTypeInfoCount()

static HRESULT WINAPI DispatchEx_GetTypeInfoCount ( IDispatchEx *  iface,
UINT pctinfo 
)
static

Definition at line 218 of file activex.c.

219 {
220  ok(0, "unexpected call\n");
221  return E_NOTIMPL;
222 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_Invoke()

static HRESULT WINAPI DispatchEx_Invoke ( IDispatchEx *  iface,
DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
static

Definition at line 239 of file activex.c.

242 {
243  ok(0, "unexpected call\n");
244  return E_NOTIMPL;
245 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_QueryInterface()

static HRESULT WINAPI DispatchEx_QueryInterface ( IDispatchEx *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 188 of file activex.c.

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 }
static IObjectWithSite * object_with_site
Definition: activex.c:186
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
const IID IID_IObjectWithSite
const GUID IID_IDispatch
#define CHECK_EXPECT(func)
Definition: activex.c:72
#define S_OK
Definition: intsafe.h:59
static HRESULT QI_IDispatch_hres
Definition: activex.c:102
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ DispatchEx_Release()

static ULONG WINAPI DispatchEx_Release ( IDispatchEx *  iface)
static

Definition at line 213 of file activex.c.

214 {
215  return 1;
216 }

◆ Global_GetDispID()

static HRESULT WINAPI Global_GetDispID ( IDispatchEx *  iface,
BSTR  bstrName,
DWORD  grfdex,
DISPID pid 
)
static

Definition at line 339 of file activex.c.

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 }
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
#define wine_dbgstr_w
Definition: kernel32.h:34
#define DISPID_GLOBAL_OK
Definition: activex.c:117
#define ok(value,...)
static int strcmp_wa(LPCWSTR strw, const char *stra)
Definition: activex.c:131
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Global_InvokeEx()

static HRESULT WINAPI Global_InvokeEx ( IDispatchEx *  iface,
DISPID  id,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pdp,
VARIANT pvarRes,
EXCEPINFO *  pei,
IServiceProvider pspCaller 
)
static

Definition at line 351 of file activex.c.

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 }
#define wine_dbgstr_w
Definition: kernel32.h:34
#define DISPID_GLOBAL_OK
Definition: activex.c:117
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define V_BOOL(A)
Definition: oleauto.h:224
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ init_key()

static BOOL init_key ( const char key_name,
const char def_value,
BOOL  init 
)
static

Definition at line 1073 of file activex.c.

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 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LONG WINAPI RegSetValueA(HKEY hKeyOriginal, LPCSTR lpSubKey, DWORD dwType, LPCSTR lpData, DWORD cbData)
Definition: reg.c:4968
static int init
Definition: wintirpc.c:33
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegCreateKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1177
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
GLuint res
Definition: glext.h:9613
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define REG_SZ
Definition: layer.c:22

Referenced by init_registry().

◆ init_registry()

static BOOL init_registry ( BOOL  init)
static

Definition at line 1095 of file activex.c.

1096 {
1097  return init_key("Wine.Test\\CLSID", TESTOBJ_CLSID, init);
1098 }
static BOOL init_key(const char *key_name, const char *def_value, BOOL init)
Definition: activex.c:1073
static int init
Definition: wintirpc.c:33
#define TESTOBJ_CLSID
Definition: activex.c:106

Referenced by register_activex(), and START_TEST().

◆ InternetHostSecurityManager_AddRef()

static ULONG WINAPI InternetHostSecurityManager_AddRef ( IInternetHostSecurityManager iface)
static

Definition at line 453 of file activex.c.

454 {
455  return 2;
456 }

◆ InternetHostSecurityManager_GetSecurityId()

static HRESULT WINAPI InternetHostSecurityManager_GetSecurityId ( IInternetHostSecurityManager iface,
BYTE pbSecurityId,
DWORD pcbSecurityId,
DWORD_PTR  dwReserved 
)
static

Definition at line 463 of file activex.c.

465 {
466  ok(0, "unexpected call\n");
467  return E_NOTIMPL;
468 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InternetHostSecurityManager_ProcessUrlAction()

static HRESULT WINAPI InternetHostSecurityManager_ProcessUrlAction ( IInternetHostSecurityManager iface,
DWORD  dwAction,
BYTE pPolicy,
DWORD  cbPolicy,
BYTE pContext,
DWORD  cbContext,
DWORD  dwFlags,
DWORD  dwReserved 
)
static

Definition at line 470 of file activex.c.

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 }
static const GUID CLSID_TestObj
Definition: activex.c:108
const char * wine_dbgstr_guid(const GUID *guid)
static HRESULT ProcessUrlAction_hres
Definition: activex.c:96
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
static DWORD ProcessUrlAction_policy
Definition: activex.c:97
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define CHECK_EXPECT(func)
Definition: activex.c:72
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ InternetHostSecurityManager_QueryCustomPolicy()

static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy ( IInternetHostSecurityManager iface,
REFGUID  guidKey,
BYTE **  ppPolicy,
DWORD pcbPolicy,
BYTE pContext,
DWORD  cbContext,
DWORD  dwReserved 
)
static

Definition at line 489 of file activex.c.

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 }
static DWORD QueryCustomPolicy_policy
Definition: activex.c:101
static HRESULT QueryCustomPolicy_hres
Definition: activex.c:99
const char * wine_dbgstr_guid(const GUID *guid)
const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY
Definition: activex.c:31
uint32_t cs
Definition: isohybrid.c:75
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
static DWORD QueryCustomPolicy_psize
Definition: activex.c:100
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
unsigned char BYTE
Definition: mem.h:68
#define CHECK_EXPECT(func)
Definition: activex.c:72
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define memset(x, y, z)
Definition: compat.h:39
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

◆ InternetHostSecurityManager_QueryInterface()

static HRESULT WINAPI InternetHostSecurityManager_QueryInterface ( IInternetHostSecurityManager iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 447 of file activex.c.

448 {
449  ok(0, "unexpected call\n");
450  return E_NOINTERFACE;
451 }
#define E_NOINTERFACE
Definition: winerror.h:2364
#define ok(value,...)

◆ InternetHostSecurityManager_Release()

static ULONG WINAPI InternetHostSecurityManager_Release ( IInternetHostSecurityManager iface)
static

Definition at line 458 of file activex.c.

459 {
460  return 1;
461 }

◆ ObjectWithSite_AddRef()

static ULONG WINAPI ObjectWithSite_AddRef ( IObjectWithSite iface)
static

Definition at line 144 of file activex.c.

145 {
146  return 2;
147 }

◆ ObjectWithSite_GetSite()

static HRESULT WINAPI ObjectWithSite_GetSite ( IObjectWithSite iface,
REFIID  riid,
void **  ppvSite 
)
static

Definition at line 170 of file activex.c.

171 {
172  ok(0, "unexpected call\n");
173  return E_NOTIMPL;
174 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ObjectWithSite_QueryInterface()

static HRESULT WINAPI ObjectWithSite_QueryInterface ( IObjectWithSite iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 138 of file activex.c.

139 {
140  ok(0, "unexpected call\n");
141  return E_NOTIMPL;
142 }
#define ok(value,...)
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ObjectWithSite_Release()

static ULONG WINAPI ObjectWithSite_Release ( IObjectWithSite iface)
static

Definition at line 149 of file activex.c.

150 {
151  return 1;
152 }

◆ ObjectWithSite_SetSite()

static HRESULT WINAPI ObjectWithSite_SetSite ( IObjectWithSite iface,
IUnknown pUnkSite 
)
static

Definition at line 154 of file activex.c.

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 }
static HRESULT SetSite_hres
Definition: activex.c:103
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define CHECK_EXPECT(func)
Definition: activex.c:72
#define S_OK
Definition: intsafe.h:59
static const WCHAR sp[]
Definition: suminfo.c:288

◆ parse_procedure_a()

static IDispatchEx* parse_procedure_a ( IActiveScriptParse *  parser,
const char src 
)
static

Definition at line 778 of file activex.c.

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 }
disp
Definition: i386-dis.c:3181
OLECHAR * BSTR
Definition: compat.h:1934
#define ok(value,...)
#define IActiveScriptParseProcedure2_ParseProcedureText
Definition: activex.c:52
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define IActiveScriptParse_QueryInterface
Definition: activex.c:46
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static BSTR a2bstr(const char *str)
Definition: activex.c:119
GLenum src
Definition: glext.h:6340
#define IActiveScriptParseProcedure2_Release
Definition: activex.c:50
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
Definition: import.c:86

Referenced by test_ActiveXObject().

◆ register_activex()

static BOOL register_activex ( void  )
static

Definition at line 1100 of file activex.c.

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 }
#define TRUE
Definition: types.h:120
static const GUID CLSID_TestObj
Definition: activex.c:108
#define regid
Definition: ecma_167.h:64
static IClassFactory activex_cf
Definition: activex.c:445
#define ok(value,...)
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2806
#define S_OK
Definition: intsafe.h:59
static BOOL init_registry(BOOL init)
Definition: activex.c:1095

Referenced by START_TEST().

◆ ServiceProvider_AddRef()

static ULONG WINAPI ServiceProvider_AddRef ( IServiceProvider iface)
static

Definition at line 541 of file activex.c.

542 {
543  return 2;
544 }

◆ ServiceProvider_QueryInterface()

static HRESULT WINAPI ServiceProvider_QueryInterface ( IServiceProvider iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 535 of file activex.c.

536 {
537  ok(0, "unexpected call\n");
538  return E_NOINTERFACE;
539 }
#define E_NOINTERFACE
Definition: winerror.h:2364
#define ok(value,...)

◆ ServiceProvider_QueryService()

static HRESULT WINAPI ServiceProvider_QueryService ( IServiceProvider iface,
REFGUID  guidService,
REFIID  riid,
void **  ppv 
)
static

Definition at line 551 of file activex.c.

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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
const char * wine_dbgstr_guid(const GUID *guid)
#define ok(value,...)
static IServiceProvider ServiceProvider
Definition: activex.c:533
static HRESULT QS_SecMgr_hres
Definition: activex.c:95
static IInternetHostSecurityManager InternetHostSecurityManager
Definition: activex.c:531
#define CHECK_EXPECT(func)
Definition: activex.c:72
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ ServiceProvider_Release()

static ULONG WINAPI ServiceProvider_Release ( IServiceProvider iface)
static

Definition at line 546 of file activex.c.

547 {
548  return 1;
549 }

◆ set_safety_options()

static void set_safety_options ( IUnknown unk,
BOOL  use_sec_mgr 
)
static

Definition at line 675 of file activex.c.

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 }
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
#define ok(value,...)
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:59

Referenced by create_script().

◆ START_TEST()

START_TEST ( activex  )

Definition at line 1141 of file activex.c.

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 }
smooth NULL
Definition: ftsmooth.c:416
static void test_ActiveXObject(void)
Definition: activex.c:815
static BOOL register_activex(void)
Definition: activex.c:1100
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
static BOOL check_jscript(void)
Definition: activex.c:1117
static BOOL init_registry(BOOL init)
Definition: activex.c:1095
#define skip(...)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1897
#define win_skip
Definition: test.h:141

◆ strcmp_wa()

static int strcmp_wa ( LPCWSTR  strw,
const char stra 
)
static

Definition at line 131 of file activex.c.

132 {
133  CHAR buf[512];
134  WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), 0, 0);
135  return lstrcmpA(buf, stra);
136 }
#define WideCharToMultiByte
Definition: compat.h:101
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
static const char * strw(LPCWSTR x)
Definition: actctx.c:49

Referenced by ActiveScriptSite_GetItemInfo(), Global_GetDispID(), and Test_GetDispID().

◆ test_ActiveXObject()

static void test_ActiveXObject ( void  )
static

Definition at line 815 of file activex.c.

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 }
static IObjectWithSite * object_with_site
Definition: activex.c:186
static IDispatchEx * parse_procedure_a(IActiveScriptParse *parser, const char *src)
Definition: activex.c:778
static DWORD QueryCustomPolicy_policy
Definition: activex.c:101
#define parse_script_a(p, s)
Definition: activex.c:704
#define TRUE
Definition: types.h:120
#define E_NOINTERFACE
Definition: winerror.h:2364
static HRESULT QueryCustomPolicy_hres
Definition: activex.c:99
static HRESULT SetSite_hres
Definition: activex.c:103
static BOOL AllowIServiceProvider
Definition: activex.c:104
static HANDLE proc()
Definition: pdb.c:32
static IServiceProvider caller_sp
Definition: activex.c:580
#define E_FAIL
Definition: ddrawi.h:102
static HRESULT ProcessUrlAction_hres
Definition: activex.c:96
static IObjectWithSite ObjectWithSite
Definition: activex.c:184
smooth NULL
Definition: ftsmooth.c:416
static DWORD QueryCustomPolicy_psize
Definition: activex.c:100
#define IActiveScriptParse_Release
Definition: activex.c:47
static HRESULT QS_SecMgr_hres
Definition: activex.c:95
#define CHECK_CALLED(func)
Definition: activex.c:78
static DWORD ProcessUrlAction_policy
Definition: activex.c:97
#define SET_EXPECT(func)
Definition: activex.c:63
static HRESULT CreateInstance_hres
Definition: activex.c:98
static IActiveScriptParse * create_script(BOOL skip_tests, BOOL use_sec_mgr)
Definition: activex.c:716
Definition: import.c:86
#define call_procedure(p, c)
Definition: activex.c:803

Referenced by START_TEST().

◆ Test_GetDispID()

static HRESULT WINAPI Test_GetDispID ( IDispatchEx *  iface,
BSTR  bstrName,
DWORD  grfdex,
DISPID pid 
)
static

Definition at line 283 of file activex.c.

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 }
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
#define wine_dbgstr_w
Definition: kernel32.h:34
#define ok(value,...)
#define DISPID_TEST_REPORTSUCCESS
Definition: activex.c:115
static int strcmp_wa(LPCWSTR strw, const char *stra)
Definition: activex.c:131
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Test_InvokeEx()

static HRESULT WINAPI Test_InvokeEx ( IDispatchEx *  iface,
DISPID  id,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pdp,
VARIANT pvarRes,
EXCEPINFO *  pei,
IServiceProvider pspCaller 
)
static

Definition at line 295 of file activex.c.

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 }
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define DISPID_TEST_REPORTSUCCESS
Definition: activex.c:115
#define CHECK_EXPECT(func)
Definition: activex.c:72
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99

Variable Documentation

◆ ActiveScriptSite

IActiveScriptSite ActiveScriptSite = { &ActiveScriptSiteVtbl }
static

Definition at line 673 of file activex.c.

Referenced by create_script().

◆ ActiveScriptSiteVtbl

const IActiveScriptSiteVtbl ActiveScriptSiteVtbl
static
Initial value:
= {
}
static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown **ppiunkItem, ITypeInfo **ppti)
Definition: activex.c:615
static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, REFIID riid, void **ppv)
Definition: activex.c:582
static HRESULT WINAPI ActiveScriptSite_GetDocVersionString(IActiveScriptSite *iface, BSTR *pbstrVersion)
Definition: activex.c:626
static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface)
Definition: activex.c:604
static ULONG WINAPI ActiveScriptSite_AddRef(IActiveScriptSite *iface)
Definition: activex.c:599
static HRESULT WINAPI ActiveScriptSite_OnScriptTerminate(IActiveScriptSite *iface, const VARIANT *pvarResult, const EXCEPINFO *pexcepinfo)
Definition: activex.c:631
static HRESULT WINAPI ActiveScriptSite_OnScriptError(IActiveScriptSite *iface, IActiveScriptError *pscripterror)
Definition: activex.c:642
static HRESULT WINAPI ActiveScriptSite_OnEnterScript(IActiveScriptSite *iface)
Definition: activex.c:647
static HRESULT WINAPI ActiveScriptSite_GetLCID(IActiveScriptSite *iface, LCID *plcid)
Definition: activex.c:609
static HRESULT WINAPI ActiveScriptSite_OnLeaveScript(IActiveScriptSite *iface)
Definition: activex.c:652
static HRESULT WINAPI ActiveScriptSite_OnStateChange(IActiveScriptSite *iface, SCRIPTSTATE ssScriptState)
Definition: activex.c:637

Definition at line 659 of file activex.c.

◆ activex_cf

IClassFactory activex_cf = { &ClassFactoryVtbl }
static

Definition at line 445 of file activex.c.

Referenced by register_activex().

◆ AllowIServiceProvider

BOOL AllowIServiceProvider
static

Definition at line 104 of file activex.c.

Referenced by ActiveScriptSite_QueryInterface(), create_script(), and test_ActiveXObject().

◆ caller_sp

IServiceProvider caller_sp = { &ServiceProviderVtbl }
static

Definition at line 580 of file activex.c.

Referenced by test_ActiveXObject().

◆ ClassFactoryVtbl

const IClassFactoryVtbl ClassFactoryVtbl
static
Initial value:
= {
}
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: activex.c:409
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: activex.c:397
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
Definition: activex.c:431
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: activex.c:414
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
Definition: activex.c:419

Definition at line 437 of file activex.c.

◆ CLSID_JScript

const CLSID CLSID_JScript
static
Initial value:
=
{0xf414c260,0x6ac0,0x11cf,{0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58}}

Definition at line 57 of file activex.c.

Referenced by create_script(), DllGetClassObject(), get_default_script_guid(), get_elem_script_host(), get_guid_from_type(), is_jscript_available(), and script_parse_event().

◆ CLSID_TestObj

const GUID CLSID_TestObj
static
Initial value:
=
{0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x06,0x46}}

Definition at line 108 of file activex.c.

Referenced by InternetHostSecurityManager_ProcessUrlAction(), and register_activex().

◆ CreateInstance_hres

HRESULT CreateInstance_hres
static

Definition at line 98 of file activex.c.

Referenced by ClassFactory_CreateInstance(), create_script(), and test_ActiveXObject().

◆ globalObj

IDispatchEx globalObj = { &globalObjVtbl }
static

Definition at line 395 of file activex.c.

Referenced by ActiveScriptSite_GetItemInfo().

◆ globalObjVtbl

IDispatchExVtbl globalObjVtbl
static
Initial value:
= {
}
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
Definition: activex.c:259
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
Definition: activex.c:271
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 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
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
Definition: activex.c:247
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: activex.c:231
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
Definition: activex.c:213
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: activex.c:224
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 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 HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
Definition: activex.c:253
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
Definition: activex.c:208
static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: activex.c:339

Definition at line 377 of file activex.c.

◆ GUID_CUSTOM_CONFIRMOBJECTSAFETY

const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY
Initial value:
=
{0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}}

Definition at line 112 of file activex.c.

◆ InternetHostSecurityManager

IInternetHostSecurityManager InternetHostSecurityManager = { &InternetHostSecurityManagerVtbl }
static

Definition at line 531 of file activex.c.

Referenced by ServiceProvider_QueryService().

◆ InternetHostSecurityManagerVtbl

const IInternetHostSecurityManagerVtbl InternetHostSecurityManagerVtbl
static
Initial value:
= {
}
static ULONG WINAPI InternetHostSecurityManager_Release(IInternetHostSecurityManager *iface)
Definition: activex.c:458
static ULONG WINAPI InternetHostSecurityManager_AddRef(IInternetHostSecurityManager *iface)
Definition: activex.c:453
static HRESULT WINAPI InternetHostSecurityManager_GetSecurityId(IInternetHostSecurityManager *iface, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
Definition: activex.c:463
static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHostSecurityManager *iface, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwReserved)
Definition: activex.c:489
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 InternetHostSecurityManager_QueryInterface(IInternetHostSecurityManager *iface, REFIID riid, void **ppv)
Definition: activex.c:447

Definition at line 522 of file activex.c.

◆ object_with_site

IObjectWithSite* object_with_site
static

Definition at line 186 of file activex.c.

Referenced by DispatchEx_QueryInterface(), and test_ActiveXObject().

◆ ObjectWithSite

IObjectWithSite ObjectWithSite = { &ObjectWithSiteVtbl }
static

Definition at line 184 of file activex.c.

Referenced by test_ActiveXObject().

◆ ObjectWithSiteVtbl

const IObjectWithSiteVtbl ObjectWithSiteVtbl
static
Initial value:
= {
}
static HRESULT WINAPI ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID riid, void **ppv)
Definition: activex.c:138
static ULONG WINAPI ObjectWithSite_Release(IObjectWithSite *iface)
Definition: activex.c:149
static HRESULT WINAPI ObjectWithSite_SetSite(IObjectWithSite *iface, IUnknown *pUnkSite)
Definition: activex.c:154
static ULONG WINAPI ObjectWithSite_AddRef(IObjectWithSite *iface)
Definition: activex.c:144
static HRESULT WINAPI ObjectWithSite_GetSite(IObjectWithSite *iface, REFIID riid, void **ppvSite)
Definition: activex.c:170

Definition at line 176 of file activex.c.

◆ ProcessUrlAction_hres

HRESULT ProcessUrlAction_hres
static

◆ ProcessUrlAction_policy

DWORD ProcessUrlAction_policy
static

◆ QI_IDispatch_hres

HRESULT QI_IDispatch_hres
static

Definition at line 102 of file activex.c.

Referenced by create_script(), and DispatchEx_QueryInterface().

◆ QS_SecMgr_hres

HRESULT QS_SecMgr_hres
static

Definition at line 95 of file activex.c.

Referenced by create_script(), ServiceProvider_QueryService(), and test_ActiveXObject().

◆ QueryCustomPolicy_hres

HRESULT QueryCustomPolicy_hres
static

◆ QueryCustomPolicy_policy

DWORD QueryCustomPolicy_policy
static

◆ QueryCustomPolicy_psize

DWORD QueryCustomPolicy_psize
static

◆ ServiceProvider

static IServiceProvider ServiceProvider = { &ServiceProviderVtbl }
static

Definition at line 533 of file activex.c.

Referenced by ActiveScriptSite_QueryInterface(), and ServiceProvider_QueryService().

◆ ServiceProviderVtbl

IServiceProviderVtbl ServiceProviderVtbl
static
Initial value:
= {
}
static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
Definition: activex.c:535
static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
Definition: activex.c:551
static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
Definition: activex.c:546
static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
Definition: activex.c:541

Definition at line 572 of file activex.c.

◆ SetSite_hres

HRESULT SetSite_hres
static

Definition at line 103 of file activex.c.

Referenced by create_script(), ObjectWithSite_SetSite(), and test_ActiveXObject().

◆ testObj

IDispatchEx testObj = { &testObjVtbl }
static

Definition at line 337 of file activex.c.

Referenced by ClassFactory_CreateInstance().

◆ testObjVtbl

IDispatchExVtbl testObjVtbl
static
Initial value:
= {
}
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
Definition: activex.c:259
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
Definition: activex.c:271
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 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
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
Definition: activex.c:247
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: activex.c:231
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
Definition: activex.c:213
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
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 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 HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
Definition: activex.c:253
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
Definition: activex.c:208

Definition at line 319 of file activex.c.

◆ testW

const WCHAR testW[] = {'t','e','s','t',0}
static

Definition at line 93 of file activex.c.

Referenced by create_script().