atl100: Fixed AtlAdvise and AtlUnadvise crashing with NULL pUnkCP.
[wine.git] / dlls / atl100 / tests / atl.c
blob4cf4a62ee01ce286ed3a0fece7b6b6b5c7c0d87a
1 /*
2 * Copyright 2012 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
19 #include <stdarg.h>
20 #include <stdio.h>
22 #define COBJMACROS
23 #define CONST_VTABLE
25 #include <windef.h>
26 #include <winbase.h>
27 #include <winuser.h>
29 #include <atlbase.h>
30 #include <mshtml.h>
32 #include <wine/test.h>
34 static const GUID CLSID_Test =
35 {0x178fc163,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
36 #define CLSID_TEST_STR "178fc163-0000-0000-0000-000000000046"
38 static const GUID CATID_CatTest1 =
39 {0x178fc163,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x46}};
40 #define CATID_CATTEST1_STR "178fc163-0000-0000-0000-000000000146"
42 static const GUID CATID_CatTest2 =
43 {0x178fc163,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x46}};
44 #define CATID_CATTEST2_STR "178fc163-0000-0000-0000-000000000246"
46 static const char *debugstr_guid(REFIID riid)
48 static char buf[50];
50 if(!riid)
51 return "(null)";
53 sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
54 riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
55 riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
56 riid->Data4[5], riid->Data4[6], riid->Data4[7]);
58 return buf;
61 static void test_winmodule(void)
63 _AtlCreateWndData create_data[3];
64 _ATL_WIN_MODULE winmod;
65 void *p;
66 HRESULT hres;
68 winmod.cbSize = 0xdeadbeef;
69 hres = AtlWinModuleInit(&winmod);
70 ok(hres == E_INVALIDARG, "AtlWinModuleInit failed: %08x\n", hres);
72 winmod.cbSize = sizeof(winmod);
73 winmod.m_pCreateWndList = (void*)0xdeadbeef;
74 winmod.m_csWindowCreate.LockCount = 0xdeadbeef;
75 winmod.m_rgWindowClassAtoms.m_aT = (void*)0xdeadbeef;
76 winmod.m_rgWindowClassAtoms.m_nSize = 0xdeadbeef;
77 winmod.m_rgWindowClassAtoms.m_nAllocSize = 0xdeadbeef;
78 hres = AtlWinModuleInit(&winmod);
79 ok(hres == S_OK, "AtlWinModuleInit failed: %08x\n", hres);
80 ok(!winmod.m_pCreateWndList, "winmod.m_pCreateWndList = %p\n", winmod.m_pCreateWndList);
81 ok(winmod.m_csWindowCreate.LockCount == -1, "winmod.m_csWindowCreate.LockCount = %d\n",
82 winmod.m_csWindowCreate.LockCount);
83 ok(winmod.m_rgWindowClassAtoms.m_aT == (void*)0xdeadbeef, "winmod.m_rgWindowClassAtoms.m_aT = %p\n",
84 winmod.m_rgWindowClassAtoms.m_aT);
85 ok(winmod.m_rgWindowClassAtoms.m_nSize == 0xdeadbeef, "winmod.m_rgWindowClassAtoms.m_nSize = %d\n",
86 winmod.m_rgWindowClassAtoms.m_nSize);
87 ok(winmod.m_rgWindowClassAtoms.m_nAllocSize == 0xdeadbeef, "winmod.m_rgWindowClassAtoms.m_nAllocSize = %d\n",
88 winmod.m_rgWindowClassAtoms.m_nAllocSize);
90 InitializeCriticalSection(&winmod.m_csWindowCreate);
92 AtlWinModuleAddCreateWndData(&winmod, create_data, (void*)0xdead0001);
93 ok(winmod.m_pCreateWndList == create_data, "winmod.m_pCreateWndList != create_data\n");
94 ok(create_data[0].m_pThis == (void*)0xdead0001, "unexpected create_data[0].m_pThis %p\n", create_data[0].m_pThis);
95 ok(create_data[0].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[0].m_dwThreadID %x\n",
96 create_data[0].m_dwThreadID);
97 ok(!create_data[0].m_pNext, "unexpected create_data[0].m_pNext %p\n", create_data[0].m_pNext);
99 AtlWinModuleAddCreateWndData(&winmod, create_data+1, (void*)0xdead0002);
100 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
101 ok(create_data[1].m_pThis == (void*)0xdead0002, "unexpected create_data[1].m_pThis %p\n", create_data[1].m_pThis);
102 ok(create_data[1].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[1].m_dwThreadID %x\n",
103 create_data[1].m_dwThreadID);
104 ok(create_data[1].m_pNext == create_data, "unexpected create_data[1].m_pNext %p\n", create_data[1].m_pNext);
106 AtlWinModuleAddCreateWndData(&winmod, create_data+2, (void*)0xdead0003);
107 ok(winmod.m_pCreateWndList == create_data+2, "winmod.m_pCreateWndList != create_data\n");
108 ok(create_data[2].m_pThis == (void*)0xdead0003, "unexpected create_data[2].m_pThis %p\n", create_data[2].m_pThis);
109 ok(create_data[2].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[2].m_dwThreadID %x\n",
110 create_data[2].m_dwThreadID);
111 ok(create_data[2].m_pNext == create_data+1, "unexpected create_data[2].m_pNext %p\n", create_data[2].m_pNext);
113 p = AtlWinModuleExtractCreateWndData(&winmod);
114 ok(p == (void*)0xdead0003, "unexpected AtlWinModuleExtractCreateWndData result %p\n", p);
115 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
116 ok(create_data[2].m_pNext == create_data+1, "unexpected create_data[2].m_pNext %p\n", create_data[2].m_pNext);
118 create_data[1].m_dwThreadID = 0xdeadbeef;
120 p = AtlWinModuleExtractCreateWndData(&winmod);
121 ok(p == (void*)0xdead0001, "unexpected AtlWinModuleExtractCreateWndData result %p\n", p);
122 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
123 ok(!create_data[0].m_pNext, "unexpected create_data[0].m_pNext %p\n", create_data[0].m_pNext);
124 ok(!create_data[1].m_pNext, "unexpected create_data[1].m_pNext %p\n", create_data[1].m_pNext);
126 p = AtlWinModuleExtractCreateWndData(&winmod);
127 ok(!p, "unexpected AtlWinModuleExtractCreateWndData result %p\n", p);
128 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
131 #define test_key_exists(a,b) _test_key_exists(__LINE__,a,b)
132 static void _test_key_exists(unsigned line, HKEY root, const char *key_name)
134 HKEY key;
135 DWORD res;
137 res = RegOpenKeyA(root, key_name, &key);
138 ok_(__FILE__,line)(res == ERROR_SUCCESS, "Could not open key %s\n", key_name);
139 if(res == ERROR_SUCCESS)
140 RegCloseKey(key);
143 #define test_key_not_exists(a,b) _test_key_not_exists(__LINE__,a,b)
144 static void _test_key_not_exists(unsigned line, HKEY root, const char *key_name)
146 HKEY key;
147 DWORD res;
149 res = RegOpenKeyA(root, key_name, &key);
150 ok_(__FILE__,line)(res == ERROR_FILE_NOT_FOUND, "Attempting to open %s returned %u\n", key_name, res);
151 if(res == ERROR_SUCCESS)
152 RegCloseKey(key);
155 static void test_regcat(void)
157 unsigned char b;
158 HRESULT hres;
160 const struct _ATL_CATMAP_ENTRY catmap[] = {
161 {_ATL_CATMAP_ENTRY_IMPLEMENTED, &CATID_CatTest1},
162 {_ATL_CATMAP_ENTRY_REQUIRED, &CATID_CatTest2},
163 {_ATL_CATMAP_ENTRY_END}
166 hres = AtlRegisterClassCategoriesHelper(&CLSID_Test, catmap, TRUE);
167 ok(hres == S_OK, "AtlRegisterClassCategoriesHelper failed: %08x\n", hres);
169 test_key_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}");
170 test_key_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}\\Implemented Categories\\{" CATID_CATTEST1_STR "}");
171 test_key_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}\\Required Categories\\{" CATID_CATTEST2_STR "}");
173 hres = AtlRegisterClassCategoriesHelper(&CLSID_Test, catmap, FALSE);
174 ok(hres == S_OK, "AtlRegisterClassCategoriesHelper failed: %08x\n", hres);
176 test_key_not_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}\\Implemented Categories");
177 test_key_not_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}\\Required Categories");
178 test_key_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}");
180 ok(RegDeleteKeyA(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}") == ERROR_SUCCESS, "Could not delete key\n");
182 hres = AtlRegisterClassCategoriesHelper(&CLSID_Test, NULL, TRUE);
183 ok(hres == S_OK, "AtlRegisterClassCategoriesHelper failed: %08x\n", hres);
185 test_key_not_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}");
187 b = 10;
188 hres = AtlGetPerUserRegistration(&b);
189 ok(hres == S_OK, "AtlGetPerUserRegistration failed: %08x\n", hres);
190 ok(!b, "AtlGetPerUserRegistration returned %x\n", b);
193 static void test_typelib(void)
195 ITypeLib *typelib;
196 HINSTANCE inst;
197 size_t len;
198 BSTR path;
199 HRESULT hres;
201 static const WCHAR scrrun_dll_suffixW[] = {'\\','s','c','r','r','u','n','.','d','l','l',0};
202 static const WCHAR mshtml_tlb_suffixW[] = {'\\','m','s','h','t','m','l','.','t','l','b',0};
204 inst = LoadLibraryA("scrrun.dll");
205 ok(inst != NULL, "Could not load scrrun.dll\n");
207 typelib = NULL;
208 hres = AtlLoadTypeLib(inst, NULL, &path, &typelib);
209 ok(hres == S_OK, "AtlLoadTypeLib failed: %08x\n", hres);
210 FreeLibrary(inst);
212 len = SysStringLen(path);
213 ok(len > sizeof(scrrun_dll_suffixW)/sizeof(WCHAR)
214 && lstrcmpiW(path+len-sizeof(scrrun_dll_suffixW)/sizeof(WCHAR), scrrun_dll_suffixW),
215 "unexpected path %s\n", wine_dbgstr_w(path));
216 SysFreeString(path);
217 ok(typelib != NULL, "typelib == NULL\n");
218 ITypeLib_Release(typelib);
220 inst = LoadLibraryA("mshtml.dll");
221 ok(inst != NULL, "Could not load mshtml.dll\n");
223 typelib = NULL;
224 hres = AtlLoadTypeLib(inst, NULL, &path, &typelib);
225 ok(hres == S_OK, "AtlLoadTypeLib failed: %08x\n", hres);
226 FreeLibrary(inst);
228 len = SysStringLen(path);
229 ok(len > sizeof(mshtml_tlb_suffixW)/sizeof(WCHAR)
230 && lstrcmpiW(path+len-sizeof(mshtml_tlb_suffixW)/sizeof(WCHAR), mshtml_tlb_suffixW),
231 "unexpected path %s\n", wine_dbgstr_w(path));
232 SysFreeString(path);
233 ok(typelib != NULL, "typelib == NULL\n");
234 ITypeLib_Release(typelib);
237 static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface, REFIID riid, void **ppv)
239 if(IsEqualGUID(&IID_IConnectionPoint, riid)) {
240 *ppv = iface;
241 return S_OK;
244 ok(0, "unexpected call\n");
245 return E_NOINTERFACE;
248 static ULONG WINAPI ConnectionPoint_AddRef(IConnectionPoint *iface)
250 return 2;
253 static ULONG WINAPI ConnectionPoint_Release(IConnectionPoint *iface)
255 return 1;
258 static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *iface, IID *pIID)
260 ok(0, "unexpected call\n");
261 return E_NOTIMPL;
264 static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoint *iface,
265 IConnectionPointContainer **ppCPC)
267 ok(0, "unexpected call\n");
268 return E_NOTIMPL;
271 static int advise_cnt;
273 static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *pUnkSink,
274 DWORD *pdwCookie)
276 ok(pUnkSink == (IUnknown*)0xdead0000, "pUnkSink = %p\n", pUnkSink);
277 *pdwCookie = 0xdeadbeef;
278 advise_cnt++;
279 return S_OK;
282 static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD dwCookie)
284 ok(dwCookie == 0xdeadbeef, "dwCookie = %x\n", dwCookie);
285 advise_cnt--;
286 return S_OK;
289 static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface,
290 IEnumConnections **ppEnum)
292 ok(0, "unexpected call\n");
293 return E_NOTIMPL;
296 static const IConnectionPointVtbl ConnectionPointVtbl =
298 ConnectionPoint_QueryInterface,
299 ConnectionPoint_AddRef,
300 ConnectionPoint_Release,
301 ConnectionPoint_GetConnectionInterface,
302 ConnectionPoint_GetConnectionPointContainer,
303 ConnectionPoint_Advise,
304 ConnectionPoint_Unadvise,
305 ConnectionPoint_EnumConnections
308 static IConnectionPoint ConnectionPoint = { &ConnectionPointVtbl };
310 static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface,
311 REFIID riid, void **ppv)
313 if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
314 *ppv = iface;
315 return S_OK;
318 ok(0, "unexpected call\n");
319 return E_NOTIMPL;
322 static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
324 return 2;
327 static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
329 return 1;
332 static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface,
333 IEnumConnectionPoints **ppEnum)
335 ok(0, "unexpected call\n");
336 return E_NOTIMPL;
339 static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface,
340 REFIID riid, IConnectionPoint **ppCP)
342 ok(IsEqualGUID(riid, &CLSID_Test), "unexpected riid\n");
343 *ppCP = &ConnectionPoint;
344 return S_OK;
347 static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = {
348 ConnectionPointContainer_QueryInterface,
349 ConnectionPointContainer_AddRef,
350 ConnectionPointContainer_Release,
351 ConnectionPointContainer_EnumConnectionPoints,
352 ConnectionPointContainer_FindConnectionPoint
355 static IConnectionPointContainer ConnectionPointContainer = { &ConnectionPointContainerVtbl };
357 static void test_cp(void)
359 DWORD cookie = 0;
360 HRESULT hres;
362 hres = AtlAdvise(NULL, (IUnknown*)0xdeed0000, &CLSID_Test, &cookie);
363 ok(hres == E_INVALIDARG, "expect E_INVALIDARG, returned %08x\n", hres);
365 hres = AtlUnadvise(NULL, &CLSID_Test, 0xdeadbeef);
366 ok(hres == E_INVALIDARG, "expect E_INVALIDARG, returned %08x\n", hres);
368 hres = AtlAdvise((IUnknown*)&ConnectionPointContainer, (IUnknown*)0xdead0000, &CLSID_Test, &cookie);
369 ok(hres == S_OK, "AtlAdvise failed: %08x\n", hres);
370 ok(cookie == 0xdeadbeef, "cookie = %x\n", cookie);
371 ok(advise_cnt == 1, "advise_cnt = %d\n", advise_cnt);
373 hres = AtlUnadvise((IUnknown*)&ConnectionPointContainer, &CLSID_Test, 0xdeadbeef);
374 ok(hres == S_OK, "AtlUnadvise failed: %08x\n", hres);
375 ok(!advise_cnt, "advise_cnt = %d\n", advise_cnt);
378 static CLSID persist_clsid;
380 static HRESULT WINAPI Persist_QueryInterface(IPersist *iface, REFIID riid, void **ppv)
382 ok(0, "unexpected call\n");
383 return E_NOINTERFACE;
386 static ULONG WINAPI Persist_AddRef(IPersist *iface)
388 return 2;
391 static ULONG WINAPI Persist_Release(IPersist *iface)
393 return 1;
396 static HRESULT WINAPI Persist_GetClassID(IPersist *iface, CLSID *pClassID)
398 *pClassID = persist_clsid;
399 return S_OK;
402 static const IPersistVtbl PersistVtbl = {
403 Persist_QueryInterface,
404 Persist_AddRef,
405 Persist_Release,
406 Persist_GetClassID
409 static IPersist Persist = { &PersistVtbl };
411 static HRESULT WINAPI ProvideClassInfo2_QueryInterface(IProvideClassInfo2 *iface, REFIID riid, void **ppv)
413 ok(0, "unexpected call\n");
414 return E_NOINTERFACE;
417 static ULONG WINAPI ProvideClassInfo2_AddRef(IProvideClassInfo2 *iface)
419 return 2;
422 static ULONG WINAPI ProvideClassInfo2_Release(IProvideClassInfo2 *iface)
424 return 1;
427 static HRESULT WINAPI ProvideClassInfo2_GetClassInfo(IProvideClassInfo2 *iface, ITypeInfo **ppTI)
429 ok(0, "unexpected call\n");
430 return E_NOTIMPL;
433 static HRESULT WINAPI ProvideClassInfo2_GetGUID(IProvideClassInfo2 *iface, DWORD dwGuidKind, GUID *pGUID)
435 ok(dwGuidKind == GUIDKIND_DEFAULT_SOURCE_DISP_IID, "unexpected dwGuidKind %x\n", dwGuidKind);
436 *pGUID = DIID_DispHTMLBody;
437 return S_OK;
440 static const IProvideClassInfo2Vtbl ProvideClassInfo2Vtbl = {
441 ProvideClassInfo2_QueryInterface,
442 ProvideClassInfo2_AddRef,
443 ProvideClassInfo2_Release,
444 ProvideClassInfo2_GetClassInfo,
445 ProvideClassInfo2_GetGUID
448 static IProvideClassInfo2 ProvideClassInfo2 = { &ProvideClassInfo2Vtbl };
449 static BOOL support_classinfo2;
451 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
453 *ppv = NULL;
455 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
456 *ppv = iface;
457 return S_OK;
460 if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
461 if(!support_classinfo2)
462 return E_NOINTERFACE;
463 *ppv = &ProvideClassInfo2;
464 return S_OK;
467 if(IsEqualGUID(&IID_IPersist, riid)) {
468 *ppv = &Persist;
469 return S_OK;
472 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
473 return E_NOINTERFACE;
476 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
478 return 2;
481 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
483 return 1;
486 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
488 ok(0, "unexpected call\n");
489 return E_NOTIMPL;
492 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
493 ITypeInfo **ppTInfo)
495 ITypeLib *typelib;
496 HRESULT hres;
498 static const WCHAR mshtml_tlbW[] = {'m','s','h','t','m','l','.','t','l','b',0};
500 ok(!iTInfo, "iTInfo = %d\n", iTInfo);
501 ok(!lcid, "lcid = %x\n", lcid);
503 hres = LoadTypeLib(mshtml_tlbW, &typelib);
504 ok(hres == S_OK, "LoadTypeLib failed: %08x\n", hres);
506 hres = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IHTMLElement, ppTInfo);
507 ok(hres == S_OK, "GetTypeInfoOfGuid failed: %08x\n", hres);
509 ITypeLib_Release(typelib);
510 return S_OK;
513 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
514 UINT cNames, LCID lcid, DISPID *rgDispId)
516 ok(0, "unexpected call\n");
517 return E_NOTIMPL;
520 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
521 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
522 EXCEPINFO *pExcepInfo, UINT *puArgErr)
524 ok(0, "unexpected call\n");
525 return E_NOTIMPL;
528 static const IDispatchVtbl DispatchVtbl = {
529 Dispatch_QueryInterface,
530 Dispatch_AddRef,
531 Dispatch_Release,
532 Dispatch_GetTypeInfoCount,
533 Dispatch_GetTypeInfo,
534 Dispatch_GetIDsOfNames,
535 Dispatch_Invoke
538 static IDispatch Dispatch = { &DispatchVtbl };
540 static void test_source_iface(void)
542 unsigned short maj_ver, min_ver;
543 IID libid, iid;
544 HRESULT hres;
546 support_classinfo2 = TRUE;
548 maj_ver = min_ver = 0xdead;
549 hres = AtlGetObjectSourceInterface((IUnknown*)&Dispatch, &libid, &iid, &maj_ver, &min_ver);
550 ok(hres == S_OK, "AtlGetObjectSourceInterface failed: %08x\n", hres);
551 ok(IsEqualGUID(&libid, &LIBID_MSHTML), "libid = %s\n", debugstr_guid(&libid));
552 ok(IsEqualGUID(&iid, &DIID_DispHTMLBody), "iid = %s\n", debugstr_guid(&iid));
553 ok(maj_ver == 4 && min_ver == 0, "ver = %d.%d\n", maj_ver, min_ver);
555 support_classinfo2 = FALSE;
556 persist_clsid = CLSID_HTMLDocument;
558 maj_ver = min_ver = 0xdead;
559 hres = AtlGetObjectSourceInterface((IUnknown*)&Dispatch, &libid, &iid, &maj_ver, &min_ver);
560 ok(hres == S_OK, "AtlGetObjectSourceInterface failed: %08x\n", hres);
561 ok(IsEqualGUID(&libid, &LIBID_MSHTML), "libid = %s\n", debugstr_guid(&libid));
562 ok(IsEqualGUID(&iid, &DIID_HTMLDocumentEvents), "iid = %s\n", debugstr_guid(&iid));
563 ok(maj_ver == 4 && min_ver == 0, "ver = %d.%d\n", maj_ver, min_ver);
565 persist_clsid = CLSID_HTMLStyle;
567 maj_ver = min_ver = 0xdead;
568 hres = AtlGetObjectSourceInterface((IUnknown*)&Dispatch, &libid, &iid, &maj_ver, &min_ver);
569 ok(hres == S_OK, "AtlGetObjectSourceInterface failed: %08x\n", hres);
570 ok(IsEqualGUID(&libid, &LIBID_MSHTML), "libid = %s\n", debugstr_guid(&libid));
571 ok(IsEqualGUID(&iid, &IID_NULL), "iid = %s\n", debugstr_guid(&iid));
572 ok(maj_ver == 4 && min_ver == 0, "ver = %d.%d\n", maj_ver, min_ver);
575 static void test_ax_win(void)
577 BOOL ret;
578 WNDCLASSEXW wcex;
579 static const WCHAR AtlAxWin100[] = {'A','t','l','A','x','W','i','n','1','0','0',0};
580 static const WCHAR AtlAxWinLic100[] = {'A','t','l','A','x','W','i','n','L','i','c','1','0','0',0};
581 static HMODULE hinstance = 0;
583 ret = AtlAxWinInit();
584 ok(ret, "AtlAxWinInit failed\n");
586 hinstance = GetModuleHandleA(NULL);
588 memset(&wcex, 0, sizeof(wcex));
589 wcex.cbSize = sizeof(wcex);
590 ret = GetClassInfoExW(hinstance, AtlAxWin100, &wcex);
591 ok(ret, "AtlAxWin100 has not registered\n");
592 ok(wcex.style == (CS_GLOBALCLASS | CS_DBLCLKS), "wcex.style %08x\n", wcex.style);
594 memset(&wcex, 0, sizeof(wcex));
595 wcex.cbSize = sizeof(wcex);
596 ret = GetClassInfoExW(hinstance, AtlAxWinLic100, &wcex);
597 ok(ret, "AtlAxWinLic100 has not registered\n");
598 ok(wcex.style == (CS_GLOBALCLASS | CS_DBLCLKS), "wcex.style %08x\n", wcex.style);
601 START_TEST(atl)
603 CoInitialize(NULL);
605 test_winmodule();
606 test_regcat();
607 test_typelib();
608 test_cp();
609 test_source_iface();
610 test_ax_win();
612 CoUninitialize();