ReactOS  0.4.14-dev-98-gb0d4763
createobj.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 createobj.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 VB_E_ACCESS_DENIED   0x800a0046
 
#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 CLEAR_CALLED(func)   expect_ ## func = called_ ## func = FALSE
 
#define TESTOBJ_CLSID   "{178fc163-f585-4e24-9c13-4bb7faf80646}"
 
#define TESTOBJINST_CLSID   "{178fc163-f585-4e24-9c13-4bb7faf80647}"
 
#define DISPID_TEST_REPORTSUCCESS   0x1000
 
#define DISPID_GLOBAL_OK   0x2000
 
#define VB_E_CANNOT_CREATE_OBJ   0x800a01ad
 
#define parse_script_a(p, s)   _parse_script_a(__LINE__,p,s)
 

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 HRESULT parse_script_ae (IActiveScriptParse *parser, const char *script)
 
static IActiveScriptParse * create_script (BOOL use_sec_mgr)
 
static void test_CreateObject (void)
 
static void test_GetObject (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_vbscript (void)
 
 START_TEST (createobj)
 

Variables

const CLSID CLSID_VBScript
 
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 QI_IObjectWithSite_hres
 
static HRESULT SetSite_hres
 
static const GUID CLSID_TestObj
 
static const GUID CLSID_TestObjInst
 
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 const IActiveScriptSiteVtbl ActiveScriptSiteVtbl
 
static IActiveScriptSite ActiveScriptSite = { &ActiveScriptSiteVtbl }
 

Macro Definition Documentation

◆ 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 73 of file createobj.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 67 of file createobj.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 61 of file createobj.c.

◆ CLEAR_CALLED

#define CLEAR_CALLED (   func)    expect_ ## func = called_ ## func = FALSE

Definition at line 79 of file createobj.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file createobj.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 22 of file createobj.c.

◆ DEFINE_EXPECT

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

Definition at line 55 of file createobj.c.

◆ DISPID_GLOBAL_OK

#define DISPID_GLOBAL_OK   0x2000

Definition at line 118 of file createobj.c.

◆ DISPID_TEST_REPORTSUCCESS

#define DISPID_TEST_REPORTSUCCESS   0x1000

Definition at line 116 of file createobj.c.

◆ IActiveScriptParse_InitNew

#define IActiveScriptParse_InitNew   IActiveScriptParse32_InitNew

Definition at line 45 of file createobj.c.

◆ IActiveScriptParse_ParseScriptText

#define IActiveScriptParse_ParseScriptText   IActiveScriptParse32_ParseScriptText

Definition at line 46 of file createobj.c.

◆ IActiveScriptParse_QueryInterface

#define IActiveScriptParse_QueryInterface   IActiveScriptParse32_QueryInterface

Definition at line 43 of file createobj.c.

◆ IActiveScriptParse_Release

#define IActiveScriptParse_Release   IActiveScriptParse32_Release

Definition at line 44 of file createobj.c.

◆ IActiveScriptParseProcedure2_Release

#define IActiveScriptParseProcedure2_Release   IActiveScriptParseProcedure2_32_Release

Definition at line 47 of file createobj.c.

◆ parse_script_a

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

Definition at line 706 of file createobj.c.

◆ SET_EXPECT

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

Definition at line 58 of file createobj.c.

◆ TESTOBJ_CLSID

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

Definition at line 104 of file createobj.c.

◆ TESTOBJINST_CLSID

#define TESTOBJINST_CLSID   "{178fc163-f585-4e24-9c13-4bb7faf80647}"

Definition at line 105 of file createobj.c.

◆ VB_E_ACCESS_DENIED

#define VB_E_ACCESS_DENIED   0x800a0046

Definition at line 53 of file createobj.c.

◆ VB_E_CANNOT_CREATE_OBJ

#define VB_E_CANNOT_CREATE_OBJ   0x800a01ad

Definition at line 120 of file createobj.c.

Function Documentation

◆ _parse_script_a()

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

Definition at line 707 of file createobj.c.

708 {
709  BSTR str;
710  HRESULT hres;
711 
712  str = a2bstr(script);
715  ok_(__FILE__,line)(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
716 }
static BSTR a2bstr(const char *str)
Definition: createobj.c:122
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
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
Definition: import.c:86
#define IActiveScriptParse_ParseScriptText
Definition: createobj.c:46
#define ok_(x1, x2)
Definition: atltest.h:61

◆ a2bstr()

static BSTR a2bstr ( const char str)
static

Definition at line 122 of file createobj.c.

123 {
124  BSTR ret;
125  int len;
126 
127  len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
129  MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
130 
131  return ret;
132 }
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(), and parse_script_ae().

◆ ActiveScriptSite_AddRef()

static ULONG WINAPI ActiveScriptSite_AddRef ( IActiveScriptSite iface)
static

Definition at line 603 of file createobj.c.

604 {
605  return 2;
606 }

◆ ActiveScriptSite_GetDocVersionString()

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

Definition at line 630 of file createobj.c.

631 {
632  return E_NOTIMPL;
633 }
#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 619 of file createobj.c.

621 {
622  ok(dwReturnMask == SCRIPTINFO_IUNKNOWN, "unexpected dwReturnMask %x\n", dwReturnMask);
623  ok(!ppti, "ppti != NULL\n");
624  ok(!strcmp_wa(pstrName, "test"), "pstrName = %s\n", wine_dbgstr_w(pstrName));
625 
626  *ppiunkItem = (IUnknown*)&globalObj;
627  return S_OK;
628 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
static int strcmp_wa(LPCWSTR strw, const char *stra)
Definition: createobj.c:134
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
static IDispatchEx globalObj
Definition: createobj.c:400

◆ ActiveScriptSite_GetLCID()

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

Definition at line 613 of file createobj.c.

614 {
615  *plcid = GetUserDefaultLCID();
616  return S_OK;
617 }
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 651 of file createobj.c.

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

◆ ActiveScriptSite_OnLeaveScript()

static HRESULT WINAPI ActiveScriptSite_OnLeaveScript ( IActiveScriptSite iface)
static

Definition at line 656 of file createobj.c.

657 {
658  return E_NOTIMPL;
659 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ActiveScriptSite_OnScriptError()

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

Definition at line 646 of file createobj.c.

647 {
648  return E_NOTIMPL;
649 }
#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 635 of file createobj.c.

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

◆ ActiveScriptSite_OnStateChange()

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

Definition at line 641 of file createobj.c.

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

◆ ActiveScriptSite_QueryInterface()

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

Definition at line 586 of file createobj.c.

587 {
588  if(IsEqualGUID(&IID_IUnknown, riid)) {
589  *ppv = iface;
590  }else if(IsEqualGUID(&IID_IActiveScriptSite, riid)) {
591  *ppv = iface;
592  }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
593  *ppv = &ServiceProvider;
594  }else {
595  *ppv = NULL;
596  return E_NOINTERFACE;
597  }
598 
599  IUnknown_AddRef((IUnknown*)*ppv);
600  return S_OK;
601 }
#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
static IServiceProvider ServiceProvider
Definition: createobj.c:538
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 608 of file createobj.c.

609 {
610  return 1;
611 }

◆ check_vbscript()

static BOOL check_vbscript ( void  )
static

Definition at line 1080 of file createobj.c.

1081 {
1082  IActiveScriptParseProcedure2 *vbscript;
1083  HRESULT hres;
1084 
1085  hres = CoCreateInstance(&CLSID_VBScript, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
1086  &IID_IActiveScriptParseProcedure2, (void**)&vbscript);
1087  if(SUCCEEDED(hres))
1089 
1090  return hres == S_OK;
1091 }
const CLSID CLSID_VBScript
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
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
#define IActiveScriptParseProcedure2_Release
Definition: createobj.c:47
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by START_TEST().

◆ ClassFactory_AddRef()

static ULONG WINAPI ClassFactory_AddRef ( IClassFactory iface)
static

Definition at line 414 of file createobj.c.

415 {
416  return 2;
417 }

◆ ClassFactory_CreateInstance()

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

Definition at line 424 of file createobj.c.

425 {
426  CHECK_EXPECT(CreateInstance);
427 
428  ok(!outer, "outer = %p\n", outer);
429  ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
430 
432  *ppv = &testObj;
433  return CreateInstance_hres;
434 }
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: createobj.c:342
const GUID IID_IUnknown
#define CHECK_EXPECT(func)
Definition: createobj.c:67
static HRESULT CreateInstance_hres
Definition: createobj.c:96
#define ok(value,...)
Definition: atltest.h:57
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 436 of file createobj.c.

437 {
438  ok(0, "unexpected call\n");
439  return S_OK;
440 }
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57

◆ ClassFactory_QueryInterface()

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

Definition at line 402 of file createobj.c.

403 {
405  *ppv = iface;
406  return S_OK;
407  }
408 
409  /* TODO: IClassFactoryEx */
410  *ppv = NULL;
411  return E_NOINTERFACE;
412 }
#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 419 of file createobj.c.

420 {
421  return 1;
422 }

◆ create_script()

static IActiveScriptParse* create_script ( BOOL  use_sec_mgr)
static

Definition at line 730 of file createobj.c.

731 {
732  IActiveScriptParse *parser;
734  HRESULT hres;
735 
738  ProcessUrlAction_policy = URLPOLICY_ALLOW;
741  QueryCustomPolicy_psize = sizeof(DWORD);
742  QueryCustomPolicy_policy = URLPOLICY_ALLOW;
745  SetSite_hres = S_OK;
746 
747  hres = CoCreateInstance(&CLSID_VBScript, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
748  &IID_IActiveScript, (void**)&script);
749  ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
750  if(FAILED(hres))
751  return NULL;
752 
753  set_safety_options((IUnknown*)script, use_sec_mgr);
754 
755  hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParse, (void**)&parser);
756  ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
757 
759  ok(hres == S_OK, "InitNew failed: %08x\n", hres);
760 
761  hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite);
762  ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres);
763 
764  hres = IActiveScript_AddNamedItem(script, testW,
765  SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS);
766  ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres);
767 
768  hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_STARTED);
769  ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
770 
771  IActiveScript_Release(script);
772 
773  return parser;
774 }
static HRESULT QI_IDispatch_hres
Definition: createobj.c:100
static DWORD QueryCustomPolicy_policy
Definition: createobj.c:99
#define IActiveScriptParse_InitNew
Definition: createobj.c:45
static HRESULT ProcessUrlAction_hres
Definition: createobj.c:94
static DWORD QueryCustomPolicy_psize
Definition: createobj.c:98
static HRESULT QS_SecMgr_hres
Definition: createobj.c:93
#define DWORD
Definition: nt_native.h:44
const CLSID CLSID_VBScript
smooth NULL
Definition: ftsmooth.c:416
script
Definition: msipriv.h:374
static void set_safety_options(IUnknown *unk, BOOL use_sec_mgr)
Definition: createobj.c:677
static const WCHAR testW[]
Definition: createobj.c:91
static DWORD ProcessUrlAction_policy
Definition: createobj.c:95
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static HRESULT QI_IObjectWithSite_hres
Definition: createobj.c:101
static HRESULT CreateInstance_hres
Definition: createobj.c:96
static IActiveScriptSite ActiveScriptSite
Definition: createobj.c:675
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
static HRESULT SetSite_hres
Definition: createobj.c:102
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
Definition: import.c:86
static HRESULT QueryCustomPolicy_hres
Definition: createobj.c:97

