[PATCH] msi/tests: Use the available ARRAY_SIZE() macro

Michael Stefaniuc mstefani at winehq.org
Fri Jun 15 11:54:38 CDT 2018


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/msi/tests/action.c     |  64 ++++++++---------
 dlls/msi/tests/automation.c |  70 +++++++++---------
 dlls/msi/tests/db.c         |  12 ++--
 dlls/msi/tests/install.c    | 169 ++++++++++++++++++++++----------------------
 dlls/msi/tests/msi.c        |  30 ++++----
 dlls/msi/tests/package.c    |   2 +-
 dlls/msi/tests/patch.c      |   8 +--
 dlls/msi/tests/record.c     |   4 +-
 8 files changed, 178 insertions(+), 181 deletions(-)

diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c
index 2e464c4ecb..cb8514d42d 100644
--- a/dlls/msi/tests/action.c
+++ b/dlls/msi/tests/action.c
@@ -2650,7 +2650,7 @@ static void test_register_product(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\maximus", 500);
 
-    create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
+    create_database(msifile, pp_tables, ARRAY_SIZE(pp_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
 
@@ -2917,7 +2917,7 @@ static void test_publish_product(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\maximus", 500);
 
-    create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
+    create_database(msifile, pp_tables, ARRAY_SIZE(pp_tables));
 
     if (is_wow64)
         access |= KEY_WOW64_64KEY;
@@ -3150,7 +3150,7 @@ static void test_publish_features(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\maximus", 500);
 
-    create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
+    create_database(msifile, pp_tables, ARRAY_SIZE(pp_tables));
 
     if (is_wow64)
         access |= KEY_WOW64_64KEY;
@@ -3336,7 +3336,7 @@ static void test_register_user(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\maximus", 500);
 
-    create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
+    create_database(msifile, pp_tables, ARRAY_SIZE(pp_tables));
 
     if (is_wow64)
         access |= KEY_WOW64_64KEY;
@@ -3430,7 +3430,7 @@ static void test_process_components(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\maximus", 500);
 
-    create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table));
+    create_database(msifile, ppc_tables, ARRAY_SIZE(ppc_tables));
 
     if (is_wow64)
         access |= KEY_WOW64_64KEY;
@@ -3578,7 +3578,7 @@ static void test_publish(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\maximus", 500);
 
-    create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
+    create_database(msifile, pp_tables, ARRAY_SIZE(pp_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -4152,7 +4152,7 @@ static void test_publish_sourcelist(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\maximus", 500);
 
-    create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
+    create_database(msifile, pp_tables, ARRAY_SIZE(pp_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -4352,7 +4352,7 @@ static void test_remove_files(void)
     create_file("msitest\\helium", 500);
     create_file("msitest\\lithium", 500);
 
-    create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
+    create_database(msifile, rem_tables, ARRAY_SIZE(rem_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -4509,7 +4509,7 @@ static void test_move_files(void)
     create_file("bur", 100);
     create_file("bird", 100);
 
-    create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
+    create_database(msifile, mov_tables, ARRAY_SIZE(mov_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -4630,7 +4630,7 @@ static void test_duplicate_files(void)
 
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\maximus", 500);
-    create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
+    create_database(msifile, df_tables, ARRAY_SIZE(df_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -4673,7 +4673,7 @@ static void test_write_registry_values(void)
 
     CreateDirectoryA("msitest", NULL);
 
-    create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
+    create_database(msifile, wrv_tables, ARRAY_SIZE(wrv_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -4839,7 +4839,7 @@ static void test_envvar(void)
         return;
     }
 
-    create_database(msifile, env_tables, sizeof(env_tables) / sizeof(msi_table));
+    create_database(msifile, env_tables, ARRAY_SIZE(env_tables));
 
     res = RegCreateKeyExA(HKEY_CURRENT_USER, "Environment", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &env, NULL);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@@ -4948,7 +4948,7 @@ static void test_create_remove_folder(void)
     CreateDirectoryA("msitest\\second", NULL);
     create_file("msitest\\first\\one.txt", 1000);
     create_file("msitest\\second\\two.txt", 1000);
-    create_database(msifile, cf_tables, sizeof(cf_tables) / sizeof(msi_table));
+    create_database(msifile, cf_tables, ARRAY_SIZE(cf_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5028,7 +5028,7 @@ static void test_start_stop_services(void)
     CloseServiceHandle(scm);
 
     create_test_files();
-    create_database(msifile, sss_tables, sizeof(sss_tables) / sizeof(msi_table));
+    create_database(msifile, sss_tables, ARRAY_SIZE(sss_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5128,7 +5128,7 @@ static void test_delete_services(void)
     if (!service) return;
 
     create_test_files();
-    create_database(msifile, sds_tables, sizeof(sds_tables) / sizeof(msi_table));
+    create_database(msifile, sds_tables, ARRAY_SIZE(sds_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5190,7 +5190,7 @@ static void test_install_services(void)
     }
 
     create_test_files();
-    create_database(msifile, sis_tables, sizeof(sis_tables) / sizeof(msi_table));
+    create_database(msifile, sis_tables, ARRAY_SIZE(sis_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5267,7 +5267,7 @@ static void test_self_registration(void)
 
     create_test_files();
     extract_resource("selfreg.dll", "TESTDLL", "msitest\\selfreg.dll");
-    create_database(msifile, sr_tables, sizeof(sr_tables) / sizeof(msi_table));
+    create_database(msifile, sr_tables, ARRAY_SIZE(sr_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5315,7 +5315,7 @@ static void test_register_font(void)
 
     create_test_files();
     create_file("msitest\\font.ttf", 1000);
-    create_database(msifile, font_tables, sizeof(font_tables) / sizeof(msi_table));
+    create_database(msifile, font_tables, ARRAY_SIZE(font_tables));
 
     if (is_wow64)
         access |= KEY_WOW64_64KEY;
@@ -5365,7 +5365,7 @@ static void test_validate_product_id(void)
     }
 
     create_test_files();
-    create_database(msifile, vp_tables, sizeof(vp_tables) / sizeof(msi_table));
+    create_database(msifile, vp_tables, ARRAY_SIZE(vp_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5424,7 +5424,7 @@ static void test_install_remove_odbc(void)
     create_file("msitest\\ODBCtranslator.dll", 1000);
     create_file("msitest\\ODBCtranslator2.dll", 1000);
     create_file("msitest\\ODBCsetup.dll", 1000);
-    create_database(msifile, odbc_tables, sizeof(odbc_tables) / sizeof(msi_table));
+    create_database(msifile, odbc_tables, ARRAY_SIZE(odbc_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5510,7 +5510,7 @@ static void test_register_typelib(void)
 
     create_test_files();
     extract_resource("typelib.tlb", "TYPELIB", "msitest\\typelib.dll");
-    create_database(msifile, tl_tables, sizeof(tl_tables) / sizeof(msi_table));
+    create_database(msifile, tl_tables, ARRAY_SIZE(tl_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5553,7 +5553,7 @@ static void test_create_remove_shortcut(void)
 
     create_test_files();
     create_file("msitest\\target.txt", 1000);
-    create_database(msifile, crs_tables, sizeof(crs_tables) / sizeof(msi_table));
+    create_database(msifile, crs_tables, ARRAY_SIZE(crs_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5602,7 +5602,7 @@ static void test_publish_components(void)
 
     create_test_files();
     create_file("msitest\\english.txt", 1000);
-    create_database(msifile, pub_tables, sizeof(pub_tables) / sizeof(msi_table));
+    create_database(msifile, pub_tables, ARRAY_SIZE(pub_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5688,7 +5688,7 @@ static void test_remove_duplicate_files(void)
     create_file("msitest\\original.txt", 1000);
     create_file("msitest\\original2.txt", 1000);
     create_file("msitest\\original3.txt", 1000);
-    create_database(msifile, rd_tables, sizeof(rd_tables) / sizeof(msi_table));
+    create_database(msifile, rd_tables, ARRAY_SIZE(rd_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5736,7 +5736,7 @@ static void test_find_related_products(void)
 
     create_test_files();
     create_file("msitest\\product.txt", 1000);
-    create_database(msifile, frp_tables, sizeof(frp_tables) / sizeof(msi_table));
+    create_database(msifile, frp_tables, ARRAY_SIZE(frp_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5780,7 +5780,7 @@ static void test_ini_values(void)
 
     create_test_files();
     create_file("msitest\\inifile.txt", 1000);
-    create_database(msifile, ini_tables, sizeof(ini_tables) / sizeof(msi_table));
+    create_database(msifile, ini_tables, ARRAY_SIZE(ini_tables));
 
     lstrcpyA(inifile, PROG_FILES_DIR);
     lstrcatA(inifile, "\\msitest");
@@ -5841,7 +5841,7 @@ static void test_register_class_info(void)
 
     create_test_files();
     create_file("msitest\\class.txt", 1000);
-    create_database(msifile, rci_tables, sizeof(rci_tables) / sizeof(msi_table));
+    create_database(msifile, rci_tables, ARRAY_SIZE(rci_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5906,7 +5906,7 @@ static void test_register_extension_info(void)
 
     create_test_files();
     create_file("msitest\\extension.txt", 1000);
-    create_database(msifile, rei_tables, sizeof(rei_tables) / sizeof(msi_table));
+    create_database(msifile, rei_tables, ARRAY_SIZE(rei_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5958,7 +5958,7 @@ static void test_register_progid_info(void)
 
     create_test_files();
     create_file("msitest\\progid.txt", 1000);
-    create_database(msifile, rpi_tables, sizeof(rpi_tables) / sizeof(msi_table));
+    create_database(msifile, rpi_tables, ARRAY_SIZE(rpi_tables));
 
     res = RegCreateKeyExA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", 0, NULL, 0,
                           KEY_ALL_ACCESS, NULL, &hkey, NULL);
@@ -6084,7 +6084,7 @@ static void test_register_mime_info(void)
 
     create_test_files();
     create_file("msitest\\mime.txt", 1000);
-    create_database(msifile, rmi_tables, sizeof(rmi_tables) / sizeof(msi_table));
+    create_database(msifile, rmi_tables, ARRAY_SIZE(rmi_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -6182,7 +6182,7 @@ static void test_publish_assemblies(void)
     create_file_data("msitest\\manifest_local.txt", manifest_local, 0);
     create_file("msitest\\application_win32.txt", 1000);
     create_file("msitest\\application_dotnet.txt", 1000);
-    create_database(msifile, pa_tables, sizeof(pa_tables) / sizeof(msi_table));
+    create_database(msifile, pa_tables, ARRAY_SIZE(pa_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -6340,7 +6340,7 @@ static void test_remove_existing_products(void)
 
     create_test_files();
     create_file("msitest\\rep.txt", 1000);
-    create_database(msifile, rep_tables, sizeof(rep_tables) / sizeof(msi_table));
+    create_database(msifile, rep_tables, ARRAY_SIZE(rep_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
diff --git a/dlls/msi/tests/automation.c b/dlls/msi/tests/automation.c
index e4d2faad5c..2554df7ee6 100644
--- a/dlls/msi/tests/automation.c
+++ b/dlls/msi/tests/automation.c
@@ -355,9 +355,7 @@ static BOOL create_package(LPWSTR path)
     DWORD len;
 
     /* Prepare package */
-    create_database(msifile, tables,
-                    sizeof(tables) / sizeof(msi_table), summary_info,
-                    sizeof(summary_info) / sizeof(msi_summary_info));
+    create_database(msifile, tables, ARRAY_SIZE(tables), summary_info, ARRAY_SIZE(summary_info));
 
     len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
                               CURR_DIR, -1, path, MAX_PATH);
@@ -903,7 +901,7 @@ static HRESULT Installer_CreateRecord(int count, IDispatch **pRecord)
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[0]);
@@ -918,7 +916,7 @@ static HRESULT Installer_CreateRecord(int count, IDispatch **pRecord)
 static HRESULT Installer_RegistryValue(HKEY hkey, LPCWSTR szKey, VARIANT vValue, VARIANT *pVarResult, VARTYPE vtExpect)
 {
     VARIANTARG vararg[3];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
 
     VariantInit(&vararg[2]);
     V_VT(&vararg[2]) = VT_I4;
@@ -983,7 +981,7 @@ static HRESULT Installer_OpenPackage(LPCWSTR szPackagePath, int options, IDispat
 {
     VARIANT varresult;
     VARIANTARG vararg[2];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[1]);
@@ -1002,7 +1000,7 @@ static HRESULT Installer_OpenDatabase(LPCWSTR szDatabasePath, int openmode, IDis
 {
     VARIANT varresult;
     VARIANTARG vararg[2];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[1]);
@@ -1021,7 +1019,7 @@ static HRESULT Installer_InstallProduct(LPCWSTR szPackagePath, LPCWSTR szPropert
 {
     VARIANT varresult;
     VARIANTARG vararg[2];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
 
     VariantInit(&vararg[1]);
     V_VT(&vararg[1]) = VT_BSTR;
@@ -1037,7 +1035,7 @@ static HRESULT Installer_ProductState(LPCWSTR szProduct, int *pInstallState)
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[0]);
@@ -1054,7 +1052,7 @@ static HRESULT Installer_ProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, LPW
 {
     VARIANT varresult;
     VARIANTARG vararg[2];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[1]);
@@ -1085,7 +1083,7 @@ static HRESULT Installer_RelatedProducts(LPCWSTR szProduct, IDispatch **pStringL
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[0]);
@@ -1127,7 +1125,7 @@ static HRESULT Installer_SummaryInformation(BSTR PackagePath, int UpdateCount, I
 {
     VARIANT varresult;
     VARIANTARG vararg[2];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[1]);
@@ -1157,7 +1155,7 @@ static HRESULT Session_PropertyGet(IDispatch *pSession, LPCWSTR szName, LPWSTR s
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[0]);
@@ -1175,7 +1173,7 @@ static HRESULT Session_PropertyPut(IDispatch *pSession, LPCWSTR szName, LPCWSTR
     VARIANT varresult;
     VARIANTARG vararg[2];
     DISPID dispid = DISPID_PROPERTYPUT;
-    DISPPARAMS dispparams = {vararg, &dispid, sizeof(vararg)/sizeof(VARIANTARG), 1};
+    DISPPARAMS dispparams = {vararg, &dispid, ARRAY_SIZE(vararg), 1};
 
     VariantInit(&vararg[1]);
     V_VT(&vararg[1]) = VT_BSTR;
@@ -1203,7 +1201,7 @@ static HRESULT Session_ModeGet(IDispatch *pSession, int iFlag, VARIANT_BOOL *mod
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[0]);
@@ -1221,7 +1219,7 @@ static HRESULT Session_ModePut(IDispatch *pSession, int iFlag, VARIANT_BOOL mode
     VARIANT varresult;
     VARIANTARG vararg[2];
     DISPID dispid = DISPID_PROPERTYPUT;
-    DISPPARAMS dispparams = {vararg, &dispid, sizeof(vararg)/sizeof(VARIANTARG), 1};
+    DISPPARAMS dispparams = {vararg, &dispid, ARRAY_SIZE(vararg), 1};
 
     VariantInit(&vararg[1]);
     V_VT(&vararg[1]) = VT_I4;
@@ -1248,7 +1246,7 @@ static HRESULT Session_DoAction(IDispatch *pSession, LPCWSTR szAction, int *iRet
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[0]);
@@ -1265,7 +1263,7 @@ static HRESULT Session_EvaluateCondition(IDispatch *pSession, LPCWSTR szConditio
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[0]);
@@ -1282,7 +1280,7 @@ static HRESULT Session_Message(IDispatch *pSession, LONG kind, IDispatch *record
 {
     VARIANT varresult;
     VARIANTARG vararg[2];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&varresult);
@@ -1303,7 +1301,7 @@ static HRESULT Session_SetInstallLevel(IDispatch *pSession, LONG iInstallLevel)
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
 
     VariantInit(&vararg[0]);
     V_VT(&vararg[0]) = VT_I4;
@@ -1316,7 +1314,7 @@ static HRESULT Session_FeatureCurrentState(IDispatch *pSession, LPCWSTR szName,
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[0]);
@@ -1333,7 +1331,7 @@ static HRESULT Session_FeatureRequestStateGet(IDispatch *pSession, LPCWSTR szNam
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[0]);
@@ -1351,7 +1349,7 @@ static HRESULT Session_FeatureRequestStatePut(IDispatch *pSession, LPCWSTR szNam
     VARIANT varresult;
     VARIANTARG vararg[2];
     DISPID dispid = DISPID_PROPERTYPUT;
-    DISPPARAMS dispparams = {vararg, &dispid, sizeof(vararg)/sizeof(VARIANTARG), 1};
+    DISPPARAMS dispparams = {vararg, &dispid, ARRAY_SIZE(vararg), 1};
 
     VariantInit(&vararg[1]);
     V_VT(&vararg[1]) = VT_BSTR;
@@ -1367,7 +1365,7 @@ static HRESULT Database_OpenView(IDispatch *pDatabase, LPCWSTR szSql, IDispatch
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[0]);
@@ -1383,7 +1381,7 @@ static HRESULT Database_SummaryInformation(IDispatch *pDatabase, int iUpdateCoun
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[0]);
@@ -1399,7 +1397,7 @@ static HRESULT View_Execute(IDispatch *pView, IDispatch *pRecord)
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
 
     VariantInit(&vararg[0]);
     V_VT(&vararg[0]) = VT_DISPATCH;
@@ -1421,7 +1419,7 @@ static HRESULT View_Modify(IDispatch *pView, int iMode, IDispatch *pRecord)
 {
     VARIANT varresult;
     VARIANTARG vararg[2];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
 
     VariantInit(&vararg[1]);
     V_VT(&vararg[1]) = VT_I4;
@@ -1456,7 +1454,7 @@ static HRESULT Record_StringDataGet(IDispatch *pRecord, int iField, LPWSTR szStr
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[0]);
@@ -1474,7 +1472,7 @@ static HRESULT Record_StringDataPut(IDispatch *pRecord, int iField, LPCWSTR szSt
     VARIANT varresult;
     VARIANTARG vararg[2];
     DISPID dispid = DISPID_PROPERTYPUT;
-    DISPPARAMS dispparams = {vararg, &dispid, sizeof(vararg)/sizeof(VARIANTARG), 1};
+    DISPPARAMS dispparams = {vararg, &dispid, ARRAY_SIZE(vararg), 1};
 
     VariantInit(&vararg[1]);
     V_VT(&vararg[1]) = VT_I4;
@@ -1490,7 +1488,7 @@ static HRESULT Record_IntegerDataGet(IDispatch *pRecord, int iField, int *pValue
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[0]);
@@ -1508,7 +1506,7 @@ static HRESULT Record_IntegerDataPut(IDispatch *pRecord, int iField, int iValue)
     VARIANT varresult;
     VARIANTARG vararg[2];
     DISPID dispid = DISPID_PROPERTYPUT;
-    DISPPARAMS dispparams = {vararg, &dispid, sizeof(vararg)/sizeof(VARIANTARG), 1};
+    DISPPARAMS dispparams = {vararg, &dispid, ARRAY_SIZE(vararg), 1};
 
     VariantInit(&vararg[1]);
     V_VT(&vararg[1]) = VT_I4;
@@ -1533,7 +1531,7 @@ static HRESULT StringList_Item(IDispatch *pStringList, int iIndex, LPWSTR szStri
 {
     VARIANT varresult;
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
     HRESULT hr;
 
     VariantInit(&vararg[0]);
@@ -1559,7 +1557,7 @@ static HRESULT StringList_Count(IDispatch *pStringList, int *pCount)
 static HRESULT SummaryInfo_PropertyGet(IDispatch *pSummaryInfo, int pid, VARIANT *pVarResult, VARTYPE vtExpect)
 {
     VARIANTARG vararg[1];
-    DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
+    DISPPARAMS dispparams = {vararg, NULL, ARRAY_SIZE(vararg), 0};
 
     VariantInit(&vararg[0]);
     V_VT(&vararg[0]) = VT_I4;
@@ -1572,7 +1570,7 @@ static HRESULT SummaryInfo_PropertyPut(IDispatch *pSummaryInfo, int pid, VARIANT
     VARIANT varresult;
     VARIANTARG vararg[2];
     DISPID dispid = DISPID_PROPERTYPUT;
-    DISPPARAMS dispparams = {vararg, &dispid, sizeof(vararg)/sizeof(VARIANTARG), 1};
+    DISPPARAMS dispparams = {vararg, &dispid, ARRAY_SIZE(vararg), 1};
 
     VariantInit(&vararg[1]);
     V_VT(&vararg[1]) = VT_I4;
@@ -1850,7 +1848,7 @@ static void test_Database(IDispatch *pDatabase, BOOL readonly)
     ok(pSummaryInfo != NULL, "Database_SummaryInformation should not have returned NULL record\n");
     if (pSummaryInfo)
     {
-        test_SummaryInfo(pSummaryInfo, summary_info, sizeof(summary_info)/sizeof(msi_summary_info), readonly);
+        test_SummaryInfo(pSummaryInfo, summary_info, ARRAY_SIZE(summary_info), readonly);
         IDispatch_Release(pSummaryInfo);
     }
 }
@@ -2697,7 +2695,7 @@ static void test_Installer(void)
     ok(hr == S_OK, "Installer_SummaryInformation failed, hresult 0x%08x\n", hr);
     if (hr == S_OK)
     {
-        test_SummaryInfo(pSumInfo, summary_info, sizeof(summary_info)/sizeof(msi_summary_info), TRUE);
+        test_SummaryInfo(pSumInfo, summary_info, ARRAY_SIZE(summary_info), TRUE);
         IDispatch_Release(pSumInfo);
     }
 
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index ff54a95ab1..2b927b78f2 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -5221,12 +5221,12 @@ static void test_collation(void)
 
     r = MsiViewFetch(hview, &hrec);
     ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n");
-    sz = sizeof(bufferW) / sizeof(bufferW[0]);
+    sz = ARRAY_SIZE(bufferW);
     r = MsiRecordGetStringW(hrec, 1, bufferW, &sz);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!memcmp(bufferW, letter_a_ring, sizeof(letter_a_ring)),
        "Expected %s, got %s\n", wine_dbgstr_w(letter_a_ring), wine_dbgstr_w(bufferW));
-    sz = sizeof(bufferW) / sizeof(bufferW[0]);
+    sz = ARRAY_SIZE(bufferW);
     r = MsiRecordGetStringW(hrec, 2, bufferW, &sz);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpW(bufferW, letter_C), "Expected C, got %s\n", wine_dbgstr_w(bufferW));
@@ -5234,12 +5234,12 @@ static void test_collation(void)
 
     r = MsiViewFetch(hview, &hrec);
     ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n");
-    sz = sizeof(bufferW) / sizeof(bufferW[0]);
+    sz = ARRAY_SIZE(bufferW);
     r = MsiRecordGetStringW(hrec, 1, bufferW, &sz);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!memcmp(bufferW, letter_a_with_ring, sizeof(letter_a_with_ring)),
        "Expected %s, got %s\n", wine_dbgstr_w(letter_a_with_ring), wine_dbgstr_w(bufferW));
-    sz = sizeof(bufferW) / sizeof(bufferW[0]);
+    sz = ARRAY_SIZE(bufferW);
     r = MsiRecordGetStringW(hrec, 2, bufferW, &sz);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpW(bufferW, letter_D), "Expected D, got %s\n", wine_dbgstr_w(bufferW));
@@ -5257,12 +5257,12 @@ static void test_collation(void)
 
     r = MsiViewFetch(hview, &hrec);
     ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n");
-    sz = sizeof(bufferW) / sizeof(bufferW[0]);
+    sz = ARRAY_SIZE(bufferW);
     r = MsiRecordGetStringW(hrec, 1, bufferW, &sz);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!memcmp(bufferW, letter_a_with_ring, sizeof(letter_a_with_ring)),
        "Expected %s, got %s\n", wine_dbgstr_w(letter_a_with_ring), wine_dbgstr_w(bufferW));
-    sz = sizeof(bufferW) / sizeof(bufferW[0]);
+    sz = ARRAY_SIZE(bufferW);
     r = MsiRecordGetStringW(hrec, 2, bufferW, &sz);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
     ok(!lstrcmpW(bufferW, letter_D), "Expected D, got %s\n", wine_dbgstr_w(bufferW));
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 951f0e7222..f21e32789f 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -2706,7 +2706,7 @@ static void test_MsiInstallProduct(void)
        "Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
 
     create_test_files();
-    create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
+    create_database(msifile, tables, ARRAY_SIZE(tables));
 
     /* install, don't publish */
     r = MsiInstallProductA(msifile, NULL);
@@ -2757,7 +2757,7 @@ static void test_MsiInstallProduct(void)
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
     RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
 
-    create_database(msifile, up_tables, sizeof(up_tables) / sizeof(msi_table));
+    create_database(msifile, up_tables, ARRAY_SIZE(up_tables));
 
     /* not published, RemovePreviousVersions set */
     r = MsiInstallProductA(msifile, NULL);
@@ -2769,7 +2769,7 @@ static void test_MsiInstallProduct(void)
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
     RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
 
-    create_database(msifile, up2_tables, sizeof(up2_tables) / sizeof(msi_table));
+    create_database(msifile, up2_tables, ARRAY_SIZE(up2_tables));
 
     /* not published, version number bumped */
     r = MsiInstallProductA(msifile, NULL);
@@ -2781,7 +2781,7 @@ static void test_MsiInstallProduct(void)
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
     RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
 
-    create_database(msifile, up3_tables, sizeof(up3_tables) / sizeof(msi_table));
+    create_database(msifile, up3_tables, ARRAY_SIZE(up3_tables));
 
     /* not published, RemovePreviousVersions set and version number bumped */
     r = MsiInstallProductA(msifile, NULL);
@@ -2793,7 +2793,7 @@ static void test_MsiInstallProduct(void)
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
     RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
 
-    create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
+    create_database(msifile, up4_tables, ARRAY_SIZE(up4_tables));
 
     /* install, publish product */
     r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
@@ -2804,7 +2804,7 @@ static void test_MsiInstallProduct(void)
     res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
     ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
 
-    create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
+    create_database(msifile, up4_tables, ARRAY_SIZE(up4_tables));
 
     /* published, reinstall */
     r = MsiInstallProductA(msifile, NULL);
@@ -2815,7 +2815,7 @@ static void test_MsiInstallProduct(void)
     res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
     ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
 
-    create_database(msifile, up5_tables, sizeof(up5_tables) / sizeof(msi_table));
+    create_database(msifile, up5_tables, ARRAY_SIZE(up5_tables));
 
     /* published product, RemovePreviousVersions set */
     r = MsiInstallProductA(msifile, NULL);
@@ -2826,7 +2826,7 @@ static void test_MsiInstallProduct(void)
     res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
     ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
 
-    create_database(msifile, up6_tables, sizeof(up6_tables) / sizeof(msi_table));
+    create_database(msifile, up6_tables, ARRAY_SIZE(up6_tables));
 
     /* published product, version number bumped */
     r = MsiInstallProductA(msifile, NULL);
@@ -2837,7 +2837,7 @@ static void test_MsiInstallProduct(void)
     res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
     ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
 
-    create_database(msifile, up7_tables, sizeof(up7_tables) / sizeof(msi_table));
+    create_database(msifile, up7_tables, ARRAY_SIZE(up7_tables));
 
     /* published product, RemovePreviousVersions set and version number bumped */
     r = MsiInstallProductA(msifile, NULL);
@@ -2863,7 +2863,7 @@ static void test_MsiSetComponentState(void)
     char path[MAX_PATH];
     UINT r;
 
-    create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
+    create_database(msifile, tables, ARRAY_SIZE(tables));
 
     CoInitialize(NULL);
 
@@ -2913,7 +2913,7 @@ static void test_packagecoltypes(void)
     LPCSTR query;
     UINT r, count;
 
-    create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
+    create_database(msifile, tables, ARRAY_SIZE(tables));
 
     CoInitialize(NULL);
 
@@ -3032,7 +3032,7 @@ static void test_continuouscabs(void)
     }
 
     create_cc_test_files();
-    create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
+    create_database(msifile, cc_tables, ARRAY_SIZE(cc_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -3055,7 +3055,7 @@ static void test_continuouscabs(void)
     DeleteFileA(msifile);
 
     create_cc_test_files();
-    create_database(msifile, cc2_tables, sizeof(cc2_tables) / sizeof(msi_table));
+    create_database(msifile, cc2_tables, ARRAY_SIZE(cc2_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -3081,7 +3081,7 @@ static void test_continuouscabs(void)
 
     /* Filename from cab is right and the one from msi is wrong */
     create_cc_test_files();
-    create_database(msifile, cc3_tables, sizeof(cc3_tables) / sizeof(msi_table));
+    create_database(msifile, cc3_tables, ARRAY_SIZE(cc3_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -3105,7 +3105,7 @@ static void test_continuouscabs(void)
     /* Filename from msi is right and the one from cab is wrong */
     create_cc_test_files();
     ok(MoveFileA("test2.cab", "test2_.cab"), "Cannot rename test2.cab to test2_.cab\n");
-    create_database(msifile, cc3_tables, sizeof(cc3_tables) / sizeof(msi_table));
+    create_database(msifile, cc3_tables, ARRAY_SIZE(cc3_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -3137,7 +3137,7 @@ static void test_caborder(void)
     create_file("augustus", 50000);
     create_file("caesar", 500);
 
-    create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
+    create_database(msifile, cc_tables, ARRAY_SIZE(cc_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -3177,7 +3177,7 @@ static void test_caborder(void)
     DeleteFileA(msifile);
 
     create_cc_test_files();
-    create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
+    create_database(msifile, co_tables, ARRAY_SIZE(co_tables));
 
     r = MsiInstallProductA(msifile, NULL);
     ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
@@ -3193,7 +3193,7 @@ static void test_caborder(void)
     DeleteFileA(msifile);
 
     create_cc_test_files();
-    create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
+    create_database(msifile, co2_tables, ARRAY_SIZE(co2_tables));
 
     r = MsiInstallProductA(msifile, NULL);
     ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
@@ -3229,7 +3229,7 @@ static void test_mixedmedia(void)
     create_file("msitest\\augustus", 500);
     create_file("caesar", 500);
 
-    create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
+    create_database(msifile, mm_tables, ARRAY_SIZE(mm_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -3262,7 +3262,7 @@ static void test_samesequence(void)
     UINT r;
 
     create_cc_test_files();
-    create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
+    create_database(msifile, ss_tables, ARRAY_SIZE(ss_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -3291,7 +3291,7 @@ static void test_uiLevelFlags(void)
     UINT r;
 
     create_cc_test_files();
-    create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
+    create_database(msifile, ui_tables, ARRAY_SIZE(ui_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
 
@@ -3346,7 +3346,7 @@ static void test_readonlyfile(void)
 
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\maximus", 500);
-    create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
+    create_database(msifile, rof_tables, ARRAY_SIZE(rof_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -3398,7 +3398,7 @@ static void test_readonlyfile_cab(void)
     create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
     DeleteFileA("maximus");
 
-    create_database(msifile, rofc_tables, sizeof(rofc_tables) / sizeof(msi_table));
+    create_database(msifile, rofc_tables, ARRAY_SIZE(rofc_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -3452,7 +3452,7 @@ static void test_setdirproperty(void)
 
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\maximus", 500);
-    create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
+    create_database(msifile, sdp_tables, ARRAY_SIZE(sdp_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -3493,7 +3493,7 @@ static void test_cabisextracted(void)
     create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
     create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
 
-    create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
+    create_database(msifile, cie_tables, ARRAY_SIZE(cie_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -3727,7 +3727,7 @@ static void test_transformprop(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\augustus", 500);
 
-    create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
+    create_database(msifile, tp_tables, ARRAY_SIZE(tp_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -3775,7 +3775,7 @@ static void test_currentworkingdir(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\augustus", 500);
 
-    create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
+    create_database(msifile, cwd_tables, ARRAY_SIZE(cwd_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -3859,7 +3859,7 @@ static void test_admin(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\augustus", 500);
 
-    create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
+    create_database(msifile, adm_tables, ARRAY_SIZE(adm_tables));
     set_admin_summary_info(msifileW);
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
@@ -3937,7 +3937,7 @@ static void test_adminprops(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\augustus", 500);
 
-    create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
+    create_database(msifile, amp_tables, ARRAY_SIZE(amp_tables));
     set_admin_summary_info(msifileW);
     set_admin_property_stream(msifile);
 
@@ -3990,7 +3990,7 @@ static void test_missingcab(void)
     create_file("maximus", 500);
     create_file("tiberius", 500);
 
-    create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
+    create_database(msifile, mc_tables, ARRAY_SIZE(mc_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -4058,7 +4058,7 @@ static void test_sourcefolder(void)
     CreateDirectoryA("msitest", NULL);
     create_file("augustus", 500);
 
-    create_database(msifile, sf_tables, sizeof(sf_tables) / sizeof(msi_table));
+    create_database(msifile, sf_tables, ARRAY_SIZE(sf_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -4097,7 +4097,7 @@ static void test_customaction1(void)
     UINT r;
 
     create_test_files();
-    create_database(msifile, ca1_tables, sizeof(ca1_tables) / sizeof(msi_table));
+    create_database(msifile, ca1_tables, ARRAY_SIZE(ca1_tables));
 
     /* create a test table */
     MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb);
@@ -4153,7 +4153,7 @@ static void test_customaction51(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\augustus", 500);
 
-    create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
+    create_database(msifile, ca51_tables, ARRAY_SIZE(ca51_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -4197,7 +4197,7 @@ static void test_installstate(void)
     create_file("msitest\\lambda", 500);
     create_file("msitest\\mu", 500);
 
-    create_database(msifile, is_tables, sizeof(is_tables) / sizeof(msi_table));
+    create_database(msifile, is_tables, ARRAY_SIZE(is_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -4588,11 +4588,11 @@ static void test_sourcepath(void)
         return;
     }
 
-    create_database(msifile, sp_tables, sizeof(sp_tables) / sizeof(msi_table));
+    create_database(msifile, sp_tables, ARRAY_SIZE(sp_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
-    for (i = 0; i < sizeof(spmap) / sizeof(spmap[0]); i++)
+    for (i = 0; i < ARRAY_SIZE(spmap); i++)
     {
         if (spmap[i].sost)
         {
@@ -4675,7 +4675,7 @@ static void test_missingcomponent(void)
     create_file("msitest\\lithium", 500);
     create_file("beryllium", 500);
 
-    create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
+    create_database(msifile, mcp_tables, ARRAY_SIZE(mcp_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -4728,7 +4728,7 @@ static void test_sourcedirprop(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\augustus", 500);
 
-    create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
+    create_database(msifile, ca51_tables, ARRAY_SIZE(ca51_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -4788,8 +4788,7 @@ static void test_adminimage(void)
     create_file("msitest\\cabout\\new\\five.txt", 100);
     create_file("msitest\\filename", 100);
 
-    create_database_wordcount(msifile, ai_tables,
-                              sizeof(ai_tables) / sizeof(msi_table),
+    create_database_wordcount(msifile, ai_tables, ARRAY_SIZE(ai_tables),
                               100, msidbSumInfoSourceTypeAdminImage, ";1033",
                               "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
 
@@ -4833,7 +4832,7 @@ static void test_propcase(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\augustus", 500);
 
-    create_database(msifile, pc_tables, sizeof(pc_tables) / sizeof(msi_table));
+    create_database(msifile, pc_tables, ARRAY_SIZE(pc_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -4909,7 +4908,7 @@ static void test_int_widths( void )
     r = MsiOpenDatabaseW(msidb, MSIDBOPEN_CREATE, &db);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
 
-    for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+    for (i = 0; i < ARRAY_SIZE(tests); i++)
     {
         DWORD count;
         HANDLE handle = CreateFileW(msitable, GENERIC_WRITE, 0, NULL,
@@ -4942,7 +4941,7 @@ static void test_shortcut(void)
     }
 
     create_test_files();
-    create_database(msifile, sc_tables, sizeof(sc_tables) / sizeof(msi_table));
+    create_database(msifile, sc_tables, ARRAY_SIZE(sc_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -4989,7 +4988,7 @@ static void test_preselected(void)
     }
 
     create_test_files();
-    create_database(msifile, ps_tables, sizeof(ps_tables) / sizeof(msi_table));
+    create_database(msifile, ps_tables, ARRAY_SIZE(ps_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5045,7 +5044,7 @@ static void test_installed_prop(void)
     }
 
     create_test_files();
-    create_database(msifile, ip_tables, sizeof(ip_tables) / sizeof(msi_table));
+    create_database(msifile, ip_tables, ARRAY_SIZE(ip_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5084,7 +5083,7 @@ static void test_allusers_prop(void)
     }
 
     create_test_files();
-    create_database(msifile, aup_tables, sizeof(aup_tables) / sizeof(msi_table));
+    create_database(msifile, aup_tables, ARRAY_SIZE(aup_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5105,7 +5104,7 @@ static void test_allusers_prop(void)
     delete_test_files();
 
     create_test_files();
-    create_database(msifile, aup2_tables, sizeof(aup2_tables) / sizeof(msi_table));
+    create_database(msifile, aup2_tables, ARRAY_SIZE(aup2_tables));
 
     /* ALLUSERS property set to 1 */
     r = MsiInstallProductA(msifile, "FULL=1");
@@ -5119,7 +5118,7 @@ static void test_allusers_prop(void)
     delete_test_files();
 
     create_test_files();
-    create_database(msifile, aup3_tables, sizeof(aup3_tables) / sizeof(msi_table));
+    create_database(msifile, aup3_tables, ARRAY_SIZE(aup3_tables));
 
     /* ALLUSERS property set to 2 */
     r = MsiInstallProductA(msifile, "FULL=1");
@@ -5133,7 +5132,7 @@ static void test_allusers_prop(void)
     delete_test_files();
 
     create_test_files();
-    create_database(msifile, aup4_tables, sizeof(aup4_tables) / sizeof(msi_table));
+    create_database(msifile, aup4_tables, ARRAY_SIZE(aup4_tables));
 
     /* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */
     r = MsiInstallProductA(msifile, "FULL=1");
@@ -5248,7 +5247,7 @@ static void test_file_in_use(void)
 
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\maximus", 500);
-    create_database(msifile, fiu_tables, sizeof(fiu_tables) / sizeof(msi_table));
+    create_database(msifile, fiu_tables, ARRAY_SIZE(fiu_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5310,7 +5309,7 @@ static void test_file_in_use_cab(void)
     create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
     DeleteFileA("maximus");
 
-    create_database(msifile, fiuc_tables, sizeof(fiuc_tables) / sizeof(msi_table));
+    create_database(msifile, fiuc_tables, ARRAY_SIZE(fiuc_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5368,7 +5367,7 @@ static void test_feature_override(void)
     create_file("msitest\\override.txt", 1000);
     create_file("msitest\\preselected.txt", 1000);
     create_file("msitest\\notpreselected.txt", 1000);
-    create_database(msifile, fo_tables, sizeof(fo_tables) / sizeof(msi_table));
+    create_database(msifile, fo_tables, ARRAY_SIZE(fo_tables));
 
     if (is_wow64)
         access |= KEY_WOW64_64KEY;
@@ -5448,7 +5447,7 @@ static void test_icon_table(void)
         return;
     }
 
-    create_database(msifile, icon_base_tables, sizeof(icon_base_tables) / sizeof(msi_table));
+    create_database(msifile, icon_base_tables, ARRAY_SIZE(icon_base_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5528,7 +5527,7 @@ static void test_package_validation(void)
 
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\maximus", 500);
-    create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;1033");
+    create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;1033");
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5543,19 +5542,19 @@ static void test_package_validation(void)
     ok(delete_pf("msitest", FALSE), "directory does not exist\n");
 
     DeleteFileA(msifile);
-    create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,9999;9999");
+    create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel,9999;9999");
 
     r = MsiInstallProductA(msifile, NULL);
     ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
 
     DeleteFileA(msifile);
-    create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,1033;9999");
+    create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel,1033;9999");
 
     r = MsiInstallProductA(msifile, NULL);
     ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
 
     DeleteFileA(msifile);
-    create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,9999;1033");
+    create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel,9999;1033");
 
     r = MsiInstallProductA(msifile, NULL);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@@ -5563,25 +5562,25 @@ static void test_package_validation(void)
     ok(delete_pf("msitest", FALSE), "directory does not exist\n");
 
     DeleteFileA(msifile);
-    create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel64,9999;1033");
+    create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel64,9999;1033");
 
     r = MsiInstallProductA(msifile, NULL);
     ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
 
     DeleteFileA(msifile);
-    create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel32,1033;1033");
+    create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel32,1033;1033");
 
     r = MsiInstallProductA(msifile, NULL);
     ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
 
     DeleteFileA(msifile);
-    create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel32,9999;1033");
+    create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel32,9999;1033");
 
     r = MsiInstallProductA(msifile, NULL);
     ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
 
     DeleteFileA(msifile);
-    create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;9999");
+    create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;9999");
 
     r = MsiInstallProductA(msifile, NULL);
     ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
@@ -5591,14 +5590,14 @@ static void test_package_validation(void)
     if (GetSystemDefaultLangID() == MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ))
     {
         DeleteFileA(msifile);
-        create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;9");
+        create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;9");
         r = MsiInstallProductA(msifile, NULL);
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
         ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
         ok(delete_pf("msitest", FALSE), "directory does not exist\n");
 
         DeleteFileA(msifile);
-        create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;1024");
+        create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;1024");
         r = MsiInstallProductA(msifile, NULL);
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
         ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
@@ -5606,7 +5605,7 @@ static void test_package_validation(void)
     }
 
     DeleteFileA(msifile);
-    create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel32;0");
+    create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel32;0");
 
     r = MsiInstallProductA(msifile, NULL);
     ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
@@ -5616,7 +5615,7 @@ static void test_package_validation(void)
     if (is_64bit && !is_wow64)
     {
         DeleteFileA(msifile);
-        create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
+        create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;0");
 
         r = MsiInstallProductA(msifile, NULL);
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@@ -5624,7 +5623,7 @@ static void test_package_validation(void)
         ok(delete_pf("msitest", FALSE), "directory does not exist\n");
 
         DeleteFileA(msifile);
-        create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
+        create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "x64;0");
 
         r = MsiInstallProductA(msifile, NULL);
         ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
@@ -5632,7 +5631,7 @@ static void test_package_validation(void)
         ok(!delete_pf("msitest", FALSE), "directory exists\n");
 
         DeleteFileA(msifile);
-        create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
+        create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "x64;0");
 
         r = MsiInstallProductA(msifile, NULL);
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@@ -5642,7 +5641,7 @@ static void test_package_validation(void)
     else if (is_wow64)
     {
         DeleteFileA(msifile);
-        create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
+        create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;0");
 
         r = MsiInstallProductA(msifile, NULL);
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@@ -5650,7 +5649,7 @@ static void test_package_validation(void)
         ok(delete_pf("msitest", FALSE), "directory does not exist\n");
 
         DeleteFileA(msifile);
-        create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
+        create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "x64;0");
 
         r = MsiInstallProductA(msifile, NULL);
         ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
@@ -5658,7 +5657,7 @@ static void test_package_validation(void)
         ok(!delete_pf("msitest", FALSE), "directory exists\n");
 
         DeleteFileA(msifile);
-        create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
+        create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "x64;0");
 
         r = MsiInstallProductA(msifile, NULL);
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@@ -5668,7 +5667,7 @@ static void test_package_validation(void)
     else
     {
         DeleteFileA(msifile);
-        create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
+        create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;0");
 
         r = MsiInstallProductA(msifile, NULL);
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@@ -5676,7 +5675,7 @@ static void test_package_validation(void)
         ok(delete_pf("msitest", FALSE), "directory does not exist\n");
 
         DeleteFileA(msifile);
-        create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Alpha,Beta,Intel;0");
+        create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Alpha,Beta,Intel;0");
 
         r = MsiInstallProductA(msifile, NULL);
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@@ -5684,7 +5683,7 @@ static void test_package_validation(void)
         ok(delete_pf("msitest", FALSE), "directory does not exist\n");
 
         DeleteFileA(msifile);
-        create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
+        create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "x64;0");
 
         r = MsiInstallProductA(msifile, NULL);
         ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
@@ -5692,7 +5691,7 @@ static void test_package_validation(void)
         ok(!delete_pf("msitest", FALSE), "directory exists\n");
 
         DeleteFileA(msifile);
-        create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
+        create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "x64;0");
 
         r = MsiInstallProductA(msifile, NULL);
         ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
@@ -5719,7 +5718,7 @@ static void test_upgrade_code(void)
 
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\upgradecode.txt", 1000);
-    create_database(msifile, uc_tables, sizeof(uc_tables) / sizeof(msi_table));
+    create_database(msifile, uc_tables, ARRAY_SIZE(uc_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5758,7 +5757,7 @@ static void test_mixed_package(void)
         return;
     }
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
-    create_database_template(msifile, mixed_tables, sizeof(mixed_tables)/sizeof(msi_table), 200, "x64;1033");
+    create_database_template(msifile, mixed_tables, ARRAY_SIZE(mixed_tables), 200, "x64;1033");
 
     r = MsiInstallProductA(msifile, NULL);
     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
@@ -5826,7 +5825,7 @@ static void test_mixed_package(void)
     ok(res == ERROR_FILE_NOT_FOUND, "64-bit CLSID key not removed\n");
 
     DeleteFileA( msifile );
-    create_database_template(msifile, mixed_tables, sizeof(mixed_tables)/sizeof(msi_table), 200, "Intel;1033");
+    create_database_template(msifile, mixed_tables, ARRAY_SIZE(mixed_tables), 200, "Intel;1033");
 
     r = MsiInstallProductA(msifile, NULL);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@@ -5903,7 +5902,7 @@ static void test_volume_props(void)
     }
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\volumeprop.txt", 1000);
-    create_database(msifile, vp_tables, sizeof(vp_tables)/sizeof(msi_table));
+    create_database(msifile, vp_tables, ARRAY_SIZE(vp_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -5929,9 +5928,9 @@ static void test_shared_component(void)
     }
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\sharedcomponent.txt", 1000);
-    create_database_wordcount(msifile, shc_tables, sizeof(shc_tables)/sizeof(shc_tables[0]),
+    create_database_wordcount(msifile, shc_tables, ARRAY_SIZE(shc_tables),
                               100, 0, ";", "{A8826420-FD72-4E61-9E15-C1944CF4CBE1}");
-    create_database_wordcount(msifile2, shc2_tables, sizeof(shc2_tables)/sizeof(shc2_tables[0]),
+    create_database_wordcount(msifile2, shc2_tables, ARRAY_SIZE(shc2_tables),
                               100, 0, ";", "{A8B50B30-0E8A-4ACD-B3CF-1A5DC58B2739}");
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
@@ -5979,7 +5978,7 @@ static void test_remove_upgrade_code(void)
     if (is_wow64) access |= KEY_WOW64_64KEY;
 
     create_test_files();
-    create_database( msifile, icon_base_tables, sizeof(icon_base_tables)/sizeof(icon_base_tables[0]) );
+    create_database( msifile, icon_base_tables, ARRAY_SIZE( icon_base_tables ));
 
     MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
 
@@ -6024,7 +6023,7 @@ static void test_feature_tree(void)
     }
 
     create_file( "msitest\\featuretree.txt", 1000 );
-    create_database( msifile, ft_tables, sizeof(ft_tables)/sizeof(ft_tables[0]) );
+    create_database( msifile, ft_tables, ARRAY_SIZE( ft_tables ));
 
     MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
 
@@ -6063,7 +6062,7 @@ static void test_deferred_action(void)
     GetTempFileNameA(path, "da", 0, file);
     sprintf(buffer, "TESTPATH=\"%s\"", file);
 
-    create_database(msifile, da_tables, sizeof(da_tables) / sizeof(da_tables[0]));
+    create_database(msifile, da_tables, ARRAY_SIZE(da_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -6102,7 +6101,7 @@ static void test_wow64(void)
     }
 
     create_test_files();
-    create_database_template(msifile, x64_tables, sizeof(x64_tables)/sizeof(msi_table), 200, "x64;0");
+    create_database_template(msifile, x64_tables, ARRAY_SIZE(x64_tables), 200, "x64;0");
     r = MsiInstallProductA(msifile, NULL);
     if (r == ERROR_INSTALL_PACKAGE_REJECTED)
     {
@@ -6155,7 +6154,7 @@ static void test_source_resolution(void)
     }
 
     create_test_files();
-    create_database(msifile, sr_tables, sizeof(sr_tables) / sizeof(msi_table));
+    create_database(msifile, sr_tables, ARRAY_SIZE(sr_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c
index 62afa6e747..f4afef15db 100644
--- a/dlls/msi/tests/msi.c
+++ b/dlls/msi/tests/msi.c
@@ -1094,7 +1094,7 @@ static void test_MsiGetFileHash(void)
     r = pMsiGetFileHashA(name, 0, NULL);
     ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
 
-    for (i = 0; i < sizeof(hash_data) / sizeof(hash_data[0]); i++)
+    for (i = 0; i < ARRAY_SIZE(hash_data); i++)
     {
         int ret;
 
@@ -3313,7 +3313,7 @@ static void test_MsiProvideComponent(void)
 
     create_test_files();
     create_file("msitest\\sourcedir.txt", 1000);
-    create_database(msifile, sd_tables, sizeof(sd_tables) / sizeof(msi_table));
+    create_database(msifile, sd_tables, ARRAY_SIZE(sd_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -13446,7 +13446,7 @@ static void test_MsiConfigureProductEx(void)
     create_file_data("msitest\\helium", "helium", 500);
     create_file_data("msitest\\lithium", "lithium", 500);
 
-    create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
+    create_database(msifile, mcp_tables, ARRAY_SIZE(mcp_tables));
 
     if (is_wow64)
         access |= KEY_WOW64_64KEY;
@@ -13574,7 +13574,7 @@ static void test_MsiConfigureProductEx(void)
     ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
     ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
 
-    create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
+    create_database(msifile, mcp_tables, ARRAY_SIZE(mcp_tables));
 
     /* install the product, machine */
     r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
@@ -13615,7 +13615,7 @@ static void test_MsiConfigureProductEx(void)
     ok(pf_exists("msitest"), "File not installed\n");
 
     RegCloseKey(props);
-    create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
+    create_database(msifile, mcp_tables, ARRAY_SIZE(mcp_tables));
 
     /* LastUsedSource can be used as a last resort */
     r = MsiConfigureProductExA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}",
@@ -13723,7 +13723,7 @@ static void test_MsiSetFeatureAttributes(void)
         skip("process is limited\n");
         return;
     }
-    create_database( msifile, tables, sizeof(tables) / sizeof(tables[0]) );
+    create_database( msifile, tables, ARRAY_SIZE( tables ));
 
     strcpy( path, CURR_DIR );
     strcat( path, "\\" );
@@ -13805,7 +13805,7 @@ static void test_MsiGetFeatureInfo(void)
         skip("process is limited\n");
         return;
     }
-    create_database( msifile, tables, sizeof(tables) / sizeof(tables[0]) );
+    create_database( msifile, tables, ARRAY_SIZE( tables ));
 
     strcpy( path, CURR_DIR );
     strcat( path, "\\" );
@@ -13989,9 +13989,9 @@ static void test_lastusedsource(void)
     create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
     DeleteFileA("maximus");
 
-    create_database("msifile0.msi", lus0_tables, sizeof(lus0_tables) / sizeof(msi_table));
-    create_database("msifile1.msi", lus1_tables, sizeof(lus1_tables) / sizeof(msi_table));
-    create_database("msifile2.msi", lus2_tables, sizeof(lus2_tables) / sizeof(msi_table));
+    create_database("msifile0.msi", lus0_tables, ARRAY_SIZE(lus0_tables));
+    create_database("msifile1.msi", lus1_tables, ARRAY_SIZE(lus1_tables));
+    create_database("msifile2.msi", lus2_tables, ARRAY_SIZE(lus2_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
@@ -14111,7 +14111,7 @@ static void test_setpropertyfolder(void)
     CreateDirectoryA("msitest", NULL);
     create_file("msitest\\maximus", 500);
 
-    create_database(msifile, spf_tables, sizeof(spf_tables) / sizeof(msi_table));
+    create_database(msifile, spf_tables, ARRAY_SIZE(spf_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
 
@@ -14154,7 +14154,7 @@ static void test_sourcedir_props(void)
 
     create_test_files();
     create_file("msitest\\sourcedir.txt", 1000);
-    create_database(msifile, sd_tables, sizeof(sd_tables) / sizeof(msi_table));
+    create_database(msifile, sd_tables, ARRAY_SIZE(sd_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
 
@@ -14221,11 +14221,11 @@ static void test_concurrentinstall(void)
     create_file("msitest\\maximus", 500);
     create_file("msitest\\msitest\\augustus", 500);
 
-    create_database(msifile, ci_tables, sizeof(ci_tables) / sizeof(msi_table));
+    create_database(msifile, ci_tables, ARRAY_SIZE(ci_tables));
 
     lstrcpyA(path, CURR_DIR);
     lstrcatA(path, "\\msitest\\concurrent.msi");
-    create_database(path, ci2_tables, sizeof(ci2_tables) / sizeof(msi_table));
+    create_database(path, ci2_tables, ARRAY_SIZE(ci2_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
 
@@ -14269,7 +14269,7 @@ static void test_command_line_parsing(void)
     }
 
     create_test_files();
-    create_database(msifile, cl_tables, sizeof(cl_tables)/sizeof(msi_table));
+    create_database(msifile, cl_tables, ARRAY_SIZE(cl_tables));
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
 
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index 09d2e0b61b..88bd60a8f2 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -187,7 +187,7 @@ static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM acce
     dwMaxSubkeyLen++;
     dwMaxValueLen++;
     dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
-    if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
+    if (dwMaxLen > ARRAY_SIZE(szNameBuf))
     {
         /* Name too big: alloc a buffer for it */
         if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
diff --git a/dlls/msi/tests/patch.c b/dlls/msi/tests/patch.c
index a09084002e..b577982443 100644
--- a/dlls/msi/tests/patch.c
+++ b/dlls/msi/tests/patch.c
@@ -731,7 +731,7 @@ static void test_simple_patch( void )
     CreateDirectoryA( "msitest", NULL );
     create_file( "msitest\\patch.txt", 1000 );
 
-    create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) );
+    create_database( msifile, tables, ARRAY_SIZE(tables) );
     create_patch( mspfile );
 
     MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
@@ -929,7 +929,7 @@ static void test_MsiOpenDatabase( void )
     MsiCloseHandle( hdb );
     DeleteFileA( mspfile );
 
-    create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) );
+    create_database( msifile, tables, ARRAY_SIZE(tables) );
     create_patch( mspfile );
 
     r = MsiOpenDatabaseW( msifileW, MSIDBOPEN_READONLY + MSIDBOPEN_PATCHFILE, &hdb );
@@ -1072,7 +1072,7 @@ static void test_system_tables( void )
     CreateDirectoryA( "msitest", NULL );
     create_file( "msitest\\patch.txt", 1000 );
 
-    create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) );
+    create_database( msifile, tables, ARRAY_SIZE(tables) );
     create_patch( mspfile );
 
     MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
@@ -1261,7 +1261,7 @@ static void test_patch_registration( void )
     CreateDirectoryA( "msitest", NULL );
     create_file( "msitest\\patch.txt", 1000 );
 
-    create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) );
+    create_database( msifile, tables, ARRAY_SIZE(tables) );
     create_patch( mspfile );
 
     MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
diff --git a/dlls/msi/tests/record.c b/dlls/msi/tests/record.c
index 777f1f78ed..d0ad15b8fe 100644
--- a/dlls/msi/tests/record.c
+++ b/dlls/msi/tests/record.c
@@ -138,7 +138,7 @@ static void test_msirecord(void)
     ok(buf[0] == 0, "MsiRecordGetStringA returned the wrong string\n");
     ok(sz == 0, "MsiRecordGetStringA returned the wrong length\n");
     bufW[0] = 0;
-    sz = sizeof bufW / sizeof bufW[0];
+    sz = ARRAY_SIZE(bufW);
     r = MsiRecordGetStringW(h, 0, bufW, &sz);
     ok(r == ERROR_SUCCESS, "Failed to get string at 0\n");
     ok(bufW[0] == 0, "MsiRecordGetStringW returned the wrong string\n");
@@ -156,7 +156,7 @@ static void test_msirecord(void)
     ok(buf[0] == 0, "MsiRecordGetStringA returned the wrong string\n");
     ok(sz == 0, "MsiRecordGetStringA returned the wrong length\n");
     bufW[0] = 0;
-    sz = sizeof bufW / sizeof bufW[0];
+    sz = ARRAY_SIZE(bufW);
     r = MsiRecordGetStringW(h, 0, bufW, &sz);
     ok(r == ERROR_SUCCESS, "Failed to get string at 0\n");
     ok(bufW[0] == 0, "MsiRecordGetStringW returned the wrong string\n");
-- 
2.14.4




More information about the wine-devel mailing list