d2d1/tests: Add a basic clipping test.
[wine.git] / dlls / atl100 / tests / atl.c
blob96abf57f14eb11b6c81ba32cef378a6760800695
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 BOOL is_process_limited(void)
48 static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE) = NULL;
49 HANDLE token;
51 if (!pOpenProcessToken)
53 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
54 pOpenProcessToken = (void*)GetProcAddress(hadvapi32, "OpenProcessToken");
55 if (!pOpenProcessToken)
56 return FALSE;
59 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
61 BOOL ret;
62 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
63 DWORD size;
65 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
66 CloseHandle(token);
67 return (ret && type == TokenElevationTypeLimited);
69 return FALSE;
72 static void test_winmodule(void)
74 _AtlCreateWndData create_data[3];
75 _ATL_WIN_MODULE winmod;
76 void *p;
77 HRESULT hres;
79 winmod.cbSize = 0xdeadbeef;
80 hres = AtlWinModuleInit(&winmod);
81 ok(hres == E_INVALIDARG, "AtlWinModuleInit failed: %08x\n", hres);
83 winmod.cbSize = sizeof(winmod);
84 winmod.m_pCreateWndList = (void*)0xdeadbeef;
85 winmod.m_csWindowCreate.LockCount = 0xdeadbeef;
86 winmod.m_rgWindowClassAtoms.m_aT = (void*)0xdeadbeef;
87 winmod.m_rgWindowClassAtoms.m_nSize = 0xdeadbeef;
88 winmod.m_rgWindowClassAtoms.m_nAllocSize = 0xdeadbeef;
89 hres = AtlWinModuleInit(&winmod);
90 ok(hres == S_OK, "AtlWinModuleInit failed: %08x\n", hres);
91 ok(!winmod.m_pCreateWndList, "winmod.m_pCreateWndList = %p\n", winmod.m_pCreateWndList);
92 ok(winmod.m_csWindowCreate.LockCount == -1, "winmod.m_csWindowCreate.LockCount = %d\n",
93 winmod.m_csWindowCreate.LockCount);
94 ok(winmod.m_rgWindowClassAtoms.m_aT == (void*)0xdeadbeef, "winmod.m_rgWindowClassAtoms.m_aT = %p\n",
95 winmod.m_rgWindowClassAtoms.m_aT);
96 ok(winmod.m_rgWindowClassAtoms.m_nSize == 0xdeadbeef, "winmod.m_rgWindowClassAtoms.m_nSize = %d\n",
97 winmod.m_rgWindowClassAtoms.m_nSize);
98 ok(winmod.m_rgWindowClassAtoms.m_nAllocSize == 0xdeadbeef, "winmod.m_rgWindowClassAtoms.m_nAllocSize = %d\n",
99 winmod.m_rgWindowClassAtoms.m_nAllocSize);
101 InitializeCriticalSection(&winmod.m_csWindowCreate);
103 AtlWinModuleAddCreateWndData(&winmod, create_data, (void*)0xdead0001);
104 ok(winmod.m_pCreateWndList == create_data, "winmod.m_pCreateWndList != create_data\n");
105 ok(create_data[0].m_pThis == (void*)0xdead0001, "unexpected create_data[0].m_pThis %p\n", create_data[0].m_pThis);
106 ok(create_data[0].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[0].m_dwThreadID %x\n",
107 create_data[0].m_dwThreadID);
108 ok(!create_data[0].m_pNext, "unexpected create_data[0].m_pNext %p\n", create_data[0].m_pNext);
110 AtlWinModuleAddCreateWndData(&winmod, create_data+1, (void*)0xdead0002);
111 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
112 ok(create_data[1].m_pThis == (void*)0xdead0002, "unexpected create_data[1].m_pThis %p\n", create_data[1].m_pThis);
113 ok(create_data[1].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[1].m_dwThreadID %x\n",
114 create_data[1].m_dwThreadID);
115 ok(create_data[1].m_pNext == create_data, "unexpected create_data[1].m_pNext %p\n", create_data[1].m_pNext);
117 AtlWinModuleAddCreateWndData(&winmod, create_data+2, (void*)0xdead0003);
118 ok(winmod.m_pCreateWndList == create_data+2, "winmod.m_pCreateWndList != create_data\n");
119 ok(create_data[2].m_pThis == (void*)0xdead0003, "unexpected create_data[2].m_pThis %p\n", create_data[2].m_pThis);
120 ok(create_data[2].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[2].m_dwThreadID %x\n",
121 create_data[2].m_dwThreadID);
122 ok(create_data[2].m_pNext == create_data+1, "unexpected create_data[2].m_pNext %p\n", create_data[2].m_pNext);
124 p = AtlWinModuleExtractCreateWndData(&winmod);
125 ok(p == (void*)0xdead0003, "unexpected AtlWinModuleExtractCreateWndData result %p\n", p);
126 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
127 ok(create_data[2].m_pNext == create_data+1, "unexpected create_data[2].m_pNext %p\n", create_data[2].m_pNext);
129 create_data[1].m_dwThreadID = 0xdeadbeef;
131 p = AtlWinModuleExtractCreateWndData(&winmod);
132 ok(p == (void*)0xdead0001, "unexpected AtlWinModuleExtractCreateWndData result %p\n", p);
133 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
134 ok(!create_data[0].m_pNext, "unexpected create_data[0].m_pNext %p\n", create_data[0].m_pNext);
135 ok(!create_data[1].m_pNext, "unexpected create_data[1].m_pNext %p\n", create_data[1].m_pNext);
137 p = AtlWinModuleExtractCreateWndData(&winmod);
138 ok(!p, "unexpected AtlWinModuleExtractCreateWndData result %p\n", p);
139 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
142 #define test_key_exists(a,b) _test_key_exists(__LINE__,a,b)
143 static void _test_key_exists(unsigned line, HKEY root, const char *key_name)
145 HKEY key;
146 DWORD res;
148 res = RegOpenKeyA(root, key_name, &key);
149 ok_(__FILE__,line)(res == ERROR_SUCCESS, "Could not open key %s\n", key_name);
150 if(res == ERROR_SUCCESS)
151 RegCloseKey(key);
154 #define test_key_not_exists(a,b) _test_key_not_exists(__LINE__,a,b)
155 static void _test_key_not_exists(unsigned line, HKEY root, const char *key_name)
157 HKEY key;
158 DWORD res;
160 res = RegOpenKeyA(root, key_name, &key);
161 ok_(__FILE__,line)(res == ERROR_FILE_NOT_FOUND, "Attempting to open %s returned %u\n", key_name, res);
162 if(res == ERROR_SUCCESS)
163 RegCloseKey(key);
166 static void test_regcat(void)
168 unsigned char b;
169 HRESULT hres;
171 const struct _ATL_CATMAP_ENTRY catmap[] = {
172 {_ATL_CATMAP_ENTRY_IMPLEMENTED, &CATID_CatTest1},
173 {_ATL_CATMAP_ENTRY_REQUIRED, &CATID_CatTest2},
174 {_ATL_CATMAP_ENTRY_END}
177 if (is_process_limited())
179 skip("process is limited\n");
180 return;
183 hres = AtlRegisterClassCategoriesHelper(&CLSID_Test, catmap, TRUE);
184 ok(hres == S_OK, "AtlRegisterClassCategoriesHelper failed: %08x\n", hres);
186 test_key_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}");
187 test_key_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}\\Implemented Categories\\{" CATID_CATTEST1_STR "}");
188 test_key_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}\\Required Categories\\{" CATID_CATTEST2_STR "}");
190 hres = AtlRegisterClassCategoriesHelper(&CLSID_Test, catmap, FALSE);
191 ok(hres == S_OK, "AtlRegisterClassCategoriesHelper failed: %08x\n", hres);
193 test_key_not_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}\\Implemented Categories");
194 test_key_not_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}\\Required Categories");
195 test_key_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}");
197 ok(RegDeleteKeyA(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}") == ERROR_SUCCESS, "Could not delete key\n");
199 hres = AtlRegisterClassCategoriesHelper(&CLSID_Test, NULL, TRUE);
200 ok(hres == S_OK, "AtlRegisterClassCategoriesHelper failed: %08x\n", hres);
202 test_key_not_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}");
204 b = 10;
205 hres = AtlGetPerUserRegistration(&b);
206 ok(hres == S_OK, "AtlGetPerUserRegistration failed: %08x\n", hres);
207 ok(!b, "AtlGetPerUserRegistration returned %x\n", b);
210 static void test_typelib(void)
212 ITypeLib *typelib;
213 HINSTANCE inst;
214 size_t len;
215 BSTR path;
216 HRESULT hres;
218 static const WCHAR scrrun_dll_suffixW[] = {'\\','s','c','r','r','u','n','.','d','l','l',0};
219 static const WCHAR mshtml_tlb_suffixW[] = {'\\','m','s','h','t','m','l','.','t','l','b',0};
221 inst = LoadLibraryA("scrrun.dll");
222 ok(inst != NULL, "Could not load scrrun.dll\n");
224 typelib = NULL;
225 hres = AtlLoadTypeLib(inst, NULL, &path, &typelib);
226 ok(hres == S_OK, "AtlLoadTypeLib failed: %08x\n", hres);
227 FreeLibrary(inst);
229 len = SysStringLen(path);
230 ok(len > sizeof(scrrun_dll_suffixW)/sizeof(WCHAR)
231 && lstrcmpiW(path+len-sizeof(scrrun_dll_suffixW)/sizeof(WCHAR), scrrun_dll_suffixW),
232 "unexpected path %s\n", wine_dbgstr_w(path));
233 SysFreeString(path);
234 ok(typelib != NULL, "typelib == NULL\n");
235 ITypeLib_Release(typelib);
237 inst = LoadLibraryA("mshtml.dll");
238 ok(inst != NULL, "Could not load mshtml.dll\n");
240 typelib = NULL;
241 hres = AtlLoadTypeLib(inst, NULL, &path, &typelib);
242 ok(hres == S_OK, "AtlLoadTypeLib failed: %08x\n", hres);
243 FreeLibrary(inst);
245 len = SysStringLen(path);
246 ok(len > sizeof(mshtml_tlb_suffixW)/sizeof(WCHAR)
247 && lstrcmpiW(path+len-sizeof(mshtml_tlb_suffixW)/sizeof(WCHAR), mshtml_tlb_suffixW),
248 "unexpected path %s\n", wine_dbgstr_w(path));
249 SysFreeString(path);
250 ok(typelib != NULL, "typelib == NULL\n");
251 ITypeLib_Release(typelib);
254 static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface, REFIID riid, void **ppv)
256 if(IsEqualGUID(&IID_IConnectionPoint, riid)) {
257 *ppv = iface;
258 return S_OK;
261 ok(0, "unexpected call\n");
262 return E_NOINTERFACE;
265 static ULONG WINAPI ConnectionPoint_AddRef(IConnectionPoint *iface)
267 return 2;
270 static ULONG WINAPI ConnectionPoint_Release(IConnectionPoint *iface)
272 return 1;
275 static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *iface, IID *pIID)
277 ok(0, "unexpected call\n");
278 return E_NOTIMPL;
281 static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoint *iface,
282 IConnectionPointContainer **ppCPC)
284 ok(0, "unexpected call\n");
285 return E_NOTIMPL;
288 static int advise_cnt;
290 static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *pUnkSink,
291 DWORD *pdwCookie)
293 ok(pUnkSink == (IUnknown*)0xdead0000, "pUnkSink = %p\n", pUnkSink);
294 *pdwCookie = 0xdeadbeef;
295 advise_cnt++;
296 return S_OK;
299 static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD dwCookie)
301 ok(dwCookie == 0xdeadbeef, "dwCookie = %x\n", dwCookie);
302 advise_cnt--;
303 return S_OK;
306 static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface,
307 IEnumConnections **ppEnum)
309 ok(0, "unexpected call\n");
310 return E_NOTIMPL;
313 static const IConnectionPointVtbl ConnectionPointVtbl =
315 ConnectionPoint_QueryInterface,
316 ConnectionPoint_AddRef,
317 ConnectionPoint_Release,
318 ConnectionPoint_GetConnectionInterface,
319 ConnectionPoint_GetConnectionPointContainer,
320 ConnectionPoint_Advise,
321 ConnectionPoint_Unadvise,
322 ConnectionPoint_EnumConnections
325 static IConnectionPoint ConnectionPoint = { &ConnectionPointVtbl };
327 static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface,
328 REFIID riid, void **ppv)
330 if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
331 *ppv = iface;
332 return S_OK;
335 ok(0, "unexpected call\n");
336 return E_NOTIMPL;
339 static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
341 return 2;
344 static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
346 return 1;
349 static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface,
350 IEnumConnectionPoints **ppEnum)
352 ok(0, "unexpected call\n");
353 return E_NOTIMPL;
356 static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface,
357 REFIID riid, IConnectionPoint **ppCP)
359 ok(IsEqualGUID(riid, &CLSID_Test), "unexpected riid\n");
360 *ppCP = &ConnectionPoint;
361 return S_OK;
364 static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = {
365 ConnectionPointContainer_QueryInterface,
366 ConnectionPointContainer_AddRef,
367 ConnectionPointContainer_Release,
368 ConnectionPointContainer_EnumConnectionPoints,
369 ConnectionPointContainer_FindConnectionPoint
372 static IConnectionPointContainer ConnectionPointContainer = { &ConnectionPointContainerVtbl };
374 static void test_cp(void)
376 DWORD cookie = 0;
377 HRESULT hres;
379 hres = AtlAdvise(NULL, (IUnknown*)0xdeed0000, &CLSID_Test, &cookie);
380 ok(hres == E_INVALIDARG, "expect E_INVALIDARG, returned %08x\n", hres);
382 hres = AtlUnadvise(NULL, &CLSID_Test, 0xdeadbeef);
383 ok(hres == E_INVALIDARG, "expect E_INVALIDARG, returned %08x\n", hres);
385 hres = AtlAdvise((IUnknown*)&ConnectionPointContainer, (IUnknown*)0xdead0000, &CLSID_Test, &cookie);
386 ok(hres == S_OK, "AtlAdvise failed: %08x\n", hres);
387 ok(cookie == 0xdeadbeef, "cookie = %x\n", cookie);
388 ok(advise_cnt == 1, "advise_cnt = %d\n", advise_cnt);
390 hres = AtlUnadvise((IUnknown*)&ConnectionPointContainer, &CLSID_Test, 0xdeadbeef);
391 ok(hres == S_OK, "AtlUnadvise failed: %08x\n", hres);
392 ok(!advise_cnt, "advise_cnt = %d\n", advise_cnt);
395 static CLSID persist_clsid;
397 static HRESULT WINAPI Persist_QueryInterface(IPersist *iface, REFIID riid, void **ppv)
399 ok(0, "unexpected call\n");
400 return E_NOINTERFACE;
403 static ULONG WINAPI Persist_AddRef(IPersist *iface)
405 return 2;
408 static ULONG WINAPI Persist_Release(IPersist *iface)
410 return 1;
413 static HRESULT WINAPI Persist_GetClassID(IPersist *iface, CLSID *pClassID)
415 *pClassID = persist_clsid;
416 return S_OK;
419 static const IPersistVtbl PersistVtbl = {
420 Persist_QueryInterface,
421 Persist_AddRef,
422 Persist_Release,
423 Persist_GetClassID
426 static IPersist Persist = { &PersistVtbl };
428 static HRESULT WINAPI ProvideClassInfo2_QueryInterface(IProvideClassInfo2 *iface, REFIID riid, void **ppv)
430 ok(0, "unexpected call\n");
431 return E_NOINTERFACE;
434 static ULONG WINAPI ProvideClassInfo2_AddRef(IProvideClassInfo2 *iface)
436 return 2;
439 static ULONG WINAPI ProvideClassInfo2_Release(IProvideClassInfo2 *iface)
441 return 1;
444 static HRESULT WINAPI ProvideClassInfo2_GetClassInfo(IProvideClassInfo2 *iface, ITypeInfo **ppTI)
446 ok(0, "unexpected call\n");
447 return E_NOTIMPL;
450 static HRESULT WINAPI ProvideClassInfo2_GetGUID(IProvideClassInfo2 *iface, DWORD dwGuidKind, GUID *pGUID)
452 ok(dwGuidKind == GUIDKIND_DEFAULT_SOURCE_DISP_IID, "unexpected dwGuidKind %x\n", dwGuidKind);
453 *pGUID = DIID_DispHTMLBody;
454 return S_OK;
457 static const IProvideClassInfo2Vtbl ProvideClassInfo2Vtbl = {
458 ProvideClassInfo2_QueryInterface,
459 ProvideClassInfo2_AddRef,
460 ProvideClassInfo2_Release,
461 ProvideClassInfo2_GetClassInfo,
462 ProvideClassInfo2_GetGUID
465 static IProvideClassInfo2 ProvideClassInfo2 = { &ProvideClassInfo2Vtbl };
466 static BOOL support_classinfo2;
468 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
470 *ppv = NULL;
472 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
473 *ppv = iface;
474 return S_OK;
477 if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
478 if(!support_classinfo2)
479 return E_NOINTERFACE;
480 *ppv = &ProvideClassInfo2;
481 return S_OK;
484 if(IsEqualGUID(&IID_IPersist, riid)) {
485 *ppv = &Persist;
486 return S_OK;
489 ok(0, "unexpected riid: %s\n", wine_dbgstr_guid(riid));
490 return E_NOINTERFACE;
493 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
495 return 2;
498 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
500 return 1;
503 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
505 ok(0, "unexpected call\n");
506 return E_NOTIMPL;
509 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
510 ITypeInfo **ppTInfo)
512 ITypeLib *typelib;
513 HRESULT hres;
515 static const WCHAR mshtml_tlbW[] = {'m','s','h','t','m','l','.','t','l','b',0};
517 ok(!iTInfo, "iTInfo = %d\n", iTInfo);
518 ok(!lcid, "lcid = %x\n", lcid);
520 hres = LoadTypeLib(mshtml_tlbW, &typelib);
521 ok(hres == S_OK, "LoadTypeLib failed: %08x\n", hres);
523 hres = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IHTMLElement, ppTInfo);
524 ok(hres == S_OK, "GetTypeInfoOfGuid failed: %08x\n", hres);
526 ITypeLib_Release(typelib);
527 return S_OK;
530 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
531 UINT cNames, LCID lcid, DISPID *rgDispId)
533 ok(0, "unexpected call\n");
534 return E_NOTIMPL;
537 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
538 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
539 EXCEPINFO *pExcepInfo, UINT *puArgErr)
541 ok(0, "unexpected call\n");
542 return E_NOTIMPL;
545 static const IDispatchVtbl DispatchVtbl = {
546 Dispatch_QueryInterface,
547 Dispatch_AddRef,
548 Dispatch_Release,
549 Dispatch_GetTypeInfoCount,
550 Dispatch_GetTypeInfo,
551 Dispatch_GetIDsOfNames,
552 Dispatch_Invoke
555 static IDispatch Dispatch = { &DispatchVtbl };
557 static void test_source_iface(void)
559 unsigned short maj_ver, min_ver;
560 IID libid, iid;
561 HRESULT hres;
563 support_classinfo2 = TRUE;
565 maj_ver = min_ver = 0xdead;
566 hres = AtlGetObjectSourceInterface((IUnknown*)&Dispatch, &libid, &iid, &maj_ver, &min_ver);
567 ok(hres == S_OK, "AtlGetObjectSourceInterface failed: %08x\n", hres);
568 ok(IsEqualGUID(&libid, &LIBID_MSHTML), "libid = %s\n", wine_dbgstr_guid(&libid));
569 ok(IsEqualGUID(&iid, &DIID_DispHTMLBody), "iid = %s\n", wine_dbgstr_guid(&iid));
570 ok(maj_ver == 4 && min_ver == 0, "ver = %d.%d\n", maj_ver, min_ver);
572 support_classinfo2 = FALSE;
573 persist_clsid = CLSID_HTMLDocument;
575 maj_ver = min_ver = 0xdead;
576 hres = AtlGetObjectSourceInterface((IUnknown*)&Dispatch, &libid, &iid, &maj_ver, &min_ver);
577 ok(hres == S_OK, "AtlGetObjectSourceInterface failed: %08x\n", hres);
578 ok(IsEqualGUID(&libid, &LIBID_MSHTML), "libid = %s\n", wine_dbgstr_guid(&libid));
579 ok(IsEqualGUID(&iid, &DIID_HTMLDocumentEvents), "iid = %s\n", wine_dbgstr_guid(&iid));
580 ok(maj_ver == 4 && min_ver == 0, "ver = %d.%d\n", maj_ver, min_ver);
582 persist_clsid = CLSID_HTMLStyle;
584 maj_ver = min_ver = 0xdead;
585 hres = AtlGetObjectSourceInterface((IUnknown*)&Dispatch, &libid, &iid, &maj_ver, &min_ver);
586 ok(hres == S_OK, "AtlGetObjectSourceInterface failed: %08x\n", hres);
587 ok(IsEqualGUID(&libid, &LIBID_MSHTML), "libid = %s\n", wine_dbgstr_guid(&libid));
588 ok(IsEqualGUID(&iid, &IID_NULL), "iid = %s\n", wine_dbgstr_guid(&iid));
589 ok(maj_ver == 4 && min_ver == 0, "ver = %d.%d\n", maj_ver, min_ver);
592 static void test_ax_win(void)
594 BOOL ret;
595 WNDCLASSEXW wcex;
596 static const WCHAR AtlAxWin100[] = {'A','t','l','A','x','W','i','n','1','0','0',0};
597 static const WCHAR AtlAxWinLic100[] = {'A','t','l','A','x','W','i','n','L','i','c','1','0','0',0};
598 static HMODULE hinstance = 0;
600 ret = AtlAxWinInit();
601 ok(ret, "AtlAxWinInit failed\n");
603 hinstance = GetModuleHandleA(NULL);
605 memset(&wcex, 0, sizeof(wcex));
606 wcex.cbSize = sizeof(wcex);
607 ret = GetClassInfoExW(hinstance, AtlAxWin100, &wcex);
608 ok(ret, "AtlAxWin100 has not registered\n");
609 ok(wcex.style == (CS_GLOBALCLASS | CS_DBLCLKS), "wcex.style %08x\n", wcex.style);
611 memset(&wcex, 0, sizeof(wcex));
612 wcex.cbSize = sizeof(wcex);
613 ret = GetClassInfoExW(hinstance, AtlAxWinLic100, &wcex);
614 ok(ret, "AtlAxWinLic100 has not registered\n");
615 ok(wcex.style == (CS_GLOBALCLASS | CS_DBLCLKS), "wcex.style %08x\n", wcex.style);
618 START_TEST(atl)
620 CoInitialize(NULL);
622 test_winmodule();
623 test_regcat();
624 test_typelib();
625 test_cp();
626 test_source_iface();
627 test_ax_win();
629 CoUninitialize();