Referenced by test_CreateObject(), and test_GetObject().

◆ 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 213 of file createobj.c.

214 {
215  return 2;
216 }

◆ DispatchEx_DeleteMemberByDispID()

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

Definition at line 258 of file createobj.c.

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

◆ DispatchEx_DeleteMemberByName()

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

Definition at line 252 of file createobj.c.

253 {
254  ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex);
255  return E_NOTIMPL;
256 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define ok(value,...)
Definition: atltest.h:57
#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 236 of file createobj.c.

239 {
240  ok(0, "unexpected call\n");
241  return E_NOTIMPL;
242 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_GetMemberName()

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

Definition at line 270 of file createobj.c.

271 {
272  ok(0, "unexpected call\n");
273  return E_NOTIMPL;
274 }
#define ok(value,...)
Definition: atltest.h:57
#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 264 of file createobj.c.

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

◆ DispatchEx_GetNameSpaceParent()

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

Definition at line 282 of file createobj.c.

283 {
284  ok(0, "unexpected call\n");
285  return E_NOTIMPL;
286 }
#define ok(value,...)
Definition: atltest.h:57
#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 276 of file createobj.c.

277 {
278  ok(0, "unexpected call\n");
279  return E_NOTIMPL;
280 }
#define ok(value,...)
Definition: atltest.h:57
#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 229 of file createobj.c.

231 {
232  ok(0, "unexpected call\n");
233  return E_NOTIMPL;
234 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_GetTypeInfoCount()

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

Definition at line 223 of file createobj.c.

224 {
225  ok(0, "unexpected call\n");
226  return E_NOTIMPL;
227 }
#define ok(value,...)
Definition: atltest.h:57
#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 244 of file createobj.c.

247 {
248  ok(0, "unexpected call\n");
249  return E_NOTIMPL;
250 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DispatchEx_QueryInterface()

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

Definition at line 191 of file createobj.c.

192 {
193  *ppv = NULL;
194 
195  if(IsEqualGUID(riid, &IID_IUnknown)) {
196  *ppv = iface;
197  }else if(IsEqualGUID(riid, &IID_IDispatch) || IsEqualGUID(riid, &IID_IDispatchEx)) {
199  return QI_IDispatch_hres;
200  *ppv = iface;
201  }else if(IsEqualGUID(&IID_IObjectWithSite, riid)) {
202  CHECK_EXPECT(QI_IObjectWithSite);
206  }else if(IsEqualGUID(&IID_IObjectSafety, riid)) {
207  ok(0, "Unexpected IID_IObjectSafety query\n");
208  }
209 
210  return *ppv ? S_OK : E_NOINTERFACE;
211 }
static HRESULT QI_IDispatch_hres
Definition: createobj.c:100
#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
const IID IID_IObjectWithSite
static HRESULT QI_IObjectWithSite_hres
Definition: createobj.c:101
#define CHECK_EXPECT(func)
Definition: createobj.c:67
const GUID IID_IDispatch
static IObjectWithSite * object_with_site
Definition: createobj.c:189
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ DispatchEx_Release()

static ULONG WINAPI DispatchEx_Release ( IDispatchEx *  iface)
static

Definition at line 218 of file createobj.c.

219 {
220  return 1;
221 }

◆ Global_GetDispID()

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

Definition at line 344 of file createobj.c.

345 {
346  if(!strcmp_wa(bstrName, "ok")) {
347  ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex);
349  return S_OK;
350  }
351 
352  ok(0, "unexpected name %s\n", wine_dbgstr_w(bstrName));
353  return E_NOTIMPL;
354 }
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define DISPID_GLOBAL_OK
Definition: createobj.c:118
static int strcmp_wa(LPCWSTR strw, const char *stra)
Definition: createobj.c:134
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
#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 356 of file createobj.c.

358 {
359  switch(id) {
360  case DISPID_GLOBAL_OK:
361  ok(wFlags == INVOKE_FUNC || wFlags == (INVOKE_FUNC|INVOKE_PROPERTYGET), "wFlags = %x\n", wFlags);
362  ok(pdp != NULL, "pdp == NULL\n");
363  ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
364  ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
365  ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs);
366  ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
367  ok(pei != NULL, "pei == NULL\n");
368 
369  ok(V_VT(pdp->rgvarg) == VT_BSTR, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg));
370  ok(V_VT(pdp->rgvarg+1) == VT_BOOL, "V_VT(psp->rgvargs+1) = %d\n", V_VT(pdp->rgvarg));
371  ok(V_BOOL(pdp->rgvarg+1), "%s\n", wine_dbgstr_w(V_BSTR(pdp->rgvarg)));
372  break;
373 
374  default:
375  ok(0, "unexpected call\n");
376  return E_NOTIMPL;
377  }
378 
379  return S_OK;
380 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define DISPID_GLOBAL_OK
Definition: createobj.c:118
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 ok(value,...)
Definition: atltest.h:57
#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 1032 of file createobj.c.

1033 {
1034  HKEY hkey;
1035  DWORD res;
1036 
1037  if(!init) {
1039  return TRUE;
1040  }
1041 
1043  if(res != ERROR_SUCCESS)
1044  return FALSE;
1045 
1046  if(def_value)
1047  res = RegSetValueA(hkey, NULL, REG_SZ, def_value, strlen(def_value));
1048 
1049  RegCloseKey(hkey);
1050 
1051  return res == ERROR_SUCCESS;
1052 }
#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 1054 of file createobj.c.

1055 {
1056  return init_key("Wine.Test\\CLSID", TESTOBJ_CLSID, init);
1057 }
#define TESTOBJ_CLSID
Definition: createobj.c:104
static BOOL init_key(const char *key_name, const char *def_value, BOOL init)
Definition: createobj.c:1032
static int init
Definition: wintirpc.c:33

Referenced by register_activex(), and START_TEST().

◆ InternetHostSecurityManager_AddRef()

static ULONG WINAPI InternetHostSecurityManager_AddRef ( IInternetHostSecurityManager iface)
static

Definition at line 458 of file createobj.c.

459 {
460  return 2;
461 }

◆ InternetHostSecurityManager_GetSecurityId()

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

Definition at line 468 of file createobj.c.

470 {
471  ok(0, "unexpected call\n");
472  return E_NOTIMPL;
473 }
#define ok(value,...)
Definition: atltest.h:57
#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 475 of file createobj.c.

477 {
478  CHECK_EXPECT(ProcessUrlAction);
479 
480  ok(dwAction == URLACTION_ACTIVEX_RUN, "dwAction = %x\n", dwAction);
481  ok(pPolicy != NULL, "pPolicy == NULL\n");
482  ok(cbPolicy == sizeof(DWORD), "cbPolicy = %d\n", cbPolicy);
483  ok(pContext != NULL, "pContext == NULL\n");
484  ok(cbContext == sizeof(GUID), "cbContext = %d\n", cbContext);
485  ok(IsEqualGUID(pContext, &CLSID_TestObj), "pContext = %s\n", wine_dbgstr_guid((const IID*)pContext));
486  ok(!dwFlags, "dwFlags = %x\n", dwFlags);
487  ok(!dwReserved, "dwReserved = %x\n", dwReserved);
488 
490  *(DWORD*)pPolicy = ProcessUrlAction_policy;
491  return ProcessUrlAction_hres;
492 }
static const GUID CLSID_TestObj
Definition: createobj.c:107
static HRESULT ProcessUrlAction_hres
Definition: createobj.c:94
const char * wine_dbgstr_guid(const GUID *guid)
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
smooth NULL
Definition: ftsmooth.c:416
static DWORD ProcessUrlAction_policy
Definition: createobj.c:95
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CHECK_EXPECT(func)
Definition: createobj.c:67
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ok(value,...)
Definition: atltest.h:57
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 494 of file createobj.c.

496 {
497  const struct CONFIRMSAFETY *cs = (const struct CONFIRMSAFETY*)pContext;
498  DWORD *ret;
499 
500  CHECK_EXPECT(QueryCustomPolicy);
501 
502  ok(IsEqualGUID(&GUID_CUSTOM_CONFIRMOBJECTSAFETY, guidKey), "guidKey = %s\n", wine_dbgstr_guid(guidKey));
503 
504  ok(ppPolicy != NULL, "ppPolicy == NULL\n");
505  ok(pcbPolicy != NULL, "pcbPolicy == NULL\n");
506  ok(pContext != NULL, "pContext == NULL\n");
507  ok(cbContext == sizeof(struct CONFIRMSAFETY), "cbContext = %d\n", cbContext);
508  ok(!dwReserved, "dwReserved = %x\n", dwReserved);
509 
510  /* TODO: CLSID */
511  ok(cs->pUnk != NULL, "cs->pUnk == NULL\n");
512  ok(!cs->dwFlags, "dwFlags = %x\n", cs->dwFlags);
513 
515  return QueryCustomPolicy_hres;
516 
518  *ppPolicy = (BYTE*)ret;
519  *pcbPolicy = QueryCustomPolicy_psize;
521  if(QueryCustomPolicy_psize >= sizeof(DWORD))
523 
524  return QueryCustomPolicy_hres;
525 }
static DWORD QueryCustomPolicy_policy
Definition: createobj.c:99
const char * wine_dbgstr_guid(const GUID *guid)
static DWORD QueryCustomPolicy_psize
Definition: createobj.c:98
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
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CHECK_EXPECT(func)
Definition: createobj.c:67
int ret
unsigned char BYTE
Definition: mem.h:68
const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY
Definition: createobj.c:113
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static HRESULT QueryCustomPolicy_hres
Definition: createobj.c:97
#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 452 of file createobj.c.

453 {
454  ok(0, "unexpected call\n");
455  return E_NOINTERFACE;
456 }
#define E_NOINTERFACE
Definition: winerror.h:2364
#define ok(value,...)
Definition: atltest.h:57

◆ InternetHostSecurityManager_Release()

static ULONG WINAPI InternetHostSecurityManager_Release ( IInternetHostSecurityManager iface)
static

Definition at line 463 of file createobj.c.

464 {
465  return 1;
466 }

◆ ObjectWithSite_AddRef()

static ULONG WINAPI ObjectWithSite_AddRef ( IObjectWithSite iface)
static

Definition at line 147 of file createobj.c.

148 {
149  return 2;
150 }

◆ ObjectWithSite_GetSite()

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

Definition at line 173 of file createobj.c.

174 {
175  ok(0, "unexpected call\n");
176  return E_NOTIMPL;
177 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ObjectWithSite_QueryInterface()

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

Definition at line 141 of file createobj.c.

142 {
143  ok(0, "unexpected call\n");
144  return E_NOTIMPL;
145 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ObjectWithSite_Release()

static ULONG WINAPI ObjectWithSite_Release ( IObjectWithSite iface)
static

Definition at line 152 of file createobj.c.

153 {
154  return 1;
155 }

◆ ObjectWithSite_SetSite()

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

Definition at line 157 of file createobj.c.

158 {
160  HRESULT hres;
161 
162 
163  CHECK_EXPECT(SetSite);
164  ok(pUnkSite != NULL, "pUnkSite == NULL\n");
165 
166  hres = IUnknown_QueryInterface(pUnkSite, &IID_IServiceProvider, (void**)&sp);
167  ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
168  IServiceProvider_Release(sp);
169 
170  return SetSite_hres;
171 }
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define CHECK_EXPECT(func)
Definition: createobj.c:67
static HRESULT SetSite_hres
Definition: createobj.c:102
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
static const WCHAR sp[]
Definition: suminfo.c:288

◆ parse_script_ae()

static HRESULT parse_script_ae ( IActiveScriptParse *  parser,
const char script 
)
static

Definition at line 718 of file createobj.c.

719 {
720  BSTR str;
721  HRESULT hres;
722 
723  str = a2bstr(script);
726 
727  return hres;
728 }
static BSTR a2bstr(const char *str)
Definition: createobj.c:122
OLECHAR * BSTR
Definition: compat.h:1934
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
script
Definition: msipriv.h:374
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
Definition: import.c:86
#define IActiveScriptParse_ParseScriptText
Definition: createobj.c:46

Referenced by test_CreateObject(), and test_GetObject().

◆ register_activex()

static BOOL register_activex ( void  )
static

Definition at line 1059 of file createobj.c.

1060 {
1061  DWORD regid;
1062  HRESULT hres;
1063 
1064  if(!init_registry(TRUE)) {
1066  return FALSE;
1067  }
1068 
1070  CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &regid);
1071  ok(hres == S_OK, "Could not register script engine: %08x\n", hres);
1072 
1074  CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &regid);
1075  ok(hres == S_OK, "Could not register script engine: %08x\n", hres);
1076 
1077  return TRUE;
1078 }
#define TRUE
Definition: types.h:120
static const GUID CLSID_TestObj
Definition: createobj.c:107
static IClassFactory activex_cf
Definition: createobj.c:450
#define regid
Definition: ecma_167.h:64
static BOOL init_registry(BOOL init)
Definition: createobj.c:1054
HRESULT hres
Definition: protocol.c:465
static IDispatchEx testObj
Definition: createobj.c:342
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 const GUID CLSID_TestObjInst
Definition: createobj.c:109
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ ServiceProvider_AddRef()

static ULONG WINAPI ServiceProvider_AddRef ( IServiceProvider iface)
static

Definition at line 546 of file createobj.c.

547 {
548  return 2;
549 }

◆ ServiceProvider_QueryInterface()

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

Definition at line 540 of file createobj.c.

541 {
542  ok(0, "unexpected call\n");
543  return E_NOINTERFACE;
544 }
#define E_NOINTERFACE
Definition: winerror.h:2364
#define ok(value,...)
Definition: atltest.h:57

◆ ServiceProvider_QueryService()

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

Definition at line 556 of file createobj.c.

558 {
559  if(IsEqualGUID(&SID_GetCaller, guidService))
560  return E_NOINTERFACE;
561 
562  if(IsEqualGUID(&SID_SInternetHostSecurityManager, guidService)) {
563  if(iface == &ServiceProvider)
564  CHECK_EXPECT(Host_QS_SecMgr);
565  else
566  CHECK_EXPECT(Caller_QS_SecMgr);
567  ok(IsEqualGUID(&IID_IInternetHostSecurityManager, riid), "unexpected riid %s\n", wine_dbgstr_guid(riid));
570  return QS_SecMgr_hres;
571  }
572 
573  ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService));
574  return E_NOINTERFACE;
575 }
#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)
static HRESULT QS_SecMgr_hres
Definition: createobj.c:93
static IServiceProvider ServiceProvider
Definition: createobj.c:538
#define CHECK_EXPECT(func)
Definition: createobj.c:67
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static IInternetHostSecurityManager InternetHostSecurityManager
Definition: createobj.c:536
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ ServiceProvider_Release()

