2009-01-31 14:49:08 +00:00
|
|
|
/* File generated automatically from tools/winapi/tests.dat; do not edit! */
|
2007-03-06 11:59:18 +00:00
|
|
|
/* This file can be copied, modified and distributed without restriction. */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Unit tests for data structure packing
|
|
|
|
*/
|
|
|
|
|
2013-03-24 12:36:17 +00:00
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#define _INC_WINDOWS
|
|
|
|
#define COM_NO_WINDOWS_H
|
|
|
|
|
2013-09-26 16:52:35 +00:00
|
|
|
#ifndef __REACTOS__
|
2007-03-06 11:59:18 +00:00
|
|
|
#define WINVER 0x0501
|
|
|
|
#define _WIN32_IE 0x0501
|
|
|
|
#define _WIN32_WINNT 0x0501
|
2013-09-26 16:52:35 +00:00
|
|
|
#endif
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
#define WINE_NOWINSOCK
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2013-03-24 12:36:17 +00:00
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
|
|
|
//#include "wtypes.h"
|
|
|
|
#include <winreg.h>
|
|
|
|
#include <shlwapi.h>
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2013-03-24 12:36:17 +00:00
|
|
|
#include <wine/test.h>
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/***********************************************************************
|
2008-04-04 16:43:16 +00:00
|
|
|
* Compatibility macros
|
2007-03-06 11:59:18 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define DWORD_PTR UINT_PTR
|
|
|
|
#define LONG_PTR INT_PTR
|
|
|
|
#define ULONG_PTR UINT_PTR
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* Windows API extension
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
|
|
|
|
# define _TYPE_ALIGNMENT(type) __alignof(type)
|
|
|
|
#elif defined(__GNUC__)
|
|
|
|
# define _TYPE_ALIGNMENT(type) __alignof__(type)
|
|
|
|
#else
|
|
|
|
/*
|
2009-01-31 14:49:08 +00:00
|
|
|
* FIXME: May not be possible without a compiler extension
|
|
|
|
* (if type is not just a name that is, otherwise the normal
|
2007-03-06 11:59:18 +00:00
|
|
|
* TYPE_ALIGNMENT can be used)
|
|
|
|
*/
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)
|
|
|
|
#pragma warning(disable:4116)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
|
|
|
|
# define TYPE_ALIGNMENT _TYPE_ALIGNMENT
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* Test helper macros
|
|
|
|
*/
|
|
|
|
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
#define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
#ifdef TYPE_ALIGNMENT
|
|
|
|
# define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
|
|
|
|
#else
|
2009-01-31 14:49:08 +00:00
|
|
|
# define TEST_TYPE_ALIGN(type, align)
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _TYPE_ALIGNMENT
|
|
|
|
# define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
|
|
|
|
# define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
|
|
|
|
#else
|
2009-01-31 14:49:08 +00:00
|
|
|
# define TEST_TARGET_ALIGN(type, align)
|
|
|
|
# define TEST_FIELD_ALIGN(type, field, align)
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
#endif
|
2007-03-06 11:59:18 +00:00
|
|
|
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
#define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
#define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
|
|
|
|
#define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)
|
|
|
|
#define TEST_TYPE_SIGNED(type) C_ASSERT((type) -1 < 0);
|
|
|
|
#define TEST_TYPE_UNSIGNED(type) C_ASSERT((type) -1 > 0);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
#ifdef _WIN64
|
2007-03-06 11:59:18 +00:00
|
|
|
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
static void test_pack_ASSOCF(void)
|
|
|
|
{
|
|
|
|
/* ASSOCF */
|
|
|
|
TEST_TYPE_SIZE (ASSOCF, 4)
|
|
|
|
TEST_TYPE_ALIGN (ASSOCF, 4)
|
|
|
|
TEST_TYPE_UNSIGNED(ASSOCF)
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
static void test_pack_DLLGETVERSIONPROC(void)
|
|
|
|
{
|
|
|
|
/* DLLGETVERSIONPROC */
|
|
|
|
TEST_TYPE_SIZE (DLLGETVERSIONPROC, 8)
|
|
|
|
TEST_TYPE_ALIGN (DLLGETVERSIONPROC, 8)
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
static void test_pack_DLLVERSIONINFO(void)
|
|
|
|
{
|
|
|
|
/* DLLVERSIONINFO (pack 8) */
|
|
|
|
TEST_TYPE_SIZE (DLLVERSIONINFO, 20)
|
|
|
|
TEST_TYPE_ALIGN (DLLVERSIONINFO, 4)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO, cbSize, 4)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO, cbSize, 4)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO, cbSize, 0)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO, dwMajorVersion, 4)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO, dwMajorVersion, 4)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO, dwMajorVersion, 4)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO, dwMinorVersion, 4)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO, dwMinorVersion, 4)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO, dwMinorVersion, 8)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO, dwBuildNumber, 4)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO, dwBuildNumber, 4)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO, dwBuildNumber, 12)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO, dwPlatformID, 4)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO, dwPlatformID, 4)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO, dwPlatformID, 16)
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
static void test_pack_DLLVERSIONINFO2(void)
|
|
|
|
{
|
|
|
|
/* DLLVERSIONINFO2 (pack 8) */
|
|
|
|
TEST_TYPE_SIZE (DLLVERSIONINFO2, 32)
|
|
|
|
TEST_TYPE_ALIGN (DLLVERSIONINFO2, 8)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO2, info1, 20)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO2, info1, 4)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO2, info1, 0)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO2, dwFlags, 4)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO2, dwFlags, 4)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO2, dwFlags, 20)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO2, ullVersion, 8)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO2, ullVersion, 8)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO2, ullVersion, 24)
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_pack_HUSKEY(void)
|
|
|
|
{
|
|
|
|
/* HUSKEY */
|
|
|
|
TEST_TYPE_SIZE (HUSKEY, 8)
|
|
|
|
TEST_TYPE_ALIGN (HUSKEY, 8)
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_pack_PHUSKEY(void)
|
|
|
|
{
|
|
|
|
/* PHUSKEY */
|
|
|
|
TEST_TYPE_SIZE (PHUSKEY, 8)
|
|
|
|
TEST_TYPE_ALIGN (PHUSKEY, 8)
|
|
|
|
TEST_TARGET_SIZE (PHUSKEY, 8)
|
|
|
|
TEST_TARGET_ALIGN(PHUSKEY, 8)
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /* _WIN64 */
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
static void test_pack_ASSOCF(void)
|
|
|
|
{
|
|
|
|
/* ASSOCF */
|
2009-01-31 14:49:08 +00:00
|
|
|
TEST_TYPE_SIZE (ASSOCF, 4)
|
|
|
|
TEST_TYPE_ALIGN (ASSOCF, 4)
|
|
|
|
TEST_TYPE_UNSIGNED(ASSOCF)
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_pack_DLLGETVERSIONPROC(void)
|
|
|
|
{
|
|
|
|
/* DLLGETVERSIONPROC */
|
2009-01-31 14:49:08 +00:00
|
|
|
TEST_TYPE_SIZE (DLLGETVERSIONPROC, 4)
|
|
|
|
TEST_TYPE_ALIGN (DLLGETVERSIONPROC, 4)
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_pack_DLLVERSIONINFO(void)
|
|
|
|
{
|
|
|
|
/* DLLVERSIONINFO (pack 8) */
|
2009-01-31 14:49:08 +00:00
|
|
|
TEST_TYPE_SIZE (DLLVERSIONINFO, 20)
|
|
|
|
TEST_TYPE_ALIGN (DLLVERSIONINFO, 4)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO, cbSize, 4)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO, cbSize, 4)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO, cbSize, 0)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO, dwMajorVersion, 4)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO, dwMajorVersion, 4)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO, dwMajorVersion, 4)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO, dwMinorVersion, 4)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO, dwMinorVersion, 4)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO, dwMinorVersion, 8)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO, dwBuildNumber, 4)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO, dwBuildNumber, 4)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO, dwBuildNumber, 12)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO, dwPlatformID, 4)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO, dwPlatformID, 4)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO, dwPlatformID, 16)
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_pack_DLLVERSIONINFO2(void)
|
|
|
|
{
|
|
|
|
/* DLLVERSIONINFO2 (pack 8) */
|
2009-01-31 14:49:08 +00:00
|
|
|
TEST_TYPE_SIZE (DLLVERSIONINFO2, 32)
|
|
|
|
TEST_TYPE_ALIGN (DLLVERSIONINFO2, 8)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO2, info1, 20)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO2, info1, 4)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO2, info1, 0)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO2, dwFlags, 4)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO2, dwFlags, 4)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO2, dwFlags, 20)
|
|
|
|
TEST_FIELD_SIZE (DLLVERSIONINFO2, ullVersion, 8)
|
|
|
|
TEST_FIELD_ALIGN (DLLVERSIONINFO2, ullVersion, 8)
|
|
|
|
TEST_FIELD_OFFSET(DLLVERSIONINFO2, ullVersion, 24)
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_pack_HUSKEY(void)
|
|
|
|
{
|
|
|
|
/* HUSKEY */
|
2009-01-31 14:49:08 +00:00
|
|
|
TEST_TYPE_SIZE (HUSKEY, 4)
|
|
|
|
TEST_TYPE_ALIGN (HUSKEY, 4)
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_pack_PHUSKEY(void)
|
|
|
|
{
|
|
|
|
/* PHUSKEY */
|
2009-01-31 14:49:08 +00:00
|
|
|
TEST_TYPE_SIZE (PHUSKEY, 4)
|
|
|
|
TEST_TYPE_ALIGN (PHUSKEY, 4)
|
|
|
|
TEST_TARGET_SIZE (PHUSKEY, 4)
|
|
|
|
TEST_TARGET_ALIGN(PHUSKEY, 4)
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
#endif /* _WIN64 */
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
static void test_pack(void)
|
|
|
|
{
|
|
|
|
test_pack_ASSOCF();
|
|
|
|
test_pack_DLLGETVERSIONPROC();
|
|
|
|
test_pack_DLLVERSIONINFO();
|
|
|
|
test_pack_DLLVERSIONINFO2();
|
|
|
|
test_pack_HUSKEY();
|
|
|
|
test_pack_PHUSKEY();
|
|
|
|
}
|
|
|
|
|
|
|
|
START_TEST(generated)
|
|
|
|
{
|
|
|
|
test_pack();
|
|
|
|
}
|