4 * Copyright 2010 Marcus Meissner
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include <wine/test.h>
32 static void test_StructSize(void)
38 tst
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, MAXSIZE
);
40 for (i
=0;i
<MAXSIZE
;i
++) {
42 hres
= AtlModuleInit(tst
, NULL
, NULL
);
45 case FIELD_OFFSET(_ATL_MODULEW
, dwAtlBuildVer
):
46 case sizeof(_ATL_MODULEW
):
48 case sizeof(_ATL_MODULEW
) + sizeof(void *):
50 ok (hres
== S_OK
, "AtlModuleInit with %d failed (0x%x).\n", i
, (int)hres
);
53 ok (FAILED(hres
), "AtlModuleInit with %d succeeded? (0x%x).\n", i
, (int)hres
);
58 HeapFree (GetProcessHeap(), 0, tst
);
61 static void test_winmodule(void)
63 _AtlCreateWndData create_data
[3];
68 winmod
.cbSize
= sizeof(winmod
);
69 winmod
.m_pCreateWndList
= (void*)0xdeadbeef;
70 winmod
.m_csWindowCreate
.LockCount
= 0xdeadbeef;
71 hres
= AtlModuleInit(&winmod
, NULL
, NULL
);
72 ok(hres
== S_OK
, "AtlModuleInit failed: %08x\n", hres
);
73 ok(!winmod
.m_pCreateWndList
, "winmod.m_pCreateWndList = %p\n", winmod
.m_pCreateWndList
);
74 ok(winmod
.m_csWindowCreate
.LockCount
== -1, "winmod.m_csWindowCreate.LockCount = %d\n",
75 winmod
.m_csWindowCreate
.LockCount
);
77 AtlModuleAddCreateWndData(&winmod
, create_data
, (void*)0xdead0001);
78 ok(winmod
.m_pCreateWndList
== create_data
, "winmod.m_pCreateWndList != create_data\n");
79 ok(create_data
[0].m_pThis
== (void*)0xdead0001, "unexpected create_data[0].m_pThis %p\n", create_data
[0].m_pThis
);
80 ok(create_data
[0].m_dwThreadID
== GetCurrentThreadId(), "unexpected create_data[0].m_dwThreadID %x\n",
81 create_data
[0].m_dwThreadID
);
82 ok(!create_data
[0].m_pNext
, "unexpected create_data[0].m_pNext %p\n", create_data
[0].m_pNext
);
84 AtlModuleAddCreateWndData(&winmod
, create_data
+1, (void*)0xdead0002);
85 ok(winmod
.m_pCreateWndList
== create_data
+1, "winmod.m_pCreateWndList != create_data\n");
86 ok(create_data
[1].m_pThis
== (void*)0xdead0002, "unexpected create_data[1].m_pThis %p\n", create_data
[1].m_pThis
);
87 ok(create_data
[1].m_dwThreadID
== GetCurrentThreadId(), "unexpected create_data[1].m_dwThreadID %x\n",
88 create_data
[1].m_dwThreadID
);
89 ok(create_data
[1].m_pNext
== create_data
, "unexpected create_data[1].m_pNext %p\n", create_data
[1].m_pNext
);
91 AtlModuleAddCreateWndData(&winmod
, create_data
+2, (void*)0xdead0003);
92 ok(winmod
.m_pCreateWndList
== create_data
+2, "winmod.m_pCreateWndList != create_data\n");
93 ok(create_data
[2].m_pThis
== (void*)0xdead0003, "unexpected create_data[2].m_pThis %p\n", create_data
[2].m_pThis
);
94 ok(create_data
[2].m_dwThreadID
== GetCurrentThreadId(), "unexpected create_data[2].m_dwThreadID %x\n",
95 create_data
[2].m_dwThreadID
);
96 ok(create_data
[2].m_pNext
== create_data
+1, "unexpected create_data[2].m_pNext %p\n", create_data
[2].m_pNext
);
98 p
= AtlModuleExtractCreateWndData(&winmod
);
99 ok(p
== (void*)0xdead0003, "unexpected AtlModuleExtractCreateWndData result %p\n", p
);
100 ok(winmod
.m_pCreateWndList
== create_data
+1, "winmod.m_pCreateWndList != create_data\n");
101 ok(create_data
[2].m_pNext
== create_data
+1, "unexpected create_data[2].m_pNext %p\n", create_data
[2].m_pNext
);
103 create_data
[1].m_dwThreadID
= 0xdeadbeef;
105 p
= AtlModuleExtractCreateWndData(&winmod
);
106 ok(p
== (void*)0xdead0001, "unexpected AtlModuleExtractCreateWndData result %p\n", p
);
107 ok(winmod
.m_pCreateWndList
== create_data
+1, "winmod.m_pCreateWndList != create_data\n");
108 ok(!create_data
[0].m_pNext
, "unexpected create_data[0].m_pNext %p\n", create_data
[0].m_pNext
);
109 ok(!create_data
[1].m_pNext
, "unexpected create_data[1].m_pNext %p\n", create_data
[1].m_pNext
);
111 p
= AtlModuleExtractCreateWndData(&winmod
);
112 ok(!p
, "unexpected AtlModuleExtractCreateWndData result %p\n", p
);
113 ok(winmod
.m_pCreateWndList
== create_data
+1, "winmod.m_pCreateWndList != create_data\n");