static ULONG WINAPI ServiceProvider_Release ( IServiceProvider iface)
static

Definition at line 551 of file createobj.c.

552 {
553  return 1;
554 }

◆ set_safety_options()

static void set_safety_options ( IUnknown unk,
BOOL  use_sec_mgr 
)
static

Definition at line 677 of file createobj.c.

678 {
679  IObjectSafety *safety;
680  DWORD supported, enabled, options_all, options_set;
681  HRESULT hres;
682 
683  hres = IUnknown_QueryInterface(unk, &IID_IObjectSafety, (void**)&safety);
684  ok(hres == S_OK, "Could not get IObjectSafety: %08x\n", hres);
685  if(FAILED(hres))
686  return;
687 
688  options_all = INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER;
689  if(use_sec_mgr)
690  options_set = options_all;
691  else
692  options_set = INTERFACE_USES_DISPEX;
693 
694  hres = IObjectSafety_SetInterfaceSafetyOptions(safety, &IID_IActiveScriptParse, options_all, options_set);
695  ok(hres == S_OK, "SetInterfaceSafetyOptions failed: %08x\n", hres);
696 
697  supported = enabled = 0xdeadbeef;
698  hres = IObjectSafety_GetInterfaceSafetyOptions(safety, &IID_IActiveScriptParse, &supported, &enabled);
699  ok(hres == S_OK, "GetInterfaceSafetyOptions failed: %08x\n", hres);
700  ok(supported == options_all, "supported=%x, expected %x\n", supported, options_all);
701  ok(enabled == options_set, "enabled=%x, expected %x\n", enabled, options_set);
702 
703  IObjectSafety_Release(safety);
704 }
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
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
#define ok(value,...)
Definition: atltest.h:57

