46{
57
60 ok(
hr ==
S_OK,
"CoCreateInstance failed with %x\n",
hr);
61 ok(pUnkOuter !=
NULL,
"pUnkOuter is NULL\n");
62
63 if (!pUnkOuter)
64 {
65 skip(
"pUnkOuter is NULL\n");
66 return;
67 }
68
69
71 &iidInner, (
LPVOID*)&pUnkInnerFail);
73 {
74 skip(
"Class not registered\n");
75 return;
76 }
78 ok(pUnkInnerFail ==
NULL,
"pUnkInnerFail is not NULL\n");
79
80
83 ok(
hr ==
S_OK,
"CoCreateInstance returned %x\n",
hr);
84 ok(pUnkInner !=
NULL,
"pUnkInner is NULL\n");
85
86 if (!pUnkInner)
87 {
88 skip(
"pUnkInner is NULL\n");
89 return;
90 }
91
96
97 QI_FAIL(pUnkOuter, iidInner, pUnkAggregatee);
98 QI_FAIL(pUnkInner, iidOuter, pUnkAggregator);
99
100
101 QI_SUCCEED(pUnkOuter, iidOuter, pUnkAggregator);
103
105 {
106 hr = IUnknown_QueryInterface(pUnkInner, &iidInner, (
LPVOID*)&pUnkAggregatee);
108 ok(pUnkAggregatee !=
NULL ||
broken(!pUnkAggregatee),
"Pointer is NULL\n");
109 }
110 else
111 {
112 QI_SUCCEED(pUnkInner, iidInner, pUnkAggregatee);
113 }
115
116 if (!pUnkAggregator || !pUnkOuterTest || !pUnkAggregatee
117 || !pUnkInnerTest)
118 {
119 skip(
"One of the required interfaces is NULL\n");
120 return;
121 }
122
131
136
137 QI_FAIL(pUnkAggregator, iidInner, pUnkTest);
138 QI_FAIL(pUnkOuterTest, iidInner, pUnkTest);
139 QI_FAIL(pUnkAggregatee, iidInner, pUnkTest);
140 QI_SUCCEED(pUnkInnerTest, iidInner, pUnkTest);
141
142 QI_SUCCEED(pUnkAggregator, iidOuter, pUnkTest);
143 QI_SUCCEED(pUnkOuterTest, iidOuter, pUnkTest);
144 QI_SUCCEED(pUnkAggregatee, iidOuter, pUnkTest);
145 QI_FAIL(pUnkInnerTest, iidOuter, pUnkTest);
146
153
154 do
155 {
156 refCount = IUnknown_Release(pUnkInner);
157 } while (refCount);
158
159 do
160 {
161 refCount = IUnknown_Release(pUnkOuter);
162 } while (refCount);
163}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
#define RELEASE_EXPECT(iface, num)
#define QI_FAIL(iface, riid, ppv)
#define QI_SUCCEED(iface, riid, ppv)
#define ADDREF_EXPECT(iface, num)
#define IsEqualGUID(rguid1, rguid2)
#define REGDB_E_CLASSNOTREG