1 /* File generated automatically from tools/winapi/tests.dat; do not edit! */
2 /* This file can be copied, modified and distributed without restriction. */
5 * Unit tests for data structure packing
9 #define _WIN32_IE 0x0501
10 #define _WIN32_WINNT 0x0501
12 #define WINE_NOWINSOCK
19 #include "wine/test.h"
21 /***********************************************************************
22 * Compatibility macros
25 #define DWORD_PTR UINT_PTR
26 #define LONG_PTR INT_PTR
27 #define ULONG_PTR UINT_PTR
29 /***********************************************************************
30 * Windows API extension
33 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
34 # define _TYPE_ALIGNMENT(type) __alignof(type)
35 #elif defined(__GNUC__)
36 # define _TYPE_ALIGNMENT(type) __alignof__(type)
39 * FIXME: May not be possible without a compiler extension
40 * (if type is not just a name that is, otherwise the normal
41 * TYPE_ALIGNMENT can be used)
45 #if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)
46 #pragma warning(disable:4116)
49 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
50 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
53 /***********************************************************************
59 # define TEST_TYPE_SIZE(type, size)
60 # define TEST_TYPE_ALIGN(type, align)
61 # define TEST_TARGET_ALIGN(type, align)
62 # define TEST_FIELD_ALIGN(type, field, align)
63 # define TEST_FIELD_OFFSET(type, field, offset)
67 # define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
69 # ifdef TYPE_ALIGNMENT
70 # define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
72 # define TEST_TYPE_ALIGN(type, align)
75 # ifdef _TYPE_ALIGNMENT
76 # define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
77 # define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
79 # define TEST_TARGET_ALIGN(type, align)
80 # define TEST_FIELD_ALIGN(type, field, align)
83 # define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
87 #define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
88 #define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)
89 #define TEST_TYPE_SIGNED(type) C_ASSERT((type) -1 < 0);
90 #define TEST_TYPE_UNSIGNED(type) C_ASSERT((type) -1 > 0);
93 static void test_pack_BINDINFO(void)
95 /* BINDINFO (pack 4) */
96 TEST_FIELD_SIZE (BINDINFO
, cbSize
, 4)
97 TEST_FIELD_ALIGN (BINDINFO
, cbSize
, 4)
98 TEST_FIELD_OFFSET(BINDINFO
, cbSize
, 0)
99 TEST_FIELD_SIZE (BINDINFO
, szExtraInfo
, 4)
100 TEST_FIELD_ALIGN (BINDINFO
, szExtraInfo
, 4)
101 TEST_FIELD_OFFSET(BINDINFO
, szExtraInfo
, 4)
104 static void test_pack_IBindHost(void)
109 static void test_pack_IBindHostVtbl(void)
111 /* IBindHostVtbl (pack 4) */
114 static void test_pack_IBindStatusCallback(void)
116 /* IBindStatusCallback */
119 static void test_pack_IBindStatusCallbackVtbl(void)
121 /* IBindStatusCallbackVtbl (pack 4) */
124 static void test_pack_IBinding(void)
129 static void test_pack_IBindingVtbl(void)
131 /* IBindingVtbl (pack 4) */
134 static void test_pack_IInternetProtocolInfo(void)
136 /* IInternetProtocolInfo */
139 static void test_pack_IInternetProtocolInfoVtbl(void)
141 /* IInternetProtocolInfoVtbl (pack 4) */
144 static void test_pack_IInternetSession(void)
146 /* IInternetSession */
149 static void test_pack_IInternetSessionVtbl(void)
151 /* IInternetSessionVtbl (pack 4) */
154 static void test_pack_IPersistMoniker(void)
156 /* IPersistMoniker */
159 static void test_pack_IPersistMonikerVtbl(void)
161 /* IPersistMonikerVtbl (pack 4) */
164 static void test_pack_IWinInetHttpInfo(void)
166 /* IWinInetHttpInfo */
169 static void test_pack_IWinInetHttpInfoVtbl(void)
171 /* IWinInetHttpInfoVtbl (pack 4) */
174 static void test_pack_IWinInetInfo(void)
179 static void test_pack_IWinInetInfoVtbl(void)
181 /* IWinInetInfoVtbl (pack 4) */
184 static void test_pack_LPBINDHOST(void)
187 TEST_TYPE_SIZE (LPBINDHOST
, 4)
188 TEST_TYPE_ALIGN (LPBINDHOST
, 4)
191 static void test_pack_LPBINDING(void)
194 TEST_TYPE_SIZE (LPBINDING
, 4)
195 TEST_TYPE_ALIGN (LPBINDING
, 4)
198 static void test_pack_LPBINDSTATUSCALLBACK(void)
200 /* LPBINDSTATUSCALLBACK */
201 TEST_TYPE_SIZE (LPBINDSTATUSCALLBACK
, 4)
202 TEST_TYPE_ALIGN (LPBINDSTATUSCALLBACK
, 4)
205 static void test_pack_LPIINTERNETPROTOCOLINFO(void)
207 /* LPIINTERNETPROTOCOLINFO */
208 TEST_TYPE_SIZE (LPIINTERNETPROTOCOLINFO
, 4)
209 TEST_TYPE_ALIGN (LPIINTERNETPROTOCOLINFO
, 4)
212 static void test_pack_LPIINTERNETSESSION(void)
214 /* LPIINTERNETSESSION */
215 TEST_TYPE_SIZE (LPIINTERNETSESSION
, 4)
216 TEST_TYPE_ALIGN (LPIINTERNETSESSION
, 4)
219 static void test_pack_LPPERSISTMONIKER(void)
221 /* LPPERSISTMONIKER */
222 TEST_TYPE_SIZE (LPPERSISTMONIKER
, 4)
223 TEST_TYPE_ALIGN (LPPERSISTMONIKER
, 4)
226 static void test_pack_LPREMFORMATETC(void)
229 TEST_TYPE_SIZE (LPREMFORMATETC
, 4)
230 TEST_TYPE_ALIGN (LPREMFORMATETC
, 4)
233 static void test_pack_LPREMSECURITY_ATTRIBUTES(void)
235 /* LPREMSECURITY_ATTRIBUTES */
236 TEST_TYPE_SIZE (LPREMSECURITY_ATTRIBUTES
, 4)
237 TEST_TYPE_ALIGN (LPREMSECURITY_ATTRIBUTES
, 4)
240 static void test_pack_LPWININETHTTPINFO(void)
242 /* LPWININETHTTPINFO */
243 TEST_TYPE_SIZE (LPWININETHTTPINFO
, 4)
244 TEST_TYPE_ALIGN (LPWININETHTTPINFO
, 4)
247 static void test_pack_LPWININETINFO(void)
250 TEST_TYPE_SIZE (LPWININETINFO
, 4)
251 TEST_TYPE_ALIGN (LPWININETINFO
, 4)
254 static void test_pack_PREMSECURITY_ATTRIBUTES(void)
256 /* PREMSECURITY_ATTRIBUTES */
257 TEST_TYPE_SIZE (PREMSECURITY_ATTRIBUTES
, 4)
258 TEST_TYPE_ALIGN (PREMSECURITY_ATTRIBUTES
, 4)
261 static void test_pack_REMSECURITY_ATTRIBUTES(void)
263 /* REMSECURITY_ATTRIBUTES (pack 4) */
264 TEST_TYPE_SIZE (REMSECURITY_ATTRIBUTES
, 12)
265 TEST_TYPE_ALIGN (REMSECURITY_ATTRIBUTES
, 4)
266 TEST_FIELD_SIZE (REMSECURITY_ATTRIBUTES
, nLength
, 4)
267 TEST_FIELD_ALIGN (REMSECURITY_ATTRIBUTES
, nLength
, 4)
268 TEST_FIELD_OFFSET(REMSECURITY_ATTRIBUTES
, nLength
, 0)
269 TEST_FIELD_SIZE (REMSECURITY_ATTRIBUTES
, lpSecurityDescriptor
, 4)
270 TEST_FIELD_ALIGN (REMSECURITY_ATTRIBUTES
, lpSecurityDescriptor
, 4)
271 TEST_FIELD_OFFSET(REMSECURITY_ATTRIBUTES
, lpSecurityDescriptor
, 4)
272 TEST_FIELD_SIZE (REMSECURITY_ATTRIBUTES
, bInheritHandle
, 4)
273 TEST_FIELD_ALIGN (REMSECURITY_ATTRIBUTES
, bInheritHandle
, 4)
274 TEST_FIELD_OFFSET(REMSECURITY_ATTRIBUTES
, bInheritHandle
, 8)
277 static void test_pack_RemBINDINFO(void)
279 /* RemBINDINFO (pack 4) */
280 TEST_TYPE_SIZE (RemBINDINFO
, 72)
281 TEST_TYPE_ALIGN (RemBINDINFO
, 4)
282 TEST_FIELD_SIZE (RemBINDINFO
, cbSize
, 4)
283 TEST_FIELD_ALIGN (RemBINDINFO
, cbSize
, 4)
284 TEST_FIELD_OFFSET(RemBINDINFO
, cbSize
, 0)
285 TEST_FIELD_SIZE (RemBINDINFO
, szExtraInfo
, 4)
286 TEST_FIELD_ALIGN (RemBINDINFO
, szExtraInfo
, 4)
287 TEST_FIELD_OFFSET(RemBINDINFO
, szExtraInfo
, 4)
288 TEST_FIELD_SIZE (RemBINDINFO
, grfBindInfoF
, 4)
289 TEST_FIELD_ALIGN (RemBINDINFO
, grfBindInfoF
, 4)
290 TEST_FIELD_OFFSET(RemBINDINFO
, grfBindInfoF
, 8)
291 TEST_FIELD_SIZE (RemBINDINFO
, dwBindVerb
, 4)
292 TEST_FIELD_ALIGN (RemBINDINFO
, dwBindVerb
, 4)
293 TEST_FIELD_OFFSET(RemBINDINFO
, dwBindVerb
, 12)
294 TEST_FIELD_SIZE (RemBINDINFO
, szCustomVerb
, 4)
295 TEST_FIELD_ALIGN (RemBINDINFO
, szCustomVerb
, 4)
296 TEST_FIELD_OFFSET(RemBINDINFO
, szCustomVerb
, 16)
297 TEST_FIELD_SIZE (RemBINDINFO
, cbstgmedData
, 4)
298 TEST_FIELD_ALIGN (RemBINDINFO
, cbstgmedData
, 4)
299 TEST_FIELD_OFFSET(RemBINDINFO
, cbstgmedData
, 20)
300 TEST_FIELD_SIZE (RemBINDINFO
, dwOptions
, 4)
301 TEST_FIELD_ALIGN (RemBINDINFO
, dwOptions
, 4)
302 TEST_FIELD_OFFSET(RemBINDINFO
, dwOptions
, 24)
303 TEST_FIELD_SIZE (RemBINDINFO
, dwOptionsFlags
, 4)
304 TEST_FIELD_ALIGN (RemBINDINFO
, dwOptionsFlags
, 4)
305 TEST_FIELD_OFFSET(RemBINDINFO
, dwOptionsFlags
, 28)
306 TEST_FIELD_SIZE (RemBINDINFO
, dwCodePage
, 4)
307 TEST_FIELD_ALIGN (RemBINDINFO
, dwCodePage
, 4)
308 TEST_FIELD_OFFSET(RemBINDINFO
, dwCodePage
, 32)
309 TEST_FIELD_SIZE (RemBINDINFO
, securityAttributes
, 12)
310 TEST_FIELD_ALIGN (RemBINDINFO
, securityAttributes
, 4)
311 TEST_FIELD_OFFSET(RemBINDINFO
, securityAttributes
, 36)
312 TEST_FIELD_SIZE (RemBINDINFO
, iid
, 16)
313 TEST_FIELD_ALIGN (RemBINDINFO
, iid
, 4)
314 TEST_FIELD_OFFSET(RemBINDINFO
, iid
, 48)
315 TEST_FIELD_SIZE (RemBINDINFO
, pUnk
, 4)
316 TEST_FIELD_ALIGN (RemBINDINFO
, pUnk
, 4)
317 TEST_FIELD_OFFSET(RemBINDINFO
, pUnk
, 64)
318 TEST_FIELD_SIZE (RemBINDINFO
, dwReserved
, 4)
319 TEST_FIELD_ALIGN (RemBINDINFO
, dwReserved
, 4)
320 TEST_FIELD_OFFSET(RemBINDINFO
, dwReserved
, 68)
323 static void test_pack_RemFORMATETC(void)
325 /* RemFORMATETC (pack 4) */
326 TEST_TYPE_SIZE (RemFORMATETC
, 20)
327 TEST_TYPE_ALIGN (RemFORMATETC
, 4)
328 TEST_FIELD_SIZE (RemFORMATETC
, cfFormat
, 4)
329 TEST_FIELD_ALIGN (RemFORMATETC
, cfFormat
, 4)
330 TEST_FIELD_OFFSET(RemFORMATETC
, cfFormat
, 0)
331 TEST_FIELD_SIZE (RemFORMATETC
, ptd
, 4)
332 TEST_FIELD_ALIGN (RemFORMATETC
, ptd
, 4)
333 TEST_FIELD_OFFSET(RemFORMATETC
, ptd
, 4)
334 TEST_FIELD_SIZE (RemFORMATETC
, dwAspect
, 4)
335 TEST_FIELD_ALIGN (RemFORMATETC
, dwAspect
, 4)
336 TEST_FIELD_OFFSET(RemFORMATETC
, dwAspect
, 8)
337 TEST_FIELD_SIZE (RemFORMATETC
, lindex
, 4)
338 TEST_FIELD_ALIGN (RemFORMATETC
, lindex
, 4)
339 TEST_FIELD_OFFSET(RemFORMATETC
, lindex
, 12)
340 TEST_FIELD_SIZE (RemFORMATETC
, tymed
, 4)
341 TEST_FIELD_ALIGN (RemFORMATETC
, tymed
, 4)
342 TEST_FIELD_OFFSET(RemFORMATETC
, tymed
, 16)
345 static void test_pack(void)
347 test_pack_BINDINFO();
348 test_pack_IBindHost();
349 test_pack_IBindHostVtbl();
350 test_pack_IBindStatusCallback();
351 test_pack_IBindStatusCallbackVtbl();
352 test_pack_IBinding();
353 test_pack_IBindingVtbl();
354 test_pack_IInternetProtocolInfo();
355 test_pack_IInternetProtocolInfoVtbl();
356 test_pack_IInternetSession();
357 test_pack_IInternetSessionVtbl();
358 test_pack_IPersistMoniker();
359 test_pack_IPersistMonikerVtbl();
360 test_pack_IWinInetHttpInfo();
361 test_pack_IWinInetHttpInfoVtbl();
362 test_pack_IWinInetInfo();
363 test_pack_IWinInetInfoVtbl();
364 test_pack_LPBINDHOST();
365 test_pack_LPBINDING();
366 test_pack_LPBINDSTATUSCALLBACK();
367 test_pack_LPIINTERNETPROTOCOLINFO();
368 test_pack_LPIINTERNETSESSION();
369 test_pack_LPPERSISTMONIKER();
370 test_pack_LPREMFORMATETC();
371 test_pack_LPREMSECURITY_ATTRIBUTES();
372 test_pack_LPWININETHTTPINFO();
373 test_pack_LPWININETINFO();
374 test_pack_PREMSECURITY_ATTRIBUTES();
375 test_pack_REMSECURITY_ATTRIBUTES();
376 test_pack_RemBINDINFO();
377 test_pack_RemFORMATETC();
380 START_TEST(generated
)
383 ok(0, "The type size / alignment tests don't support Win64 yet\n");