Referenced by create_script().

◆ START_TEST()

START_TEST ( createobj  )

Definition at line 1094 of file createobj.c.

1095 {
1096  CoInitialize(NULL);
1097 
1098  if(check_vbscript()) {
1099  if(register_activex()) {
1101  test_GetObject();
1103  }else {
1104  skip("Could not register ActiveX object.\n");
1105  }
1106  }else {
1107  win_skip("Broken engine, probably too old\n");
1108  }
1109 
1110  CoUninitialize();
1111 }
static BOOL check_vbscript(void)
Definition: createobj.c:1080
static BOOL register_activex(void)
Definition: createobj.c:1059
smooth NULL
Definition: ftsmooth.c:416
static BOOL init_registry(BOOL init)
Definition: createobj.c:1054
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
static void test_GetObject(void)
Definition: createobj.c:976
#define skip(...)
Definition: atltest.h:64
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1897
#define win_skip
Definition: test.h:141
static void test_CreateObject(void)
Definition: createobj.c:776

◆ strcmp_wa()

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

Definition at line 134 of file createobj.c.

135 {
136  CHAR buf[512];
137  WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), 0, 0);
138  return lstrcmpA(buf, stra);
139 }
#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_CreateObject()

static void test_CreateObject ( void  )
static

Definition at line 776 of file createobj.c.

