Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink...
authorDaniel Reimer <reimer.daniel@freenet.de>
Sat, 3 Jul 2010 12:45:23 +0000 (12:45 +0000)
committerDaniel Reimer <reimer.daniel@freenet.de>
Sat, 3 Jul 2010 12:45:23 +0000 (12:45 +0000)
TBD mshtml, shell32, oleaut32 which still fail to build here

svn path=/trunk/; revision=47931

80 files changed:
rostests/winetests/advapi32/crypt.c
rostests/winetests/advapi32/registry.c
rostests/winetests/advapi32/security.c
rostests/winetests/comctl32/imagelist.c
rostests/winetests/comctl32/propsheet.c
rostests/winetests/comctl32/rebar.c
rostests/winetests/comctl32/resources.h
rostests/winetests/comctl32/rsrc.rc
rostests/winetests/comctl32/treeview.c
rostests/winetests/crypt32/chain.c
rostests/winetests/crypt32/encode.c
rostests/winetests/crypt32/store.c
rostests/winetests/cryptnet/cryptnet.c
rostests/winetests/cryptui/cryptui.c
rostests/winetests/fusion/asmcache.c
rostests/winetests/gdi32/bitmap.c
rostests/winetests/gdi32/dc.c
rostests/winetests/gdi32/font.c
rostests/winetests/gdi32/generated.c
rostests/winetests/gdi32/metafile.c
rostests/winetests/gdi32/path.c
rostests/winetests/gdiplus/graphics.c
rostests/winetests/gdiplus/graphicspath.c
rostests/winetests/gdiplus/image.c
rostests/winetests/hlink/browse_ctx.c
rostests/winetests/hlink/hlink.c
rostests/winetests/imm32/imm32.c
rostests/winetests/jscript/api.js
rostests/winetests/jscript/lang.js
rostests/winetests/jscript/regexp.js
rostests/winetests/kernel32/debugger.c
rostests/winetests/kernel32/file.c
rostests/winetests/kernel32/format_msg.c
rostests/winetests/kernel32/heap.c
rostests/winetests/kernel32/locale.c
rostests/winetests/kernel32/path.c
rostests/winetests/kernel32/pipe.c
rostests/winetests/kernel32/process.c
rostests/winetests/kernel32/thread.c
rostests/winetests/kernel32/version.c
rostests/winetests/localspl/localmon.c
rostests/winetests/msacm32/msacm.c
rostests/winetests/mscms/profile.c
rostests/winetests/msi/automation.c
rostests/winetests/msi/db.c
rostests/winetests/msi/install.c
rostests/winetests/msi/msi.c
rostests/winetests/msi/msi.rbuild
rostests/winetests/msi/package.c
rostests/winetests/msi/patch.c [new file with mode: 0644]
rostests/winetests/msi/source.c
rostests/winetests/msi/testlist.c
rostests/winetests/mstask/task.c
rostests/winetests/msvcrtd/debug.c
rostests/winetests/msxml3/domdoc.c
rostests/winetests/msxml3/xmlelem.c
rostests/winetests/ntdll/atom.c
rostests/winetests/ntdll/error.c
rostests/winetests/ntdll/exception.c
rostests/winetests/ntdll/file.c
rostests/winetests/ntdll/generated.c
rostests/winetests/ntdll/info.c
rostests/winetests/ntdll/path.c
rostests/winetests/ntdll/port.c
rostests/winetests/ntdll/rtlstr.c
rostests/winetests/ntdll/string.c
rostests/winetests/ole32/dragdrop.c
rostests/winetests/ole32/hglobalstream.c
rostests/winetests/ole32/moniker.c
rostests/winetests/ole32/stg_prop.c
rostests/winetests/ole32/storage32.c
rostests/winetests/ole32/usrmarshal.c
rostests/winetests/pdh/pdh.c
rostests/winetests/psapi/psapi_main.c
rostests/winetests/quartz/dsoundrender.c [new file with mode: 0644]
rostests/winetests/quartz/quartz.rbuild
rostests/winetests/quartz/referenceclock.c
rostests/winetests/rasapi32/rasapi.c
rostests/winetests/riched20/editor.c
rostests/winetests/rsaenh/rsaenh.c

index 2a5993c..6cfbbbf 100644 (file)
@@ -64,7 +64,7 @@ static BOOL (WINAPI *pCryptSetHashParam)(HCRYPTKEY, DWORD, BYTE*, DWORD);
 static BOOL (WINAPI *pCryptSetKeyParam)(HCRYPTKEY, DWORD, BYTE*, DWORD);
 static BOOL (WINAPI *pCryptSetProvParam)(HCRYPTPROV, DWORD, BYTE*, DWORD);
 static BOOL (WINAPI *pCryptVerifySignatureW)(HCRYPTHASH, BYTE*, DWORD, HCRYPTKEY, LPCWSTR, DWORD);
-static BOOL (WINAPI *pSystemFunction036)(PVOID, ULONG);
+static BOOLEAN (WINAPI *pSystemFunction036)(PVOID, ULONG);
 
 static void init_function_pointers(void)
 {
@@ -856,6 +856,8 @@ static void test_set_provider_ex(void)
 {
        DWORD result;
        DWORD notNull = 5;
+        LPSTR curProvName = NULL;
+        DWORD curlen;
        
        /* results */
        LPSTR pszProvName = NULL;
@@ -867,6 +869,13 @@ static void test_set_provider_ex(void)
            return;
        }
 
+        /* store the current one */
+        pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, NULL, &curlen);
+        if (!(curProvName = LocalAlloc(LMEM_ZEROINIT, curlen)))
+            return;
+        result = pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, curProvName, &curlen);
+        ok(result, "%d\n", GetLastError());
+
        /* check pdwReserved for NULL */
        result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, &notNull, CRYPT_MACHINE_DEFAULT);
        ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %d\n",
@@ -880,6 +889,7 @@ static void test_set_provider_ex(void)
                 ok( GetLastError() == ERROR_ACCESS_DENIED || broken(GetLastError() == ERROR_INVALID_PARAMETER),
                     "wrong error %u\n", GetLastError() );
                skip("Not enough rights to remove the default provider\n");
+                LocalFree(curProvName);
                return;
        }
 
@@ -889,13 +899,19 @@ static void test_set_provider_ex(void)
        /* call CryptGetDefaultProvider to see if they match */
        result = pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, NULL, &cbProvName);
        if (!(pszProvName = LocalAlloc(LMEM_ZEROINIT, cbProvName)))
-               return;
+               goto reset;
 
        result = pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, pszProvName, &cbProvName);
        ok(result && !strcmp(MS_DEF_PROV, pszProvName), "expected %s, got %s\n", MS_DEF_PROV, pszProvName);
        ok(result && cbProvName==(strlen(MS_DEF_PROV) + 1), "expected %i, got %d\n", (lstrlenA(MS_DEF_PROV) + 1), cbProvName);
 
        LocalFree(pszProvName);
+
+reset:
+        /* Set the provider back to it's original */
+        result = pCryptSetProviderExA(curProvName, PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT);
+        ok(result, "%d\n", GetLastError());
+        LocalFree(curProvName);
 }
 
 static void test_machine_guid(void)
index 3a65339..30dda7e 100644 (file)
@@ -1862,7 +1862,9 @@ static void test_redirection(void)
     ok( err == ERROR_SUCCESS, "RegCreateKeyExA failed: %u\n", err );
     check_key_value( key, "Winetest", 0, ptr_size );
     check_key_value( key, "Winetest", KEY_WOW64_64KEY, is_vista ? 64 : ptr_size );
-    check_key_value( key, "Winetest", KEY_WOW64_32KEY, 32 );
+    dw = get_key_value( key, "Winetest", KEY_WOW64_32KEY );
+    if (ptr_size == 32) ok( dw == 32, "wrong value %u\n", dw );
+    else todo_wine ok( dw == 32, "wrong value %u\n", dw );
     RegCloseKey( key );
 
     if (ptr_size == 32)
@@ -1910,6 +1912,79 @@ static void test_redirection(void)
     RegCloseKey( root64 );
 }
 
+static void test_deleted_key(void)
+{
+    HKEY hkey, hkey2;
+    char value[20];
+    DWORD val_count, type;
+    LONG res;
+
+    /* Open the test key, then delete it while it's open */
+    RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkey );
+
+    delete_key( hkey_main );
+
+    val_count = sizeof(value);
+    type = 0;
+    res = RegEnumValueA( hkey, 0, value, &val_count, NULL, &type, 0, 0 );
+    ok(res == ERROR_KEY_DELETED, "expect ERROR_KEY_DELETED, got %i\n", res);
+
+    res = RegEnumKeyA( hkey, 0, value, sizeof(value) );
+    ok(res == ERROR_KEY_DELETED, "expect ERROR_KEY_DELETED, got %i\n", res);
+
+    val_count = sizeof(value);
+    type = 0;
+    res = RegQueryValueExA( hkey, "test", NULL, &type, (BYTE *)value, &val_count );
+    ok(res == ERROR_KEY_DELETED, "expect ERROR_KEY_DELETED, got %i\n", res);
+
+    res = RegSetValueExA( hkey, "test", 0, REG_SZ, (const BYTE*)"value", 6);
+    ok(res == ERROR_KEY_DELETED, "expect ERROR_KEY_DELETED, got %i\n", res);
+
+    res = RegOpenKeyA( hkey, "test", &hkey2 );
+    ok(res == ERROR_KEY_DELETED, "expect ERROR_KEY_DELETED, got %i\n", res);
+    if (res == 0)
+        RegCloseKey( hkey2 );
+
+    res = RegCreateKeyA( hkey, "test", &hkey2 );
+    ok(res == ERROR_KEY_DELETED, "expect ERROR_KEY_DELETED, got %i\n", res);
+    if (res == 0)
+        RegCloseKey( hkey2 );
+
+    res = RegFlushKey( hkey );
+    ok(res == ERROR_KEY_DELETED, "expect ERROR_KEY_DELETED, got %i\n", res);
+
+    RegCloseKey( hkey );
+
+    setup_main_key();
+}
+
+static void test_delete_value(void)
+{
+    LONG res;
+    char longname[401];
+
+    res = RegSetValueExA( hkey_main, "test", 0, REG_SZ, (const BYTE*)"value", 6 );
+    ok(res == ERROR_SUCCESS, "expect ERROR_SUCCESS, got %i\n", res);
+
+    res = RegQueryValueExA( hkey_main, "test", NULL, NULL, NULL, NULL);
+    ok(res == ERROR_SUCCESS, "expect ERROR_SUCCESS, got %i\n", res);
+
+    res = RegDeleteValueA( hkey_main, "test" );
+    ok(res == ERROR_SUCCESS, "expect ERROR_SUCCESS, got %i\n", res);
+
+    res = RegQueryValueExA( hkey_main, "test", NULL, NULL, NULL, NULL);
+    ok(res == ERROR_FILE_NOT_FOUND, "expect ERROR_FILE_NOT_FOUND, got %i\n", res);
+
+    res = RegDeleteValueA( hkey_main, "test" );
+    ok(res == ERROR_FILE_NOT_FOUND, "expect ERROR_FILE_NOT_FOUND, got %i\n", res);
+
+    memset(longname, 'a', 400);
+    longname[400] = 0;
+    res = RegDeleteValueA( hkey_main, longname );
+    ok(res == ERROR_FILE_NOT_FOUND || broken(res == ERROR_MORE_DATA), /* nt4, win2k */
+       "expect ERROR_FILE_NOT_FOUND, got %i\n", res);
+}
+
 START_TEST(registry)
 {
     /* Load pointers for functions that are not available in all Windows versions */
@@ -1944,6 +2019,8 @@ START_TEST(registry)
 
     test_reg_delete_tree();
     test_rw_order();
+    test_deleted_key();
+    test_delete_value();
 
     /* cleanup */
     delete_key( hkey_main );
index 029568c..1f1b697 100644 (file)
@@ -656,7 +656,7 @@ static void test_lookupPrivilegeValue(void)
      { "SeCreateGlobalPrivilege", SE_CREATE_GLOBAL_PRIVILEGE },
     };
     BOOL (WINAPI *pLookupPrivilegeValueA)(LPCSTR, LPCSTR, PLUID);
-    int i;
+    unsigned int i;
     LUID luid;
     BOOL ret;
 
@@ -913,13 +913,13 @@ static void test_AccessCheck(void)
 
     /* SD without owner/group */
     SetLastError(0xdeadbeef);
-    Access = AccessStatus = 0xdeadbeef;
+    Access = AccessStatus = 0x1abe11ed;
     ret = AccessCheck(SecurityDescriptor, Token, KEY_QUERY_VALUE, &Mapping,
                       PrivSet, &PrivSetLen, &Access, &AccessStatus);
     err = GetLastError();
     ok(!ret && err == ERROR_INVALID_SECURITY_DESCR, "AccessCheck should have "
        "failed with ERROR_INVALID_SECURITY_DESCR, instead of %d\n", err);
-    ok(Access == 0xdeadbeef && AccessStatus == 0xdeadbeef,
+    ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed,
        "Access and/or AccessStatus were changed!\n");
 
     /* Set owner and group */
@@ -930,50 +930,50 @@ static void test_AccessCheck(void)
 
     /* Generic access mask */
     SetLastError(0xdeadbeef);
-    Access = AccessStatus = 0xdeadbeef;
+    Access = AccessStatus = 0x1abe11ed;
     ret = AccessCheck(SecurityDescriptor, Token, GENERIC_READ, &Mapping,
                       PrivSet, &PrivSetLen, &Access, &AccessStatus);
     err = GetLastError();
     ok(!ret && err == ERROR_GENERIC_NOT_MAPPED, "AccessCheck should have failed "
        "with ERROR_GENERIC_NOT_MAPPED, instead of %d\n", err);
-    ok(Access == 0xdeadbeef && AccessStatus == 0xdeadbeef,
+    ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed,
        "Access and/or AccessStatus were changed!\n");
 
     /* Generic access mask - no privilegeset buffer */
     SetLastError(0xdeadbeef);
-    Access = AccessStatus = 0xdeadbeef;
+    Access = AccessStatus = 0x1abe11ed;
     ret = AccessCheck(SecurityDescriptor, Token, GENERIC_READ, &Mapping,
                       NULL, &PrivSetLen, &Access, &AccessStatus);
     err = GetLastError();
     ok(!ret && err == ERROR_NOACCESS, "AccessCheck should have failed "
        "with ERROR_NOACCESS, instead of %d\n", err);
-    ok(Access == 0xdeadbeef && AccessStatus == 0xdeadbeef,
+    ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed,
        "Access and/or AccessStatus were changed!\n");
 
     /* Generic access mask - no returnlength */
     SetLastError(0xdeadbeef);
-    Access = AccessStatus = 0xdeadbeef;
+    Access = AccessStatus = 0x1abe11ed;
     ret = AccessCheck(SecurityDescriptor, Token, GENERIC_READ, &Mapping,
                       PrivSet, NULL, &Access, &AccessStatus);
     err = GetLastError();
     ok(!ret && err == ERROR_NOACCESS, "AccessCheck should have failed "
        "with ERROR_NOACCESS, instead of %d\n", err);
-    ok(Access == 0xdeadbeef && AccessStatus == 0xdeadbeef,
+    ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed,
        "Access and/or AccessStatus were changed!\n");
 
     /* Generic access mask - no privilegeset buffer, no returnlength */
     SetLastError(0xdeadbeef);
-    Access = AccessStatus = 0xdeadbeef;
+    Access = AccessStatus = 0x1abe11ed;
     ret = AccessCheck(SecurityDescriptor, Token, GENERIC_READ, &Mapping,
                       NULL, NULL, &Access, &AccessStatus);
     err = GetLastError();
     ok(!ret && err == ERROR_NOACCESS, "AccessCheck should have failed "
        "with ERROR_NOACCESS, instead of %d\n", err);
-    ok(Access == 0xdeadbeef && AccessStatus == 0xdeadbeef,
+    ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed,
        "Access and/or AccessStatus were changed!\n");
 
     /* sd with no dacl present */
-    Access = AccessStatus = 0xdeadbeef;
+    Access = AccessStatus = 0x1abe11ed;
     ret = SetSecurityDescriptorDacl(SecurityDescriptor, FALSE, NULL, FALSE);
     ok(ret, "SetSecurityDescriptorDacl failed with error %d\n", GetLastError());
     ret = AccessCheck(SecurityDescriptor, Token, KEY_READ, &Mapping,
@@ -985,20 +985,20 @@ static void test_AccessCheck(void)
 
     /* sd with no dacl present - no privilegeset buffer */
     SetLastError(0xdeadbeef);
-    Access = AccessStatus = 0xdeadbeef;
+    Access = AccessStatus = 0x1abe11ed;
     ret = AccessCheck(SecurityDescriptor, Token, GENERIC_READ, &Mapping,
                       NULL, &PrivSetLen, &Access, &AccessStatus);
     err = GetLastError();
     ok(!ret && err == ERROR_NOACCESS, "AccessCheck should have failed "
        "with ERROR_NOACCESS, instead of %d\n", err);
-    ok(Access == 0xdeadbeef && AccessStatus == 0xdeadbeef,
+    ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed,
        "Access and/or AccessStatus were changed!\n");
 
     if(pNtAccessCheck)
     {
        /* Generic access mask - no privilegeset buffer */
        SetLastError(0xdeadbeef);
-       Access = ntAccessStatus = 0xdeadbeef;
+       Access = ntAccessStatus = 0x1abe11ed;
        ntret = pNtAccessCheck(SecurityDescriptor, Token, GENERIC_READ, &Mapping,
                               NULL, &PrivSetLen, &Access, &ntAccessStatus);
        err = GetLastError();
@@ -1006,12 +1006,12 @@ static void test_AccessCheck(void)
           "NtAccessCheck should have failed with STATUS_ACCESS_VIOLATION, got %x\n", ntret);
        ok(err == 0xdeadbeef,
           "NtAccessCheck shouldn't set last error, got %d\n", err);
-       ok(Access == 0xdeadbeef && ntAccessStatus == 0xdeadbeef,
+       ok(Access == 0x1abe11ed && ntAccessStatus == 0x1abe11ed,
           "Access and/or AccessStatus were changed!\n");
 
       /* Generic access mask - no returnlength */
       SetLastError(0xdeadbeef);
-      Access = ntAccessStatus = 0xdeadbeef;
+      Access = ntAccessStatus = 0x1abe11ed;
       ntret = pNtAccessCheck(SecurityDescriptor, Token, GENERIC_READ, &Mapping,
                              PrivSet, NULL, &Access, &ntAccessStatus);
       err = GetLastError();
@@ -1019,12 +1019,12 @@ static void test_AccessCheck(void)
          "NtAccessCheck should have failed with STATUS_ACCESS_VIOLATION, got %x\n", ntret);
       ok(err == 0xdeadbeef,
          "NtAccessCheck shouldn't set last error, got %d\n", err);
-      ok(Access == 0xdeadbeef && ntAccessStatus == 0xdeadbeef,
+      ok(Access == 0x1abe11ed && ntAccessStatus == 0x1abe11ed,
          "Access and/or AccessStatus were changed!\n");
 
       /* Generic access mask - no privilegeset buffer, no returnlength */
       SetLastError(0xdeadbeef);
-      Access = ntAccessStatus = 0xdeadbeef;
+      Access = ntAccessStatus = 0x1abe11ed;
       ntret = pNtAccessCheck(SecurityDescriptor, Token, GENERIC_READ, &Mapping,
                              NULL, NULL, &Access, &ntAccessStatus);
       err = GetLastError();
@@ -1032,14 +1032,14 @@ static void test_AccessCheck(void)
          "NtAccessCheck should have failed with STATUS_ACCESS_VIOLATION, got %x\n", ntret);
       ok(err == 0xdeadbeef,
          "NtAccessCheck shouldn't set last error, got %d\n", err);
-      ok(Access == 0xdeadbeef && ntAccessStatus == 0xdeadbeef,
+      ok(Access == 0x1abe11ed && ntAccessStatus == 0x1abe11ed,
          "Access and/or AccessStatus were changed!\n");
     }
     else
        win_skip("NtAccessCheck unavailable. Skipping.\n");
 
     /* sd with NULL dacl */
-    Access = AccessStatus = 0xdeadbeef;
+    Access = AccessStatus = 0x1abe11ed;
     ret = SetSecurityDescriptorDacl(SecurityDescriptor, TRUE, NULL, FALSE);
     ok(ret, "SetSecurityDescriptorDacl failed with error %d\n", GetLastError());
     ret = AccessCheck(SecurityDescriptor, Token, KEY_READ, &Mapping,
@@ -1067,7 +1067,7 @@ static void test_AccessCheck(void)
     ok(res, "AddAccessDeniedAce failed with error %d\n", GetLastError());
 
     /* sd with dacl */
-    Access = AccessStatus = 0xdeadbeef;
+    Access = AccessStatus = 0x1abe11ed;
     ret = AccessCheck(SecurityDescriptor, Token, KEY_READ, &Mapping,
                       PrivSet, &PrivSetLen, &Access, &AccessStatus);
     ok(ret, "AccessCheck failed with error %d\n", GetLastError());
@@ -1085,7 +1085,7 @@ static void test_AccessCheck(void)
 
     /* Access denied by SD */
     SetLastError(0xdeadbeef);
-    Access = AccessStatus = 0xdeadbeef;
+    Access = AccessStatus = 0x1abe11ed;
     ret = AccessCheck(SecurityDescriptor, Token, KEY_WRITE, &Mapping,
                       PrivSet, &PrivSetLen, &Access, &AccessStatus);
     ok(ret, "AccessCheck failed with error %d\n", GetLastError());
@@ -1420,7 +1420,7 @@ static void test_CreateWellKnownSid(void)
     PSID domainsid, sid;
     DWORD size, error;
     BOOL ret;
-    int i;
+    unsigned int i;
 
     if (!pCreateWellKnownSid)
     {
@@ -1466,13 +1466,13 @@ static void test_CreateWellKnownSid(void)
             cb = sizeof(sid_buffer);
             if (!pCreateWellKnownSid(i, domainsid, sid_buffer, &cb))
             {
-                skip("Well known SIDs starting from %d are not implemented\n", i);
+                skip("Well known SIDs starting from %u are not implemented\n", i);
                 break;
             }
         }
 
         cb = sizeof(sid_buffer);
-        ok(pCreateWellKnownSid(i, value->without_domain ? NULL : domainsid, sid_buffer, &cb), "Couldn't create well known sid %d\n", i);
+        ok(pCreateWellKnownSid(i, value->without_domain ? NULL : domainsid, sid_buffer, &cb), "Couldn't create well known sid %u\n", i);
         expect_eq(GetSidLengthRequired(*GetSidSubAuthorityCount(sid_buffer)), cb, DWORD, "%d");
         ok(IsValidSid(sid_buffer), "The sid is not valid\n");
         ok(pConvertSidToStringSidA(sid_buffer, &str), "Couldn't convert SID to string\n");
@@ -1484,9 +1484,9 @@ static void test_CreateWellKnownSid(void)
         {
             char buf2[SECURITY_MAX_SID_SIZE];
             cb = sizeof(buf2);
-            ok(pCreateWellKnownSid(i, domainsid, buf2, &cb), "Couldn't create well known sid %d with optional domain\n", i);
+            ok(pCreateWellKnownSid(i, domainsid, buf2, &cb), "Couldn't create well known sid %u with optional domain\n", i);
             expect_eq(GetSidLengthRequired(*GetSidSubAuthorityCount(sid_buffer)), cb, DWORD, "%d");
-            ok(memcmp(buf2, sid_buffer, cb) == 0, "SID create with domain is different than without (%d)\n", i);
+            ok(memcmp(buf2, sid_buffer, cb) == 0, "SID create with domain is different than without (%u)\n", i);
         }
     }
 
@@ -2674,7 +2674,7 @@ static void test_ConvertStringSecurityDescriptor(void)
     BOOL ret;
     PSECURITY_DESCRIPTOR pSD;
     static const WCHAR Blank[] = { 0 };
-    int i;
+    unsigned int i;
     static const struct
     {
         const char *sidstring;
@@ -2733,11 +2733,11 @@ static void test_ConvertStringSecurityDescriptor(void)
         ret = pConvertStringSecurityDescriptorToSecurityDescriptorA(
             cssd[i].sidstring, cssd[i].revision, &pSD, NULL);
         GLE = GetLastError();
-        ok(ret == cssd[i].ret, "(%02d) Expected %s (%d)\n", i, cssd[i].ret ? "success" : "failure", GLE);
+        ok(ret == cssd[i].ret, "(%02u) Expected %s (%d)\n", i, cssd[i].ret ? "success" : "failure", GLE);
         if (!cssd[i].ret)
             ok(GLE == cssd[i].GLE ||
                (cssd[i].altGLE && GLE == cssd[i].altGLE),
-               "(%02d) Unexpected last error %d\n", i, GLE);
+               "(%02u) Unexpected last error %d\n", i, GLE);
         if (ret)
             LocalFree(pSD);
     }
@@ -2807,12 +2807,12 @@ static void test_ConvertSecurityDescriptorToString(void)
  * don't replicate this feature so we only test len >= strlen+1. */
 #define CHECK_RESULT_AND_FREE(exp_str) \
     ok(strcmp(string, (exp_str)) == 0, "String mismatch (expected \"%s\", got \"%s\")\n", (exp_str), string); \
-    ok(len >= (lstrlen(exp_str) + 1), "Length mismatch (expected %d, got %d)\n", lstrlen(exp_str) + 1, len); \
+    ok(len >= (strlen(exp_str) + 1), "Length mismatch (expected %d, got %d)\n", lstrlen(exp_str) + 1, len); \
     LocalFree(string);
 
 #define CHECK_ONE_OF_AND_FREE(exp_str1, exp_str2) \
     ok(strcmp(string, (exp_str1)) == 0 || strcmp(string, (exp_str2)) == 0, "String mismatch (expected\n\"%s\" or\n\"%s\", got\n\"%s\")\n", (exp_str1), (exp_str2), string); \
-    ok(len >= (strlen(string) + 1), "Length mismatch (expected %d, got %d)\n", lstrlen(string) + 1, len); \
+    ok(len >= (strlen(exp_str1) + 1) || len >= (strlen(exp_str2) + 1), "Length mismatch (expected %d or %d, got %d)\n", lstrlen(exp_str1) + 1, lstrlen(exp_str2) + 1, len); \
     LocalFree(string);
 
     InitializeSecurityDescriptor(&desc, SECURITY_DESCRIPTOR_REVISION);
index cf749c8..5398201 100644 (file)
@@ -126,6 +126,7 @@ static HIMAGELIST createImageList(int cx, int cy)
     HIMAGELIST himl = ImageList_Create(cx, cy, ILC_COLOR, 1, 1);
     HBITMAP hbm = CreateBitmap(48, 48, 1, 1, bitmap_bits);
     ImageList_Add(himl, hbm, NULL);
+    DeleteObject(hbm);
     return himl;
 }
 
@@ -831,7 +832,7 @@ static void check_bitmap_data(const char *bm_data, ULONG bm_data_size,
 #endif
 }
 
-static void check_ilhead_data(const char *ilh_data, INT cx, INT cy, INT cur, INT max)
+static void check_ilhead_data(const char *ilh_data, INT cx, INT cy, INT cur, INT max, INT grow)
 {
     const ILHEAD *ilh = (const ILHEAD *)ilh_data;
 
@@ -839,7 +840,7 @@ static void check_ilhead_data(const char *ilh_data, INT cx, INT cy, INT cur, INT
     ok(ilh->usVersion == 0x101, "wrong usVersion %x (expected 0x101)\n", ilh->usVersion);
     ok(ilh->cCurImage == cur, "wrong cCurImage %d (expected %d)\n", ilh->cCurImage, cur);
     ok(ilh->cMaxImage == max, "wrong cMaxImage %d (expected %d)\n", ilh->cMaxImage, max);
-    ok(ilh->cGrow == 4, "wrong cGrow %d (expected 4)\n", ilh->cGrow);
+    ok(ilh->cGrow == grow, "wrong cGrow %d (expected %d)\n", ilh->cGrow, grow);
     ok(ilh->cx == cx, "wrong cx %d (expected %d)\n", ilh->cx, cx);
     ok(ilh->cy == cy, "wrong cy %d (expected %d)\n", ilh->cy, cy);
     ok(ilh->bkcolor == CLR_NONE, "wrong bkcolor %x\n", ilh->bkcolor);
@@ -892,38 +893,20 @@ static HBITMAP create_bitmap(INT cx, INT cy, COLORREF color, const char *comment
     return hbmp;
 }
 
-static void image_list_init(HIMAGELIST himl)
-{
-    HBITMAP hbm;
-    char comment[16];
-    INT n = 1;
-
-#define add_bitmap(grey) \
-    sprintf(comment, "%d", n++); \
-    hbm = create_bitmap(BMP_CX, BMP_CX, RGB((grey),(grey),(grey)), comment); \
-    ImageList_Add(himl, hbm, NULL);
-
-    add_bitmap(255); add_bitmap(170); add_bitmap(85); add_bitmap(0);
-    add_bitmap(0); add_bitmap(85); add_bitmap(170); add_bitmap(255);
-    add_bitmap(255); add_bitmap(170); add_bitmap(85); add_bitmap(0);
-    add_bitmap(0); add_bitmap(85); add_bitmap(170); add_bitmap(255);
-    add_bitmap(255); add_bitmap(170); add_bitmap(85); add_bitmap(0);
-    add_bitmap(0); add_bitmap(85); add_bitmap(170); add_bitmap(255);
-#undef add_bitmap
-}
-
 #define iml_clear_stream_data() \
     HeapFree(GetProcessHeap(), 0, Test_Stream.iml_data); \
     Test_Stream.iml_data = NULL; \
     Test_Stream.iml_data_size = 0;
 
-static void check_iml_data(HIMAGELIST himl, INT cx, INT cy, INT cur, INT max,
+static void check_iml_data(HIMAGELIST himl, INT cx, INT cy, INT cur, INT max, INT grow,
                            INT width, INT height, INT bpp, const char *comment)
 {
     INT ret, cxx, cyy;
 
+    trace("%s\n", comment);
+
     ret = ImageList_GetImageCount(himl);
-    ok(ret == cur, "expected cur %d got %d\n", cur, ret);
+    ok(ret == cur, "expected image count %d got %d\n", cur, ret);
 
     ret = ImageList_GetIconSize(himl, &cxx, &cyy);
     ok(ret, "ImageList_GetIconSize failed\n");
@@ -937,57 +920,191 @@ static void check_iml_data(HIMAGELIST himl, INT cx, INT cy, INT cur, INT max,
     ok(Test_Stream.iml_data != 0, "ImageList_Write didn't write any data\n");
     ok(Test_Stream.iml_data_size > sizeof(ILHEAD), "ImageList_Write wrote not enough data\n");
 
-    check_ilhead_data(Test_Stream.iml_data, cx, cy, cur, max);
+    check_ilhead_data(Test_Stream.iml_data, cx, cy, cur, max, grow);
     check_bitmap_data(Test_Stream.iml_data + sizeof(ILHEAD),
                       Test_Stream.iml_data_size - sizeof(ILHEAD),
                       width, height, bpp, comment);
 }
 
+static void image_list_init(HIMAGELIST himl)
+{
+    HBITMAP hbm;
+    char comment[16];
+    INT n = 1, i;
+    static const struct test_data
+    {
+        BYTE grey;
+        INT cx, cy, cur, max, grow, width, height, bpp;
+        const char *comment;
+    } td[] =
+    {
+        { 255, BMP_CX, BMP_CX, 1, 2, 4, BMP_CX * 4, BMP_CX * 1, 24, "total 1" },
+        { 170, BMP_CX, BMP_CX, 2, 7, 4, BMP_CX * 4, BMP_CX * 2, 24, "total 2" },
+        { 85, BMP_CX, BMP_CX, 3, 7, 4, BMP_CX * 4, BMP_CX * 2, 24, "total 3" },
+        { 0, BMP_CX, BMP_CX, 4, 7, 4, BMP_CX * 4, BMP_CX * 2, 24, "total 4" },
+        { 0, BMP_CX, BMP_CX, 5, 7, 4, BMP_CX * 4, BMP_CX * 2, 24, "total 5" },
+        { 85, BMP_CX, BMP_CX, 6, 7, 4, BMP_CX * 4, BMP_CX * 2, 24, "total 6" },
+        { 170, BMP_CX, BMP_CX, 7, 12, 4, BMP_CX * 4, BMP_CX * 3, 24, "total 7" },
+        { 255, BMP_CX, BMP_CX, 8, 12, 4, BMP_CX * 4, BMP_CX * 3, 24, "total 8" },
+        { 255, BMP_CX, BMP_CX, 9, 12, 4, BMP_CX * 4, BMP_CX * 3, 24, "total 9" },
+        { 170, BMP_CX, BMP_CX, 10, 12, 4, BMP_CX * 4, BMP_CX * 3, 24, "total 10" },
+        { 85, BMP_CX, BMP_CX, 11, 12, 4, BMP_CX * 4, BMP_CX * 3, 24, "total 11" },
+        { 0, BMP_CX, BMP_CX, 12, 17, 4, BMP_CX * 4, BMP_CX * 5, 24, "total 12" },
+        { 0, BMP_CX, BMP_CX, 13, 17, 4, BMP_CX * 4, BMP_CX * 5, 24, "total 13" },
+        { 85, BMP_CX, BMP_CX, 14, 17, 4, BMP_CX * 4, BMP_CX * 5, 24, "total 14" },
+        { 170, BMP_CX, BMP_CX, 15, 17, 4, BMP_CX * 4, BMP_CX * 5, 24, "total 15" },
+        { 255, BMP_CX, BMP_CX, 16, 17, 4, BMP_CX * 4, BMP_CX * 5, 24, "total 16" },
+        { 255, BMP_CX, BMP_CX, 17, 22, 4, BMP_CX * 4, BMP_CX * 6, 24, "total 17" },
+        { 170, BMP_CX, BMP_CX, 18, 22, 4, BMP_CX * 4, BMP_CX * 6, 24, "total 18" },
+        { 85, BMP_CX, BMP_CX, 19, 22, 4, BMP_CX * 4, BMP_CX * 6, 24, "total 19" },
+        { 0, BMP_CX, BMP_CX, 20, 22, 4, BMP_CX * 4, BMP_CX * 6, 24, "total 20" },
+        { 0, BMP_CX, BMP_CX, 21, 22, 4, BMP_CX * 4, BMP_CX * 6, 24, "total 21" },
+        { 85, BMP_CX, BMP_CX, 22, 27, 4, BMP_CX * 4, BMP_CX * 7, 24, "total 22" },
+        { 170, BMP_CX, BMP_CX, 23, 27, 4, BMP_CX * 4, BMP_CX * 7, 24, "total 23" },
+        { 255, BMP_CX, BMP_CX, 24, 27, 4, BMP_CX * 4, BMP_CX * 7, 24, "total 24" }
+    };
+
+    check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, 4, BMP_CX * 4, BMP_CX * 1, 24, "total 0");
+
+#define add_bitmap(grey) \
+    sprintf(comment, "%d", n++); \
+    hbm = create_bitmap(BMP_CX, BMP_CX, RGB((grey),(grey),(grey)), comment); \
+    ImageList_Add(himl, hbm, NULL); \
+    DeleteObject(hbm);
+
+    for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+    {
+        add_bitmap(td[i].grey);
+        check_iml_data(himl, td[i].cx, td[i].cy, td[i].cur, td[i].max, td[i].grow,
+                       td[i].width, td[i].height, td[i].bpp, td[i].comment);
+    }
+#undef add_bitmap
+}
+
 static void test_imagelist_storage(void)
 {
     HIMAGELIST himl;
-    BOOL ret;
+    HBITMAP hbm;
+    INT ret;
 
     himl = ImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 1, 1);
     ok(himl != 0, "ImageList_Create failed\n");
 
-    check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, BMP_CX * 4, BMP_CX * 1, 24, "empty");
+    check_iml_data(himl, BMP_CX, BMP_CX, 0, 2, 4, BMP_CX * 4, BMP_CX * 1, 24, "empty");
 
     image_list_init(himl);
-    check_iml_data(himl, BMP_CX, BMP_CX, 24, 27, BMP_CX * 4, BMP_CX * 7, 24, "orig");
+    check_iml_data(himl, BMP_CX, BMP_CX, 24, 27, 4, BMP_CX * 4, BMP_CX * 7, 24, "orig");
 
     ret = ImageList_Remove(himl, 4);
     ok(ret, "ImageList_Remove failed\n");
-    check_iml_data(himl, BMP_CX, BMP_CX, 23, 27, BMP_CX * 4, BMP_CX * 7, 24, "1");
+    check_iml_data(himl, BMP_CX, BMP_CX, 23, 27, 4, BMP_CX * 4, BMP_CX * 7, 24, "1");
 
     ret = ImageList_Remove(himl, 5);
     ok(ret, "ImageList_Remove failed\n");
-    check_iml_data(himl, BMP_CX, BMP_CX, 22, 27, BMP_CX * 4, BMP_CX * 7, 24, "2");
+    check_iml_data(himl, BMP_CX, BMP_CX, 22, 27, 4, BMP_CX * 4, BMP_CX * 7, 24, "2");
 
     ret = ImageList_Remove(himl, 6);
     ok(ret, "ImageList_Remove failed\n");
-    check_iml_data(himl, BMP_CX, BMP_CX, 21, 27, BMP_CX * 4, BMP_CX * 7, 24, "3");
+    check_iml_data(himl, BMP_CX, BMP_CX, 21, 27, 4, BMP_CX * 4, BMP_CX * 7, 24, "3");
 
     ret = ImageList_Remove(himl, 7);
     ok(ret, "ImageList_Remove failed\n");
-    check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, BMP_CX * 4, BMP_CX * 7, 24, "4");
+    check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 4, BMP_CX * 4, BMP_CX * 7, 24, "4");
 
     ret = ImageList_Remove(himl, -2);
     ok(!ret, "ImageList_Remove(-2) should fail\n");
-    check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, BMP_CX * 4, BMP_CX * 7, 24, "5");
+    check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 4, BMP_CX * 4, BMP_CX * 7, 24, "5");
 
     ret = ImageList_Remove(himl, 20);
     ok(!ret, "ImageList_Remove(20) should fail\n");
-    check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, BMP_CX * 4, BMP_CX * 7, 24, "6");
+    check_iml_data(himl, BMP_CX, BMP_CX, 20, 27, 4, BMP_CX * 4, BMP_CX * 7, 24, "6");
 
     ret = ImageList_Remove(himl, -1);
     ok(ret, "ImageList_Remove(-1) failed\n");
-    check_iml_data(himl, BMP_CX, BMP_CX, 0, 4, BMP_CX * 4, BMP_CX * 1, 24, "7");
+    check_iml_data(himl, BMP_CX, BMP_CX, 0, 4, 4, BMP_CX * 4, BMP_CX * 1, 24, "7");
 
     ret = ImageList_Destroy(himl);
     ok(ret, "ImageList_Destroy failed\n");
 
     iml_clear_stream_data();
+
+    /* test ImageList_Create storage allocation */
+
+    himl = ImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 0, 32);
+    ok(himl != 0, "ImageList_Create failed\n");
+    check_iml_data(himl, BMP_CX, BMP_CX, 0, 1, 32, BMP_CX * 4, BMP_CX * 1, 24, "init 0 grow 32");
+    hbm = create_bitmap(BMP_CX * 9, BMP_CX, 0, "9");
+    ret = ImageList_Add(himl, hbm, NULL);
+    ok(ret == 0, "ImageList_Add returned %d, expected 0\n", ret);
+    check_iml_data(himl, BMP_CX, BMP_CX, 1, 34, 32, BMP_CX * 4, BMP_CX * 9, 24, "add 1 x 9");
+    DeleteObject(hbm);
+    ret = ImageList_Destroy(himl);
+    ok(ret, "ImageList_Destroy failed\n");
+    iml_clear_stream_data();
+
+    himl = ImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 4, 4);
+    ok(himl != 0, "ImageList_Create failed\n");
+    check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, BMP_CX * 4, BMP_CX * 2, 24, "init 4 grow 4");
+    hbm = create_bitmap(BMP_CX, BMP_CX * 9, 0, "9");
+    ret = ImageList_Add(himl, hbm, NULL);
+    ok(ret == 0, "ImageList_Add returned %d, expected 0\n", ret);
+    check_iml_data(himl, BMP_CX, BMP_CX, 9, 15, 4, BMP_CX * 4, BMP_CX * 4, 24, "add 9 x 1");
+    ret = ImageList_Add(himl, hbm, NULL);
+    ok(ret == 9, "ImageList_Add returned %d, expected 9\n", ret);
+    check_iml_data(himl, BMP_CX, BMP_CX, 18, 25, 4, BMP_CX * 4, BMP_CX * 7, 24, "add 9 x 1");
+    DeleteObject(hbm);
+    ret = ImageList_Destroy(himl);
+    ok(ret, "ImageList_Destroy failed\n");
+    iml_clear_stream_data();
+
+    himl = ImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 207, 209);
+    ok(himl != 0, "ImageList_Create failed\n");
+    check_iml_data(himl, BMP_CX, BMP_CX, 0, 208, 212, BMP_CX * 4, BMP_CX * 52, 24, "init 207 grow 209");
+    ret = ImageList_Destroy(himl);
+    ok(ret, "ImageList_Destroy failed\n");
+    iml_clear_stream_data();
+
+    himl = ImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 209, 207);
+    ok(himl != 0, "ImageList_Create failed\n");
+    check_iml_data(himl, BMP_CX, BMP_CX, 0, 210, 208, BMP_CX * 4, BMP_CX * 53, 24, "init 209 grow 207");
+    ret = ImageList_Destroy(himl);
+    ok(ret, "ImageList_Destroy failed\n");
+    iml_clear_stream_data();
+
+    himl = ImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 14, 4);
+    ok(himl != 0, "ImageList_Create failed\n");
+    check_iml_data(himl, BMP_CX, BMP_CX, 0, 15, 4, BMP_CX * 4, BMP_CX * 4, 24, "init 14 grow 4");
+    ret = ImageList_Destroy(himl);
+    ok(ret, "ImageList_Destroy failed\n");
+    iml_clear_stream_data();
+
+    himl = ImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 5, 9);
+    ok(himl != 0, "ImageList_Create failed\n");
+    check_iml_data(himl, BMP_CX, BMP_CX, 0, 6, 12, BMP_CX * 4, BMP_CX * 2, 24, "init 5 grow 9");
+    ret = ImageList_Destroy(himl);
+    ok(ret, "ImageList_Destroy failed\n");
+    iml_clear_stream_data();
+
+    himl = ImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 9, 5);
+    ok(himl != 0, "ImageList_Create failed\n");
+    check_iml_data(himl, BMP_CX, BMP_CX, 0, 10, 8, BMP_CX * 4, BMP_CX * 3, 24, "init 9 grow 5");
+    ret = ImageList_Destroy(himl);
+    ok(ret, "ImageList_Destroy failed\n");
+    iml_clear_stream_data();
+
+    himl = ImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 2, 4);
+    ok(himl != 0, "ImageList_Create failed\n");
+    check_iml_data(himl, BMP_CX, BMP_CX, 0, 3, 4, BMP_CX * 4, BMP_CX * 1, 24, "init 2 grow 4");
+    ret = ImageList_Destroy(himl);
+    ok(ret, "ImageList_Destroy failed\n");
+    iml_clear_stream_data();
+
+    himl = ImageList_Create(BMP_CX, BMP_CX, ILC_COLOR24, 4, 2);
+    ok(himl != 0, "ImageList_Create failed\n");
+    check_iml_data(himl, BMP_CX, BMP_CX, 0, 5, 4, BMP_CX * 4, BMP_CX * 2, 24, "init 4 grow 2");
+    ret = ImageList_Destroy(himl);
+    ok(ret, "ImageList_Destroy failed\n");
+    iml_clear_stream_data();
 }
 
 static void test_shell_imagelist(void)
index bf40db4..bfbaaa0 100644 (file)
@@ -371,6 +371,7 @@ static void test_wiznavigation(void)
 
     DestroyWindow(hdlg);
 }
+
 static void test_buttons(void)
 {
     HPROPSHEETPAGE hpsp[1];
@@ -436,6 +437,94 @@ static void test_buttons(void)
     DestroyWindow(hdlg);
 }
 
+static BOOL add_button_has_been_pressed;
+
+static INT_PTR CALLBACK
+page_with_custom_default_button_dlg_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+    switch (msg)
+    {
+    case WM_COMMAND:
+        switch(LOWORD(wparam))
+        {
+        case IDC_PS_PUSHBUTTON1:
+            switch(HIWORD(wparam))
+            {
+            case BN_CLICKED:
+                add_button_has_been_pressed = TRUE;
+                return TRUE;
+            }
+            break;
+        }
+        break;
+    }
+    return FALSE;
+}
+
+static void test_custom_default_button(void)
+{
+    HWND hdlg;
+    PROPSHEETPAGEA psp[1];
+    PROPSHEETHEADERA psh;
+    MSG msg;
+    LRESULT result;
+
+    psp[0].dwSize = sizeof (PROPSHEETPAGEA);
+    psp[0].dwFlags = PSP_USETITLE;
+    psp[0].hInstance = GetModuleHandleA(NULL);
+    U(psp[0]).pszTemplate = MAKEINTRESOURCE(IDD_PROP_PAGE_WITH_CUSTOM_DEFAULT_BUTTON);
+    U2(psp[0]).pszIcon = NULL;
+    psp[0].pfnDlgProc = page_with_custom_default_button_dlg_proc;
+    psp[0].pszTitle = "Page1";
+    psp[0].lParam = 0;
+
+    psh.dwSize = sizeof (PROPSHEETHEADERA);
+    psh.dwFlags = PSH_PROPSHEETPAGE | PSH_MODELESS;
+    psh.hwndParent = GetDesktopWindow();
+    psh.hInstance = GetModuleHandleA(NULL);
+    U(psh).pszIcon = NULL;
+    psh.pszCaption =  "PropertySheet1";
+    psh.nPages = 1;
+    U3(psh).ppsp = psp;
+    U2(psh).nStartPage = 0;
+
+    /* The goal of the test is to make sure that the Add button is pressed
+     * when the ENTER key is pressed and a different control, a combobox,
+     * has the keyboard focus. */
+    add_button_has_been_pressed = FALSE;
+
+    /* Create the modeless property sheet. */
+    hdlg = (HWND)PropertySheetA(&psh);
+    ok(hdlg != INVALID_HANDLE_VALUE, "Cannot create the property sheet\n");
+
+    /* Set the Add button as the default button. */
+    SendMessage(hdlg, DM_SETDEFID, (WPARAM)IDC_PS_PUSHBUTTON1, 0);
+
+    /* Make sure the default button is the Add button. */
+    result = SendMessage(hdlg, DM_GETDEFID, 0, 0);
+    ok(DC_HASDEFID == HIWORD(result), "The property sheet does not have a default button\n");
+    ok(IDC_PS_PUSHBUTTON1 == LOWORD(result), "The default button is not the Add button\n");
+
+    /* At this point, the combobox should have keyboard focus, so we press ENTER.
+     * Pull the lever, Kronk! */
+    keybd_event(VK_RETURN, 0, 0, 0);
+
+    /* Process all the messages in the queue for this thread. */
+    while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+    {
+        if (!PropSheet_IsDialogMessage(hdlg, &msg))
+        {
+            TranslateMessage(&msg);
+            DispatchMessage(&msg);
+        }
+    }
+
+    todo_wine
+    ok(add_button_has_been_pressed, "The Add button has not been pressed!\n");
+
+    DestroyWindow(hdlg);
+}
+
 START_TEST(propsheet)
 {
     test_title();
@@ -443,4 +532,5 @@ START_TEST(propsheet)
     test_disableowner();
     test_wiznavigation();
     test_buttons();
+    test_custom_default_button();
 }
index a75a064..d5f27b9 100644 (file)
@@ -925,6 +925,36 @@ static HWND create_parent_window(void)
     return hwnd;
 }
 
+static void test_showband(void)
+{
+    HWND hRebar;
+    REBARBANDINFOA rbi;
+    BOOL ret;
+
+    hRebar = create_rebar_control();
+
+    /* no bands */
+    ret = SendMessageA(hRebar, RB_SHOWBAND, 0, TRUE);
+    ok(ret == FALSE, "got %d\n", ret);
+
+    rbi.cbSize = REBARBANDINFOA_V6_SIZE;
+    rbi.fMask = RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_CHILD;
+    rbi.cx = 200;
+    rbi.cxMinChild = 100;
+    rbi.cyMinChild = 30;
+    rbi.hwndChild = NULL;
+    SendMessageA(hRebar, RB_INSERTBAND, -1, (LPARAM)&rbi);
+
+    /* index out of range */
+    ret = SendMessageA(hRebar, RB_SHOWBAND, 1, TRUE);
+    ok(ret == FALSE, "got %d\n", ret);
+
+    ret = SendMessageA(hRebar, RB_SHOWBAND, 0, TRUE);
+    ok(ret == TRUE, "got %d\n", ret);
+
+    DestroyWindow(hRebar);
+}
+
 START_TEST(rebar)
 {
     HMODULE hComctl32;
@@ -948,6 +978,7 @@ START_TEST(rebar)
 
     test_bandinfo();
     test_colors();
+    test_showband();
 
     if(!is_font_installed("System") || !is_font_installed("Tahoma"))
     {
index 8459fc8..beabce5 100644 (file)
 #define IDD_PROP_PAGE_RADIO 32
 #define IDD_PROP_PAGE_EXIT 33
 
+#define IDD_PROP_PAGE_WITH_CUSTOM_DEFAULT_BUTTON 34
+
 #define IDC_PS_EDIT1 1000
 #define IDC_PS_EDIT2 1001
 #define IDC_PS_RADIO1 1010
 #define IDC_PS_RADIO2 1011
 
+#define IDC_PS_COMBO1 1020
+#define IDC_PS_PUSHBUTTON1 1021
+
 #endif  /* __WINE_COMCTL32_TEST_RESOURCES_H */
index 06e382e..c817acd 100644 (file)
@@ -79,3 +79,11 @@ IDB_BITMAP_128x15 BITMAP bmp128x15.bmp
 
 /* @makedep: bmp80x15.bmp */
 IDB_BITMAP_80x15 BITMAP bmp80x15.bmp
+
+IDD_PROP_PAGE_WITH_CUSTOM_DEFAULT_BUTTON DIALOG DISCARDABLE  5, 43, 227, 215
+STYLE WS_CHILD | WS_DISABLED
+FONT 8, "MS Shell Dlg"
+{
+    COMBOBOX        IDC_PS_COMBO1, 16, 68, 140, 14, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Add", IDC_PS_PUSHBUTTON1, 164, 68, 40, 13
+}
index 848d4ca..320deba 100644 (file)
 
 const char *TEST_CALLBACK_TEXT = "callback_text";
 
-#define NUM_MSG_SEQUENCES   1
+#define NUM_MSG_SEQUENCES   2
 #define TREEVIEW_SEQ_INDEX  0
+#define PARENT_SEQ_INDEX    1
 
 #define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
 
-static struct msg_sequence *MsgSequences[NUM_MSG_SEQUENCES];
+static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
 
 static const struct message FillRootSeq[] = {
     { TVM_INSERTITEM, sent },
@@ -184,6 +185,16 @@ static const struct message test_get_set_unicodeformat_seq[] = {
     { 0 }
 };
 
+static const struct message parent_expand_seq[] = {
+    { WM_NOTIFY, sent|id, 0, 0, TVN_ITEMEXPANDING },
+    { WM_NOTIFY, sent|id, 0, 0, TVN_ITEMEXPANDED },
+    { 0 }
+};
+
+static const struct message empty_seq[] = {
+    { 0 }
+};
+
 static HWND hMainWnd;
 
 static HTREEITEM hRoot, hChild;
@@ -233,7 +244,7 @@ static LRESULT WINAPI TreeviewWndProc(HWND hwnd, UINT message, WPARAM wParam, LP
     if (defwndproc_counter) msg.flags |= defwinproc;
     msg.wParam = wParam;
     msg.lParam = lParam;
-    add_message(MsgSequences, TREEVIEW_SEQ_INDEX, &msg);
+    add_message(sequences, TREEVIEW_SEQ_INDEX, &msg);
 
     defwndproc_counter++;
     ret = CallWindowProcA(lpOldProc, hwnd, message, wParam, lParam);
@@ -286,7 +297,7 @@ static void test_fillroot(void)
 
     hTree = create_treeview_control();
 
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     fill_tree(hTree);
 
@@ -296,7 +307,7 @@ static void test_fillroot(void)
     AddItem('B');
     assert(hChild);
     AddItem('.');
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, FillRootSeq, "FillRoot", FALSE);
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, FillRootSeq, "FillRoot", FALSE);
     ok(!strcmp(sequence, "AB."), "Item creation\n");
 
     /* UMLPad 1.15 depends on this being not -1 (I_IMAGECALLBACK) */
@@ -386,7 +397,7 @@ static void test_select(void)
     fill_tree(hTree);
 
     /* root-none select tests */
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
     r = TreeView_SelectItem(hTree, NULL);
     expect(TRUE, r);
     Clear();
@@ -407,11 +418,11 @@ static void test_select(void)
     expect(TRUE, r);
     AddItem('.');
     ok(!strcmp(sequence, "1(nR)nR23(Rn)Rn45(nR)nR."), "root-none select test\n");
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, rootnone_select_seq,
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, rootnone_select_seq,
                 "root-none select seq", FALSE);
 
     /* root-child select tests */
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
     r = TreeView_SelectItem(hTree, NULL);
     expect(TRUE, r);
 
@@ -433,7 +444,7 @@ static void test_select(void)
     expect(TRUE, r);
     AddItem('.');
     ok(!strcmp(sequence, "1(nR)nR23(RC)RC45(CR)CR."), "root-child select test\n");
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, rootchild_select_seq,
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, rootchild_select_seq,
                 "root-child select seq", FALSE);
 
     DestroyWindow(hTree);
@@ -452,7 +463,7 @@ static void test_getitemtext(void)
     hTree = create_treeview_control();
     fill_tree(hTree);
 
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     /* add an item without TVIF_TEXT mask and pszText == NULL */
     ins.hParent = hRoot;
@@ -472,7 +483,7 @@ static void test_getitemtext(void)
     SendMessageA( hTree, TVM_GETITEM, 0, (LPARAM)&tvi );
     ok(!strcmp(szBuffer, ""), "szBuffer=\"%s\", expected \"\"\n", szBuffer);
     ok(SendMessageA(hTree, TVM_DELETEITEM, 0, (LPARAM)hChild), "DeleteItem failed\n");
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, getitemtext_seq, "get item text seq", FALSE);
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, getitemtext_seq, "get item text seq", FALSE);
 
     DestroyWindow(hTree);
 }
@@ -489,7 +500,7 @@ static void test_focus(void)
     hTree = create_treeview_control();
     fill_tree(hTree);
 
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     /* This test verifies that when a label is being edited, scrolling
      * the treeview does not cause the label to lose focus. To test
@@ -513,7 +524,7 @@ static void test_focus(void)
     hEdit = TreeView_EditLabel(hTree, hChild);
     ScrollWindowEx(hTree, -10, 0, NULL, NULL, NULL, NULL, SW_SCROLLCHILDREN);
     ok(GetFocus() == hEdit, "Edit control should have focus\n");
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, focus_seq, "focus test", TRUE);
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, focus_seq, "focus test", TRUE);
 
     DestroyWindow(hTree);
 }
@@ -526,7 +537,7 @@ static void test_get_set_bkcolor(void)
     hTree = create_treeview_control();
     fill_tree(hTree);
 
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     /* If the value is -1, the control is using the system color for the background color. */
     crColor = (COLORREF)SendMessage( hTree, TVM_GETBKCOLOR, 0, 0 );
@@ -545,7 +556,7 @@ static void test_get_set_bkcolor(void)
     /* Reset the default background */
     SendMessage( hTree, TVM_SETBKCOLOR, 0, -1 );
 
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, test_get_set_bkcolor_seq,
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_bkcolor_seq,
         "test get set bkcolor", FALSE);
 
     DestroyWindow(hTree);
@@ -559,7 +570,7 @@ static void test_get_set_imagelist(void)
     hTree = create_treeview_control();
     fill_tree(hTree);
 
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     /* Test a NULL HIMAGELIST */
     SendMessage( hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)hImageList );
@@ -568,7 +579,7 @@ static void test_get_set_imagelist(void)
 
     /* TODO: Test an actual image list */
 
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, test_get_set_imagelist_seq,
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_imagelist_seq,
         "test get imagelist", FALSE);
 
     DestroyWindow(hTree);
@@ -584,7 +595,7 @@ static void test_get_set_indent(void)
     hTree = create_treeview_control();
     fill_tree(hTree);
 
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     /* Finding the minimum indent */
     SendMessage( hTree, TVM_SETINDENT, 0, 0 );
@@ -596,7 +607,7 @@ static void test_get_set_indent(void)
     ulIndent = (DWORD)SendMessage( hTree, TVM_GETINDENT, 0, 0 );
     ok(ulIndent == ulMoreThanTwiceMin, "Indent reported as %d, expected %d\n", ulIndent, ulMoreThanTwiceMin);
 
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, test_get_set_indent_seq,
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_indent_seq,
         "test get set indent", FALSE);
 
     DestroyWindow(hTree);
@@ -610,13 +621,13 @@ static void test_get_set_insertmark(void)
     hTree = create_treeview_control();
     fill_tree(hTree);
 
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     SendMessage( hTree, TVM_SETINSERTMARKCOLOR, 0, crColor );
     crColor = (COLORREF)SendMessage( hTree, TVM_GETINSERTMARKCOLOR, 0, 0 );
     ok(crColor == RGB(0,0,0), "Insert mark color reported as 0x%.8x, expected 0x00000000\n", crColor);
 
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, test_get_set_insertmarkcolor_seq,
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_insertmarkcolor_seq,
         "test get set insertmark color", FALSE);
 
     DestroyWindow(hTree);
@@ -632,7 +643,7 @@ static void test_get_set_item(void)
     hTree = create_treeview_control();
     fill_tree(hTree);
 
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     /* Test the root item */
     tviRoot.hItem = hRoot;
@@ -654,7 +665,7 @@ static void test_get_set_item(void)
     strncpy(szBuffer, "Root", nBufferSize);
     SendMessage( hTree, TVM_SETITEM, 0, (LPARAM)&tviRoot );
 
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, test_get_set_item_seq,
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_item_seq,
         "test get set item", FALSE);
 
     DestroyWindow(hTree);
@@ -669,7 +680,7 @@ static void test_get_set_itemheight(void)
     hTree = create_treeview_control();
     fill_tree(hTree);
 
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     /* Assuming default height to begin with */
     ulOldHeight = (int) SendMessage( hTree, TVM_GETITEMHEIGHT, 0, 0 );
@@ -689,7 +700,7 @@ static void test_get_set_itemheight(void)
     ulNewHeight = (int) SendMessage( hTree, TVM_GETITEMHEIGHT, 0, 0 );
     ok(ulNewHeight == 8, "Uneven height not set properly, reported %d, expected %d\n", ulNewHeight, 8);
 
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, test_get_set_itemheight_seq,
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_itemheight_seq,
         "test get set item height", FALSE);
 
     DestroyWindow(hTree);
@@ -704,13 +715,13 @@ static void test_get_set_scrolltime(void)
     hTree = create_treeview_control();
     fill_tree(hTree);
 
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     SendMessage( hTree, TVM_SETSCROLLTIME, ulExpectedTime, 0 );
     ulTime = (int)SendMessage( hTree, TVM_GETSCROLLTIME, 0, 0 );
     ok(ulTime == ulExpectedTime, "Scroll time reported as %d, expected %d\n", ulTime, ulExpectedTime);
 
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, test_get_set_scrolltime_seq,
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_scrolltime_seq,
         "test get set scroll time", FALSE);
 
     DestroyWindow(hTree);
@@ -725,7 +736,7 @@ static void test_get_set_textcolor(void)
     hTree = create_treeview_control();
     fill_tree(hTree);
 
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     crColor = (COLORREF)SendMessage( hTree, TVM_GETTEXTCOLOR, 0, 0 );
     ok(crColor == -1, "Default text color reported as 0x%.8x\n", crColor);
@@ -743,7 +754,7 @@ static void test_get_set_textcolor(void)
     /* Reset the default text color */
     SendMessage( hTree, TVM_SETTEXTCOLOR, 0, CLR_NONE );
 
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, test_get_set_textcolor_seq,
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_textcolor_seq,
         "test get set text color", FALSE);
 
     DestroyWindow(hTree);
@@ -758,7 +769,7 @@ static void test_get_set_tooltips(void)
     hTree = create_treeview_control();
     fill_tree(hTree);
 
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     /* show even WS_POPUP treeview don't send NM_TOOLTIPSCREATED */
     hPopupTreeView = CreateWindow(WC_TREEVIEW, NULL, WS_POPUP|WS_VISIBLE, 0, 0, 100, 100, hMainWnd, NULL, NULL, NULL);
@@ -769,7 +780,7 @@ static void test_get_set_tooltips(void)
     hwndLastToolTip = (HWND)SendMessage( hTree, TVM_GETTOOLTIPS, 0, 0 );
     ok(hwndLastToolTip == NULL, "NULL tool tip, reported as 0x%p, expected 0.\n", hwndLastToolTip);
 
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, test_get_set_tooltips_seq,
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_tooltips_seq,
         "test get set tooltips", TRUE);
 
     /* TODO: Add a test of an actual tooltip */
@@ -785,7 +796,7 @@ static void test_get_set_unicodeformat(void)
     hTree = create_treeview_control();
     fill_tree(hTree);
 
-    flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     /* Set to Unicode */
     bPreviousSetting = (BOOL)SendMessage( hTree, TVM_SETUNICODEFORMAT, 1, 0 );
@@ -800,54 +811,131 @@ static void test_get_set_unicodeformat(void)
     /* Revert to original setting */
     SendMessage( hTree, TVM_SETUNICODEFORMAT, bPreviousSetting, 0 );
 
-    ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, test_get_set_unicodeformat_seq,
+    ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_unicodeformat_seq,
         "test get set unicode format", FALSE);
 
     DestroyWindow(hTree);
 }
 
-static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static TVITEMA g_item_expanding, g_item_expanded;
+static BOOL g_get_from_expand;
+static BOOL g_get_rect_in_expand;
+
+static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-    switch(msg) {
+    static LONG defwndproc_counter = 0;
+    struct message msg;
+    LRESULT ret;
+    RECT rect;
+    HTREEITEM visibleItem;
+
+    msg.message = message;
+    msg.flags = sent|wparam|lparam;
+    if (defwndproc_counter) msg.flags |= defwinproc;
+    msg.wParam = wParam;
+    msg.lParam = lParam;
+    if (message == WM_NOTIFY && lParam) msg.id = ((NMHDR*)lParam)->code;
+
+    /* log system messages, except for painting */
+    if (message < WM_USER &&
+        message != WM_PAINT &&
+        message != WM_ERASEBKGND &&
+        message != WM_NCPAINT &&
+        message != WM_NCHITTEST &&
+        message != WM_GETTEXT &&
+        message != WM_GETICON &&
+        message != WM_DEVICECHANGE)
+    {
+        trace("parent: %p, %04x, %08lx, %08lx\n", hWnd, message, wParam, lParam);
+        add_message(sequences, PARENT_SEQ_INDEX, &msg);
+    }
+
+    switch(message) {
     case WM_NOTIFY:
     {
         NMHDR *pHdr = (NMHDR *)lParam;
     
-        ok(pHdr->code != NM_FIRST - 19, "Treeview should not send NM_TOOLTIPSCREATED\n");
-        if (pHdr->idFrom == 100) {
+        ok(pHdr->code != NM_TOOLTIPSCREATED, "Treeview should not send NM_TOOLTIPSCREATED\n");
+        if (pHdr->idFrom == 100)
+        {
             NMTREEVIEWA *pTreeView = (LPNMTREEVIEWA) lParam;
-            switch(pHdr->code) {
+            switch(pHdr->code)
+            {
             case TVN_SELCHANGINGA:
                 AddItem('(');
                 IdentifyItem(pTreeView->itemOld.hItem);
                 IdentifyItem(pTreeView->itemNew.hItem);
-                return 0;
+                break;
             case TVN_SELCHANGEDA:
                 AddItem(')');
                 IdentifyItem(pTreeView->itemOld.hItem);
                 IdentifyItem(pTreeView->itemNew.hItem);
-                return 0;
+                break;
             case TVN_GETDISPINFOA: {
                 NMTVDISPINFOA *disp = (NMTVDISPINFOA *)lParam;
                 if (disp->item.mask & TVIF_TEXT) {
                     lstrcpyn(disp->item.pszText, TEST_CALLBACK_TEXT, disp->item.cchTextMax);
                 }
-                return 0;
+                break;
               }
             case TVN_ENDLABELEDIT: return TRUE;
+            case TVN_ITEMEXPANDING:
+                ok(pTreeView->itemNew.mask ==
+                   (TVIF_HANDLE | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_PARAM | TVIF_STATE),
+                   "got wrong mask %x\n", pTreeView->itemNew.mask);
+                ok((pTreeView->itemNew.state & TVIS_EXPANDED) == 0,
+                   "got wrong state %x\n", pTreeView->itemNew.state);
+                ok(pTreeView->itemOld.mask == 0,
+                   "got wrong mask %x\n", pTreeView->itemOld.mask);
+
+                if (g_get_from_expand)
+                {
+                  g_item_expanding.mask = TVIF_STATE;
+                  g_item_expanding.hItem = hRoot;
+                  ret = SendMessageA(pHdr->hwndFrom, TVM_GETITEMA, 0, (LPARAM)&g_item_expanding);
+                  ok(ret == TRUE, "got %lu\n", ret);
+                }
+                break;
+            case TVN_ITEMEXPANDED:
+                ok(pTreeView->itemNew.mask & TVIF_STATE, "got wrong mask %x\n", pTreeView->itemNew.mask);
+                ok(pTreeView->itemNew.state & (TVIS_EXPANDED|TVIS_EXPANDEDONCE),
+                   "got wrong mask %x\n", pTreeView->itemNew.mask);
+                ok(pTreeView->itemOld.mask == 0,
+                   "got wrong mask %x\n", pTreeView->itemOld.mask);
+
+                if (g_get_from_expand)
+                {
+                  g_item_expanded.mask = TVIF_STATE;
+                  g_item_expanded.hItem = hRoot;
+                  ret = SendMessageA(pHdr->hwndFrom, TVM_GETITEMA, 0, (LPARAM)&g_item_expanded);
+                  ok(ret == TRUE, "got %lu\n", ret);
+                }
+                if (g_get_rect_in_expand) {
+                  visibleItem = TreeView_GetNextItem(pHdr->hwndFrom, NULL, TVGN_FIRSTVISIBLE);
+                  ok(pTreeView->itemNew.hItem == visibleItem, "expanded item == first visible item\n");
+                  *(HTREEITEM*)&rect = visibleItem;
+                  ok(SendMessage(pHdr->hwndFrom, TVM_GETITEMRECT, TRUE, (LPARAM)&rect), "Failed to get rect for first visible item.\n");
+                  visibleItem = TreeView_GetNextItem(pHdr->hwndFrom, visibleItem, TVGN_NEXTVISIBLE);
+                  *(HTREEITEM*)&rect = visibleItem;
+                  ok(visibleItem != NULL, "There must be a visible item after the first visisble item.\n");
+                  todo_wine
+                  ok(SendMessage(pHdr->hwndFrom, TVM_GETITEMRECT, TRUE, (LPARAM)&rect), "Failed to get rect for second visible item.\n");
+                }
+                break;
             }
         }
-        return 0;
     }
-  
+
     case WM_DESTROY:
         PostQuitMessage(0);
         break;
-  
-    default:
-        return DefWindowProcA(hWnd, msg, wParam, lParam);
     }
-    return 0L;
+
+    defwndproc_counter++;
+    ret = DefWindowProcA(hWnd, message, wParam, lParam);
+    defwndproc_counter--;
+
+    return ret;
 }
 
 static void test_expandinvisible(void)
@@ -1037,6 +1125,73 @@ static void test_get_insertmarkcolor(void)
     DestroyWindow(hTree);
 }
 
+static void test_expandnotify(void)
+{
+    HWND hTree;
+    BOOL ret;
+    TVITEMA item;
+
+    hTree = create_treeview_control();
+    fill_tree(hTree);
+
+    item.hItem = hRoot;
+    item.mask = TVIF_STATE;
+
+    item.state = TVIS_EXPANDED;
+    ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
+    ok(ret == TRUE, "got %d\n", ret);
+    ok((item.state & TVIS_EXPANDED) == 0, "expected collapsed\n");
+
+    /* preselect root node here */
+    ret = SendMessageA(hTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hRoot);
+    ok(ret == TRUE, "got %d\n", ret);
+
+    g_get_from_expand = TRUE;
+    /* expand */
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+    g_item_expanding.state = 0xdeadbeef;
+    g_item_expanded.state = 0xdeadbeef;
+    ret = SendMessageA(hTree, TVM_EXPAND, TVE_EXPAND, (LPARAM)hRoot);
+    ok(ret == TRUE, "got %d\n", ret);
+    ok(g_item_expanding.state == TVIS_SELECTED, "got state on TVN_ITEMEXPANDING 0x%08x\n",
+       g_item_expanding.state);
+    ok(g_item_expanded.state == (TVIS_SELECTED|TVIS_EXPANDED), "got state on TVN_ITEMEXPANDED 0x%08x\n",
+       g_item_expanded.state);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, parent_expand_seq, "expand notifications", FALSE);
+    g_get_from_expand = FALSE;
+
+    /* check that it's expanded */
+    item.state = TVIS_EXPANDED;
+    ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
+    ok(ret == TRUE, "got %d\n", ret);
+    ok((item.state & TVIS_EXPANDED) == TVIS_EXPANDED, "expected expanded\n");
+
+    /* collapse */
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+    ret = SendMessageA(hTree, TVM_EXPAND, TVE_COLLAPSE, (LPARAM)hRoot);
+    ok(ret == TRUE, "got %d\n", ret);
+    item.state = TVIS_EXPANDED;
+    ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
+    ok(ret == TRUE, "got %d\n", ret);
+    ok((item.state & TVIS_EXPANDED) == 0, "expected collapsed\n");
+    /* all next collapse/expand attempts won't produce any notifications,
+       the only way is to reset with all children removed */
+    ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "collapse after expand notifications", FALSE);
+
+    DestroyWindow(hTree);
+}
+
+static void test_rect_retrieval_after_expand_with_select(void) {
+  BOOL ret;
+  HWND hTree;
+  hTree = create_treeview_control();
+  fill_tree(hTree);
+  g_get_rect_in_expand = TRUE;
+  ret = TreeView_Select(hTree, hChild, TVGN_CARET);
+  g_get_rect_in_expand = FALSE;
+  ok(ret,"TreeView_Select should return true\n");
+}
+
 START_TEST(treeview)
 {
     HMODULE hComctl32;
@@ -1056,7 +1211,7 @@ START_TEST(treeview)
     else
         InitCommonControls();
 
-    init_msg_sequences(MsgSequences, NUM_MSG_SEQUENCES);
+    init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
   
     wc.style = CS_HREDRAW | CS_VREDRAW;
     wc.cbClsExtra = 0;
@@ -1067,7 +1222,7 @@ START_TEST(treeview)
     wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
     wc.lpszMenuName = NULL;
     wc.lpszClassName = "MyTestWnd";
-    wc.lpfnWndProc = MyWndProc;
+    wc.lpfnWndProc = parent_wnd_proc;
     RegisterClassA(&wc);
 
     hMainWnd = CreateWindowExA(0, "MyTestWnd", "Blah", WS_OVERLAPPEDWINDOW,
@@ -1096,6 +1251,8 @@ START_TEST(treeview)
     test_expandinvisible();
     test_itemedit();
     test_treeview_classinfo();
+    test_expandnotify();
+    test_rect_retrieval_after_expand_with_select();
 
     PostMessageA(hMainWnd, WM_CLOSE, 0, 0);
     while(GetMessageA(&msg,0,0,0)) {
index f9ccaed..a59a95a 100644 (file)
@@ -60,11 +60,25 @@ static BOOL (WINAPI *pCertVerifyCertificateChainPolicy)(LPCSTR,PCCERT_CHAIN_CONT
 
 #define IS_INTOID(x)    (((ULONG_PTR)(x) >> 16) == 0)
 
+typedef struct _CERT_CHAIN_ENGINE_CONFIG_NO_EXCLUSIVE_ROOT
+{
+    DWORD       cbSize;
+    HCERTSTORE  hRestrictedRoot;
+    HCERTSTORE  hRestrictedTrust;
+    HCERTSTORE  hRestrictedOther;
+    DWORD       cAdditionalStore;
+    HCERTSTORE *rghAdditionalStore;
+    DWORD       dwFlags;
+    DWORD       dwUrlRetrievalTimeout;
+    DWORD       MaximumCachedCertificates;
+    DWORD       CycleDetectionModulus;
+} CERT_CHAIN_ENGINE_CONFIG_NO_EXCLUSIVE_ROOT;
 
 static void testCreateCertChainEngine(void)
 {
     BOOL ret;
-    CERT_CHAIN_ENGINE_CONFIG config = { 0 };
+    CERT_CHAIN_ENGINE_CONFIG_NO_EXCLUSIVE_ROOT config = { 0 };
+    CERT_CHAIN_ENGINE_CONFIG *pConfig = (CERT_CHAIN_ENGINE_CONFIG *)&config;
     HCERTCHAINENGINE engine;
     HCERTSTORE store;
 
@@ -77,21 +91,21 @@ static void testCreateCertChainEngine(void)
     /* Crash
     ret = pCertCreateCertificateChainEngine(NULL, NULL);
     ret = pCertCreateCertificateChainEngine(NULL, &engine);
-    ret = pCertCreateCertificateChainEngine(&config, NULL);
+    ret = pCertCreateCertificateChainEngine(pConfig, NULL);
      */
-    ret = pCertCreateCertificateChainEngine(&config, &engine);
+    ret = pCertCreateCertificateChainEngine(pConfig, &engine);
     ok(!ret && GetLastError() == E_INVALIDARG,
      "Expected E_INVALIDARG, got %08x\n", GetLastError());
     /* Crashes
     config.cbSize = sizeof(config);
-    ret = pCertCreateCertificateChainEngine(&config, NULL);
+    ret = pCertCreateCertificateChainEngine(pConfig, NULL);
      */
     config.cbSize = sizeof(config);
-    ret = pCertCreateCertificateChainEngine(&config, &engine);
+    ret = pCertCreateCertificateChainEngine(pConfig, &engine);
     ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError());
     pCertFreeCertificateChainEngine(engine);
     config.dwFlags = 0xff000000;
-    ret = pCertCreateCertificateChainEngine(&config, &engine);
+    ret = pCertCreateCertificateChainEngine(pConfig, &engine);
     ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError());
     pCertFreeCertificateChainEngine(engine);
 
@@ -99,7 +113,7 @@ static void testCreateCertChainEngine(void)
     store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
      CERT_STORE_CREATE_NEW_FLAG, NULL);
     config.hRestrictedRoot = store;
-    ret = pCertCreateCertificateChainEngine(&config, &engine);
+    ret = pCertCreateCertificateChainEngine(pConfig, &engine);
     ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError());
     pCertFreeCertificateChainEngine(engine);
 
@@ -108,7 +122,7 @@ static void testCreateCertChainEngine(void)
      */
     CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING, selfSignedCert,
      sizeof(selfSignedCert), CERT_STORE_ADD_ALWAYS, NULL);
-    ret = pCertCreateCertificateChainEngine(&config, &engine);
+    ret = pCertCreateCertificateChainEngine(pConfig, &engine);
     ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
      "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
 
@@ -2458,6 +2472,37 @@ static const BYTE chain28_1[] = {
 0x44,0x76,0x66,0x26,0xa7,0x05,0x3c,0x68,0x66,0x1c,0x07,0x4d,0xcf,0x54,0xaa,
 0x5d,0xba,0x7a,0x8f,0x06,0xa7,0x1e,0x86,0xf1,0x5a,0x4b,0x50,0x16,0xad,0x9f,
 0x89 };
+/* A chain whose end certificate is issued to *.winehq.org. */
+static const BYTE chain29_1[] = {
+0x30,0x82,0x01,0xab,0x30,0x82,0x01,0x16,0xa0,0x03,0x02,0x01,0x02,0x02,0x01,
+0x01,0x30,0x0b,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x30,
+0x10,0x31,0x0e,0x30,0x0c,0x06,0x03,0x55,0x04,0x03,0x13,0x05,0x43,0x65,0x72,
+0x74,0x31,0x30,0x1e,0x17,0x0d,0x30,0x37,0x30,0x35,0x30,0x31,0x30,0x30,0x30,
+0x30,0x30,0x30,0x5a,0x17,0x0d,0x30,0x37,0x31,0x30,0x30,0x31,0x30,0x30,0x30,
+0x30,0x30,0x30,0x5a,0x30,0x10,0x31,0x0e,0x30,0x0c,0x06,0x03,0x55,0x04,0x03,
+0x13,0x05,0x43,0x65,0x72,0x74,0x32,0x30,0x81,0x9d,0x30,0x0b,0x06,0x09,0x2a,
+0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x03,0x81,0x8d,0x00,0x30,0x81,0x89,
+0x02,0x81,0x81,0x00,0xb8,0x52,0xda,0xc5,0x4b,0x3f,0xe5,0x33,0x0e,0x67,0x5f,
+0x48,0x21,0xdc,0x7e,0xef,0x37,0x33,0xba,0xff,0xb4,0xc6,0xdc,0xb6,0x17,0x8e,
+0x20,0x55,0x07,0x12,0xd2,0x7b,0x3c,0xce,0x30,0xc5,0xa7,0x48,0x9f,0x6e,0xfe,
+0xb8,0xbe,0xdb,0x9f,0x9b,0x17,0x60,0x16,0xde,0xc6,0x8b,0x47,0xd1,0x57,0x71,
+0x3c,0x93,0xfc,0xbd,0xec,0x44,0x32,0x3b,0xb9,0xcf,0x6b,0x05,0x72,0xa7,0x87,
+0x8e,0x7e,0xd4,0x9a,0x87,0x1c,0x2f,0xb7,0x82,0x40,0xfc,0x6a,0x80,0x83,0x68,
+0x28,0xce,0x84,0xf4,0x0b,0x2e,0x44,0xcb,0x53,0xac,0x85,0x85,0xb5,0x46,0x36,
+0x98,0x3c,0x10,0x02,0xaa,0x02,0xbc,0x8b,0xa2,0x23,0xb2,0xd3,0x51,0x9a,0x22,
+0x4a,0xe3,0xaa,0x4e,0x7c,0xda,0x38,0xcf,0x49,0x98,0x72,0xa3,0x02,0x03,0x01,
+0x00,0x01,0xa3,0x1b,0x30,0x19,0x30,0x17,0x06,0x03,0x55,0x1d,0x07,0x04,0x10,
+0x30,0x0e,0x82,0x0c,0x2a,0x2e,0x77,0x69,0x6e,0x65,0x68,0x71,0x2e,0x6f,0x72,
+0x67,0x30,0x0b,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x03,
+0x81,0x81,0x00,0x65,0xbf,0xfa,0xf7,0xc3,0x09,0x70,0x25,0x8a,0x46,0x69,0xf6,
+0xdc,0x07,0x1e,0x30,0xc9,0xe4,0x58,0x89,0x65,0x3a,0xa8,0xda,0xbd,0x17,0xf8,
+0x1d,0x0d,0x7d,0x47,0xb1,0xb2,0xda,0x17,0x9f,0xf6,0x47,0xe0,0xe4,0x4a,0xeb,
+0x02,0xc9,0x2e,0x69,0x1c,0x57,0x2a,0x80,0xc9,0x01,0x77,0x7b,0x27,0xff,0x2f,
+0xaf,0xdf,0xf3,0x65,0x12,0xd8,0x7d,0xc2,0xbf,0x1b,0x1d,0x18,0x96,0x5c,0xf6,
+0xba,0x43,0xc5,0x43,0x57,0xc0,0xdd,0x97,0x95,0xfb,0x1c,0xad,0x64,0x0f,0x61,
+0x3a,0xe9,0x27,0xa4,0x57,0x27,0x34,0xa7,0x42,0xde,0x78,0x1a,0x71,0x80,0x23,
+0xd6,0xd7,0x22,0xf0,0x24,0x0d,0x71,0xf1,0x2b,0xd0,0xd8,0x76,0x3d,0xef,0x4c,
+0xce,0x1c,0x3b,0x83,0x1b,0x63,0x10,0x6c,0x63,0xe5,0x69 };
 
 typedef struct _CONST_DATA_BLOB
 {
@@ -2482,9 +2527,9 @@ typedef struct _CONST_BLOB_ARRAY
  * certArray, where the last certificate in the chain is expected to be the
  * end certificate (the one from which the chain is built.)
  */
-static PCCERT_CHAIN_CONTEXT getChain(const CONST_BLOB_ARRAY *certArray,
DWORD flags, BOOL includeStore, LPSYSTEMTIME checkTime, DWORD todo,
- DWORD testIndex)
+static PCCERT_CHAIN_CONTEXT getChain(HCERTCHAINENGINE engine,
const CONST_BLOB_ARRAY *certArray, DWORD flags, BOOL includeStore,
LPSYSTEMTIME checkTime, DWORD todo, DWORD testIndex)
 {
     HCERTSTORE store;
     PCCERT_CHAIN_CONTEXT chain = NULL;
@@ -2522,7 +2567,7 @@ static PCCERT_CHAIN_CONTEXT getChain(const CONST_BLOB_ARRAY *certArray,
             FILETIME fileTime;
 
             SystemTimeToFileTime(checkTime, &fileTime);
-            ret = pCertGetCertificateChain(NULL, endCert, &fileTime,
+            ret = pCertGetCertificateChain(engine, endCert, &fileTime,
              includeStore ? store : NULL, &chainPara, flags, NULL, &chain);
             if (todo & TODO_CHAIN)
                 todo_wine ok(ret, "Chain %d: CertGetCertificateChain failed: %08x\n",
@@ -3055,6 +3100,18 @@ static const CERT_TRUST_STATUS elementStatus28[] = {
 static const SimpleChainStatusCheck simpleStatus28[] = {
  { sizeof(elementStatus28) / sizeof(elementStatus28[0]), elementStatus28 },
 };
+static CONST_DATA_BLOB chain29[] = {
+ { sizeof(chain0_0), chain0_0 },
+ { sizeof(chain29_1), chain29_1 },
+};
+static const CERT_TRUST_STATUS elementStatus29[] = {
+ { CERT_TRUST_NO_ERROR, CERT_TRUST_HAS_NAME_MATCH_ISSUER },
+ { CERT_TRUST_IS_UNTRUSTED_ROOT | CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT,
+   CERT_TRUST_IS_SELF_SIGNED | CERT_TRUST_HAS_NAME_MATCH_ISSUER },
+};
+static const SimpleChainStatusCheck simpleStatus29[] = {
+ { sizeof(elementStatus29) / sizeof(elementStatus29[0]), elementStatus29 },
+};
 static CONST_DATA_BLOB selfSignedChain[] = {
  { sizeof(selfSignedCert), selfSignedCert }
 };
@@ -3340,6 +3397,7 @@ static ChainCheck chainCheck[] = {
        CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT, 0 },
      1, simpleStatus28 },
    0 },
+ /* chain29 is handled separately elsewhere */
  { { sizeof(selfSignedChain) / sizeof(selfSignedChain[0]), selfSignedChain },
    { { 0, CERT_TRUST_HAS_PREFERRED_ISSUER },
      { CERT_TRUST_IS_NOT_TIME_VALID | CERT_TRUST_IS_UNTRUSTED_ROOT, 0 },
@@ -3555,7 +3613,7 @@ static void testGetCertChain(void)
 
     for (i = 0; i < sizeof(chainCheck) / sizeof(chainCheck[0]); i++)
     {
-        chain = getChain(&chainCheck[i].certs, 0, TRUE, &oct2007,
+        chain = getChain(NULL, &chainCheck[i].certs, 0, TRUE, &oct2007,
          chainCheck[i].todo, i);
         if (chain)
         {
@@ -3567,7 +3625,7 @@ static void testGetCertChain(void)
     for (i = 0; i < sizeof(chainCheckNoStore) / sizeof(chainCheckNoStore[0]);
      i++)
     {
-        chain = getChain(&chainCheckNoStore[i].certs, 0, FALSE, &oct2007,
+        chain = getChain(NULL, &chainCheckNoStore[i].certs, 0, FALSE, &oct2007,
          chainCheckNoStore[i].todo, i);
         if (chain)
         {
@@ -3576,7 +3634,7 @@ static void testGetCertChain(void)
             pCertFreeCertificateChain(chain);
         }
     }
-    chain = getChain(&chainCheckEmbeddedNull.certs, 0, TRUE, &oct2007,
+    chain = getChain(NULL, &chainCheckEmbeddedNull.certs, 0, TRUE, &oct2007,
      chainCheckEmbeddedNull.todo, 0);
     if (chain)
     {
@@ -3758,6 +3816,16 @@ static const ChainPolicyCheck opensslPolicyCheckWithoutMatchingName = {
  { 0, CERT_E_CN_NO_MATCH, 0, 0, NULL}, NULL, 0
 };
 
+static const ChainPolicyCheck winehqPolicyCheckWithMatchingName = {
+ { sizeof(chain29) / sizeof(chain29[0]), chain29 },
+ { 0, 0, -1, -1, NULL}, NULL, 0
+};
+
+static const ChainPolicyCheck winehqPolicyCheckWithoutMatchingName = {
+ { sizeof(chain29) / sizeof(chain29[0]), chain29 },
+ { 0, CERT_E_CN_NO_MATCH, 0, 0, NULL}, NULL, 0
+};
+
 static const ChainPolicyCheck stanfordPolicyCheckWithMatchingName = {
  { sizeof(stanfordChain) / sizeof(stanfordChain[0]), stanfordChain },
  { 0, 0, -1, -1, NULL}, NULL, 0
@@ -3869,12 +3937,12 @@ static const char *num_to_str(WORD num)
     return buf;
 }
 
-static void checkChainPolicyStatus(LPCSTR policy, const ChainPolicyCheck *check,
- DWORD testIndex, SYSTEMTIME *sysTime, PCERT_CHAIN_POLICY_PARA para)
-
+static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine,
+ const ChainPolicyCheck *check, DWORD testIndex, SYSTEMTIME *sysTime,
+ PCERT_CHAIN_POLICY_PARA para)
 {
-    PCCERT_CHAIN_CONTEXT chain = getChain(&check->certs, 0, TRUE, sysTime,
-     check->todo, testIndex);
+    PCCERT_CHAIN_CONTEXT chain = getChain(engine, &check->certs, 0, TRUE,
+     sysTime, check->todo, testIndex);
 
     if (chain)
     {
@@ -3986,37 +4054,44 @@ static void check_ssl_policy(void)
      's','t','a','n','f','o','r','d','.','e','d','u',0 };
     WCHAR a_dot_cs_dot_stanford_dot_edu[] = { 'a','.','c','s','.',
      's','t','a','n','f','o','r','d','.','e','d','u',0 };
+    WCHAR test_dot_winehq_dot_org[] = { 't','e','s','t','.',
+     'w','i','n','e','h','q','.','o','r','g',0 };
+    WCHAR a_dot_b_dot_winehq_dot_org[] = { 'a','.','b','.',
+     'w','i','n','e','h','q','.','o','r','g',0 };
+    HCERTSTORE testRoot;
+    CERT_CHAIN_ENGINE_CONFIG engineConfig = { sizeof(engineConfig), 0 };
+    HCERTCHAINENGINE engine;
 
     /* Check ssl policy with no parameter */
     for (i = 0;
      i < sizeof(sslPolicyCheck) / sizeof(sslPolicyCheck[0]); i++)
-        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, &sslPolicyCheck[i], i,
-         &oct2007, NULL);
+        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL, &sslPolicyCheck[i],
+         i, &oct2007, NULL);
     /* Check again with a policy parameter that specifies nothing */
     for (i = 0;
      i < sizeof(sslPolicyCheck) / sizeof(sslPolicyCheck[0]); i++)
-        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, &sslPolicyCheck[i], i,
-         &oct2007, &policyPara);
+        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL, &sslPolicyCheck[i],
+         i, &oct2007, &policyPara);
     /* Check yet again, but specify an empty SSL_EXTRA_CERT_CHAIN_POLICY_PARA
      * argument.
      */
     policyPara.pvExtraPolicyPara = &sslPolicyPara;
     for (i = 0;
      i < sizeof(sslPolicyCheck) / sizeof(sslPolicyCheck[0]); i++)
-        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, &sslPolicyCheck[i], i,
-         &oct2007, &policyPara);
+        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL, &sslPolicyCheck[i],
+         i, &oct2007, &policyPara);
     /* And again, but specify the auth type as a client */
     sslPolicyPara.dwAuthType = AUTHTYPE_CLIENT;
     for (i = 0;
      i < sizeof(sslPolicyCheck) / sizeof(sslPolicyCheck[0]); i++)
-        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, &sslPolicyCheck[i], i,
-         &oct2007, &policyPara);
+        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL, &sslPolicyCheck[i],
+         i, &oct2007, &policyPara);
     /* And again, but specify the auth type as a server */
     sslPolicyPara.dwAuthType = AUTHTYPE_SERVER;
     for (i = 0;
      i < sizeof(sslPolicyCheck) / sizeof(sslPolicyCheck[0]); i++)
-        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, &sslPolicyCheck[i], i,
-         &oct2007, &policyPara);
+        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL, &sslPolicyCheck[i],
+         i, &oct2007, &policyPara);
     /* And again authenticating a client, but specify the size of the policy
      * parameter.
      */
@@ -4024,79 +4099,107 @@ static void check_ssl_policy(void)
     sslPolicyPara.dwAuthType = AUTHTYPE_CLIENT;
     for (i = 0;
      i < sizeof(sslPolicyCheck) / sizeof(sslPolicyCheck[0]); i++)
-        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, &sslPolicyCheck[i], i,
-         &oct2007, &policyPara);
+        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL, &sslPolicyCheck[i],
+         i, &oct2007, &policyPara);
     /* One more time authenticating a client, but specify winehq.org as the
      * server name.
      */
     sslPolicyPara.pwszServerName = winehq;
     for (i = 0;
      i < sizeof(sslPolicyCheck) / sizeof(sslPolicyCheck[0]); i++)
-        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, &sslPolicyCheck[i], i,
-         &oct2007, &policyPara);
+        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL, &sslPolicyCheck[i],
+         i, &oct2007, &policyPara);
     /* And again authenticating a server, still specifying winehq.org as the
      * server name.
      */
     sslPolicyPara.dwAuthType = AUTHTYPE_SERVER;
     for (i = 0;
      i < sizeof(sslPolicyCheck) / sizeof(sslPolicyCheck[0]); i++)
-        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, &sslPolicyCheck[i], i,
-         &oct2007, &policyPara);
+        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL, &sslPolicyCheck[i],
+         i, &oct2007, &policyPara);
     /* And again authenticating a server, this time specifying the size of the
      * policy param.
      */
     policyPara.cbSize = sizeof(policyPara);
     for (i = 0;
      i < sizeof(sslPolicyCheck) / sizeof(sslPolicyCheck[0]); i++)
-        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, &sslPolicyCheck[i], i,
-         &oct2007, &policyPara);
+        checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL, &sslPolicyCheck[i],
+         i, &oct2007, &policyPara);
     /* Yet again, but checking the iTunes chain, which contains a name
      * extension.
      */
-    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL,
+    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL,
      &iTunesPolicyCheckWithoutMatchingName, 0, &oct2007, &policyPara);
     /* And again, but checking the Google chain at a bad date */
     sslPolicyPara.pwszServerName = google_dot_com;
-    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL,
+    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL,
      &googlePolicyCheckWithMatchingNameExpired, 0, &oct2007, &policyPara);
     /* And again, but checking the Google chain at a good date */
     sslPolicyPara.pwszServerName = google_dot_com;
-    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL,
+    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL,
      &googlePolicyCheckWithMatchingName, 0, &oct2009, &policyPara);
     /* Check again with the openssl cert, which has a wildcard in its name,
      * with various combinations of matching and non-matching names.
      * With "a.openssl.org": match
      */
     sslPolicyPara.pwszServerName = a_dot_openssl_dot_org;
-    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL,
+    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL,
      &opensslPolicyCheckWithMatchingName, 0, &oct2009, &policyPara);
     /* With "openssl.org": no match */
     sslPolicyPara.pwszServerName = openssl_dot_org;
-    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL,
+    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL,
      &opensslPolicyCheckWithoutMatchingName, 0, &oct2009, &policyPara);
     /* With "fopenssl.org": no match */
     sslPolicyPara.pwszServerName = fopenssl_dot_org;
-    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL,
+    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL,
      &opensslPolicyCheckWithoutMatchingName, 0, &oct2009, &policyPara);
     /* with "a.b.openssl.org": no match */
     sslPolicyPara.pwszServerName = a_dot_b_dot_openssl_dot_org;
-    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL,
+    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL,
      &opensslPolicyCheckWithoutMatchingName, 0, &oct2009, &policyPara);
     /* Check again with the cs.stanford.edu, which has both cs.stanford.edu
      * and www.cs.stanford.edu in its subject alternative name.
      * With "cs.stanford.edu": match
      */
     sslPolicyPara.pwszServerName = cs_dot_stanford_dot_edu;
-    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL,
+    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL,
      &stanfordPolicyCheckWithMatchingName, 0, &oct2009, &policyPara);
     /* With "www.cs.stanford.edu": match */
     sslPolicyPara.pwszServerName = www_dot_cs_dot_stanford_dot_edu;
-    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL,
+    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL,
      &stanfordPolicyCheckWithMatchingName, 0, &oct2009, &policyPara);
     /* With "a.cs.stanford.edu": no match */
     sslPolicyPara.pwszServerName = a_dot_cs_dot_stanford_dot_edu;
-    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL,
+    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, NULL,
      &stanfordPolicyCheckWithoutMatchingName, 0, &oct2009, &policyPara);
+    /* Check chain29, which has a wildcard in its subject alternative name,
+     * but not in its distinguished name.
+     * Step 1: create a chain engine that trusts chain29's root.
+     */
+    testRoot = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
+     CERT_STORE_CREATE_NEW_FLAG, NULL);
+    CertAddEncodedCertificateToStore(testRoot, X509_ASN_ENCODING, chain0_0,
+     sizeof(chain0_0), CERT_STORE_ADD_ALWAYS, NULL);
+    engineConfig.hExclusiveRoot = testRoot;
+    if (!CertCreateCertificateChainEngine(&engineConfig, &engine))
+    {
+        skip("Couldn't create chain engine\n");
+        return;
+    }
+    /* With "winehq.org": no match */
+    sslPolicyPara.pwszServerName = winehq;
+    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, engine,
+     &winehqPolicyCheckWithoutMatchingName, 0, &oct2007, &policyPara);
+    /* With "test.winehq.org": match */
+    sslPolicyPara.pwszServerName = test_dot_winehq_dot_org;
+    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, engine,
+     &winehqPolicyCheckWithMatchingName, 0, &oct2007, &policyPara);
+    /* With "a.b.winehq.org": no match */
+    sslPolicyPara.pwszServerName = a_dot_b_dot_winehq_dot_org;
+    checkChainPolicyStatus(CERT_CHAIN_POLICY_SSL, engine,
+     &winehqPolicyCheckWithoutMatchingName, 0, &oct2007, &policyPara);
+    CertFreeCertificateChainEngine(engine);
+    CertCloseStore(testRoot, 0);
 }
 
 static void testVerifyCertChainPolicy(void)
@@ -4163,8 +4266,8 @@ static void testVerifyCertChainPolicy(void)
 
     for (i = 0;
      i < sizeof(basePolicyCheck) / sizeof(basePolicyCheck[0]); i++)
-        checkChainPolicyStatus(CERT_CHAIN_POLICY_BASE, &basePolicyCheck[i], i,
-         &oct2007, NULL);
+        checkChainPolicyStatus(CERT_CHAIN_POLICY_BASE, NULL,
+         &basePolicyCheck[i], i, &oct2007, NULL);
     check_ssl_policy();
     /* The authenticode policy doesn't seem to check anything beyond the base
      * policy.  It might check for chains signed by the MS test cert, but none
@@ -4172,12 +4275,12 @@ static void testVerifyCertChainPolicy(void)
      */
     for (i = 0; i <
      sizeof(authenticodePolicyCheck) / sizeof(authenticodePolicyCheck[0]); i++)
-        checkChainPolicyStatus(CERT_CHAIN_POLICY_AUTHENTICODE,
+        checkChainPolicyStatus(CERT_CHAIN_POLICY_AUTHENTICODE, NULL,
          &authenticodePolicyCheck[i], i, &oct2007, NULL);
     for (i = 0; i <
      sizeof(basicConstraintsPolicyCheck) / sizeof(basicConstraintsPolicyCheck[0]);
      i++)
-        checkChainPolicyStatus(CERT_CHAIN_POLICY_BASIC_CONSTRAINTS,
+        checkChainPolicyStatus(CERT_CHAIN_POLICY_BASIC_CONSTRAINTS, NULL,
          &basicConstraintsPolicyCheck[i], i, &oct2007, NULL);
 }
 
index 0f8ae7f..cc59a59 100644 (file)
@@ -4595,13 +4595,11 @@ static void test_decodeCRLToBeSigned(DWORD dwEncoding)
     if (buf)
     {
         CRL_INFO *info = (CRL_INFO *)buf;
-        CRL_ENTRY *entry;
 
         ok(size >= sizeof(CRL_INFO), "Wrong size %d\n", size);
         ok(info->cCRLEntry == 3, "Expected 3 CRL entries, got %d\n",
          info->cCRLEntry);
         ok(info->rgCRLEntry != NULL, "Expected a valid CRL entry array\n");
-        entry = info->rgCRLEntry;
         ok(info->cExtension == 2, "Expected 2 extensions, got %d\n",
          info->cExtension);
         LocalFree(buf);
@@ -7964,6 +7962,7 @@ static void testPortPublicKeyInfo(void)
      CRYPT_DELETEKEYSET);
     ret = CryptAcquireContextA(&csp, cspName, MS_DEF_PROV, PROV_RSA_FULL,
      CRYPT_NEWKEYSET);
+    ok(ret,"CryptAcquireContextA failed\n");
 
     testExportPublicKey(csp, &info);
     testImportPublicKey(csp, info);
@@ -7972,6 +7971,7 @@ static void testPortPublicKeyInfo(void)
     CryptReleaseContext(csp, 0);
     ret = CryptAcquireContextA(&csp, cspName, MS_DEF_PROV, PROV_RSA_FULL,
      CRYPT_DELETEKEYSET);
+    ok(ret,"CryptAcquireContextA failed\n");
 }
 
 START_TEST(encode)
index ee91e73..10a85a3 100644 (file)
@@ -277,29 +277,35 @@ static void testMemStore(void)
     CertCloseStore(store1, 0);
 }
 
-static void compareFile(LPCWSTR filename, const BYTE *pb, DWORD cb)
+static void compareStore(HCERTSTORE store, LPCSTR name, const BYTE *pb,
+ DWORD cb, BOOL todo)
 {
-    HANDLE h;
-    BYTE buf[200];
     BOOL ret;
-    DWORD cbRead = 0, totalRead = 0;
-
-    h = CreateFileW(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING,
-     FILE_ATTRIBUTE_NORMAL, NULL);
-    if (h == INVALID_HANDLE_VALUE)
-        return;
-    do {
-        ret = ReadFile(h, buf, sizeof(buf), &cbRead, NULL);
-        if (ret && cbRead)
-        {
-            ok(totalRead + cbRead <= cb, "Expected total count %d, see %d\n",
-             cb, totalRead + cbRead);
-            ok(!memcmp(pb + totalRead, buf, cbRead),
-             "Unexpected data in file\n");
-            totalRead += cbRead;
-        }
-    } while (ret && cbRead);
-    CloseHandle(h);
+    CRYPT_DATA_BLOB blob = { 0, NULL };
+
+    ret = CertSaveStore(store, X509_ASN_ENCODING, CERT_STORE_SAVE_AS_STORE,
+     CERT_STORE_SAVE_TO_MEMORY, &blob, 0);
+    ok(ret, "CertSaveStore failed: %08x\n", GetLastError());
+    if (todo)
+        todo_wine
+        ok(blob.cbData == cb, "%s: expected size %d, got %d\n", name, cb,
+         blob.cbData);
+    else
+        ok(blob.cbData == cb, "%s: expected size %d, got %d\n", name, cb,
+         blob.cbData);
+    blob.pbData = HeapAlloc(GetProcessHeap(), 0, blob.cbData);
+    if (blob.pbData)
+    {
+        ret = CertSaveStore(store, X509_ASN_ENCODING, CERT_STORE_SAVE_AS_STORE,
+         CERT_STORE_SAVE_TO_MEMORY, &blob, 0);
+        ok(ret, "CertSaveStore failed: %08x\n", GetLastError());
+        if (todo)
+            todo_wine
+            ok(!memcmp(pb, blob.pbData, cb), "%s: unexpected value\n", name);
+        else
+            ok(!memcmp(pb, blob.pbData, cb), "%s: unexpected value\n", name);
+        HeapFree(GetProcessHeap(), 0, blob.pbData);
+    }
 }
 
 static const BYTE serializedStoreWithCert[] = {
@@ -689,11 +695,10 @@ static void testCollectionStore(void)
      GetLastError());
     ret = pCertControlStore(collection, 0, CERT_STORE_CTRL_COMMIT, NULL);
     ok(ret, "CertControlStore failed: %d\n", ret);
-
+    compareStore(collection, "serialized store with cert",
+     serializedStoreWithCert, sizeof(serializedStoreWithCert), FALSE);
     CertCloseStore(collection, 0);
 
-    compareFile(filename, serializedStoreWithCert,
-     sizeof(serializedStoreWithCert));
     DeleteFileW(filename);
 }
 
@@ -1294,8 +1299,8 @@ static void testFileStore(void)
         /* with commits enabled, commit is allowed */
         ret = pCertControlStore(store, 0, CERT_STORE_CTRL_COMMIT, NULL);
         ok(ret, "CertControlStore failed: %d\n", ret);
-        compareFile(filename, serializedStoreWithCert,
-         sizeof(serializedStoreWithCert));
+        compareStore(store, "serialized store with cert",
+         serializedStoreWithCert, sizeof(serializedStoreWithCert), FALSE);
         CertCloseStore(store, 0);
     }
     file = CreateFileW(filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
@@ -1311,9 +1316,10 @@ static void testFileStore(void)
         ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING, signedCRL,
          sizeof(signedCRL), CERT_STORE_ADD_ALWAYS, NULL);
         ok(ret, "CertAddEncodedCRLToStore failed: %08x\n", GetLastError());
+        compareStore(store, "serialized store with cert and CRL",
+         serializedStoreWithCertAndCRL, sizeof(serializedStoreWithCertAndCRL),
+         FALSE);
         CertCloseStore(store, 0);
-        compareFile(filename, serializedStoreWithCertAndCRL,
-         sizeof(serializedStoreWithCertAndCRL));
     }
 
     DeleteFileW(filename);
@@ -1517,9 +1523,9 @@ static void testFileNameStore(void)
          bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, NULL);
         ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n",
          GetLastError());
+        compareStore(store, "serialized store with cert",
+         serializedStoreWithCert, sizeof(serializedStoreWithCert), FALSE);
         CertCloseStore(store, 0);
-        compareFile(filename, serializedStoreWithCert,
-         sizeof(serializedStoreWithCert));
     }
     store = CertOpenStore(CERT_STORE_PROV_FILENAME_W, 0, 0,
      CERT_FILE_STORE_COMMIT_ENABLE_FLAG, filename);
@@ -1529,9 +1535,10 @@ static void testFileNameStore(void)
         ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING,
          signedCRL, sizeof(signedCRL), CERT_STORE_ADD_ALWAYS, NULL);
         ok(ret, "CertAddEncodedCRLToStore failed: %08x\n", GetLastError());
+        compareStore(store, "serialized store with cert and CRL",
+         serializedStoreWithCertAndCRL, sizeof(serializedStoreWithCertAndCRL),
+         FALSE);
         CertCloseStore(store, 0);
-        compareFile(filename, serializedStoreWithCertAndCRL,
-         sizeof(serializedStoreWithCertAndCRL));
     }
     DeleteFileW(filename);
 
@@ -1757,6 +1764,69 @@ static void testMessageStore(void)
      "Expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
 }
 
+static void testSerializedStore(void)
+{
+    HCERTSTORE store;
+    CRYPT_DATA_BLOB blob;
+
+    if (0)
+    {
+        /* Crash */
+        store = CertOpenStore(CERT_STORE_PROV_SERIALIZED, 0, 0, 0, NULL);
+        store = CertOpenStore(CERT_STORE_PROV_SERIALIZED, 0, 0,
+         CERT_STORE_DELETE_FLAG, NULL);
+    }
+    blob.cbData = sizeof(serializedStoreWithCert);
+    blob.pbData = (BYTE *)serializedStoreWithCert;
+    store = CertOpenStore(CERT_STORE_PROV_SERIALIZED, 0, 0,
+     CERT_STORE_DELETE_FLAG, &blob);
+    ok(!store && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
+     "Expected ERROR_CALL_NOT_IMPLEMENTED, got %08x\n", GetLastError());
+    store = CertOpenStore(CERT_STORE_PROV_SERIALIZED, 0, 0, 0, &blob);
+    ok(store != NULL, "CertOpenStore failed: %08x\n", GetLastError());
+    if (store)
+    {
+        PCCERT_CONTEXT cert;
+        PCCRL_CONTEXT crl;
+
+        cert = CertEnumCertificatesInStore(store, NULL);
+        ok(cert != NULL, "CertEnumCertificatesInStore failed: %08x\n",
+         GetLastError());
+        cert = CertEnumCertificatesInStore(store, cert);
+        ok(!cert, "Expected only one cert\n");
+        if (pCertEnumCRLsInStore)
+        {
+            crl = pCertEnumCRLsInStore(store, NULL);
+            ok(!crl, "Expected no CRLs\n");
+        }
+        CertCloseStore(store, 0);
+    }
+    blob.cbData = sizeof(serializedStoreWithCertAndCRL);
+    blob.pbData = (BYTE *)serializedStoreWithCertAndCRL;
+    store = CertOpenStore(CERT_STORE_PROV_SERIALIZED, 0, 0, 0, &blob);
+    ok(store != NULL, "CertOpenStore failed: %08x\n", GetLastError());
+    if (store)
+    {
+        PCCERT_CONTEXT cert;
+        PCCRL_CONTEXT crl;
+
+        cert = CertEnumCertificatesInStore(store, NULL);
+        ok(cert != NULL, "CertEnumCertificatesInStore failed: %08x\n",
+         GetLastError());
+        cert = CertEnumCertificatesInStore(store, cert);
+        ok(!cert, "Expected only one cert\n");
+        if (pCertEnumCRLsInStore)
+        {
+            crl = pCertEnumCRLsInStore(store, NULL);
+            ok(crl != NULL, "CertEnumCRLsInStore failed: %08x\n",
+             GetLastError());
+            crl = pCertEnumCRLsInStore(store, crl);
+            ok(!crl, "Expected only one CRL\n");
+        }
+        CertCloseStore(store, 0);
+    }
+}
+
 static void testCertOpenSystemStore(void)
 {
     HCERTSTORE store;
@@ -2063,6 +2133,334 @@ static void testAddSerialized(void)
     CertCloseStore(store, 0);
 }
 
+static const BYTE serializedCertWithFriendlyName[] = {
+0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x57,0x00,0x69,
+0x00,0x6e,0x00,0x65,0x00,0x54,0x00,0x65,0x00,0x73,0x00,0x74,0x00,0x00,0x00,
+0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x30,0x7a,0x02,
+0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,
+0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,
+0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,
+0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,
+0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,
+0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x07,
+0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,0x03,
+0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,
+0x01 };
+static const BYTE serializedStoreWithCertWithFriendlyName[] = {
+0x00,0x00,0x00,0x00,0x43,0x45,0x52,0x54,0x0b,0x00,0x00,0x00,0x01,0x00,0x00,
+0x00,0x12,0x00,0x00,0x00,0x57,0x00,0x69,0x00,0x6e,0x00,0x65,0x00,0x54,0x00,
+0x65,0x00,0x73,0x00,0x74,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,
+0x00,0x7c,0x00,0x00,0x00,0x30,0x7a,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,
+0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,
+0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,
+0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,
+0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,
+0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,
+0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,
+0xa3,0x16,0x30,0x14,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,
+0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00 };
+static const BYTE serializedStoreWithCertAndHash[] = {
+0x00,0x00,0x00,0x00,0x43,0x45,0x52,0x54,0x03,0x00,0x00,0x00,0x01,0x00,0x00,
+0x00,0x14,0x00,0x00,0x00,0x6e,0x30,0x90,0x71,0x5f,0xd9,0x23,0x56,0xeb,0xae,
+0x25,0x40,0xe6,0x22,0xda,0x19,0x26,0x02,0xa6,0x08,0x20,0x00,0x00,0x00,0x01,
+0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x30,0x7a,0x02,0x01,0x01,0x30,0x02,0x06,
+0x00,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,
+0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,
+0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,
+0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,
+0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,
+0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,0x07,0x30,0x02,0x06,0x00,0x03,
+0x01,0x00,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,
+0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
+
+static void testAddCertificateLink(void)
+{
+    BOOL ret;
+    HCERTSTORE store1, store2;
+    PCCERT_CONTEXT source, linked;
+    DWORD size;
+    LPBYTE buf;
+    CERT_NAME_BLOB blob;
+    static const WCHAR szPrefix[] = { 'c','e','r',0 };
+    static const WCHAR szDot[] = { '.',0 };
+    static const WCHAR WineTestW[] = { 'W','i','n','e','T','e','s','t',0 };
+    WCHAR filename1[MAX_PATH], filename2[MAX_PATH];
+    HANDLE file;
+
+    if (0)
+    {
+        /* Crashes, i.e. the store is dereferenced without checking. */
+        ret = CertAddCertificateLinkToStore(NULL, NULL, 0, NULL);
+    }
+
+    /* Adding a certificate link to a store requires a valid add disposition */
+    store1 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
+     CERT_STORE_CREATE_NEW_FLAG, NULL);
+    SetLastError(0xdeadbeef);
+    ret = CertAddCertificateLinkToStore(store1, NULL, 0, NULL);
+    ok(!ret && GetLastError() == E_INVALIDARG,
+     "expected E_INVALIDARG, got %08x\n", GetLastError());
+    source = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
+     sizeof(bigCert));
+    SetLastError(0xdeadbeef);
+    ret = CertAddCertificateLinkToStore(store1, source, 0, NULL);
+    ok(!ret && GetLastError() == E_INVALIDARG,
+     "expected E_INVALIDARG, got %08x\n", GetLastError());
+    ret = CertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
+     NULL);
+    ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
+    if (0)
+    {
+        /* Crashes, i.e. the source certificate is dereferenced without
+         * checking when a valid add disposition is given.
+         */
+        ret = CertAddCertificateLinkToStore(store1, NULL, CERT_STORE_ADD_ALWAYS,
+         NULL);
+    }
+    CertCloseStore(store1, 0);
+
+    store1 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
+     CERT_STORE_CREATE_NEW_FLAG, NULL);
+    ret = CertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
+     &linked);
+    ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
+    if (ret)
+    {
+        ok(linked->hCertStore == store1, "unexpected store\n");
+        ret = CertSerializeCertificateStoreElement(linked, 0, NULL, &size);
+        ok(ret, "CertSerializeCertificateStoreElement failed: %08x\n",
+         GetLastError());
+        buf = HeapAlloc(GetProcessHeap(), 0, size);
+        if (buf)
+        {
+            ret = CertSerializeCertificateStoreElement(linked, 0, buf, &size);
+            /* The serialized linked certificate is identical to the serialized
+             * original certificate.
+             */
+            ok(size == sizeof(serializedCert), "Wrong size %d\n", size);
+            ok(!memcmp(serializedCert, buf, size),
+             "Unexpected serialized cert\n");
+            HeapFree(GetProcessHeap(), 0, buf);
+        }
+        /* Set a friendly name on the source certificate... */
+        blob.pbData = (LPBYTE)WineTestW;
+        blob.cbData = sizeof(WineTestW);
+        ret = CertSetCertificateContextProperty(source,
+         CERT_FRIENDLY_NAME_PROP_ID, 0, &blob);
+        ok(ret, "CertSetCertificateContextProperty failed: %08x\n",
+         GetLastError());
+        /* and the linked certificate has the same friendly name. */
+        ret = CertGetCertificateContextProperty(linked,
+         CERT_FRIENDLY_NAME_PROP_ID, NULL, &size);
+        ok(ret, "CertGetCertificateContextProperty failed: %08x\n",
+         GetLastError());
+        buf = HeapAlloc(GetProcessHeap(), 0, size);
+        if (buf)
+        {
+            ret = CertGetCertificateContextProperty(linked,
+             CERT_FRIENDLY_NAME_PROP_ID, buf, &size);
+            ok(!lstrcmpW((LPCWSTR)buf, WineTestW),
+             "unexpected friendly name\n");
+            HeapFree(GetProcessHeap(), 0, buf);
+        }
+        CertFreeCertificateContext(linked);
+    }
+    CertFreeCertificateContext(source);
+    CertCloseStore(store1, 0);
+
+    /* Test adding a cert to a file store, committing the change to the store,
+     * and creating a link to the resulting cert.
+     */
+    if (!GetTempFileNameW(szDot, szPrefix, 0, filename1))
+       return;
+
+    DeleteFileW(filename1);
+    file = CreateFileW(filename1, GENERIC_READ | GENERIC_WRITE, 0, NULL,
+     CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+    if (file == INVALID_HANDLE_VALUE)
+        return;
+
+    store1 = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0,
+     CERT_FILE_STORE_COMMIT_ENABLE_FLAG, file);
+    ok(store1 != NULL, "CertOpenStore failed: %08x\n", GetLastError());
+    CloseHandle(file);
+
+    ret = CertAddEncodedCertificateToStore(store1, X509_ASN_ENCODING,
+     bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, &source);
+    ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n",
+     GetLastError());
+
+    /* Test adding a link to a memory store. */
+    store2 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
+     CERT_STORE_CREATE_NEW_FLAG, NULL);
+    ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
+     &linked);
+    ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
+    if (ret)
+    {
+        ok(linked->hCertStore == store2, "unexpected store\n");
+        ret = CertSerializeCertificateStoreElement(linked, 0, NULL, &size);
+        ok(ret, "CertSerializeCertificateStoreElement failed: %08x\n",
+         GetLastError());
+        buf = HeapAlloc(GetProcessHeap(), 0, size);
+        if (buf)
+        {
+            ret = CertSerializeCertificateStoreElement(linked, 0, buf, &size);
+            /* The serialized linked certificate is identical to the serialized
+             * original certificate.
+             */
+            ok(size == sizeof(serializedCert), "Wrong size %d\n", size);
+            ok(!memcmp(serializedCert, buf, size),
+             "Unexpected serialized cert\n");
+            HeapFree(GetProcessHeap(), 0, buf);
+        }
+        /* Set a friendly name on the source certificate... */
+        blob.pbData = (LPBYTE)WineTestW;
+        blob.cbData = sizeof(WineTestW);
+        ret = CertSetCertificateContextProperty(source,
+         CERT_FRIENDLY_NAME_PROP_ID, 0, &blob);
+        ok(ret, "CertSetCertificateContextProperty failed: %08x\n",
+         GetLastError());
+        /* and the linked certificate has the same friendly name. */
+        ret = CertGetCertificateContextProperty(linked,
+         CERT_FRIENDLY_NAME_PROP_ID, NULL, &size);
+        ok(ret, "CertGetCertificateContextProperty failed: %08x\n",
+         GetLastError());
+        buf = HeapAlloc(GetProcessHeap(), 0, size);
+        if (buf)
+        {
+            ret = CertGetCertificateContextProperty(linked,
+             CERT_FRIENDLY_NAME_PROP_ID, buf, &size);
+            ok(!lstrcmpW((LPCWSTR)buf, WineTestW),
+             "unexpected friendly name\n");
+            HeapFree(GetProcessHeap(), 0, buf);
+        }
+        CertFreeCertificateContext(linked);
+    }
+    CertCloseStore(store2, 0);
+
+    if (!GetTempFileNameW(szDot, szPrefix, 0, filename2))
+       return;
+
+    DeleteFileW(filename2);
+    file = CreateFileW(filename2, GENERIC_READ | GENERIC_WRITE, 0, NULL,
+     CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+    if (file == INVALID_HANDLE_VALUE)
+        return;
+
+    store2 = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0,
+     CERT_FILE_STORE_COMMIT_ENABLE_FLAG, file);
+    ok(store2 != NULL, "CertOpenStore failed: %08x\n", GetLastError());
+    CloseHandle(file);
+    /* Test adding a link to a file store. */
+    ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
+     &linked);
+    ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
+    if (ret)
+    {
+        ok(linked->hCertStore == store2, "unexpected store\n");
+        ret = CertSerializeCertificateStoreElement(linked, 0, NULL, &size);
+        ok(ret, "CertSerializeCertificateStoreElement failed: %08x\n",
+         GetLastError());
+        buf = HeapAlloc(GetProcessHeap(), 0, size);
+        if (buf)
+        {
+            ret = CertSerializeCertificateStoreElement(linked, 0, buf, &size);
+            ok(ret, "CertSerializeCertificateStoreElement failed: %08x\n",
+             GetLastError());
+            /* The serialized linked certificate now contains the friendly
+             * name property.
+             */
+            ok(size == sizeof(serializedCertWithFriendlyName),
+             "Wrong size %d\n", size);
+            ok(!memcmp(serializedCertWithFriendlyName, buf, size),
+             "Unexpected serialized cert\n");
+            HeapFree(GetProcessHeap(), 0, buf);
+        }
+        CertFreeCertificateContext(linked);
+        compareStore(store2, "file store -> file store",
+         serializedStoreWithCertWithFriendlyName,
+         sizeof(serializedStoreWithCertWithFriendlyName), FALSE);
+    }
+    CertCloseStore(store2, 0);
+    DeleteFileW(filename2);
+
+    CertFreeCertificateContext(source);
+
+    CertCloseStore(store1, 0);
+    DeleteFileW(filename1);
+
+    /* Test adding a link to a system store (which is a collection store.) */
+    store1 = CertOpenSystemStoreA(0, "My");
+    source = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
+     sizeof(bigCert));
+    SetLastError(0xdeadbeef);
+    ret = CertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS,
+     &linked);
+    ok(!ret && GetLastError() == E_INVALIDARG,
+     "expected E_INVALIDARG, got %08x\n", GetLastError());
+    CertFreeCertificateContext(source);
+
+    /* Test adding a link to a file store, where the linked certificate is
+     * in a system store.
+     */
+    ret = CertAddEncodedCertificateToStore(store1, X509_ASN_ENCODING,
+     bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, &source);
+    ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n",
+     GetLastError());
+    if (!GetTempFileNameW(szDot, szPrefix, 0, filename1))
+       return;
+
+    DeleteFileW(filename1);
+    file = CreateFileW(filename1, GENERIC_READ | GENERIC_WRITE, 0, NULL,
+     CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+    if (file == INVALID_HANDLE_VALUE)
+        return;
+
+    store2 = CertOpenStore(CERT_STORE_PROV_FILE, 0, 0,
+     CERT_FILE_STORE_COMMIT_ENABLE_FLAG, file);
+    ok(store2 != NULL, "CertOpenStore failed: %08x\n", GetLastError());
+    CloseHandle(file);
+
+    ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
+     &linked);
+    ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
+    if (ret)
+    {
+        ok(linked->hCertStore == store2, "unexpected store\n");
+        ret = pCertControlStore(store2, 0, CERT_STORE_CTRL_COMMIT, NULL);
+        ok(ret, "CertControlStore failed: %d\n", ret);
+        compareStore(store2, "file store -> system store",
+         serializedStoreWithCertAndHash,
+         sizeof(serializedStoreWithCertAndHash), TRUE);
+        CertFreeCertificateContext(linked);
+    }
+
+    CertCloseStore(store2, 0);
+    DeleteFileW(filename1);
+
+    /* Test adding a link to a registry store, where the linked certificate is
+     * in a system store.
+     */
+    store2 = CertOpenStore(CERT_STORE_PROV_SYSTEM_REGISTRY, 0, 0,
+     CERT_SYSTEM_STORE_CURRENT_USER, WineTestW);
+    ok(store2 != NULL, "CertOpenStore failed: %08x\n", GetLastError());
+    ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS,
+     &linked);
+    ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError());
+    if (ret)
+    {
+        ok(linked->hCertStore == store2, "unexpected store\n");
+        CertDeleteCertificateFromStore(linked);
+    }
+    CertCloseStore(store2, 0);
+
+    CertFreeCertificateContext(source);
+    CertCloseStore(store1, 0);
+}
+
 static DWORD countCertsInStore(HCERTSTORE store)
 {
     PCCERT_CONTEXT cert = NULL;
@@ -2185,12 +2583,14 @@ START_TEST(store)
     testFileStore();
     testFileNameStore();
     testMessageStore();
+    testSerializedStore();
 
     testCertOpenSystemStore();
     testCertEnumSystemStore();
     testStoreProperty();
 
     testAddSerialized();
+    testAddCertificateLink();
 
     test_I_UpdateStore();
 }
index 618e494..1cdafa4 100644 (file)
@@ -60,6 +60,29 @@ static const BYTE certWithCRLDistPoint[] = {
 0x25,0x06,0x03,0x55,0x1d,0x1f,0x01,0x01,0xff,0x04,0x1b,0x30,0x19,0x30,0x17,
 0xa0,0x15,0xa0,0x13,0x86,0x11,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x69,
 0x6e,0x65,0x68,0x71,0x2e,0x6f,0x72,0x67, };
+static const BYTE certWithAIAWithCAIssuers[] = {
+0x30,0x82,0x01,0x3c,0xa0,0x03,0x02,0x01,0x02,0x02,0x01,0x01,0x30,0x0b,0x06,
+0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x30,0x14,0x31,0x12,0x30,
+0x10,0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
+0x6e,0x67,0x30,0x1e,0x17,0x0d,0x30,0x39,0x31,0x30,0x32,0x38,0x30,0x30,0x30,
+0x30,0x30,0x30,0x5a,0x17,0x0d,0x32,0x30,0x31,0x31,0x32,0x37,0x30,0x30,0x30,
+0x30,0x30,0x30,0x5a,0x30,0x14,0x31,0x12,0x30,0x10,0x06,0x03,0x55,0x04,0x03,
+0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x30,0x81,0xa5,0x30,
+0x0b,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x03,0x81,0x95,
+0x00,0x06,0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x52,0x53,0x41,0x31,0x00,0x04,
+0x00,0x00,0x01,0x00,0x01,0x00,0x2f,0xb2,0x8c,0xff,0x6c,0xf1,0xb1,0x61,0x9c,
+0x3a,0x8f,0x5e,0x35,0x2f,0x1f,0xd5,0xcf,0x2a,0xf6,0x9e,0x37,0xe8,0x89,0xa2,
+0xb1,0x1c,0xc0,0x1c,0xb6,0x72,0x45,0x97,0xe5,0x88,0x3d,0xfe,0xa6,0x27,0xea,
+0xd6,0x07,0x0f,0xcd,0xba,0x49,0x06,0x16,0xdb,0xad,0x06,0x76,0x39,0x4c,0x15,
+0xdf,0xe2,0x07,0xc5,0x99,0x1b,0x98,0x4b,0xc3,0x8e,0x89,0x12,0x95,0x9e,0x3b,
+0xb9,0x59,0xfe,0x91,0x33,0xc1,0x1f,0xce,0x8f,0xab,0x93,0x25,0x01,0x3e,0xde,
+0xf1,0x58,0x3b,0xe7,0x7a,0x03,0x14,0x07,0x09,0x0a,0x21,0x2d,0x12,0x11,0x08,
+0x78,0x07,0x9e,0x34,0xc3,0xc5,0xde,0xb2,0xd8,0xd7,0x86,0x0d,0x0d,0xcd,0x81,
+0xa4,0x2d,0x7c,0x82,0x50,0xca,0x2a,0xc2,0x99,0xe5,0xf3,0xca,0x7e,0xad,0xa3,
+0x31,0x30,0x2f,0x30,0x2d,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x01,
+0x04,0x21,0x30,0x1f,0x30,0x1d,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30,
+0x02,0x86,0x11,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x69,0x6e,0x65,0x68,
+0x71,0x2e,0x6f,0x72,0x67 };
 
 static void compareUrlArray(const CRYPT_URL_ARRAY *expected,
  const CRYPT_URL_ARRAY *got)
@@ -231,6 +254,45 @@ static void test_getObjectUrl(void)
          "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
         CertFreeCertificateContext(cert);
     }
+    cert = CertCreateCertificateContext(X509_ASN_ENCODING,
+     certWithAIAWithCAIssuers, sizeof(certWithAIAWithCAIssuers));
+    if (cert)
+    {
+        PCRYPT_URL_ARRAY urlArray;
+
+        /* This has an AIA extension with the CA Issuers set, so expect it
+         * to succeed:
+         */
+        ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER,
+         (void *)cert, 0, NULL, &urlArraySize, NULL, NULL, NULL);
+        ok(ret, "CryptGetObjectUrl failed: %08x\n", GetLastError());
+        if (ret)
+        {
+            urlArray = HeapAlloc(GetProcessHeap(), 0, urlArraySize);
+            if (urlArray)
+            {
+                ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER,
+                 (void *)cert, CRYPT_GET_URL_FROM_EXTENSION, urlArray,
+                 &urlArraySize, NULL, NULL, NULL);
+                ok(ret, "CryptGetObjectUrl failed: %08x\n", GetLastError());
+                if (ret)
+                {
+                    LPWSTR pUrl = url;
+                    CRYPT_URL_ARRAY expectedUrl = { 1, &pUrl };
+
+                    compareUrlArray(&expectedUrl, urlArray);
+                }
+                HeapFree(GetProcessHeap(), 0, urlArray);
+            }
+        }
+        /* It doesn't have a CRL dist points extension, so this should fail */
+        SetLastError(0xdeadbeef);
+        ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT,
+         (void *)cert, 0, NULL, &urlArraySize, NULL, NULL, NULL);
+        ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
+         "expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
+        CertFreeCertificateContext(cert);
+    }
 }
 
 static void make_tmp_file(LPSTR path)
@@ -376,10 +438,13 @@ static void test_retrieveObjectByUrl(void)
         skip("no usable CertificateContext\n");
         return;
     }
+    CertFreeCertificateContext(cert);
 
     aux.pLastSyncTime = &ft;
     ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CERTIFICATE, 0, 0,
      (void **)&cert, NULL, NULL, NULL, &aux);
+    ok(ret, "CryptRetrieveObjectByUrlA failed: %08x\n", GetLastError());
+    CertFreeCertificateContext(cert);
     ok(ft.dwLowDateTime || ft.dwHighDateTime,
      "Expected last sync time to be set\n");
     DeleteFileA(tmpfile);
@@ -393,8 +458,234 @@ static void test_retrieveObjectByUrl(void)
      GetLastError());
 }
 
+static const BYTE rootWithKeySignAndCRLSign[] = {
+0x30,0x82,0x01,0xdf,0x30,0x82,0x01,0x4c,0xa0,0x03,0x02,0x01,0x02,0x02,0x10,
+0x5b,0xc7,0x0b,0x27,0x99,0xbb,0x2e,0x99,0x47,0x9d,0x45,0x4e,0x7c,0x1a,0xca,
+0xe8,0x30,0x09,0x06,0x05,0x2b,0x0e,0x03,0x02,0x1d,0x05,0x00,0x30,0x10,0x31,
+0x0e,0x30,0x0c,0x06,0x03,0x55,0x04,0x03,0x13,0x05,0x43,0x65,0x72,0x74,0x31,
+0x30,0x1e,0x17,0x0d,0x30,0x37,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,
+0x30,0x5a,0x17,0x0d,0x30,0x37,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x39,0x35,
+0x39,0x5a,0x30,0x10,0x31,0x0e,0x30,0x0c,0x06,0x03,0x55,0x04,0x03,0x13,0x05,
+0x43,0x65,0x72,0x74,0x31,0x30,0x81,0x9f,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,
+0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8d,0x00,0x30,0x81,0x89,
+0x02,0x81,0x81,0x00,0xad,0x7e,0xca,0xf3,0xe5,0x99,0xc2,0x2a,0xca,0x50,0x82,
+0x7c,0x2d,0xa4,0x81,0xcd,0x0d,0x0d,0x86,0xd7,0xd8,0xb2,0xde,0xc5,0xc3,0x34,
+0x9e,0x07,0x78,0x08,0x11,0x12,0x2d,0x21,0x0a,0x09,0x07,0x14,0x03,0x7a,0xe7,
+0x3b,0x58,0xf1,0xde,0x3e,0x01,0x25,0x93,0xab,0x8f,0xce,0x1f,0xc1,0x33,0x91,
+0xfe,0x59,0xb9,0x3b,0x9e,0x95,0x12,0x89,0x8e,0xc3,0x4b,0x98,0x1b,0x99,0xc5,
+0x07,0xe2,0xdf,0x15,0x4c,0x39,0x76,0x06,0xad,0xdb,0x16,0x06,0x49,0xba,0xcd,
+0x0f,0x07,0xd6,0xea,0x27,0xa6,0xfe,0x3d,0x88,0xe5,0x97,0x45,0x72,0xb6,0x1c,
+0xc0,0x1c,0xb1,0xa2,0x89,0xe8,0x37,0x9e,0xf6,0x2a,0xcf,0xd5,0x1f,0x2f,0x35,
+0x5e,0x8f,0x3a,0x9c,0x61,0xb1,0xf1,0x6c,0xff,0x8c,0xb2,0x2f,0x02,0x03,0x01,
+0x00,0x01,0xa3,0x42,0x30,0x40,0x30,0x0e,0x06,0x03,0x55,0x1d,0x0f,0x01,0x01,
+0xff,0x04,0x04,0x03,0x02,0x00,0x06,0x30,0x0f,0x06,0x03,0x55,0x1d,0x13,0x01,
+0x01,0xff,0x04,0x05,0x30,0x03,0x01,0x01,0xff,0x30,0x1d,0x06,0x03,0x55,0x1d,
+0x0e,0x04,0x16,0x04,0x14,0x14,0x8c,0x16,0xbb,0xbe,0x70,0xa2,0x28,0x89,0xa0,
+0x58,0xff,0x98,0xbd,0xa8,0x24,0x2b,0x8a,0xe9,0x9a,0x30,0x09,0x06,0x05,0x2b,
+0x0e,0x03,0x02,0x1d,0x05,0x00,0x03,0x81,0x81,0x00,0x74,0xcb,0x21,0xfd,0x2d,
+0x25,0xdc,0xa5,0xaa,0xa1,0x26,0xdc,0x8b,0x40,0x11,0x64,0xae,0x5c,0x71,0x3c,
+0x28,0xbc,0xf9,0xb3,0xcb,0xa5,0x94,0xb2,0x8d,0x4c,0x23,0x2b,0x9b,0xde,0x2c,
+0x4c,0x30,0x04,0xc6,0x88,0x10,0x2f,0x53,0xfd,0x6c,0x82,0xf1,0x13,0xfb,0xda,
+0x27,0x75,0x25,0x48,0xe4,0x72,0x09,0x2a,0xee,0xb4,0x1e,0xc9,0x55,0xf5,0xf7,
+0x82,0x91,0xd8,0x4b,0xe4,0x3a,0xfe,0x97,0x87,0xdf,0xfb,0x15,0x5a,0x12,0x3e,
+0x12,0xe6,0xad,0x40,0x0b,0xcf,0xee,0x1a,0x44,0xe0,0x83,0xb2,0x67,0x94,0xd4,
+0x2e,0x7c,0xf2,0x06,0x9d,0xb3,0x3b,0x7e,0x2f,0xda,0x25,0x66,0x7e,0xa7,0x1f,
+0x45,0xd4,0xf5,0xe3,0xdf,0x2a,0xf1,0x18,0x28,0x20,0xb5,0xf8,0xf5,0x8d,0x7a,
+0x2e,0x84,0xee };
+static const BYTE eeCert[] = {
+0x30,0x82,0x01,0xb9,0x30,0x82,0x01,0x22,0xa0,0x03,0x02,0x01,0x02,0x02,0x01,
+0x01,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,
+0x00,0x30,0x10,0x31,0x0e,0x30,0x0c,0x06,0x03,0x55,0x04,0x03,0x13,0x05,0x43,
+0x65,0x72,0x74,0x31,0x30,0x1e,0x17,0x0d,0x30,0x37,0x30,0x35,0x30,0x31,0x30,
+0x30,0x30,0x30,0x30,0x30,0x5a,0x17,0x0d,0x30,0x37,0x31,0x30,0x30,0x31,0x30,
+0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x10,0x31,0x0e,0x30,0x0c,0x06,0x03,0x55,
+0x04,0x03,0x13,0x05,0x43,0x65,0x72,0x74,0x32,0x30,0x81,0x9f,0x30,0x0d,0x06,
+0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8d,
+0x00,0x30,0x81,0x89,0x02,0x81,0x81,0x00,0xb8,0x52,0xda,0xc5,0x4b,0x3f,0xe5,
+0x33,0x0e,0x67,0x5f,0x48,0x21,0xdc,0x7e,0xef,0x37,0x33,0xba,0xff,0xb4,0xc6,
+0xdc,0xb6,0x17,0x8e,0x20,0x55,0x07,0x12,0xd2,0x7b,0x3c,0xce,0x30,0xc5,0xa7,
+0x48,0x9f,0x6e,0xfe,0xb8,0xbe,0xdb,0x9f,0x9b,0x17,0x60,0x16,0xde,0xc6,0x8b,
+0x47,0xd1,0x57,0x71,0x3c,0x93,0xfc,0xbd,0xec,0x44,0x32,0x3b,0xb9,0xcf,0x6b,
+0x05,0x72,0xa7,0x87,0x8e,0x7e,0xd4,0x9a,0x87,0x1c,0x2f,0xb7,0x82,0x40,0xfc,
+0x6a,0x80,0x83,0x68,0x28,0xce,0x84,0xf4,0x0b,0x2e,0x44,0xcb,0x53,0xac,0x85,
+0x85,0xb5,0x46,0x36,0x98,0x3c,0x10,0x02,0xaa,0x02,0xbc,0x8b,0xa2,0x23,0xb2,
+0xd3,0x51,0x9a,0x22,0x4a,0xe3,0xaa,0x4e,0x7c,0xda,0x38,0xcf,0x49,0x98,0x72,
+0xa3,0x02,0x03,0x01,0x00,0x01,0xa3,0x23,0x30,0x21,0x30,0x1f,0x06,0x03,0x55,
+0x1d,0x23,0x04,0x18,0x30,0x18,0x80,0x14,0x14,0x8c,0x16,0xbb,0xbe,0x70,0xa2,
+0x28,0x89,0xa0,0x58,0xff,0x98,0xbd,0xa8,0x24,0x2b,0x8a,0xe9,0x9a,0x30,0x0d,
+0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,0x00,0x03,0x81,
+0x81,0x00,0x8a,0x49,0xa9,0x86,0x5e,0xc9,0x33,0x7e,0xfd,0xab,0x64,0x1f,0x6d,
+0x00,0xd7,0x9b,0xec,0xd1,0x5b,0x38,0xcc,0xd6,0xf3,0xf2,0xb4,0x75,0x70,0x00,
+0x82,0x9d,0x37,0x58,0xe1,0xcd,0x2c,0x61,0xb3,0x28,0xe7,0x8a,0x00,0xbe,0x6e,
+0xca,0xe8,0x55,0xd5,0xad,0x3a,0xea,0xaf,0x13,0x20,0x1c,0x44,0xfc,0xb4,0xf9,
+0x29,0x2b,0xdc,0x8a,0x2d,0x1b,0x27,0x9e,0xb9,0x3b,0x4a,0x71,0x9d,0x47,0x7d,
+0xf7,0x92,0x6b,0x21,0x7f,0xfa,0x88,0x79,0x94,0x33,0xf6,0xdd,0x92,0x04,0x92,
+0xd6,0x5e,0x0a,0x74,0xf2,0x85,0xa6,0xd5,0x3c,0x28,0xc0,0x89,0x5d,0xda,0xf3,
+0xa6,0x01,0xc2,0xe9,0xa3,0xc1,0xb7,0x21,0x08,0xba,0x18,0x07,0x45,0xeb,0x77,
+0x7d,0xcd,0xc6,0xe7,0x2a,0x7b,0x46,0xd2,0x3d,0xb5 };
+static const BYTE rootSignedCRL[] = {
+0x30,0x82,0x01,0x1f,0x30,0x81,0x89,0x02,0x01,0x01,0x30,0x0d,0x06,0x09,0x2a,
+0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,0x00,0x30,0x10,0x31,0x0e,0x30,
+0x0c,0x06,0x03,0x55,0x04,0x03,0x13,0x05,0x43,0x65,0x72,0x74,0x31,0x17,0x0d,
+0x30,0x37,0x30,0x39,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x17,0x0d,
+0x30,0x37,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5a,0x30,0x14,
+0x30,0x12,0x02,0x01,0x01,0x17,0x0d,0x30,0x37,0x30,0x39,0x30,0x31,0x30,0x30,
+0x30,0x30,0x30,0x30,0x5a,0xa0,0x2f,0x30,0x2d,0x30,0x0a,0x06,0x03,0x55,0x1d,
+0x14,0x04,0x03,0x02,0x01,0x01,0x30,0x1f,0x06,0x03,0x55,0x1d,0x23,0x04,0x18,
+0x30,0x18,0x80,0x14,0x14,0x8c,0x16,0xbb,0xbe,0x70,0xa2,0x28,0x89,0xa0,0x58,
+0xff,0x98,0xbd,0xa8,0x24,0x2b,0x8a,0xe9,0x9a,0x30,0x0d,0x06,0x09,0x2a,0x86,
+0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,0x00,0x03,0x81,0x81,0x00,0xa3,0xcf,
+0x17,0x5d,0x7a,0x08,0xab,0x11,0x1a,0xbd,0x5c,0xde,0x9a,0x22,0x92,0x38,0xe6,
+0x96,0xcc,0xb1,0xc5,0x42,0x86,0xa6,0xae,0xad,0xa3,0x1a,0x2b,0xa0,0xb0,0x65,
+0xaa,0x9c,0xd7,0x2d,0x44,0x8c,0xae,0x61,0xc7,0x30,0x17,0x89,0x84,0x3b,0x4a,
+0x8f,0x17,0x08,0x06,0x37,0x1c,0xf7,0x2d,0x4e,0x47,0x07,0x61,0x50,0xd9,0x06,
+0xd1,0x46,0xed,0x0a,0xbb,0xc3,0x9b,0x36,0x0b,0xa7,0x27,0x2f,0x2b,0x55,0xce,
+0x2a,0xa5,0x60,0xc6,0x53,0x28,0xe8,0xee,0xad,0x0e,0x2b,0xe8,0xd7,0x5f,0xc9,
+0xa5,0xed,0xf9,0x77,0xb0,0x3c,0x81,0xcf,0xcc,0x49,0xb2,0x1a,0xc3,0xfd,0x34,
+0xd5,0xbc,0xb0,0xd5,0xa5,0x9c,0x1b,0x72,0xc3,0x0f,0xa3,0xe3,0x3c,0xf0,0xc3,
+0x91,0xe8,0x93,0x4f,0xd4,0x2f };
+
+BOOL (WINAPI *pCertVerifyRevocation)(DWORD, DWORD, DWORD, void **, DWORD,
+ PCERT_REVOCATION_PARA, PCERT_REVOCATION_STATUS);
+
+/* Wednesday, Oct 1, 2007 */
+static SYSTEMTIME oct2007 = { 2007, 10, 1, 1, 0, 0, 0, 0 };
+
+static void test_verifyRevocation(void)
+{
+    HMODULE hCryptNet = GetModuleHandleA("cryptnet.dll");
+    BOOL ret;
+    CERT_REVOCATION_STATUS status = { sizeof(status), 0 };
+    PCCERT_CONTEXT certs[2];
+    CERT_REVOCATION_PARA revPara = { sizeof(revPara), 0 };
+    FILETIME time;
+
+    pCertVerifyRevocation = (void *)GetProcAddress(hCryptNet,
+     "CertDllVerifyRevocation");
+    if (!pCertVerifyRevocation)
+    {
+        win_skip("no CertDllVerifyRevocation\n");
+        return;
+    }
+    if (0)
+    {
+        /* Crash */
+        ret = pCertVerifyRevocation(0, 0, 0, NULL, 0, NULL, NULL);
+    }
+    SetLastError(0xdeadbeef);
+    ret = pCertVerifyRevocation(0, 0, 0, NULL, 0, NULL, &status);
+    ok(!ret && GetLastError() == E_INVALIDARG,
+     "expected E_INVALIDARG, got %08x\n", GetLastError());
+    SetLastError(0xdeadbeef);
+    ret = pCertVerifyRevocation(X509_ASN_ENCODING, 0, 0, NULL, 0, NULL,
+     &status);
+    ok(!ret && GetLastError() == E_INVALIDARG,
+     "expected E_INVALIDARG, got %08x\n", GetLastError());
+    SetLastError(0xdeadbeef);
+    ret = pCertVerifyRevocation(0, CERT_CONTEXT_REVOCATION_TYPE, 0, NULL, 0,
+     NULL, &status);
+    ok(!ret && GetLastError() == E_INVALIDARG,
+     "expected E_INVALIDARG, got %08x\n", GetLastError());
+    certs[0] = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
+     sizeof(bigCert));
+    SetLastError(0xdeadbeef);
+    ret = pCertVerifyRevocation(0, CERT_CONTEXT_REVOCATION_TYPE,
+     1, (void **)certs, 0, NULL, &status);
+    ok(!ret && GetLastError() == CRYPT_E_NO_REVOCATION_CHECK,
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", GetLastError());
+    ok(status.dwError == CRYPT_E_NO_REVOCATION_CHECK,
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", status.dwError);
+    ok(status.dwIndex == 0, "expected index 0, got %d\n", status.dwIndex);
+    CertFreeCertificateContext(certs[0]);
+    certs[0] = CertCreateCertificateContext(X509_ASN_ENCODING,
+     rootWithKeySignAndCRLSign, sizeof(rootWithKeySignAndCRLSign));
+    certs[1] = CertCreateCertificateContext(X509_ASN_ENCODING,
+     eeCert, sizeof(eeCert));
+    /* The root cert itself can't be checked for revocation */
+    SetLastError(0xdeadbeef);
+    ret = pCertVerifyRevocation(0, CERT_CONTEXT_REVOCATION_TYPE,
+     1, (void **)certs, 0, NULL, &status);
+    ok(!ret && GetLastError() == CRYPT_E_NO_REVOCATION_CHECK,
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", GetLastError());
+    ok(status.dwError == CRYPT_E_NO_REVOCATION_CHECK,
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", status.dwError);
+    ok(status.dwIndex == 0, "expected index 0, got %d\n", status.dwIndex);
+    /* Neither can the end cert */
+    SetLastError(0xdeadbeef);
+    ret = pCertVerifyRevocation(0, CERT_CONTEXT_REVOCATION_TYPE,
+     1, (void **)&certs[1], 0, NULL, &status);
+    ok(!ret && GetLastError() == CRYPT_E_NO_REVOCATION_CHECK,
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", GetLastError());
+    ok(status.dwError == CRYPT_E_NO_REVOCATION_CHECK,
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", status.dwError);
+    ok(status.dwIndex == 0, "expected index 0, got %d\n", status.dwIndex);
+    /* Both certs together can't, either (they're not CRLs) */
+    SetLastError(0xdeadbeef);
+    ret = pCertVerifyRevocation(0, CERT_CONTEXT_REVOCATION_TYPE,
+     2, (void **)certs, 0, NULL, &status);
+    ok(!ret && GetLastError() == CRYPT_E_NO_REVOCATION_CHECK,
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", GetLastError());
+    ok(status.dwError == CRYPT_E_NO_REVOCATION_CHECK,
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", status.dwError);
+    ok(status.dwIndex == 0, "expected index 0, got %d\n", status.dwIndex);
+    /* Now add a CRL to the hCrlStore */
+    revPara.hCrlStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
+     CERT_STORE_CREATE_NEW_FLAG, NULL);
+    CertAddEncodedCRLToStore(revPara.hCrlStore, X509_ASN_ENCODING,
+     rootSignedCRL, sizeof(rootSignedCRL), CERT_STORE_ADD_ALWAYS, NULL);
+    SetLastError(0xdeadbeef);
+    ret = pCertVerifyRevocation(0, CERT_CONTEXT_REVOCATION_TYPE,
+     2, (void **)certs, 0, &revPara, &status);
+    ok(!ret && GetLastError() == CRYPT_E_NO_REVOCATION_CHECK,
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", GetLastError());
+    ok(status.dwError == CRYPT_E_NO_REVOCATION_CHECK,
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", status.dwError);
+    ok(status.dwIndex == 0, "expected index 0, got %d\n", status.dwIndex);
+    /* Specifying CERT_VERIFY_REV_CHAIN_FLAG doesn't change things either */
+    SetLastError(0xdeadbeef);
+    ret = pCertVerifyRevocation(0, CERT_CONTEXT_REVOCATION_TYPE,
+     2, (void **)certs, CERT_VERIFY_REV_CHAIN_FLAG, &revPara, &status);
+    ok(!ret && GetLastError() == CRYPT_E_NO_REVOCATION_CHECK,
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", GetLastError());
+    ok(status.dwError == CRYPT_E_NO_REVOCATION_CHECK,
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", status.dwError);
+    ok(status.dwIndex == 0, "expected index 0, got %d\n", status.dwIndex);
+    /* Again, specifying the issuer cert: no change */
+    revPara.pIssuerCert = certs[0];
+    SetLastError(0xdeadbeef);
+    ret = CertVerifyRevocation(X509_ASN_ENCODING, CERT_CONTEXT_REVOCATION_TYPE,
+     1, (void **)&certs[1], 0, &revPara, &status);
+    /* Win2k thinks the cert is revoked, and it is, except the CRL is out of
+     * date, hence the revocation status should be unknown.
+     */
+    ok(!ret && (GetLastError() == CRYPT_E_NO_REVOCATION_CHECK ||
+     broken(GetLastError() == CRYPT_E_REVOKED /* Win2k */)),
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", GetLastError());
+    ok(status.dwError == CRYPT_E_NO_REVOCATION_CHECK ||
+     broken(status.dwError == CRYPT_E_REVOKED /* Win2k */),
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", status.dwError);
+    ok(status.dwIndex == 0, "expected index 0, got %d\n", status.dwIndex);
+    /* Specifying the time to check: still no change */
+    SystemTimeToFileTime(&oct2007, &time);
+    revPara.pftTimeToUse = &time;
+    ret = pCertVerifyRevocation(X509_ASN_ENCODING, CERT_CONTEXT_REVOCATION_TYPE,
+     1, (void **)&certs[1], 0, &revPara, &status);
+    ok(!ret, "Expected failure\n");
+    ok(GetLastError() == CRYPT_E_NO_REVOCATION_CHECK ||
+     broken(GetLastError() == CRYPT_E_REVOKED), /* W2K SP3/SP4 */
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", GetLastError());
+    ok(status.dwError == CRYPT_E_NO_REVOCATION_CHECK ||
+     broken(GetLastError() == CRYPT_E_REVOKED), /* W2K SP3/SP4 */
+     "expected CRYPT_E_NO_REVOCATION_CHECK, got %08x\n", status.dwError);
+    ok(status.dwIndex == 0, "expected index 0, got %d\n", status.dwIndex);
+    CertCloseStore(revPara.hCrlStore, 0);
+    CertFreeCertificateContext(certs[1]);
+    CertFreeCertificateContext(certs[0]);
+}
+
 START_TEST(cryptnet)
 {
     test_getObjectUrl();
     test_retrieveObjectByUrl();
+    test_verifyRevocation();
 }
index 534d0e7..996df0e 100644 (file)
@@ -317,7 +317,6 @@ static BOOL find_and_delete_cert_in_store(HCERTSTORE store, PCCERT_CONTEXT cert)
         return FALSE;
 
     CertDeleteCertificateFromStore(found);
-    CertFreeCertificateContext(found);
 
     return TRUE;
 }
@@ -560,7 +559,7 @@ static void test_crypt_ui_wiz_import(void)
             crl = CertEnumCRLsInStore(store, crl);
             if (crl)
                 count++;
-        } while (cert);
+        } while (crl);
         ok(count == 1, "expected 1 CRL, got %d\n", count);
     }
     CertCloseStore(store, 0);
@@ -596,7 +595,7 @@ static void test_crypt_ui_wiz_import(void)
             crl = CertEnumCRLsInStore(store, crl);
             if (crl)
                 count++;
-        } while (cert);
+        } while (crl);
         ok(count == 0, "expected 0 CRLs, got %d\n", count);
     }
     SetLastError(0xdeadbeef);
@@ -636,7 +635,7 @@ static void test_crypt_ui_wiz_import(void)
             crl = CertEnumCRLsInStore(store, crl);
             if (crl)
                 count++;
-        } while (cert);
+        } while (crl);
         ok(count == 1, "expected 1 CRL, got %d\n", count);
     }
     SetLastError(0xdeadbeef);
index 81c0e76..06867e6 100644 (file)
 
 #include "wine/test.h"
 
-#define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE          0x0040
-#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT             0x0100
-#define CLDB_E_FILE_OLDVER              EMAKEHR(0x1107)
-
 typedef struct _tagASSEMBLY ASSEMBLY;
 
 typedef struct
index f6a4434..8e5ad2e 100755 (executable)
@@ -411,7 +411,7 @@ static void test_dib_bits_access( HBITMAP hdib, void *bits )
     char bmibuf[sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD)];
     DWORD data[256];
     BITMAPINFO *pbmi = (BITMAPINFO *)bmibuf;
-    HDC hdc = GetDC(0);
+    HDC hdc;
     char filename[MAX_PATH];
     HANDLE file;
     DWORD written;
@@ -435,11 +435,15 @@ static void test_dib_bits_access( HBITMAP hdib, void *bits )
     pbmi->bmiHeader.biPlanes = 1;
     pbmi->bmiHeader.biCompression = BI_RGB;
 
+    hdc = GetDC(0);
+
     ret = SetDIBits( hdc, hdib, 0, 16, data, pbmi, DIB_RGB_COLORS );
     ok(ret == 16 ||
        broken(ret == 0), /* win9x */
        "SetDIBits failed: expected 16 got %d\n", ret);
 
+    ReleaseDC(0, hdc);
+
     ok(VirtualQuery(bits, &info, sizeof(info)) == sizeof(info),
         "VirtualQuery failed\n");
     ok(info.BaseAddress == bits, "%p != %p\n", info.BaseAddress, bits);
@@ -542,6 +546,18 @@ static void test_dibsections(void)
     ok(hdib == NULL, "CreateDIBSection should fail when asked to create a compressed DIB section\n");
     ok(GetLastError() == 0xdeadbeef, "wrong error %d\n", GetLastError());
 
+    for (i = 0; i < 128; i++)
+    {
+        pbmi->bmiHeader.biBitCount = i;
+        pbmi->bmiHeader.biCompression = BI_RGB;
+        hdib = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
+        if (i == 1 || i == 4 || i == 8 || i == 16 || i == 24 || i == 32)
+            ok(hdib != NULL, "CreateDIBSection bpp %u\n", i);
+        else
+            todo_wine ok(hdib == NULL, "CreateDIBSection bpp %u succeeded\n", i);
+        if (hdib) DeleteObject( hdib );
+    }
+
     pbmi->bmiHeader.biBitCount = 16;
     pbmi->bmiHeader.biCompression = BI_BITFIELDS;
     ((PDWORD)pbmi->bmiColors)[0] = 0xf800;
@@ -864,8 +880,8 @@ static void test_dibsections(void)
     DeleteObject(hdib);
     DeleteObject(hpal);
 
-
     DeleteDC(hdcmem);
+    DeleteDC(hdcmem2);
     ReleaseDC(0, hdc);
 }
 
@@ -1805,9 +1821,11 @@ static void test_GetDIBits_BI_BITFIELDS(void)
     char dibinfo_buf[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
     DWORD bits[32];
     LPBITMAPINFO dibinfo = (LPBITMAPINFO) dibinfo_buf;
+    DWORD *bitmasks = (DWORD *)dibinfo->bmiColors;
     HDC hdc;
     HBITMAP hbm;
     int ret;
+    void *ptr;
 
     memset(dibinfo, 0, sizeof(dibinfo_buf));
     dibinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
@@ -1822,8 +1840,6 @@ static void test_GetDIBits_BI_BITFIELDS(void)
     ok(ret == 1, "GetDIBits failed\n");
     if (dibinfo->bmiHeader.biBitCount > 8)
     {
-        DWORD *bitmasks = (DWORD *)dibinfo->bmiColors;
-
         ok( dibinfo->bmiHeader.biCompression == BI_BITFIELDS,
             "compression is %u\n", dibinfo->bmiHeader.biCompression );
 
@@ -1887,6 +1903,135 @@ static void test_GetDIBits_BI_BITFIELDS(void)
     }
     else skip("not in 16 bpp BI_BITFIELDS mode, skipping that test\n");
 
+    DeleteObject(hbm);
+
+    /* same thing now with a 32-bpp DIB section */
+
+    dibinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+    dibinfo->bmiHeader.biWidth = 1;
+    dibinfo->bmiHeader.biHeight = 1;
+    dibinfo->bmiHeader.biPlanes = 1;
+    dibinfo->bmiHeader.biBitCount = 32;
+    dibinfo->bmiHeader.biCompression = BI_RGB;
+    dibinfo->bmiHeader.biSizeImage = 0;
+    dibinfo->bmiHeader.biXPelsPerMeter = 0;
+    dibinfo->bmiHeader.biYPelsPerMeter = 0;
+    dibinfo->bmiHeader.biClrUsed = 0;
+    dibinfo->bmiHeader.biClrImportant = 0;
+    bitmasks[0] = 0x0000ff;
+    bitmasks[1] = 0x00ff00;
+    bitmasks[2] = 0xff0000;
+    hbm = CreateDIBSection( hdc, dibinfo, DIB_RGB_COLORS, &ptr, NULL, 0 );
+    ok( hbm != 0, "failed to create bitmap\n" );
+
+    memset(dibinfo, 0, sizeof(dibinfo_buf));
+    dibinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+    ret = GetDIBits(hdc, hbm, 0, 0, NULL, dibinfo, DIB_RGB_COLORS);
+    ok(ret == 1, "GetDIBits failed\n");
+    ok( dibinfo->bmiHeader.biBitCount == 32, "wrong bit count %u\n", dibinfo->bmiHeader.biBitCount );
+
+    ok( dibinfo->bmiHeader.biCompression == BI_BITFIELDS,
+        "compression is %u\n", dibinfo->bmiHeader.biCompression );
+    ok( !bitmasks[0], "red mask is set\n" );
+    ok( !bitmasks[1], "green mask is set\n" );
+    ok( !bitmasks[2], "blue mask is set\n" );
+
+    dibinfo->bmiHeader.biSizeImage = 0xdeadbeef;
+    ret = GetDIBits(hdc, hbm, 0, 1, bits, dibinfo, DIB_RGB_COLORS);
+    ok(ret == 1, "GetDIBits failed\n");
+    ok( dibinfo->bmiHeader.biBitCount == 32, "wrong bit count %u\n", dibinfo->bmiHeader.biBitCount );
+    ok( bitmasks[0] == 0xff0000, "wrong red mask %08x\n", bitmasks[0] );
+    ok( bitmasks[1] == 0x00ff00, "wrong green mask %08x\n", bitmasks[1] );
+    ok( bitmasks[2] == 0x0000ff, "wrong blue mask %08x\n", bitmasks[2] );
+    ok( dibinfo->bmiHeader.biSizeImage != 0xdeadbeef ||
+        broken(dibinfo->bmiHeader.biSizeImage == 0xdeadbeef), /* win9x */
+        "size image not set\n" );
+
+    DeleteObject(hbm);
+
+    dibinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+    dibinfo->bmiHeader.biWidth = 1;
+    dibinfo->bmiHeader.biHeight = 1;
+    dibinfo->bmiHeader.biPlanes = 1;
+    dibinfo->bmiHeader.biBitCount = 32;
+    dibinfo->bmiHeader.biCompression = BI_BITFIELDS;
+    dibinfo->bmiHeader.biSizeImage = 0;
+    dibinfo->bmiHeader.biXPelsPerMeter = 0;
+    dibinfo->bmiHeader.biYPelsPerMeter = 0;
+    dibinfo->bmiHeader.biClrUsed = 0;
+    dibinfo->bmiHeader.biClrImportant = 0;
+    bitmasks[0] = 0x0000ff;
+    bitmasks[1] = 0x00ff00;
+    bitmasks[2] = 0xff0000;
+    hbm = CreateDIBSection( hdc, dibinfo, DIB_RGB_COLORS, &ptr, NULL, 0 );
+    ok( hbm != 0 || broken(!hbm), /* win9x */  "failed to create bitmap\n" );
+
+    if (hbm)
+    {
+        memset(dibinfo, 0, sizeof(dibinfo_buf));
+        dibinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+        ret = GetDIBits(hdc, hbm, 0, 0, NULL, dibinfo, DIB_RGB_COLORS);
+        ok(ret == 1, "GetDIBits failed\n");
+
+        ok( dibinfo->bmiHeader.biCompression == BI_BITFIELDS,
+            "compression is %u\n", dibinfo->bmiHeader.biCompression );
+        ok( !bitmasks[0], "red mask is set\n" );
+        ok( !bitmasks[1], "green mask is set\n" );
+        ok( !bitmasks[2], "blue mask is set\n" );
+
+        dibinfo->bmiHeader.biSizeImage = 0xdeadbeef;
+        ret = GetDIBits(hdc, hbm, 0, 1, bits, dibinfo, DIB_RGB_COLORS);
+        ok(ret == 1, "GetDIBits failed\n");
+        ok( bitmasks[0] == 0x0000ff, "wrong red mask %08x\n", bitmasks[0] );
+        ok( bitmasks[1] == 0x00ff00, "wrong green mask %08x\n", bitmasks[1] );
+        ok( bitmasks[2] == 0xff0000, "wrong blue mask %08x\n", bitmasks[2] );
+        ok( dibinfo->bmiHeader.biSizeImage != 0xdeadbeef, "size image not set\n" );
+
+        DeleteObject(hbm);
+    }
+
+    /* 24-bpp DIB sections don't have bitfields */
+
+    dibinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+    dibinfo->bmiHeader.biWidth = 1;
+    dibinfo->bmiHeader.biHeight = 1;
+    dibinfo->bmiHeader.biPlanes = 1;
+    dibinfo->bmiHeader.biBitCount = 24;
+    dibinfo->bmiHeader.biCompression = BI_BITFIELDS;
+    dibinfo->bmiHeader.biSizeImage = 0;
+    dibinfo->bmiHeader.biXPelsPerMeter = 0;
+    dibinfo->bmiHeader.biYPelsPerMeter = 0;
+    dibinfo->bmiHeader.biClrUsed = 0;
+    dibinfo->bmiHeader.biClrImportant = 0;
+    hbm = CreateDIBSection( hdc, dibinfo, DIB_RGB_COLORS, &ptr, NULL, 0 );
+    ok( hbm == 0, "creating 24-bpp BI_BITFIELDS dibsection should fail\n" );
+    dibinfo->bmiHeader.biCompression = BI_RGB;
+    hbm = CreateDIBSection( hdc, dibinfo, DIB_RGB_COLORS, &ptr, NULL, 0 );
+    ok( hbm != 0, "failed to create bitmap\n" );
+
+    memset(dibinfo, 0, sizeof(dibinfo_buf));
+    dibinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+    ret = GetDIBits(hdc, hbm, 0, 0, NULL, dibinfo, DIB_RGB_COLORS);
+    ok(ret == 1, "GetDIBits failed\n");
+    ok( dibinfo->bmiHeader.biBitCount == 24, "wrong bit count %u\n", dibinfo->bmiHeader.biBitCount );
+
+    ok( dibinfo->bmiHeader.biCompression == BI_RGB,
+        "compression is %u\n", dibinfo->bmiHeader.biCompression );
+    ok( !bitmasks[0], "red mask is set\n" );
+    ok( !bitmasks[1], "green mask is set\n" );
+    ok( !bitmasks[2], "blue mask is set\n" );
+
+    dibinfo->bmiHeader.biSizeImage = 0xdeadbeef;
+    ret = GetDIBits(hdc, hbm, 0, 1, bits, dibinfo, DIB_RGB_COLORS);
+    ok(ret == 1, "GetDIBits failed\n");
+    ok( dibinfo->bmiHeader.biBitCount == 24, "wrong bit count %u\n", dibinfo->bmiHeader.biBitCount );
+    ok( !bitmasks[0], "red mask is set\n" );
+    ok( !bitmasks[1], "green mask is set\n" );
+    ok( !bitmasks[2], "blue mask is set\n" );
+    ok( dibinfo->bmiHeader.biSizeImage != 0xdeadbeef ||
+        broken(dibinfo->bmiHeader.biSizeImage == 0xdeadbeef), /* win9x */
+        "size image not set\n" );
+
     DeleteObject(hbm);
     ReleaseDC(NULL, hdc);
 }
@@ -2806,9 +2951,7 @@ static void test_GdiAlphaBlend(void)
 static void test_clipping(void)
 {
     HBITMAP bmpDst;
-    HBITMAP oldDst;
     HBITMAP bmpSrc;
-    HBITMAP oldSrc;
     HRGN hRgn;
     LPVOID bits;
     BOOL result;
@@ -2826,11 +2969,11 @@ static void test_clipping(void)
 
     bmpDst = CreateDIBSection( hdcDst, &bmpinfo, DIB_RGB_COLORS, &bits, NULL, 0 );
     ok(bmpDst != NULL, "Couldn't create destination bitmap\n");
-    oldDst = SelectObject( hdcDst, bmpDst );
+    SelectObject( hdcDst, bmpDst );
 
     bmpSrc = CreateDIBSection( hdcSrc, &bmpinfo, DIB_RGB_COLORS, &bits, NULL, 0 );
     ok(bmpSrc != NULL, "Couldn't create source bitmap\n");
-    oldSrc = SelectObject( hdcSrc, bmpSrc );
+    SelectObject( hdcSrc, bmpSrc );
 
     result = BitBlt( hdcDst, 0, 0, 100, 100, hdcSrc, 100, 100, SRCCOPY );
     ok(result, "BitBlt failed\n");
@@ -2848,6 +2991,54 @@ static void test_clipping(void)
     DeleteDC( hdcSrc );
 }
 
+static void test_32bit_bitmap_blt(void)
+{
+    BITMAPINFO biDst;
+    HBITMAP bmpSrc, bmpDst;
+    HBITMAP oldSrc, oldDst;
+    HDC hdcSrc, hdcDst, hdcScreen;
+    UINT32 *dstBuffer;
+    DWORD colorSrc = 0x11223344;
+
+    memset(&biDst, 0, sizeof(BITMAPINFO));
+    biDst.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+    biDst.bmiHeader.biWidth = 2;
+    biDst.bmiHeader.biHeight = -2;
+    biDst.bmiHeader.biPlanes = 1;
+    biDst.bmiHeader.biBitCount = 32;
+    biDst.bmiHeader.biCompression = BI_RGB;
+
+    hdcScreen = CreateCompatibleDC(0);
+    if(GetDeviceCaps(hdcScreen, BITSPIXEL) != 32)
+    {
+        DeleteDC(hdcScreen);
+        trace("Skipping 32-bit DDB test\n");
+        return;
+    }
+
+    hdcSrc = CreateCompatibleDC(hdcScreen);
+    bmpSrc = CreateBitmap(1, 1, 1, 32, &colorSrc);
+    oldSrc = SelectObject(hdcSrc, bmpSrc);
+
+    hdcDst = CreateCompatibleDC(hdcScreen);
+    bmpDst = CreateDIBSection(hdcDst, &biDst, DIB_RGB_COLORS, (void**)&dstBuffer, NULL, 0);
+    oldDst = SelectObject(hdcDst, bmpDst);
+
+    StretchBlt(hdcDst, 0, 0, 1, 1, hdcSrc, 0, 0, 1, 1, SRCCOPY);
+    ok(dstBuffer[0] == colorSrc, "Expected color=%x, received color=%x\n", colorSrc, dstBuffer[0]);
+
+    /* Tidy up */
+    SelectObject(hdcDst, oldDst);
+    DeleteObject(bmpDst);
+    DeleteDC(hdcDst);
+
+    SelectObject(hdcSrc, oldSrc);
+    DeleteObject(bmpSrc);
+    DeleteDC(hdcSrc);
+
+    DeleteDC(hdcScreen);
+}
+
 START_TEST(bitmap)
 {
     HMODULE hdll;
@@ -2874,6 +3065,7 @@ START_TEST(bitmap)
     test_StretchBlt();
     test_StretchDIBits();
     test_GdiAlphaBlend();
+    test_32bit_bitmap_blt();
     test_bitmapinfoheadersize();
     test_get16dibits();
     test_clipping();
index 193832c..5d56caa 100644 (file)
@@ -162,15 +162,35 @@ static void test_savedc(void)
     ret = RestoreDC(hdc, 3);
     ok(!ret, "ret = %d\n", ret);
 
-    /* Under win98 the following two succeed and both clear the save stack
+    /* Under Win9x the following RestoreDC call succeeds and clears the save stack. */
+    ret = RestoreDC(hdc, -3);
+    ok(!ret ||
+       broken(ret), /* Win9x */
+       "ret = %d\n", ret);
+
+    /* Trying to clear an empty save stack fails. */
     ret = RestoreDC(hdc, -3);
     ok(!ret, "ret = %d\n", ret);
+
+    ret = SaveDC(hdc);
+    ok(ret == 3 ||
+       broken(ret == 1), /* Win9x */
+       "ret = %d\n", ret);
+
+    /* Under Win9x the following RestoreDC call succeeds and clears the save stack. */
+    ret = RestoreDC(hdc, 0);
+    ok(!ret ||
+       broken(ret), /* Win9x */
+       "ret = %d\n", ret);
+
+    /* Trying to clear an empty save stack fails. */
     ret = RestoreDC(hdc, 0);
     ok(!ret, "ret = %d\n", ret);
-    */
 
     ret = RestoreDC(hdc, 1);
-    ok(ret, "ret = %d\n", ret);
+    ok(ret ||
+       broken(!ret), /* Win9x */
+       "ret = %d\n", ret);
 
     DeleteDC(hdc);
 }
@@ -474,6 +494,107 @@ todo_wine
     ok(ret, "UnregisterClassA failed\n");
 }
 
+static void test_boundsrect_invalid(void)
+{
+    HDC hdc;
+    RECT rect, expect;
+    UINT ret;
+
+    hdc = GetDC(NULL);
+    ok(hdc != NULL, "GetDC failed\n");
+
+    ret = GetBoundsRect(hdc, NULL, 0);
+    ok(ret == 0 ||
+       broken(ret == DCB_RESET), /* Win9x */
+       "Expected GetBoundsRect to return 0, got %u\n", ret);
+
+    ret = GetBoundsRect(hdc, NULL, ~0U);
+    ok(ret == 0 ||
+       broken(ret == DCB_RESET), /* Win9x */
+       "Expected GetBoundsRect to return 0, got %u\n", ret);
+
+    if (GetBoundsRect(hdc, NULL, 0) == DCB_RESET)
+        win_skip("Win9x fails catastrophically with first GetBoundsRect call\n");
+    else
+    {
+        /* Test parameter handling order. */
+        SetRect(&rect, 0, 0, 50, 50);
+        ret = SetBoundsRect(hdc, &rect, DCB_SET);
+        ok(ret & DCB_RESET,
+           "Expected return flag DCB_RESET to be set, got %u\n", ret);
+
+        ret = GetBoundsRect(hdc, NULL, DCB_RESET);
+        ok(ret == 0,
+           "Expected GetBoundsRect to return 0, got %u\n", ret);
+
+        ret = GetBoundsRect(hdc, &rect, 0);
+        ok(ret == DCB_RESET,
+           "Expected GetBoundsRect to return DCB_RESET, got %u\n", ret);
+        SetRect(&expect, 0, 0, 0, 0);
+        ok(EqualRect(&rect, &expect),
+           "Expected output rectangle (0,0)-(0,0), got (%d,%d)-(%d,%d)\n",
+           rect.left, rect.top, rect.right, rect.bottom);
+    }
+
+    if (GetBoundsRect(hdc, NULL, 0) == DCB_RESET)
+        win_skip("Win9x fails catastrophically with NULL device context parameter\n");
+    else
+    {
+        ret = GetBoundsRect(NULL, NULL, 0);
+        ok(ret == 0, "Expected GetBoundsRect to return 0, got %u\n", ret);
+
+        ret = GetBoundsRect(NULL, NULL, ~0U);
+        ok(ret == 0, "Expected GetBoundsRect to return 0, got %u\n", ret);
+
+        ret = SetBoundsRect(NULL, NULL, 0);
+        ok(ret == 0, "Expected SetBoundsRect to return 0, got %u\n", ret);
+
+        ret = SetBoundsRect(NULL, NULL, ~0U);
+        ok(ret == 0, "Expected SetBoundsRect to return 0, got %u\n", ret);
+    }
+
+    DeleteDC(hdc);
+}
+
+static void test_desktop_colorres(void)
+{
+    HDC hdc = GetDC(NULL);
+    int bitspixel, colorres;
+
+    bitspixel = GetDeviceCaps(hdc, BITSPIXEL);
+    ok(bitspixel != 0, "Expected to get valid BITSPIXEL capability value\n");
+
+    colorres = GetDeviceCaps(hdc, COLORRES);
+    ok(colorres != 0 ||
+       broken(colorres == 0), /* Win9x */
+       "Expected to get valid COLORRES capability value\n");
+
+    if (colorres)
+    {
+        switch (bitspixel)
+        {
+        case 8:
+            ok(colorres == 18,
+               "Expected COLORRES to be 18, got %d\n", colorres);
+            break;
+        case 16:
+            ok(colorres == 16,
+               "Expected COLORRES to be 16, got %d\n", colorres);
+            break;
+        case 24:
+        case 32:
+            ok(colorres == 24,
+               "Expected COLORRES to be 24, got %d\n", bitspixel);
+            break;
+        default:
+            ok(0, "Got unknown BITSPIXEL %d with COLORRES %d\n", bitspixel, colorres);
+            break;
+        }
+    }
+
+    DeleteDC(hdc);
+}
+
 START_TEST(dc)
 {
     test_savedc();
@@ -482,4 +603,6 @@ START_TEST(dc)
     test_CreateCompatibleDC();
     test_DC_bitmap();
     test_DeleteDC();
+    test_boundsrect_invalid();
+    test_desktop_colorres();
 }
index a5cfe22..d89132d 100644 (file)
@@ -30,6 +30,9 @@
 
 #include "wine/test.h"
 
+/* Do not allow more than 1 deviation here */
+#define match_off_by_1(a, b) (abs((a) - (b)) <= 1)
+
 #define near_match(a, b) (abs((a) - (b)) <= 6)
 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
 
@@ -40,6 +43,7 @@ DWORD (WINAPI *pGetFontUnicodeRanges)(HDC hdc, LPGLYPHSET lpgs);
 DWORD (WINAPI *pGetGlyphIndicesA)(HDC hdc, LPCSTR lpstr, INT count, LPWORD pgi, DWORD flags);
 DWORD (WINAPI *pGetGlyphIndicesW)(HDC hdc, LPCWSTR lpstr, INT count, LPWORD pgi, DWORD flags);
 BOOL  (WINAPI *pGdiRealizationInfo)(HDC hdc, DWORD *);
+HFONT (WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDV *);
 
 static HMODULE hgdi32 = 0;
 
@@ -54,6 +58,7 @@ static void init(void)
     pGetGlyphIndicesA = (void *)GetProcAddress(hgdi32, "GetGlyphIndicesA");
     pGetGlyphIndicesW = (void *)GetProcAddress(hgdi32, "GetGlyphIndicesW");
     pGdiRealizationInfo = (void *)GetProcAddress(hgdi32, "GdiRealizationInfo");
+    pCreateFontIndirectExA = (void *)GetProcAddress(hgdi32, "CreateFontIndirectExA");
 }
 
 static INT CALLBACK is_truetype_font_installed_proc(const LOGFONT *elf, const TEXTMETRIC *ntm, DWORD type, LPARAM lParam)
@@ -308,9 +313,6 @@ static void test_bitmap_font(void)
     SIZE size_orig;
     INT ret, i, width_orig, height_orig, scale, lfWidth;
 
-    skip("ROS-HACK: Skipping bitmap font tests!\n");
-    return;
-
     hdc = GetDC(0);
 
     /* "System" has only 1 pixel size defined, otherwise the test breaks */
@@ -1169,9 +1171,9 @@ static void test_GetKerningPairs(void)
         otm.otmSize = sizeof(otm); /* just in case for Win9x compatibility */
         ok(GetOutlineTextMetricsW(hdc, sizeof(otm), &otm) == sizeof(otm), "GetOutlineTextMetricsW error %d\n", GetLastError());
 
-        ok(kd[i].tmHeight == otm.otmTextMetrics.tmHeight, "expected %d, got %d\n",
+        ok(match_off_by_1(kd[i].tmHeight, otm.otmTextMetrics.tmHeight), "expected %d, got %d\n",
            kd[i].tmHeight, otm.otmTextMetrics.tmHeight);
-        ok(kd[i].tmAscent == otm.otmTextMetrics.tmAscent, "expected %d, got %d\n",
+        ok(match_off_by_1(kd[i].tmAscent, otm.otmTextMetrics.tmAscent), "expected %d, got %d\n",
            kd[i].tmAscent, otm.otmTextMetrics.tmAscent);
         ok(kd[i].tmDescent == otm.otmTextMetrics.tmDescent, "expected %d, got %d\n",
            kd[i].tmDescent, otm.otmTextMetrics.tmDescent);
@@ -1186,13 +1188,13 @@ static void test_GetKerningPairs(void)
            kd[i].otmLineGap, otm.otmLineGap);
         ok(near_match(kd[i].otmMacDescent, otm.otmMacDescent), "expected %d, got %d\n",
            kd[i].otmMacDescent, otm.otmMacDescent);
+        ok(near_match(kd[i].otmMacAscent, otm.otmMacAscent), "expected %d, got %d\n",
+           kd[i].otmMacAscent, otm.otmMacAscent);
 todo_wine {
         ok(kd[i].otmsCapEmHeight == otm.otmsCapEmHeight, "expected %u, got %u\n",
            kd[i].otmsCapEmHeight, otm.otmsCapEmHeight);
         ok(kd[i].otmsXHeight == otm.otmsXHeight, "expected %u, got %u\n",
            kd[i].otmsXHeight, otm.otmsXHeight);
-        ok(kd[i].otmMacAscent == otm.otmMacAscent, "expected %d, got %d\n",
-           kd[i].otmMacAscent, otm.otmMacAscent);
         /* FIXME: this one sometimes succeeds due to expected 0, enable it when removing todo */
         if (0) ok(kd[i].otmMacLineGap == otm.otmMacLineGap, "expected %u, got %u\n",
            kd[i].otmMacLineGap, otm.otmMacLineGap);
@@ -1257,6 +1259,74 @@ todo_wine {
     ReleaseDC(0, hdc);
 }
 
+static void test_height_selection(void)
+{
+    static const struct font_data
+    {
+        const char face_name[LF_FACESIZE];
+        int requested_height;
+        int weight, height, ascent, descent, int_leading, ext_leading, dpi;
+    } fd[] =
+    {
+        {"Tahoma", -12, FW_NORMAL, 14, 12, 2, 2, 0, 96 },
+        {"Tahoma", -24, FW_NORMAL, 29, 24, 5, 5, 0, 96 },
+        {"Tahoma", -48, FW_NORMAL, 58, 48, 10, 10, 0, 96 },
+        {"Tahoma", -96, FW_NORMAL, 116, 96, 20, 20, 0, 96 },
+        {"Tahoma", -192, FW_NORMAL, 232, 192, 40, 40, 0, 96 },
+        {"Tahoma", 12, FW_NORMAL, 12, 10, 2, 2, 0, 96 },
+        {"Tahoma", 24, FW_NORMAL, 24, 20, 4, 4, 0, 96 },
+        {"Tahoma", 48, FW_NORMAL, 48, 40, 8, 8, 0, 96 },
+        {"Tahoma", 96, FW_NORMAL, 96, 80, 16, 17, 0, 96 },
+        {"Tahoma", 192, FW_NORMAL, 192, 159, 33, 33, 0, 96 }
+    };
+    HDC hdc;
+    LOGFONT lf;
+    HFONT hfont, old_hfont;
+    TEXTMETRIC tm;
+    INT ret, i;
+
+    hdc = CreateCompatibleDC(0);
+    assert(hdc);
+
+    for (i = 0; i < sizeof(fd)/sizeof(fd[0]); i++)
+    {
+        if (!is_truetype_font_installed(fd[i].face_name))
+        {
+            skip("%s is not installed\n", fd[i].face_name);
+            continue;
+        }
+
+        memset(&lf, 0, sizeof(lf));
+        lf.lfHeight = fd[i].requested_height;
+        lf.lfWeight = fd[i].weight;
+        strcpy(lf.lfFaceName, fd[i].face_name);
+
+        hfont = CreateFontIndirect(&lf);
+        assert(hfont);
+
+        old_hfont = SelectObject(hdc, hfont);
+        ret = GetTextMetrics(hdc, &tm);
+        ok(ret, "GetTextMetrics error %d\n", GetLastError());
+        if(fd[i].dpi == tm.tmDigitizedAspectX)
+        {
+            trace("found font %s, height %d charset %x dpi %d\n", lf.lfFaceName, lf.lfHeight, lf.lfCharSet, fd[i].dpi);
+            ok(tm.tmWeight == fd[i].weight, "%s(%d): tm.tmWeight %d != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmWeight, fd[i].weight);
+            ok(match_off_by_1(tm.tmHeight, fd[i].height), "%s(%d): tm.tmHeight %d != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmHeight, fd[i].height);
+            ok(match_off_by_1(tm.tmAscent, fd[i].ascent), "%s(%d): tm.tmAscent %d != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmAscent, fd[i].ascent);
+            ok(match_off_by_1(tm.tmDescent, fd[i].descent), "%s(%d): tm.tmDescent %d != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmDescent, fd[i].descent);
+#if 0 /* FIXME: calculation of tmInternalLeading in Wine doesn't match what Windows does */
+            ok(tm.tmInternalLeading == fd[i].int_leading, "%s(%d): tm.tmInternalLeading %d != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmInternalLeading, fd[i].int_leading);
+#endif
+            ok(tm.tmExternalLeading == fd[i].ext_leading, "%s(%d): tm.tmExternalLeading %d != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmExternalLeading, fd[i].ext_leading);
+        }
+
+        SelectObject(hdc, old_hfont);
+        DeleteObject(hfont);
+    }
+
+    DeleteDC(hdc);
+}
+
 static void test_GetOutlineTextMetrics(void)
 {
     OUTLINETEXTMETRIC *otm;
@@ -1346,7 +1416,7 @@ static void test_GetOutlineTextMetrics(void)
 
 static void testJustification(HDC hdc, PSTR str, RECT *clientArea)
 {
-    INT         x, y,
+    INT         y,
                 breakCount,
                 justifiedWidth = 0, /* to test GetTextExtentExPointW() */
                 areaWidth = clientArea->right - clientArea->left,
@@ -1402,8 +1472,6 @@ static void testJustification(HDC hdc, PSTR str, RECT *clientArea)
         }
         else lastExtent = TRUE;
 
-        x = clientArea->left;
-
         /* catch errors and report them */
         if (!lastExtent && (justifiedWidth != areaWidth))
         {
@@ -2970,7 +3038,7 @@ static void test_GetTextMetrics2(const char *fontname, int font_height)
             DEFAULT_CHARSET, OUT_TT_PRECIS, CLIP_LH_ANGLES,
             DEFAULT_QUALITY, VARIABLE_PITCH,
             fontname);
-    ok( hf != NULL, "CreateFontA failed\n");
+    ok( hf != NULL, "CreateFontA(%s, %d) failed\n", fontname, font_height);
     of = SelectObject( hdc, hf);
     ret = GetTextMetricsA( hdc, &tm);
     ok(ret, "GetTextMetricsA error %u\n", GetLastError());
@@ -2993,7 +3061,7 @@ static void test_GetTextMetrics2(const char *fontname, int font_height)
         SelectObject(hdc, of);
         DeleteObject(hf);
 
-        if (tm.tmAveCharWidth == ave_width || width / height > 200)
+        if (match_off_by_1(tm.tmAveCharWidth, ave_width) || width / height > 200)
             break;
     }
 
@@ -3029,7 +3097,9 @@ static void test_CreateFontIndirect(void)
         lstrcpyA(lf.lfFaceName, TestName[i]);
         hfont = CreateFontIndirectA(&lf);
         ok(hfont != 0, "CreateFontIndirectA failed\n");
+        SetLastError(0xdeadbeef);
         ret = GetObject(hfont, sizeof(getobj_lf), &getobj_lf);
+        ok(ret, "GetObject failed: %d\n", GetLastError());
         ok(lf.lfItalic == getobj_lf.lfItalic, "lfItalic: expect %02x got %02x\n", lf.lfItalic, getobj_lf.lfItalic);
         ok(lf.lfWeight == getobj_lf.lfWeight ||
            broken((SHORT)lf.lfWeight == getobj_lf.lfWeight), /* win9x */
@@ -3041,9 +3111,41 @@ static void test_CreateFontIndirect(void)
     }
 }
 
+static void test_CreateFontIndirectEx(void)
+{
+    ENUMLOGFONTEXDVA lfex;
+    HFONT hfont;
+
+    if (!pCreateFontIndirectExA)
+    {
+        win_skip("CreateFontIndirectExA is not available\n");
+        return;
+    }
+
+    if (!is_truetype_font_installed("Arial"))
+    {
+        skip("Arial is not installed\n");
+        return;
+    }
+
+    SetLastError(0xdeadbeef);
+    hfont = pCreateFontIndirectExA(NULL);
+    ok(hfont == NULL, "got %p\n", hfont);
+    ok(GetLastError() == 0xdeadbeef, "got error %d\n", GetLastError());
+
+    memset(&lfex, 0, sizeof(lfex));
+    lstrcpyA(lfex.elfEnumLogfontEx.elfLogFont.lfFaceName, "Arial");
+    hfont = pCreateFontIndirectExA(&lfex);
+    ok(hfont != 0, "CreateFontIndirectEx failed\n");
+    if (hfont)
+        check_font("Arial", &lfex.elfEnumLogfontEx.elfLogFont, hfont);
+    DeleteObject(hfont);
+}
+
 START_TEST(font)
 {
     init();
+
     test_logfont();
     test_bitmap_font();
     test_outline_font();
@@ -3059,6 +3161,7 @@ START_TEST(font)
     test_GetFontUnicodeRanges();
     test_nonexistent_font();
     test_orientation();
+    test_height_selection();
 
     /* On Windows Arial has a lot of default charset aliases such as Arial Cyr,
      * I'd like to avoid them in this test.
@@ -3085,5 +3188,6 @@ START_TEST(font)
     test_GetTextMetrics2("Arial", -55);
     test_GetTextMetrics2("Arial", -110);
     test_CreateFontIndirect();
+    test_CreateFontIndirectEx();
     test_oemcharset();
 }
index 2bd6376..497d900 100644 (file)
  * Test helper macros
  */
 
+#define TEST_TYPE_SIZE(type, size)             C_ASSERT(sizeof(type) == size);
+
+#ifdef TYPE_ALIGNMENT
+# define TEST_TYPE_ALIGN(type, align)          C_ASSERT(TYPE_ALIGNMENT(type) == align);
+#else
+# define TEST_TYPE_ALIGN(type, align)
+#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
+# define TEST_TARGET_ALIGN(type, align)
+# define TEST_FIELD_ALIGN(type, field, align)
+#endif
+
+#define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
+
+#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);
+
+
 #ifdef _WIN64
 
-# define TEST_TYPE_SIZE(type, size)
-# define TEST_TYPE_ALIGN(type, align)
-# define TEST_TARGET_ALIGN(type, align)
-# define TEST_FIELD_ALIGN(type, field, align)
-# define TEST_FIELD_OFFSET(type, field, offset)
+static void test_pack_ABC(void)
+{
+    /* ABC */
+    TEST_TYPE_SIZE   (ABC, 12)
+    TEST_TYPE_ALIGN  (ABC, 4)
+    TEST_FIELD_SIZE  (ABC, abcA, 4)
+    TEST_FIELD_ALIGN (ABC, abcA, 4)
+    TEST_FIELD_OFFSET(ABC, abcA, 0)
+    TEST_FIELD_SIZE  (ABC, abcB, 4)
+    TEST_FIELD_ALIGN (ABC, abcB, 4)
+    TEST_FIELD_OFFSET(ABC, abcB, 4)
+    TEST_FIELD_SIZE  (ABC, abcC, 4)
+    TEST_FIELD_ALIGN (ABC, abcC, 4)
+    TEST_FIELD_OFFSET(ABC, abcC, 8)
+}
+
+static void test_pack_ABCFLOAT(void)
+{
+    /* ABCFLOAT */
+    TEST_TYPE_SIZE   (ABCFLOAT, 12)
+    TEST_TYPE_ALIGN  (ABCFLOAT, 4)
+    TEST_FIELD_SIZE  (ABCFLOAT, abcfA, 4)
+    TEST_FIELD_ALIGN (ABCFLOAT, abcfA, 4)
+    TEST_FIELD_OFFSET(ABCFLOAT, abcfA, 0)
+    TEST_FIELD_SIZE  (ABCFLOAT, abcfB, 4)
+    TEST_FIELD_ALIGN (ABCFLOAT, abcfB, 4)
+    TEST_FIELD_OFFSET(ABCFLOAT, abcfB, 4)
+    TEST_FIELD_SIZE  (ABCFLOAT, abcfC, 4)
+    TEST_FIELD_ALIGN (ABCFLOAT, abcfC, 4)
+    TEST_FIELD_OFFSET(ABCFLOAT, abcfC, 8)
+}
+
+static void test_pack_ABORTPROC(void)
+{
+    /* ABORTPROC */
+    TEST_TYPE_SIZE   (ABORTPROC, 8)
+    TEST_TYPE_ALIGN  (ABORTPROC, 8)
+}
+
+static void test_pack_BITMAP(void)
+{
+    /* BITMAP */
+    TEST_TYPE_SIZE   (BITMAP, 32)
+    TEST_TYPE_ALIGN  (BITMAP, 8)
+    TEST_FIELD_SIZE  (BITMAP, bmType, 4)
+    TEST_FIELD_ALIGN (BITMAP, bmType, 4)
+    TEST_FIELD_OFFSET(BITMAP, bmType, 0)
+    TEST_FIELD_SIZE  (BITMAP, bmWidth, 4)
+    TEST_FIELD_ALIGN (BITMAP, bmWidth, 4)
+    TEST_FIELD_OFFSET(BITMAP, bmWidth, 4)
+    TEST_FIELD_SIZE  (BITMAP, bmHeight, 4)
+    TEST_FIELD_ALIGN (BITMAP, bmHeight, 4)
+    TEST_FIELD_OFFSET(BITMAP, bmHeight, 8)
+    TEST_FIELD_SIZE  (BITMAP, bmWidthBytes, 4)
+    TEST_FIELD_ALIGN (BITMAP, bmWidthBytes, 4)
+    TEST_FIELD_OFFSET(BITMAP, bmWidthBytes, 12)
+    TEST_FIELD_SIZE  (BITMAP, bmPlanes, 2)
+    TEST_FIELD_ALIGN (BITMAP, bmPlanes, 2)
+    TEST_FIELD_OFFSET(BITMAP, bmPlanes, 16)
+    TEST_FIELD_SIZE  (BITMAP, bmBitsPixel, 2)
+    TEST_FIELD_ALIGN (BITMAP, bmBitsPixel, 2)
+    TEST_FIELD_OFFSET(BITMAP, bmBitsPixel, 18)
+    TEST_FIELD_SIZE  (BITMAP, bmBits, 8)
+    TEST_FIELD_ALIGN (BITMAP, bmBits, 8)
+    TEST_FIELD_OFFSET(BITMAP, bmBits, 24)
+}
+
+static void test_pack_BITMAPCOREHEADER(void)
+{
+    /* BITMAPCOREHEADER */
+    TEST_TYPE_SIZE   (BITMAPCOREHEADER, 12)
+    TEST_TYPE_ALIGN  (BITMAPCOREHEADER, 4)
+    TEST_FIELD_SIZE  (BITMAPCOREHEADER, bcSize, 4)
+    TEST_FIELD_ALIGN (BITMAPCOREHEADER, bcSize, 4)
+    TEST_FIELD_OFFSET(BITMAPCOREHEADER, bcSize, 0)
+    TEST_FIELD_SIZE  (BITMAPCOREHEADER, bcWidth, 2)
+    TEST_FIELD_ALIGN (BITMAPCOREHEADER, bcWidth, 2)
+    TEST_FIELD_OFFSET(BITMAPCOREHEADER, bcWidth, 4)
+    TEST_FIELD_SIZE  (BITMAPCOREHEADER, bcHeight, 2)
+    TEST_FIELD_ALIGN (BITMAPCOREHEADER, bcHeight, 2)
+    TEST_FIELD_OFFSET(BITMAPCOREHEADER, bcHeight, 6)
+    TEST_FIELD_SIZE  (BITMAPCOREHEADER, bcPlanes, 2)
+    TEST_FIELD_ALIGN (BITMAPCOREHEADER, bcPlanes, 2)
+    TEST_FIELD_OFFSET(BITMAPCOREHEADER, bcPlanes, 8)
+    TEST_FIELD_SIZE  (BITMAPCOREHEADER, bcBitCount, 2)
+    TEST_FIELD_ALIGN (BITMAPCOREHEADER, bcBitCount, 2)
+    TEST_FIELD_OFFSET(BITMAPCOREHEADER, bcBitCount, 10)
+}
+
+static void test_pack_BITMAPCOREINFO(void)
+{
+    /* BITMAPCOREINFO */
+    TEST_TYPE_SIZE   (BITMAPCOREINFO, 16)
+    TEST_TYPE_ALIGN  (BITMAPCOREINFO, 4)
+    TEST_FIELD_SIZE  (BITMAPCOREINFO, bmciHeader, 12)
+    TEST_FIELD_ALIGN (BITMAPCOREINFO, bmciHeader, 4)
+    TEST_FIELD_OFFSET(BITMAPCOREINFO, bmciHeader, 0)
+    TEST_FIELD_SIZE  (BITMAPCOREINFO, bmciColors, 3)
+    TEST_FIELD_ALIGN (BITMAPCOREINFO, bmciColors, 1)
+    TEST_FIELD_OFFSET(BITMAPCOREINFO, bmciColors, 12)
+}
+
+static void test_pack_BITMAPFILEHEADER(void)
+{
+    /* BITMAPFILEHEADER (pack 2) */
+    TEST_TYPE_SIZE   (BITMAPFILEHEADER, 14)
+    TEST_TYPE_ALIGN  (BITMAPFILEHEADER, 2)
+    TEST_FIELD_SIZE  (BITMAPFILEHEADER, bfType, 2)
+    TEST_FIELD_ALIGN (BITMAPFILEHEADER, bfType, 2)
+    TEST_FIELD_OFFSET(BITMAPFILEHEADER, bfType, 0)
+    TEST_FIELD_SIZE  (BITMAPFILEHEADER, bfSize, 4)
+    TEST_FIELD_ALIGN (BITMAPFILEHEADER, bfSize, 2)
+    TEST_FIELD_OFFSET(BITMAPFILEHEADER, bfSize, 2)
+    TEST_FIELD_SIZE  (BITMAPFILEHEADER, bfReserved1, 2)
+    TEST_FIELD_ALIGN (BITMAPFILEHEADER, bfReserved1, 2)
+    TEST_FIELD_OFFSET(BITMAPFILEHEADER, bfReserved1, 6)
+    TEST_FIELD_SIZE  (BITMAPFILEHEADER, bfReserved2, 2)
+    TEST_FIELD_ALIGN (BITMAPFILEHEADER, bfReserved2, 2)
+    TEST_FIELD_OFFSET(BITMAPFILEHEADER, bfReserved2, 8)
+    TEST_FIELD_SIZE  (BITMAPFILEHEADER, bfOffBits, 4)
+    TEST_FIELD_ALIGN (BITMAPFILEHEADER, bfOffBits, 2)
+    TEST_FIELD_OFFSET(BITMAPFILEHEADER, bfOffBits, 10)
+}
+
+static void test_pack_BITMAPINFO(void)
+{
+    /* BITMAPINFO */
+    TEST_TYPE_SIZE   (BITMAPINFO, 44)
+    TEST_TYPE_ALIGN  (BITMAPINFO, 4)
+    TEST_FIELD_SIZE  (BITMAPINFO, bmiHeader, 40)
+    TEST_FIELD_ALIGN (BITMAPINFO, bmiHeader, 4)
+    TEST_FIELD_OFFSET(BITMAPINFO, bmiHeader, 0)
+    TEST_FIELD_SIZE  (BITMAPINFO, bmiColors, 4)
+    TEST_FIELD_ALIGN (BITMAPINFO, bmiColors, 1)
+    TEST_FIELD_OFFSET(BITMAPINFO, bmiColors, 40)
+}
+
+static void test_pack_BITMAPINFOHEADER(void)
+{
+    /* BITMAPINFOHEADER */
+    TEST_TYPE_SIZE   (BITMAPINFOHEADER, 40)
+    TEST_TYPE_ALIGN  (BITMAPINFOHEADER, 4)
+    TEST_FIELD_SIZE  (BITMAPINFOHEADER, biSize, 4)
+    TEST_FIELD_ALIGN (BITMAPINFOHEADER, biSize, 4)
+    TEST_FIELD_OFFSET(BITMAPINFOHEADER, biSize, 0)
+    TEST_FIELD_SIZE  (BITMAPINFOHEADER, biWidth, 4)
+    TEST_FIELD_ALIGN (BITMAPINFOHEADER, biWidth, 4)
+    TEST_FIELD_OFFSET(BITMAPINFOHEADER, biWidth, 4)
+    TEST_FIELD_SIZE  (BITMAPINFOHEADER, biHeight, 4)
+    TEST_FIELD_ALIGN (BITMAPINFOHEADER, biHeight, 4)
+    TEST_FIELD_OFFSET(BITMAPINFOHEADER, biHeight, 8)
+    TEST_FIELD_SIZE  (BITMAPINFOHEADER, biPlanes, 2)
+    TEST_FIELD_ALIGN (BITMAPINFOHEADER, biPlanes, 2)
+    TEST_FIELD_OFFSET(BITMAPINFOHEADER, biPlanes, 12)
+    TEST_FIELD_SIZE  (BITMAPINFOHEADER, biBitCount, 2)
+    TEST_FIELD_ALIGN (BITMAPINFOHEADER, biBitCount, 2)
+    TEST_FIELD_OFFSET(BITMAPINFOHEADER, biBitCount, 14)
+    TEST_FIELD_SIZE  (BITMAPINFOHEADER, biCompression, 4)
+    TEST_FIELD_ALIGN (BITMAPINFOHEADER, biCompression, 4)
+    TEST_FIELD_OFFSET(BITMAPINFOHEADER, biCompression, 16)
+    TEST_FIELD_SIZE  (BITMAPINFOHEADER, biSizeImage, 4)
+    TEST_FIELD_ALIGN (BITMAPINFOHEADER, biSizeImage, 4)
+    TEST_FIELD_OFFSET(BITMAPINFOHEADER, biSizeImage, 20)
+    TEST_FIELD_SIZE  (BITMAPINFOHEADER, biXPelsPerMeter, 4)
+    TEST_FIELD_ALIGN (BITMAPINFOHEADER, biXPelsPerMeter, 4)
+    TEST_FIELD_OFFSET(BITMAPINFOHEADER, biXPelsPerMeter, 24)
+    TEST_FIELD_SIZE  (BITMAPINFOHEADER, biYPelsPerMeter, 4)
+    TEST_FIELD_ALIGN (BITMAPINFOHEADER, biYPelsPerMeter, 4)
+    TEST_FIELD_OFFSET(BITMAPINFOHEADER, biYPelsPerMeter, 28)
+    TEST_FIELD_SIZE  (BITMAPINFOHEADER, biClrUsed, 4)
+    TEST_FIELD_ALIGN (BITMAPINFOHEADER, biClrUsed, 4)
+    TEST_FIELD_OFFSET(BITMAPINFOHEADER, biClrUsed, 32)
+    TEST_FIELD_SIZE  (BITMAPINFOHEADER, biClrImportant, 4)
+    TEST_FIELD_ALIGN (BITMAPINFOHEADER, biClrImportant, 4)
+    TEST_FIELD_OFFSET(BITMAPINFOHEADER, biClrImportant, 36)
+}
+
+static void test_pack_BITMAPV4HEADER(void)
+{
+    /* BITMAPV4HEADER */
+    TEST_TYPE_SIZE   (BITMAPV4HEADER, 108)
+    TEST_TYPE_ALIGN  (BITMAPV4HEADER, 4)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4Size, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4Size, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4Size, 0)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4Width, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4Width, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4Width, 4)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4Height, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4Height, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4Height, 8)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4Planes, 2)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4Planes, 2)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4Planes, 12)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4BitCount, 2)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4BitCount, 2)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4BitCount, 14)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4V4Compression, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4V4Compression, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4V4Compression, 16)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4SizeImage, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4SizeImage, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4SizeImage, 20)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4XPelsPerMeter, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4XPelsPerMeter, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4XPelsPerMeter, 24)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4YPelsPerMeter, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4YPelsPerMeter, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4YPelsPerMeter, 28)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4ClrUsed, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4ClrUsed, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4ClrUsed, 32)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4ClrImportant, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4ClrImportant, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4ClrImportant, 36)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4RedMask, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4RedMask, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4RedMask, 40)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4GreenMask, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4GreenMask, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4GreenMask, 44)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4BlueMask, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4BlueMask, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4BlueMask, 48)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4AlphaMask, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4AlphaMask, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4AlphaMask, 52)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4CSType, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4CSType, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4CSType, 56)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4Endpoints, 36)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4Endpoints, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4Endpoints, 60)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4GammaRed, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4GammaRed, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4GammaRed, 96)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4GammaGreen, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4GammaGreen, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4GammaGreen, 100)
+    TEST_FIELD_SIZE  (BITMAPV4HEADER, bV4GammaBlue, 4)
+    TEST_FIELD_ALIGN (BITMAPV4HEADER, bV4GammaBlue, 4)
+    TEST_FIELD_OFFSET(BITMAPV4HEADER, bV4GammaBlue, 104)
+}
+
+static void test_pack_BITMAPV5HEADER(void)
+{
+    /* BITMAPV5HEADER */
+    TEST_TYPE_SIZE   (BITMAPV5HEADER, 124)
+    TEST_TYPE_ALIGN  (BITMAPV5HEADER, 4)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5Size, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5Size, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5Size, 0)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5Width, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5Width, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5Width, 4)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5Height, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5Height, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5Height, 8)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5Planes, 2)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5Planes, 2)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5Planes, 12)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5BitCount, 2)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5BitCount, 2)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5BitCount, 14)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5Compression, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5Compression, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5Compression, 16)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5SizeImage, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5SizeImage, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5SizeImage, 20)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5XPelsPerMeter, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5XPelsPerMeter, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5XPelsPerMeter, 24)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5YPelsPerMeter, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5YPelsPerMeter, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5YPelsPerMeter, 28)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5ClrUsed, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5ClrUsed, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5ClrUsed, 32)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5ClrImportant, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5ClrImportant, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5ClrImportant, 36)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5RedMask, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5RedMask, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5RedMask, 40)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5GreenMask, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5GreenMask, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5GreenMask, 44)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5BlueMask, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5BlueMask, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5BlueMask, 48)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5AlphaMask, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5AlphaMask, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5AlphaMask, 52)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5CSType, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5CSType, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5CSType, 56)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5Endpoints, 36)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5Endpoints, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5Endpoints, 60)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5GammaRed, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5GammaRed, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5GammaRed, 96)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5GammaGreen, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5GammaGreen, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5GammaGreen, 100)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5GammaBlue, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5GammaBlue, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5GammaBlue, 104)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5Intent, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5Intent, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5Intent, 108)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5ProfileData, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5ProfileData, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5ProfileData, 112)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5ProfileSize, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5ProfileSize, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5ProfileSize, 116)
+    TEST_FIELD_SIZE  (BITMAPV5HEADER, bV5Reserved, 4)
+    TEST_FIELD_ALIGN (BITMAPV5HEADER, bV5Reserved, 4)
+    TEST_FIELD_OFFSET(BITMAPV5HEADER, bV5Reserved, 120)
+}
+
+static void test_pack_BLENDFUNCTION(void)
+{
+    /* BLENDFUNCTION */
+    TEST_TYPE_SIZE   (BLENDFUNCTION, 4)
+    TEST_TYPE_ALIGN  (BLENDFUNCTION, 1)
+    TEST_FIELD_SIZE  (BLENDFUNCTION, BlendOp, 1)
+    TEST_FIELD_ALIGN (BLENDFUNCTION, BlendOp, 1)
+    TEST_FIELD_OFFSET(BLENDFUNCTION, BlendOp, 0)
+    TEST_FIELD_SIZE  (BLENDFUNCTION, BlendFlags, 1)
+    TEST_FIELD_ALIGN (BLENDFUNCTION, BlendFlags, 1)
+    TEST_FIELD_OFFSET(BLENDFUNCTION, BlendFlags, 1)
+    TEST_FIELD_SIZE  (BLENDFUNCTION, SourceConstantAlpha, 1)
+    TEST_FIELD_ALIGN (BLENDFUNCTION, SourceConstantAlpha, 1)
+    TEST_FIELD_OFFSET(BLENDFUNCTION, SourceConstantAlpha, 2)
+    TEST_FIELD_SIZE  (BLENDFUNCTION, AlphaFormat, 1)
+    TEST_FIELD_ALIGN (BLENDFUNCTION, AlphaFormat, 1)
+    TEST_FIELD_OFFSET(BLENDFUNCTION, AlphaFormat, 3)
+}
+
+static void test_pack_CHARSETINFO(void)
+{
+    /* CHARSETINFO */
+    TEST_TYPE_SIZE   (CHARSETINFO, 32)
+    TEST_TYPE_ALIGN  (CHARSETINFO, 4)
+    TEST_FIELD_SIZE  (CHARSETINFO, ciCharset, 4)
+    TEST_FIELD_ALIGN (CHARSETINFO, ciCharset, 4)
+    TEST_FIELD_OFFSET(CHARSETINFO, ciCharset, 0)
+    TEST_FIELD_SIZE  (CHARSETINFO, ciACP, 4)
+    TEST_FIELD_ALIGN (CHARSETINFO, ciACP, 4)
+    TEST_FIELD_OFFSET(CHARSETINFO, ciACP, 4)
+    TEST_FIELD_SIZE  (CHARSETINFO, fs, 24)
+    TEST_FIELD_ALIGN (CHARSETINFO, fs, 4)
+    TEST_FIELD_OFFSET(CHARSETINFO, fs, 8)
+}
+
+static void test_pack_CIEXYZ(void)
+{
+    /* CIEXYZ */
+    TEST_TYPE_SIZE   (CIEXYZ, 12)
+    TEST_TYPE_ALIGN  (CIEXYZ, 4)
+    TEST_FIELD_SIZE  (CIEXYZ, ciexyzX, 4)
+    TEST_FIELD_ALIGN (CIEXYZ, ciexyzX, 4)
+    TEST_FIELD_OFFSET(CIEXYZ, ciexyzX, 0)
+    TEST_FIELD_SIZE  (CIEXYZ, ciexyzY, 4)
+    TEST_FIELD_ALIGN (CIEXYZ, ciexyzY, 4)
+    TEST_FIELD_OFFSET(CIEXYZ, ciexyzY, 4)
+    TEST_FIELD_SIZE  (CIEXYZ, ciexyzZ, 4)
+    TEST_FIELD_ALIGN (CIEXYZ, ciexyzZ, 4)
+    TEST_FIELD_OFFSET(CIEXYZ, ciexyzZ, 8)
+}
+
+static void test_pack_CIEXYZTRIPLE(void)
+{
+    /* CIEXYZTRIPLE */
+    TEST_TYPE_SIZE   (CIEXYZTRIPLE, 36)
+    TEST_TYPE_ALIGN  (CIEXYZTRIPLE, 4)
+    TEST_FIELD_SIZE  (CIEXYZTRIPLE, ciexyzRed, 12)
+    TEST_FIELD_ALIGN (CIEXYZTRIPLE, ciexyzRed, 4)
+    TEST_FIELD_OFFSET(CIEXYZTRIPLE, ciexyzRed, 0)
+    TEST_FIELD_SIZE  (CIEXYZTRIPLE, ciexyzGreen, 12)
+    TEST_FIELD_ALIGN (CIEXYZTRIPLE, ciexyzGreen, 4)
+    TEST_FIELD_OFFSET(CIEXYZTRIPLE, ciexyzGreen, 12)
+    TEST_FIELD_SIZE  (CIEXYZTRIPLE, ciexyzBlue, 12)
+    TEST_FIELD_ALIGN (CIEXYZTRIPLE, ciexyzBlue, 4)
+    TEST_FIELD_OFFSET(CIEXYZTRIPLE, ciexyzBlue, 24)
+}
+
+static void test_pack_COLOR16(void)
+{
+    /* COLOR16 */
+    TEST_TYPE_SIZE   (COLOR16, 2)
+    TEST_TYPE_ALIGN  (COLOR16, 2)
+}
+
+static void test_pack_COLORADJUSTMENT(void)
+{
+    /* COLORADJUSTMENT */
+    TEST_TYPE_SIZE   (COLORADJUSTMENT, 24)
+    TEST_TYPE_ALIGN  (COLORADJUSTMENT, 2)
+    TEST_FIELD_SIZE  (COLORADJUSTMENT, caSize, 2)
+    TEST_FIELD_ALIGN (COLORADJUSTMENT, caSize, 2)
+    TEST_FIELD_OFFSET(COLORADJUSTMENT, caSize, 0)
+    TEST_FIELD_SIZE  (COLORADJUSTMENT, caFlags, 2)
+    TEST_FIELD_ALIGN (COLORADJUSTMENT, caFlags, 2)
+    TEST_FIELD_OFFSET(COLORADJUSTMENT, caFlags, 2)
+    TEST_FIELD_SIZE  (COLORADJUSTMENT, caIlluminantIndex, 2)
+    TEST_FIELD_ALIGN (COLORADJUSTMENT, caIlluminantIndex, 2)
+    TEST_FIELD_OFFSET(COLORADJUSTMENT, caIlluminantIndex, 4)
+    TEST_FIELD_SIZE  (COLORADJUSTMENT, caRedGamma, 2)
+    TEST_FIELD_ALIGN (COLORADJUSTMENT, caRedGamma, 2)
+    TEST_FIELD_OFFSET(COLORADJUSTMENT, caRedGamma, 6)
+    TEST_FIELD_SIZE  (COLORADJUSTMENT, caGreenGamma, 2)
+    TEST_FIELD_ALIGN (COLORADJUSTMENT, caGreenGamma, 2)
+    TEST_FIELD_OFFSET(COLORADJUSTMENT, caGreenGamma, 8)
+    TEST_FIELD_SIZE  (COLORADJUSTMENT, caBlueGamma, 2)
+    TEST_FIELD_ALIGN (COLORADJUSTMENT, caBlueGamma, 2)
+    TEST_FIELD_OFFSET(COLORADJUSTMENT, caBlueGamma, 10)
+    TEST_FIELD_SIZE  (COLORADJUSTMENT, caReferenceBlack, 2)
+    TEST_FIELD_ALIGN (COLORADJUSTMENT, caReferenceBlack, 2)
+    TEST_FIELD_OFFSET(COLORADJUSTMENT, caReferenceBlack, 12)
+    TEST_FIELD_SIZE  (COLORADJUSTMENT, caReferenceWhite, 2)
+    TEST_FIELD_ALIGN (COLORADJUSTMENT, caReferenceWhite, 2)
+    TEST_FIELD_OFFSET(COLORADJUSTMENT, caReferenceWhite, 14)
+    TEST_FIELD_SIZE  (COLORADJUSTMENT, caContrast, 2)
+    TEST_FIELD_ALIGN (COLORADJUSTMENT, caContrast, 2)
+    TEST_FIELD_OFFSET(COLORADJUSTMENT, caContrast, 16)
+    TEST_FIELD_SIZE  (COLORADJUSTMENT, caBrightness, 2)
+    TEST_FIELD_ALIGN (COLORADJUSTMENT, caBrightness, 2)
+    TEST_FIELD_OFFSET(COLORADJUSTMENT, caBrightness, 18)
+    TEST_FIELD_SIZE  (COLORADJUSTMENT, caColorfulness, 2)
+    TEST_FIELD_ALIGN (COLORADJUSTMENT, caColorfulness, 2)
+    TEST_FIELD_OFFSET(COLORADJUSTMENT, caColorfulness, 20)
+    TEST_FIELD_SIZE  (COLORADJUSTMENT, caRedGreenTint, 2)
+    TEST_FIELD_ALIGN (COLORADJUSTMENT, caRedGreenTint, 2)
+    TEST_FIELD_OFFSET(COLORADJUSTMENT, caRedGreenTint, 22)
+}
+
+static void test_pack_DEVMODEA(void)
+{
+    /* DEVMODEA */
+    TEST_FIELD_SIZE  (DEVMODEA, dmDeviceName, 32)
+    TEST_FIELD_ALIGN (DEVMODEA, dmDeviceName, 1)
+    TEST_FIELD_OFFSET(DEVMODEA, dmDeviceName, 0)
+    TEST_FIELD_SIZE  (DEVMODEA, dmSpecVersion, 2)
+    TEST_FIELD_ALIGN (DEVMODEA, dmSpecVersion, 2)
+    TEST_FIELD_OFFSET(DEVMODEA, dmSpecVersion, 32)
+    TEST_FIELD_SIZE  (DEVMODEA, dmDriverVersion, 2)
+    TEST_FIELD_ALIGN (DEVMODEA, dmDriverVersion, 2)
+    TEST_FIELD_OFFSET(DEVMODEA, dmDriverVersion, 34)
+    TEST_FIELD_SIZE  (DEVMODEA, dmSize, 2)
+    TEST_FIELD_ALIGN (DEVMODEA, dmSize, 2)
+    TEST_FIELD_OFFSET(DEVMODEA, dmSize, 36)
+    TEST_FIELD_SIZE  (DEVMODEA, dmDriverExtra, 2)
+    TEST_FIELD_ALIGN (DEVMODEA, dmDriverExtra, 2)
+    TEST_FIELD_OFFSET(DEVMODEA, dmDriverExtra, 38)
+    TEST_FIELD_SIZE  (DEVMODEA, dmFields, 4)
+    TEST_FIELD_ALIGN (DEVMODEA, dmFields, 4)
+    TEST_FIELD_OFFSET(DEVMODEA, dmFields, 40)
+}
+
+static void test_pack_DEVMODEW(void)
+{
+    /* DEVMODEW */
+    TEST_FIELD_SIZE  (DEVMODEW, dmDeviceName, 64)
+    TEST_FIELD_ALIGN (DEVMODEW, dmDeviceName, 2)
+    TEST_FIELD_OFFSET(DEVMODEW, dmDeviceName, 0)
+    TEST_FIELD_SIZE  (DEVMODEW, dmSpecVersion, 2)
+    TEST_FIELD_ALIGN (DEVMODEW, dmSpecVersion, 2)
+    TEST_FIELD_OFFSET(DEVMODEW, dmSpecVersion, 64)
+    TEST_FIELD_SIZE  (DEVMODEW, dmDriverVersion, 2)
+    TEST_FIELD_ALIGN (DEVMODEW, dmDriverVersion, 2)
+    TEST_FIELD_OFFSET(DEVMODEW, dmDriverVersion, 66)
+    TEST_FIELD_SIZE  (DEVMODEW, dmSize, 2)
+    TEST_FIELD_ALIGN (DEVMODEW, dmSize, 2)
+    TEST_FIELD_OFFSET(DEVMODEW, dmSize, 68)
+    TEST_FIELD_SIZE  (DEVMODEW, dmDriverExtra, 2)
+    TEST_FIELD_ALIGN (DEVMODEW, dmDriverExtra, 2)
+    TEST_FIELD_OFFSET(DEVMODEW, dmDriverExtra, 70)
+    TEST_FIELD_SIZE  (DEVMODEW, dmFields, 4)
+    TEST_FIELD_ALIGN (DEVMODEW, dmFields, 4)
+    TEST_FIELD_OFFSET(DEVMODEW, dmFields, 72)
+}
+
+static void test_pack_DIBSECTION(void)
+{
+    /* DIBSECTION */
+    TEST_TYPE_SIZE   (DIBSECTION, 104)
+    TEST_TYPE_ALIGN  (DIBSECTION, 8)
+    TEST_FIELD_SIZE  (DIBSECTION, dsBm, 32)
+    TEST_FIELD_ALIGN (DIBSECTION, dsBm, 8)
+    TEST_FIELD_OFFSET(DIBSECTION, dsBm, 0)
+    TEST_FIELD_SIZE  (DIBSECTION, dsBmih, 40)
+    TEST_FIELD_ALIGN (DIBSECTION, dsBmih, 4)
+    TEST_FIELD_OFFSET(DIBSECTION, dsBmih, 32)
+    TEST_FIELD_SIZE  (DIBSECTION, dsBitfields, 12)
+    TEST_FIELD_ALIGN (DIBSECTION, dsBitfields, 4)
+    TEST_FIELD_OFFSET(DIBSECTION, dsBitfields, 72)
+    TEST_FIELD_SIZE  (DIBSECTION, dshSection, 8)
+    TEST_FIELD_ALIGN (DIBSECTION, dshSection, 8)
+    TEST_FIELD_OFFSET(DIBSECTION, dshSection, 88)
+    TEST_FIELD_SIZE  (DIBSECTION, dsOffset, 4)
+    TEST_FIELD_ALIGN (DIBSECTION, dsOffset, 4)
+    TEST_FIELD_OFFSET(DIBSECTION, dsOffset, 96)
+}
+
+static void test_pack_DISPLAY_DEVICEA(void)
+{
+    /* DISPLAY_DEVICEA */
+    TEST_TYPE_SIZE   (DISPLAY_DEVICEA, 424)
+    TEST_TYPE_ALIGN  (DISPLAY_DEVICEA, 4)
+    TEST_FIELD_SIZE  (DISPLAY_DEVICEA, cb, 4)
+    TEST_FIELD_ALIGN (DISPLAY_DEVICEA, cb, 4)
+    TEST_FIELD_OFFSET(DISPLAY_DEVICEA, cb, 0)
+    TEST_FIELD_SIZE  (DISPLAY_DEVICEA, DeviceName, 32)
+    TEST_FIELD_ALIGN (DISPLAY_DEVICEA, DeviceName, 1)
+    TEST_FIELD_OFFSET(DISPLAY_DEVICEA, DeviceName, 4)
+    TEST_FIELD_SIZE  (DISPLAY_DEVICEA, DeviceString, 128)
+    TEST_FIELD_ALIGN (DISPLAY_DEVICEA, DeviceString, 1)
+    TEST_FIELD_OFFSET(DISPLAY_DEVICEA, DeviceString, 36)
+    TEST_FIELD_SIZE  (DISPLAY_DEVICEA, StateFlags, 4)
+    TEST_FIELD_ALIGN (DISPLAY_DEVICEA, StateFlags, 4)
+    TEST_FIELD_OFFSET(DISPLAY_DEVICEA, StateFlags, 164)
+    TEST_FIELD_SIZE  (DISPLAY_DEVICEA, DeviceID, 128)
+    TEST_FIELD_ALIGN (DISPLAY_DEVICEA, DeviceID, 1)
+    TEST_FIELD_OFFSET(DISPLAY_DEVICEA, DeviceID, 168)
+    TEST_FIELD_SIZE  (DISPLAY_DEVICEA, DeviceKey, 128)
+    TEST_FIELD_ALIGN (DISPLAY_DEVICEA, DeviceKey, 1)
+    TEST_FIELD_OFFSET(DISPLAY_DEVICEA, DeviceKey, 296)
+}
+
+static void test_pack_DISPLAY_DEVICEW(void)
+{
+    /* DISPLAY_DEVICEW */
+    TEST_TYPE_SIZE   (DISPLAY_DEVICEW, 840)
+    TEST_TYPE_ALIGN  (DISPLAY_DEVICEW, 4)
+    TEST_FIELD_SIZE  (DISPLAY_DEVICEW, cb, 4)
+    TEST_FIELD_ALIGN (DISPLAY_DEVICEW, cb, 4)
+    TEST_FIELD_OFFSET(DISPLAY_DEVICEW, cb, 0)
+    TEST_FIELD_SIZE  (DISPLAY_DEVICEW, DeviceName, 64)
+    TEST_FIELD_ALIGN (DISPLAY_DEVICEW, DeviceName, 2)
+    TEST_FIELD_OFFSET(DISPLAY_DEVICEW, DeviceName, 4)
+    TEST_FIELD_SIZE  (DISPLAY_DEVICEW, DeviceString, 256)
+    TEST_FIELD_ALIGN (DISPLAY_DEVICEW, DeviceString, 2)
+    TEST_FIELD_OFFSET(DISPLAY_DEVICEW, DeviceString, 68)
+    TEST_FIELD_SIZE  (DISPLAY_DEVICEW, StateFlags, 4)
+    TEST_FIELD_ALIGN (DISPLAY_DEVICEW, StateFlags, 4)
+    TEST_FIELD_OFFSET(DISPLAY_DEVICEW, StateFlags, 324)
+    TEST_FIELD_SIZE  (DISPLAY_DEVICEW, DeviceID, 256)
+    TEST_FIELD_ALIGN (DISPLAY_DEVICEW, DeviceID, 2)
+    TEST_FIELD_OFFSET(DISPLAY_DEVICEW, DeviceID, 328)
+    TEST_FIELD_SIZE  (DISPLAY_DEVICEW, DeviceKey, 256)
+    TEST_FIELD_ALIGN (DISPLAY_DEVICEW, DeviceKey, 2)
+    TEST_FIELD_OFFSET(DISPLAY_DEVICEW, DeviceKey, 584)
+}
+
+static void test_pack_DOCINFOA(void)
+{
+    /* DOCINFOA */
+    TEST_TYPE_SIZE   (DOCINFOA, 40)
+    TEST_TYPE_ALIGN  (DOCINFOA, 8)
+    TEST_FIELD_SIZE  (DOCINFOA, cbSize, 4)
+    TEST_FIELD_ALIGN (DOCINFOA, cbSize, 4)
+    TEST_FIELD_OFFSET(DOCINFOA, cbSize, 0)
+    TEST_FIELD_SIZE  (DOCINFOA, lpszDocName, 8)
+    TEST_FIELD_ALIGN (DOCINFOA, lpszDocName, 8)
+    TEST_FIELD_OFFSET(DOCINFOA, lpszDocName, 8)
+    TEST_FIELD_SIZE  (DOCINFOA, lpszOutput, 8)
+    TEST_FIELD_ALIGN (DOCINFOA, lpszOutput, 8)
+    TEST_FIELD_OFFSET(DOCINFOA, lpszOutput, 16)
+    TEST_FIELD_SIZE  (DOCINFOA, lpszDatatype, 8)
+    TEST_FIELD_ALIGN (DOCINFOA, lpszDatatype, 8)
+    TEST_FIELD_OFFSET(DOCINFOA, lpszDatatype, 24)
+    TEST_FIELD_SIZE  (DOCINFOA, fwType, 4)
+    TEST_FIELD_ALIGN (DOCINFOA, fwType, 4)
+    TEST_FIELD_OFFSET(DOCINFOA, fwType, 32)
+}
+
+static void test_pack_DOCINFOW(void)
+{
+    /* DOCINFOW */
+    TEST_TYPE_SIZE   (DOCINFOW, 40)
+    TEST_TYPE_ALIGN  (DOCINFOW, 8)
+    TEST_FIELD_SIZE  (DOCINFOW, cbSize, 4)
+    TEST_FIELD_ALIGN (DOCINFOW, cbSize, 4)
+    TEST_FIELD_OFFSET(DOCINFOW, cbSize, 0)
+    TEST_FIELD_SIZE  (DOCINFOW, lpszDocName, 8)
+    TEST_FIELD_ALIGN (DOCINFOW, lpszDocName, 8)
+    TEST_FIELD_OFFSET(DOCINFOW, lpszDocName, 8)
+    TEST_FIELD_SIZE  (DOCINFOW, lpszOutput, 8)
+    TEST_FIELD_ALIGN (DOCINFOW, lpszOutput, 8)
+    TEST_FIELD_OFFSET(DOCINFOW, lpszOutput, 16)
+    TEST_FIELD_SIZE  (DOCINFOW, lpszDatatype, 8)
+    TEST_FIELD_ALIGN (DOCINFOW, lpszDatatype, 8)
+    TEST_FIELD_OFFSET(DOCINFOW, lpszDatatype, 24)
+    TEST_FIELD_SIZE  (DOCINFOW, fwType, 4)
+    TEST_FIELD_ALIGN (DOCINFOW, fwType, 4)
+    TEST_FIELD_OFFSET(DOCINFOW, fwType, 32)
+}
+
+static void test_pack_EMR(void)
+{
+    /* EMR */
+    TEST_TYPE_SIZE   (EMR, 8)
+    TEST_TYPE_ALIGN  (EMR, 4)
+    TEST_FIELD_SIZE  (EMR, iType, 4)
+    TEST_FIELD_ALIGN (EMR, iType, 4)
+    TEST_FIELD_OFFSET(EMR, iType, 0)
+    TEST_FIELD_SIZE  (EMR, nSize, 4)
+    TEST_FIELD_ALIGN (EMR, nSize, 4)
+    TEST_FIELD_OFFSET(EMR, nSize, 4)
+}
+
+static void test_pack_EMRABORTPATH(void)
+{
+    /* EMRABORTPATH */
+    TEST_TYPE_SIZE   (EMRABORTPATH, 8)
+    TEST_TYPE_ALIGN  (EMRABORTPATH, 4)
+    TEST_FIELD_SIZE  (EMRABORTPATH, emr, 8)
+    TEST_FIELD_ALIGN (EMRABORTPATH, emr, 4)
+    TEST_FIELD_OFFSET(EMRABORTPATH, emr, 0)
+}
+
+static void test_pack_EMRANGLEARC(void)
+{
+    /* EMRANGLEARC */
+    TEST_TYPE_SIZE   (EMRANGLEARC, 28)
+    TEST_TYPE_ALIGN  (EMRANGLEARC, 4)
+    TEST_FIELD_SIZE  (EMRANGLEARC, emr, 8)
+    TEST_FIELD_ALIGN (EMRANGLEARC, emr, 4)
+    TEST_FIELD_OFFSET(EMRANGLEARC, emr, 0)
+    TEST_FIELD_SIZE  (EMRANGLEARC, ptlCenter, 8)
+    TEST_FIELD_ALIGN (EMRANGLEARC, ptlCenter, 4)
+    TEST_FIELD_OFFSET(EMRANGLEARC, ptlCenter, 8)
+    TEST_FIELD_SIZE  (EMRANGLEARC, nRadius, 4)
+    TEST_FIELD_ALIGN (EMRANGLEARC, nRadius, 4)
+    TEST_FIELD_OFFSET(EMRANGLEARC, nRadius, 16)
+    TEST_FIELD_SIZE  (EMRANGLEARC, eStartAngle, 4)
+    TEST_FIELD_ALIGN (EMRANGLEARC, eStartAngle, 4)
+    TEST_FIELD_OFFSET(EMRANGLEARC, eStartAngle, 20)
+    TEST_FIELD_SIZE  (EMRANGLEARC, eSweepAngle, 4)
+    TEST_FIELD_ALIGN (EMRANGLEARC, eSweepAngle, 4)
+    TEST_FIELD_OFFSET(EMRANGLEARC, eSweepAngle, 24)
+}
+
+static void test_pack_EMRARC(void)
+{
+    /* EMRARC */
+    TEST_TYPE_SIZE   (EMRARC, 40)
+    TEST_TYPE_ALIGN  (EMRARC, 4)
+    TEST_FIELD_SIZE  (EMRARC, emr, 8)
+    TEST_FIELD_ALIGN (EMRARC, emr, 4)
+    TEST_FIELD_OFFSET(EMRARC, emr, 0)
+    TEST_FIELD_SIZE  (EMRARC, rclBox, 16)
+    TEST_FIELD_ALIGN (EMRARC, rclBox, 4)
+    TEST_FIELD_OFFSET(EMRARC, rclBox, 8)
+    TEST_FIELD_SIZE  (EMRARC, ptlStart, 8)
+    TEST_FIELD_ALIGN (EMRARC, ptlStart, 4)
+    TEST_FIELD_OFFSET(EMRARC, ptlStart, 24)
+    TEST_FIELD_SIZE  (EMRARC, ptlEnd, 8)
+    TEST_FIELD_ALIGN (EMRARC, ptlEnd, 4)
+    TEST_FIELD_OFFSET(EMRARC, ptlEnd, 32)
+}
+
+static void test_pack_EMRARCTO(void)
+{
+    /* EMRARCTO */
+    TEST_TYPE_SIZE   (EMRARCTO, 40)
+    TEST_TYPE_ALIGN  (EMRARCTO, 4)
+    TEST_FIELD_SIZE  (EMRARCTO, emr, 8)
+    TEST_FIELD_ALIGN (EMRARCTO, emr, 4)
+    TEST_FIELD_OFFSET(EMRARCTO, emr, 0)
+    TEST_FIELD_SIZE  (EMRARCTO, rclBox, 16)
+    TEST_FIELD_ALIGN (EMRARCTO, rclBox, 4)
+    TEST_FIELD_OFFSET(EMRARCTO, rclBox, 8)
+    TEST_FIELD_SIZE  (EMRARCTO, ptlStart, 8)
+    TEST_FIELD_ALIGN (EMRARCTO, ptlStart, 4)
+    TEST_FIELD_OFFSET(EMRARCTO, ptlStart, 24)
+    TEST_FIELD_SIZE  (EMRARCTO, ptlEnd, 8)
+    TEST_FIELD_ALIGN (EMRARCTO, ptlEnd, 4)
+    TEST_FIELD_OFFSET(EMRARCTO, ptlEnd, 32)
+}
+
+static void test_pack_EMRBEGINPATH(void)
+{
+    /* EMRBEGINPATH */
+    TEST_TYPE_SIZE   (EMRBEGINPATH, 8)
+    TEST_TYPE_ALIGN  (EMRBEGINPATH, 4)
+    TEST_FIELD_SIZE  (EMRBEGINPATH, emr, 8)
+    TEST_FIELD_ALIGN (EMRBEGINPATH, emr, 4)
+    TEST_FIELD_OFFSET(EMRBEGINPATH, emr, 0)
+}
+
+static void test_pack_EMRBITBLT(void)
+{
+    /* EMRBITBLT */
+    TEST_TYPE_SIZE   (EMRBITBLT, 100)
+    TEST_TYPE_ALIGN  (EMRBITBLT, 4)
+    TEST_FIELD_SIZE  (EMRBITBLT, emr, 8)
+    TEST_FIELD_ALIGN (EMRBITBLT, emr, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, emr, 0)
+    TEST_FIELD_SIZE  (EMRBITBLT, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRBITBLT, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRBITBLT, xDest, 4)
+    TEST_FIELD_ALIGN (EMRBITBLT, xDest, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, xDest, 24)
+    TEST_FIELD_SIZE  (EMRBITBLT, yDest, 4)
+    TEST_FIELD_ALIGN (EMRBITBLT, yDest, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, yDest, 28)
+    TEST_FIELD_SIZE  (EMRBITBLT, cxDest, 4)
+    TEST_FIELD_ALIGN (EMRBITBLT, cxDest, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, cxDest, 32)
+    TEST_FIELD_SIZE  (EMRBITBLT, cyDest, 4)
+    TEST_FIELD_ALIGN (EMRBITBLT, cyDest, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, cyDest, 36)
+    TEST_FIELD_SIZE  (EMRBITBLT, dwRop, 4)
+    TEST_FIELD_ALIGN (EMRBITBLT, dwRop, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, dwRop, 40)
+    TEST_FIELD_SIZE  (EMRBITBLT, xSrc, 4)
+    TEST_FIELD_ALIGN (EMRBITBLT, xSrc, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, xSrc, 44)
+    TEST_FIELD_SIZE  (EMRBITBLT, ySrc, 4)
+    TEST_FIELD_ALIGN (EMRBITBLT, ySrc, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, ySrc, 48)
+    TEST_FIELD_SIZE  (EMRBITBLT, xformSrc, 24)
+    TEST_FIELD_ALIGN (EMRBITBLT, xformSrc, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, xformSrc, 52)
+    TEST_FIELD_SIZE  (EMRBITBLT, crBkColorSrc, 4)
+    TEST_FIELD_ALIGN (EMRBITBLT, crBkColorSrc, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, crBkColorSrc, 76)
+    TEST_FIELD_SIZE  (EMRBITBLT, iUsageSrc, 4)
+    TEST_FIELD_ALIGN (EMRBITBLT, iUsageSrc, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, iUsageSrc, 80)
+    TEST_FIELD_SIZE  (EMRBITBLT, offBmiSrc, 4)
+    TEST_FIELD_ALIGN (EMRBITBLT, offBmiSrc, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, offBmiSrc, 84)
+    TEST_FIELD_SIZE  (EMRBITBLT, cbBmiSrc, 4)
+    TEST_FIELD_ALIGN (EMRBITBLT, cbBmiSrc, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, cbBmiSrc, 88)
+    TEST_FIELD_SIZE  (EMRBITBLT, offBitsSrc, 4)
+    TEST_FIELD_ALIGN (EMRBITBLT, offBitsSrc, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, offBitsSrc, 92)
+    TEST_FIELD_SIZE  (EMRBITBLT, cbBitsSrc, 4)
+    TEST_FIELD_ALIGN (EMRBITBLT, cbBitsSrc, 4)
+    TEST_FIELD_OFFSET(EMRBITBLT, cbBitsSrc, 96)
+}
+
+static void test_pack_EMRCHORD(void)
+{
+    /* EMRCHORD */
+    TEST_TYPE_SIZE   (EMRCHORD, 40)
+    TEST_TYPE_ALIGN  (EMRCHORD, 4)
+    TEST_FIELD_SIZE  (EMRCHORD, emr, 8)
+    TEST_FIELD_ALIGN (EMRCHORD, emr, 4)
+    TEST_FIELD_OFFSET(EMRCHORD, emr, 0)
+    TEST_FIELD_SIZE  (EMRCHORD, rclBox, 16)
+    TEST_FIELD_ALIGN (EMRCHORD, rclBox, 4)
+    TEST_FIELD_OFFSET(EMRCHORD, rclBox, 8)
+    TEST_FIELD_SIZE  (EMRCHORD, ptlStart, 8)
+    TEST_FIELD_ALIGN (EMRCHORD, ptlStart, 4)
+    TEST_FIELD_OFFSET(EMRCHORD, ptlStart, 24)
+    TEST_FIELD_SIZE  (EMRCHORD, ptlEnd, 8)
+    TEST_FIELD_ALIGN (EMRCHORD, ptlEnd, 4)
+    TEST_FIELD_OFFSET(EMRCHORD, ptlEnd, 32)
+}
+
+static void test_pack_EMRCLOSEFIGURE(void)
+{
+    /* EMRCLOSEFIGURE */
+    TEST_TYPE_SIZE   (EMRCLOSEFIGURE, 8)
+    TEST_TYPE_ALIGN  (EMRCLOSEFIGURE, 4)
+    TEST_FIELD_SIZE  (EMRCLOSEFIGURE, emr, 8)
+    TEST_FIELD_ALIGN (EMRCLOSEFIGURE, emr, 4)
+    TEST_FIELD_OFFSET(EMRCLOSEFIGURE, emr, 0)
+}
+
+static void test_pack_EMRCREATEBRUSHINDIRECT(void)
+{
+    /* EMRCREATEBRUSHINDIRECT */
+    TEST_TYPE_SIZE   (EMRCREATEBRUSHINDIRECT, 24)
+    TEST_TYPE_ALIGN  (EMRCREATEBRUSHINDIRECT, 4)
+    TEST_FIELD_SIZE  (EMRCREATEBRUSHINDIRECT, emr, 8)
+    TEST_FIELD_ALIGN (EMRCREATEBRUSHINDIRECT, emr, 4)
+    TEST_FIELD_OFFSET(EMRCREATEBRUSHINDIRECT, emr, 0)
+    TEST_FIELD_SIZE  (EMRCREATEBRUSHINDIRECT, ihBrush, 4)
+    TEST_FIELD_ALIGN (EMRCREATEBRUSHINDIRECT, ihBrush, 4)
+    TEST_FIELD_OFFSET(EMRCREATEBRUSHINDIRECT, ihBrush, 8)
+    TEST_FIELD_SIZE  (EMRCREATEBRUSHINDIRECT, lb, 12)
+    TEST_FIELD_ALIGN (EMRCREATEBRUSHINDIRECT, lb, 4)
+    TEST_FIELD_OFFSET(EMRCREATEBRUSHINDIRECT, lb, 12)
+}
+
+static void test_pack_EMRCREATECOLORSPACE(void)
+{
+    /* EMRCREATECOLORSPACE */
+    TEST_TYPE_SIZE   (EMRCREATECOLORSPACE, 340)
+    TEST_TYPE_ALIGN  (EMRCREATECOLORSPACE, 4)
+    TEST_FIELD_SIZE  (EMRCREATECOLORSPACE, emr, 8)
+    TEST_FIELD_ALIGN (EMRCREATECOLORSPACE, emr, 4)
+    TEST_FIELD_OFFSET(EMRCREATECOLORSPACE, emr, 0)
+    TEST_FIELD_SIZE  (EMRCREATECOLORSPACE, ihCS, 4)
+    TEST_FIELD_ALIGN (EMRCREATECOLORSPACE, ihCS, 4)
+    TEST_FIELD_OFFSET(EMRCREATECOLORSPACE, ihCS, 8)
+    TEST_FIELD_SIZE  (EMRCREATECOLORSPACE, lcs, 328)
+    TEST_FIELD_ALIGN (EMRCREATECOLORSPACE, lcs, 4)
+    TEST_FIELD_OFFSET(EMRCREATECOLORSPACE, lcs, 12)
+}
+
+static void test_pack_EMRCREATECOLORSPACEW(void)
+{
+    /* EMRCREATECOLORSPACEW */
+    TEST_TYPE_SIZE   (EMRCREATECOLORSPACEW, 612)
+    TEST_TYPE_ALIGN  (EMRCREATECOLORSPACEW, 4)
+    TEST_FIELD_SIZE  (EMRCREATECOLORSPACEW, emr, 8)
+    TEST_FIELD_ALIGN (EMRCREATECOLORSPACEW, emr, 4)
+    TEST_FIELD_OFFSET(EMRCREATECOLORSPACEW, emr, 0)
+    TEST_FIELD_SIZE  (EMRCREATECOLORSPACEW, ihCS, 4)
+    TEST_FIELD_ALIGN (EMRCREATECOLORSPACEW, ihCS, 4)
+    TEST_FIELD_OFFSET(EMRCREATECOLORSPACEW, ihCS, 8)
+    TEST_FIELD_SIZE  (EMRCREATECOLORSPACEW, lcs, 588)
+    TEST_FIELD_ALIGN (EMRCREATECOLORSPACEW, lcs, 4)
+    TEST_FIELD_OFFSET(EMRCREATECOLORSPACEW, lcs, 12)
+    TEST_FIELD_SIZE  (EMRCREATECOLORSPACEW, dwFlags, 4)
+    TEST_FIELD_ALIGN (EMRCREATECOLORSPACEW, dwFlags, 4)
+    TEST_FIELD_OFFSET(EMRCREATECOLORSPACEW, dwFlags, 600)
+    TEST_FIELD_SIZE  (EMRCREATECOLORSPACEW, cbData, 4)
+    TEST_FIELD_ALIGN (EMRCREATECOLORSPACEW, cbData, 4)
+    TEST_FIELD_OFFSET(EMRCREATECOLORSPACEW, cbData, 604)
+    TEST_FIELD_SIZE  (EMRCREATECOLORSPACEW, Data, 1)
+    TEST_FIELD_ALIGN (EMRCREATECOLORSPACEW, Data, 1)
+    TEST_FIELD_OFFSET(EMRCREATECOLORSPACEW, Data, 608)
+}
+
+static void test_pack_EMRCREATEDIBPATTERNBRUSHPT(void)
+{
+    /* EMRCREATEDIBPATTERNBRUSHPT */
+    TEST_TYPE_SIZE   (EMRCREATEDIBPATTERNBRUSHPT, 32)
+    TEST_TYPE_ALIGN  (EMRCREATEDIBPATTERNBRUSHPT, 4)
+    TEST_FIELD_SIZE  (EMRCREATEDIBPATTERNBRUSHPT, emr, 8)
+    TEST_FIELD_ALIGN (EMRCREATEDIBPATTERNBRUSHPT, emr, 4)
+    TEST_FIELD_OFFSET(EMRCREATEDIBPATTERNBRUSHPT, emr, 0)
+    TEST_FIELD_SIZE  (EMRCREATEDIBPATTERNBRUSHPT, ihBrush, 4)
+    TEST_FIELD_ALIGN (EMRCREATEDIBPATTERNBRUSHPT, ihBrush, 4)
+    TEST_FIELD_OFFSET(EMRCREATEDIBPATTERNBRUSHPT, ihBrush, 8)
+    TEST_FIELD_SIZE  (EMRCREATEDIBPATTERNBRUSHPT, iUsage, 4)
+    TEST_FIELD_ALIGN (EMRCREATEDIBPATTERNBRUSHPT, iUsage, 4)
+    TEST_FIELD_OFFSET(EMRCREATEDIBPATTERNBRUSHPT, iUsage, 12)
+    TEST_FIELD_SIZE  (EMRCREATEDIBPATTERNBRUSHPT, offBmi, 4)
+    TEST_FIELD_ALIGN (EMRCREATEDIBPATTERNBRUSHPT, offBmi, 4)
+    TEST_FIELD_OFFSET(EMRCREATEDIBPATTERNBRUSHPT, offBmi, 16)
+    TEST_FIELD_SIZE  (EMRCREATEDIBPATTERNBRUSHPT, cbBmi, 4)
+    TEST_FIELD_ALIGN (EMRCREATEDIBPATTERNBRUSHPT, cbBmi, 4)
+    TEST_FIELD_OFFSET(EMRCREATEDIBPATTERNBRUSHPT, cbBmi, 20)
+    TEST_FIELD_SIZE  (EMRCREATEDIBPATTERNBRUSHPT, offBits, 4)
+    TEST_FIELD_ALIGN (EMRCREATEDIBPATTERNBRUSHPT, offBits, 4)
+    TEST_FIELD_OFFSET(EMRCREATEDIBPATTERNBRUSHPT, offBits, 24)
+    TEST_FIELD_SIZE  (EMRCREATEDIBPATTERNBRUSHPT, cbBits, 4)
+    TEST_FIELD_ALIGN (EMRCREATEDIBPATTERNBRUSHPT, cbBits, 4)
+    TEST_FIELD_OFFSET(EMRCREATEDIBPATTERNBRUSHPT, cbBits, 28)
+}
+
+static void test_pack_EMRCREATEMONOBRUSH(void)
+{
+    /* EMRCREATEMONOBRUSH */
+    TEST_TYPE_SIZE   (EMRCREATEMONOBRUSH, 32)
+    TEST_TYPE_ALIGN  (EMRCREATEMONOBRUSH, 4)
+    TEST_FIELD_SIZE  (EMRCREATEMONOBRUSH, emr, 8)
+    TEST_FIELD_ALIGN (EMRCREATEMONOBRUSH, emr, 4)
+    TEST_FIELD_OFFSET(EMRCREATEMONOBRUSH, emr, 0)
+    TEST_FIELD_SIZE  (EMRCREATEMONOBRUSH, ihBrush, 4)
+    TEST_FIELD_ALIGN (EMRCREATEMONOBRUSH, ihBrush, 4)
+    TEST_FIELD_OFFSET(EMRCREATEMONOBRUSH, ihBrush, 8)
+    TEST_FIELD_SIZE  (EMRCREATEMONOBRUSH, iUsage, 4)
+    TEST_FIELD_ALIGN (EMRCREATEMONOBRUSH, iUsage, 4)
+    TEST_FIELD_OFFSET(EMRCREATEMONOBRUSH, iUsage, 12)
+    TEST_FIELD_SIZE  (EMRCREATEMONOBRUSH, offBmi, 4)
+    TEST_FIELD_ALIGN (EMRCREATEMONOBRUSH, offBmi, 4)
+    TEST_FIELD_OFFSET(EMRCREATEMONOBRUSH, offBmi, 16)
+    TEST_FIELD_SIZE  (EMRCREATEMONOBRUSH, cbBmi, 4)
+    TEST_FIELD_ALIGN (EMRCREATEMONOBRUSH, cbBmi, 4)
+    TEST_FIELD_OFFSET(EMRCREATEMONOBRUSH, cbBmi, 20)
+    TEST_FIELD_SIZE  (EMRCREATEMONOBRUSH, offBits, 4)
+    TEST_FIELD_ALIGN (EMRCREATEMONOBRUSH, offBits, 4)
+    TEST_FIELD_OFFSET(EMRCREATEMONOBRUSH, offBits, 24)
+    TEST_FIELD_SIZE  (EMRCREATEMONOBRUSH, cbBits, 4)
+    TEST_FIELD_ALIGN (EMRCREATEMONOBRUSH, cbBits, 4)
+    TEST_FIELD_OFFSET(EMRCREATEMONOBRUSH, cbBits, 28)
+}
+
+static void test_pack_EMRCREATEPEN(void)
+{
+    /* EMRCREATEPEN */
+    TEST_TYPE_SIZE   (EMRCREATEPEN, 28)
+    TEST_TYPE_ALIGN  (EMRCREATEPEN, 4)
+    TEST_FIELD_SIZE  (EMRCREATEPEN, emr, 8)
+    TEST_FIELD_ALIGN (EMRCREATEPEN, emr, 4)
+    TEST_FIELD_OFFSET(EMRCREATEPEN, emr, 0)
+    TEST_FIELD_SIZE  (EMRCREATEPEN, ihPen, 4)
+    TEST_FIELD_ALIGN (EMRCREATEPEN, ihPen, 4)
+    TEST_FIELD_OFFSET(EMRCREATEPEN, ihPen, 8)
+    TEST_FIELD_SIZE  (EMRCREATEPEN, lopn, 16)
+    TEST_FIELD_ALIGN (EMRCREATEPEN, lopn, 4)
+    TEST_FIELD_OFFSET(EMRCREATEPEN, lopn, 12)
+}
+
+static void test_pack_EMRDELETECOLORSPACE(void)
+{
+    /* EMRDELETECOLORSPACE */
+    TEST_TYPE_SIZE   (EMRDELETECOLORSPACE, 12)
+    TEST_TYPE_ALIGN  (EMRDELETECOLORSPACE, 4)
+    TEST_FIELD_SIZE  (EMRDELETECOLORSPACE, emr, 8)
+    TEST_FIELD_ALIGN (EMRDELETECOLORSPACE, emr, 4)
+    TEST_FIELD_OFFSET(EMRDELETECOLORSPACE, emr, 0)
+    TEST_FIELD_SIZE  (EMRDELETECOLORSPACE, ihCS, 4)
+    TEST_FIELD_ALIGN (EMRDELETECOLORSPACE, ihCS, 4)
+    TEST_FIELD_OFFSET(EMRDELETECOLORSPACE, ihCS, 8)
+}
+
+static void test_pack_EMRDELETEOBJECT(void)
+{
+    /* EMRDELETEOBJECT */
+    TEST_TYPE_SIZE   (EMRDELETEOBJECT, 12)
+    TEST_TYPE_ALIGN  (EMRDELETEOBJECT, 4)
+    TEST_FIELD_SIZE  (EMRDELETEOBJECT, emr, 8)
+    TEST_FIELD_ALIGN (EMRDELETEOBJECT, emr, 4)
+    TEST_FIELD_OFFSET(EMRDELETEOBJECT, emr, 0)
+    TEST_FIELD_SIZE  (EMRDELETEOBJECT, ihObject, 4)
+    TEST_FIELD_ALIGN (EMRDELETEOBJECT, ihObject, 4)
+    TEST_FIELD_OFFSET(EMRDELETEOBJECT, ihObject, 8)
+}
+
+static void test_pack_EMRELLIPSE(void)
+{
+    /* EMRELLIPSE */
+    TEST_TYPE_SIZE   (EMRELLIPSE, 24)
+    TEST_TYPE_ALIGN  (EMRELLIPSE, 4)
+    TEST_FIELD_SIZE  (EMRELLIPSE, emr, 8)
+    TEST_FIELD_ALIGN (EMRELLIPSE, emr, 4)
+    TEST_FIELD_OFFSET(EMRELLIPSE, emr, 0)
+    TEST_FIELD_SIZE  (EMRELLIPSE, rclBox, 16)
+    TEST_FIELD_ALIGN (EMRELLIPSE, rclBox, 4)
+    TEST_FIELD_OFFSET(EMRELLIPSE, rclBox, 8)
+}
+
+static void test_pack_EMRENDPATH(void)
+{
+    /* EMRENDPATH */
+    TEST_TYPE_SIZE   (EMRENDPATH, 8)
+    TEST_TYPE_ALIGN  (EMRENDPATH, 4)
+    TEST_FIELD_SIZE  (EMRENDPATH, emr, 8)
+    TEST_FIELD_ALIGN (EMRENDPATH, emr, 4)
+    TEST_FIELD_OFFSET(EMRENDPATH, emr, 0)
+}
+
+static void test_pack_EMREOF(void)
+{
+    /* EMREOF */
+    TEST_TYPE_SIZE   (EMREOF, 20)
+    TEST_TYPE_ALIGN  (EMREOF, 4)
+    TEST_FIELD_SIZE  (EMREOF, emr, 8)
+    TEST_FIELD_ALIGN (EMREOF, emr, 4)
+    TEST_FIELD_OFFSET(EMREOF, emr, 0)
+    TEST_FIELD_SIZE  (EMREOF, nPalEntries, 4)
+    TEST_FIELD_ALIGN (EMREOF, nPalEntries, 4)
+    TEST_FIELD_OFFSET(EMREOF, nPalEntries, 8)
+    TEST_FIELD_SIZE  (EMREOF, offPalEntries, 4)
+    TEST_FIELD_ALIGN (EMREOF, offPalEntries, 4)
+    TEST_FIELD_OFFSET(EMREOF, offPalEntries, 12)
+    TEST_FIELD_SIZE  (EMREOF, nSizeLast, 4)
+    TEST_FIELD_ALIGN (EMREOF, nSizeLast, 4)
+    TEST_FIELD_OFFSET(EMREOF, nSizeLast, 16)
+}
+
+static void test_pack_EMREXCLUDECLIPRECT(void)
+{
+    /* EMREXCLUDECLIPRECT */
+    TEST_TYPE_SIZE   (EMREXCLUDECLIPRECT, 24)
+    TEST_TYPE_ALIGN  (EMREXCLUDECLIPRECT, 4)
+    TEST_FIELD_SIZE  (EMREXCLUDECLIPRECT, emr, 8)
+    TEST_FIELD_ALIGN (EMREXCLUDECLIPRECT, emr, 4)
+    TEST_FIELD_OFFSET(EMREXCLUDECLIPRECT, emr, 0)
+    TEST_FIELD_SIZE  (EMREXCLUDECLIPRECT, rclClip, 16)
+    TEST_FIELD_ALIGN (EMREXCLUDECLIPRECT, rclClip, 4)
+    TEST_FIELD_OFFSET(EMREXCLUDECLIPRECT, rclClip, 8)
+}
+
+static void test_pack_EMREXTCREATEFONTINDIRECTW(void)
+{
+    /* EMREXTCREATEFONTINDIRECTW */
+    TEST_TYPE_SIZE   (EMREXTCREATEFONTINDIRECTW, 332)
+    TEST_TYPE_ALIGN  (EMREXTCREATEFONTINDIRECTW, 4)
+    TEST_FIELD_SIZE  (EMREXTCREATEFONTINDIRECTW, emr, 8)
+    TEST_FIELD_ALIGN (EMREXTCREATEFONTINDIRECTW, emr, 4)
+    TEST_FIELD_OFFSET(EMREXTCREATEFONTINDIRECTW, emr, 0)
+    TEST_FIELD_SIZE  (EMREXTCREATEFONTINDIRECTW, ihFont, 4)
+    TEST_FIELD_ALIGN (EMREXTCREATEFONTINDIRECTW, ihFont, 4)
+    TEST_FIELD_OFFSET(EMREXTCREATEFONTINDIRECTW, ihFont, 8)
+    TEST_FIELD_SIZE  (EMREXTCREATEFONTINDIRECTW, elfw, 320)
+    TEST_FIELD_ALIGN (EMREXTCREATEFONTINDIRECTW, elfw, 4)
+    TEST_FIELD_OFFSET(EMREXTCREATEFONTINDIRECTW, elfw, 12)
+}
+
+static void test_pack_EMREXTCREATEPEN(void)
+{
+    /* EMREXTCREATEPEN */
+    TEST_TYPE_SIZE   (EMREXTCREATEPEN, 64)
+    TEST_TYPE_ALIGN  (EMREXTCREATEPEN, 8)
+    TEST_FIELD_SIZE  (EMREXTCREATEPEN, emr, 8)
+    TEST_FIELD_ALIGN (EMREXTCREATEPEN, emr, 4)
+    TEST_FIELD_OFFSET(EMREXTCREATEPEN, emr, 0)
+    TEST_FIELD_SIZE  (EMREXTCREATEPEN, ihPen, 4)
+    TEST_FIELD_ALIGN (EMREXTCREATEPEN, ihPen, 4)
+    TEST_FIELD_OFFSET(EMREXTCREATEPEN, ihPen, 8)
+    TEST_FIELD_SIZE  (EMREXTCREATEPEN, offBmi, 4)
+    TEST_FIELD_ALIGN (EMREXTCREATEPEN, offBmi, 4)
+    TEST_FIELD_OFFSET(EMREXTCREATEPEN, offBmi, 12)
+    TEST_FIELD_SIZE  (EMREXTCREATEPEN, cbBmi, 4)
+    TEST_FIELD_ALIGN (EMREXTCREATEPEN, cbBmi, 4)
+    TEST_FIELD_OFFSET(EMREXTCREATEPEN, cbBmi, 16)
+    TEST_FIELD_SIZE  (EMREXTCREATEPEN, offBits, 4)
+    TEST_FIELD_ALIGN (EMREXTCREATEPEN, offBits, 4)
+    TEST_FIELD_OFFSET(EMREXTCREATEPEN, offBits, 20)
+    TEST_FIELD_SIZE  (EMREXTCREATEPEN, cbBits, 4)
+    TEST_FIELD_ALIGN (EMREXTCREATEPEN, cbBits, 4)
+    TEST_FIELD_OFFSET(EMREXTCREATEPEN, cbBits, 24)
+    TEST_FIELD_SIZE  (EMREXTCREATEPEN, elp, 32)
+    TEST_FIELD_ALIGN (EMREXTCREATEPEN, elp, 8)
+    TEST_FIELD_OFFSET(EMREXTCREATEPEN, elp, 32)
+}
+
+static void test_pack_EMREXTFLOODFILL(void)
+{
+    /* EMREXTFLOODFILL */
+    TEST_TYPE_SIZE   (EMREXTFLOODFILL, 24)
+    TEST_TYPE_ALIGN  (EMREXTFLOODFILL, 4)
+    TEST_FIELD_SIZE  (EMREXTFLOODFILL, emr, 8)
+    TEST_FIELD_ALIGN (EMREXTFLOODFILL, emr, 4)
+    TEST_FIELD_OFFSET(EMREXTFLOODFILL, emr, 0)
+    TEST_FIELD_SIZE  (EMREXTFLOODFILL, ptlStart, 8)
+    TEST_FIELD_ALIGN (EMREXTFLOODFILL, ptlStart, 4)
+    TEST_FIELD_OFFSET(EMREXTFLOODFILL, ptlStart, 8)
+    TEST_FIELD_SIZE  (EMREXTFLOODFILL, crColor, 4)
+    TEST_FIELD_ALIGN (EMREXTFLOODFILL, crColor, 4)
+    TEST_FIELD_OFFSET(EMREXTFLOODFILL, crColor, 16)
+    TEST_FIELD_SIZE  (EMREXTFLOODFILL, iMode, 4)
+    TEST_FIELD_ALIGN (EMREXTFLOODFILL, iMode, 4)
+    TEST_FIELD_OFFSET(EMREXTFLOODFILL, iMode, 20)
+}
+
+static void test_pack_EMREXTSELECTCLIPRGN(void)
+{
+    /* EMREXTSELECTCLIPRGN */
+    TEST_TYPE_SIZE   (EMREXTSELECTCLIPRGN, 20)
+    TEST_TYPE_ALIGN  (EMREXTSELECTCLIPRGN, 4)
+    TEST_FIELD_SIZE  (EMREXTSELECTCLIPRGN, emr, 8)
+    TEST_FIELD_ALIGN (EMREXTSELECTCLIPRGN, emr, 4)
+    TEST_FIELD_OFFSET(EMREXTSELECTCLIPRGN, emr, 0)
+    TEST_FIELD_SIZE  (EMREXTSELECTCLIPRGN, cbRgnData, 4)
+    TEST_FIELD_ALIGN (EMREXTSELECTCLIPRGN, cbRgnData, 4)
+    TEST_FIELD_OFFSET(EMREXTSELECTCLIPRGN, cbRgnData, 8)
+    TEST_FIELD_SIZE  (EMREXTSELECTCLIPRGN, iMode, 4)
+    TEST_FIELD_ALIGN (EMREXTSELECTCLIPRGN, iMode, 4)
+    TEST_FIELD_OFFSET(EMREXTSELECTCLIPRGN, iMode, 12)
+    TEST_FIELD_SIZE  (EMREXTSELECTCLIPRGN, RgnData, 1)
+    TEST_FIELD_ALIGN (EMREXTSELECTCLIPRGN, RgnData, 1)
+    TEST_FIELD_OFFSET(EMREXTSELECTCLIPRGN, RgnData, 16)
+}
+
+static void test_pack_EMREXTTEXTOUTA(void)
+{
+    /* EMREXTTEXTOUTA */
+    TEST_TYPE_SIZE   (EMREXTTEXTOUTA, 76)
+    TEST_TYPE_ALIGN  (EMREXTTEXTOUTA, 4)
+    TEST_FIELD_SIZE  (EMREXTTEXTOUTA, emr, 8)
+    TEST_FIELD_ALIGN (EMREXTTEXTOUTA, emr, 4)
+    TEST_FIELD_OFFSET(EMREXTTEXTOUTA, emr, 0)
+    TEST_FIELD_SIZE  (EMREXTTEXTOUTA, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMREXTTEXTOUTA, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMREXTTEXTOUTA, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMREXTTEXTOUTA, iGraphicsMode, 4)
+    TEST_FIELD_ALIGN (EMREXTTEXTOUTA, iGraphicsMode, 4)
+    TEST_FIELD_OFFSET(EMREXTTEXTOUTA, iGraphicsMode, 24)
+    TEST_FIELD_SIZE  (EMREXTTEXTOUTA, exScale, 4)
+    TEST_FIELD_ALIGN (EMREXTTEXTOUTA, exScale, 4)
+    TEST_FIELD_OFFSET(EMREXTTEXTOUTA, exScale, 28)
+    TEST_FIELD_SIZE  (EMREXTTEXTOUTA, eyScale, 4)
+    TEST_FIELD_ALIGN (EMREXTTEXTOUTA, eyScale, 4)
+    TEST_FIELD_OFFSET(EMREXTTEXTOUTA, eyScale, 32)
+    TEST_FIELD_SIZE  (EMREXTTEXTOUTA, emrtext, 40)
+    TEST_FIELD_ALIGN (EMREXTTEXTOUTA, emrtext, 4)
+    TEST_FIELD_OFFSET(EMREXTTEXTOUTA, emrtext, 36)
+}
+
+static void test_pack_EMREXTTEXTOUTW(void)
+{
+    /* EMREXTTEXTOUTW */
+    TEST_TYPE_SIZE   (EMREXTTEXTOUTW, 76)
+    TEST_TYPE_ALIGN  (EMREXTTEXTOUTW, 4)
+    TEST_FIELD_SIZE  (EMREXTTEXTOUTW, emr, 8)
+    TEST_FIELD_ALIGN (EMREXTTEXTOUTW, emr, 4)
+    TEST_FIELD_OFFSET(EMREXTTEXTOUTW, emr, 0)
+    TEST_FIELD_SIZE  (EMREXTTEXTOUTW, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMREXTTEXTOUTW, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMREXTTEXTOUTW, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMREXTTEXTOUTW, iGraphicsMode, 4)
+    TEST_FIELD_ALIGN (EMREXTTEXTOUTW, iGraphicsMode, 4)
+    TEST_FIELD_OFFSET(EMREXTTEXTOUTW, iGraphicsMode, 24)
+    TEST_FIELD_SIZE  (EMREXTTEXTOUTW, exScale, 4)
+    TEST_FIELD_ALIGN (EMREXTTEXTOUTW, exScale, 4)
+    TEST_FIELD_OFFSET(EMREXTTEXTOUTW, exScale, 28)
+    TEST_FIELD_SIZE  (EMREXTTEXTOUTW, eyScale, 4)
+    TEST_FIELD_ALIGN (EMREXTTEXTOUTW, eyScale, 4)
+    TEST_FIELD_OFFSET(EMREXTTEXTOUTW, eyScale, 32)
+    TEST_FIELD_SIZE  (EMREXTTEXTOUTW, emrtext, 40)
+    TEST_FIELD_ALIGN (EMREXTTEXTOUTW, emrtext, 4)
+    TEST_FIELD_OFFSET(EMREXTTEXTOUTW, emrtext, 36)
+}
+
+static void test_pack_EMRFILLPATH(void)
+{
+    /* EMRFILLPATH */
+    TEST_TYPE_SIZE   (EMRFILLPATH, 24)
+    TEST_TYPE_ALIGN  (EMRFILLPATH, 4)
+    TEST_FIELD_SIZE  (EMRFILLPATH, emr, 8)
+    TEST_FIELD_ALIGN (EMRFILLPATH, emr, 4)
+    TEST_FIELD_OFFSET(EMRFILLPATH, emr, 0)
+    TEST_FIELD_SIZE  (EMRFILLPATH, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRFILLPATH, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRFILLPATH, rclBounds, 8)
+}
+
+static void test_pack_EMRFILLRGN(void)
+{
+    /* EMRFILLRGN */
+    TEST_TYPE_SIZE   (EMRFILLRGN, 36)
+    TEST_TYPE_ALIGN  (EMRFILLRGN, 4)
+    TEST_FIELD_SIZE  (EMRFILLRGN, emr, 8)
+    TEST_FIELD_ALIGN (EMRFILLRGN, emr, 4)
+    TEST_FIELD_OFFSET(EMRFILLRGN, emr, 0)
+    TEST_FIELD_SIZE  (EMRFILLRGN, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRFILLRGN, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRFILLRGN, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRFILLRGN, cbRgnData, 4)
+    TEST_FIELD_ALIGN (EMRFILLRGN, cbRgnData, 4)
+    TEST_FIELD_OFFSET(EMRFILLRGN, cbRgnData, 24)
+    TEST_FIELD_SIZE  (EMRFILLRGN, ihBrush, 4)
+    TEST_FIELD_ALIGN (EMRFILLRGN, ihBrush, 4)
+    TEST_FIELD_OFFSET(EMRFILLRGN, ihBrush, 28)
+    TEST_FIELD_SIZE  (EMRFILLRGN, RgnData, 1)
+    TEST_FIELD_ALIGN (EMRFILLRGN, RgnData, 1)
+    TEST_FIELD_OFFSET(EMRFILLRGN, RgnData, 32)
+}
+
+static void test_pack_EMRFLATTENPATH(void)
+{
+    /* EMRFLATTENPATH */
+    TEST_TYPE_SIZE   (EMRFLATTENPATH, 8)
+    TEST_TYPE_ALIGN  (EMRFLATTENPATH, 4)
+    TEST_FIELD_SIZE  (EMRFLATTENPATH, emr, 8)
+    TEST_FIELD_ALIGN (EMRFLATTENPATH, emr, 4)
+    TEST_FIELD_OFFSET(EMRFLATTENPATH, emr, 0)
+}
+
+static void test_pack_EMRFORMAT(void)
+{
+    /* EMRFORMAT */
+    TEST_TYPE_SIZE   (EMRFORMAT, 16)
+    TEST_TYPE_ALIGN  (EMRFORMAT, 4)
+    TEST_FIELD_SIZE  (EMRFORMAT, dSignature, 4)
+    TEST_FIELD_ALIGN (EMRFORMAT, dSignature, 4)
+    TEST_FIELD_OFFSET(EMRFORMAT, dSignature, 0)
+    TEST_FIELD_SIZE  (EMRFORMAT, nVersion, 4)
+    TEST_FIELD_ALIGN (EMRFORMAT, nVersion, 4)
+    TEST_FIELD_OFFSET(EMRFORMAT, nVersion, 4)
+    TEST_FIELD_SIZE  (EMRFORMAT, cbData, 4)
+    TEST_FIELD_ALIGN (EMRFORMAT, cbData, 4)
+    TEST_FIELD_OFFSET(EMRFORMAT, cbData, 8)
+    TEST_FIELD_SIZE  (EMRFORMAT, offData, 4)
+    TEST_FIELD_ALIGN (EMRFORMAT, offData, 4)
+    TEST_FIELD_OFFSET(EMRFORMAT, offData, 12)
+}
+
+static void test_pack_EMRFRAMERGN(void)
+{
+    /* EMRFRAMERGN */
+    TEST_TYPE_SIZE   (EMRFRAMERGN, 44)
+    TEST_TYPE_ALIGN  (EMRFRAMERGN, 4)
+    TEST_FIELD_SIZE  (EMRFRAMERGN, emr, 8)
+    TEST_FIELD_ALIGN (EMRFRAMERGN, emr, 4)
+    TEST_FIELD_OFFSET(EMRFRAMERGN, emr, 0)
+    TEST_FIELD_SIZE  (EMRFRAMERGN, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRFRAMERGN, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRFRAMERGN, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRFRAMERGN, cbRgnData, 4)
+    TEST_FIELD_ALIGN (EMRFRAMERGN, cbRgnData, 4)
+    TEST_FIELD_OFFSET(EMRFRAMERGN, cbRgnData, 24)
+    TEST_FIELD_SIZE  (EMRFRAMERGN, ihBrush, 4)
+    TEST_FIELD_ALIGN (EMRFRAMERGN, ihBrush, 4)
+    TEST_FIELD_OFFSET(EMRFRAMERGN, ihBrush, 28)
+    TEST_FIELD_SIZE  (EMRFRAMERGN, szlStroke, 8)
+    TEST_FIELD_ALIGN (EMRFRAMERGN, szlStroke, 4)
+    TEST_FIELD_OFFSET(EMRFRAMERGN, szlStroke, 32)
+    TEST_FIELD_SIZE  (EMRFRAMERGN, RgnData, 1)
+    TEST_FIELD_ALIGN (EMRFRAMERGN, RgnData, 1)
+    TEST_FIELD_OFFSET(EMRFRAMERGN, RgnData, 40)
+}
+
+static void test_pack_EMRGDICOMMENT(void)
+{
+    /* EMRGDICOMMENT */
+    TEST_TYPE_SIZE   (EMRGDICOMMENT, 16)
+    TEST_TYPE_ALIGN  (EMRGDICOMMENT, 4)
+    TEST_FIELD_SIZE  (EMRGDICOMMENT, emr, 8)
+    TEST_FIELD_ALIGN (EMRGDICOMMENT, emr, 4)
+    TEST_FIELD_OFFSET(EMRGDICOMMENT, emr, 0)
+    TEST_FIELD_SIZE  (EMRGDICOMMENT, cbData, 4)
+    TEST_FIELD_ALIGN (EMRGDICOMMENT, cbData, 4)
+    TEST_FIELD_OFFSET(EMRGDICOMMENT, cbData, 8)
+    TEST_FIELD_SIZE  (EMRGDICOMMENT, Data, 1)
+    TEST_FIELD_ALIGN (EMRGDICOMMENT, Data, 1)
+    TEST_FIELD_OFFSET(EMRGDICOMMENT, Data, 12)
+}
+
+static void test_pack_EMRGLSBOUNDEDRECORD(void)
+{
+    /* EMRGLSBOUNDEDRECORD */
+    TEST_TYPE_SIZE   (EMRGLSBOUNDEDRECORD, 32)
+    TEST_TYPE_ALIGN  (EMRGLSBOUNDEDRECORD, 4)
+    TEST_FIELD_SIZE  (EMRGLSBOUNDEDRECORD, emr, 8)
+    TEST_FIELD_ALIGN (EMRGLSBOUNDEDRECORD, emr, 4)
+    TEST_FIELD_OFFSET(EMRGLSBOUNDEDRECORD, emr, 0)
+    TEST_FIELD_SIZE  (EMRGLSBOUNDEDRECORD, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRGLSBOUNDEDRECORD, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRGLSBOUNDEDRECORD, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRGLSBOUNDEDRECORD, cbData, 4)
+    TEST_FIELD_ALIGN (EMRGLSBOUNDEDRECORD, cbData, 4)
+    TEST_FIELD_OFFSET(EMRGLSBOUNDEDRECORD, cbData, 24)
+    TEST_FIELD_SIZE  (EMRGLSBOUNDEDRECORD, Data, 1)
+    TEST_FIELD_ALIGN (EMRGLSBOUNDEDRECORD, Data, 1)
+    TEST_FIELD_OFFSET(EMRGLSBOUNDEDRECORD, Data, 28)
+}
+
+static void test_pack_EMRGLSRECORD(void)
+{
+    /* EMRGLSRECORD */
+    TEST_TYPE_SIZE   (EMRGLSRECORD, 16)
+    TEST_TYPE_ALIGN  (EMRGLSRECORD, 4)
+    TEST_FIELD_SIZE  (EMRGLSRECORD, emr, 8)
+    TEST_FIELD_ALIGN (EMRGLSRECORD, emr, 4)
+    TEST_FIELD_OFFSET(EMRGLSRECORD, emr, 0)
+    TEST_FIELD_SIZE  (EMRGLSRECORD, cbData, 4)
+    TEST_FIELD_ALIGN (EMRGLSRECORD, cbData, 4)
+    TEST_FIELD_OFFSET(EMRGLSRECORD, cbData, 8)
+    TEST_FIELD_SIZE  (EMRGLSRECORD, Data, 1)
+    TEST_FIELD_ALIGN (EMRGLSRECORD, Data, 1)
+    TEST_FIELD_OFFSET(EMRGLSRECORD, Data, 12)
+}
+
+static void test_pack_EMRINTERSECTCLIPRECT(void)
+{
+    /* EMRINTERSECTCLIPRECT */
+    TEST_TYPE_SIZE   (EMRINTERSECTCLIPRECT, 24)
+    TEST_TYPE_ALIGN  (EMRINTERSECTCLIPRECT, 4)
+    TEST_FIELD_SIZE  (EMRINTERSECTCLIPRECT, emr, 8)
+    TEST_FIELD_ALIGN (EMRINTERSECTCLIPRECT, emr, 4)
+    TEST_FIELD_OFFSET(EMRINTERSECTCLIPRECT, emr, 0)
+    TEST_FIELD_SIZE  (EMRINTERSECTCLIPRECT, rclClip, 16)
+    TEST_FIELD_ALIGN (EMRINTERSECTCLIPRECT, rclClip, 4)
+    TEST_FIELD_OFFSET(EMRINTERSECTCLIPRECT, rclClip, 8)
+}
+
+static void test_pack_EMRINVERTRGN(void)
+{
+    /* EMRINVERTRGN */
+    TEST_TYPE_SIZE   (EMRINVERTRGN, 32)
+    TEST_TYPE_ALIGN  (EMRINVERTRGN, 4)
+    TEST_FIELD_SIZE  (EMRINVERTRGN, emr, 8)
+    TEST_FIELD_ALIGN (EMRINVERTRGN, emr, 4)
+    TEST_FIELD_OFFSET(EMRINVERTRGN, emr, 0)
+    TEST_FIELD_SIZE  (EMRINVERTRGN, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRINVERTRGN, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRINVERTRGN, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRINVERTRGN, cbRgnData, 4)
+    TEST_FIELD_ALIGN (EMRINVERTRGN, cbRgnData, 4)
+    TEST_FIELD_OFFSET(EMRINVERTRGN, cbRgnData, 24)
+    TEST_FIELD_SIZE  (EMRINVERTRGN, RgnData, 1)
+    TEST_FIELD_ALIGN (EMRINVERTRGN, RgnData, 1)
+    TEST_FIELD_OFFSET(EMRINVERTRGN, RgnData, 28)
+}
+
+static void test_pack_EMRLINETO(void)
+{
+    /* EMRLINETO */
+    TEST_TYPE_SIZE   (EMRLINETO, 16)
+    TEST_TYPE_ALIGN  (EMRLINETO, 4)
+    TEST_FIELD_SIZE  (EMRLINETO, emr, 8)
+    TEST_FIELD_ALIGN (EMRLINETO, emr, 4)
+    TEST_FIELD_OFFSET(EMRLINETO, emr, 0)
+    TEST_FIELD_SIZE  (EMRLINETO, ptl, 8)
+    TEST_FIELD_ALIGN (EMRLINETO, ptl, 4)
+    TEST_FIELD_OFFSET(EMRLINETO, ptl, 8)
+}
+
+static void test_pack_EMRMASKBLT(void)
+{
+    /* EMRMASKBLT */
+    TEST_TYPE_SIZE   (EMRMASKBLT, 128)
+    TEST_TYPE_ALIGN  (EMRMASKBLT, 4)
+    TEST_FIELD_SIZE  (EMRMASKBLT, emr, 8)
+    TEST_FIELD_ALIGN (EMRMASKBLT, emr, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, emr, 0)
+    TEST_FIELD_SIZE  (EMRMASKBLT, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRMASKBLT, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRMASKBLT, xDest, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, xDest, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, xDest, 24)
+    TEST_FIELD_SIZE  (EMRMASKBLT, yDest, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, yDest, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, yDest, 28)
+    TEST_FIELD_SIZE  (EMRMASKBLT, cxDest, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, cxDest, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, cxDest, 32)
+    TEST_FIELD_SIZE  (EMRMASKBLT, cyDest, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, cyDest, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, cyDest, 36)
+    TEST_FIELD_SIZE  (EMRMASKBLT, dwRop, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, dwRop, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, dwRop, 40)
+    TEST_FIELD_SIZE  (EMRMASKBLT, xSrc, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, xSrc, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, xSrc, 44)
+    TEST_FIELD_SIZE  (EMRMASKBLT, ySrc, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, ySrc, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, ySrc, 48)
+    TEST_FIELD_SIZE  (EMRMASKBLT, xformSrc, 24)
+    TEST_FIELD_ALIGN (EMRMASKBLT, xformSrc, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, xformSrc, 52)
+    TEST_FIELD_SIZE  (EMRMASKBLT, crBkColorSrc, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, crBkColorSrc, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, crBkColorSrc, 76)
+    TEST_FIELD_SIZE  (EMRMASKBLT, iUsageSrc, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, iUsageSrc, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, iUsageSrc, 80)
+    TEST_FIELD_SIZE  (EMRMASKBLT, offBmiSrc, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, offBmiSrc, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, offBmiSrc, 84)
+    TEST_FIELD_SIZE  (EMRMASKBLT, cbBmiSrc, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, cbBmiSrc, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, cbBmiSrc, 88)
+    TEST_FIELD_SIZE  (EMRMASKBLT, offBitsSrc, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, offBitsSrc, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, offBitsSrc, 92)
+    TEST_FIELD_SIZE  (EMRMASKBLT, cbBitsSrc, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, cbBitsSrc, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, cbBitsSrc, 96)
+    TEST_FIELD_SIZE  (EMRMASKBLT, xMask, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, xMask, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, xMask, 100)
+    TEST_FIELD_SIZE  (EMRMASKBLT, yMask, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, yMask, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, yMask, 104)
+    TEST_FIELD_SIZE  (EMRMASKBLT, iUsageMask, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, iUsageMask, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, iUsageMask, 108)
+    TEST_FIELD_SIZE  (EMRMASKBLT, offBmiMask, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, offBmiMask, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, offBmiMask, 112)
+    TEST_FIELD_SIZE  (EMRMASKBLT, cbBmiMask, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, cbBmiMask, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, cbBmiMask, 116)
+    TEST_FIELD_SIZE  (EMRMASKBLT, offBitsMask, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, offBitsMask, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, offBitsMask, 120)
+    TEST_FIELD_SIZE  (EMRMASKBLT, cbBitsMask, 4)
+    TEST_FIELD_ALIGN (EMRMASKBLT, cbBitsMask, 4)
+    TEST_FIELD_OFFSET(EMRMASKBLT, cbBitsMask, 124)
+}
+
+static void test_pack_EMRMODIFYWORLDTRANSFORM(void)
+{
+    /* EMRMODIFYWORLDTRANSFORM */
+    TEST_TYPE_SIZE   (EMRMODIFYWORLDTRANSFORM, 36)
+    TEST_TYPE_ALIGN  (EMRMODIFYWORLDTRANSFORM, 4)
+    TEST_FIELD_SIZE  (EMRMODIFYWORLDTRANSFORM, emr, 8)
+    TEST_FIELD_ALIGN (EMRMODIFYWORLDTRANSFORM, emr, 4)
+    TEST_FIELD_OFFSET(EMRMODIFYWORLDTRANSFORM, emr, 0)
+    TEST_FIELD_SIZE  (EMRMODIFYWORLDTRANSFORM, xform, 24)
+    TEST_FIELD_ALIGN (EMRMODIFYWORLDTRANSFORM, xform, 4)
+    TEST_FIELD_OFFSET(EMRMODIFYWORLDTRANSFORM, xform, 8)
+    TEST_FIELD_SIZE  (EMRMODIFYWORLDTRANSFORM, iMode, 4)
+    TEST_FIELD_ALIGN (EMRMODIFYWORLDTRANSFORM, iMode, 4)
+    TEST_FIELD_OFFSET(EMRMODIFYWORLDTRANSFORM, iMode, 32)
+}
+
+static void test_pack_EMRMOVETOEX(void)
+{
+    /* EMRMOVETOEX */
+    TEST_TYPE_SIZE   (EMRMOVETOEX, 16)
+    TEST_TYPE_ALIGN  (EMRMOVETOEX, 4)
+    TEST_FIELD_SIZE  (EMRMOVETOEX, emr, 8)
+    TEST_FIELD_ALIGN (EMRMOVETOEX, emr, 4)
+    TEST_FIELD_OFFSET(EMRMOVETOEX, emr, 0)
+    TEST_FIELD_SIZE  (EMRMOVETOEX, ptl, 8)
+    TEST_FIELD_ALIGN (EMRMOVETOEX, ptl, 4)
+    TEST_FIELD_OFFSET(EMRMOVETOEX, ptl, 8)
+}
+
+static void test_pack_EMROFFSETCLIPRGN(void)
+{
+    /* EMROFFSETCLIPRGN */
+    TEST_TYPE_SIZE   (EMROFFSETCLIPRGN, 16)
+    TEST_TYPE_ALIGN  (EMROFFSETCLIPRGN, 4)
+    TEST_FIELD_SIZE  (EMROFFSETCLIPRGN, emr, 8)
+    TEST_FIELD_ALIGN (EMROFFSETCLIPRGN, emr, 4)
+    TEST_FIELD_OFFSET(EMROFFSETCLIPRGN, emr, 0)
+    TEST_FIELD_SIZE  (EMROFFSETCLIPRGN, ptlOffset, 8)
+    TEST_FIELD_ALIGN (EMROFFSETCLIPRGN, ptlOffset, 4)
+    TEST_FIELD_OFFSET(EMROFFSETCLIPRGN, ptlOffset, 8)
+}
+
+static void test_pack_EMRPAINTRGN(void)
+{
+    /* EMRPAINTRGN */
+    TEST_TYPE_SIZE   (EMRPAINTRGN, 32)
+    TEST_TYPE_ALIGN  (EMRPAINTRGN, 4)
+    TEST_FIELD_SIZE  (EMRPAINTRGN, emr, 8)
+    TEST_FIELD_ALIGN (EMRPAINTRGN, emr, 4)
+    TEST_FIELD_OFFSET(EMRPAINTRGN, emr, 0)
+    TEST_FIELD_SIZE  (EMRPAINTRGN, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPAINTRGN, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPAINTRGN, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPAINTRGN, cbRgnData, 4)
+    TEST_FIELD_ALIGN (EMRPAINTRGN, cbRgnData, 4)
+    TEST_FIELD_OFFSET(EMRPAINTRGN, cbRgnData, 24)
+    TEST_FIELD_SIZE  (EMRPAINTRGN, RgnData, 1)
+    TEST_FIELD_ALIGN (EMRPAINTRGN, RgnData, 1)
+    TEST_FIELD_OFFSET(EMRPAINTRGN, RgnData, 28)
+}
+
+static void test_pack_EMRPIE(void)
+{
+    /* EMRPIE */
+    TEST_TYPE_SIZE   (EMRPIE, 40)
+    TEST_TYPE_ALIGN  (EMRPIE, 4)
+    TEST_FIELD_SIZE  (EMRPIE, emr, 8)
+    TEST_FIELD_ALIGN (EMRPIE, emr, 4)
+    TEST_FIELD_OFFSET(EMRPIE, emr, 0)
+    TEST_FIELD_SIZE  (EMRPIE, rclBox, 16)
+    TEST_FIELD_ALIGN (EMRPIE, rclBox, 4)
+    TEST_FIELD_OFFSET(EMRPIE, rclBox, 8)
+    TEST_FIELD_SIZE  (EMRPIE, ptlStart, 8)
+    TEST_FIELD_ALIGN (EMRPIE, ptlStart, 4)
+    TEST_FIELD_OFFSET(EMRPIE, ptlStart, 24)
+    TEST_FIELD_SIZE  (EMRPIE, ptlEnd, 8)
+    TEST_FIELD_ALIGN (EMRPIE, ptlEnd, 4)
+    TEST_FIELD_OFFSET(EMRPIE, ptlEnd, 32)
+}
+
+static void test_pack_EMRPIXELFORMAT(void)
+{
+    /* EMRPIXELFORMAT */
+    TEST_TYPE_SIZE   (EMRPIXELFORMAT, 48)
+    TEST_TYPE_ALIGN  (EMRPIXELFORMAT, 4)
+    TEST_FIELD_SIZE  (EMRPIXELFORMAT, emr, 8)
+    TEST_FIELD_ALIGN (EMRPIXELFORMAT, emr, 4)
+    TEST_FIELD_OFFSET(EMRPIXELFORMAT, emr, 0)
+    TEST_FIELD_SIZE  (EMRPIXELFORMAT, pfd, 40)
+    TEST_FIELD_ALIGN (EMRPIXELFORMAT, pfd, 4)
+    TEST_FIELD_OFFSET(EMRPIXELFORMAT, pfd, 8)
+}
+
+static void test_pack_EMRPLGBLT(void)
+{
+    /* EMRPLGBLT */
+    TEST_TYPE_SIZE   (EMRPLGBLT, 140)
+    TEST_TYPE_ALIGN  (EMRPLGBLT, 4)
+    TEST_FIELD_SIZE  (EMRPLGBLT, emr, 8)
+    TEST_FIELD_ALIGN (EMRPLGBLT, emr, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, emr, 0)
+    TEST_FIELD_SIZE  (EMRPLGBLT, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPLGBLT, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPLGBLT, aptlDest, 24)
+    TEST_FIELD_ALIGN (EMRPLGBLT, aptlDest, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, aptlDest, 24)
+    TEST_FIELD_SIZE  (EMRPLGBLT, xSrc, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, xSrc, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, xSrc, 48)
+    TEST_FIELD_SIZE  (EMRPLGBLT, ySrc, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, ySrc, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, ySrc, 52)
+    TEST_FIELD_SIZE  (EMRPLGBLT, cxSrc, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, cxSrc, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, cxSrc, 56)
+    TEST_FIELD_SIZE  (EMRPLGBLT, cySrc, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, cySrc, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, cySrc, 60)
+    TEST_FIELD_SIZE  (EMRPLGBLT, xformSrc, 24)
+    TEST_FIELD_ALIGN (EMRPLGBLT, xformSrc, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, xformSrc, 64)
+    TEST_FIELD_SIZE  (EMRPLGBLT, crBkColorSrc, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, crBkColorSrc, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, crBkColorSrc, 88)
+    TEST_FIELD_SIZE  (EMRPLGBLT, iUsageSrc, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, iUsageSrc, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, iUsageSrc, 92)
+    TEST_FIELD_SIZE  (EMRPLGBLT, offBmiSrc, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, offBmiSrc, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, offBmiSrc, 96)
+    TEST_FIELD_SIZE  (EMRPLGBLT, cbBmiSrc, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, cbBmiSrc, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, cbBmiSrc, 100)
+    TEST_FIELD_SIZE  (EMRPLGBLT, offBitsSrc, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, offBitsSrc, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, offBitsSrc, 104)
+    TEST_FIELD_SIZE  (EMRPLGBLT, cbBitsSrc, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, cbBitsSrc, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, cbBitsSrc, 108)
+    TEST_FIELD_SIZE  (EMRPLGBLT, xMask, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, xMask, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, xMask, 112)
+    TEST_FIELD_SIZE  (EMRPLGBLT, yMask, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, yMask, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, yMask, 116)
+    TEST_FIELD_SIZE  (EMRPLGBLT, iUsageMask, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, iUsageMask, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, iUsageMask, 120)
+    TEST_FIELD_SIZE  (EMRPLGBLT, offBmiMask, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, offBmiMask, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, offBmiMask, 124)
+    TEST_FIELD_SIZE  (EMRPLGBLT, cbBmiMask, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, cbBmiMask, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, cbBmiMask, 128)
+    TEST_FIELD_SIZE  (EMRPLGBLT, offBitsMask, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, offBitsMask, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, offBitsMask, 132)
+    TEST_FIELD_SIZE  (EMRPLGBLT, cbBitsMask, 4)
+    TEST_FIELD_ALIGN (EMRPLGBLT, cbBitsMask, 4)
+    TEST_FIELD_OFFSET(EMRPLGBLT, cbBitsMask, 136)
+}
+
+static void test_pack_EMRPOLYBEZIER(void)
+{
+    /* EMRPOLYBEZIER */
+    TEST_TYPE_SIZE   (EMRPOLYBEZIER, 36)
+    TEST_TYPE_ALIGN  (EMRPOLYBEZIER, 4)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIER, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIER, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIER, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIER, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIER, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIER, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIER, cptl, 4)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIER, cptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIER, cptl, 24)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIER, aptl, 8)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIER, aptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIER, aptl, 28)
+}
+
+static void test_pack_EMRPOLYBEZIER16(void)
+{
+    /* EMRPOLYBEZIER16 */
+    TEST_TYPE_SIZE   (EMRPOLYBEZIER16, 32)
+    TEST_TYPE_ALIGN  (EMRPOLYBEZIER16, 4)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIER16, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIER16, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIER16, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIER16, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIER16, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIER16, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIER16, cpts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIER16, cpts, 4)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIER16, cpts, 24)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIER16, apts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIER16, apts, 2)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIER16, apts, 28)
+}
+
+static void test_pack_EMRPOLYBEZIERTO(void)
+{
+    /* EMRPOLYBEZIERTO */
+    TEST_TYPE_SIZE   (EMRPOLYBEZIERTO, 36)
+    TEST_TYPE_ALIGN  (EMRPOLYBEZIERTO, 4)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIERTO, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIERTO, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIERTO, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIERTO, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIERTO, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIERTO, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIERTO, cptl, 4)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIERTO, cptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIERTO, cptl, 24)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIERTO, aptl, 8)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIERTO, aptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIERTO, aptl, 28)
+}
+
+static void test_pack_EMRPOLYBEZIERTO16(void)
+{
+    /* EMRPOLYBEZIERTO16 */
+    TEST_TYPE_SIZE   (EMRPOLYBEZIERTO16, 32)
+    TEST_TYPE_ALIGN  (EMRPOLYBEZIERTO16, 4)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIERTO16, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIERTO16, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIERTO16, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIERTO16, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIERTO16, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIERTO16, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIERTO16, cpts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIERTO16, cpts, 4)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIERTO16, cpts, 24)
+    TEST_FIELD_SIZE  (EMRPOLYBEZIERTO16, apts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYBEZIERTO16, apts, 2)
+    TEST_FIELD_OFFSET(EMRPOLYBEZIERTO16, apts, 28)
+}
+
+static void test_pack_EMRPOLYDRAW(void)
+{
+    /* EMRPOLYDRAW */
+    TEST_TYPE_SIZE   (EMRPOLYDRAW, 40)
+    TEST_TYPE_ALIGN  (EMRPOLYDRAW, 4)
+    TEST_FIELD_SIZE  (EMRPOLYDRAW, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYDRAW, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYDRAW, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYDRAW, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYDRAW, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYDRAW, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYDRAW, cptl, 4)
+    TEST_FIELD_ALIGN (EMRPOLYDRAW, cptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYDRAW, cptl, 24)
+    TEST_FIELD_SIZE  (EMRPOLYDRAW, aptl, 8)
+    TEST_FIELD_ALIGN (EMRPOLYDRAW, aptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYDRAW, aptl, 28)
+    TEST_FIELD_SIZE  (EMRPOLYDRAW, abTypes, 1)
+    TEST_FIELD_ALIGN (EMRPOLYDRAW, abTypes, 1)
+    TEST_FIELD_OFFSET(EMRPOLYDRAW, abTypes, 36)
+}
+
+static void test_pack_EMRPOLYDRAW16(void)
+{
+    /* EMRPOLYDRAW16 */
+    TEST_TYPE_SIZE   (EMRPOLYDRAW16, 36)
+    TEST_TYPE_ALIGN  (EMRPOLYDRAW16, 4)
+    TEST_FIELD_SIZE  (EMRPOLYDRAW16, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYDRAW16, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYDRAW16, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYDRAW16, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYDRAW16, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYDRAW16, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYDRAW16, cpts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYDRAW16, cpts, 4)
+    TEST_FIELD_OFFSET(EMRPOLYDRAW16, cpts, 24)
+    TEST_FIELD_SIZE  (EMRPOLYDRAW16, apts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYDRAW16, apts, 2)
+    TEST_FIELD_OFFSET(EMRPOLYDRAW16, apts, 28)
+    TEST_FIELD_SIZE  (EMRPOLYDRAW16, abTypes, 1)
+    TEST_FIELD_ALIGN (EMRPOLYDRAW16, abTypes, 1)
+    TEST_FIELD_OFFSET(EMRPOLYDRAW16, abTypes, 32)
+}
+
+static void test_pack_EMRPOLYGON(void)
+{
+    /* EMRPOLYGON */
+    TEST_TYPE_SIZE   (EMRPOLYGON, 36)
+    TEST_TYPE_ALIGN  (EMRPOLYGON, 4)
+    TEST_FIELD_SIZE  (EMRPOLYGON, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYGON, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYGON, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYGON, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYGON, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYGON, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYGON, cptl, 4)
+    TEST_FIELD_ALIGN (EMRPOLYGON, cptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYGON, cptl, 24)
+    TEST_FIELD_SIZE  (EMRPOLYGON, aptl, 8)
+    TEST_FIELD_ALIGN (EMRPOLYGON, aptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYGON, aptl, 28)
+}
+
+static void test_pack_EMRPOLYGON16(void)
+{
+    /* EMRPOLYGON16 */
+    TEST_TYPE_SIZE   (EMRPOLYGON16, 32)
+    TEST_TYPE_ALIGN  (EMRPOLYGON16, 4)
+    TEST_FIELD_SIZE  (EMRPOLYGON16, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYGON16, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYGON16, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYGON16, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYGON16, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYGON16, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYGON16, cpts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYGON16, cpts, 4)
+    TEST_FIELD_OFFSET(EMRPOLYGON16, cpts, 24)
+    TEST_FIELD_SIZE  (EMRPOLYGON16, apts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYGON16, apts, 2)
+    TEST_FIELD_OFFSET(EMRPOLYGON16, apts, 28)
+}
+
+static void test_pack_EMRPOLYLINE(void)
+{
+    /* EMRPOLYLINE */
+    TEST_TYPE_SIZE   (EMRPOLYLINE, 36)
+    TEST_TYPE_ALIGN  (EMRPOLYLINE, 4)
+    TEST_FIELD_SIZE  (EMRPOLYLINE, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYLINE, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYLINE, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYLINE, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYLINE, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYLINE, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYLINE, cptl, 4)
+    TEST_FIELD_ALIGN (EMRPOLYLINE, cptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYLINE, cptl, 24)
+    TEST_FIELD_SIZE  (EMRPOLYLINE, aptl, 8)
+    TEST_FIELD_ALIGN (EMRPOLYLINE, aptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYLINE, aptl, 28)
+}
+
+static void test_pack_EMRPOLYLINE16(void)
+{
+    /* EMRPOLYLINE16 */
+    TEST_TYPE_SIZE   (EMRPOLYLINE16, 32)
+    TEST_TYPE_ALIGN  (EMRPOLYLINE16, 4)
+    TEST_FIELD_SIZE  (EMRPOLYLINE16, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYLINE16, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYLINE16, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYLINE16, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYLINE16, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYLINE16, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYLINE16, cpts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYLINE16, cpts, 4)
+    TEST_FIELD_OFFSET(EMRPOLYLINE16, cpts, 24)
+    TEST_FIELD_SIZE  (EMRPOLYLINE16, apts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYLINE16, apts, 2)
+    TEST_FIELD_OFFSET(EMRPOLYLINE16, apts, 28)
+}
+
+static void test_pack_EMRPOLYLINETO(void)
+{
+    /* EMRPOLYLINETO */
+    TEST_TYPE_SIZE   (EMRPOLYLINETO, 36)
+    TEST_TYPE_ALIGN  (EMRPOLYLINETO, 4)
+    TEST_FIELD_SIZE  (EMRPOLYLINETO, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYLINETO, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYLINETO, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYLINETO, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYLINETO, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYLINETO, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYLINETO, cptl, 4)
+    TEST_FIELD_ALIGN (EMRPOLYLINETO, cptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYLINETO, cptl, 24)
+    TEST_FIELD_SIZE  (EMRPOLYLINETO, aptl, 8)
+    TEST_FIELD_ALIGN (EMRPOLYLINETO, aptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYLINETO, aptl, 28)
+}
+
+static void test_pack_EMRPOLYLINETO16(void)
+{
+    /* EMRPOLYLINETO16 */
+    TEST_TYPE_SIZE   (EMRPOLYLINETO16, 32)
+    TEST_TYPE_ALIGN  (EMRPOLYLINETO16, 4)
+    TEST_FIELD_SIZE  (EMRPOLYLINETO16, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYLINETO16, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYLINETO16, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYLINETO16, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYLINETO16, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYLINETO16, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYLINETO16, cpts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYLINETO16, cpts, 4)
+    TEST_FIELD_OFFSET(EMRPOLYLINETO16, cpts, 24)
+    TEST_FIELD_SIZE  (EMRPOLYLINETO16, apts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYLINETO16, apts, 2)
+    TEST_FIELD_OFFSET(EMRPOLYLINETO16, apts, 28)
+}
+
+static void test_pack_EMRPOLYPOLYGON(void)
+{
+    /* EMRPOLYPOLYGON */
+    TEST_TYPE_SIZE   (EMRPOLYPOLYGON, 44)
+    TEST_TYPE_ALIGN  (EMRPOLYPOLYGON, 4)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYGON, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYGON, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYGON, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYGON, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYGON, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYGON, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYGON, nPolys, 4)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYGON, nPolys, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYGON, nPolys, 24)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYGON, cptl, 4)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYGON, cptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYGON, cptl, 28)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYGON, aPolyCounts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYGON, aPolyCounts, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYGON, aPolyCounts, 32)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYGON, aptl, 8)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYGON, aptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYGON, aptl, 36)
+}
+
+static void test_pack_EMRPOLYPOLYGON16(void)
+{
+    /* EMRPOLYPOLYGON16 */
+    TEST_TYPE_SIZE   (EMRPOLYPOLYGON16, 40)
+    TEST_TYPE_ALIGN  (EMRPOLYPOLYGON16, 4)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYGON16, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYGON16, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYGON16, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYGON16, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYGON16, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYGON16, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYGON16, nPolys, 4)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYGON16, nPolys, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYGON16, nPolys, 24)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYGON16, cpts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYGON16, cpts, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYGON16, cpts, 28)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYGON16, aPolyCounts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYGON16, aPolyCounts, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYGON16, aPolyCounts, 32)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYGON16, apts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYGON16, apts, 2)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYGON16, apts, 36)
+}
+
+static void test_pack_EMRPOLYPOLYLINE(void)
+{
+    /* EMRPOLYPOLYLINE */
+    TEST_TYPE_SIZE   (EMRPOLYPOLYLINE, 44)
+    TEST_TYPE_ALIGN  (EMRPOLYPOLYLINE, 4)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYLINE, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYLINE, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYLINE, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYLINE, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYLINE, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYLINE, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYLINE, nPolys, 4)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYLINE, nPolys, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYLINE, nPolys, 24)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYLINE, cptl, 4)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYLINE, cptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYLINE, cptl, 28)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYLINE, aPolyCounts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYLINE, aPolyCounts, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYLINE, aPolyCounts, 32)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYLINE, aptl, 8)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYLINE, aptl, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYLINE, aptl, 36)
+}
+
+static void test_pack_EMRPOLYPOLYLINE16(void)
+{
+    /* EMRPOLYPOLYLINE16 */
+    TEST_TYPE_SIZE   (EMRPOLYPOLYLINE16, 40)
+    TEST_TYPE_ALIGN  (EMRPOLYPOLYLINE16, 4)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYLINE16, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYLINE16, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYLINE16, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYLINE16, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYLINE16, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYLINE16, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYLINE16, nPolys, 4)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYLINE16, nPolys, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYLINE16, nPolys, 24)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYLINE16, cpts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYLINE16, cpts, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYLINE16, cpts, 28)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYLINE16, aPolyCounts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYLINE16, aPolyCounts, 4)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYLINE16, aPolyCounts, 32)
+    TEST_FIELD_SIZE  (EMRPOLYPOLYLINE16, apts, 4)
+    TEST_FIELD_ALIGN (EMRPOLYPOLYLINE16, apts, 2)
+    TEST_FIELD_OFFSET(EMRPOLYPOLYLINE16, apts, 36)
+}
+
+static void test_pack_EMRPOLYTEXTOUTA(void)
+{
+    /* EMRPOLYTEXTOUTA */
+    TEST_TYPE_SIZE   (EMRPOLYTEXTOUTA, 80)
+    TEST_TYPE_ALIGN  (EMRPOLYTEXTOUTA, 4)
+    TEST_FIELD_SIZE  (EMRPOLYTEXTOUTA, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYTEXTOUTA, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYTEXTOUTA, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYTEXTOUTA, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYTEXTOUTA, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYTEXTOUTA, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYTEXTOUTA, iGraphicsMode, 4)
+    TEST_FIELD_ALIGN (EMRPOLYTEXTOUTA, iGraphicsMode, 4)
+    TEST_FIELD_OFFSET(EMRPOLYTEXTOUTA, iGraphicsMode, 24)
+    TEST_FIELD_SIZE  (EMRPOLYTEXTOUTA, exScale, 4)
+    TEST_FIELD_ALIGN (EMRPOLYTEXTOUTA, exScale, 4)
+    TEST_FIELD_OFFSET(EMRPOLYTEXTOUTA, exScale, 28)
+    TEST_FIELD_SIZE  (EMRPOLYTEXTOUTA, eyScale, 4)
+    TEST_FIELD_ALIGN (EMRPOLYTEXTOUTA, eyScale, 4)
+    TEST_FIELD_OFFSET(EMRPOLYTEXTOUTA, eyScale, 32)
+    TEST_FIELD_SIZE  (EMRPOLYTEXTOUTA, cStrings, 4)
+    TEST_FIELD_ALIGN (EMRPOLYTEXTOUTA, cStrings, 4)
+    TEST_FIELD_OFFSET(EMRPOLYTEXTOUTA, cStrings, 36)
+    TEST_FIELD_SIZE  (EMRPOLYTEXTOUTA, aemrtext, 40)
+    TEST_FIELD_ALIGN (EMRPOLYTEXTOUTA, aemrtext, 4)
+    TEST_FIELD_OFFSET(EMRPOLYTEXTOUTA, aemrtext, 40)
+}
+
+static void test_pack_EMRPOLYTEXTOUTW(void)
+{
+    /* EMRPOLYTEXTOUTW */
+    TEST_TYPE_SIZE   (EMRPOLYTEXTOUTW, 80)
+    TEST_TYPE_ALIGN  (EMRPOLYTEXTOUTW, 4)
+    TEST_FIELD_SIZE  (EMRPOLYTEXTOUTW, emr, 8)
+    TEST_FIELD_ALIGN (EMRPOLYTEXTOUTW, emr, 4)
+    TEST_FIELD_OFFSET(EMRPOLYTEXTOUTW, emr, 0)
+    TEST_FIELD_SIZE  (EMRPOLYTEXTOUTW, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRPOLYTEXTOUTW, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRPOLYTEXTOUTW, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRPOLYTEXTOUTW, iGraphicsMode, 4)
+    TEST_FIELD_ALIGN (EMRPOLYTEXTOUTW, iGraphicsMode, 4)
+    TEST_FIELD_OFFSET(EMRPOLYTEXTOUTW, iGraphicsMode, 24)
+    TEST_FIELD_SIZE  (EMRPOLYTEXTOUTW, exScale, 4)
+    TEST_FIELD_ALIGN (EMRPOLYTEXTOUTW, exScale, 4)
+    TEST_FIELD_OFFSET(EMRPOLYTEXTOUTW, exScale, 28)
+    TEST_FIELD_SIZE  (EMRPOLYTEXTOUTW, eyScale, 4)
+    TEST_FIELD_ALIGN (EMRPOLYTEXTOUTW, eyScale, 4)
+    TEST_FIELD_OFFSET(EMRPOLYTEXTOUTW, eyScale, 32)
+    TEST_FIELD_SIZE  (EMRPOLYTEXTOUTW, cStrings, 4)
+    TEST_FIELD_ALIGN (EMRPOLYTEXTOUTW, cStrings, 4)
+    TEST_FIELD_OFFSET(EMRPOLYTEXTOUTW, cStrings, 36)
+    TEST_FIELD_SIZE  (EMRPOLYTEXTOUTW, aemrtext, 40)
+    TEST_FIELD_ALIGN (EMRPOLYTEXTOUTW, aemrtext, 4)
+    TEST_FIELD_OFFSET(EMRPOLYTEXTOUTW, aemrtext, 40)
+}
+
+static void test_pack_EMRREALIZEPALETTE(void)
+{
+    /* EMRREALIZEPALETTE */
+    TEST_TYPE_SIZE   (EMRREALIZEPALETTE, 8)
+    TEST_TYPE_ALIGN  (EMRREALIZEPALETTE, 4)
+    TEST_FIELD_SIZE  (EMRREALIZEPALETTE, emr, 8)
+    TEST_FIELD_ALIGN (EMRREALIZEPALETTE, emr, 4)
+    TEST_FIELD_OFFSET(EMRREALIZEPALETTE, emr, 0)
+}
+
+static void test_pack_EMRRECTANGLE(void)
+{
+    /* EMRRECTANGLE */
+    TEST_TYPE_SIZE   (EMRRECTANGLE, 24)
+    TEST_TYPE_ALIGN  (EMRRECTANGLE, 4)
+    TEST_FIELD_SIZE  (EMRRECTANGLE, emr, 8)
+    TEST_FIELD_ALIGN (EMRRECTANGLE, emr, 4)
+    TEST_FIELD_OFFSET(EMRRECTANGLE, emr, 0)
+    TEST_FIELD_SIZE  (EMRRECTANGLE, rclBox, 16)
+    TEST_FIELD_ALIGN (EMRRECTANGLE, rclBox, 4)
+    TEST_FIELD_OFFSET(EMRRECTANGLE, rclBox, 8)
+}
+
+static void test_pack_EMRRESIZEPALETTE(void)
+{
+    /* EMRRESIZEPALETTE */
+    TEST_TYPE_SIZE   (EMRRESIZEPALETTE, 16)
+    TEST_TYPE_ALIGN  (EMRRESIZEPALETTE, 4)
+    TEST_FIELD_SIZE  (EMRRESIZEPALETTE, emr, 8)
+    TEST_FIELD_ALIGN (EMRRESIZEPALETTE, emr, 4)
+    TEST_FIELD_OFFSET(EMRRESIZEPALETTE, emr, 0)
+    TEST_FIELD_SIZE  (EMRRESIZEPALETTE, ihPal, 4)
+    TEST_FIELD_ALIGN (EMRRESIZEPALETTE, ihPal, 4)
+    TEST_FIELD_OFFSET(EMRRESIZEPALETTE, ihPal, 8)
+    TEST_FIELD_SIZE  (EMRRESIZEPALETTE, cEntries, 4)
+    TEST_FIELD_ALIGN (EMRRESIZEPALETTE, cEntries, 4)
+    TEST_FIELD_OFFSET(EMRRESIZEPALETTE, cEntries, 12)
+}
+
+static void test_pack_EMRRESTOREDC(void)
+{
+    /* EMRRESTOREDC */
+    TEST_TYPE_SIZE   (EMRRESTOREDC, 12)
+    TEST_TYPE_ALIGN  (EMRRESTOREDC, 4)
+    TEST_FIELD_SIZE  (EMRRESTOREDC, emr, 8)
+    TEST_FIELD_ALIGN (EMRRESTOREDC, emr, 4)
+    TEST_FIELD_OFFSET(EMRRESTOREDC, emr, 0)
+    TEST_FIELD_SIZE  (EMRRESTOREDC, iRelative, 4)
+    TEST_FIELD_ALIGN (EMRRESTOREDC, iRelative, 4)
+    TEST_FIELD_OFFSET(EMRRESTOREDC, iRelative, 8)
+}
+
+static void test_pack_EMRROUNDRECT(void)
+{
+    /* EMRROUNDRECT */
+    TEST_TYPE_SIZE   (EMRROUNDRECT, 32)
+    TEST_TYPE_ALIGN  (EMRROUNDRECT, 4)
+    TEST_FIELD_SIZE  (EMRROUNDRECT, emr, 8)
+    TEST_FIELD_ALIGN (EMRROUNDRECT, emr, 4)
+    TEST_FIELD_OFFSET(EMRROUNDRECT, emr, 0)
+    TEST_FIELD_SIZE  (EMRROUNDRECT, rclBox, 16)
+    TEST_FIELD_ALIGN (EMRROUNDRECT, rclBox, 4)
+    TEST_FIELD_OFFSET(EMRROUNDRECT, rclBox, 8)
+    TEST_FIELD_SIZE  (EMRROUNDRECT, szlCorner, 8)
+    TEST_FIELD_ALIGN (EMRROUNDRECT, szlCorner, 4)
+    TEST_FIELD_OFFSET(EMRROUNDRECT, szlCorner, 24)
+}
+
+static void test_pack_EMRSAVEDC(void)
+{
+    /* EMRSAVEDC */
+    TEST_TYPE_SIZE   (EMRSAVEDC, 8)
+    TEST_TYPE_ALIGN  (EMRSAVEDC, 4)
+    TEST_FIELD_SIZE  (EMRSAVEDC, emr, 8)
+    TEST_FIELD_ALIGN (EMRSAVEDC, emr, 4)
+    TEST_FIELD_OFFSET(EMRSAVEDC, emr, 0)
+}
+
+static void test_pack_EMRSCALEVIEWPORTEXTEX(void)
+{
+    /* EMRSCALEVIEWPORTEXTEX */
+    TEST_TYPE_SIZE   (EMRSCALEVIEWPORTEXTEX, 24)
+    TEST_TYPE_ALIGN  (EMRSCALEVIEWPORTEXTEX, 4)
+    TEST_FIELD_SIZE  (EMRSCALEVIEWPORTEXTEX, emr, 8)
+    TEST_FIELD_ALIGN (EMRSCALEVIEWPORTEXTEX, emr, 4)
+    TEST_FIELD_OFFSET(EMRSCALEVIEWPORTEXTEX, emr, 0)
+    TEST_FIELD_SIZE  (EMRSCALEVIEWPORTEXTEX, xNum, 4)
+    TEST_FIELD_ALIGN (EMRSCALEVIEWPORTEXTEX, xNum, 4)
+    TEST_FIELD_OFFSET(EMRSCALEVIEWPORTEXTEX, xNum, 8)
+    TEST_FIELD_SIZE  (EMRSCALEVIEWPORTEXTEX, xDenom, 4)
+    TEST_FIELD_ALIGN (EMRSCALEVIEWPORTEXTEX, xDenom, 4)
+    TEST_FIELD_OFFSET(EMRSCALEVIEWPORTEXTEX, xDenom, 12)
+    TEST_FIELD_SIZE  (EMRSCALEVIEWPORTEXTEX, yNum, 4)
+    TEST_FIELD_ALIGN (EMRSCALEVIEWPORTEXTEX, yNum, 4)
+    TEST_FIELD_OFFSET(EMRSCALEVIEWPORTEXTEX, yNum, 16)
+    TEST_FIELD_SIZE  (EMRSCALEVIEWPORTEXTEX, yDenom, 4)
+    TEST_FIELD_ALIGN (EMRSCALEVIEWPORTEXTEX, yDenom, 4)
+    TEST_FIELD_OFFSET(EMRSCALEVIEWPORTEXTEX, yDenom, 20)
+}
+
+static void test_pack_EMRSCALEWINDOWEXTEX(void)
+{
+    /* EMRSCALEWINDOWEXTEX */
+    TEST_TYPE_SIZE   (EMRSCALEWINDOWEXTEX, 24)
+    TEST_TYPE_ALIGN  (EMRSCALEWINDOWEXTEX, 4)
+    TEST_FIELD_SIZE  (EMRSCALEWINDOWEXTEX, emr, 8)
+    TEST_FIELD_ALIGN (EMRSCALEWINDOWEXTEX, emr, 4)
+    TEST_FIELD_OFFSET(EMRSCALEWINDOWEXTEX, emr, 0)
+    TEST_FIELD_SIZE  (EMRSCALEWINDOWEXTEX, xNum, 4)
+    TEST_FIELD_ALIGN (EMRSCALEWINDOWEXTEX, xNum, 4)
+    TEST_FIELD_OFFSET(EMRSCALEWINDOWEXTEX, xNum, 8)
+    TEST_FIELD_SIZE  (EMRSCALEWINDOWEXTEX, xDenom, 4)
+    TEST_FIELD_ALIGN (EMRSCALEWINDOWEXTEX, xDenom, 4)
+    TEST_FIELD_OFFSET(EMRSCALEWINDOWEXTEX, xDenom, 12)
+    TEST_FIELD_SIZE  (EMRSCALEWINDOWEXTEX, yNum, 4)
+    TEST_FIELD_ALIGN (EMRSCALEWINDOWEXTEX, yNum, 4)
+    TEST_FIELD_OFFSET(EMRSCALEWINDOWEXTEX, yNum, 16)
+    TEST_FIELD_SIZE  (EMRSCALEWINDOWEXTEX, yDenom, 4)
+    TEST_FIELD_ALIGN (EMRSCALEWINDOWEXTEX, yDenom, 4)
+    TEST_FIELD_OFFSET(EMRSCALEWINDOWEXTEX, yDenom, 20)
+}
+
+static void test_pack_EMRSELECTCLIPPATH(void)
+{
+    /* EMRSELECTCLIPPATH */
+    TEST_TYPE_SIZE   (EMRSELECTCLIPPATH, 12)
+    TEST_TYPE_ALIGN  (EMRSELECTCLIPPATH, 4)
+    TEST_FIELD_SIZE  (EMRSELECTCLIPPATH, emr, 8)
+    TEST_FIELD_ALIGN (EMRSELECTCLIPPATH, emr, 4)
+    TEST_FIELD_OFFSET(EMRSELECTCLIPPATH, emr, 0)
+    TEST_FIELD_SIZE  (EMRSELECTCLIPPATH, iMode, 4)
+    TEST_FIELD_ALIGN (EMRSELECTCLIPPATH, iMode, 4)
+    TEST_FIELD_OFFSET(EMRSELECTCLIPPATH, iMode, 8)
+}
+
+static void test_pack_EMRSELECTCOLORSPACE(void)
+{
+    /* EMRSELECTCOLORSPACE */
+    TEST_TYPE_SIZE   (EMRSELECTCOLORSPACE, 12)
+    TEST_TYPE_ALIGN  (EMRSELECTCOLORSPACE, 4)
+    TEST_FIELD_SIZE  (EMRSELECTCOLORSPACE, emr, 8)
+    TEST_FIELD_ALIGN (EMRSELECTCOLORSPACE, emr, 4)
+    TEST_FIELD_OFFSET(EMRSELECTCOLORSPACE, emr, 0)
+    TEST_FIELD_SIZE  (EMRSELECTCOLORSPACE, ihCS, 4)
+    TEST_FIELD_ALIGN (EMRSELECTCOLORSPACE, ihCS, 4)
+    TEST_FIELD_OFFSET(EMRSELECTCOLORSPACE, ihCS, 8)
+}
+
+static void test_pack_EMRSELECTOBJECT(void)
+{
+    /* EMRSELECTOBJECT */
+    TEST_TYPE_SIZE   (EMRSELECTOBJECT, 12)
+    TEST_TYPE_ALIGN  (EMRSELECTOBJECT, 4)
+    TEST_FIELD_SIZE  (EMRSELECTOBJECT, emr, 8)
+    TEST_FIELD_ALIGN (EMRSELECTOBJECT, emr, 4)
+    TEST_FIELD_OFFSET(EMRSELECTOBJECT, emr, 0)
+    TEST_FIELD_SIZE  (EMRSELECTOBJECT, ihObject, 4)
+    TEST_FIELD_ALIGN (EMRSELECTOBJECT, ihObject, 4)
+    TEST_FIELD_OFFSET(EMRSELECTOBJECT, ihObject, 8)
+}
+
+static void test_pack_EMRSELECTPALETTE(void)
+{
+    /* EMRSELECTPALETTE */
+    TEST_TYPE_SIZE   (EMRSELECTPALETTE, 12)
+    TEST_TYPE_ALIGN  (EMRSELECTPALETTE, 4)
+    TEST_FIELD_SIZE  (EMRSELECTPALETTE, emr, 8)
+    TEST_FIELD_ALIGN (EMRSELECTPALETTE, emr, 4)
+    TEST_FIELD_OFFSET(EMRSELECTPALETTE, emr, 0)
+    TEST_FIELD_SIZE  (EMRSELECTPALETTE, ihPal, 4)
+    TEST_FIELD_ALIGN (EMRSELECTPALETTE, ihPal, 4)
+    TEST_FIELD_OFFSET(EMRSELECTPALETTE, ihPal, 8)
+}
+
+static void test_pack_EMRSETARCDIRECTION(void)
+{
+    /* EMRSETARCDIRECTION */
+    TEST_TYPE_SIZE   (EMRSETARCDIRECTION, 12)
+    TEST_TYPE_ALIGN  (EMRSETARCDIRECTION, 4)
+    TEST_FIELD_SIZE  (EMRSETARCDIRECTION, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETARCDIRECTION, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETARCDIRECTION, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETARCDIRECTION, iArcDirection, 4)
+    TEST_FIELD_ALIGN (EMRSETARCDIRECTION, iArcDirection, 4)
+    TEST_FIELD_OFFSET(EMRSETARCDIRECTION, iArcDirection, 8)
+}
+
+static void test_pack_EMRSETBKCOLOR(void)
+{
+    /* EMRSETBKCOLOR */
+    TEST_TYPE_SIZE   (EMRSETBKCOLOR, 12)
+    TEST_TYPE_ALIGN  (EMRSETBKCOLOR, 4)
+    TEST_FIELD_SIZE  (EMRSETBKCOLOR, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETBKCOLOR, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETBKCOLOR, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETBKCOLOR, crColor, 4)
+    TEST_FIELD_ALIGN (EMRSETBKCOLOR, crColor, 4)
+    TEST_FIELD_OFFSET(EMRSETBKCOLOR, crColor, 8)
+}
+
+static void test_pack_EMRSETBKMODE(void)
+{
+    /* EMRSETBKMODE */
+    TEST_TYPE_SIZE   (EMRSETBKMODE, 12)
+    TEST_TYPE_ALIGN  (EMRSETBKMODE, 4)
+    TEST_FIELD_SIZE  (EMRSETBKMODE, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETBKMODE, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETBKMODE, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETBKMODE, iMode, 4)
+    TEST_FIELD_ALIGN (EMRSETBKMODE, iMode, 4)
+    TEST_FIELD_OFFSET(EMRSETBKMODE, iMode, 8)
+}
+
+static void test_pack_EMRSETBRUSHORGEX(void)
+{
+    /* EMRSETBRUSHORGEX */
+    TEST_TYPE_SIZE   (EMRSETBRUSHORGEX, 16)
+    TEST_TYPE_ALIGN  (EMRSETBRUSHORGEX, 4)
+    TEST_FIELD_SIZE  (EMRSETBRUSHORGEX, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETBRUSHORGEX, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETBRUSHORGEX, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETBRUSHORGEX, ptlOrigin, 8)
+    TEST_FIELD_ALIGN (EMRSETBRUSHORGEX, ptlOrigin, 4)
+    TEST_FIELD_OFFSET(EMRSETBRUSHORGEX, ptlOrigin, 8)
+}
+
+static void test_pack_EMRSETCOLORADJUSTMENT(void)
+{
+    /* EMRSETCOLORADJUSTMENT */
+    TEST_TYPE_SIZE   (EMRSETCOLORADJUSTMENT, 32)
+    TEST_TYPE_ALIGN  (EMRSETCOLORADJUSTMENT, 4)
+    TEST_FIELD_SIZE  (EMRSETCOLORADJUSTMENT, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETCOLORADJUSTMENT, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETCOLORADJUSTMENT, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETCOLORADJUSTMENT, ColorAdjustment, 24)
+    TEST_FIELD_ALIGN (EMRSETCOLORADJUSTMENT, ColorAdjustment, 2)
+    TEST_FIELD_OFFSET(EMRSETCOLORADJUSTMENT, ColorAdjustment, 8)
+}
+
+static void test_pack_EMRSETCOLORSPACE(void)
+{
+    /* EMRSETCOLORSPACE */
+    TEST_TYPE_SIZE   (EMRSETCOLORSPACE, 12)
+    TEST_TYPE_ALIGN  (EMRSETCOLORSPACE, 4)
+    TEST_FIELD_SIZE  (EMRSETCOLORSPACE, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETCOLORSPACE, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETCOLORSPACE, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETCOLORSPACE, ihCS, 4)
+    TEST_FIELD_ALIGN (EMRSETCOLORSPACE, ihCS, 4)
+    TEST_FIELD_OFFSET(EMRSETCOLORSPACE, ihCS, 8)
+}
+
+static void test_pack_EMRSETDIBITSTODEVICE(void)
+{
+    /* EMRSETDIBITSTODEVICE */
+    TEST_TYPE_SIZE   (EMRSETDIBITSTODEVICE, 76)
+    TEST_TYPE_ALIGN  (EMRSETDIBITSTODEVICE, 4)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, xDest, 4)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, xDest, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, xDest, 24)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, yDest, 4)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, yDest, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, yDest, 28)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, xSrc, 4)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, xSrc, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, xSrc, 32)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, ySrc, 4)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, ySrc, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, ySrc, 36)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, cxSrc, 4)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, cxSrc, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, cxSrc, 40)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, cySrc, 4)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, cySrc, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, cySrc, 44)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, offBmiSrc, 4)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, offBmiSrc, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, offBmiSrc, 48)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, cbBmiSrc, 4)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, cbBmiSrc, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, cbBmiSrc, 52)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, offBitsSrc, 4)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, offBitsSrc, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, offBitsSrc, 56)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, cbBitsSrc, 4)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, cbBitsSrc, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, cbBitsSrc, 60)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, iUsageSrc, 4)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, iUsageSrc, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, iUsageSrc, 64)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, iStartScan, 4)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, iStartScan, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, iStartScan, 68)
+    TEST_FIELD_SIZE  (EMRSETDIBITSTODEVICE, cScans, 4)
+    TEST_FIELD_ALIGN (EMRSETDIBITSTODEVICE, cScans, 4)
+    TEST_FIELD_OFFSET(EMRSETDIBITSTODEVICE, cScans, 72)
+}
+
+static void test_pack_EMRSETICMMODE(void)
+{
+    /* EMRSETICMMODE */
+    TEST_TYPE_SIZE   (EMRSETICMMODE, 12)
+    TEST_TYPE_ALIGN  (EMRSETICMMODE, 4)
+    TEST_FIELD_SIZE  (EMRSETICMMODE, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETICMMODE, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETICMMODE, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETICMMODE, iMode, 4)
+    TEST_FIELD_ALIGN (EMRSETICMMODE, iMode, 4)
+    TEST_FIELD_OFFSET(EMRSETICMMODE, iMode, 8)
+}
+
+static void test_pack_EMRSETLAYOUT(void)
+{
+    /* EMRSETLAYOUT */
+    TEST_TYPE_SIZE   (EMRSETLAYOUT, 12)
+    TEST_TYPE_ALIGN  (EMRSETLAYOUT, 4)
+    TEST_FIELD_SIZE  (EMRSETLAYOUT, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETLAYOUT, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETLAYOUT, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETLAYOUT, iMode, 4)
+    TEST_FIELD_ALIGN (EMRSETLAYOUT, iMode, 4)
+    TEST_FIELD_OFFSET(EMRSETLAYOUT, iMode, 8)
+}
+
+static void test_pack_EMRSETMAPMODE(void)
+{
+    /* EMRSETMAPMODE */
+    TEST_TYPE_SIZE   (EMRSETMAPMODE, 12)
+    TEST_TYPE_ALIGN  (EMRSETMAPMODE, 4)
+    TEST_FIELD_SIZE  (EMRSETMAPMODE, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETMAPMODE, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETMAPMODE, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETMAPMODE, iMode, 4)
+    TEST_FIELD_ALIGN (EMRSETMAPMODE, iMode, 4)
+    TEST_FIELD_OFFSET(EMRSETMAPMODE, iMode, 8)
+}
+
+static void test_pack_EMRSETMAPPERFLAGS(void)
+{
+    /* EMRSETMAPPERFLAGS */
+    TEST_TYPE_SIZE   (EMRSETMAPPERFLAGS, 12)
+    TEST_TYPE_ALIGN  (EMRSETMAPPERFLAGS, 4)
+    TEST_FIELD_SIZE  (EMRSETMAPPERFLAGS, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETMAPPERFLAGS, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETMAPPERFLAGS, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETMAPPERFLAGS, dwFlags, 4)
+    TEST_FIELD_ALIGN (EMRSETMAPPERFLAGS, dwFlags, 4)
+    TEST_FIELD_OFFSET(EMRSETMAPPERFLAGS, dwFlags, 8)
+}
+
+static void test_pack_EMRSETMETARGN(void)
+{
+    /* EMRSETMETARGN */
+    TEST_TYPE_SIZE   (EMRSETMETARGN, 8)
+    TEST_TYPE_ALIGN  (EMRSETMETARGN, 4)
+    TEST_FIELD_SIZE  (EMRSETMETARGN, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETMETARGN, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETMETARGN, emr, 0)
+}
+
+static void test_pack_EMRSETMITERLIMIT(void)
+{
+    /* EMRSETMITERLIMIT */
+    TEST_TYPE_SIZE   (EMRSETMITERLIMIT, 12)
+    TEST_TYPE_ALIGN  (EMRSETMITERLIMIT, 4)
+    TEST_FIELD_SIZE  (EMRSETMITERLIMIT, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETMITERLIMIT, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETMITERLIMIT, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETMITERLIMIT, eMiterLimit, 4)
+    TEST_FIELD_ALIGN (EMRSETMITERLIMIT, eMiterLimit, 4)
+    TEST_FIELD_OFFSET(EMRSETMITERLIMIT, eMiterLimit, 8)
+}
+
+static void test_pack_EMRSETPIXELV(void)
+{
+    /* EMRSETPIXELV */
+    TEST_TYPE_SIZE   (EMRSETPIXELV, 20)
+    TEST_TYPE_ALIGN  (EMRSETPIXELV, 4)
+    TEST_FIELD_SIZE  (EMRSETPIXELV, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETPIXELV, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETPIXELV, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETPIXELV, ptlPixel, 8)
+    TEST_FIELD_ALIGN (EMRSETPIXELV, ptlPixel, 4)
+    TEST_FIELD_OFFSET(EMRSETPIXELV, ptlPixel, 8)
+    TEST_FIELD_SIZE  (EMRSETPIXELV, crColor, 4)
+    TEST_FIELD_ALIGN (EMRSETPIXELV, crColor, 4)
+    TEST_FIELD_OFFSET(EMRSETPIXELV, crColor, 16)
+}
+
+static void test_pack_EMRSETPOLYFILLMODE(void)
+{
+    /* EMRSETPOLYFILLMODE */
+    TEST_TYPE_SIZE   (EMRSETPOLYFILLMODE, 12)
+    TEST_TYPE_ALIGN  (EMRSETPOLYFILLMODE, 4)
+    TEST_FIELD_SIZE  (EMRSETPOLYFILLMODE, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETPOLYFILLMODE, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETPOLYFILLMODE, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETPOLYFILLMODE, iMode, 4)
+    TEST_FIELD_ALIGN (EMRSETPOLYFILLMODE, iMode, 4)
+    TEST_FIELD_OFFSET(EMRSETPOLYFILLMODE, iMode, 8)
+}
+
+static void test_pack_EMRSETROP2(void)
+{
+    /* EMRSETROP2 */
+    TEST_TYPE_SIZE   (EMRSETROP2, 12)
+    TEST_TYPE_ALIGN  (EMRSETROP2, 4)
+    TEST_FIELD_SIZE  (EMRSETROP2, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETROP2, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETROP2, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETROP2, iMode, 4)
+    TEST_FIELD_ALIGN (EMRSETROP2, iMode, 4)
+    TEST_FIELD_OFFSET(EMRSETROP2, iMode, 8)
+}
+
+static void test_pack_EMRSETSTRETCHBLTMODE(void)
+{
+    /* EMRSETSTRETCHBLTMODE */
+    TEST_TYPE_SIZE   (EMRSETSTRETCHBLTMODE, 12)
+    TEST_TYPE_ALIGN  (EMRSETSTRETCHBLTMODE, 4)
+    TEST_FIELD_SIZE  (EMRSETSTRETCHBLTMODE, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETSTRETCHBLTMODE, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETSTRETCHBLTMODE, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETSTRETCHBLTMODE, iMode, 4)
+    TEST_FIELD_ALIGN (EMRSETSTRETCHBLTMODE, iMode, 4)
+    TEST_FIELD_OFFSET(EMRSETSTRETCHBLTMODE, iMode, 8)
+}
+
+static void test_pack_EMRSETTEXTALIGN(void)
+{
+    /* EMRSETTEXTALIGN */
+    TEST_TYPE_SIZE   (EMRSETTEXTALIGN, 12)
+    TEST_TYPE_ALIGN  (EMRSETTEXTALIGN, 4)
+    TEST_FIELD_SIZE  (EMRSETTEXTALIGN, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETTEXTALIGN, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETTEXTALIGN, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETTEXTALIGN, iMode, 4)
+    TEST_FIELD_ALIGN (EMRSETTEXTALIGN, iMode, 4)
+    TEST_FIELD_OFFSET(EMRSETTEXTALIGN, iMode, 8)
+}
+
+static void test_pack_EMRSETTEXTCOLOR(void)
+{
+    /* EMRSETTEXTCOLOR */
+    TEST_TYPE_SIZE   (EMRSETTEXTCOLOR, 12)
+    TEST_TYPE_ALIGN  (EMRSETTEXTCOLOR, 4)
+    TEST_FIELD_SIZE  (EMRSETTEXTCOLOR, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETTEXTCOLOR, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETTEXTCOLOR, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETTEXTCOLOR, crColor, 4)
+    TEST_FIELD_ALIGN (EMRSETTEXTCOLOR, crColor, 4)
+    TEST_FIELD_OFFSET(EMRSETTEXTCOLOR, crColor, 8)
+}
+
+static void test_pack_EMRSETVIEWPORTEXTEX(void)
+{
+    /* EMRSETVIEWPORTEXTEX */
+    TEST_TYPE_SIZE   (EMRSETVIEWPORTEXTEX, 16)
+    TEST_TYPE_ALIGN  (EMRSETVIEWPORTEXTEX, 4)
+    TEST_FIELD_SIZE  (EMRSETVIEWPORTEXTEX, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETVIEWPORTEXTEX, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETVIEWPORTEXTEX, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETVIEWPORTEXTEX, szlExtent, 8)
+    TEST_FIELD_ALIGN (EMRSETVIEWPORTEXTEX, szlExtent, 4)
+    TEST_FIELD_OFFSET(EMRSETVIEWPORTEXTEX, szlExtent, 8)
+}
+
+static void test_pack_EMRSETVIEWPORTORGEX(void)
+{
+    /* EMRSETVIEWPORTORGEX */
+    TEST_TYPE_SIZE   (EMRSETVIEWPORTORGEX, 16)
+    TEST_TYPE_ALIGN  (EMRSETVIEWPORTORGEX, 4)
+    TEST_FIELD_SIZE  (EMRSETVIEWPORTORGEX, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETVIEWPORTORGEX, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETVIEWPORTORGEX, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETVIEWPORTORGEX, ptlOrigin, 8)
+    TEST_FIELD_ALIGN (EMRSETVIEWPORTORGEX, ptlOrigin, 4)
+    TEST_FIELD_OFFSET(EMRSETVIEWPORTORGEX, ptlOrigin, 8)
+}
+
+static void test_pack_EMRSETWINDOWEXTEX(void)
+{
+    /* EMRSETWINDOWEXTEX */
+    TEST_TYPE_SIZE   (EMRSETWINDOWEXTEX, 16)
+    TEST_TYPE_ALIGN  (EMRSETWINDOWEXTEX, 4)
+    TEST_FIELD_SIZE  (EMRSETWINDOWEXTEX, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETWINDOWEXTEX, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETWINDOWEXTEX, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETWINDOWEXTEX, szlExtent, 8)
+    TEST_FIELD_ALIGN (EMRSETWINDOWEXTEX, szlExtent, 4)
+    TEST_FIELD_OFFSET(EMRSETWINDOWEXTEX, szlExtent, 8)
+}
+
+static void test_pack_EMRSETWINDOWORGEX(void)
+{
+    /* EMRSETWINDOWORGEX */
+    TEST_TYPE_SIZE   (EMRSETWINDOWORGEX, 16)
+    TEST_TYPE_ALIGN  (EMRSETWINDOWORGEX, 4)
+    TEST_FIELD_SIZE  (EMRSETWINDOWORGEX, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETWINDOWORGEX, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETWINDOWORGEX, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETWINDOWORGEX, ptlOrigin, 8)
+    TEST_FIELD_ALIGN (EMRSETWINDOWORGEX, ptlOrigin, 4)
+    TEST_FIELD_OFFSET(EMRSETWINDOWORGEX, ptlOrigin, 8)
+}
+
+static void test_pack_EMRSETWORLDTRANSFORM(void)
+{
+    /* EMRSETWORLDTRANSFORM */
+    TEST_TYPE_SIZE   (EMRSETWORLDTRANSFORM, 32)
+    TEST_TYPE_ALIGN  (EMRSETWORLDTRANSFORM, 4)
+    TEST_FIELD_SIZE  (EMRSETWORLDTRANSFORM, emr, 8)
+    TEST_FIELD_ALIGN (EMRSETWORLDTRANSFORM, emr, 4)
+    TEST_FIELD_OFFSET(EMRSETWORLDTRANSFORM, emr, 0)
+    TEST_FIELD_SIZE  (EMRSETWORLDTRANSFORM, xform, 24)
+    TEST_FIELD_ALIGN (EMRSETWORLDTRANSFORM, xform, 4)
+    TEST_FIELD_OFFSET(EMRSETWORLDTRANSFORM, xform, 8)
+}
+
+static void test_pack_EMRSTRETCHBLT(void)
+{
+    /* EMRSTRETCHBLT */
+    TEST_TYPE_SIZE   (EMRSTRETCHBLT, 108)
+    TEST_TYPE_ALIGN  (EMRSTRETCHBLT, 4)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, emr, 8)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, emr, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, emr, 0)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, xDest, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, xDest, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, xDest, 24)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, yDest, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, yDest, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, yDest, 28)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, cxDest, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, cxDest, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, cxDest, 32)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, cyDest, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, cyDest, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, cyDest, 36)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, dwRop, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, dwRop, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, dwRop, 40)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, xSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, xSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, xSrc, 44)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, ySrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, ySrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, ySrc, 48)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, xformSrc, 24)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, xformSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, xformSrc, 52)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, crBkColorSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, crBkColorSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, crBkColorSrc, 76)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, iUsageSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, iUsageSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, iUsageSrc, 80)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, offBmiSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, offBmiSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, offBmiSrc, 84)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, cbBmiSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, cbBmiSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, cbBmiSrc, 88)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, offBitsSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, offBitsSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, offBitsSrc, 92)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, cbBitsSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, cbBitsSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, cbBitsSrc, 96)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, cxSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, cxSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, cxSrc, 100)
+    TEST_FIELD_SIZE  (EMRSTRETCHBLT, cySrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHBLT, cySrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHBLT, cySrc, 104)
+}
+
+static void test_pack_EMRSTRETCHDIBITS(void)
+{
+    /* EMRSTRETCHDIBITS */
+    TEST_TYPE_SIZE   (EMRSTRETCHDIBITS, 80)
+    TEST_TYPE_ALIGN  (EMRSTRETCHDIBITS, 4)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, emr, 8)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, emr, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, emr, 0)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, rclBounds, 8)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, xDest, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, xDest, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, xDest, 24)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, yDest, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, yDest, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, yDest, 28)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, xSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, xSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, xSrc, 32)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, ySrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, ySrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, ySrc, 36)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, cxSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, cxSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, cxSrc, 40)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, cySrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, cySrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, cySrc, 44)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, offBmiSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, offBmiSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, offBmiSrc, 48)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, cbBmiSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, cbBmiSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, cbBmiSrc, 52)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, offBitsSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, offBitsSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, offBitsSrc, 56)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, cbBitsSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, cbBitsSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, cbBitsSrc, 60)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, iUsageSrc, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, iUsageSrc, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, iUsageSrc, 64)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, dwRop, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, dwRop, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, dwRop, 68)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, cxDest, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, cxDest, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, cxDest, 72)
+    TEST_FIELD_SIZE  (EMRSTRETCHDIBITS, cyDest, 4)
+    TEST_FIELD_ALIGN (EMRSTRETCHDIBITS, cyDest, 4)
+    TEST_FIELD_OFFSET(EMRSTRETCHDIBITS, cyDest, 76)
+}
+
+static void test_pack_EMRSTROKEANDFILLPATH(void)
+{
+    /* EMRSTROKEANDFILLPATH */
+    TEST_TYPE_SIZE   (EMRSTROKEANDFILLPATH, 24)
+    TEST_TYPE_ALIGN  (EMRSTROKEANDFILLPATH, 4)
+    TEST_FIELD_SIZE  (EMRSTROKEANDFILLPATH, emr, 8)
+    TEST_FIELD_ALIGN (EMRSTROKEANDFILLPATH, emr, 4)
+    TEST_FIELD_OFFSET(EMRSTROKEANDFILLPATH, emr, 0)
+    TEST_FIELD_SIZE  (EMRSTROKEANDFILLPATH, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRSTROKEANDFILLPATH, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRSTROKEANDFILLPATH, rclBounds, 8)
+}
+
+static void test_pack_EMRSTROKEPATH(void)
+{
+    /* EMRSTROKEPATH */
+    TEST_TYPE_SIZE   (EMRSTROKEPATH, 24)
+    TEST_TYPE_ALIGN  (EMRSTROKEPATH, 4)
+    TEST_FIELD_SIZE  (EMRSTROKEPATH, emr, 8)
+    TEST_FIELD_ALIGN (EMRSTROKEPATH, emr, 4)
+    TEST_FIELD_OFFSET(EMRSTROKEPATH, emr, 0)
+    TEST_FIELD_SIZE  (EMRSTROKEPATH, rclBounds, 16)
+    TEST_FIELD_ALIGN (EMRSTROKEPATH, rclBounds, 4)
+    TEST_FIELD_OFFSET(EMRSTROKEPATH, rclBounds, 8)
+}
+
+static void test_pack_EMRTEXT(void)
+{
+    /* EMRTEXT */
+    TEST_TYPE_SIZE   (EMRTEXT, 40)
+    TEST_TYPE_ALIGN  (EMRTEXT, 4)
+    TEST_FIELD_SIZE  (EMRTEXT, ptlReference, 8)
+    TEST_FIELD_ALIGN (EMRTEXT, ptlReference, 4)
+    TEST_FIELD_OFFSET(EMRTEXT, ptlReference, 0)
+    TEST_FIELD_SIZE  (EMRTEXT, nChars, 4)
+    TEST_FIELD_ALIGN (EMRTEXT, nChars, 4)
+    TEST_FIELD_OFFSET(EMRTEXT, nChars, 8)
+    TEST_FIELD_SIZE  (EMRTEXT, offString, 4)
+    TEST_FIELD_ALIGN (EMRTEXT, offString, 4)
+    TEST_FIELD_OFFSET(EMRTEXT, offString, 12)
+    TEST_FIELD_SIZE  (EMRTEXT, fOptions, 4)
+    TEST_FIELD_ALIGN (EMRTEXT, fOptions, 4)
+    TEST_FIELD_OFFSET(EMRTEXT, fOptions, 16)
+    TEST_FIELD_SIZE  (EMRTEXT, rcl, 16)
+    TEST_FIELD_ALIGN (EMRTEXT, rcl, 4)
+    TEST_FIELD_OFFSET(EMRTEXT, rcl, 20)
+    TEST_FIELD_SIZE  (EMRTEXT, offDx, 4)
+    TEST_FIELD_ALIGN (EMRTEXT, offDx, 4)
+    TEST_FIELD_OFFSET(EMRTEXT, offDx, 36)
+}
+
+static void test_pack_EMRWIDENPATH(void)
+{
+    /* EMRWIDENPATH */
+    TEST_TYPE_SIZE   (EMRWIDENPATH, 8)
+    TEST_TYPE_ALIGN  (EMRWIDENPATH, 4)
+    TEST_FIELD_SIZE  (EMRWIDENPATH, emr, 8)
+    TEST_FIELD_ALIGN (EMRWIDENPATH, emr, 4)
+    TEST_FIELD_OFFSET(EMRWIDENPATH, emr, 0)
+}
+
+static void test_pack_ENHMETAHEADER(void)
+{
+    /* ENHMETAHEADER */
+    TEST_TYPE_SIZE   (ENHMETAHEADER, 108)
+    TEST_TYPE_ALIGN  (ENHMETAHEADER, 4)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, iType, 4)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, iType, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, iType, 0)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, nSize, 4)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, nSize, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, nSize, 4)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, rclBounds, 16)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, rclBounds, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, rclBounds, 8)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, rclFrame, 16)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, rclFrame, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, rclFrame, 24)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, dSignature, 4)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, dSignature, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, dSignature, 40)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, nVersion, 4)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, nVersion, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, nVersion, 44)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, nBytes, 4)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, nBytes, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, nBytes, 48)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, nRecords, 4)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, nRecords, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, nRecords, 52)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, nHandles, 2)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, nHandles, 2)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, nHandles, 56)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, sReserved, 2)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, sReserved, 2)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, sReserved, 58)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, nDescription, 4)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, nDescription, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, nDescription, 60)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, offDescription, 4)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, offDescription, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, offDescription, 64)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, nPalEntries, 4)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, nPalEntries, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, nPalEntries, 68)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, szlDevice, 8)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, szlDevice, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, szlDevice, 72)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, szlMillimeters, 8)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, szlMillimeters, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, szlMillimeters, 80)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, cbPixelFormat, 4)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, cbPixelFormat, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, cbPixelFormat, 88)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, offPixelFormat, 4)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, offPixelFormat, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, offPixelFormat, 92)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, bOpenGL, 4)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, bOpenGL, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, bOpenGL, 96)
+    TEST_FIELD_SIZE  (ENHMETAHEADER, szlMicrometers, 8)
+    TEST_FIELD_ALIGN (ENHMETAHEADER, szlMicrometers, 4)
+    TEST_FIELD_OFFSET(ENHMETAHEADER, szlMicrometers, 100)
+}
+
+static void test_pack_ENHMETARECORD(void)
+{
+    /* ENHMETARECORD */
+    TEST_TYPE_SIZE   (ENHMETARECORD, 12)
+    TEST_TYPE_ALIGN  (ENHMETARECORD, 4)
+    TEST_FIELD_SIZE  (ENHMETARECORD, iType, 4)
+    TEST_FIELD_ALIGN (ENHMETARECORD, iType, 4)
+    TEST_FIELD_OFFSET(ENHMETARECORD, iType, 0)
+    TEST_FIELD_SIZE  (ENHMETARECORD, nSize, 4)
+    TEST_FIELD_ALIGN (ENHMETARECORD, nSize, 4)
+    TEST_FIELD_OFFSET(ENHMETARECORD, nSize, 4)
+    TEST_FIELD_SIZE  (ENHMETARECORD, dParm, 4)
+    TEST_FIELD_ALIGN (ENHMETARECORD, dParm, 4)
+    TEST_FIELD_OFFSET(ENHMETARECORD, dParm, 8)
+}
+
+static void test_pack_ENHMFENUMPROC(void)
+{
+    /* ENHMFENUMPROC */
+    TEST_TYPE_SIZE   (ENHMFENUMPROC, 8)
+    TEST_TYPE_ALIGN  (ENHMFENUMPROC, 8)
+}
+
+static void test_pack_ENUMLOGFONTA(void)
+{
+    /* ENUMLOGFONTA */
+    TEST_TYPE_SIZE   (ENUMLOGFONTA, 156)
+    TEST_TYPE_ALIGN  (ENUMLOGFONTA, 4)
+    TEST_FIELD_SIZE  (ENUMLOGFONTA, elfLogFont, 60)
+    TEST_FIELD_ALIGN (ENUMLOGFONTA, elfLogFont, 4)
+    TEST_FIELD_OFFSET(ENUMLOGFONTA, elfLogFont, 0)
+    TEST_FIELD_SIZE  (ENUMLOGFONTA, elfFullName, 64)
+    TEST_FIELD_ALIGN (ENUMLOGFONTA, elfFullName, 1)
+    TEST_FIELD_OFFSET(ENUMLOGFONTA, elfFullName, 60)
+    TEST_FIELD_SIZE  (ENUMLOGFONTA, elfStyle, 32)
+    TEST_FIELD_ALIGN (ENUMLOGFONTA, elfStyle, 1)
+    TEST_FIELD_OFFSET(ENUMLOGFONTA, elfStyle, 124)
+}
+
+static void test_pack_ENUMLOGFONTEXA(void)
+{
+    /* ENUMLOGFONTEXA */
+    TEST_TYPE_SIZE   (ENUMLOGFONTEXA, 188)
+    TEST_TYPE_ALIGN  (ENUMLOGFONTEXA, 4)
+    TEST_FIELD_SIZE  (ENUMLOGFONTEXA, elfLogFont, 60)
+    TEST_FIELD_ALIGN (ENUMLOGFONTEXA, elfLogFont, 4)
+    TEST_FIELD_OFFSET(ENUMLOGFONTEXA, elfLogFont, 0)
+    TEST_FIELD_SIZE  (ENUMLOGFONTEXA, elfFullName, 64)
+    TEST_FIELD_ALIGN (ENUMLOGFONTEXA, elfFullName, 1)
+    TEST_FIELD_OFFSET(ENUMLOGFONTEXA, elfFullName, 60)
+    TEST_FIELD_SIZE  (ENUMLOGFONTEXA, elfStyle, 32)
+    TEST_FIELD_ALIGN (ENUMLOGFONTEXA, elfStyle, 1)
+    TEST_FIELD_OFFSET(ENUMLOGFONTEXA, elfStyle, 124)
+    TEST_FIELD_SIZE  (ENUMLOGFONTEXA, elfScript, 32)
+    TEST_FIELD_ALIGN (ENUMLOGFONTEXA, elfScript, 1)
+    TEST_FIELD_OFFSET(ENUMLOGFONTEXA, elfScript, 156)
+}
+
+static void test_pack_ENUMLOGFONTEXW(void)
+{
+    /* ENUMLOGFONTEXW */
+    TEST_TYPE_SIZE   (ENUMLOGFONTEXW, 348)
+    TEST_TYPE_ALIGN  (ENUMLOGFONTEXW, 4)
+    TEST_FIELD_SIZE  (ENUMLOGFONTEXW, elfLogFont, 92)
+    TEST_FIELD_ALIGN (ENUMLOGFONTEXW, elfLogFont, 4)
+    TEST_FIELD_OFFSET(ENUMLOGFONTEXW, elfLogFont, 0)
+    TEST_FIELD_SIZE  (ENUMLOGFONTEXW, elfFullName, 128)
+    TEST_FIELD_ALIGN (ENUMLOGFONTEXW, elfFullName, 2)
+    TEST_FIELD_OFFSET(ENUMLOGFONTEXW, elfFullName, 92)
+    TEST_FIELD_SIZE  (ENUMLOGFONTEXW, elfStyle, 64)
+    TEST_FIELD_ALIGN (ENUMLOGFONTEXW, elfStyle, 2)
+    TEST_FIELD_OFFSET(ENUMLOGFONTEXW, elfStyle, 220)
+    TEST_FIELD_SIZE  (ENUMLOGFONTEXW, elfScript, 64)
+    TEST_FIELD_ALIGN (ENUMLOGFONTEXW, elfScript, 2)
+    TEST_FIELD_OFFSET(ENUMLOGFONTEXW, elfScript, 284)
+}
+
+static void test_pack_ENUMLOGFONTW(void)
+{
+    /* ENUMLOGFONTW */
+    TEST_TYPE_SIZE   (ENUMLOGFONTW, 284)
+    TEST_TYPE_ALIGN  (ENUMLOGFONTW, 4)
+    TEST_FIELD_SIZE  (ENUMLOGFONTW, elfLogFont, 92)
+    TEST_FIELD_ALIGN (ENUMLOGFONTW, elfLogFont, 4)
+    TEST_FIELD_OFFSET(ENUMLOGFONTW, elfLogFont, 0)
+    TEST_FIELD_SIZE  (ENUMLOGFONTW, elfFullName, 128)
+    TEST_FIELD_ALIGN (ENUMLOGFONTW, elfFullName, 2)
+    TEST_FIELD_OFFSET(ENUMLOGFONTW, elfFullName, 92)
+    TEST_FIELD_SIZE  (ENUMLOGFONTW, elfStyle, 64)
+    TEST_FIELD_ALIGN (ENUMLOGFONTW, elfStyle, 2)
+    TEST_FIELD_OFFSET(ENUMLOGFONTW, elfStyle, 220)
+}
+
+static void test_pack_EXTLOGFONTA(void)
+{
+    /* EXTLOGFONTA */
+    TEST_TYPE_SIZE   (EXTLOGFONTA, 192)
+    TEST_TYPE_ALIGN  (EXTLOGFONTA, 4)
+    TEST_FIELD_SIZE  (EXTLOGFONTA, elfLogFont, 60)
+    TEST_FIELD_ALIGN (EXTLOGFONTA, elfLogFont, 4)
+    TEST_FIELD_OFFSET(EXTLOGFONTA, elfLogFont, 0)
+    TEST_FIELD_SIZE  (EXTLOGFONTA, elfFullName, 64)
+    TEST_FIELD_ALIGN (EXTLOGFONTA, elfFullName, 1)
+    TEST_FIELD_OFFSET(EXTLOGFONTA, elfFullName, 60)
+    TEST_FIELD_SIZE  (EXTLOGFONTA, elfStyle, 32)
+    TEST_FIELD_ALIGN (EXTLOGFONTA, elfStyle, 1)
+    TEST_FIELD_OFFSET(EXTLOGFONTA, elfStyle, 124)
+    TEST_FIELD_SIZE  (EXTLOGFONTA, elfVersion, 4)
+    TEST_FIELD_ALIGN (EXTLOGFONTA, elfVersion, 4)
+    TEST_FIELD_OFFSET(EXTLOGFONTA, elfVersion, 156)
+    TEST_FIELD_SIZE  (EXTLOGFONTA, elfStyleSize, 4)
+    TEST_FIELD_ALIGN (EXTLOGFONTA, elfStyleSize, 4)
+    TEST_FIELD_OFFSET(EXTLOGFONTA, elfStyleSize, 160)
+    TEST_FIELD_SIZE  (EXTLOGFONTA, elfMatch, 4)
+    TEST_FIELD_ALIGN (EXTLOGFONTA, elfMatch, 4)
+    TEST_FIELD_OFFSET(EXTLOGFONTA, elfMatch, 164)
+    TEST_FIELD_SIZE  (EXTLOGFONTA, elfReserved, 4)
+    TEST_FIELD_ALIGN (EXTLOGFONTA, elfReserved, 4)
+    TEST_FIELD_OFFSET(EXTLOGFONTA, elfReserved, 168)
+    TEST_FIELD_SIZE  (EXTLOGFONTA, elfVendorId, 4)
+    TEST_FIELD_ALIGN (EXTLOGFONTA, elfVendorId, 1)
+    TEST_FIELD_OFFSET(EXTLOGFONTA, elfVendorId, 172)
+    TEST_FIELD_SIZE  (EXTLOGFONTA, elfCulture, 4)
+    TEST_FIELD_ALIGN (EXTLOGFONTA, elfCulture, 4)
+    TEST_FIELD_OFFSET(EXTLOGFONTA, elfCulture, 176)
+    TEST_FIELD_SIZE  (EXTLOGFONTA, elfPanose, 10)
+    TEST_FIELD_ALIGN (EXTLOGFONTA, elfPanose, 1)
+    TEST_FIELD_OFFSET(EXTLOGFONTA, elfPanose, 180)
+}
+
+static void test_pack_EXTLOGFONTW(void)
+{
+    /* EXTLOGFONTW */
+    TEST_TYPE_SIZE   (EXTLOGFONTW, 320)
+    TEST_TYPE_ALIGN  (EXTLOGFONTW, 4)
+    TEST_FIELD_SIZE  (EXTLOGFONTW, elfLogFont, 92)
+    TEST_FIELD_ALIGN (EXTLOGFONTW, elfLogFont, 4)
+    TEST_FIELD_OFFSET(EXTLOGFONTW, elfLogFont, 0)
+    TEST_FIELD_SIZE  (EXTLOGFONTW, elfFullName, 128)
+    TEST_FIELD_ALIGN (EXTLOGFONTW, elfFullName, 2)
+    TEST_FIELD_OFFSET(EXTLOGFONTW, elfFullName, 92)
+    TEST_FIELD_SIZE  (EXTLOGFONTW, elfStyle, 64)
+    TEST_FIELD_ALIGN (EXTLOGFONTW, elfStyle, 2)
+    TEST_FIELD_OFFSET(EXTLOGFONTW, elfStyle, 220)
+    TEST_FIELD_SIZE  (EXTLOGFONTW, elfVersion, 4)
+    TEST_FIELD_ALIGN (EXTLOGFONTW, elfVersion, 4)
+    TEST_FIELD_OFFSET(EXTLOGFONTW, elfVersion, 284)
+    TEST_FIELD_SIZE  (EXTLOGFONTW, elfStyleSize, 4)
+    TEST_FIELD_ALIGN (EXTLOGFONTW, elfStyleSize, 4)
+    TEST_FIELD_OFFSET(EXTLOGFONTW, elfStyleSize, 288)
+    TEST_FIELD_SIZE  (EXTLOGFONTW, elfMatch, 4)
+    TEST_FIELD_ALIGN (EXTLOGFONTW, elfMatch, 4)
+    TEST_FIELD_OFFSET(EXTLOGFONTW, elfMatch, 292)
+    TEST_FIELD_SIZE  (EXTLOGFONTW, elfReserved, 4)
+    TEST_FIELD_ALIGN (EXTLOGFONTW, elfReserved, 4)
+    TEST_FIELD_OFFSET(EXTLOGFONTW, elfReserved, 296)
+    TEST_FIELD_SIZE  (EXTLOGFONTW, elfVendorId, 4)
+    TEST_FIELD_ALIGN (EXTLOGFONTW, elfVendorId, 1)
+    TEST_FIELD_OFFSET(EXTLOGFONTW, elfVendorId, 300)
+    TEST_FIELD_SIZE  (EXTLOGFONTW, elfCulture, 4)
+    TEST_FIELD_ALIGN (EXTLOGFONTW, elfCulture, 4)
+    TEST_FIELD_OFFSET(EXTLOGFONTW, elfCulture, 304)
+    TEST_FIELD_SIZE  (EXTLOGFONTW, elfPanose, 10)
+    TEST_FIELD_ALIGN (EXTLOGFONTW, elfPanose, 1)
+    TEST_FIELD_OFFSET(EXTLOGFONTW, elfPanose, 308)
+}
+
+static void test_pack_EXTLOGPEN(void)
+{
+    /* EXTLOGPEN */
+    TEST_TYPE_SIZE   (EXTLOGPEN, 32)
+    TEST_TYPE_ALIGN  (EXTLOGPEN, 8)
+    TEST_FIELD_SIZE  (EXTLOGPEN, elpPenStyle, 4)
+    TEST_FIELD_ALIGN (EXTLOGPEN, elpPenStyle, 4)
+    TEST_FIELD_OFFSET(EXTLOGPEN, elpPenStyle, 0)
+    TEST_FIELD_SIZE  (EXTLOGPEN, elpWidth, 4)
+    TEST_FIELD_ALIGN (EXTLOGPEN, elpWidth, 4)
+    TEST_FIELD_OFFSET(EXTLOGPEN, elpWidth, 4)
+    TEST_FIELD_SIZE  (EXTLOGPEN, elpBrushStyle, 4)
+    TEST_FIELD_ALIGN (EXTLOGPEN, elpBrushStyle, 4)
+    TEST_FIELD_OFFSET(EXTLOGPEN, elpBrushStyle, 8)
+    TEST_FIELD_SIZE  (EXTLOGPEN, elpColor, 4)
+    TEST_FIELD_ALIGN (EXTLOGPEN, elpColor, 4)
+    TEST_FIELD_OFFSET(EXTLOGPEN, elpColor, 12)
+    TEST_FIELD_SIZE  (EXTLOGPEN, elpHatch, 8)
+    TEST_FIELD_ALIGN (EXTLOGPEN, elpHatch, 8)
+    TEST_FIELD_OFFSET(EXTLOGPEN, elpHatch, 16)
+    TEST_FIELD_SIZE  (EXTLOGPEN, elpNumEntries, 4)
+    TEST_FIELD_ALIGN (EXTLOGPEN, elpNumEntries, 4)
+    TEST_FIELD_OFFSET(EXTLOGPEN, elpNumEntries, 24)
+    TEST_FIELD_SIZE  (EXTLOGPEN, elpStyleEntry, 4)
+    TEST_FIELD_ALIGN (EXTLOGPEN, elpStyleEntry, 4)
+    TEST_FIELD_OFFSET(EXTLOGPEN, elpStyleEntry, 28)
+}
+
+static void test_pack_FIXED(void)
+{
+    /* FIXED */
+    TEST_TYPE_SIZE   (FIXED, 4)
+    TEST_TYPE_ALIGN  (FIXED, 2)
+    TEST_FIELD_SIZE  (FIXED, fract, 2)
+    TEST_FIELD_ALIGN (FIXED, fract, 2)
+    TEST_FIELD_OFFSET(FIXED, fract, 0)
+    TEST_FIELD_SIZE  (FIXED, value, 2)
+    TEST_FIELD_ALIGN (FIXED, value, 2)
+    TEST_FIELD_OFFSET(FIXED, value, 2)
+}
+
+static void test_pack_FONTENUMPROCA(void)
+{
+    /* FONTENUMPROCA */
+    TEST_TYPE_SIZE   (FONTENUMPROCA, 8)
+    TEST_TYPE_ALIGN  (FONTENUMPROCA, 8)
+}
+
+static void test_pack_FONTENUMPROCW(void)
+{
+    /* FONTENUMPROCW */
+    TEST_TYPE_SIZE   (FONTENUMPROCW, 8)
+    TEST_TYPE_ALIGN  (FONTENUMPROCW, 8)
+}
+
+static void test_pack_FONTSIGNATURE(void)
+{
+    /* FONTSIGNATURE */
+    TEST_TYPE_SIZE   (FONTSIGNATURE, 24)
+    TEST_TYPE_ALIGN  (FONTSIGNATURE, 4)
+    TEST_FIELD_SIZE  (FONTSIGNATURE, fsUsb, 16)
+    TEST_FIELD_ALIGN (FONTSIGNATURE, fsUsb, 4)
+    TEST_FIELD_OFFSET(FONTSIGNATURE, fsUsb, 0)
+    TEST_FIELD_SIZE  (FONTSIGNATURE, fsCsb, 8)
+    TEST_FIELD_ALIGN (FONTSIGNATURE, fsCsb, 4)
+    TEST_FIELD_OFFSET(FONTSIGNATURE, fsCsb, 16)
+}
+
+static void test_pack_FXPT16DOT16(void)
+{
+    /* FXPT16DOT16 */
+    TEST_TYPE_SIZE   (FXPT16DOT16, 4)
+    TEST_TYPE_ALIGN  (FXPT16DOT16, 4)
+}
+
+static void test_pack_FXPT2DOT30(void)
+{
+    /* FXPT2DOT30 */
+    TEST_TYPE_SIZE   (FXPT2DOT30, 4)
+    TEST_TYPE_ALIGN  (FXPT2DOT30, 4)
+}
+
+static void test_pack_GCP_RESULTSA(void)
+{
+    /* GCP_RESULTSA */
+    TEST_TYPE_SIZE   (GCP_RESULTSA, 64)
+    TEST_TYPE_ALIGN  (GCP_RESULTSA, 8)
+    TEST_FIELD_SIZE  (GCP_RESULTSA, lStructSize, 4)
+    TEST_FIELD_ALIGN (GCP_RESULTSA, lStructSize, 4)
+    TEST_FIELD_OFFSET(GCP_RESULTSA, lStructSize, 0)
+    TEST_FIELD_SIZE  (GCP_RESULTSA, lpOutString, 8)
+    TEST_FIELD_ALIGN (GCP_RESULTSA, lpOutString, 8)
+    TEST_FIELD_OFFSET(GCP_RESULTSA, lpOutString, 8)
+    TEST_FIELD_SIZE  (GCP_RESULTSA, lpOrder, 8)
+    TEST_FIELD_ALIGN (GCP_RESULTSA, lpOrder, 8)
+    TEST_FIELD_OFFSET(GCP_RESULTSA, lpOrder, 16)
+    TEST_FIELD_SIZE  (GCP_RESULTSA, lpDx, 8)
+    TEST_FIELD_ALIGN (GCP_RESULTSA, lpDx, 8)
+    TEST_FIELD_OFFSET(GCP_RESULTSA, lpDx, 24)
+    TEST_FIELD_SIZE  (GCP_RESULTSA, lpCaretPos, 8)
+    TEST_FIELD_ALIGN (GCP_RESULTSA, lpCaretPos, 8)
+    TEST_FIELD_OFFSET(GCP_RESULTSA, lpCaretPos, 32)
+    TEST_FIELD_SIZE  (GCP_RESULTSA, lpClass, 8)
+    TEST_FIELD_ALIGN (GCP_RESULTSA, lpClass, 8)
+    TEST_FIELD_OFFSET(GCP_RESULTSA, lpClass, 40)
+    TEST_FIELD_SIZE  (GCP_RESULTSA, lpGlyphs, 8)
+    TEST_FIELD_ALIGN (GCP_RESULTSA, lpGlyphs, 8)
+    TEST_FIELD_OFFSET(GCP_RESULTSA, lpGlyphs, 48)
+    TEST_FIELD_SIZE  (GCP_RESULTSA, nGlyphs, 4)
+    TEST_FIELD_ALIGN (GCP_RESULTSA, nGlyphs, 4)
+    TEST_FIELD_OFFSET(GCP_RESULTSA, nGlyphs, 56)
+    TEST_FIELD_SIZE  (GCP_RESULTSA, nMaxFit, 4)
+    TEST_FIELD_ALIGN (GCP_RESULTSA, nMaxFit, 4)
+    TEST_FIELD_OFFSET(GCP_RESULTSA, nMaxFit, 60)
+}
+
+static void test_pack_GCP_RESULTSW(void)
+{
+    /* GCP_RESULTSW */
+    TEST_TYPE_SIZE   (GCP_RESULTSW, 64)
+    TEST_TYPE_ALIGN  (GCP_RESULTSW, 8)
+    TEST_FIELD_SIZE  (GCP_RESULTSW, lStructSize, 4)
+    TEST_FIELD_ALIGN (GCP_RESULTSW, lStructSize, 4)
+    TEST_FIELD_OFFSET(GCP_RESULTSW, lStructSize, 0)
+    TEST_FIELD_SIZE  (GCP_RESULTSW, lpOutString, 8)
+    TEST_FIELD_ALIGN (GCP_RESULTSW, lpOutString, 8)
+    TEST_FIELD_OFFSET(GCP_RESULTSW, lpOutString, 8)
+    TEST_FIELD_SIZE  (GCP_RESULTSW, lpOrder, 8)
+    TEST_FIELD_ALIGN (GCP_RESULTSW, lpOrder, 8)
+    TEST_FIELD_OFFSET(GCP_RESULTSW, lpOrder, 16)
+    TEST_FIELD_SIZE  (GCP_RESULTSW, lpDx, 8)
+    TEST_FIELD_ALIGN (GCP_RESULTSW, lpDx, 8)
+    TEST_FIELD_OFFSET(GCP_RESULTSW, lpDx, 24)
+    TEST_FIELD_SIZE  (GCP_RESULTSW, lpCaretPos, 8)
+    TEST_FIELD_ALIGN (GCP_RESULTSW, lpCaretPos, 8)
+    TEST_FIELD_OFFSET(GCP_RESULTSW, lpCaretPos, 32)
+    TEST_FIELD_SIZE  (GCP_RESULTSW, lpClass, 8)
+    TEST_FIELD_ALIGN (GCP_RESULTSW, lpClass, 8)
+    TEST_FIELD_OFFSET(GCP_RESULTSW, lpClass, 40)
+    TEST_FIELD_SIZE  (GCP_RESULTSW, lpGlyphs, 8)
+    TEST_FIELD_ALIGN (GCP_RESULTSW, lpGlyphs, 8)
+    TEST_FIELD_OFFSET(GCP_RESULTSW, lpGlyphs, 48)
+    TEST_FIELD_SIZE  (GCP_RESULTSW, nGlyphs, 4)
+    TEST_FIELD_ALIGN (GCP_RESULTSW, nGlyphs, 4)
+    TEST_FIELD_OFFSET(GCP_RESULTSW, nGlyphs, 56)
+    TEST_FIELD_SIZE  (GCP_RESULTSW, nMaxFit, 4)
+    TEST_FIELD_ALIGN (GCP_RESULTSW, nMaxFit, 4)
+    TEST_FIELD_OFFSET(GCP_RESULTSW, nMaxFit, 60)
+}
+
+static void test_pack_GLYPHMETRICS(void)
+{
+    /* GLYPHMETRICS */
+    TEST_TYPE_SIZE   (GLYPHMETRICS, 20)
+    TEST_TYPE_ALIGN  (GLYPHMETRICS, 4)
+    TEST_FIELD_SIZE  (GLYPHMETRICS, gmBlackBoxX, 4)
+    TEST_FIELD_ALIGN (GLYPHMETRICS, gmBlackBoxX, 4)
+    TEST_FIELD_OFFSET(GLYPHMETRICS, gmBlackBoxX, 0)
+    TEST_FIELD_SIZE  (GLYPHMETRICS, gmBlackBoxY, 4)
+    TEST_FIELD_ALIGN (GLYPHMETRICS, gmBlackBoxY, 4)
+    TEST_FIELD_OFFSET(GLYPHMETRICS, gmBlackBoxY, 4)
+    TEST_FIELD_SIZE  (GLYPHMETRICS, gmptGlyphOrigin, 8)
+    TEST_FIELD_ALIGN (GLYPHMETRICS, gmptGlyphOrigin, 4)
+    TEST_FIELD_OFFSET(GLYPHMETRICS, gmptGlyphOrigin, 8)
+    TEST_FIELD_SIZE  (GLYPHMETRICS, gmCellIncX, 2)
+    TEST_FIELD_ALIGN (GLYPHMETRICS, gmCellIncX, 2)
+    TEST_FIELD_OFFSET(GLYPHMETRICS, gmCellIncX, 16)
+    TEST_FIELD_SIZE  (GLYPHMETRICS, gmCellIncY, 2)
+    TEST_FIELD_ALIGN (GLYPHMETRICS, gmCellIncY, 2)
+    TEST_FIELD_OFFSET(GLYPHMETRICS, gmCellIncY, 18)
+}
+
+static void test_pack_GLYPHMETRICSFLOAT(void)
+{
+    /* GLYPHMETRICSFLOAT */
+    TEST_TYPE_SIZE   (GLYPHMETRICSFLOAT, 24)
+    TEST_TYPE_ALIGN  (GLYPHMETRICSFLOAT, 4)
+    TEST_FIELD_SIZE  (GLYPHMETRICSFLOAT, gmfBlackBoxX, 4)
+    TEST_FIELD_ALIGN (GLYPHMETRICSFLOAT, gmfBlackBoxX, 4)
+    TEST_FIELD_OFFSET(GLYPHMETRICSFLOAT, gmfBlackBoxX, 0)
+    TEST_FIELD_SIZE  (GLYPHMETRICSFLOAT, gmfBlackBoxY, 4)
+    TEST_FIELD_ALIGN (GLYPHMETRICSFLOAT, gmfBlackBoxY, 4)
+    TEST_FIELD_OFFSET(GLYPHMETRICSFLOAT, gmfBlackBoxY, 4)
+    TEST_FIELD_SIZE  (GLYPHMETRICSFLOAT, gmfptGlyphOrigin, 8)
+    TEST_FIELD_ALIGN (GLYPHMETRICSFLOAT, gmfptGlyphOrigin, 4)
+    TEST_FIELD_OFFSET(GLYPHMETRICSFLOAT, gmfptGlyphOrigin, 8)
+    TEST_FIELD_SIZE  (GLYPHMETRICSFLOAT, gmfCellIncX, 4)
+    TEST_FIELD_ALIGN (GLYPHMETRICSFLOAT, gmfCellIncX, 4)
+    TEST_FIELD_OFFSET(GLYPHMETRICSFLOAT, gmfCellIncX, 16)
+    TEST_FIELD_SIZE  (GLYPHMETRICSFLOAT, gmfCellIncY, 4)
+    TEST_FIELD_ALIGN (GLYPHMETRICSFLOAT, gmfCellIncY, 4)
+    TEST_FIELD_OFFSET(GLYPHMETRICSFLOAT, gmfCellIncY, 20)
+}
+
+static void test_pack_GOBJENUMPROC(void)
+{
+    /* GOBJENUMPROC */
+    TEST_TYPE_SIZE   (GOBJENUMPROC, 8)
+    TEST_TYPE_ALIGN  (GOBJENUMPROC, 8)
+}
+
+static void test_pack_GRADIENT_RECT(void)
+{
+    /* GRADIENT_RECT */
+    TEST_TYPE_SIZE   (GRADIENT_RECT, 8)
+    TEST_TYPE_ALIGN  (GRADIENT_RECT, 4)
+    TEST_FIELD_SIZE  (GRADIENT_RECT, UpperLeft, 4)
+    TEST_FIELD_ALIGN (GRADIENT_RECT, UpperLeft, 4)
+    TEST_FIELD_OFFSET(GRADIENT_RECT, UpperLeft, 0)
+    TEST_FIELD_SIZE  (GRADIENT_RECT, LowerRight, 4)
+    TEST_FIELD_ALIGN (GRADIENT_RECT, LowerRight, 4)
+    TEST_FIELD_OFFSET(GRADIENT_RECT, LowerRight, 4)
+}
+
+static void test_pack_GRADIENT_TRIANGLE(void)
+{
+    /* GRADIENT_TRIANGLE */
+    TEST_TYPE_SIZE   (GRADIENT_TRIANGLE, 12)
+    TEST_TYPE_ALIGN  (GRADIENT_TRIANGLE, 4)
+    TEST_FIELD_SIZE  (GRADIENT_TRIANGLE, Vertex1, 4)
+    TEST_FIELD_ALIGN (GRADIENT_TRIANGLE, Vertex1, 4)
+    TEST_FIELD_OFFSET(GRADIENT_TRIANGLE, Vertex1, 0)
+    TEST_FIELD_SIZE  (GRADIENT_TRIANGLE, Vertex2, 4)
+    TEST_FIELD_ALIGN (GRADIENT_TRIANGLE, Vertex2, 4)
+    TEST_FIELD_OFFSET(GRADIENT_TRIANGLE, Vertex2, 4)
+    TEST_FIELD_SIZE  (GRADIENT_TRIANGLE, Vertex3, 4)
+    TEST_FIELD_ALIGN (GRADIENT_TRIANGLE, Vertex3, 4)
+    TEST_FIELD_OFFSET(GRADIENT_TRIANGLE, Vertex3, 8)
+}
+
+static void test_pack_HANDLETABLE(void)
+{
+    /* HANDLETABLE */
+    TEST_TYPE_SIZE   (HANDLETABLE, 8)
+    TEST_TYPE_ALIGN  (HANDLETABLE, 8)
+    TEST_FIELD_SIZE  (HANDLETABLE, objectHandle, 8)
+    TEST_FIELD_ALIGN (HANDLETABLE, objectHandle, 8)
+    TEST_FIELD_OFFSET(HANDLETABLE, objectHandle, 0)
+}
+
+static void test_pack_ICMENUMPROCA(void)
+{
+    /* ICMENUMPROCA */
+    TEST_TYPE_SIZE   (ICMENUMPROCA, 8)
+    TEST_TYPE_ALIGN  (ICMENUMPROCA, 8)
+}
+
+static void test_pack_ICMENUMPROCW(void)
+{
+    /* ICMENUMPROCW */
+    TEST_TYPE_SIZE   (ICMENUMPROCW, 8)
+    TEST_TYPE_ALIGN  (ICMENUMPROCW, 8)
+}
+
+static void test_pack_KERNINGPAIR(void)
+{
+    /* KERNINGPAIR */
+    TEST_TYPE_SIZE   (KERNINGPAIR, 8)
+    TEST_TYPE_ALIGN  (KERNINGPAIR, 4)
+    TEST_FIELD_SIZE  (KERNINGPAIR, wFirst, 2)
+    TEST_FIELD_ALIGN (KERNINGPAIR, wFirst, 2)
+    TEST_FIELD_OFFSET(KERNINGPAIR, wFirst, 0)
+    TEST_FIELD_SIZE  (KERNINGPAIR, wSecond, 2)
+    TEST_FIELD_ALIGN (KERNINGPAIR, wSecond, 2)
+    TEST_FIELD_OFFSET(KERNINGPAIR, wSecond, 2)
+    TEST_FIELD_SIZE  (KERNINGPAIR, iKernAmount, 4)
+    TEST_FIELD_ALIGN (KERNINGPAIR, iKernAmount, 4)
+    TEST_FIELD_OFFSET(KERNINGPAIR, iKernAmount, 4)
+}
+
+static void test_pack_LAYERPLANEDESCRIPTOR(void)
+{
+    /* LAYERPLANEDESCRIPTOR */
+    TEST_TYPE_SIZE   (LAYERPLANEDESCRIPTOR, 32)
+    TEST_TYPE_ALIGN  (LAYERPLANEDESCRIPTOR, 4)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, nSize, 2)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, nSize, 2)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, nSize, 0)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, nVersion, 2)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, nVersion, 2)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, nVersion, 2)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, dwFlags, 4)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, dwFlags, 4)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, dwFlags, 4)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, iPixelType, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, iPixelType, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, iPixelType, 8)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cColorBits, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cColorBits, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cColorBits, 9)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cRedBits, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cRedBits, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cRedBits, 10)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cRedShift, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cRedShift, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cRedShift, 11)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cGreenBits, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cGreenBits, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cGreenBits, 12)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cGreenShift, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cGreenShift, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cGreenShift, 13)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cBlueBits, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cBlueBits, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cBlueBits, 14)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cBlueShift, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cBlueShift, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cBlueShift, 15)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cAlphaBits, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cAlphaBits, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cAlphaBits, 16)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cAlphaShift, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cAlphaShift, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cAlphaShift, 17)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cAccumBits, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cAccumBits, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cAccumBits, 18)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cAccumRedBits, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cAccumRedBits, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cAccumRedBits, 19)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cAccumGreenBits, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cAccumGreenBits, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cAccumGreenBits, 20)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cAccumBlueBits, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cAccumBlueBits, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cAccumBlueBits, 21)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cAccumAlphaBits, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cAccumAlphaBits, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cAccumAlphaBits, 22)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cDepthBits, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cDepthBits, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cDepthBits, 23)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cStencilBits, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cStencilBits, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cStencilBits, 24)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, cAuxBuffers, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, cAuxBuffers, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, cAuxBuffers, 25)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, iLayerPlane, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, iLayerPlane, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, iLayerPlane, 26)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, bReserved, 1)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, bReserved, 1)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, bReserved, 27)
+    TEST_FIELD_SIZE  (LAYERPLANEDESCRIPTOR, crTransparent, 4)
+    TEST_FIELD_ALIGN (LAYERPLANEDESCRIPTOR, crTransparent, 4)
+    TEST_FIELD_OFFSET(LAYERPLANEDESCRIPTOR, crTransparent, 28)
+}
+
+static void test_pack_LCSCSTYPE(void)
+{
+    /* LCSCSTYPE */
+    TEST_TYPE_SIZE   (LCSCSTYPE, 4)
+    TEST_TYPE_ALIGN  (LCSCSTYPE, 4)
+}
+
+static void test_pack_LCSGAMUTMATCH(void)
+{
+    /* LCSGAMUTMATCH */
+    TEST_TYPE_SIZE   (LCSGAMUTMATCH, 4)
+    TEST_TYPE_ALIGN  (LCSGAMUTMATCH, 4)
+}
+
+static void test_pack_LINEDDAPROC(void)
+{
+    /* LINEDDAPROC */
+    TEST_TYPE_SIZE   (LINEDDAPROC, 8)
+    TEST_TYPE_ALIGN  (LINEDDAPROC, 8)
+}
+
+static void test_pack_LOCALESIGNATURE(void)
+{
+    /* LOCALESIGNATURE */
+    TEST_TYPE_SIZE   (LOCALESIGNATURE, 32)
+    TEST_TYPE_ALIGN  (LOCALESIGNATURE, 4)
+    TEST_FIELD_SIZE  (LOCALESIGNATURE, lsUsb, 16)
+    TEST_FIELD_ALIGN (LOCALESIGNATURE, lsUsb, 4)
+    TEST_FIELD_OFFSET(LOCALESIGNATURE, lsUsb, 0)
+    TEST_FIELD_SIZE  (LOCALESIGNATURE, lsCsbDefault, 8)
+    TEST_FIELD_ALIGN (LOCALESIGNATURE, lsCsbDefault, 4)
+    TEST_FIELD_OFFSET(LOCALESIGNATURE, lsCsbDefault, 16)
+    TEST_FIELD_SIZE  (LOCALESIGNATURE, lsCsbSupported, 8)
+    TEST_FIELD_ALIGN (LOCALESIGNATURE, lsCsbSupported, 4)
+    TEST_FIELD_OFFSET(LOCALESIGNATURE, lsCsbSupported, 24)
+}
+
+static void test_pack_LOGBRUSH(void)
+{
+    /* LOGBRUSH */
+    TEST_TYPE_SIZE   (LOGBRUSH, 16)
+    TEST_TYPE_ALIGN  (LOGBRUSH, 8)
+    TEST_FIELD_SIZE  (LOGBRUSH, lbStyle, 4)
+    TEST_FIELD_ALIGN (LOGBRUSH, lbStyle, 4)
+    TEST_FIELD_OFFSET(LOGBRUSH, lbStyle, 0)
+    TEST_FIELD_SIZE  (LOGBRUSH, lbColor, 4)
+    TEST_FIELD_ALIGN (LOGBRUSH, lbColor, 4)
+    TEST_FIELD_OFFSET(LOGBRUSH, lbColor, 4)
+    TEST_FIELD_SIZE  (LOGBRUSH, lbHatch, 8)
+    TEST_FIELD_ALIGN (LOGBRUSH, lbHatch, 8)
+    TEST_FIELD_OFFSET(LOGBRUSH, lbHatch, 8)
+}
+
+static void test_pack_LOGCOLORSPACEA(void)
+{
+    /* LOGCOLORSPACEA */
+    TEST_TYPE_SIZE   (LOGCOLORSPACEA, 328)
+    TEST_TYPE_ALIGN  (LOGCOLORSPACEA, 4)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEA, lcsSignature, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEA, lcsSignature, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEA, lcsSignature, 0)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEA, lcsVersion, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEA, lcsVersion, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEA, lcsVersion, 4)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEA, lcsSize, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEA, lcsSize, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEA, lcsSize, 8)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEA, lcsCSType, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEA, lcsCSType, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEA, lcsCSType, 12)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEA, lcsIntent, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEA, lcsIntent, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEA, lcsIntent, 16)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEA, lcsEndpoints, 36)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEA, lcsEndpoints, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEA, lcsEndpoints, 20)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEA, lcsGammaRed, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEA, lcsGammaRed, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEA, lcsGammaRed, 56)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEA, lcsGammaGreen, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEA, lcsGammaGreen, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEA, lcsGammaGreen, 60)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEA, lcsGammaBlue, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEA, lcsGammaBlue, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEA, lcsGammaBlue, 64)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEA, lcsFilename, 260)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEA, lcsFilename, 1)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEA, lcsFilename, 68)
+}
+
+static void test_pack_LOGCOLORSPACEW(void)
+{
+    /* LOGCOLORSPACEW */
+    TEST_TYPE_SIZE   (LOGCOLORSPACEW, 588)
+    TEST_TYPE_ALIGN  (LOGCOLORSPACEW, 4)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEW, lcsSignature, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEW, lcsSignature, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEW, lcsSignature, 0)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEW, lcsVersion, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEW, lcsVersion, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEW, lcsVersion, 4)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEW, lcsSize, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEW, lcsSize, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEW, lcsSize, 8)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEW, lcsCSType, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEW, lcsCSType, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEW, lcsCSType, 12)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEW, lcsIntent, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEW, lcsIntent, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEW, lcsIntent, 16)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEW, lcsEndpoints, 36)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEW, lcsEndpoints, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEW, lcsEndpoints, 20)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEW, lcsGammaRed, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEW, lcsGammaRed, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEW, lcsGammaRed, 56)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEW, lcsGammaGreen, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEW, lcsGammaGreen, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEW, lcsGammaGreen, 60)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEW, lcsGammaBlue, 4)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEW, lcsGammaBlue, 4)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEW, lcsGammaBlue, 64)
+    TEST_FIELD_SIZE  (LOGCOLORSPACEW, lcsFilename, 520)
+    TEST_FIELD_ALIGN (LOGCOLORSPACEW, lcsFilename, 2)
+    TEST_FIELD_OFFSET(LOGCOLORSPACEW, lcsFilename, 68)
+}
+
+static void test_pack_LOGFONTA(void)
+{
+    /* LOGFONTA */
+    TEST_TYPE_SIZE   (LOGFONTA, 60)
+    TEST_TYPE_ALIGN  (LOGFONTA, 4)
+    TEST_FIELD_SIZE  (LOGFONTA, lfHeight, 4)
+    TEST_FIELD_ALIGN (LOGFONTA, lfHeight, 4)
+    TEST_FIELD_OFFSET(LOGFONTA, lfHeight, 0)
+    TEST_FIELD_SIZE  (LOGFONTA, lfWidth, 4)
+    TEST_FIELD_ALIGN (LOGFONTA, lfWidth, 4)
+    TEST_FIELD_OFFSET(LOGFONTA, lfWidth, 4)
+    TEST_FIELD_SIZE  (LOGFONTA, lfEscapement, 4)
+    TEST_FIELD_ALIGN (LOGFONTA, lfEscapement, 4)
+    TEST_FIELD_OFFSET(LOGFONTA, lfEscapement, 8)
+    TEST_FIELD_SIZE  (LOGFONTA, lfOrientation, 4)
+    TEST_FIELD_ALIGN (LOGFONTA, lfOrientation, 4)
+    TEST_FIELD_OFFSET(LOGFONTA, lfOrientation, 12)
+    TEST_FIELD_SIZE  (LOGFONTA, lfWeight, 4)
+    TEST_FIELD_ALIGN (LOGFONTA, lfWeight, 4)
+    TEST_FIELD_OFFSET(LOGFONTA, lfWeight, 16)
+    TEST_FIELD_SIZE  (LOGFONTA, lfItalic, 1)
+    TEST_FIELD_ALIGN (LOGFONTA, lfItalic, 1)
+    TEST_FIELD_OFFSET(LOGFONTA, lfItalic, 20)
+    TEST_FIELD_SIZE  (LOGFONTA, lfUnderline, 1)
+    TEST_FIELD_ALIGN (LOGFONTA, lfUnderline, 1)
+    TEST_FIELD_OFFSET(LOGFONTA, lfUnderline, 21)
+    TEST_FIELD_SIZE  (LOGFONTA, lfStrikeOut, 1)
+    TEST_FIELD_ALIGN (LOGFONTA, lfStrikeOut, 1)
+    TEST_FIELD_OFFSET(LOGFONTA, lfStrikeOut, 22)
+    TEST_FIELD_SIZE  (LOGFONTA, lfCharSet, 1)
+    TEST_FIELD_ALIGN (LOGFONTA, lfCharSet, 1)
+    TEST_FIELD_OFFSET(LOGFONTA, lfCharSet, 23)
+    TEST_FIELD_SIZE  (LOGFONTA, lfOutPrecision, 1)
+    TEST_FIELD_ALIGN (LOGFONTA, lfOutPrecision, 1)
+    TEST_FIELD_OFFSET(LOGFONTA, lfOutPrecision, 24)
+    TEST_FIELD_SIZE  (LOGFONTA, lfClipPrecision, 1)
+    TEST_FIELD_ALIGN (LOGFONTA, lfClipPrecision, 1)
+    TEST_FIELD_OFFSET(LOGFONTA, lfClipPrecision, 25)
+    TEST_FIELD_SIZE  (LOGFONTA, lfQuality, 1)
+    TEST_FIELD_ALIGN (LOGFONTA, lfQuality, 1)
+    TEST_FIELD_OFFSET(LOGFONTA, lfQuality, 26)
+    TEST_FIELD_SIZE  (LOGFONTA, lfPitchAndFamily, 1)
+    TEST_FIELD_ALIGN (LOGFONTA, lfPitchAndFamily, 1)
+    TEST_FIELD_OFFSET(LOGFONTA, lfPitchAndFamily, 27)
+    TEST_FIELD_SIZE  (LOGFONTA, lfFaceName, 32)
+    TEST_FIELD_ALIGN (LOGFONTA, lfFaceName, 1)
+    TEST_FIELD_OFFSET(LOGFONTA, lfFaceName, 28)
+}
+
+static void test_pack_LOGFONTW(void)
+{
+    /* LOGFONTW */
+    TEST_TYPE_SIZE   (LOGFONTW, 92)
+    TEST_TYPE_ALIGN  (LOGFONTW, 4)
+    TEST_FIELD_SIZE  (LOGFONTW, lfHeight, 4)
+    TEST_FIELD_ALIGN (LOGFONTW, lfHeight, 4)
+    TEST_FIELD_OFFSET(LOGFONTW, lfHeight, 0)
+    TEST_FIELD_SIZE  (LOGFONTW, lfWidth, 4)
+    TEST_FIELD_ALIGN (LOGFONTW, lfWidth, 4)
+    TEST_FIELD_OFFSET(LOGFONTW, lfWidth, 4)
+    TEST_FIELD_SIZE  (LOGFONTW, lfEscapement, 4)
+    TEST_FIELD_ALIGN (LOGFONTW, lfEscapement, 4)
+    TEST_FIELD_OFFSET(LOGFONTW, lfEscapement, 8)
+    TEST_FIELD_SIZE  (LOGFONTW, lfOrientation, 4)
+    TEST_FIELD_ALIGN (LOGFONTW, lfOrientation, 4)
+    TEST_FIELD_OFFSET(LOGFONTW, lfOrientation, 12)
+    TEST_FIELD_SIZE  (LOGFONTW, lfWeight, 4)
+    TEST_FIELD_ALIGN (LOGFONTW, lfWeight, 4)
+    TEST_FIELD_OFFSET(LOGFONTW, lfWeight, 16)
+    TEST_FIELD_SIZE  (LOGFONTW, lfItalic, 1)
+    TEST_FIELD_ALIGN (LOGFONTW, lfItalic, 1)
+    TEST_FIELD_OFFSET(LOGFONTW, lfItalic, 20)
+    TEST_FIELD_SIZE  (LOGFONTW, lfUnderline, 1)
+    TEST_FIELD_ALIGN (LOGFONTW, lfUnderline, 1)
+    TEST_FIELD_OFFSET(LOGFONTW, lfUnderline, 21)
+    TEST_FIELD_SIZE  (LOGFONTW, lfStrikeOut, 1)
+    TEST_FIELD_ALIGN (LOGFONTW, lfStrikeOut, 1)
+    TEST_FIELD_OFFSET(LOGFONTW, lfStrikeOut, 22)
+    TEST_FIELD_SIZE  (LOGFONTW, lfCharSet, 1)
+    TEST_FIELD_ALIGN (LOGFONTW, lfCharSet, 1)
+    TEST_FIELD_OFFSET(LOGFONTW, lfCharSet, 23)
+    TEST_FIELD_SIZE  (LOGFONTW, lfOutPrecision, 1)
+    TEST_FIELD_ALIGN (LOGFONTW, lfOutPrecision, 1)
+    TEST_FIELD_OFFSET(LOGFONTW, lfOutPrecision, 24)
+    TEST_FIELD_SIZE  (LOGFONTW, lfClipPrecision, 1)
+    TEST_FIELD_ALIGN (LOGFONTW, lfClipPrecision, 1)
+    TEST_FIELD_OFFSET(LOGFONTW, lfClipPrecision, 25)
+    TEST_FIELD_SIZE  (LOGFONTW, lfQuality, 1)
+    TEST_FIELD_ALIGN (LOGFONTW, lfQuality, 1)
+    TEST_FIELD_OFFSET(LOGFONTW, lfQuality, 26)
+    TEST_FIELD_SIZE  (LOGFONTW, lfPitchAndFamily, 1)
+    TEST_FIELD_ALIGN (LOGFONTW, lfPitchAndFamily, 1)
+    TEST_FIELD_OFFSET(LOGFONTW, lfPitchAndFamily, 27)
+    TEST_FIELD_SIZE  (LOGFONTW, lfFaceName, 64)
+    TEST_FIELD_ALIGN (LOGFONTW, lfFaceName, 2)
+    TEST_FIELD_OFFSET(LOGFONTW, lfFaceName, 28)
+}
+
+static void test_pack_LOGPEN(void)
+{
+    /* LOGPEN */
+    TEST_TYPE_SIZE   (LOGPEN, 16)
+    TEST_TYPE_ALIGN  (LOGPEN, 4)
+    TEST_FIELD_SIZE  (LOGPEN, lopnStyle, 4)
+    TEST_FIELD_ALIGN (LOGPEN, lopnStyle, 4)
+    TEST_FIELD_OFFSET(LOGPEN, lopnStyle, 0)
+    TEST_FIELD_SIZE  (LOGPEN, lopnWidth, 8)
+    TEST_FIELD_ALIGN (LOGPEN, lopnWidth, 4)
+    TEST_FIELD_OFFSET(LOGPEN, lopnWidth, 4)
+    TEST_FIELD_SIZE  (LOGPEN, lopnColor, 4)
+    TEST_FIELD_ALIGN (LOGPEN, lopnColor, 4)
+    TEST_FIELD_OFFSET(LOGPEN, lopnColor, 12)
+}
+
+static void test_pack_LPABC(void)
+{
+    /* LPABC */
+    TEST_TYPE_SIZE   (LPABC, 8)
+    TEST_TYPE_ALIGN  (LPABC, 8)
+    TEST_TARGET_SIZE (LPABC, 12)
+    TEST_TARGET_ALIGN(LPABC, 4)
+}
+
+static void test_pack_LPABCFLOAT(void)
+{
+    /* LPABCFLOAT */
+    TEST_TYPE_SIZE   (LPABCFLOAT, 8)
+    TEST_TYPE_ALIGN  (LPABCFLOAT, 8)
+    TEST_TARGET_SIZE (LPABCFLOAT, 12)
+    TEST_TARGET_ALIGN(LPABCFLOAT, 4)
+}
+
+static void test_pack_LPBITMAP(void)
+{
+    /* LPBITMAP */
+    TEST_TYPE_SIZE   (LPBITMAP, 8)
+    TEST_TYPE_ALIGN  (LPBITMAP, 8)
+    TEST_TARGET_SIZE (LPBITMAP, 32)
+    TEST_TARGET_ALIGN(LPBITMAP, 8)
+}
+
+static void test_pack_LPBITMAPCOREHEADER(void)
+{
+    /* LPBITMAPCOREHEADER */
+    TEST_TYPE_SIZE   (LPBITMAPCOREHEADER, 8)
+    TEST_TYPE_ALIGN  (LPBITMAPCOREHEADER, 8)
+    TEST_TARGET_SIZE (LPBITMAPCOREHEADER, 12)
+    TEST_TARGET_ALIGN(LPBITMAPCOREHEADER, 4)
+}
+
+static void test_pack_LPBITMAPCOREINFO(void)
+{
+    /* LPBITMAPCOREINFO */
+    TEST_TYPE_SIZE   (LPBITMAPCOREINFO, 8)
+    TEST_TYPE_ALIGN  (LPBITMAPCOREINFO, 8)
+    TEST_TARGET_SIZE (LPBITMAPCOREINFO, 16)
+    TEST_TARGET_ALIGN(LPBITMAPCOREINFO, 4)
+}
+
+static void test_pack_LPBITMAPFILEHEADER(void)
+{
+    /* LPBITMAPFILEHEADER */
+    TEST_TYPE_SIZE   (LPBITMAPFILEHEADER, 8)
+    TEST_TYPE_ALIGN  (LPBITMAPFILEHEADER, 8)
+    TEST_TARGET_SIZE (LPBITMAPFILEHEADER, 14)
+    TEST_TARGET_ALIGN(LPBITMAPFILEHEADER, 2)
+}
+
+static void test_pack_LPBITMAPINFO(void)
+{
+    /* LPBITMAPINFO */
+    TEST_TYPE_SIZE   (LPBITMAPINFO, 8)
+    TEST_TYPE_ALIGN  (LPBITMAPINFO, 8)
+    TEST_TARGET_SIZE (LPBITMAPINFO, 44)
+    TEST_TARGET_ALIGN(LPBITMAPINFO, 4)
+}
+
+static void test_pack_LPBITMAPINFOHEADER(void)
+{
+    /* LPBITMAPINFOHEADER */
+    TEST_TYPE_SIZE   (LPBITMAPINFOHEADER, 8)
+    TEST_TYPE_ALIGN  (LPBITMAPINFOHEADER, 8)
+    TEST_TARGET_SIZE (LPBITMAPINFOHEADER, 40)
+    TEST_TARGET_ALIGN(LPBITMAPINFOHEADER, 4)
+}
+
+static void test_pack_LPBITMAPV5HEADER(void)
+{
+    /* LPBITMAPV5HEADER */
+    TEST_TYPE_SIZE   (LPBITMAPV5HEADER, 8)
+    TEST_TYPE_ALIGN  (LPBITMAPV5HEADER, 8)
+    TEST_TARGET_SIZE (LPBITMAPV5HEADER, 124)
+    TEST_TARGET_ALIGN(LPBITMAPV5HEADER, 4)
+}
+
+static void test_pack_LPCHARSETINFO(void)
+{
+    /* LPCHARSETINFO */
+    TEST_TYPE_SIZE   (LPCHARSETINFO, 8)
+    TEST_TYPE_ALIGN  (LPCHARSETINFO, 8)
+    TEST_TARGET_SIZE (LPCHARSETINFO, 32)
+    TEST_TARGET_ALIGN(LPCHARSETINFO, 4)
+}
+
+static void test_pack_LPCIEXYZ(void)
+{
+    /* LPCIEXYZ */
+    TEST_TYPE_SIZE   (LPCIEXYZ, 8)
+    TEST_TYPE_ALIGN  (LPCIEXYZ, 8)
+    TEST_TARGET_SIZE (LPCIEXYZ, 12)
+    TEST_TARGET_ALIGN(LPCIEXYZ, 4)
+}
+
+static void test_pack_LPCIEXYZTRIPLE(void)
+{
+    /* LPCIEXYZTRIPLE */
+    TEST_TYPE_SIZE   (LPCIEXYZTRIPLE, 8)
+    TEST_TYPE_ALIGN  (LPCIEXYZTRIPLE, 8)
+    TEST_TARGET_SIZE (LPCIEXYZTRIPLE, 36)
+    TEST_TARGET_ALIGN(LPCIEXYZTRIPLE, 4)
+}
+
+static void test_pack_LPCOLORADJUSTMENT(void)
+{
+    /* LPCOLORADJUSTMENT */
+    TEST_TYPE_SIZE   (LPCOLORADJUSTMENT, 8)
+    TEST_TYPE_ALIGN  (LPCOLORADJUSTMENT, 8)
+    TEST_TARGET_SIZE (LPCOLORADJUSTMENT, 24)
+    TEST_TARGET_ALIGN(LPCOLORADJUSTMENT, 2)
+}
+
+static void test_pack_LPDEVMODEA(void)
+{
+    /* LPDEVMODEA */
+    TEST_TYPE_SIZE   (LPDEVMODEA, 8)
+    TEST_TYPE_ALIGN  (LPDEVMODEA, 8)
+}
+
+static void test_pack_LPDEVMODEW(void)
+{
+    /* LPDEVMODEW */
+    TEST_TYPE_SIZE   (LPDEVMODEW, 8)
+    TEST_TYPE_ALIGN  (LPDEVMODEW, 8)
+}
+
+static void test_pack_LPDIBSECTION(void)
+{
+    /* LPDIBSECTION */
+    TEST_TYPE_SIZE   (LPDIBSECTION, 8)
+    TEST_TYPE_ALIGN  (LPDIBSECTION, 8)
+    TEST_TARGET_SIZE (LPDIBSECTION, 104)
+    TEST_TARGET_ALIGN(LPDIBSECTION, 8)
+}
+
+static void test_pack_LPDISPLAY_DEVICEA(void)
+{
+    /* LPDISPLAY_DEVICEA */
+    TEST_TYPE_SIZE   (LPDISPLAY_DEVICEA, 8)
+    TEST_TYPE_ALIGN  (LPDISPLAY_DEVICEA, 8)
+    TEST_TARGET_SIZE (LPDISPLAY_DEVICEA, 424)
+    TEST_TARGET_ALIGN(LPDISPLAY_DEVICEA, 4)
+}
+
+static void test_pack_LPDISPLAY_DEVICEW(void)
+{
+    /* LPDISPLAY_DEVICEW */
+    TEST_TYPE_SIZE   (LPDISPLAY_DEVICEW, 8)
+    TEST_TYPE_ALIGN  (LPDISPLAY_DEVICEW, 8)
+    TEST_TARGET_SIZE (LPDISPLAY_DEVICEW, 840)
+    TEST_TARGET_ALIGN(LPDISPLAY_DEVICEW, 4)
+}
+
+static void test_pack_LPDOCINFOA(void)
+{
+    /* LPDOCINFOA */
+    TEST_TYPE_SIZE   (LPDOCINFOA, 8)
+    TEST_TYPE_ALIGN  (LPDOCINFOA, 8)
+    TEST_TARGET_SIZE (LPDOCINFOA, 40)
+    TEST_TARGET_ALIGN(LPDOCINFOA, 8)
+}
+
+static void test_pack_LPDOCINFOW(void)
+{
+    /* LPDOCINFOW */
+    TEST_TYPE_SIZE   (LPDOCINFOW, 8)
+    TEST_TYPE_ALIGN  (LPDOCINFOW, 8)
+    TEST_TARGET_SIZE (LPDOCINFOW, 40)
+    TEST_TARGET_ALIGN(LPDOCINFOW, 8)
+}
+
+static void test_pack_LPENHMETAHEADER(void)
+{
+    /* LPENHMETAHEADER */
+    TEST_TYPE_SIZE   (LPENHMETAHEADER, 8)
+    TEST_TYPE_ALIGN  (LPENHMETAHEADER, 8)
+    TEST_TARGET_SIZE (LPENHMETAHEADER, 108)
+    TEST_TARGET_ALIGN(LPENHMETAHEADER, 4)
+}
+
+static void test_pack_LPENHMETARECORD(void)
+{
+    /* LPENHMETARECORD */
+    TEST_TYPE_SIZE   (LPENHMETARECORD, 8)
+    TEST_TYPE_ALIGN  (LPENHMETARECORD, 8)
+    TEST_TARGET_SIZE (LPENHMETARECORD, 12)
+    TEST_TARGET_ALIGN(LPENHMETARECORD, 4)
+}
+
+static void test_pack_LPENUMLOGFONTA(void)
+{
+    /* LPENUMLOGFONTA */
+    TEST_TYPE_SIZE   (LPENUMLOGFONTA, 8)
+    TEST_TYPE_ALIGN  (LPENUMLOGFONTA, 8)
+    TEST_TARGET_SIZE (LPENUMLOGFONTA, 156)
+    TEST_TARGET_ALIGN(LPENUMLOGFONTA, 4)
+}
+
+static void test_pack_LPENUMLOGFONTEXA(void)
+{
+    /* LPENUMLOGFONTEXA */
+    TEST_TYPE_SIZE   (LPENUMLOGFONTEXA, 8)
+    TEST_TYPE_ALIGN  (LPENUMLOGFONTEXA, 8)
+    TEST_TARGET_SIZE (LPENUMLOGFONTEXA, 188)
+    TEST_TARGET_ALIGN(LPENUMLOGFONTEXA, 4)
+}
+
+static void test_pack_LPENUMLOGFONTEXW(void)
+{
+    /* LPENUMLOGFONTEXW */
+    TEST_TYPE_SIZE   (LPENUMLOGFONTEXW, 8)
+    TEST_TYPE_ALIGN  (LPENUMLOGFONTEXW, 8)
+    TEST_TARGET_SIZE (LPENUMLOGFONTEXW, 348)
+    TEST_TARGET_ALIGN(LPENUMLOGFONTEXW, 4)
+}
+
+static void test_pack_LPENUMLOGFONTW(void)
+{
+    /* LPENUMLOGFONTW */
+    TEST_TYPE_SIZE   (LPENUMLOGFONTW, 8)
+    TEST_TYPE_ALIGN  (LPENUMLOGFONTW, 8)
+    TEST_TARGET_SIZE (LPENUMLOGFONTW, 284)
+    TEST_TARGET_ALIGN(LPENUMLOGFONTW, 4)
+}
+
+static void test_pack_LPEXTLOGFONTA(void)
+{
+    /* LPEXTLOGFONTA */
+    TEST_TYPE_SIZE   (LPEXTLOGFONTA, 8)
+    TEST_TYPE_ALIGN  (LPEXTLOGFONTA, 8)
+    TEST_TARGET_SIZE (LPEXTLOGFONTA, 192)
+    TEST_TARGET_ALIGN(LPEXTLOGFONTA, 4)
+}
+
+static void test_pack_LPEXTLOGFONTW(void)
+{
+    /* LPEXTLOGFONTW */
+    TEST_TYPE_SIZE   (LPEXTLOGFONTW, 8)
+    TEST_TYPE_ALIGN  (LPEXTLOGFONTW, 8)
+    TEST_TARGET_SIZE (LPEXTLOGFONTW, 320)
+    TEST_TARGET_ALIGN(LPEXTLOGFONTW, 4)
+}
+
+static void test_pack_LPEXTLOGPEN(void)
+{
+    /* LPEXTLOGPEN */
+    TEST_TYPE_SIZE   (LPEXTLOGPEN, 8)
+    TEST_TYPE_ALIGN  (LPEXTLOGPEN, 8)
+    TEST_TARGET_SIZE (LPEXTLOGPEN, 32)
+    TEST_TARGET_ALIGN(LPEXTLOGPEN, 8)
+}
+
+static void test_pack_LPFONTSIGNATURE(void)
+{
+    /* LPFONTSIGNATURE */
+    TEST_TYPE_SIZE   (LPFONTSIGNATURE, 8)
+    TEST_TYPE_ALIGN  (LPFONTSIGNATURE, 8)
+    TEST_TARGET_SIZE (LPFONTSIGNATURE, 24)
+    TEST_TARGET_ALIGN(LPFONTSIGNATURE, 4)
+}
+
+static void test_pack_LPGCP_RESULTSA(void)
+{
+    /* LPGCP_RESULTSA */
+    TEST_TYPE_SIZE   (LPGCP_RESULTSA, 8)
+    TEST_TYPE_ALIGN  (LPGCP_RESULTSA, 8)
+    TEST_TARGET_SIZE (LPGCP_RESULTSA, 64)
+    TEST_TARGET_ALIGN(LPGCP_RESULTSA, 8)
+}
+
+static void test_pack_LPGCP_RESULTSW(void)
+{
+    /* LPGCP_RESULTSW */
+    TEST_TYPE_SIZE   (LPGCP_RESULTSW, 8)
+    TEST_TYPE_ALIGN  (LPGCP_RESULTSW, 8)
+    TEST_TARGET_SIZE (LPGCP_RESULTSW, 64)
+    TEST_TARGET_ALIGN(LPGCP_RESULTSW, 8)
+}
+
+static void test_pack_LPGLYPHMETRICS(void)
+{
+    /* LPGLYPHMETRICS */
+    TEST_TYPE_SIZE   (LPGLYPHMETRICS, 8)
+    TEST_TYPE_ALIGN  (LPGLYPHMETRICS, 8)
+    TEST_TARGET_SIZE (LPGLYPHMETRICS, 20)
+    TEST_TARGET_ALIGN(LPGLYPHMETRICS, 4)
+}
+
+static void test_pack_LPGLYPHMETRICSFLOAT(void)
+{
+    /* LPGLYPHMETRICSFLOAT */
+    TEST_TYPE_SIZE   (LPGLYPHMETRICSFLOAT, 8)
+    TEST_TYPE_ALIGN  (LPGLYPHMETRICSFLOAT, 8)
+    TEST_TARGET_SIZE (LPGLYPHMETRICSFLOAT, 24)
+    TEST_TARGET_ALIGN(LPGLYPHMETRICSFLOAT, 4)
+}
+
+static void test_pack_LPGRADIENT_RECT(void)
+{
+    /* LPGRADIENT_RECT */
+    TEST_TYPE_SIZE   (LPGRADIENT_RECT, 8)
+    TEST_TYPE_ALIGN  (LPGRADIENT_RECT, 8)
+    TEST_TARGET_SIZE (LPGRADIENT_RECT, 8)
+    TEST_TARGET_ALIGN(LPGRADIENT_RECT, 4)
+}
+
+static void test_pack_LPGRADIENT_TRIANGLE(void)
+{
+    /* LPGRADIENT_TRIANGLE */
+    TEST_TYPE_SIZE   (LPGRADIENT_TRIANGLE, 8)
+    TEST_TYPE_ALIGN  (LPGRADIENT_TRIANGLE, 8)
+    TEST_TARGET_SIZE (LPGRADIENT_TRIANGLE, 12)
+    TEST_TARGET_ALIGN(LPGRADIENT_TRIANGLE, 4)
+}
+
+static void test_pack_LPHANDLETABLE(void)
+{
+    /* LPHANDLETABLE */
+    TEST_TYPE_SIZE   (LPHANDLETABLE, 8)
+    TEST_TYPE_ALIGN  (LPHANDLETABLE, 8)
+    TEST_TARGET_SIZE (LPHANDLETABLE, 8)
+    TEST_TARGET_ALIGN(LPHANDLETABLE, 8)
+}
+
+static void test_pack_LPKERNINGPAIR(void)
+{
+    /* LPKERNINGPAIR */
+    TEST_TYPE_SIZE   (LPKERNINGPAIR, 8)
+    TEST_TYPE_ALIGN  (LPKERNINGPAIR, 8)
+    TEST_TARGET_SIZE (LPKERNINGPAIR, 8)
+    TEST_TARGET_ALIGN(LPKERNINGPAIR, 4)
+}
+
+static void test_pack_LPLAYERPLANEDESCRIPTOR(void)
+{
+    /* LPLAYERPLANEDESCRIPTOR */
+    TEST_TYPE_SIZE   (LPLAYERPLANEDESCRIPTOR, 8)
+    TEST_TYPE_ALIGN  (LPLAYERPLANEDESCRIPTOR, 8)
+    TEST_TARGET_SIZE (LPLAYERPLANEDESCRIPTOR, 32)
+    TEST_TARGET_ALIGN(LPLAYERPLANEDESCRIPTOR, 4)
+}
+
+static void test_pack_LPLOCALESIGNATURE(void)
+{
+    /* LPLOCALESIGNATURE */
+    TEST_TYPE_SIZE   (LPLOCALESIGNATURE, 8)
+    TEST_TYPE_ALIGN  (LPLOCALESIGNATURE, 8)
+    TEST_TARGET_SIZE (LPLOCALESIGNATURE, 32)
+    TEST_TARGET_ALIGN(LPLOCALESIGNATURE, 4)
+}
+
+static void test_pack_LPLOGBRUSH(void)
+{
+    /* LPLOGBRUSH */
+    TEST_TYPE_SIZE   (LPLOGBRUSH, 8)
+    TEST_TYPE_ALIGN  (LPLOGBRUSH, 8)
+    TEST_TARGET_SIZE (LPLOGBRUSH, 16)
+    TEST_TARGET_ALIGN(LPLOGBRUSH, 8)
+}
+
+static void test_pack_LPLOGCOLORSPACEA(void)
+{
+    /* LPLOGCOLORSPACEA */
+    TEST_TYPE_SIZE   (LPLOGCOLORSPACEA, 8)
+    TEST_TYPE_ALIGN  (LPLOGCOLORSPACEA, 8)
+    TEST_TARGET_SIZE (LPLOGCOLORSPACEA, 328)
+    TEST_TARGET_ALIGN(LPLOGCOLORSPACEA, 4)
+}
+
+static void test_pack_LPLOGCOLORSPACEW(void)
+{
+    /* LPLOGCOLORSPACEW */
+    TEST_TYPE_SIZE   (LPLOGCOLORSPACEW, 8)
+    TEST_TYPE_ALIGN  (LPLOGCOLORSPACEW, 8)
+    TEST_TARGET_SIZE (LPLOGCOLORSPACEW, 588)
+    TEST_TARGET_ALIGN(LPLOGCOLORSPACEW, 4)
+}
+
+static void test_pack_LPLOGFONTA(void)
+{
+    /* LPLOGFONTA */
+    TEST_TYPE_SIZE   (LPLOGFONTA, 8)
+    TEST_TYPE_ALIGN  (LPLOGFONTA, 8)
+    TEST_TARGET_SIZE (LPLOGFONTA, 60)
+    TEST_TARGET_ALIGN(LPLOGFONTA, 4)
+}
+
+static void test_pack_LPLOGFONTW(void)
+{
+    /* LPLOGFONTW */
+    TEST_TYPE_SIZE   (LPLOGFONTW, 8)
+    TEST_TYPE_ALIGN  (LPLOGFONTW, 8)
+    TEST_TARGET_SIZE (LPLOGFONTW, 92)
+    TEST_TARGET_ALIGN(LPLOGFONTW, 4)
+}
+
+static void test_pack_LPLOGPEN(void)
+{
+    /* LPLOGPEN */
+    TEST_TYPE_SIZE   (LPLOGPEN, 8)
+    TEST_TYPE_ALIGN  (LPLOGPEN, 8)
+    TEST_TARGET_SIZE (LPLOGPEN, 16)
+    TEST_TARGET_ALIGN(LPLOGPEN, 4)
+}
+
+static void test_pack_LPMAT2(void)
+{
+    /* LPMAT2 */
+    TEST_TYPE_SIZE   (LPMAT2, 8)
+    TEST_TYPE_ALIGN  (LPMAT2, 8)
+    TEST_TARGET_SIZE (LPMAT2, 16)
+    TEST_TARGET_ALIGN(LPMAT2, 2)
+}
+
+static void test_pack_LPMETAFILEPICT(void)
+{
+    /* LPMETAFILEPICT */
+    TEST_TYPE_SIZE   (LPMETAFILEPICT, 8)
+    TEST_TYPE_ALIGN  (LPMETAFILEPICT, 8)
+    TEST_TARGET_SIZE (LPMETAFILEPICT, 24)
+    TEST_TARGET_ALIGN(LPMETAFILEPICT, 8)
+}
+
+static void test_pack_LPMETAHEADER(void)
+{
+    /* LPMETAHEADER */
+    TEST_TYPE_SIZE   (LPMETAHEADER, 8)
+    TEST_TYPE_ALIGN  (LPMETAHEADER, 8)
+    TEST_TARGET_SIZE (LPMETAHEADER, 18)
+    TEST_TARGET_ALIGN(LPMETAHEADER, 2)
+}
+
+static void test_pack_LPMETARECORD(void)
+{
+    /* LPMETARECORD */
+    TEST_TYPE_SIZE   (LPMETARECORD, 8)
+    TEST_TYPE_ALIGN  (LPMETARECORD, 8)
+    TEST_TARGET_SIZE (LPMETARECORD, 8)
+    TEST_TARGET_ALIGN(LPMETARECORD, 4)
+}
+
+static void test_pack_LPNEWTEXTMETRICA(void)
+{
+    /* LPNEWTEXTMETRICA */
+    TEST_TYPE_SIZE   (LPNEWTEXTMETRICA, 8)
+    TEST_TYPE_ALIGN  (LPNEWTEXTMETRICA, 8)
+    TEST_TARGET_SIZE (LPNEWTEXTMETRICA, 72)
+    TEST_TARGET_ALIGN(LPNEWTEXTMETRICA, 4)
+}
+
+static void test_pack_LPNEWTEXTMETRICW(void)
+{
+    /* LPNEWTEXTMETRICW */
+    TEST_TYPE_SIZE   (LPNEWTEXTMETRICW, 8)
+    TEST_TYPE_ALIGN  (LPNEWTEXTMETRICW, 8)
+    TEST_TARGET_SIZE (LPNEWTEXTMETRICW, 76)
+    TEST_TARGET_ALIGN(LPNEWTEXTMETRICW, 4)
+}
+
+static void test_pack_LPOUTLINETEXTMETRICA(void)
+{
+    /* LPOUTLINETEXTMETRICA */
+    TEST_TYPE_SIZE   (LPOUTLINETEXTMETRICA, 8)
+    TEST_TYPE_ALIGN  (LPOUTLINETEXTMETRICA, 8)
+    TEST_TARGET_SIZE (LPOUTLINETEXTMETRICA, 232)
+    TEST_TARGET_ALIGN(LPOUTLINETEXTMETRICA, 8)
+}
+
+static void test_pack_LPOUTLINETEXTMETRICW(void)
+{
+    /* LPOUTLINETEXTMETRICW */
+    TEST_TYPE_SIZE   (LPOUTLINETEXTMETRICW, 8)
+    TEST_TYPE_ALIGN  (LPOUTLINETEXTMETRICW, 8)
+    TEST_TARGET_SIZE (LPOUTLINETEXTMETRICW, 232)
+    TEST_TARGET_ALIGN(LPOUTLINETEXTMETRICW, 8)
+}
+
+static void test_pack_LPPANOSE(void)
+{
+    /* LPPANOSE */
+    TEST_TYPE_SIZE   (LPPANOSE, 8)
+    TEST_TYPE_ALIGN  (LPPANOSE, 8)
+    TEST_TARGET_SIZE (LPPANOSE, 10)
+    TEST_TARGET_ALIGN(LPPANOSE, 1)
+}
+
+static void test_pack_LPPELARRAY(void)
+{
+    /* LPPELARRAY */
+    TEST_TYPE_SIZE   (LPPELARRAY, 8)
+    TEST_TYPE_ALIGN  (LPPELARRAY, 8)
+    TEST_TARGET_SIZE (LPPELARRAY, 20)
+    TEST_TARGET_ALIGN(LPPELARRAY, 4)
+}
+
+static void test_pack_LPPIXELFORMATDESCRIPTOR(void)
+{
+    /* LPPIXELFORMATDESCRIPTOR */
+    TEST_TYPE_SIZE   (LPPIXELFORMATDESCRIPTOR, 8)
+    TEST_TYPE_ALIGN  (LPPIXELFORMATDESCRIPTOR, 8)
+    TEST_TARGET_SIZE (LPPIXELFORMATDESCRIPTOR, 40)
+    TEST_TARGET_ALIGN(LPPIXELFORMATDESCRIPTOR, 4)
+}
+
+static void test_pack_LPPOINTFX(void)
+{
+    /* LPPOINTFX */
+    TEST_TYPE_SIZE   (LPPOINTFX, 8)
+    TEST_TYPE_ALIGN  (LPPOINTFX, 8)
+    TEST_TARGET_SIZE (LPPOINTFX, 8)
+    TEST_TARGET_ALIGN(LPPOINTFX, 2)
+}
+
+static void test_pack_LPPOLYTEXTA(void)
+{
+    /* LPPOLYTEXTA */
+    TEST_TYPE_SIZE   (LPPOLYTEXTA, 8)
+    TEST_TYPE_ALIGN  (LPPOLYTEXTA, 8)
+    TEST_TARGET_SIZE (LPPOLYTEXTA, 56)
+    TEST_TARGET_ALIGN(LPPOLYTEXTA, 8)
+}
+
+static void test_pack_LPPOLYTEXTW(void)
+{
+    /* LPPOLYTEXTW */
+    TEST_TYPE_SIZE   (LPPOLYTEXTW, 8)
+    TEST_TYPE_ALIGN  (LPPOLYTEXTW, 8)
+    TEST_TARGET_SIZE (LPPOLYTEXTW, 56)
+    TEST_TARGET_ALIGN(LPPOLYTEXTW, 8)
+}
+
+static void test_pack_LPRASTERIZER_STATUS(void)
+{
+    /* LPRASTERIZER_STATUS */
+    TEST_TYPE_SIZE   (LPRASTERIZER_STATUS, 8)
+    TEST_TYPE_ALIGN  (LPRASTERIZER_STATUS, 8)
+    TEST_TARGET_SIZE (LPRASTERIZER_STATUS, 6)
+    TEST_TARGET_ALIGN(LPRASTERIZER_STATUS, 2)
+}
+
+static void test_pack_LPRGBQUAD(void)
+{
+    /* LPRGBQUAD */
+    TEST_TYPE_SIZE   (LPRGBQUAD, 8)
+    TEST_TYPE_ALIGN  (LPRGBQUAD, 8)
+    TEST_TARGET_SIZE (LPRGBQUAD, 4)
+    TEST_TARGET_ALIGN(LPRGBQUAD, 1)
+}
+
+static void test_pack_LPRGNDATA(void)
+{
+    /* LPRGNDATA */
+    TEST_TYPE_SIZE   (LPRGNDATA, 8)
+    TEST_TYPE_ALIGN  (LPRGNDATA, 8)
+    TEST_TARGET_SIZE (LPRGNDATA, 36)
+    TEST_TARGET_ALIGN(LPRGNDATA, 4)
+}
+
+static void test_pack_LPTEXTMETRICA(void)
+{
+    /* LPTEXTMETRICA */
+    TEST_TYPE_SIZE   (LPTEXTMETRICA, 8)
+    TEST_TYPE_ALIGN  (LPTEXTMETRICA, 8)
+    TEST_TARGET_SIZE (LPTEXTMETRICA, 56)
+    TEST_TARGET_ALIGN(LPTEXTMETRICA, 4)
+}
+
+static void test_pack_LPTEXTMETRICW(void)
+{
+    /* LPTEXTMETRICW */
+    TEST_TYPE_SIZE   (LPTEXTMETRICW, 8)
+    TEST_TYPE_ALIGN  (LPTEXTMETRICW, 8)
+    TEST_TARGET_SIZE (LPTEXTMETRICW, 60)
+    TEST_TARGET_ALIGN(LPTEXTMETRICW, 4)
+}
+
+static void test_pack_LPTRIVERTEX(void)
+{
+    /* LPTRIVERTEX */
+    TEST_TYPE_SIZE   (LPTRIVERTEX, 8)
+    TEST_TYPE_ALIGN  (LPTRIVERTEX, 8)
+    TEST_TARGET_SIZE (LPTRIVERTEX, 16)
+    TEST_TARGET_ALIGN(LPTRIVERTEX, 4)
+}
+
+static void test_pack_LPTTPOLYCURVE(void)
+{
+    /* LPTTPOLYCURVE */
+    TEST_TYPE_SIZE   (LPTTPOLYCURVE, 8)
+    TEST_TYPE_ALIGN  (LPTTPOLYCURVE, 8)
+    TEST_TARGET_SIZE (LPTTPOLYCURVE, 12)
+    TEST_TARGET_ALIGN(LPTTPOLYCURVE, 2)
+}
+
+static void test_pack_LPTTPOLYGONHEADER(void)
+{
+    /* LPTTPOLYGONHEADER */
+    TEST_TYPE_SIZE   (LPTTPOLYGONHEADER, 8)
+    TEST_TYPE_ALIGN  (LPTTPOLYGONHEADER, 8)
+    TEST_TARGET_SIZE (LPTTPOLYGONHEADER, 16)
+    TEST_TARGET_ALIGN(LPTTPOLYGONHEADER, 4)
+}
+
+static void test_pack_LPXFORM(void)
+{
+    /* LPXFORM */
+    TEST_TYPE_SIZE   (LPXFORM, 8)
+    TEST_TYPE_ALIGN  (LPXFORM, 8)
+    TEST_TARGET_SIZE (LPXFORM, 24)
+    TEST_TARGET_ALIGN(LPXFORM, 4)
+}
+
+static void test_pack_MAT2(void)
+{
+    /* MAT2 */
+    TEST_TYPE_SIZE   (MAT2, 16)
+    TEST_TYPE_ALIGN  (MAT2, 2)
+    TEST_FIELD_SIZE  (MAT2, eM11, 4)
+    TEST_FIELD_ALIGN (MAT2, eM11, 2)
+    TEST_FIELD_OFFSET(MAT2, eM11, 0)
+    TEST_FIELD_SIZE  (MAT2, eM12, 4)
+    TEST_FIELD_ALIGN (MAT2, eM12, 2)
+    TEST_FIELD_OFFSET(MAT2, eM12, 4)
+    TEST_FIELD_SIZE  (MAT2, eM21, 4)
+    TEST_FIELD_ALIGN (MAT2, eM21, 2)
+    TEST_FIELD_OFFSET(MAT2, eM21, 8)
+    TEST_FIELD_SIZE  (MAT2, eM22, 4)
+    TEST_FIELD_ALIGN (MAT2, eM22, 2)
+    TEST_FIELD_OFFSET(MAT2, eM22, 12)
+}
+
+static void test_pack_METAFILEPICT(void)
+{
+    /* METAFILEPICT */
+    TEST_TYPE_SIZE   (METAFILEPICT, 24)
+    TEST_TYPE_ALIGN  (METAFILEPICT, 8)
+    TEST_FIELD_SIZE  (METAFILEPICT, mm, 4)
+    TEST_FIELD_ALIGN (METAFILEPICT, mm, 4)
+    TEST_FIELD_OFFSET(METAFILEPICT, mm, 0)
+    TEST_FIELD_SIZE  (METAFILEPICT, xExt, 4)
+    TEST_FIELD_ALIGN (METAFILEPICT, xExt, 4)
+    TEST_FIELD_OFFSET(METAFILEPICT, xExt, 4)
+    TEST_FIELD_SIZE  (METAFILEPICT, yExt, 4)
+    TEST_FIELD_ALIGN (METAFILEPICT, yExt, 4)
+    TEST_FIELD_OFFSET(METAFILEPICT, yExt, 8)
+    TEST_FIELD_SIZE  (METAFILEPICT, hMF, 8)
+    TEST_FIELD_ALIGN (METAFILEPICT, hMF, 8)
+    TEST_FIELD_OFFSET(METAFILEPICT, hMF, 16)
+}
+
+static void test_pack_METAHEADER(void)
+{
+    /* METAHEADER (pack 2) */
+    TEST_TYPE_SIZE   (METAHEADER, 18)
+    TEST_TYPE_ALIGN  (METAHEADER, 2)
+    TEST_FIELD_SIZE  (METAHEADER, mtType, 2)
+    TEST_FIELD_ALIGN (METAHEADER, mtType, 2)
+    TEST_FIELD_OFFSET(METAHEADER, mtType, 0)
+    TEST_FIELD_SIZE  (METAHEADER, mtHeaderSize, 2)
+    TEST_FIELD_ALIGN (METAHEADER, mtHeaderSize, 2)
+    TEST_FIELD_OFFSET(METAHEADER, mtHeaderSize, 2)
+    TEST_FIELD_SIZE  (METAHEADER, mtVersion, 2)
+    TEST_FIELD_ALIGN (METAHEADER, mtVersion, 2)
+    TEST_FIELD_OFFSET(METAHEADER, mtVersion, 4)
+    TEST_FIELD_SIZE  (METAHEADER, mtSize, 4)
+    TEST_FIELD_ALIGN (METAHEADER, mtSize, 2)
+    TEST_FIELD_OFFSET(METAHEADER, mtSize, 6)
+    TEST_FIELD_SIZE  (METAHEADER, mtNoObjects, 2)
+    TEST_FIELD_ALIGN (METAHEADER, mtNoObjects, 2)
+    TEST_FIELD_OFFSET(METAHEADER, mtNoObjects, 10)
+    TEST_FIELD_SIZE  (METAHEADER, mtMaxRecord, 4)
+    TEST_FIELD_ALIGN (METAHEADER, mtMaxRecord, 2)
+    TEST_FIELD_OFFSET(METAHEADER, mtMaxRecord, 12)
+    TEST_FIELD_SIZE  (METAHEADER, mtNoParameters, 2)
+    TEST_FIELD_ALIGN (METAHEADER, mtNoParameters, 2)
+    TEST_FIELD_OFFSET(METAHEADER, mtNoParameters, 16)
+}
+
+static void test_pack_METARECORD(void)
+{
+    /* METARECORD */
+    TEST_TYPE_SIZE   (METARECORD, 8)
+    TEST_TYPE_ALIGN  (METARECORD, 4)
+    TEST_FIELD_SIZE  (METARECORD, rdSize, 4)
+    TEST_FIELD_ALIGN (METARECORD, rdSize, 4)
+    TEST_FIELD_OFFSET(METARECORD, rdSize, 0)
+    TEST_FIELD_SIZE  (METARECORD, rdFunction, 2)
+    TEST_FIELD_ALIGN (METARECORD, rdFunction, 2)
+    TEST_FIELD_OFFSET(METARECORD, rdFunction, 4)
+    TEST_FIELD_SIZE  (METARECORD, rdParm, 2)
+    TEST_FIELD_ALIGN (METARECORD, rdParm, 2)
+    TEST_FIELD_OFFSET(METARECORD, rdParm, 6)
+}
+
+static void test_pack_MFENUMPROC(void)
+{
+    /* MFENUMPROC */
+    TEST_TYPE_SIZE   (MFENUMPROC, 8)
+    TEST_TYPE_ALIGN  (MFENUMPROC, 8)
+}
+
+static void test_pack_NEWTEXTMETRICA(void)
+{
+    /* NEWTEXTMETRICA */
+    TEST_TYPE_SIZE   (NEWTEXTMETRICA, 72)
+    TEST_TYPE_ALIGN  (NEWTEXTMETRICA, 4)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmHeight, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmHeight, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmHeight, 0)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmAscent, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmAscent, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmAscent, 4)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmDescent, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmDescent, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmDescent, 8)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmInternalLeading, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmInternalLeading, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmInternalLeading, 12)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmExternalLeading, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmExternalLeading, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmExternalLeading, 16)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmAveCharWidth, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmAveCharWidth, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmAveCharWidth, 20)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmMaxCharWidth, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmMaxCharWidth, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmMaxCharWidth, 24)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmWeight, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmWeight, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmWeight, 28)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmOverhang, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmOverhang, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmOverhang, 32)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmDigitizedAspectX, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmDigitizedAspectX, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmDigitizedAspectX, 36)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmDigitizedAspectY, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmDigitizedAspectY, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmDigitizedAspectY, 40)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmFirstChar, 1)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmFirstChar, 1)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmFirstChar, 44)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmLastChar, 1)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmLastChar, 1)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmLastChar, 45)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmDefaultChar, 1)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmDefaultChar, 1)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmDefaultChar, 46)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmBreakChar, 1)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmBreakChar, 1)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmBreakChar, 47)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmItalic, 1)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmItalic, 1)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmItalic, 48)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmUnderlined, 1)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmUnderlined, 1)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmUnderlined, 49)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmStruckOut, 1)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmStruckOut, 1)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmStruckOut, 50)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmPitchAndFamily, 1)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmPitchAndFamily, 1)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmPitchAndFamily, 51)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, tmCharSet, 1)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, tmCharSet, 1)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, tmCharSet, 52)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, ntmFlags, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, ntmFlags, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, ntmFlags, 56)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, ntmSizeEM, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, ntmSizeEM, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, ntmSizeEM, 60)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, ntmCellHeight, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, ntmCellHeight, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, ntmCellHeight, 64)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICA, ntmAvgWidth, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICA, ntmAvgWidth, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICA, ntmAvgWidth, 68)
+}
+
+static void test_pack_NEWTEXTMETRICEXA(void)
+{
+    /* NEWTEXTMETRICEXA */
+    TEST_TYPE_SIZE   (NEWTEXTMETRICEXA, 96)
+    TEST_TYPE_ALIGN  (NEWTEXTMETRICEXA, 4)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICEXA, ntmTm, 72)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICEXA, ntmTm, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICEXA, ntmTm, 0)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICEXA, ntmFontSig, 24)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICEXA, ntmFontSig, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICEXA, ntmFontSig, 72)
+}
+
+static void test_pack_NEWTEXTMETRICEXW(void)
+{
+    /* NEWTEXTMETRICEXW */
+    TEST_TYPE_SIZE   (NEWTEXTMETRICEXW, 100)
+    TEST_TYPE_ALIGN  (NEWTEXTMETRICEXW, 4)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICEXW, ntmTm, 76)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICEXW, ntmTm, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICEXW, ntmTm, 0)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICEXW, ntmFontSig, 24)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICEXW, ntmFontSig, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICEXW, ntmFontSig, 76)
+}
+
+static void test_pack_NEWTEXTMETRICW(void)
+{
+    /* NEWTEXTMETRICW */
+    TEST_TYPE_SIZE   (NEWTEXTMETRICW, 76)
+    TEST_TYPE_ALIGN  (NEWTEXTMETRICW, 4)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmHeight, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmHeight, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmHeight, 0)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmAscent, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmAscent, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmAscent, 4)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmDescent, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmDescent, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmDescent, 8)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmInternalLeading, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmInternalLeading, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmInternalLeading, 12)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmExternalLeading, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmExternalLeading, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmExternalLeading, 16)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmAveCharWidth, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmAveCharWidth, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmAveCharWidth, 20)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmMaxCharWidth, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmMaxCharWidth, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmMaxCharWidth, 24)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmWeight, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmWeight, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmWeight, 28)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmOverhang, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmOverhang, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmOverhang, 32)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmDigitizedAspectX, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmDigitizedAspectX, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmDigitizedAspectX, 36)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmDigitizedAspectY, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmDigitizedAspectY, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmDigitizedAspectY, 40)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmFirstChar, 2)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmFirstChar, 2)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmFirstChar, 44)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmLastChar, 2)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmLastChar, 2)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmLastChar, 46)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmDefaultChar, 2)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmDefaultChar, 2)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmDefaultChar, 48)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmBreakChar, 2)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmBreakChar, 2)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmBreakChar, 50)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmItalic, 1)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmItalic, 1)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmItalic, 52)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmUnderlined, 1)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmUnderlined, 1)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmUnderlined, 53)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmStruckOut, 1)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmStruckOut, 1)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmStruckOut, 54)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmPitchAndFamily, 1)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmPitchAndFamily, 1)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmPitchAndFamily, 55)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, tmCharSet, 1)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, tmCharSet, 1)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, tmCharSet, 56)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, ntmFlags, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, ntmFlags, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, ntmFlags, 60)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, ntmSizeEM, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, ntmSizeEM, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, ntmSizeEM, 64)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, ntmCellHeight, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, ntmCellHeight, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, ntmCellHeight, 68)
+    TEST_FIELD_SIZE  (NEWTEXTMETRICW, ntmAvgWidth, 4)
+    TEST_FIELD_ALIGN (NEWTEXTMETRICW, ntmAvgWidth, 4)
+    TEST_FIELD_OFFSET(NEWTEXTMETRICW, ntmAvgWidth, 72)
+}
+
+static void test_pack_NPEXTLOGPEN(void)
+{
+    /* NPEXTLOGPEN */
+    TEST_TYPE_SIZE   (NPEXTLOGPEN, 8)
+    TEST_TYPE_ALIGN  (NPEXTLOGPEN, 8)
+    TEST_TARGET_SIZE (NPEXTLOGPEN, 32)
+    TEST_TARGET_ALIGN(NPEXTLOGPEN, 8)
+}
+
+static void test_pack_OLDFONTENUMPROC(void)
+{
+    /* OLDFONTENUMPROC */
+    TEST_TYPE_SIZE   (OLDFONTENUMPROC, 8)
+    TEST_TYPE_ALIGN  (OLDFONTENUMPROC, 8)
+}
+
+static void test_pack_OLDFONTENUMPROCA(void)
+{
+    /* OLDFONTENUMPROCA */
+    TEST_TYPE_SIZE   (OLDFONTENUMPROCA, 8)
+    TEST_TYPE_ALIGN  (OLDFONTENUMPROCA, 8)
+}
+
+static void test_pack_OLDFONTENUMPROCW(void)
+{
+    /* OLDFONTENUMPROCW */
+    TEST_TYPE_SIZE   (OLDFONTENUMPROCW, 8)
+    TEST_TYPE_ALIGN  (OLDFONTENUMPROCW, 8)
+}
+
+static void test_pack_OUTLINETEXTMETRICA(void)
+{
+    /* OUTLINETEXTMETRICA */
+    TEST_TYPE_SIZE   (OUTLINETEXTMETRICA, 232)
+    TEST_TYPE_ALIGN  (OUTLINETEXTMETRICA, 8)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmSize, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmSize, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmSize, 0)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmTextMetrics, 56)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmTextMetrics, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmTextMetrics, 4)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmFiller, 1)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmFiller, 1)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmFiller, 60)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmPanoseNumber, 10)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmPanoseNumber, 1)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmPanoseNumber, 61)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmfsSelection, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmfsSelection, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmfsSelection, 72)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmfsType, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmfsType, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmfsType, 76)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmsCharSlopeRise, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmsCharSlopeRise, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmsCharSlopeRise, 80)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmsCharSlopeRun, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmsCharSlopeRun, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmsCharSlopeRun, 84)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmItalicAngle, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmItalicAngle, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmItalicAngle, 88)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmEMSquare, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmEMSquare, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmEMSquare, 92)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmAscent, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmAscent, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmAscent, 96)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmDescent, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmDescent, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmDescent, 100)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmLineGap, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmLineGap, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmLineGap, 104)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmsCapEmHeight, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmsCapEmHeight, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmsCapEmHeight, 108)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmsXHeight, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmsXHeight, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmsXHeight, 112)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmrcFontBox, 16)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmrcFontBox, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmrcFontBox, 116)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmMacAscent, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmMacAscent, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmMacAscent, 132)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmMacDescent, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmMacDescent, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmMacDescent, 136)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmMacLineGap, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmMacLineGap, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmMacLineGap, 140)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmusMinimumPPEM, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmusMinimumPPEM, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmusMinimumPPEM, 144)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmptSubscriptSize, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmptSubscriptSize, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmptSubscriptSize, 148)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmptSubscriptOffset, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmptSubscriptOffset, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmptSubscriptOffset, 156)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmptSuperscriptSize, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmptSuperscriptSize, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmptSuperscriptSize, 164)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmptSuperscriptOffset, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmptSuperscriptOffset, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmptSuperscriptOffset, 172)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmsStrikeoutSize, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmsStrikeoutSize, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmsStrikeoutSize, 180)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmsStrikeoutPosition, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmsStrikeoutPosition, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmsStrikeoutPosition, 184)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmsUnderscoreSize, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmsUnderscoreSize, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmsUnderscoreSize, 188)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmsUnderscorePosition, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmsUnderscorePosition, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmsUnderscorePosition, 192)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmpFamilyName, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmpFamilyName, 8)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmpFamilyName, 200)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmpFaceName, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmpFaceName, 8)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmpFaceName, 208)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmpStyleName, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmpStyleName, 8)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmpStyleName, 216)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICA, otmpFullName, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICA, otmpFullName, 8)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICA, otmpFullName, 224)
+}
+
+static void test_pack_OUTLINETEXTMETRICW(void)
+{
+    /* OUTLINETEXTMETRICW */
+    TEST_TYPE_SIZE   (OUTLINETEXTMETRICW, 232)
+    TEST_TYPE_ALIGN  (OUTLINETEXTMETRICW, 8)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmSize, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmSize, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmSize, 0)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmTextMetrics, 60)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmTextMetrics, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmTextMetrics, 4)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmFiller, 1)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmFiller, 1)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmFiller, 64)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmPanoseNumber, 10)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmPanoseNumber, 1)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmPanoseNumber, 65)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmfsSelection, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmfsSelection, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmfsSelection, 76)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmfsType, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmfsType, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmfsType, 80)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmsCharSlopeRise, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmsCharSlopeRise, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmsCharSlopeRise, 84)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmsCharSlopeRun, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmsCharSlopeRun, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmsCharSlopeRun, 88)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmItalicAngle, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmItalicAngle, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmItalicAngle, 92)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmEMSquare, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmEMSquare, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmEMSquare, 96)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmAscent, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmAscent, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmAscent, 100)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmDescent, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmDescent, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmDescent, 104)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmLineGap, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmLineGap, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmLineGap, 108)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmsCapEmHeight, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmsCapEmHeight, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmsCapEmHeight, 112)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmsXHeight, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmsXHeight, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmsXHeight, 116)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmrcFontBox, 16)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmrcFontBox, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmrcFontBox, 120)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmMacAscent, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmMacAscent, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmMacAscent, 136)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmMacDescent, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmMacDescent, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmMacDescent, 140)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmMacLineGap, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmMacLineGap, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmMacLineGap, 144)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmusMinimumPPEM, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmusMinimumPPEM, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmusMinimumPPEM, 148)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmptSubscriptSize, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmptSubscriptSize, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmptSubscriptSize, 152)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmptSubscriptOffset, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmptSubscriptOffset, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmptSubscriptOffset, 160)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmptSuperscriptSize, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmptSuperscriptSize, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmptSuperscriptSize, 168)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmptSuperscriptOffset, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmptSuperscriptOffset, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmptSuperscriptOffset, 176)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmsStrikeoutSize, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmsStrikeoutSize, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmsStrikeoutSize, 184)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmsStrikeoutPosition, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmsStrikeoutPosition, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmsStrikeoutPosition, 188)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmsUnderscoreSize, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmsUnderscoreSize, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmsUnderscoreSize, 192)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmsUnderscorePosition, 4)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmsUnderscorePosition, 4)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmsUnderscorePosition, 196)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmpFamilyName, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmpFamilyName, 8)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmpFamilyName, 200)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmpFaceName, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmpFaceName, 8)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmpFaceName, 208)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmpStyleName, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmpStyleName, 8)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmpStyleName, 216)
+    TEST_FIELD_SIZE  (OUTLINETEXTMETRICW, otmpFullName, 8)
+    TEST_FIELD_ALIGN (OUTLINETEXTMETRICW, otmpFullName, 8)
+    TEST_FIELD_OFFSET(OUTLINETEXTMETRICW, otmpFullName, 224)
+}
+
+static void test_pack_PABC(void)
+{
+    /* PABC */
+    TEST_TYPE_SIZE   (PABC, 8)
+    TEST_TYPE_ALIGN  (PABC, 8)
+    TEST_TARGET_SIZE (PABC, 12)
+    TEST_TARGET_ALIGN(PABC, 4)
+}
+
+static void test_pack_PABCFLOAT(void)
+{
+    /* PABCFLOAT */
+    TEST_TYPE_SIZE   (PABCFLOAT, 8)
+    TEST_TYPE_ALIGN  (PABCFLOAT, 8)
+    TEST_TARGET_SIZE (PABCFLOAT, 12)
+    TEST_TARGET_ALIGN(PABCFLOAT, 4)
+}
+
+static void test_pack_PANOSE(void)
+{
+    /* PANOSE */
+    TEST_TYPE_SIZE   (PANOSE, 10)
+    TEST_TYPE_ALIGN  (PANOSE, 1)
+    TEST_FIELD_SIZE  (PANOSE, bFamilyType, 1)
+    TEST_FIELD_ALIGN (PANOSE, bFamilyType, 1)
+    TEST_FIELD_OFFSET(PANOSE, bFamilyType, 0)
+    TEST_FIELD_SIZE  (PANOSE, bSerifStyle, 1)
+    TEST_FIELD_ALIGN (PANOSE, bSerifStyle, 1)
+    TEST_FIELD_OFFSET(PANOSE, bSerifStyle, 1)
+    TEST_FIELD_SIZE  (PANOSE, bWeight, 1)
+    TEST_FIELD_ALIGN (PANOSE, bWeight, 1)
+    TEST_FIELD_OFFSET(PANOSE, bWeight, 2)
+    TEST_FIELD_SIZE  (PANOSE, bProportion, 1)
+    TEST_FIELD_ALIGN (PANOSE, bProportion, 1)
+    TEST_FIELD_OFFSET(PANOSE, bProportion, 3)
+    TEST_FIELD_SIZE  (PANOSE, bContrast, 1)
+    TEST_FIELD_ALIGN (PANOSE, bContrast, 1)
+    TEST_FIELD_OFFSET(PANOSE, bContrast, 4)
+    TEST_FIELD_SIZE  (PANOSE, bStrokeVariation, 1)
+    TEST_FIELD_ALIGN (PANOSE, bStrokeVariation, 1)
+    TEST_FIELD_OFFSET(PANOSE, bStrokeVariation, 5)
+    TEST_FIELD_SIZE  (PANOSE, bArmStyle, 1)
+    TEST_FIELD_ALIGN (PANOSE, bArmStyle, 1)
+    TEST_FIELD_OFFSET(PANOSE, bArmStyle, 6)
+    TEST_FIELD_SIZE  (PANOSE, bLetterform, 1)
+    TEST_FIELD_ALIGN (PANOSE, bLetterform, 1)
+    TEST_FIELD_OFFSET(PANOSE, bLetterform, 7)
+    TEST_FIELD_SIZE  (PANOSE, bMidline, 1)
+    TEST_FIELD_ALIGN (PANOSE, bMidline, 1)
+    TEST_FIELD_OFFSET(PANOSE, bMidline, 8)
+    TEST_FIELD_SIZE  (PANOSE, bXHeight, 1)
+    TEST_FIELD_ALIGN (PANOSE, bXHeight, 1)
+    TEST_FIELD_OFFSET(PANOSE, bXHeight, 9)
+}
+
+static void test_pack_PATTERN(void)
+{
+    /* PATTERN */
+    TEST_TYPE_SIZE   (PATTERN, 16)
+    TEST_TYPE_ALIGN  (PATTERN, 8)
+}
+
+static void test_pack_PBITMAP(void)
+{
+    /* PBITMAP */
+    TEST_TYPE_SIZE   (PBITMAP, 8)
+    TEST_TYPE_ALIGN  (PBITMAP, 8)
+    TEST_TARGET_SIZE (PBITMAP, 32)
+    TEST_TARGET_ALIGN(PBITMAP, 8)
+}
+
+static void test_pack_PBITMAPCOREHEADER(void)
+{
+    /* PBITMAPCOREHEADER */
+    TEST_TYPE_SIZE   (PBITMAPCOREHEADER, 8)
+    TEST_TYPE_ALIGN  (PBITMAPCOREHEADER, 8)
+    TEST_TARGET_SIZE (PBITMAPCOREHEADER, 12)
+    TEST_TARGET_ALIGN(PBITMAPCOREHEADER, 4)
+}
+
+static void test_pack_PBITMAPCOREINFO(void)
+{
+    /* PBITMAPCOREINFO */
+    TEST_TYPE_SIZE   (PBITMAPCOREINFO, 8)
+    TEST_TYPE_ALIGN  (PBITMAPCOREINFO, 8)
+    TEST_TARGET_SIZE (PBITMAPCOREINFO, 16)
+    TEST_TARGET_ALIGN(PBITMAPCOREINFO, 4)
+}
+
+static void test_pack_PBITMAPFILEHEADER(void)
+{
+    /* PBITMAPFILEHEADER */
+    TEST_TYPE_SIZE   (PBITMAPFILEHEADER, 8)
+    TEST_TYPE_ALIGN  (PBITMAPFILEHEADER, 8)
+    TEST_TARGET_SIZE (PBITMAPFILEHEADER, 14)
+    TEST_TARGET_ALIGN(PBITMAPFILEHEADER, 2)
+}
+
+static void test_pack_PBITMAPINFO(void)
+{
+    /* PBITMAPINFO */
+    TEST_TYPE_SIZE   (PBITMAPINFO, 8)
+    TEST_TYPE_ALIGN  (PBITMAPINFO, 8)
+    TEST_TARGET_SIZE (PBITMAPINFO, 44)
+    TEST_TARGET_ALIGN(PBITMAPINFO, 4)
+}
+
+static void test_pack_PBITMAPINFOHEADER(void)
+{
+    /* PBITMAPINFOHEADER */
+    TEST_TYPE_SIZE   (PBITMAPINFOHEADER, 8)
+    TEST_TYPE_ALIGN  (PBITMAPINFOHEADER, 8)
+    TEST_TARGET_SIZE (PBITMAPINFOHEADER, 40)
+    TEST_TARGET_ALIGN(PBITMAPINFOHEADER, 4)
+}
+
+static void test_pack_PBITMAPV4HEADER(void)
+{
+    /* PBITMAPV4HEADER */
+    TEST_TYPE_SIZE   (PBITMAPV4HEADER, 8)
+    TEST_TYPE_ALIGN  (PBITMAPV4HEADER, 8)
+    TEST_TARGET_SIZE (PBITMAPV4HEADER, 108)
+    TEST_TARGET_ALIGN(PBITMAPV4HEADER, 4)
+}
+
+static void test_pack_PBITMAPV5HEADER(void)
+{
+    /* PBITMAPV5HEADER */
+    TEST_TYPE_SIZE   (PBITMAPV5HEADER, 8)
+    TEST_TYPE_ALIGN  (PBITMAPV5HEADER, 8)
+    TEST_TARGET_SIZE (PBITMAPV5HEADER, 124)
+    TEST_TARGET_ALIGN(PBITMAPV5HEADER, 4)
+}
+
+static void test_pack_PBLENDFUNCTION(void)
+{
+    /* PBLENDFUNCTION */
+    TEST_TYPE_SIZE   (PBLENDFUNCTION, 8)
+    TEST_TYPE_ALIGN  (PBLENDFUNCTION, 8)
+    TEST_TARGET_SIZE (PBLENDFUNCTION, 4)
+    TEST_TARGET_ALIGN(PBLENDFUNCTION, 1)
+}
+
+static void test_pack_PCHARSETINFO(void)
+{
+    /* PCHARSETINFO */
+    TEST_TYPE_SIZE   (PCHARSETINFO, 8)
+    TEST_TYPE_ALIGN  (PCHARSETINFO, 8)
+    TEST_TARGET_SIZE (PCHARSETINFO, 32)
+    TEST_TARGET_ALIGN(PCHARSETINFO, 4)
+}
+
+static void test_pack_PCOLORADJUSTMENT(void)
+{
+    /* PCOLORADJUSTMENT */
+    TEST_TYPE_SIZE   (PCOLORADJUSTMENT, 8)
+    TEST_TYPE_ALIGN  (PCOLORADJUSTMENT, 8)
+    TEST_TARGET_SIZE (PCOLORADJUSTMENT, 24)
+    TEST_TARGET_ALIGN(PCOLORADJUSTMENT, 2)
+}
+
+static void test_pack_PDEVMODEA(void)
+{
+    /* PDEVMODEA */
+    TEST_TYPE_SIZE   (PDEVMODEA, 8)
+    TEST_TYPE_ALIGN  (PDEVMODEA, 8)
+}
+
+static void test_pack_PDEVMODEW(void)
+{
+    /* PDEVMODEW */
+    TEST_TYPE_SIZE   (PDEVMODEW, 8)
+    TEST_TYPE_ALIGN  (PDEVMODEW, 8)
+}
+
+static void test_pack_PDIBSECTION(void)
+{
+    /* PDIBSECTION */
+    TEST_TYPE_SIZE   (PDIBSECTION, 8)
+    TEST_TYPE_ALIGN  (PDIBSECTION, 8)
+    TEST_TARGET_SIZE (PDIBSECTION, 104)
+    TEST_TARGET_ALIGN(PDIBSECTION, 8)
+}
+
+static void test_pack_PDISPLAY_DEVICEA(void)
+{
+    /* PDISPLAY_DEVICEA */
+    TEST_TYPE_SIZE   (PDISPLAY_DEVICEA, 8)
+    TEST_TYPE_ALIGN  (PDISPLAY_DEVICEA, 8)
+    TEST_TARGET_SIZE (PDISPLAY_DEVICEA, 424)
+    TEST_TARGET_ALIGN(PDISPLAY_DEVICEA, 4)
+}
+
+static void test_pack_PDISPLAY_DEVICEW(void)
+{
+    /* PDISPLAY_DEVICEW */
+    TEST_TYPE_SIZE   (PDISPLAY_DEVICEW, 8)
+    TEST_TYPE_ALIGN  (PDISPLAY_DEVICEW, 8)
+    TEST_TARGET_SIZE (PDISPLAY_DEVICEW, 840)
+    TEST_TARGET_ALIGN(PDISPLAY_DEVICEW, 4)
+}
+
+static void test_pack_PELARRAY(void)
+{
+    /* PELARRAY */
+    TEST_TYPE_SIZE   (PELARRAY, 20)
+    TEST_TYPE_ALIGN  (PELARRAY, 4)
+    TEST_FIELD_SIZE  (PELARRAY, paXCount, 4)
+    TEST_FIELD_ALIGN (PELARRAY, paXCount, 4)
+    TEST_FIELD_OFFSET(PELARRAY, paXCount, 0)
+    TEST_FIELD_SIZE  (PELARRAY, paYCount, 4)
+    TEST_FIELD_ALIGN (PELARRAY, paYCount, 4)
+    TEST_FIELD_OFFSET(PELARRAY, paYCount, 4)
+    TEST_FIELD_SIZE  (PELARRAY, paXExt, 4)
+    TEST_FIELD_ALIGN (PELARRAY, paXExt, 4)
+    TEST_FIELD_OFFSET(PELARRAY, paXExt, 8)
+    TEST_FIELD_SIZE  (PELARRAY, paYExt, 4)
+    TEST_FIELD_ALIGN (PELARRAY, paYExt, 4)
+    TEST_FIELD_OFFSET(PELARRAY, paYExt, 12)
+    TEST_FIELD_SIZE  (PELARRAY, paRGBs, 1)
+    TEST_FIELD_ALIGN (PELARRAY, paRGBs, 1)
+    TEST_FIELD_OFFSET(PELARRAY, paRGBs, 16)
+}
+
+static void test_pack_PEMR(void)
+{
+    /* PEMR */
+    TEST_TYPE_SIZE   (PEMR, 8)
+    TEST_TYPE_ALIGN  (PEMR, 8)
+    TEST_TARGET_SIZE (PEMR, 8)
+    TEST_TARGET_ALIGN(PEMR, 4)
+}
+
+static void test_pack_PEMRABORTPATH(void)
+{
+    /* PEMRABORTPATH */
+    TEST_TYPE_SIZE   (PEMRABORTPATH, 8)
+    TEST_TYPE_ALIGN  (PEMRABORTPATH, 8)
+    TEST_TARGET_SIZE (PEMRABORTPATH, 8)
+    TEST_TARGET_ALIGN(PEMRABORTPATH, 4)
+}
+
+static void test_pack_PEMRANGLEARC(void)
+{
+    /* PEMRANGLEARC */
+    TEST_TYPE_SIZE   (PEMRANGLEARC, 8)
+    TEST_TYPE_ALIGN  (PEMRANGLEARC, 8)
+    TEST_TARGET_SIZE (PEMRANGLEARC, 28)
+    TEST_TARGET_ALIGN(PEMRANGLEARC, 4)
+}
+
+static void test_pack_PEMRARC(void)
+{
+    /* PEMRARC */
+    TEST_TYPE_SIZE   (PEMRARC, 8)
+    TEST_TYPE_ALIGN  (PEMRARC, 8)
+    TEST_TARGET_SIZE (PEMRARC, 40)
+    TEST_TARGET_ALIGN(PEMRARC, 4)
+}
+
+static void test_pack_PEMRARCTO(void)
+{
+    /* PEMRARCTO */
+    TEST_TYPE_SIZE   (PEMRARCTO, 8)
+    TEST_TYPE_ALIGN  (PEMRARCTO, 8)
+    TEST_TARGET_SIZE (PEMRARCTO, 40)
+    TEST_TARGET_ALIGN(PEMRARCTO, 4)
+}
+
+static void test_pack_PEMRBEGINPATH(void)
+{
+    /* PEMRBEGINPATH */
+    TEST_TYPE_SIZE   (PEMRBEGINPATH, 8)
+    TEST_TYPE_ALIGN  (PEMRBEGINPATH, 8)
+    TEST_TARGET_SIZE (PEMRBEGINPATH, 8)
+    TEST_TARGET_ALIGN(PEMRBEGINPATH, 4)
+}
+
+static void test_pack_PEMRBITBLT(void)
+{
+    /* PEMRBITBLT */
+    TEST_TYPE_SIZE   (PEMRBITBLT, 8)
+    TEST_TYPE_ALIGN  (PEMRBITBLT, 8)
+    TEST_TARGET_SIZE (PEMRBITBLT, 100)
+    TEST_TARGET_ALIGN(PEMRBITBLT, 4)
+}
+
+static void test_pack_PEMRCHORD(void)
+{
+    /* PEMRCHORD */
+    TEST_TYPE_SIZE   (PEMRCHORD, 8)
+    TEST_TYPE_ALIGN  (PEMRCHORD, 8)
+    TEST_TARGET_SIZE (PEMRCHORD, 40)
+    TEST_TARGET_ALIGN(PEMRCHORD, 4)
+}
+
+static void test_pack_PEMRCLOSEFIGURE(void)
+{
+    /* PEMRCLOSEFIGURE */
+    TEST_TYPE_SIZE   (PEMRCLOSEFIGURE, 8)
+    TEST_TYPE_ALIGN  (PEMRCLOSEFIGURE, 8)
+    TEST_TARGET_SIZE (PEMRCLOSEFIGURE, 8)
+    TEST_TARGET_ALIGN(PEMRCLOSEFIGURE, 4)
+}
+
+static void test_pack_PEMRCREATEBRUSHINDIRECT(void)
+{
+    /* PEMRCREATEBRUSHINDIRECT */
+    TEST_TYPE_SIZE   (PEMRCREATEBRUSHINDIRECT, 8)
+    TEST_TYPE_ALIGN  (PEMRCREATEBRUSHINDIRECT, 8)
+    TEST_TARGET_SIZE (PEMRCREATEBRUSHINDIRECT, 24)
+    TEST_TARGET_ALIGN(PEMRCREATEBRUSHINDIRECT, 4)
+}
+
+static void test_pack_PEMRCREATECOLORSPACE(void)
+{
+    /* PEMRCREATECOLORSPACE */
+    TEST_TYPE_SIZE   (PEMRCREATECOLORSPACE, 8)
+    TEST_TYPE_ALIGN  (PEMRCREATECOLORSPACE, 8)
+    TEST_TARGET_SIZE (PEMRCREATECOLORSPACE, 340)
+    TEST_TARGET_ALIGN(PEMRCREATECOLORSPACE, 4)
+}
+
+static void test_pack_PEMRCREATECOLORSPACEW(void)
+{
+    /* PEMRCREATECOLORSPACEW */
+    TEST_TYPE_SIZE   (PEMRCREATECOLORSPACEW, 8)
+    TEST_TYPE_ALIGN  (PEMRCREATECOLORSPACEW, 8)
+    TEST_TARGET_SIZE (PEMRCREATECOLORSPACEW, 612)
+    TEST_TARGET_ALIGN(PEMRCREATECOLORSPACEW, 4)
+}
+
+static void test_pack_PEMRCREATEDIBPATTERNBRUSHPT(void)
+{
+    /* PEMRCREATEDIBPATTERNBRUSHPT */
+    TEST_TYPE_SIZE   (PEMRCREATEDIBPATTERNBRUSHPT, 8)
+    TEST_TYPE_ALIGN  (PEMRCREATEDIBPATTERNBRUSHPT, 8)
+    TEST_TARGET_SIZE (PEMRCREATEDIBPATTERNBRUSHPT, 32)
+    TEST_TARGET_ALIGN(PEMRCREATEDIBPATTERNBRUSHPT, 4)
+}
+
+static void test_pack_PEMRCREATEMONOBRUSH(void)
+{
+    /* PEMRCREATEMONOBRUSH */
+    TEST_TYPE_SIZE   (PEMRCREATEMONOBRUSH, 8)
+    TEST_TYPE_ALIGN  (PEMRCREATEMONOBRUSH, 8)
+    TEST_TARGET_SIZE (PEMRCREATEMONOBRUSH, 32)
+    TEST_TARGET_ALIGN(PEMRCREATEMONOBRUSH, 4)
+}
+
+static void test_pack_PEMRCREATEPALETTE(void)
+{
+    /* PEMRCREATEPALETTE */
+    TEST_TYPE_SIZE   (PEMRCREATEPALETTE, 8)
+    TEST_TYPE_ALIGN  (PEMRCREATEPALETTE, 8)
+    TEST_TARGET_SIZE (PEMRCREATEPALETTE, 20)
+    TEST_TARGET_ALIGN(PEMRCREATEPALETTE, 4)
+}
+
+static void test_pack_PEMRCREATEPEN(void)
+{
+    /* PEMRCREATEPEN */
+    TEST_TYPE_SIZE   (PEMRCREATEPEN, 8)
+    TEST_TYPE_ALIGN  (PEMRCREATEPEN, 8)
+    TEST_TARGET_SIZE (PEMRCREATEPEN, 28)
+    TEST_TARGET_ALIGN(PEMRCREATEPEN, 4)
+}
+
+static void test_pack_PEMRDELETECOLORSPACE(void)
+{
+    /* PEMRDELETECOLORSPACE */
+    TEST_TYPE_SIZE   (PEMRDELETECOLORSPACE, 8)
+    TEST_TYPE_ALIGN  (PEMRDELETECOLORSPACE, 8)
+    TEST_TARGET_SIZE (PEMRDELETECOLORSPACE, 12)
+    TEST_TARGET_ALIGN(PEMRDELETECOLORSPACE, 4)
+}
+
+static void test_pack_PEMRDELETEOBJECT(void)
+{
+    /* PEMRDELETEOBJECT */
+    TEST_TYPE_SIZE   (PEMRDELETEOBJECT, 8)
+    TEST_TYPE_ALIGN  (PEMRDELETEOBJECT, 8)
+    TEST_TARGET_SIZE (PEMRDELETEOBJECT, 12)
+    TEST_TARGET_ALIGN(PEMRDELETEOBJECT, 4)
+}
+
+static void test_pack_PEMRELLIPSE(void)
+{
+    /* PEMRELLIPSE */
+    TEST_TYPE_SIZE   (PEMRELLIPSE, 8)
+    TEST_TYPE_ALIGN  (PEMRELLIPSE, 8)
+    TEST_TARGET_SIZE (PEMRELLIPSE, 24)
+    TEST_TARGET_ALIGN(PEMRELLIPSE, 4)
+}
+
+static void test_pack_PEMRENDPATH(void)
+{
+    /* PEMRENDPATH */
+    TEST_TYPE_SIZE   (PEMRENDPATH, 8)
+    TEST_TYPE_ALIGN  (PEMRENDPATH, 8)
+    TEST_TARGET_SIZE (PEMRENDPATH, 8)
+    TEST_TARGET_ALIGN(PEMRENDPATH, 4)
+}
+
+static void test_pack_PEMREOF(void)
+{
+    /* PEMREOF */
+    TEST_TYPE_SIZE   (PEMREOF, 8)
+    TEST_TYPE_ALIGN  (PEMREOF, 8)
+    TEST_TARGET_SIZE (PEMREOF, 20)
+    TEST_TARGET_ALIGN(PEMREOF, 4)
+}
+
+static void test_pack_PEMREXCLUDECLIPRECT(void)
+{
+    /* PEMREXCLUDECLIPRECT */
+    TEST_TYPE_SIZE   (PEMREXCLUDECLIPRECT, 8)
+    TEST_TYPE_ALIGN  (PEMREXCLUDECLIPRECT, 8)
+    TEST_TARGET_SIZE (PEMREXCLUDECLIPRECT, 24)
+    TEST_TARGET_ALIGN(PEMREXCLUDECLIPRECT, 4)
+}
+
+static void test_pack_PEMREXTCREATEFONTINDIRECTW(void)
+{
+    /* PEMREXTCREATEFONTINDIRECTW */
+    TEST_TYPE_SIZE   (PEMREXTCREATEFONTINDIRECTW, 8)
+    TEST_TYPE_ALIGN  (PEMREXTCREATEFONTINDIRECTW, 8)
+    TEST_TARGET_SIZE (PEMREXTCREATEFONTINDIRECTW, 332)
+    TEST_TARGET_ALIGN(PEMREXTCREATEFONTINDIRECTW, 4)
+}
+
+static void test_pack_PEMREXTCREATEPEN(void)
+{
+    /* PEMREXTCREATEPEN */
+    TEST_TYPE_SIZE   (PEMREXTCREATEPEN, 8)
+    TEST_TYPE_ALIGN  (PEMREXTCREATEPEN, 8)
+    TEST_TARGET_SIZE (PEMREXTCREATEPEN, 64)
+    TEST_TARGET_ALIGN(PEMREXTCREATEPEN, 8)
+}
+
+static void test_pack_PEMREXTFLOODFILL(void)
+{
+    /* PEMREXTFLOODFILL */
+    TEST_TYPE_SIZE   (PEMREXTFLOODFILL, 8)
+    TEST_TYPE_ALIGN  (PEMREXTFLOODFILL, 8)
+    TEST_TARGET_SIZE (PEMREXTFLOODFILL, 24)
+    TEST_TARGET_ALIGN(PEMREXTFLOODFILL, 4)
+}
+
+static void test_pack_PEMREXTSELECTCLIPRGN(void)
+{
+    /* PEMREXTSELECTCLIPRGN */
+    TEST_TYPE_SIZE   (PEMREXTSELECTCLIPRGN, 8)
+    TEST_TYPE_ALIGN  (PEMREXTSELECTCLIPRGN, 8)
+    TEST_TARGET_SIZE (PEMREXTSELECTCLIPRGN, 20)
+    TEST_TARGET_ALIGN(PEMREXTSELECTCLIPRGN, 4)
+}
+
+static void test_pack_PEMREXTTEXTOUTA(void)
+{
+    /* PEMREXTTEXTOUTA */
+    TEST_TYPE_SIZE   (PEMREXTTEXTOUTA, 8)
+    TEST_TYPE_ALIGN  (PEMREXTTEXTOUTA, 8)
+    TEST_TARGET_SIZE (PEMREXTTEXTOUTA, 76)
+    TEST_TARGET_ALIGN(PEMREXTTEXTOUTA, 4)
+}
+
+static void test_pack_PEMREXTTEXTOUTW(void)
+{
+    /* PEMREXTTEXTOUTW */
+    TEST_TYPE_SIZE   (PEMREXTTEXTOUTW, 8)
+    TEST_TYPE_ALIGN  (PEMREXTTEXTOUTW, 8)
+    TEST_TARGET_SIZE (PEMREXTTEXTOUTW, 76)
+    TEST_TARGET_ALIGN(PEMREXTTEXTOUTW, 4)
+}
+
+static void test_pack_PEMRFILLPATH(void)
+{
+    /* PEMRFILLPATH */
+    TEST_TYPE_SIZE   (PEMRFILLPATH, 8)
+    TEST_TYPE_ALIGN  (PEMRFILLPATH, 8)
+    TEST_TARGET_SIZE (PEMRFILLPATH, 24)
+    TEST_TARGET_ALIGN(PEMRFILLPATH, 4)
+}
+
+static void test_pack_PEMRFILLRGN(void)
+{
+    /* PEMRFILLRGN */
+    TEST_TYPE_SIZE   (PEMRFILLRGN, 8)
+    TEST_TYPE_ALIGN  (PEMRFILLRGN, 8)
+    TEST_TARGET_SIZE (PEMRFILLRGN, 36)
+    TEST_TARGET_ALIGN(PEMRFILLRGN, 4)
+}
+
+static void test_pack_PEMRFLATTENPATH(void)
+{
+    /* PEMRFLATTENPATH */
+    TEST_TYPE_SIZE   (PEMRFLATTENPATH, 8)
+    TEST_TYPE_ALIGN  (PEMRFLATTENPATH, 8)
+    TEST_TARGET_SIZE (PEMRFLATTENPATH, 8)
+    TEST_TARGET_ALIGN(PEMRFLATTENPATH, 4)
+}
+
+static void test_pack_PEMRFORMAT(void)
+{
+    /* PEMRFORMAT */
+    TEST_TYPE_SIZE   (PEMRFORMAT, 8)
+    TEST_TYPE_ALIGN  (PEMRFORMAT, 8)
+    TEST_TARGET_SIZE (PEMRFORMAT, 16)
+    TEST_TARGET_ALIGN(PEMRFORMAT, 4)
+}
+
+static void test_pack_PEMRFRAMERGN(void)
+{
+    /* PEMRFRAMERGN */
+    TEST_TYPE_SIZE   (PEMRFRAMERGN, 8)
+    TEST_TYPE_ALIGN  (PEMRFRAMERGN, 8)
+    TEST_TARGET_SIZE (PEMRFRAMERGN, 44)
+    TEST_TARGET_ALIGN(PEMRFRAMERGN, 4)
+}
+
+static void test_pack_PEMRGDICOMMENT(void)
+{
+    /* PEMRGDICOMMENT */
+    TEST_TYPE_SIZE   (PEMRGDICOMMENT, 8)
+    TEST_TYPE_ALIGN  (PEMRGDICOMMENT, 8)
+    TEST_TARGET_SIZE (PEMRGDICOMMENT, 16)
+    TEST_TARGET_ALIGN(PEMRGDICOMMENT, 4)
+}
+
+static void test_pack_PEMRGLSBOUNDEDRECORD(void)
+{
+    /* PEMRGLSBOUNDEDRECORD */
+    TEST_TYPE_SIZE   (PEMRGLSBOUNDEDRECORD, 8)
+    TEST_TYPE_ALIGN  (PEMRGLSBOUNDEDRECORD, 8)
+    TEST_TARGET_SIZE (PEMRGLSBOUNDEDRECORD, 32)
+    TEST_TARGET_ALIGN(PEMRGLSBOUNDEDRECORD, 4)
+}
+
+static void test_pack_PEMRGLSRECORD(void)
+{
+    /* PEMRGLSRECORD */
+    TEST_TYPE_SIZE   (PEMRGLSRECORD, 8)
+    TEST_TYPE_ALIGN  (PEMRGLSRECORD, 8)
+    TEST_TARGET_SIZE (PEMRGLSRECORD, 16)
+    TEST_TARGET_ALIGN(PEMRGLSRECORD, 4)
+}
+
+static void test_pack_PEMRINTERSECTCLIPRECT(void)
+{
+    /* PEMRINTERSECTCLIPRECT */
+    TEST_TYPE_SIZE   (PEMRINTERSECTCLIPRECT, 8)
+    TEST_TYPE_ALIGN  (PEMRINTERSECTCLIPRECT, 8)
+    TEST_TARGET_SIZE (PEMRINTERSECTCLIPRECT, 24)
+    TEST_TARGET_ALIGN(PEMRINTERSECTCLIPRECT, 4)
+}
+
+static void test_pack_PEMRINVERTRGN(void)
+{
+    /* PEMRINVERTRGN */
+    TEST_TYPE_SIZE   (PEMRINVERTRGN, 8)
+    TEST_TYPE_ALIGN  (PEMRINVERTRGN, 8)
+    TEST_TARGET_SIZE (PEMRINVERTRGN, 32)
+    TEST_TARGET_ALIGN(PEMRINVERTRGN, 4)
+}
+
+static void test_pack_PEMRLINETO(void)
+{
+    /* PEMRLINETO */
+    TEST_TYPE_SIZE   (PEMRLINETO, 8)
+    TEST_TYPE_ALIGN  (PEMRLINETO, 8)
+    TEST_TARGET_SIZE (PEMRLINETO, 16)
+    TEST_TARGET_ALIGN(PEMRLINETO, 4)
+}
+
+static void test_pack_PEMRMASKBLT(void)
+{
+    /* PEMRMASKBLT */
+    TEST_TYPE_SIZE   (PEMRMASKBLT, 8)
+    TEST_TYPE_ALIGN  (PEMRMASKBLT, 8)
+    TEST_TARGET_SIZE (PEMRMASKBLT, 128)
+    TEST_TARGET_ALIGN(PEMRMASKBLT, 4)
+}
+
+static void test_pack_PEMRMODIFYWORLDTRANSFORM(void)
+{
+    /* PEMRMODIFYWORLDTRANSFORM */
+    TEST_TYPE_SIZE   (PEMRMODIFYWORLDTRANSFORM, 8)
+    TEST_TYPE_ALIGN  (PEMRMODIFYWORLDTRANSFORM, 8)
+    TEST_TARGET_SIZE (PEMRMODIFYWORLDTRANSFORM, 36)
+    TEST_TARGET_ALIGN(PEMRMODIFYWORLDTRANSFORM, 4)
+}
+
+static void test_pack_PEMRMOVETOEX(void)
+{
+    /* PEMRMOVETOEX */
+    TEST_TYPE_SIZE   (PEMRMOVETOEX, 8)
+    TEST_TYPE_ALIGN  (PEMRMOVETOEX, 8)
+    TEST_TARGET_SIZE (PEMRMOVETOEX, 16)
+    TEST_TARGET_ALIGN(PEMRMOVETOEX, 4)
+}
+
+static void test_pack_PEMROFFSETCLIPRGN(void)
+{
+    /* PEMROFFSETCLIPRGN */
+    TEST_TYPE_SIZE   (PEMROFFSETCLIPRGN, 8)
+    TEST_TYPE_ALIGN  (PEMROFFSETCLIPRGN, 8)
+    TEST_TARGET_SIZE (PEMROFFSETCLIPRGN, 16)
+    TEST_TARGET_ALIGN(PEMROFFSETCLIPRGN, 4)
+}
+
+static void test_pack_PEMRPAINTRGN(void)
+{
+    /* PEMRPAINTRGN */
+    TEST_TYPE_SIZE   (PEMRPAINTRGN, 8)
+    TEST_TYPE_ALIGN  (PEMRPAINTRGN, 8)
+    TEST_TARGET_SIZE (PEMRPAINTRGN, 32)
+    TEST_TARGET_ALIGN(PEMRPAINTRGN, 4)
+}
+
+static void test_pack_PEMRPIE(void)
+{
+    /* PEMRPIE */
+    TEST_TYPE_SIZE   (PEMRPIE, 8)
+    TEST_TYPE_ALIGN  (PEMRPIE, 8)
+    TEST_TARGET_SIZE (PEMRPIE, 40)
+    TEST_TARGET_ALIGN(PEMRPIE, 4)
+}
+
+static void test_pack_PEMRPIXELFORMAT(void)
+{
+    /* PEMRPIXELFORMAT */
+    TEST_TYPE_SIZE   (PEMRPIXELFORMAT, 8)
+    TEST_TYPE_ALIGN  (PEMRPIXELFORMAT, 8)
+    TEST_TARGET_SIZE (PEMRPIXELFORMAT, 48)
+    TEST_TARGET_ALIGN(PEMRPIXELFORMAT, 4)
+}
+
+static void test_pack_PEMRPLGBLT(void)
+{
+    /* PEMRPLGBLT */
+    TEST_TYPE_SIZE   (PEMRPLGBLT, 8)
+    TEST_TYPE_ALIGN  (PEMRPLGBLT, 8)
+    TEST_TARGET_SIZE (PEMRPLGBLT, 140)
+    TEST_TARGET_ALIGN(PEMRPLGBLT, 4)
+}
+
+static void test_pack_PEMRPOLYBEZIER(void)
+{
+    /* PEMRPOLYBEZIER */
+    TEST_TYPE_SIZE   (PEMRPOLYBEZIER, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYBEZIER, 8)
+    TEST_TARGET_SIZE (PEMRPOLYBEZIER, 36)
+    TEST_TARGET_ALIGN(PEMRPOLYBEZIER, 4)
+}
+
+static void test_pack_PEMRPOLYBEZIER16(void)
+{
+    /* PEMRPOLYBEZIER16 */
+    TEST_TYPE_SIZE   (PEMRPOLYBEZIER16, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYBEZIER16, 8)
+    TEST_TARGET_SIZE (PEMRPOLYBEZIER16, 32)
+    TEST_TARGET_ALIGN(PEMRPOLYBEZIER16, 4)
+}
+
+static void test_pack_PEMRPOLYBEZIERTO(void)
+{
+    /* PEMRPOLYBEZIERTO */
+    TEST_TYPE_SIZE   (PEMRPOLYBEZIERTO, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYBEZIERTO, 8)
+    TEST_TARGET_SIZE (PEMRPOLYBEZIERTO, 36)
+    TEST_TARGET_ALIGN(PEMRPOLYBEZIERTO, 4)
+}
+
+static void test_pack_PEMRPOLYBEZIERTO16(void)
+{
+    /* PEMRPOLYBEZIERTO16 */
+    TEST_TYPE_SIZE   (PEMRPOLYBEZIERTO16, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYBEZIERTO16, 8)
+    TEST_TARGET_SIZE (PEMRPOLYBEZIERTO16, 32)
+    TEST_TARGET_ALIGN(PEMRPOLYBEZIERTO16, 4)
+}
+
+static void test_pack_PEMRPOLYDRAW(void)
+{
+    /* PEMRPOLYDRAW */
+    TEST_TYPE_SIZE   (PEMRPOLYDRAW, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYDRAW, 8)
+    TEST_TARGET_SIZE (PEMRPOLYDRAW, 40)
+    TEST_TARGET_ALIGN(PEMRPOLYDRAW, 4)
+}
+
+static void test_pack_PEMRPOLYDRAW16(void)
+{
+    /* PEMRPOLYDRAW16 */
+    TEST_TYPE_SIZE   (PEMRPOLYDRAW16, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYDRAW16, 8)
+    TEST_TARGET_SIZE (PEMRPOLYDRAW16, 36)
+    TEST_TARGET_ALIGN(PEMRPOLYDRAW16, 4)
+}
+
+static void test_pack_PEMRPOLYGON(void)
+{
+    /* PEMRPOLYGON */
+    TEST_TYPE_SIZE   (PEMRPOLYGON, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYGON, 8)
+    TEST_TARGET_SIZE (PEMRPOLYGON, 36)
+    TEST_TARGET_ALIGN(PEMRPOLYGON, 4)
+}
+
+static void test_pack_PEMRPOLYGON16(void)
+{
+    /* PEMRPOLYGON16 */
+    TEST_TYPE_SIZE   (PEMRPOLYGON16, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYGON16, 8)
+    TEST_TARGET_SIZE (PEMRPOLYGON16, 32)
+    TEST_TARGET_ALIGN(PEMRPOLYGON16, 4)
+}
+
+static void test_pack_PEMRPOLYLINE(void)
+{
+    /* PEMRPOLYLINE */
+    TEST_TYPE_SIZE   (PEMRPOLYLINE, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYLINE, 8)
+    TEST_TARGET_SIZE (PEMRPOLYLINE, 36)
+    TEST_TARGET_ALIGN(PEMRPOLYLINE, 4)
+}
+
+static void test_pack_PEMRPOLYLINE16(void)
+{
+    /* PEMRPOLYLINE16 */
+    TEST_TYPE_SIZE   (PEMRPOLYLINE16, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYLINE16, 8)
+    TEST_TARGET_SIZE (PEMRPOLYLINE16, 32)
+    TEST_TARGET_ALIGN(PEMRPOLYLINE16, 4)
+}
+
+static void test_pack_PEMRPOLYLINETO(void)
+{
+    /* PEMRPOLYLINETO */
+    TEST_TYPE_SIZE   (PEMRPOLYLINETO, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYLINETO, 8)
+    TEST_TARGET_SIZE (PEMRPOLYLINETO, 36)
+    TEST_TARGET_ALIGN(PEMRPOLYLINETO, 4)
+}
+
+static void test_pack_PEMRPOLYLINETO16(void)
+{
+    /* PEMRPOLYLINETO16 */
+    TEST_TYPE_SIZE   (PEMRPOLYLINETO16, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYLINETO16, 8)
+    TEST_TARGET_SIZE (PEMRPOLYLINETO16, 32)
+    TEST_TARGET_ALIGN(PEMRPOLYLINETO16, 4)
+}
+
+static void test_pack_PEMRPOLYPOLYGON(void)
+{
+    /* PEMRPOLYPOLYGON */
+    TEST_TYPE_SIZE   (PEMRPOLYPOLYGON, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYPOLYGON, 8)
+    TEST_TARGET_SIZE (PEMRPOLYPOLYGON, 44)
+    TEST_TARGET_ALIGN(PEMRPOLYPOLYGON, 4)
+}
+
+static void test_pack_PEMRPOLYPOLYGON16(void)
+{
+    /* PEMRPOLYPOLYGON16 */
+    TEST_TYPE_SIZE   (PEMRPOLYPOLYGON16, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYPOLYGON16, 8)
+    TEST_TARGET_SIZE (PEMRPOLYPOLYGON16, 40)
+    TEST_TARGET_ALIGN(PEMRPOLYPOLYGON16, 4)
+}
+
+static void test_pack_PEMRPOLYPOLYLINE(void)
+{
+    /* PEMRPOLYPOLYLINE */
+    TEST_TYPE_SIZE   (PEMRPOLYPOLYLINE, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYPOLYLINE, 8)
+    TEST_TARGET_SIZE (PEMRPOLYPOLYLINE, 44)
+    TEST_TARGET_ALIGN(PEMRPOLYPOLYLINE, 4)
+}
+
+static void test_pack_PEMRPOLYPOLYLINE16(void)
+{
+    /* PEMRPOLYPOLYLINE16 */
+    TEST_TYPE_SIZE   (PEMRPOLYPOLYLINE16, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYPOLYLINE16, 8)
+    TEST_TARGET_SIZE (PEMRPOLYPOLYLINE16, 40)
+    TEST_TARGET_ALIGN(PEMRPOLYPOLYLINE16, 4)
+}
+
+static void test_pack_PEMRPOLYTEXTOUTA(void)
+{
+    /* PEMRPOLYTEXTOUTA */
+    TEST_TYPE_SIZE   (PEMRPOLYTEXTOUTA, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYTEXTOUTA, 8)
+    TEST_TARGET_SIZE (PEMRPOLYTEXTOUTA, 80)
+    TEST_TARGET_ALIGN(PEMRPOLYTEXTOUTA, 4)
+}
+
+static void test_pack_PEMRPOLYTEXTOUTW(void)
+{
+    /* PEMRPOLYTEXTOUTW */
+    TEST_TYPE_SIZE   (PEMRPOLYTEXTOUTW, 8)
+    TEST_TYPE_ALIGN  (PEMRPOLYTEXTOUTW, 8)
+    TEST_TARGET_SIZE (PEMRPOLYTEXTOUTW, 80)
+    TEST_TARGET_ALIGN(PEMRPOLYTEXTOUTW, 4)
+}
+
+static void test_pack_PEMRREALIZEPALETTE(void)
+{
+    /* PEMRREALIZEPALETTE */
+    TEST_TYPE_SIZE   (PEMRREALIZEPALETTE, 8)
+    TEST_TYPE_ALIGN  (PEMRREALIZEPALETTE, 8)
+    TEST_TARGET_SIZE (PEMRREALIZEPALETTE, 8)
+    TEST_TARGET_ALIGN(PEMRREALIZEPALETTE, 4)
+}
+
+static void test_pack_PEMRRECTANGLE(void)
+{
+    /* PEMRRECTANGLE */
+    TEST_TYPE_SIZE   (PEMRRECTANGLE, 8)
+    TEST_TYPE_ALIGN  (PEMRRECTANGLE, 8)
+    TEST_TARGET_SIZE (PEMRRECTANGLE, 24)
+    TEST_TARGET_ALIGN(PEMRRECTANGLE, 4)
+}
+
+static void test_pack_PEMRRESIZEPALETTE(void)
+{
+    /* PEMRRESIZEPALETTE */
+    TEST_TYPE_SIZE   (PEMRRESIZEPALETTE, 8)
+    TEST_TYPE_ALIGN  (PEMRRESIZEPALETTE, 8)
+    TEST_TARGET_SIZE (PEMRRESIZEPALETTE, 16)
+    TEST_TARGET_ALIGN(PEMRRESIZEPALETTE, 4)
+}
+
+static void test_pack_PEMRRESTOREDC(void)
+{
+    /* PEMRRESTOREDC */
+    TEST_TYPE_SIZE   (PEMRRESTOREDC, 8)
+    TEST_TYPE_ALIGN  (PEMRRESTOREDC, 8)
+    TEST_TARGET_SIZE (PEMRRESTOREDC, 12)
+    TEST_TARGET_ALIGN(PEMRRESTOREDC, 4)
+}
+
+static void test_pack_PEMRROUNDRECT(void)
+{
+    /* PEMRROUNDRECT */
+    TEST_TYPE_SIZE   (PEMRROUNDRECT, 8)
+    TEST_TYPE_ALIGN  (PEMRROUNDRECT, 8)
+    TEST_TARGET_SIZE (PEMRROUNDRECT, 32)
+    TEST_TARGET_ALIGN(PEMRROUNDRECT, 4)
+}
+
+static void test_pack_PEMRSAVEDC(void)
+{
+    /* PEMRSAVEDC */
+    TEST_TYPE_SIZE   (PEMRSAVEDC, 8)
+    TEST_TYPE_ALIGN  (PEMRSAVEDC, 8)
+    TEST_TARGET_SIZE (PEMRSAVEDC, 8)
+    TEST_TARGET_ALIGN(PEMRSAVEDC, 4)
+}
+
+static void test_pack_PEMRSCALEVIEWPORTEXTEX(void)
+{
+    /* PEMRSCALEVIEWPORTEXTEX */
+    TEST_TYPE_SIZE   (PEMRSCALEVIEWPORTEXTEX, 8)
+    TEST_TYPE_ALIGN  (PEMRSCALEVIEWPORTEXTEX, 8)
+    TEST_TARGET_SIZE (PEMRSCALEVIEWPORTEXTEX, 24)
+    TEST_TARGET_ALIGN(PEMRSCALEVIEWPORTEXTEX, 4)
+}
+
+static void test_pack_PEMRSCALEWINDOWEXTEX(void)
+{
+    /* PEMRSCALEWINDOWEXTEX */
+    TEST_TYPE_SIZE   (PEMRSCALEWINDOWEXTEX, 8)
+    TEST_TYPE_ALIGN  (PEMRSCALEWINDOWEXTEX, 8)
+    TEST_TARGET_SIZE (PEMRSCALEWINDOWEXTEX, 24)
+    TEST_TARGET_ALIGN(PEMRSCALEWINDOWEXTEX, 4)
+}
+
+static void test_pack_PEMRSELECTCLIPPATH(void)
+{
+    /* PEMRSELECTCLIPPATH */
+    TEST_TYPE_SIZE   (PEMRSELECTCLIPPATH, 8)
+    TEST_TYPE_ALIGN  (PEMRSELECTCLIPPATH, 8)
+    TEST_TARGET_SIZE (PEMRSELECTCLIPPATH, 12)
+    TEST_TARGET_ALIGN(PEMRSELECTCLIPPATH, 4)
+}
+
+static void test_pack_PEMRSELECTCOLORSPACE(void)
+{
+    /* PEMRSELECTCOLORSPACE */
+    TEST_TYPE_SIZE   (PEMRSELECTCOLORSPACE, 8)
+    TEST_TYPE_ALIGN  (PEMRSELECTCOLORSPACE, 8)
+    TEST_TARGET_SIZE (PEMRSELECTCOLORSPACE, 12)
+    TEST_TARGET_ALIGN(PEMRSELECTCOLORSPACE, 4)
+}
+
+static void test_pack_PEMRSELECTOBJECT(void)
+{
+    /* PEMRSELECTOBJECT */
+    TEST_TYPE_SIZE   (PEMRSELECTOBJECT, 8)
+    TEST_TYPE_ALIGN  (PEMRSELECTOBJECT, 8)
+    TEST_TARGET_SIZE (PEMRSELECTOBJECT, 12)
+    TEST_TARGET_ALIGN(PEMRSELECTOBJECT, 4)
+}
+
+static void test_pack_PEMRSELECTPALETTE(void)
+{
+    /* PEMRSELECTPALETTE */
+    TEST_TYPE_SIZE   (PEMRSELECTPALETTE, 8)
+    TEST_TYPE_ALIGN  (PEMRSELECTPALETTE, 8)
+    TEST_TARGET_SIZE (PEMRSELECTPALETTE, 12)
+    TEST_TARGET_ALIGN(PEMRSELECTPALETTE, 4)
+}
+
+static void test_pack_PEMRSETARCDIRECTION(void)
+{
+    /* PEMRSETARCDIRECTION */
+    TEST_TYPE_SIZE   (PEMRSETARCDIRECTION, 8)
+    TEST_TYPE_ALIGN  (PEMRSETARCDIRECTION, 8)
+    TEST_TARGET_SIZE (PEMRSETARCDIRECTION, 12)
+    TEST_TARGET_ALIGN(PEMRSETARCDIRECTION, 4)
+}
+
+static void test_pack_PEMRSETBKCOLOR(void)
+{
+    /* PEMRSETBKCOLOR */
+    TEST_TYPE_SIZE   (PEMRSETBKCOLOR, 8)
+    TEST_TYPE_ALIGN  (PEMRSETBKCOLOR, 8)
+    TEST_TARGET_SIZE (PEMRSETBKCOLOR, 12)
+    TEST_TARGET_ALIGN(PEMRSETBKCOLOR, 4)
+}
+
+static void test_pack_PEMRSETBKMODE(void)
+{
+    /* PEMRSETBKMODE */
+    TEST_TYPE_SIZE   (PEMRSETBKMODE, 8)
+    TEST_TYPE_ALIGN  (PEMRSETBKMODE, 8)
+    TEST_TARGET_SIZE (PEMRSETBKMODE, 12)
+    TEST_TARGET_ALIGN(PEMRSETBKMODE, 4)
+}
+
+static void test_pack_PEMRSETBRUSHORGEX(void)
+{
+    /* PEMRSETBRUSHORGEX */
+    TEST_TYPE_SIZE   (PEMRSETBRUSHORGEX, 8)
+    TEST_TYPE_ALIGN  (PEMRSETBRUSHORGEX, 8)
+    TEST_TARGET_SIZE (PEMRSETBRUSHORGEX, 16)
+    TEST_TARGET_ALIGN(PEMRSETBRUSHORGEX, 4)
+}
+
+static void test_pack_PEMRSETCOLORADJUSTMENT(void)
+{
+    /* PEMRSETCOLORADJUSTMENT */
+    TEST_TYPE_SIZE   (PEMRSETCOLORADJUSTMENT, 8)
+    TEST_TYPE_ALIGN  (PEMRSETCOLORADJUSTMENT, 8)
+    TEST_TARGET_SIZE (PEMRSETCOLORADJUSTMENT, 32)
+    TEST_TARGET_ALIGN(PEMRSETCOLORADJUSTMENT, 4)
+}
+
+static void test_pack_PEMRSETCOLORSPACE(void)
+{
+    /* PEMRSETCOLORSPACE */
+    TEST_TYPE_SIZE   (PEMRSETCOLORSPACE, 8)
+    TEST_TYPE_ALIGN  (PEMRSETCOLORSPACE, 8)
+    TEST_TARGET_SIZE (PEMRSETCOLORSPACE, 12)
+    TEST_TARGET_ALIGN(PEMRSETCOLORSPACE, 4)
+}
+
+static void test_pack_PEMRSETDIBITSTODEVICE(void)
+{
+    /* PEMRSETDIBITSTODEVICE */
+    TEST_TYPE_SIZE   (PEMRSETDIBITSTODEVICE, 8)
+    TEST_TYPE_ALIGN  (PEMRSETDIBITSTODEVICE, 8)
+    TEST_TARGET_SIZE (PEMRSETDIBITSTODEVICE, 76)
+    TEST_TARGET_ALIGN(PEMRSETDIBITSTODEVICE, 4)
+}
+
+static void test_pack_PEMRSETICMMODE(void)
+{
+    /* PEMRSETICMMODE */
+    TEST_TYPE_SIZE   (PEMRSETICMMODE, 8)
+    TEST_TYPE_ALIGN  (PEMRSETICMMODE, 8)
+    TEST_TARGET_SIZE (PEMRSETICMMODE, 12)
+    TEST_TARGET_ALIGN(PEMRSETICMMODE, 4)
+}
+
+static void test_pack_PEMRSETLAYOUT(void)
+{
+    /* PEMRSETLAYOUT&n