Wine-devel
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
June 2018
- 68 participants
- 583 discussions
From: Denis Malikov <mdn40000(a)mail.ru>
Date: Sat, 16 Jun 2018 16:35:45 +0700
Subject: [PATCH] comctl32/imagelist: fix ImageList_Read/Write.
Fix for versions x600 and x620 and pointer calculation for mixing
image and mask bits.
Tested on ReactOS 0.4.10 with *.reg files extracted from:
- XP/2003 key HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\TrayNotify;
- Vista/7 key HKEY_CLASSES_ROOT\Local
Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify
Signed-off-by: Denis Malikov <mdn40000(a)mail.ru>
---
dlls/comctl32/imagelist.c | 59 +++++++++++++++++++++++++++--------------------
1 file changed, 34 insertions(+), 25 deletions(-)
diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index a08d60752e..052d59f9e4 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -59,7 +59,7 @@ struct _IMAGELIST
INT cGrow; /* 0C: cGrow */
INT cx; /* 10: cx */
INT cy; /* 14: cy */
- DWORD x4;
+ DWORD x4; /* hack for IL from
stream. Keep version here */
UINT flags; /* 1C: flags */
COLORREF clrFg; /* 20: foreground color */
COLORREF clrBk; /* 24: background color */
@@ -83,6 +83,7 @@ struct _IMAGELIST
};
#define IMAGELIST_MAGIC 0x53414D58
+#define IMAGELIST_VERSION 0x101
/* Header used by ImageList_Read() and ImageList_Write() */
#include "pshpack2.h"
@@ -806,6 +807,7 @@ ImageList_Create (INT cx, INT cy, UINT flags,
himl->clrFg = CLR_DEFAULT;
himl->clrBk = CLR_NONE;
himl->color_table_set = FALSE;
+ himl->x4 = 0;
/* initialize overlay mask indices */
for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++)
@@ -2257,38 +2259,43 @@ HIMAGELIST WINAPI ImageList_Read(IStream *pstm)
BITMAPINFO *image_info = (BITMAPINFO *)image_buf;
BITMAPINFO *mask_info = (BITMAPINFO *)mask_buf;
void *image_bits, *mask_bits = NULL;
- ILHEAD ilHead;
- HIMAGELIST himl;
+ ILHEAD ilHead;
+ HIMAGELIST himl;
unsigned int i;
TRACE("%p\n", pstm);
if (FAILED(IStream_Read (pstm, &ilHead, sizeof(ILHEAD), NULL)))
- return NULL;
+ return NULL;
if (ilHead.usMagic != (('L' << 8) | 'I'))
- return NULL;
- if (ilHead.usVersion != 0x101) /* probably version? */
- return NULL;
+ return NULL;
+ if (ilHead.usVersion != IMAGELIST_VERSION &&
+ ilHead.usVersion != 0x600 && /* XP/2003 version */
+ ilHead.usVersion != 0x620) /* Vista/7 version */
+ return NULL;
TRACE("cx %u, cy %u, flags 0x%04x, cCurImage %u, cMaxImage %u\n",
ilHead.cx, ilHead.cy, ilHead.flags, ilHead.cCurImage,
ilHead.cMaxImage);
himl = ImageList_Create(ilHead.cx, ilHead.cy, ilHead.flags,
ilHead.cCurImage, ilHead.cMaxImage);
if (!himl)
- return NULL;
+ return NULL;
+
+ // keep version from stream
+ himl->x4 = ilHead.usVersion;
if (!(image_bits = read_bitmap(pstm, image_info)))
{
- WARN("failed to read bitmap from stream\n");
- return NULL;
+ WARN("failed to read bitmap from stream\n");
+ return NULL;
}
if (ilHead.flags & ILC_MASK)
{
if (!(mask_bits = read_bitmap(pstm, mask_info)))
{
WARN("failed to read mask bitmap from stream\n");
- return NULL;
- }
+ return NULL;
+ }
}
else mask_info = NULL;
@@ -2296,23 +2303,25 @@ HIMAGELIST WINAPI ImageList_Read(IStream *pstm)
{
DWORD *ptr = image_bits;
BYTE *mask_ptr = mask_bits;
- int stride = himl->cy * image_info->bmiHeader.biWidth;
+ int stride = himl->cy * (ilHead.usVersion !=
IMAGELIST_VERSION ? himl->cx : image_info->bmiHeader.biWidth);
+ int image_step = ilHead.usVersion != IMAGELIST_VERSION ? 1 :
TILE_COUNT;
+ int mask_step = ilHead.usVersion != IMAGELIST_VERSION ? 4 : 8;
if (image_info->bmiHeader.biHeight > 0) /* bottom-up */
{
ptr += image_info->bmiHeader.biHeight *
image_info->bmiHeader.biWidth - stride;
- mask_ptr += (image_info->bmiHeader.biHeight *
image_info->bmiHeader.biWidth - stride) / 8;
+ mask_ptr += (image_info->bmiHeader.biHeight *
image_info->bmiHeader.biWidth - stride) / mask_step;
stride = -stride;
image_info->bmiHeader.biHeight = himl->cy;
}
else image_info->bmiHeader.biHeight = -himl->cy;
- for (i = 0; i < ilHead.cCurImage; i += TILE_COUNT)
+ for (i = 0; i < ilHead.cCurImage; i += image_step)
{
- add_dib_bits( himl, i, min( ilHead.cCurImage - i, TILE_COUNT ),
+ add_dib_bits( himl, i, min( ilHead.cCurImage - i, image_step ),
himl->cx, himl->cy, image_info, mask_info,
ptr, mask_ptr );
ptr += stride;
- mask_ptr += stride / 8;
+ mask_ptr += stride / mask_step;
}
}
else
@@ -2333,7 +2342,7 @@ HIMAGELIST WINAPI ImageList_Read(IStream *pstm)
ImageList_SetBkColor(himl,ilHead.bkcolor);
for (i=0;i<4;i++)
- ImageList_SetOverlayImage(himl,ilHead.ovls[i],i+1);
+ ImageList_SetOverlayImage(himl,ilHead.ovls[i],i+1);
return himl;
}
@@ -3078,10 +3087,10 @@ BOOL WINAPI ImageList_Write(HIMAGELIST himl,
IStream *pstm)
TRACE("%p %p\n", himl, pstm);
if (!is_valid(himl))
- return FALSE;
+ return FALSE;
ilHead.usMagic = (('L' << 8) | 'I');
- ilHead.usVersion = 0x101;
+ ilHead.usVersion = himl->x4 > 0 ? himl->x4 : IMAGELIST_VERSION;
ilHead.cCurImage = himl->cCurImage;
ilHead.cMaxImage = himl->cMaxImage;
ilHead.cGrow = himl->cGrow;
@@ -3090,23 +3099,23 @@ BOOL WINAPI ImageList_Write(HIMAGELIST himl,
IStream *pstm)
ilHead.bkcolor = himl->clrBk;
ilHead.flags = himl->flags;
for(i = 0; i < 4; i++) {
- ilHead.ovls[i] = himl->nOvlIdx[i];
+ ilHead.ovls[i] = himl->nOvlIdx[i];
}
TRACE("cx %u, cy %u, flags 0x04%x, cCurImage %u, cMaxImage %u\n",
ilHead.cx, ilHead.cy, ilHead.flags, ilHead.cCurImage,
ilHead.cMaxImage);
if(FAILED(IStream_Write(pstm, &ilHead, sizeof(ILHEAD), NULL)))
- return FALSE;
+ return FALSE;
/* write the bitmap */
if(!_write_bitmap(himl->hbmImage, pstm))
- return FALSE;
+ return FALSE;
/* write the mask if we have one */
if(himl->flags & ILC_MASK) {
- if(!_write_bitmap(himl->hbmMask, pstm))
- return FALSE;
+ if(!_write_bitmap(himl->hbmMask, pstm))
+ return FALSE;
}
return TRUE;
--
2.16.2.windows.1
1
0
From: Denis Malikov <mdn40000(a)mail.ru>
Date: Sat, 16 Jun 2018 16:35:45 +0700
Subject: [PATCH] comctl32/imagelist: fix ImageList_Read/Write.
Fixed acceptable version and pointer calculation for mixing image and mask bits.
Tested on ReactOS 0.4.10 with *.reg files extracted from XP/2003 key HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\TrayNotify
Signed-off-by: Denis Malikov <mdn40000(a)mail.ru>
---
dlls/comctl32/imagelist.c | 48 +++++++++++++++++++++++------------------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index a08d60752e..f0f8a695fe 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -2257,38 +2257,38 @@ HIMAGELIST WINAPI ImageList_Read(IStream *pstm)
BITMAPINFO *image_info = (BITMAPINFO *)image_buf;
BITMAPINFO *mask_info = (BITMAPINFO *)mask_buf;
void *image_bits, *mask_bits = NULL;
- ILHEAD ilHead;
- HIMAGELIST himl;
+ ILHEAD ilHead;
+ HIMAGELIST himl;
unsigned int i;
TRACE("%p\n", pstm);
if (FAILED(IStream_Read (pstm, &ilHead, sizeof(ILHEAD), NULL)))
- return NULL;
+ return NULL;
if (ilHead.usMagic != (('L' << 8) | 'I'))
- return NULL;
- if (ilHead.usVersion != 0x101) /* probably version? */
- return NULL;
+ return NULL;
+ if (ilHead.usVersion != 0x600) /* XP/2003 version */
+ return NULL;
TRACE("cx %u, cy %u, flags 0x%04x, cCurImage %u, cMaxImage %u\n",
ilHead.cx, ilHead.cy, ilHead.flags, ilHead.cCurImage, ilHead.cMaxImage);
himl = ImageList_Create(ilHead.cx, ilHead.cy, ilHead.flags, ilHead.cCurImage, ilHead.cMaxImage);
if (!himl)
- return NULL;
+ return NULL;
if (!(image_bits = read_bitmap(pstm, image_info)))
{
- WARN("failed to read bitmap from stream\n");
- return NULL;
+ WARN("failed to read bitmap from stream\n");
+ return NULL;
}
if (ilHead.flags & ILC_MASK)
{
if (!(mask_bits = read_bitmap(pstm, mask_info)))
{
WARN("failed to read mask bitmap from stream\n");
- return NULL;
- }
+ return NULL;
+ }
}
else mask_info = NULL;
@@ -2296,23 +2296,23 @@ HIMAGELIST WINAPI ImageList_Read(IStream *pstm)
{
DWORD *ptr = image_bits;
BYTE *mask_ptr = mask_bits;
- int stride = himl->cy * image_info->bmiHeader.biWidth;
+ int stride = himl->cy * himl->cx;
if (image_info->bmiHeader.biHeight > 0) /* bottom-up */
{
ptr += image_info->bmiHeader.biHeight * image_info->bmiHeader.biWidth - stride;
- mask_ptr += (image_info->bmiHeader.biHeight * image_info->bmiHeader.biWidth - stride) / 8;
+ mask_ptr += (image_info->bmiHeader.biHeight * image_info->bmiHeader.biWidth - stride) / 4;
stride = -stride;
image_info->bmiHeader.biHeight = himl->cy;
}
else image_info->bmiHeader.biHeight = -himl->cy;
- for (i = 0; i < ilHead.cCurImage; i += TILE_COUNT)
+ for (i = 0; i < ilHead.cCurImage; i++)
{
- add_dib_bits( himl, i, min( ilHead.cCurImage - i, TILE_COUNT ),
+ add_dib_bits( himl, i, 1,
himl->cx, himl->cy, image_info, mask_info, ptr, mask_ptr );
ptr += stride;
- mask_ptr += stride / 8;
+ mask_ptr += stride / 4;
}
}
else
@@ -2333,7 +2333,7 @@ HIMAGELIST WINAPI ImageList_Read(IStream *pstm)
ImageList_SetBkColor(himl,ilHead.bkcolor);
for (i=0;i<4;i++)
- ImageList_SetOverlayImage(himl,ilHead.ovls[i],i+1);
+ ImageList_SetOverlayImage(himl,ilHead.ovls[i],i+1);
return himl;
}
@@ -3078,10 +3078,10 @@ BOOL WINAPI ImageList_Write(HIMAGELIST himl, IStream *pstm)
TRACE("%p %p\n", himl, pstm);
if (!is_valid(himl))
- return FALSE;
+ return FALSE;
ilHead.usMagic = (('L' << 8) | 'I');
- ilHead.usVersion = 0x101;
+ ilHead.usVersion = 0x600;
ilHead.cCurImage = himl->cCurImage;
ilHead.cMaxImage = himl->cMaxImage;
ilHead.cGrow = himl->cGrow;
@@ -3090,23 +3090,23 @@ BOOL WINAPI ImageList_Write(HIMAGELIST himl, IStream *pstm)
ilHead.bkcolor = himl->clrBk;
ilHead.flags = himl->flags;
for(i = 0; i < 4; i++) {
- ilHead.ovls[i] = himl->nOvlIdx[i];
+ ilHead.ovls[i] = himl->nOvlIdx[i];
}
TRACE("cx %u, cy %u, flags 0x04%x, cCurImage %u, cMaxImage %u\n",
ilHead.cx, ilHead.cy, ilHead.flags, ilHead.cCurImage, ilHead.cMaxImage);
if(FAILED(IStream_Write(pstm, &ilHead, sizeof(ILHEAD), NULL)))
- return FALSE;
+ return FALSE;
/* write the bitmap */
if(!_write_bitmap(himl->hbmImage, pstm))
- return FALSE;
+ return FALSE;
/* write the mask if we have one */
if(himl->flags & ILC_MASK) {
- if(!_write_bitmap(himl->hbmMask, pstm))
- return FALSE;
+ if(!_write_bitmap(himl->hbmMask, pstm))
+ return FALSE;
}
return TRUE;
--
2.16.2.windows.1
1
0
Signed-off-by: Michael Stefaniuc <mstefani(a)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
3
2
15 Jun '18
From: Kieran Duggan <kieranduggan15(a)gmail.com>
Signed-off-by: Kieran Duggan <kieranduggan15(a)gmail.com>
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
---
dlls/d3dx9_36/tests/core.c | 81 +++++++++++++++++++++++++++++++++++-----------
1 file changed, 62 insertions(+), 19 deletions(-)
diff --git a/dlls/d3dx9_36/tests/core.c b/dlls/d3dx9_36/tests/core.c
index 75d33c1e0dc..3ed25f8176b 100644
--- a/dlls/d3dx9_36/tests/core.c
+++ b/dlls/d3dx9_36/tests/core.c
@@ -305,23 +305,28 @@ static void test_ID3DXSprite(IDirect3DDevice9 *device)
static void test_ID3DXFont(IDirect3DDevice9 *device)
{
- D3DXFONT_DESCA desc;
- ID3DXFont *font;
- HRESULT hr;
- int ref;
- int i;
- static const struct {
- INT font_height;
- UINT expected_size;
- DWORD expected_levels;
- } texture_tests[] = {
+ static const WCHAR testW[] = {'t','e','s','t',0};
+ static const struct
+ {
+ int font_height;
+ unsigned int expected_size;
+ unsigned int expected_levels;
+ }
+ tests[] =
+ {
{ 6, 128, 4 },
{ 8, 128, 4 },
{ 10, 256, 5 },
{ 12, 256, 5 },
- { 72, 256, 8 }
+ { 72, 256, 8 },
};
-
+ const unsigned int size = ARRAY_SIZE(testW);
+ D3DXFONT_DESCA desc;
+ ID3DXSprite *sprite;
+ int ref, i, height;
+ ID3DXFont *font;
+ HRESULT hr;
+ RECT rect;
/* D3DXCreateFont */
ref = get_ref((IUnknown*)device);
@@ -463,8 +468,6 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
/* ID3DXFont_PreloadText */
hr = D3DXCreateFontA(device, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Arial", &font);
if(SUCCEEDED(hr)) {
- const WCHAR testW[] = {'t','e','s','t',0};
-
todo_wine {
hr = ID3DXFont_PreloadTextA(font, NULL, -1);
ok(hr == D3DERR_INVALIDCALL, "ID3DXFont_PreloadTextA returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
@@ -552,7 +555,8 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
check_release((IUnknown*)font, 0);
} else skip("Failed to create a ID3DXFont object\n");
- for(i = 0; i < ARRAY_SIZE(texture_tests); i++) {
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
HDC hdc;
DWORD ret;
HRESULT hr;
@@ -560,7 +564,8 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
char c = 'a';
IDirect3DTexture9 *texture;
- hr = D3DXCreateFontA(device, texture_tests[i].font_height, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Arial", &font);
+ hr = D3DXCreateFontA(device, tests[i].font_height, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET,
+ OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Arial", &font);
if(FAILED(hr)) {
skip("Failed to create a ID3DXFont object\n");
continue;
@@ -578,17 +583,55 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
D3DSURFACE_DESC desc;
levels = IDirect3DTexture9_GetLevelCount(texture);
- ok(levels == texture_tests[i].expected_levels, "Got levels %u, expected %u\n", levels, texture_tests[i].expected_levels);
+ ok(levels == tests[i].expected_levels, "Got levels %u, expected %u\n",
+ levels, tests[i].expected_levels);
hr = IDirect3DTexture9_GetLevelDesc(texture, 0, &desc);
ok(hr == D3D_OK, "IDirect3DTexture9_GetLevelDesc failed\n");
ok(desc.Format == D3DFMT_A8R8G8B8, "Got format %#x, expected %#x\n", desc.Format, D3DFMT_A8R8G8B8);
ok(desc.Usage == 0, "Got usage %#x, expected %#x\n", desc.Usage, 0);
- ok(desc.Width == texture_tests[i].expected_size, "Got width %u, expected %u\n", desc.Width, texture_tests[i].expected_size);
- ok(desc.Height == texture_tests[i].expected_size, "Got height %u, expected %u\n", desc.Height, texture_tests[i].expected_size);
+ ok(desc.Width == tests[i].expected_size, "Got width %u, expected %u\n",
+ desc.Width, tests[i].expected_size);
+ ok(desc.Height == tests[i].expected_size, "Got height %u, expected %u\n",
+ desc.Height, tests[i].expected_size);
ok(desc.Pool == D3DPOOL_MANAGED, "Got pool %u, expected %u\n", desc.Pool, D3DPOOL_MANAGED);
IDirect3DTexture9_Release(texture);
}
+
+ /* ID3DXFontImpl_DrawText */
+ D3DXCreateSprite(device, &sprite);
+ SetRect(&rect, 0, 0, 640, 480);
+
+ IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0);
+
+ IDirect3DDevice9_BeginScene(device);
+ hr = ID3DXSprite_Begin(sprite, D3DXSPRITE_ALPHABLEND);
+ ok (hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+
+ height = ID3DXFont_DrawTextW(font, sprite, testW, -1, &rect, DT_TOP, 0xffffffff);
+ ok(height == tests[i].font_height, "Got unexpected height %u.\n", height);
+ height = ID3DXFont_DrawTextW(font, sprite, testW, size, &rect, DT_TOP, 0xffffffff);
+ ok(height == tests[i].font_height, "Got unexpected height %u.\n", height);
+ height = ID3DXFont_DrawTextW(font, sprite, testW, size, &rect, DT_RIGHT, 0xffffffff);
+ ok(height == tests[i].font_height, "Got unexpected height %u.\n", height);
+ height = ID3DXFont_DrawTextW(font, sprite, testW, size, &rect, DT_LEFT | DT_NOCLIP,
+ 0xffffffff);
+ ok(height == tests[i].font_height, "Got unexpected height %u.\n", height);
+
+ SetRect(&rect, 0, 0, 0, 0);
+ height = ID3DXFont_DrawTextW(font, sprite, testW, size, &rect,
+ DT_LEFT | DT_CALCRECT, 0xffffffff);
+ ok(height == tests[i].font_height, "Got unexpected height %u.\n", height);
+ ok(!rect.left, "Got unexpected rect left %d.\n", rect.left);
+ ok(!rect.top, "Got unexpected rect top %d.\n", rect.top);
+ ok(rect.right, "Got unexpected rect right %d.\n", rect.right);
+ ok(rect.bottom == tests[i].font_height, "Got unexpected rect bottom %d.\n", rect.bottom);
+
+ hr = ID3DXSprite_End(sprite);
+ ok (hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+ IDirect3DDevice9_EndScene(device);
+ ID3DXSprite_Release(sprite);
+
ID3DXFont_Release(font);
}
}
--
2.16.1
3
2
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
1
0
Signed-off-by: Hua meng <161220092(a)smail.nju.edu.cn>
---
dlls/msvcp120/tests/msvcp120.c | 50 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 49 insertions(+), 1 deletion(-)
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index 1247222..c34bd65 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -26,6 +26,7 @@
DWORD expect_idx;
static int vector_alloc_count;
+static int vector_elem_count;
#define DEFINE_EXPECT(func) \
BOOL expect_ ## func, called_ ## func
@@ -38,6 +39,7 @@ struct expect_struct {
DEFINE_EXPECT(queue_char__Assign_and_destroy_item);
DEFINE_EXPECT(concurrent_vector_int_alloc);
DEFINE_EXPECT(concurrent_vector_int_destroy);
+ DEFINE_EXPECT(concurrent_vector_int_copy);
};
#define SET_EXPECT(func) \
@@ -110,6 +112,8 @@ static void * (WINAPI *call_thiscall_func1)( void *func, void *this );
static void * (WINAPI *call_thiscall_func2)( void *func, void *this, const void *a );
static void * (WINAPI *call_thiscall_func3)( void *func, void *this, const void *a,
const void *b );
+static void * (WINAPI *call_thiscall_func4)( void *func, void *this, const void *a,
+ const void *b, const void *c );
static void init_thiscall_thunk(void)
{
@@ -123,18 +127,22 @@ static void init_thiscall_thunk(void)
call_thiscall_func1 = (void *)thunk;
call_thiscall_func2 = (void *)thunk;
call_thiscall_func3 = (void *)thunk;
+ call_thiscall_func4 = (void *)thunk;
}
#define call_func1(func,_this) call_thiscall_func1(func,_this)
#define call_func2(func,_this,a) call_thiscall_func2(func,_this,(const void*)(a))
#define call_func3(func,_this,a,b) call_thiscall_func3(func,_this,(const void*)(a),\
(const void*)(b))
+#define call_func4(func,_this,a,b,c) call_thiscall_func4(func,_this,(const void*)(a),\
+ (const void*)(b),(const void*)(c))
#else
#define init_thiscall_thunk()
#define call_func1(func,_this) func(_this)
#define call_func2(func,_this,a) func(_this,a)
#define call_func3(func,_this,a,b) func(_this,a,b)
+#define call_func4(func,_this,a,b,c) func(_this,a,b,c)
#endif /* __i386__ */
static inline float __port_infinity(void)
@@ -382,6 +390,8 @@ static void* (__thiscall *p_vector_base_v4__Internal_push_back)(
vector_base_v4*, size_t, size_t*);
static size_t (__thiscall *p_vector_base_v4__Internal_clear)(
vector_base_v4*, void (__cdecl*)(void*, size_t));
+static void (__thiscall *p_vector_base_v4__Internal_copy)(
+ vector_base_v4*, vector_base_v4*, size_t, void (__cdecl*)(void*, const void*, size_t));
static HMODULE msvcp;
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y)
@@ -524,6 +534,8 @@ static BOOL init(void)
"?_Internal_push_back(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAAPEAX_KAEA_K(a)Z");
SET(p_vector_base_v4__Internal_clear,
"?_Internal_clear(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAA_KP6AXPEAX_K(a)Z@Z");
+ SET(p_vector_base_v4__Internal_copy,
+ "?_Internal_copy(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAAXAEBV123(a)_KP6AXPEAXPEBX1@Z(a)Z");
} else {
SET(p_tr2_sys__File_size,
"?_File_size(a)sys@tr2(a)std@@YA_KPBD(a)Z");
@@ -635,6 +647,8 @@ static BOOL init(void)
"?_Internal_push_back(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEPAXIAAI(a)Z");
SET(p_vector_base_v4__Internal_clear,
"?_Internal_clear(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEIP6AXPAXI(a)Z@Z");
+ SET(p_vector_base_v4__Internal_copy,
+ "?_Internal_copy(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEXABV123(a)IP6AXPAXPBXI@Z(a)Z");
#else
SET(p__Thrd_current,
"_Thrd_current");
@@ -674,6 +688,8 @@ static BOOL init(void)
"?_Internal_push_back(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAPAXIAAI(a)Z");
SET(p_vector_base_v4__Internal_clear,
"?_Internal_clear(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAIP6AXPAXI(a)Z@Z");
+ SET(p_vector_base_v4__Internal_copy,
+ "?_Internal_copy(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAXABV123(a)IP6AXPAXPBXI@Z(a)Z");
#endif
}
SET(p__Thrd_equal,
@@ -2459,6 +2475,8 @@ static void* __cdecl concurrent_vector_int_alloc(vector_base_v4 *this, size_t n)
static void __cdecl concurrent_vector_int_destroy(void *ptr, size_t n)
{
CHECK_EXPECT2(concurrent_vector_int_destroy);
+ ok(vector_elem_count >= n, "invalid destroy\n");
+ vector_elem_count -= n;
memset(ptr, 0xff, sizeof(int)*n);
}
@@ -2484,6 +2502,13 @@ static void concurrent_vector_int_dtor(vector_base_v4 *this)
call_func1(p_vector_base_v4_dtor, this);
}
+static void __cdecl concurrent_vector_int_copy(void *dst, const void *src, size_t n)
+{
+ CHECK_EXPECT2(concurrent_vector_int_copy);
+ vector_elem_count += n;
+ memcpy(dst, src, n*sizeof(int));
+}
+
static void test_queue_base_v4(void)
{
queue_base_v4 queue;
@@ -2677,7 +2702,7 @@ static void test_queue_base_v4(void)
static void test_vector_base_v4(void)
{
- vector_base_v4 vector;
+ vector_base_v4 vector, v2;
size_t idx, size;
int *data;
@@ -2695,6 +2720,7 @@ static void test_vector_base_v4(void)
CHECK_CALLED(concurrent_vector_int_alloc);
ok(data != NULL, "_Internal_push_back returned NULL\n");
ok(idx == 0, "idx got %ld expected %d\n", (long)idx, 0);
+ vector_elem_count++;
*data = 1;
ok(data == vector.storage[0], "vector.storage[0] got %p expected %p\n",
vector.storage[0], data);
@@ -2709,6 +2735,7 @@ static void test_vector_base_v4(void)
data = call_func3(p_vector_base_v4__Internal_push_back, &vector, sizeof(int), &idx);
ok(data != NULL, "_Internal_push_back returned NULL\n");
ok(idx == 1, "idx got %ld expected 1\n", (long)idx);
+ vector_elem_count++;
*data = 2;
ok(vector.first_block == 1, "vector.first_block got %ld expected 1\n",
(long)vector.first_block);
@@ -2723,6 +2750,7 @@ static void test_vector_base_v4(void)
CHECK_CALLED(concurrent_vector_int_alloc);
ok(data != NULL, "_Internal_push_back returned NULL\n");
ok(idx == 2, "idx got %ld expected 2\n", (long)idx);
+ vector_elem_count++;
*data = 3;
ok(vector.first_block == 1, "vector.first_block got %ld expected 1\n",
(long)vector.first_block);
@@ -2735,6 +2763,7 @@ static void test_vector_base_v4(void)
data = call_func3(p_vector_base_v4__Internal_push_back, &vector, sizeof(int), &idx);
ok(data != NULL, "_Internal_push_back returned NULL\n");
ok(idx == 3, "idx got %ld expected 3\n", (long)idx);
+ vector_elem_count++;
*data = 4;
size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
ok(size == 4, "size of vector got %ld expected 4\n", (long)size);
@@ -2744,10 +2773,28 @@ static void test_vector_base_v4(void)
CHECK_CALLED(concurrent_vector_int_alloc);
ok(data != NULL, "_Internal_push_back returned NULL\n");
ok(idx == 4, "idx got %ld expected 2\n", (long)idx);
+ vector_elem_count++;
*data = 5;
size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
ok(size == 8, "size of vector got %ld expected 8\n", (long)size);
+ concurrent_vector_int_ctor(&v2);
+ SET_EXPECT(concurrent_vector_int_alloc);
+ SET_EXPECT(concurrent_vector_int_copy);
+ call_func4(p_vector_base_v4__Internal_copy, &v2, &vector,
+ sizeof(int), concurrent_vector_int_copy);
+ CHECK_CALLED(concurrent_vector_int_alloc);
+ CHECK_CALLED(concurrent_vector_int_copy);
+ ok(v2.first_block == 3, "v2.first_block got %ld expected 3\n",
+ (long)v2.first_block);
+ ok(v2.early_size == 5, "v2.early_size got %ld expected 5\n",
+ (long)v2.early_size);
+
+ SET_EXPECT(concurrent_vector_int_destroy);
+ size = (size_t)call_func2(p_vector_base_v4__Internal_clear,
+ &v2, concurrent_vector_int_destroy);
+ concurrent_vector_int_dtor(&v2);
+
SET_EXPECT(concurrent_vector_int_destroy);
size = (size_t)call_func2(p_vector_base_v4__Internal_clear,
&vector, concurrent_vector_int_destroy);
@@ -2759,6 +2806,7 @@ static void test_vector_base_v4(void)
(long)vector.early_size);
concurrent_vector_int_dtor(&vector);
+ ok(!vector_elem_count, "vector_elem_count = %d, expected 0\n", vector_elem_count);
ok(!vector_alloc_count, "vector_alloc_count = %d, expected 0\n", vector_alloc_count);
}
--
2.11.0
1
0
Hi Hua,
On 06/15/18 15:47, Hua Meng wrote:
> +static void (__thiscall *p_vector_base_v4__Internal_copy)(
> + vector_base_v4*, void (__cdecl*)(void*, size_t));
This doesn't match _Internal_copy header. It also breaks 64-bit compilation:
dlls/msvcp120/tests/msvcp120.c:2784:16: error: too many arguments to
function 'p_vector_base_v4__Internal_copy'
Thanks,
Piotr
1
0
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=39157
Your paranoid android.
=== build (build) ===
Rebuild of 64-bit crossbuild failed
1
0
Signed-off-by: Hua meng <161220092(a)smail.nju.edu.cn>
---
dlls/msvcp120/tests/msvcp120.c | 50 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 49 insertions(+), 1 deletion(-)
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index 1247222..fee012d 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -26,6 +26,7 @@
DWORD expect_idx;
static int vector_alloc_count;
+static int vector_elem_count;
#define DEFINE_EXPECT(func) \
BOOL expect_ ## func, called_ ## func
@@ -38,6 +39,7 @@ struct expect_struct {
DEFINE_EXPECT(queue_char__Assign_and_destroy_item);
DEFINE_EXPECT(concurrent_vector_int_alloc);
DEFINE_EXPECT(concurrent_vector_int_destroy);
+ DEFINE_EXPECT(concurrent_vector_int_copy);
};
#define SET_EXPECT(func) \
@@ -110,6 +112,8 @@ static void * (WINAPI *call_thiscall_func1)( void *func, void *this );
static void * (WINAPI *call_thiscall_func2)( void *func, void *this, const void *a );
static void * (WINAPI *call_thiscall_func3)( void *func, void *this, const void *a,
const void *b );
+static void * (WINAPI *call_thiscall_func4)( void *func, void *this, const void *a,
+ const void *b, const void *c );
static void init_thiscall_thunk(void)
{
@@ -123,18 +127,22 @@ static void init_thiscall_thunk(void)
call_thiscall_func1 = (void *)thunk;
call_thiscall_func2 = (void *)thunk;
call_thiscall_func3 = (void *)thunk;
+ call_thiscall_func4 = (void *)thunk;
}
#define call_func1(func,_this) call_thiscall_func1(func,_this)
#define call_func2(func,_this,a) call_thiscall_func2(func,_this,(const void*)(a))
#define call_func3(func,_this,a,b) call_thiscall_func3(func,_this,(const void*)(a),\
(const void*)(b))
+#define call_func4(func,_this,a,b,c) call_thiscall_func4(func,_this,(const void*)(a),\
+ (const void*)(b),(const void*)(c))
#else
#define init_thiscall_thunk()
#define call_func1(func,_this) func(_this)
#define call_func2(func,_this,a) func(_this,a)
#define call_func3(func,_this,a,b) func(_this,a,b)
+#define call_func4(func,_this,a,b,c) func(_this,a,b,c)
#endif /* __i386__ */
static inline float __port_infinity(void)
@@ -382,6 +390,8 @@ static void* (__thiscall *p_vector_base_v4__Internal_push_back)(
vector_base_v4*, size_t, size_t*);
static size_t (__thiscall *p_vector_base_v4__Internal_clear)(
vector_base_v4*, void (__cdecl*)(void*, size_t));
+static void (__thiscall *p_vector_base_v4__Internal_copy)(
+ vector_base_v4*, void (__cdecl*)(void*, size_t));
static HMODULE msvcp;
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y)
@@ -524,6 +534,8 @@ static BOOL init(void)
"?_Internal_push_back(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAAPEAX_KAEA_K(a)Z");
SET(p_vector_base_v4__Internal_clear,
"?_Internal_clear(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAA_KP6AXPEAX_K(a)Z@Z");
+ SET(p_vector_base_v4__Internal_copy,
+ "?_Internal_copy(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAAXAEBV123(a)_KP6AXPEAXPEBX1@Z(a)Z");
} else {
SET(p_tr2_sys__File_size,
"?_File_size(a)sys@tr2(a)std@@YA_KPBD(a)Z");
@@ -635,6 +647,8 @@ static BOOL init(void)
"?_Internal_push_back(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEPAXIAAI(a)Z");
SET(p_vector_base_v4__Internal_clear,
"?_Internal_clear(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEIP6AXPAXI(a)Z@Z");
+ SET(p_vector_base_v4__Internal_copy,
+ "?_Internal_copy(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEXABV123(a)IP6AXPAXPBXI@Z(a)Z");
#else
SET(p__Thrd_current,
"_Thrd_current");
@@ -674,6 +688,8 @@ static BOOL init(void)
"?_Internal_push_back(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAPAXIAAI(a)Z");
SET(p_vector_base_v4__Internal_clear,
"?_Internal_clear(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAIP6AXPAXI(a)Z@Z");
+ SET(p_vector_base_v4__Internal_copy,
+ "?_Internal_copy(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAXABV123(a)IP6AXPAXPBXI@Z(a)Z");
#endif
}
SET(p__Thrd_equal,
@@ -2459,6 +2475,8 @@ static void* __cdecl concurrent_vector_int_alloc(vector_base_v4 *this, size_t n)
static void __cdecl concurrent_vector_int_destroy(void *ptr, size_t n)
{
CHECK_EXPECT2(concurrent_vector_int_destroy);
+ ok(vector_elem_count >= n, "invalid destroy\n");
+ vector_elem_count -= n;
memset(ptr, 0xff, sizeof(int)*n);
}
@@ -2484,6 +2502,13 @@ static void concurrent_vector_int_dtor(vector_base_v4 *this)
call_func1(p_vector_base_v4_dtor, this);
}
+static void __cdecl concurrent_vector_int_copy(void *dst, const void *src, size_t n)
+{
+ CHECK_EXPECT2(concurrent_vector_int_copy);
+ vector_elem_count += n;
+ memcpy(dst, src, n*sizeof(int));
+}
+
static void test_queue_base_v4(void)
{
queue_base_v4 queue;
@@ -2677,7 +2702,7 @@ static void test_queue_base_v4(void)
static void test_vector_base_v4(void)
{
- vector_base_v4 vector;
+ vector_base_v4 vector, v2;
size_t idx, size;
int *data;
@@ -2695,6 +2720,7 @@ static void test_vector_base_v4(void)
CHECK_CALLED(concurrent_vector_int_alloc);
ok(data != NULL, "_Internal_push_back returned NULL\n");
ok(idx == 0, "idx got %ld expected %d\n", (long)idx, 0);
+ vector_elem_count++;
*data = 1;
ok(data == vector.storage[0], "vector.storage[0] got %p expected %p\n",
vector.storage[0], data);
@@ -2709,6 +2735,7 @@ static void test_vector_base_v4(void)
data = call_func3(p_vector_base_v4__Internal_push_back, &vector, sizeof(int), &idx);
ok(data != NULL, "_Internal_push_back returned NULL\n");
ok(idx == 1, "idx got %ld expected 1\n", (long)idx);
+ vector_elem_count++;
*data = 2;
ok(vector.first_block == 1, "vector.first_block got %ld expected 1\n",
(long)vector.first_block);
@@ -2723,6 +2750,7 @@ static void test_vector_base_v4(void)
CHECK_CALLED(concurrent_vector_int_alloc);
ok(data != NULL, "_Internal_push_back returned NULL\n");
ok(idx == 2, "idx got %ld expected 2\n", (long)idx);
+ vector_elem_count++;
*data = 3;
ok(vector.first_block == 1, "vector.first_block got %ld expected 1\n",
(long)vector.first_block);
@@ -2735,6 +2763,7 @@ static void test_vector_base_v4(void)
data = call_func3(p_vector_base_v4__Internal_push_back, &vector, sizeof(int), &idx);
ok(data != NULL, "_Internal_push_back returned NULL\n");
ok(idx == 3, "idx got %ld expected 3\n", (long)idx);
+ vector_elem_count++;
*data = 4;
size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
ok(size == 4, "size of vector got %ld expected 4\n", (long)size);
@@ -2744,10 +2773,28 @@ static void test_vector_base_v4(void)
CHECK_CALLED(concurrent_vector_int_alloc);
ok(data != NULL, "_Internal_push_back returned NULL\n");
ok(idx == 4, "idx got %ld expected 2\n", (long)idx);
+ vector_elem_count++;
*data = 5;
size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
ok(size == 8, "size of vector got %ld expected 8\n", (long)size);
+ concurrent_vector_int_ctor(&v2);
+ SET_EXPECT(concurrent_vector_int_alloc);
+ SET_EXPECT(concurrent_vector_int_copy);
+ call_func4(p_vector_base_v4__Internal_copy, &v2, &vector,
+ sizeof(int), concurrent_vector_int_copy);
+ CHECK_CALLED(concurrent_vector_int_alloc);
+ CHECK_CALLED(concurrent_vector_int_copy);
+ ok(v2.first_block == 3, "v2.first_block got %ld expected 3\n",
+ (long)v2.first_block);
+ ok(v2.early_size == 5, "v2.early_size got %ld expected 5\n",
+ (long)v2.early_size);
+
+ SET_EXPECT(concurrent_vector_int_destroy);
+ size = (size_t)call_func2(p_vector_base_v4__Internal_clear,
+ &v2, concurrent_vector_int_destroy);
+ concurrent_vector_int_dtor(&v2);
+
SET_EXPECT(concurrent_vector_int_destroy);
size = (size_t)call_func2(p_vector_base_v4__Internal_clear,
&vector, concurrent_vector_int_destroy);
@@ -2759,6 +2806,7 @@ static void test_vector_base_v4(void)
(long)vector.early_size);
concurrent_vector_int_dtor(&vector);
+ ok(!vector_elem_count, "vector_elem_count = %d, expected 0\n", vector_elem_count);
ok(!vector_alloc_count, "vector_alloc_count = %d, expected 0\n", vector_alloc_count);
}
--
2.11.0
1
0
Rebase. Supersede 147419.
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/comctl32/taskdialog.c | 55 ++++++++++++++++++++++++++
dlls/comctl32/tests/taskdialog.c | 67 ++++++++++++++++++++++++++++++++
2 files changed, 122 insertions(+)
diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
index 07c031b2c7..1a5fad1609 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -57,6 +57,7 @@ struct taskdialog_info
HWND main_icon;
HWND main_instruction;
HWND content;
+ HWND progress_bar;
HWND *buttons;
INT button_count;
HWND default_button;
@@ -351,6 +352,17 @@ static void taskdialog_add_content(struct taskdialog_info *dialog_info)
taskdialog_hyperlink_enabled(dialog_info));
}
+static void taskdialog_add_progress_bar(struct taskdialog_info *dialog_info)
+{
+ const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
+ DWORD style = PBS_SMOOTH | PBS_SMOOTHREVERSE | WS_CHILD | WS_VISIBLE;
+
+ if (!(taskconfig->dwFlags & (TDF_SHOW_PROGRESS_BAR | TDF_SHOW_MARQUEE_PROGRESS_BAR))) return;
+ if (taskconfig->dwFlags & TDF_SHOW_MARQUEE_PROGRESS_BAR) style |= PBS_MARQUEE;
+ dialog_info->progress_bar =
+ CreateWindowW(PROGRESS_CLASSW, NULL, style, 0, 0, 0, 0, dialog_info->hwnd, NULL, 0, NULL);
+}
+
static void taskdialog_add_button(struct taskdialog_info *dialog_info, HWND *button, INT_PTR id, const WCHAR *text,
BOOL custom_button)
{
@@ -464,6 +476,17 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info)
/* Content */
taskdialog_label_layout(dialog_info, dialog_info->content, main_icon_right, dialog_width, &dialog_height, syslink);
+ /* Progress bar */
+ if (dialog_info->progress_bar)
+ {
+ x = main_icon_right + h_spacing;
+ y = dialog_height + v_spacing;
+ size.cx = dialog_width - x - h_spacing;
+ size.cy = GetSystemMetrics(SM_CYVSCROLL);
+ SetWindowPos(dialog_info->progress_bar, 0, x, y, size.cx, size.cy, SWP_NOZORDER);
+ dialog_height = y + size.cy;
+ }
+
dialog_height = max(dialog_height, main_icon_bottom);
/* Common and custom buttons */
@@ -598,6 +621,7 @@ static void taskdialog_init(struct taskdialog_info *dialog_info, HWND hwnd)
taskdialog_add_main_icon(dialog_info);
taskdialog_add_main_instruction(dialog_info);
taskdialog_add_content(dialog_info);
+ taskdialog_add_progress_bar(dialog_info);
taskdialog_add_buttons(dialog_info);
/* Set default button */
@@ -621,6 +645,7 @@ static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
{
static const WCHAR taskdialog_info_propnameW[] = {'T','a','s','k','D','i','a','l','o','g','I','n','f','o',0};
struct taskdialog_info *dialog_info;
+ LRESULT result;
TRACE("hwnd=%p msg=0x%04x wparam=%lx lparam=%lx\n", hwnd, msg, wParam, lParam);
@@ -635,6 +660,36 @@ static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
case TDM_ENABLE_BUTTON:
taskdialog_enable_button(dialog_info, wParam, lParam);
break;
+ case TDM_SET_MARQUEE_PROGRESS_BAR:
+ {
+ BOOL marquee = wParam;
+ LONG style;
+ if(!dialog_info->progress_bar) break;
+ style = GetWindowLongW(dialog_info->progress_bar, GWL_STYLE);
+ style = marquee ? style | PBS_MARQUEE : style & (~PBS_MARQUEE);
+ SetWindowLongW(dialog_info->progress_bar, GWL_STYLE, style);
+ break;
+ }
+ case TDM_SET_PROGRESS_BAR_STATE:
+ result = SendMessageW(dialog_info->progress_bar, PBM_SETSTATE, wParam, 0);
+ SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, result);
+ break;
+ case TDM_SET_PROGRESS_BAR_RANGE:
+ result = SendMessageW(dialog_info->progress_bar, PBM_SETRANGE, 0, lParam);
+ SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, result);
+ break;
+ case TDM_SET_PROGRESS_BAR_POS:
+ result = 0;
+ if (dialog_info->progress_bar)
+ {
+ LONG style = GetWindowLongW(dialog_info->progress_bar, GWL_STYLE);
+ if (!(style & PBS_MARQUEE)) result = SendMessageW(dialog_info->progress_bar, PBM_SETPOS, wParam, 0);
+ }
+ SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, result);
+ break;
+ case TDM_SET_PROGRESS_BAR_MARQUEE:
+ SendMessageW(dialog_info->progress_bar, PBM_SETMARQUEE, wParam, lParam);
+ break;
case WM_INITDIALOG:
dialog_info = (struct taskdialog_info *)lParam;
diff --git a/dlls/comctl32/tests/taskdialog.c b/dlls/comctl32/tests/taskdialog.c
index cca700cd18..e91a878876 100644
--- a/dlls/comctl32/tests/taskdialog.c
+++ b/dlls/comctl32/tests/taskdialog.c
@@ -373,6 +373,72 @@ static void test_timer(void)
pTaskDialogIndirect(&info, NULL, NULL, NULL);
}
+static HRESULT CALLBACK taskdialog_callback_proc_progress_bar(HWND hwnd, UINT notification, WPARAM wParam,
+ LPARAM lParam, LONG_PTR ref_data)
+{
+ unsigned long ret;
+ LONG flags = (LONG)ref_data;
+ if (notification == TDN_CREATED)
+ {
+ /* TDM_SET_PROGRESS_BAR_STATE */
+ ret = SendMessageW(hwnd, TDM_SET_PROGRESS_BAR_STATE, PBST_NORMAL, 0);
+ ok(ret == PBST_NORMAL, "Expect state: %d got state: %lx\n", PBST_NORMAL, ret);
+ ret = SendMessageW(hwnd, TDM_SET_PROGRESS_BAR_STATE, PBST_PAUSED, 0);
+ ok(ret == PBST_NORMAL, "Expect state: %d got state: %lx\n", PBST_NORMAL, ret);
+ ret = SendMessageW(hwnd, TDM_SET_PROGRESS_BAR_STATE, PBST_ERROR, 0);
+ /* Progress bar has fixme on handling PBM_SETSTATE message */
+ todo_wine ok(ret == PBST_PAUSED, "Expect state: %d got state: %lx\n", PBST_PAUSED, ret);
+ ret = SendMessageW(hwnd, TDM_SET_PROGRESS_BAR_STATE, PBST_NORMAL, 0);
+ todo_wine ok(ret == PBST_ERROR, "Expect state: %d got state: %lx\n", PBST_ERROR, ret);
+
+ /* TDM_SET_PROGRESS_BAR_RANGE */
+ ret = SendMessageW(hwnd, TDM_SET_PROGRESS_BAR_RANGE, 0, MAKELPARAM(0, 200));
+ ok(ret == MAKELONG(0, 100), "Expect range:%x got:%lx\n", MAKELONG(0, 100), ret);
+ ret = SendMessageW(hwnd, TDM_SET_PROGRESS_BAR_RANGE, 0, MAKELPARAM(0, 200));
+ ok(ret == MAKELONG(0, 200), "Expect range:%x got:%lx\n", MAKELONG(0, 200), ret);
+
+ /* TDM_SET_PROGRESS_BAR_POS */
+ if (flags & TDF_SHOW_MARQUEE_PROGRESS_BAR)
+ {
+ ret = SendMessageW(hwnd, TDM_SET_PROGRESS_BAR_POS, 1, 0);
+ ok(ret == 0, "Expect position:%x got:%lx\n", 0, ret);
+ ret = SendMessageW(hwnd, TDM_SET_PROGRESS_BAR_POS, 2, 0);
+ ok(ret == 0, "Expect position:%x got:%lx\n", 0, ret);
+ }
+ else
+ {
+ ret = SendMessageW(hwnd, TDM_SET_PROGRESS_BAR_POS, 1, 0);
+ ok(ret == 0, "Expect position:%x got:%lx\n", 0, ret);
+ ret = SendMessageW(hwnd, TDM_SET_PROGRESS_BAR_POS, 2, 0);
+ ok(ret == 1, "Expect position:%x got:%lx\n", 1, ret);
+ }
+
+ SendMessageW(hwnd, TDM_CLICK_BUTTON, IDOK, 0);
+ }
+
+ return S_OK;
+}
+
+static void test_progress_bar(void)
+{
+ TASKDIALOGCONFIG info = {0};
+
+ info.cbSize = sizeof(TASKDIALOGCONFIG);
+ info.dwFlags = TDF_SHOW_PROGRESS_BAR;
+ info.pfCallback = taskdialog_callback_proc_progress_bar;
+ info.lpCallbackData = (LONG_PTR)info.dwFlags;
+ info.dwCommonButtons = TDCBF_OK_BUTTON;
+ pTaskDialogIndirect(&info, NULL, NULL, NULL);
+
+ info.dwFlags = TDF_SHOW_MARQUEE_PROGRESS_BAR;
+ info.lpCallbackData = (LONG_PTR)info.dwFlags;
+ pTaskDialogIndirect(&info, NULL, NULL, NULL);
+
+ info.dwFlags = TDF_SHOW_PROGRESS_BAR | TDF_SHOW_MARQUEE_PROGRESS_BAR;
+ info.lpCallbackData = (LONG_PTR)info.dwFlags;
+ pTaskDialogIndirect(&info, NULL, NULL, NULL);
+}
+
START_TEST(taskdialog)
{
ULONG_PTR ctx_cookie;
@@ -411,6 +477,7 @@ START_TEST(taskdialog)
test_buttons();
test_help();
test_timer();
+ test_progress_bar();
unload_v6_module(ctx_cookie, hCtx);
}
--
2.17.1
2
1