777 {
778  IActiveScriptParse *parser;
779  HRESULT hres;
780 
782 
783  SET_EXPECT(Host_QS_SecMgr);
784  SET_EXPECT(ProcessUrlAction);
785  SET_EXPECT(CreateInstance);
786  SET_EXPECT(QueryCustomPolicy);
787  SET_EXPECT(QI_IObjectWithSite);
788  SET_EXPECT(reportSuccess);
789  parse_script_a(parser, "Call CreateObject(\"Wine.Test\").reportSuccess()");
790  CHECK_CALLED(Host_QS_SecMgr);
791  CHECK_CALLED(ProcessUrlAction);
792  CHECK_CALLED(CreateInstance);
793  CHECK_CALLED(QueryCustomPolicy);
794  CHECK_CALLED(QI_IObjectWithSite);
795  CHECK_CALLED(reportSuccess);
796 
798 
800 
801  hres = parse_script_ae(parser, "Call CreateObject(\"Wine.TestABC\")");
802  ok(hres == VB_E_CANNOT_CREATE_OBJ, "hres = %08x\n", hres);
803 
805 
808 
809  SET_EXPECT(Host_QS_SecMgr);
810  hres = parse_script_ae(parser, "Call CreateObject(\"Wine.Test\")");
811  ok(hres == VB_E_CANNOT_CREATE_OBJ, "hres = %08x\n", hres);
812  CHECK_CALLED(Host_QS_SecMgr);
813 
815 
818 
819  SET_EXPECT(Host_QS_SecMgr);
820  SET_EXPECT(ProcessUrlAction);
821  hres = parse_script_ae(parser, "Call CreateObject(\"Wine.Test\")");
822  ok(hres == VB_E_CANNOT_CREATE_OBJ, "hres = %08x\n", hres);
823  CHECK_CALLED(Host_QS_SecMgr);
824  CHECK_CALLED(ProcessUrlAction);
825 
827 
829  ProcessUrlAction_policy = URLPOLICY_DISALLOW;
830 
831  SET_EXPECT(Host_QS_SecMgr);
832  SET_EXPECT(ProcessUrlAction);
833  hres = parse_script_ae(parser, "Call CreateObject(\"Wine.Test\")");
834  ok(hres == VB_E_CANNOT_CREATE_OBJ, "hres = %08x\n", hres);
835  CHECK_CALLED(Host_QS_SecMgr);
836  CHECK_CALLED(ProcessUrlAction);
837 
839 
842 
843  SET_EXPECT(Host_QS_SecMgr);
844  SET_EXPECT(ProcessUrlAction);
845  SET_EXPECT(CreateInstance);
846  hres = parse_script_ae(parser, "Call CreateObject(\"Wine.Test\")");
847  ok(hres == VB_E_CANNOT_CREATE_OBJ, "hres = %08x\n", hres);
848  CHECK_CALLED(Host_QS_SecMgr);
849  CHECK_CALLED(ProcessUrlAction);
850  CHECK_CALLED(CreateInstance);
851 
853 
856 
857  SET_EXPECT(Host_QS_SecMgr);
858  SET_EXPECT(ProcessUrlAction);
859  SET_EXPECT(CreateInstance);
860  SET_EXPECT(QueryCustomPolicy);
861  hres = parse_script_ae(parser, "Call CreateObject(\"Wine.Test\")");
862  ok(hres == VB_E_CANNOT_CREATE_OBJ, "hres = %08x\n", hres);
863  CHECK_CALLED(Host_QS_SecMgr);
864  CHECK_CALLED(ProcessUrlAction);
865  CHECK_CALLED(CreateInstance);
866  CHECK_CALLED(QueryCustomPolicy);
867 
869 
872 
873  SET_EXPECT(Host_QS_SecMgr);
874  SET_EXPECT(ProcessUrlAction);
875  SET_EXPECT(CreateInstance);
876  SET_EXPECT(QueryCustomPolicy);
877  SET_EXPECT(QI_IObjectWithSite);
878  SET_EXPECT(reportSuccess);
879  parse_script_a(parser, "Call CreateObject(\"Wine.Test\").reportSuccess()");
880  CHECK_CALLED(Host_QS_SecMgr);
881  CHECK_CALLED(ProcessUrlAction);
882  CHECK_CALLED(CreateInstance);
883  CHECK_CALLED(QueryCustomPolicy);
884  CHECK_CALLED(QI_IObjectWithSite);
885  CHECK_CALLED(reportSuccess);
886 
888 
890  QueryCustomPolicy_policy = URLPOLICY_DISALLOW;
891 
892  SET_EXPECT(Host_QS_SecMgr);
893  SET_EXPECT(ProcessUrlAction);
894  SET_EXPECT(CreateInstance);
895  SET_EXPECT(QueryCustomPolicy);
896  hres = parse_script_ae(parser, "Call CreateObject(\"Wine.Test\")");
897  ok(hres == VB_E_CANNOT_CREATE_OBJ, "hres = %08x\n", hres);
898  CHECK_CALLED(Host_QS_SecMgr);
899  CHECK_CALLED(ProcessUrlAction);
900  CHECK_CALLED(CreateInstance);
901  CHECK_CALLED(QueryCustomPolicy);
902 
904 
905  SET_EXPECT(ProcessUrlAction);
906  SET_EXPECT(CreateInstance);
907  SET_EXPECT(QueryCustomPolicy);
908  hres = parse_script_ae(parser, "Call CreateObject(\"Wine.Test\")");
909  ok(hres == VB_E_CANNOT_CREATE_OBJ, "hres = %08x\n", hres);
910  CHECK_CALLED(ProcessUrlAction);
911  CHECK_CALLED(CreateInstance);
912  CHECK_CALLED(QueryCustomPolicy);
913 
914  QueryCustomPolicy_policy = URLPOLICY_ALLOW;
916 
917  SET_EXPECT(ProcessUrlAction);
918  SET_EXPECT(CreateInstance);
919  SET_EXPECT(QueryCustomPolicy);
920  hres = parse_script_ae(parser, "Call CreateObject(\"Wine.Test\")");
921  ok(hres == VB_E_CANNOT_CREATE_OBJ, "hres = %08x\n", hres);
922  CHECK_CALLED(ProcessUrlAction);
923  CHECK_CALLED(CreateInstance);
924  CHECK_CALLED(QueryCustomPolicy);
925 
927 
929 
930  SET_EXPECT(CreateInstance);
931  SET_EXPECT(QI_IObjectWithSite);
932  SET_EXPECT(reportSuccess);
933  parse_script_a(parser, "Call CreateObject(\"Wine.Test\").reportSuccess()");
934  CHECK_CALLED(CreateInstance);
935  CHECK_CALLED(QI_IObjectWithSite);
936  CHECK_CALLED(reportSuccess);
937 
939 
942 
943  SET_EXPECT(Host_QS_SecMgr);
944  SET_EXPECT(ProcessUrlAction);
945  SET_EXPECT(CreateInstance);
946  SET_EXPECT(QueryCustomPolicy);
947  SET_EXPECT(QI_IObjectWithSite);
948  SET_EXPECT(SetSite);
949  SET_EXPECT(reportSuccess);
950  parse_script_a(parser, "Call CreateObject(\"Wine.Test\").reportSuccess()");
951  CHECK_CALLED(Host_QS_SecMgr);
952  CHECK_CALLED(ProcessUrlAction);
953  CHECK_CALLED(CreateInstance);
954  CHECK_CALLED(QueryCustomPolicy);
955  CHECK_CALLED(QI_IObjectWithSite);
956  CHECK_CALLED(SetSite);
957  CHECK_CALLED(reportSuccess);
958 
960  SET_EXPECT(ProcessUrlAction);
961  SET_EXPECT(CreateInstance);
962  SET_EXPECT(QueryCustomPolicy);
963  SET_EXPECT(QI_IObjectWithSite);
964  SET_EXPECT(SetSite);
965  hres = parse_script_ae(parser, "Call CreateObject(\"Wine.Test\")");
966  ok(hres == VB_E_CANNOT_CREATE_OBJ, "hres = %08x\n", hres);
967  CHECK_CALLED(ProcessUrlAction);
968  CHECK_CALLED(CreateInstance);
969  CHECK_CALLED(QueryCustomPolicy);
970  CHECK_CALLED(QI_IObjectWithSite);
971  CHECK_CALLED(SetSite);
972 
974 }
#define TRUE
Definition: types.h:120
#define E_NOINTERFACE
Definition: winerror.h:2364
static DWORD QueryCustomPolicy_policy
Definition: createobj.c:99
static HRESULT ProcessUrlAction_hres
Definition: createobj.c:94
static DWORD QueryCustomPolicy_psize
Definition: createobj.c:98
#define CHECK_CALLED(func)
Definition: createobj.c:73
static IObjectWithSite ObjectWithSite
Definition: createobj.c:187
static HRESULT QS_SecMgr_hres
Definition: createobj.c:93
#define E_FAIL
Definition: ddrawi.h:102
#define IActiveScriptParse_Release
Definition: createobj.c:44
static DWORD ProcessUrlAction_policy
Definition: createobj.c:95
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define parse_script_a(p, s)
Definition: createobj.c:706
static HRESULT CreateInstance_hres
Definition: createobj.c:96
#define SET_EXPECT(func)
Definition: createobj.c:58
static IObjectWithSite * object_with_site
Definition: createobj.c:189
#define VB_E_CANNOT_CREATE_OBJ
Definition: createobj.c:120
static HRESULT SetSite_hres
Definition: createobj.c:102
#define ok(value,...)
Definition: atltest.h:57
static HRESULT parse_script_ae(IActiveScriptParse *parser, const char *script)
Definition: createobj.c:718
Definition: import.c:86
static HRESULT QueryCustomPolicy_hres
Definition: createobj.c:97
static IActiveScriptParse * create_script(BOOL use_sec_mgr)
Definition: createobj.c:730

