msi: Add support for storing strings with embedded nulls in the string table.
[wine.git] / dlls / atl / tests / module.c
blob2a97ef95ad3b8702ac86aa2878923aa03970219e
1 /*
2 * ATL test program
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
22 #include <stdarg.h>
23 #include <stdio.h>
25 #define COBJMACROS
27 #include <wine/test.h>
28 #include <windef.h>
29 #include <winbase.h>
30 #include <winuser.h>
31 #include <wingdi.h>
32 #include <winnls.h>
33 #include <winerror.h>
34 #include <winnt.h>
35 #include <wtypes.h>
36 #include <olectl.h>
37 #include <ocidl.h>
39 struct _ATL_OBJMAP_ENTRYW;
40 struct _AtlCreateWndData;
41 struct _ATL_TERMFUNC_ELEM;
43 struct _ATL_MODULEW
45 UINT cbSize;
46 HINSTANCE m_hInst;
47 HINSTANCE m_hInstResource;
48 HINSTANCE m_hInstTypeLib;
49 struct _ATL_OBJMAP_ENTRYW* m_pObjMap;
50 LONG m_nLockCnt;
51 HANDLE m_hHeap;
52 union
54 CRITICAL_SECTION m_csTypeInfoHolder;
55 CRITICAL_SECTION m_csStaticDataInit;
56 } u;
57 CRITICAL_SECTION m_csWindowCreate;
58 CRITICAL_SECTION m_csObjMap;
60 DWORD dwAtlBuildVer;
61 struct _AtlCreateWndData* m_pCreateWndList;
62 BOOL m_bDestroyHeap;
63 GUID* pguidVer;
64 DWORD m_dwHeaps;
65 HANDLE* m_phHeaps;
66 int m_nHeap;
67 struct _ATL_TERMFUNC_ELEM* m_pTermFuncs;
70 HRESULT WINAPI AtlModuleInit(struct _ATL_MODULEW* pM, struct _ATL_OBJMAP_ENTRYW* p, HINSTANCE h);
72 #define MAXSIZE 512
73 static void test_StructSize(void)
75 struct _ATL_MODULEW *tst;
76 HRESULT hres;
77 int i;
79 tst = HeapAlloc (GetProcessHeap(),HEAP_ZERO_MEMORY,MAXSIZE);
81 for (i=0;i<MAXSIZE;i++) {
82 tst->cbSize = i;
83 hres = AtlModuleInit(tst, NULL, NULL);
85 switch (i) {
86 case FIELD_OFFSET( struct _ATL_MODULEW, dwAtlBuildVer ):
87 case sizeof(struct _ATL_MODULEW):
88 #ifdef _WIN64
89 case sizeof(struct _ATL_MODULEW) + sizeof(void *):
90 #endif
91 ok (hres == S_OK, "AtlModuleInit with %d failed (0x%x).\n", i, (int)hres);
92 break;
93 default:
94 ok (FAILED(hres) ||
95 broken((i > FIELD_OFFSET( struct _ATL_MODULEW, dwAtlBuildVer )) && (hres == S_OK)), /* Win95 */
96 "AtlModuleInit with %d succeeded? (0x%x).\n", i, (int)hres);
97 break;
101 HeapFree (GetProcessHeap(), 0, tst);
104 START_TEST(module)
106 test_StructSize();