1 /* File generated automatically from tools/winapi/test.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 /***********************************************************************
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 FIELD_ALIGNMENT(type, field) __alignof(((type*)0)->field)
35 #elif defined(__GNUC__)
36 # define FIELD_ALIGNMENT(type, field) __alignof__(((type*)0)->field)
38 /* FIXME: Not sure if is possible to do without compiler extension */
41 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
42 # define _TYPE_ALIGNMENT(type) __alignof(type)
43 #elif defined(__GNUC__)
44 # define _TYPE_ALIGNMENT(type) __alignof__(type)
47 * FIXME: Not sure if is possible to do without compiler extension
48 * (if type is not just a name that is, if so the normal)
49 * TYPE_ALIGNMENT can be used)
53 #if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)
54 #pragma warning(disable:4116)
57 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
58 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
61 /***********************************************************************
65 #ifdef FIELD_ALIGNMENT
66 # define TEST_FIELD_ALIGNMENT(type, field, align) \
67 ok(FIELD_ALIGNMENT(type, field) == align, \
68 "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")\n", \
69 (int)FIELD_ALIGNMENT(type, field))
71 # define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
74 #define TEST_FIELD_OFFSET(type, field, offset) \
75 ok(FIELD_OFFSET(type, field) == offset, \
76 "FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")\n", \
77 (long int)FIELD_OFFSET(type, field))
79 #ifdef _TYPE_ALIGNMENT
80 #define TEST__TYPE_ALIGNMENT(type, align) \
81 ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)_TYPE_ALIGNMENT(type))
83 # define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
87 #define TEST_TYPE_ALIGNMENT(type, align) \
88 ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", (int)TYPE_ALIGNMENT(type))
90 # define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
93 #define TEST_TYPE_SIZE(type, size) \
94 ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")\n", ((int) sizeof(type)))
96 /***********************************************************************
100 #define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \
101 TEST_TYPE_SIZE(field_type, field_size); \
102 TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
103 TEST_FIELD_OFFSET(type, field_name, field_offset); \
105 #define TEST_TYPE(type, size, align) \
106 TEST_TYPE_ALIGNMENT(type, align); \
107 TEST_TYPE_SIZE(type, size)
109 #define TEST_TYPE_POINTER(type, size, align) \
110 TEST__TYPE_ALIGNMENT(*(type)0, align); \
111 TEST_TYPE_SIZE(*(type)0, size)
113 #define TEST_TYPE_SIGNED(type) \
114 ok((type) -1 < 0, "(" #type ") -1 < 0\n");
116 #define TEST_TYPE_UNSIGNED(type) \
117 ok((type) -1 > 0, "(" #type ") -1 > 0\n");
119 static void test_pack_BINDINFO(void)
121 /* BINDINFO (pack 4) */
122 TEST_FIELD(BINDINFO, ULONG, cbSize, 0, 4, 4);
123 TEST_FIELD(BINDINFO, LPWSTR, szExtraInfo, 4, 4, 4);
126 static void test_pack_IBindHost(void)
131 static void test_pack_IBindHostVtbl(void)
133 /* IBindHostVtbl (pack 4) */
136 static void test_pack_IBindStatusCallback(void)
138 /* IBindStatusCallback */
141 static void test_pack_IBindStatusCallbackVtbl(void)
143 /* IBindStatusCallbackVtbl (pack 4) */
146 static void test_pack_IBinding(void)
151 static void test_pack_IBindingVtbl(void)
153 /* IBindingVtbl (pack 4) */
156 static void test_pack_IInternetProtocolInfo(void)
158 /* IInternetProtocolInfo */
161 static void test_pack_IInternetProtocolInfoVtbl(void)
163 /* IInternetProtocolInfoVtbl (pack 4) */
166 static void test_pack_IInternetSession(void)
168 /* IInternetSession */
171 static void test_pack_IInternetSessionVtbl(void)
173 /* IInternetSessionVtbl (pack 4) */
176 static void test_pack_IPersistMoniker(void)
178 /* IPersistMoniker */
181 static void test_pack_IPersistMonikerVtbl(void)
183 /* IPersistMonikerVtbl (pack 4) */
186 static void test_pack_IWinInetHttpInfo(void)
188 /* IWinInetHttpInfo */
191 static void test_pack_IWinInetHttpInfoVtbl(void)
193 /* IWinInetHttpInfoVtbl (pack 4) */
196 static void test_pack_IWinInetInfo(void)
201 static void test_pack_IWinInetInfoVtbl(void)
203 /* IWinInetInfoVtbl (pack 4) */
206 static void test_pack_LPBINDHOST(void)
209 TEST_TYPE(LPBINDHOST, 4, 4);
212 static void test_pack_LPBINDING(void)
215 TEST_TYPE(LPBINDING, 4, 4);
218 static void test_pack_LPBINDSTATUSCALLBACK(void)
220 /* LPBINDSTATUSCALLBACK */
221 TEST_TYPE(LPBINDSTATUSCALLBACK, 4, 4);
224 static void test_pack_LPIINTERNETPROTOCOLINFO(void)
226 /* LPIINTERNETPROTOCOLINFO */
227 TEST_TYPE(LPIINTERNETPROTOCOLINFO, 4, 4);
230 static void test_pack_LPIINTERNETSESSION(void)
232 /* LPIINTERNETSESSION */
233 TEST_TYPE(LPIINTERNETSESSION, 4, 4);
236 static void test_pack_LPPERSISTMONIKER(void)
238 /* LPPERSISTMONIKER */
239 TEST_TYPE(LPPERSISTMONIKER, 4, 4);
242 static void test_pack_LPREMFORMATETC(void)
245 TEST_TYPE(LPREMFORMATETC, 4, 4);
248 static void test_pack_LPREMSECURITY_ATTRIBUTES(void)
250 /* LPREMSECURITY_ATTRIBUTES */
251 TEST_TYPE(LPREMSECURITY_ATTRIBUTES, 4, 4);
254 static void test_pack_LPWININETHTTPINFO(void)
256 /* LPWININETHTTPINFO */
257 TEST_TYPE(LPWININETHTTPINFO, 4, 4);
260 static void test_pack_LPWININETINFO(void)
263 TEST_TYPE(LPWININETINFO, 4, 4);
266 static void test_pack_PREMSECURITY_ATTRIBUTES(void)
268 /* PREMSECURITY_ATTRIBUTES */
269 TEST_TYPE(PREMSECURITY_ATTRIBUTES, 4, 4);
272 static void test_pack_REMSECURITY_ATTRIBUTES(void)
274 /* REMSECURITY_ATTRIBUTES (pack 4) */
275 TEST_TYPE(REMSECURITY_ATTRIBUTES, 12, 4);
276 TEST_FIELD(REMSECURITY_ATTRIBUTES, DWORD, nLength, 0, 4, 4);
277 TEST_FIELD(REMSECURITY_ATTRIBUTES, DWORD, lpSecurityDescriptor, 4, 4, 4);
278 TEST_FIELD(REMSECURITY_ATTRIBUTES, BOOL, bInheritHandle, 8, 4, 4);
281 static void test_pack_RemBINDINFO(void)
283 /* RemBINDINFO (pack 4) */
284 TEST_TYPE(RemBINDINFO, 72, 4);
285 TEST_FIELD(RemBINDINFO, ULONG, cbSize, 0, 4, 4);
286 TEST_FIELD(RemBINDINFO, LPWSTR, szExtraInfo, 4, 4, 4);
287 TEST_FIELD(RemBINDINFO, DWORD, grfBindInfoF, 8, 4, 4);
288 TEST_FIELD(RemBINDINFO, DWORD, dwBindVerb, 12, 4, 4);
289 TEST_FIELD(RemBINDINFO, LPWSTR, szCustomVerb, 16, 4, 4);
290 TEST_FIELD(RemBINDINFO, DWORD, cbstgmedData, 20, 4, 4);
291 TEST_FIELD(RemBINDINFO, DWORD, dwOptions, 24, 4, 4);
292 TEST_FIELD(RemBINDINFO, DWORD, dwOptionsFlags, 28, 4, 4);
293 TEST_FIELD(RemBINDINFO, DWORD, dwCodePage, 32, 4, 4);
294 TEST_FIELD(RemBINDINFO, REMSECURITY_ATTRIBUTES, securityAttributes, 36, 12, 4);
295 TEST_FIELD(RemBINDINFO, IID, iid, 48, 16, 4);
296 TEST_FIELD(RemBINDINFO, IUnknown *, pUnk, 64, 4, 4);
297 TEST_FIELD(RemBINDINFO, DWORD, dwReserved, 68, 4, 4);
300 static void test_pack_RemFORMATETC(void)
302 /* RemFORMATETC (pack 4) */
303 TEST_TYPE(RemFORMATETC, 20, 4);
304 TEST_FIELD(RemFORMATETC, DWORD, cfFormat, 0, 4, 4);
305 TEST_FIELD(RemFORMATETC, DWORD, ptd, 4, 4, 4);
306 TEST_FIELD(RemFORMATETC, DWORD, dwAspect, 8, 4, 4);
307 TEST_FIELD(RemFORMATETC, LONG, lindex, 12, 4, 4);
308 TEST_FIELD(RemFORMATETC, DWORD, tymed, 16, 4, 4);
311 static void test_pack(void)
313 test_pack_BINDINFO();
314 test_pack_IBindHost();
315 test_pack_IBindHostVtbl();
316 test_pack_IBindStatusCallback();
317 test_pack_IBindStatusCallbackVtbl();
318 test_pack_IBinding();
319 test_pack_IBindingVtbl();
320 test_pack_IInternetProtocolInfo();
321 test_pack_IInternetProtocolInfoVtbl();
322 test_pack_IInternetSession();
323 test_pack_IInternetSessionVtbl();
324 test_pack_IPersistMoniker();
325 test_pack_IPersistMonikerVtbl();
326 test_pack_IWinInetHttpInfo();
327 test_pack_IWinInetHttpInfoVtbl();
328 test_pack_IWinInetInfo();
329 test_pack_IWinInetInfoVtbl();
330 test_pack_LPBINDHOST();
331 test_pack_LPBINDING();
332 test_pack_LPBINDSTATUSCALLBACK();
333 test_pack_LPIINTERNETPROTOCOLINFO();
334 test_pack_LPIINTERNETSESSION();
335 test_pack_LPPERSISTMONIKER();
336 test_pack_LPREMFORMATETC();
337 test_pack_LPREMSECURITY_ATTRIBUTES();
338 test_pack_LPWININETHTTPINFO();
339 test_pack_LPWININETINFO();
340 test_pack_PREMSECURITY_ATTRIBUTES();
341 test_pack_REMSECURITY_ATTRIBUTES();
342 test_pack_RemBINDINFO();
343 test_pack_RemFORMATETC();
346 START_TEST(generated)