Referenced by START_TEST().

◆ Test_GetDispID()

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

Definition at line 288 of file createobj.c.

289 {
290  if(!strcmp_wa(bstrName, "reportSuccess")) {
291  ok(grfdex == fdexNameCaseInsensitive, "grfdex = %x\n", grfdex);
293  return S_OK;
294  }
295 
296  ok(0, "unexpected name %s\n", wine_dbgstr_w(bstrName));
297  return E_NOTIMPL;
298 }
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define DISPID_TEST_REPORTSUCCESS
Definition: createobj.c:116
static int strcmp_wa(LPCWSTR strw, const char *stra)
Definition: createobj.c:134
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ test_GetObject()

static void test_GetObject ( void  )
static

Definition at line 976 of file createobj.c.

977 {
978  IActiveScriptParse *parser;
979  HRESULT hres;
980 
981  /* Never allowed with security manager */
983  hres = parse_script_ae(parser, "Call GetObject(\"clsid:" TESTOBJINST_CLSID "\").reportSuccess()");
984  ok(hres == VB_E_CANNOT_CREATE_OBJ, "hres = %08x\n", hres);
986 
988 
989  SET_EXPECT(QI_IObjectWithSite);
990  SET_EXPECT(SetSite);
991  SET_EXPECT(reportSuccess);
992  hres = parse_script_ae(parser, "Call GetObject(\"clsid:" TESTOBJINST_CLSID "\").reportSuccess()");
993  if(broken(hres == VB_E_ACCESS_DENIED)) /* 64-bit win8 fails on the first try */
994  hres = parse_script_ae(parser, "Call GetObject(\"clsid:" TESTOBJINST_CLSID "\").reportSuccess()");
995  if(hres == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) { /* Workaround for broken win2k */
996  win_skip("got unexpected error %08x\n", hres);
997  CLEAR_CALLED(QI_IObjectWithSite);
998  CLEAR_CALLED(SetSite);
999  CLEAR_CALLED(reportSuccess);
1001  return;
1002  }
1003  ok(hres == S_OK, "hres = %08x\n", hres);
1004  CHECK_CALLED(QI_IObjectWithSite);
1005  CHECK_CALLED(SetSite);
1006  CHECK_CALLED(reportSuccess);
1007 
1008  SetSite_hres = E_FAIL;
1009  SET_EXPECT(QI_IObjectWithSite);
1010  SET_EXPECT(SetSite);
1011  hres = parse_script_ae(parser, "Call GetObject(\"clsid:" TESTOBJINST_CLSID "\").reportSuccess()");
1012  ok(hres == E_FAIL, "hres = %08x\n", hres);
1013  CHECK_CALLED(QI_IObjectWithSite);
1014  CHECK_CALLED(SetSite);
1015 
1017  SET_EXPECT(QI_IObjectWithSite);
1018  SET_EXPECT(reportSuccess);
1019  parse_script_a(parser, "Call GetObject(\"clsid:" TESTOBJINST_CLSID "\").reportSuccess()");
1020  CHECK_CALLED(QI_IObjectWithSite);
1021  CHECK_CALLED(reportSuccess);
1022 
1024 
1025  /* Invalid moniker */
1027  hres = parse_script_ae(parser, "Call GetObject(\"nonexistent:test\").reportSuccess()");
1028  ok(hres == MK_E_SYNTAX, "hres = %08x\n", hres);
1030 }
#define CLEAR_CALLED(func)
Definition: createobj.c:79
#define TRUE
Definition: types.h:120
#define E_NOINTERFACE
Definition: winerror.h:2364
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define CHECK_CALLED(func)
Definition: createobj.c:73
#define E_FAIL
Definition: ddrawi.h:102
#define TESTOBJINST_CLSID
Definition: createobj.c:105
#define IActiveScriptParse_Release
Definition: createobj.c:44
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define parse_script_a(p, s)
Definition: createobj.c:706
static HRESULT QI_IObjectWithSite_hres
Definition: createobj.c:101
#define SET_EXPECT(func)
Definition: createobj.c:58
#define broken(x)
Definition: _sntprintf.h:21
#define VB_E_CANNOT_CREATE_OBJ
Definition: createobj.c:120
static HRESULT SetSite_hres
Definition: createobj.c:102
#define S_OK
Definition: intsafe.h:59
#define VB_E_ACCESS_DENIED
Definition: createobj.c:53
#define ok(value,...)
Definition: atltest.h:57
static HRESULT parse_script_ae(IActiveScriptParse *parser, const char *script)
Definition: createobj.c:718
Definition: import.c:86
#define ERROR_MOD_NOT_FOUND
Definition: compat.h:94
#define MK_E_SYNTAX
Definition: winerror.h:2785
static IActiveScriptParse * create_script(BOOL use_sec_mgr)
Definition: createobj.c:730
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ 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 300 of file createobj.c.

