diff --git a/tools/winapi/winapi_test b/tools/winapi/winapi_test
index 3e7582e38cba5bad84ef97670cb3d05f7e8ff7f2..15aa2a29f1e8c5e038b0624be4d1410c94b6c953 100755
--- a/tools/winapi/winapi_test
+++ b/tools/winapi/winapi_test
@@ -390,7 +390,6 @@ sub output_header {
     print OUT "#include <stdio.h>\n";
     print OUT "\n";
     print OUT "#include \"wine/test.h\"\n";
-    print OUT "#include \"wine/test_generated.h\"\n";
     foreach my $test (@tests) {
 	my @includes = $tests->get_section($test_dir, $test, "include");
 	foreach my $include (@includes) {
@@ -398,6 +397,57 @@ sub output_header {
 	}
     }
     print OUT "\n";
+
+
+    print OUT "/***********************************************************************\n";
+    print OUT " * Windows API extension\n";
+    print OUT " */\n";
+    print OUT "\n";
+    print OUT "#if (_MSC_VER >= 1300) && defined(__cplusplus)\n";
+    print OUT "# define FIELD_ALIGNMENT(type, field) __alignof(((type*)0)->field)\n";
+    print OUT "#elif defined(__GNUC__)\n";
+    print OUT "# define FIELD_ALIGNMENT(type, field) __alignof__(((type*)0)->field)\n";
+    print OUT "#else\n";
+    print OUT "/* FIXME: Not sure if is possible to do without compiler extension */\n";
+    print OUT "#endif\n";
+    print OUT "\n";
+    print OUT "/***********************************************************************\n";
+    print OUT " * Test helper macros\n";
+    print OUT " */\n";
+    print OUT "\n";
+    print OUT "#ifdef FIELD_ALIGNMENT\n";
+    print OUT "# define TEST_FIELD_ALIGNMENT(type, field, align) \\\n";
+    print OUT "   ok(FIELD_ALIGNMENT(type, field) == align, \\\n";
+    print OUT "       \"FIELD_ALIGNMENT(\" #type \", \" #field \") == %d (expected \" #align \")\", \\\n";
+    print OUT "           FIELD_ALIGNMENT(type, field))\n";
+    print OUT "#else\n";
+    print OUT "# define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)\n";
+    print OUT "#endif\n";
+    print OUT "\n";
+    print OUT "#define TEST_FIELD_OFFSET(type, field, offset) \\\n";
+    print OUT "    ok(FIELD_OFFSET(type, field) == offset, \\\n";
+    print OUT "        \"FIELD_OFFSET(\" #type \", \" #field \") == %ld (expected \" #offset \")\", \\\n";
+    print OUT "             FIELD_OFFSET(type, field))\n";
+    print OUT "\n";
+    print OUT "#define TEST_TYPE_ALIGNMENT(type, align) \\\n";
+    print OUT "    ok(TYPE_ALIGNMENT(type) == align, \"TYPE_ALIGNMENT(\" #type \") == %d (expected \" #align \")\", TYPE_ALIGNMENT(type))\n";
+    print OUT "\n";
+    print OUT "#define TEST_TYPE_SIZE(type, size) \\\n";
+    print OUT "    ok(sizeof(type) == size, \"sizeof(\" #type \") == %d (expected \" #size \")\", sizeof(type))\n";
+    print OUT "\n";
+    print OUT "/***********************************************************************\n";
+    print OUT " * Test macros\n";
+    print OUT " */\n";
+    print OUT "\n";
+    print OUT "#define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \\\n";
+    print OUT "  TEST_TYPE_SIZE(field_type, field_size); \\\n";
+    print OUT "  TEST_FIELD_ALIGNMENT(type, field_name, field_align); \\\n";
+    print OUT "  TEST_FIELD_OFFSET(type, field_name, field_offset); \\\n";
+    print OUT "\n";
+    print OUT "#define TEST_TYPE(type, size, align) \\\n";
+    print OUT "  TEST_TYPE_ALIGNMENT(type, align); \\\n";
+    print OUT "  TEST_TYPE_SIZE(type, size)\n";
+    print OUT "\n";
 }
 
 ########################################################################