2 * Copyright 2008 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #include "wine/test.h"
27 static const CLSID CLSID_JScript
=
28 {0xf414c260,0x6ac0,0x11cf,{0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58}};
30 static void test_safety(IUnknown
*unk
)
32 IObjectSafety
*safety
;
33 DWORD supported
, enabled
;
36 hres
= IUnknown_QueryInterface(unk
, &IID_IObjectSafety
, (void**)&safety
);
37 ok(hres
== S_OK
, "Could not get IObjectSafety: %08x\n", hres
);
41 hres
= IObjectSafety_GetInterfaceSafetyOptions(safety
, &IID_NULL
, &supported
, NULL
);
42 ok(hres
== E_POINTER
, "GetInterfaceSafetyOptions failed: %08x, expected E_POINTER\n", hres
);
43 hres
= IObjectSafety_GetInterfaceSafetyOptions(safety
, &IID_NULL
, NULL
, &enabled
);
44 ok(hres
== E_POINTER
, "GetInterfaceSafetyOptions failed: %08x, expected E_POINTER\n", hres
);
46 supported
= enabled
= 0xdeadbeef;
47 hres
= IObjectSafety_GetInterfaceSafetyOptions(safety
, &IID_NULL
, &supported
, &enabled
);
48 ok(hres
== S_OK
, "GetInterfaceSafetyOptions failed: %08x\n", hres
);
49 ok(supported
== (INTERFACESAFE_FOR_UNTRUSTED_DATA
|INTERFACE_USES_DISPEX
|INTERFACE_USES_SECURITY_MANAGER
),
50 "supported=%x\n", supported
);
51 ok(enabled
== INTERFACE_USES_DISPEX
, "enabled=%x\n", enabled
);
53 supported
= enabled
= 0xdeadbeef;
54 hres
= IObjectSafety_GetInterfaceSafetyOptions(safety
, &IID_IActiveScript
, &supported
, &enabled
);
55 ok(hres
== S_OK
, "GetInterfaceSafetyOptions failed: %08x\n", hres
);
56 ok(supported
== (INTERFACESAFE_FOR_UNTRUSTED_DATA
|INTERFACE_USES_DISPEX
|INTERFACE_USES_SECURITY_MANAGER
),
57 "supported=%x\n", supported
);
58 ok(enabled
== INTERFACE_USES_DISPEX
, "enabled=%x\n", enabled
);
60 supported
= enabled
= 0xdeadbeef;
61 hres
= IObjectSafety_GetInterfaceSafetyOptions(safety
, &IID_IActiveScriptParse
, &supported
, &enabled
);
62 ok(hres
== S_OK
, "GetInterfaceSafetyOptions failed: %08x\n", hres
);
63 ok(supported
== (INTERFACESAFE_FOR_UNTRUSTED_DATA
|INTERFACE_USES_DISPEX
|INTERFACE_USES_SECURITY_MANAGER
),
64 "supported=%x\n", supported
);
65 ok(enabled
== INTERFACE_USES_DISPEX
, "enabled=%x\n", enabled
);
67 hres
= IObjectSafety_SetInterfaceSafetyOptions(safety
, &IID_IActiveScriptParse
,
68 INTERFACESAFE_FOR_UNTRUSTED_DATA
|INTERFACE_USES_DISPEX
|INTERFACE_USES_SECURITY_MANAGER
69 |INTERFACESAFE_FOR_UNTRUSTED_CALLER
,
70 INTERFACESAFE_FOR_UNTRUSTED_DATA
|INTERFACE_USES_DISPEX
|INTERFACE_USES_SECURITY_MANAGER
);
71 ok(hres
== E_FAIL
, "SetInterfaceSafetyOptions failed: %08x\n, expected E_FAIL", hres
);
73 hres
= IObjectSafety_SetInterfaceSafetyOptions(safety
, &IID_IActiveScriptParse
,
74 INTERFACESAFE_FOR_UNTRUSTED_DATA
|INTERFACE_USES_DISPEX
|INTERFACE_USES_SECURITY_MANAGER
,
75 INTERFACESAFE_FOR_UNTRUSTED_DATA
|INTERFACE_USES_DISPEX
|INTERFACE_USES_SECURITY_MANAGER
);
76 ok(hres
== S_OK
, "SetInterfaceSafetyOptions failed: %08x\n", hres
);
78 supported
= enabled
= 0xdeadbeef;
79 hres
= IObjectSafety_GetInterfaceSafetyOptions(safety
, &IID_IActiveScriptParse
, &supported
, &enabled
);
80 ok(hres
== S_OK
, "GetInterfaceSafetyOptions failed: %08x\n", hres
);
81 ok(supported
== (INTERFACESAFE_FOR_UNTRUSTED_DATA
|INTERFACE_USES_DISPEX
|INTERFACE_USES_SECURITY_MANAGER
),
82 "supported=%x\n", supported
);
83 ok(enabled
== (INTERFACESAFE_FOR_UNTRUSTED_DATA
|INTERFACE_USES_DISPEX
|INTERFACE_USES_SECURITY_MANAGER
),
84 "enabled=%x\n", enabled
);
86 IObjectSafety_Release(safety
);
89 static void test_jscript(void)
91 IActiveScriptParse
*parse
;
92 IActiveScript
*script
;
96 hres
= CoCreateInstance(&CLSID_JScript
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
97 &IID_IUnknown
, (void**)&unk
);
98 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
102 hres
= IUnknown_QueryInterface(unk
, &IID_IActiveScript
, (void**)&script
);
103 ok(hres
== S_OK
, "Could not get IActiveScript: %08x\n", hres
);
105 hres
= IUnknown_QueryInterface(unk
, &IID_IActiveScriptParse
, (void**)&parse
);
106 ok(hres
== S_OK
, "Could not get IActiveScriptParse: %08x\n", hres
);
110 IActiveScriptParse_Release(parse
);
111 IActiveScript_Release(script
);
112 IUnknown_Release(unk
);