302 {
303  switch(id) {
305  CHECK_EXPECT(reportSuccess);
306 
307  ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags);
308  ok(pdp != NULL, "pdp == NULL\n");
309  ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
310  ok(pdp->cArgs == 0, "cArgs = %d\n", pdp->cArgs);
311  ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
312  ok(!pvarRes, "pvarRes != NULL\n");
313  ok(pei != NULL, "pei == NULL\n");
314  break;
315 
316  default:
317  ok(0, "unexpected call\n");
318  return E_NOTIMPL;
319  }
320 
321  return S_OK;
322 }
#define DISPID_TEST_REPORTSUCCESS
Definition: createobj.c:116
smooth NULL
Definition: ftsmooth.c:416
#define CHECK_EXPECT(func)
Definition: createobj.c:67
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

Variable Documentation

◆ ActiveScriptSite

IActiveScriptSite ActiveScriptSite = { &ActiveScriptSiteVtbl }
static

Definition at line 675 of file createobj.c.

Referenced by create_script().

◆ ActiveScriptSiteVtbl

const IActiveScriptSiteVtbl ActiveScriptSiteVtbl
static
Initial value:
= {
}
static HRESULT WINAPI ActiveScriptSite_OnEnterScript(IActiveScriptSite *iface)
Definition: createobj.c:651
static HRESULT WINAPI ActiveScriptSite_GetLCID(IActiveScriptSite *iface, LCID *plcid)
Definition: createobj.c:613
static HRESULT WINAPI ActiveScriptSite_OnScriptError(IActiveScriptSite *iface, IActiveScriptError *pscripterror)
Definition: createobj.c:646
static HRESULT WINAPI ActiveScriptSite_GetDocVersionString(IActiveScriptSite *iface, BSTR *pbstrVersion)
Definition: createobj.c:630
static ULONG WINAPI ActiveScriptSite_AddRef(IActiveScriptSite *iface)
Definition: createobj.c:603
static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface)
Definition: createobj.c:608
static HRESULT WINAPI ActiveScriptSite_OnLeaveScript(IActiveScriptSite *iface)
Definition: createobj.c:656
static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, REFIID riid, void **ppv)
Definition: createobj.c:586
static HRESULT WINAPI ActiveScriptSite_OnStateChange(IActiveScriptSite *iface, SCRIPTSTATE ssScriptState)
Definition: createobj.c:641
static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown **ppiunkItem, ITypeInfo **ppti)
Definition: createobj.c:619
static HRESULT WINAPI ActiveScriptSite_OnScriptTerminate(IActiveScriptSite *iface, const VARIANT *pvarResult, const EXCEPINFO *pexcepinfo)
Definition: createobj.c:635

Definition at line 661 of file createobj.c.

◆ activex_cf

IClassFactory activex_cf = { &ClassFactoryVtbl }
static

Definition at line 450 of file createobj.c.

Referenced by register_activex().

◆ ClassFactoryVtbl

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

Definition at line 442 of file createobj.c.

◆ CLSID_TestObj

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

Definition at line 107 of file createobj.c.

Referenced by InternetHostSecurityManager_ProcessUrlAction(), and register_activex().

◆ CLSID_TestObjInst

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

Definition at line 109 of file createobj.c.

Referenced by register_activex().

◆ CLSID_VBScript

◆ CreateInstance_hres

HRESULT CreateInstance_hres
static

Definition at line 96 of file createobj.c.

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

◆ globalObj

IDispatchEx globalObj = { &globalObjVtbl }
static

Definition at line 400 of file createobj.c.

Referenced by ActiveScriptSite_GetItemInfo().

◆ globalObjVtbl

IDispatchExVtbl globalObjVtbl
static
Initial value:
= {
}
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
Definition: createobj.c:270
static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
Definition: createobj.c:223
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
Definition: createobj.c:282
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
Definition: createobj.c:213
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
Definition: createobj.c:258
static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: createobj.c:356
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
Definition: createobj.c:218
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
Definition: createobj.c:252
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: createobj.c:236
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: createobj.c:229
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
Definition: createobj.c:191
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
Definition: createobj.c:264
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
Definition: createobj.c:276
static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: createobj.c:344
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: createobj.c:244

Definition at line 382 of file createobj.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 113 of file createobj.c.

Referenced by InternetHostSecurityManager_QueryCustomPolicy().

◆ InternetHostSecurityManager

IInternetHostSecurityManager InternetHostSecurityManager = { &InternetHostSecurityManagerVtbl }
static

Definition at line 536 of file createobj.c.

Referenced by ServiceProvider_QueryService().

◆ InternetHostSecurityManagerVtbl

const IInternetHostSecurityManagerVtbl InternetHostSecurityManagerVtbl
static
Initial value:
= {
}
static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHostSecurityManager *iface, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwReserved)
Definition: createobj.c:494
static HRESULT WINAPI InternetHostSecurityManager_ProcessUrlAction(IInternetHostSecurityManager *iface, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved)
Definition: createobj.c:475
static HRESULT WINAPI InternetHostSecurityManager_GetSecurityId(IInternetHostSecurityManager *iface, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
Definition: createobj.c:468
static ULONG WINAPI InternetHostSecurityManager_AddRef(IInternetHostSecurityManager *iface)
Definition: createobj.c:458
static ULONG WINAPI InternetHostSecurityManager_Release(IInternetHostSecurityManager *iface)
Definition: createobj.c:463
static HRESULT WINAPI InternetHostSecurityManager_QueryInterface(IInternetHostSecurityManager *iface, REFIID riid, void **ppv)
Definition: createobj.c:452

Definition at line 527 of file createobj.c.

◆ object_with_site

IObjectWithSite* object_with_site
static

Definition at line 189 of file createobj.c.

Referenced by DispatchEx_QueryInterface(), and test_CreateObject().

◆ ObjectWithSite

IObjectWithSite ObjectWithSite = { &ObjectWithSiteVtbl }
static

Definition at line 187 of file createobj.c.

Referenced by test_CreateObject().

◆ ObjectWithSiteVtbl

const IObjectWithSiteVtbl ObjectWithSiteVtbl
static
Initial value:
= {
}
static HRESULT WINAPI ObjectWithSite_SetSite(IObjectWithSite *iface, IUnknown *pUnkSite)
Definition: createobj.c:157
static HRESULT WINAPI ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID riid, void **ppv)
Definition: createobj.c:141
static HRESULT WINAPI ObjectWithSite_GetSite(IObjectWithSite *iface, REFIID riid, void **ppvSite)
Definition: createobj.c:173
static ULONG WINAPI ObjectWithSite_Release(IObjectWithSite *iface)
Definition: createobj.c:152
static ULONG WINAPI ObjectWithSite_AddRef(IObjectWithSite *iface)
Definition: createobj.c:147

Definition at line 179 of file createobj.c.

◆ ProcessUrlAction_hres

HRESULT ProcessUrlAction_hres
static

◆ ProcessUrlAction_policy

DWORD ProcessUrlAction_policy
static

◆ QI_IDispatch_hres

HRESULT QI_IDispatch_hres
static

Definition at line 100 of file createobj.c.

Referenced by create_script(), and DispatchEx_QueryInterface().

◆ QI_IObjectWithSite_hres

HRESULT QI_IObjectWithSite_hres
static

Definition at line 101 of file createobj.c.

Referenced by create_script(), DispatchEx_QueryInterface(), and test_GetObject().

◆ QS_SecMgr_hres

HRESULT QS_SecMgr_hres
static

Definition at line 93 of file createobj.c.

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

◆ 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 538 of file createobj.c.

Referenced by ActiveScriptSite_QueryInterface(), and ServiceProvider_QueryService().

◆ ServiceProviderVtbl

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

Definition at line 577 of file createobj.c.

◆ SetSite_hres

HRESULT SetSite_hres
static

◆ testObj

IDispatchEx testObj = { &testObjVtbl }
static

Definition at line 342 of file createobj.c.

Referenced by ClassFactory_CreateInstance(), and register_activex().

◆ testObjVtbl

IDispatchExVtbl testObjVtbl
static
Initial value:
= {
}
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
Definition: createobj.c:270
static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
Definition: createobj.c:223
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
Definition: createobj.c:282
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
Definition: createobj.c:213
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
Definition: createobj.c:258
static HRESULT WINAPI Test_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: createobj.c:288
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
Definition: createobj.c:218
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
Definition: createobj.c:252
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: createobj.c:236
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: createobj.c:229
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
Definition: createobj.c:191
static HRESULT WINAPI Test_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
Definition: createobj.c:300
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
Definition: createobj.c:264
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
Definition: createobj.c:276
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: createobj.c:244

Definition at line 324 of file createobj.c.

◆ testW

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

Definition at line 91 of file createobj.c.

Referenced by create_script().