Wine-Devel
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 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
- 580 discussions
June 17, 2018
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
1
0
June 17, 2018
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
1
0
June 17, 2018
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/comctl32/taskdialog.c | 62 +++++++++++++++++++++++++++++---
dlls/comctl32/tests/taskdialog.c | 61 +++++++++++++++++--------------
2 files changed, 93 insertions(+), 30 deletions(-)
diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
index c3c5fa0420..eb2f2a4082 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -60,6 +60,8 @@ struct taskdialog_info
HWND progress_bar;
HWND *radio_buttons;
INT radio_button_count;
+ HWND *command_links;
+ INT command_link_count;
HWND *buttons;
INT button_count;
HWND default_button;
@@ -184,7 +186,8 @@ static HWND taskdialog_find_button(HWND *buttons, INT count, INT id)
static void taskdialog_enable_button(const struct taskdialog_info *dialog_info, INT id, BOOL enable)
{
- HWND hwnd = taskdialog_find_button(dialog_info->buttons, dialog_info->button_count, id);
+ HWND hwnd = taskdialog_find_button(dialog_info->command_links, dialog_info->command_link_count, id);
+ if (!hwnd) hwnd = taskdialog_find_button(dialog_info->buttons, dialog_info->button_count, id);
if (hwnd) EnableWindow(hwnd, enable);
}
@@ -253,6 +256,11 @@ static BOOL taskdialog_hyperlink_enabled(struct taskdialog_info *dialog_info)
return dialog_info->taskconfig->dwFlags & TDF_ENABLE_HYPERLINKS;
}
+static BOOL taskdialog_use_command_link(struct taskdialog_info *dialog_info)
+{
+ return dialog_info->taskconfig->dwFlags & (TDF_USE_COMMAND_LINKS | TDF_USE_COMMAND_LINKS_NO_ICON);
+}
+
static void taskdialog_get_label_size(struct taskdialog_info *dialog_info, HWND hwnd, LONG max_width, SIZE *size,
BOOL syslink)
{
@@ -468,6 +476,34 @@ static void taskdialog_add_radio_buttons(struct taskdialog_info *dialog_info)
}
}
+static void taskdialog_add_command_links(struct taskdialog_info *dialog_info)
+{
+ const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
+ DWORD default_style = BS_MULTILINE | BS_LEFT | BS_TOP | WS_CHILD | WS_VISIBLE | WS_TABSTOP, style;
+ BOOL is_default;
+ WCHAR *textW;
+ INT i;
+
+ if (!taskconfig->cButtons || !taskconfig->pButtons || !taskdialog_use_command_link(dialog_info)) return;
+
+ dialog_info->command_links = Alloc(taskconfig->cButtons * sizeof(*dialog_info->command_links));
+ if (!dialog_info->command_links) return;
+
+ dialog_info->command_link_count = taskconfig->cButtons;
+ for (i = 0; i < dialog_info->command_link_count; i++)
+ {
+ is_default = taskconfig->pButtons[i].nButtonID == taskconfig->nDefaultButton;
+ style = is_default ? default_style | BS_DEFCOMMANDLINK : default_style | BS_COMMANDLINK;
+ textW = taskdialog_gettext(dialog_info, TRUE, taskconfig->pButtons[i].pszButtonText);
+ dialog_info->command_links[i] = CreateWindowW(WC_BUTTONW, textW, style, 0, 0, 0, 0, dialog_info->hwnd,
+ (HMENU)taskconfig->pButtons[i].nButtonID, 0, NULL);
+ SendMessageW(dialog_info->command_links[i], WM_SETFONT, (WPARAM)dialog_info->font, 0);
+ Free(textW);
+
+ if (is_default && !dialog_info->default_button) dialog_info->default_button = dialog_info->command_links[i];
+ }
+}
+
static void taskdialog_add_button(struct taskdialog_info *dialog_info, HWND *button, INT_PTR id, const WCHAR *text,
BOOL custom_button)
{
@@ -486,17 +522,18 @@ static void taskdialog_add_button(struct taskdialog_info *dialog_info, HWND *but
static void taskdialog_add_buttons(struct taskdialog_info *dialog_info)
{
const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
+ BOOL use_command_links = taskdialog_use_command_link(dialog_info);
DWORD flags = taskconfig->dwCommonButtons;
INT count, max_count;
/* Allocate enough memory for the custom and the default buttons. Maximum 6 default buttons possible. */
max_count = 6;
- if (taskconfig->cButtons && taskconfig->pButtons) max_count += taskconfig->cButtons;
+ if (!use_command_links && taskconfig->cButtons && taskconfig->pButtons) max_count += taskconfig->cButtons;
dialog_info->buttons = Alloc(max_count * sizeof(*dialog_info->buttons));
if (!dialog_info->buttons) return;
- for (count = 0; count < taskconfig->cButtons; count++)
+ for (count = 0; !use_command_links && count < taskconfig->cButtons; count++)
taskdialog_add_button(dialog_info, &dialog_info->buttons[count], taskconfig->pButtons[count].nButtonID,
taskconfig->pButtons[count].pszButtonText, TRUE);
@@ -514,7 +551,7 @@ static void taskdialog_add_buttons(struct taskdialog_info *dialog_info)
if (flags & TDCBF_CANCEL_BUTTON) TASKDIALOG_INIT_COMMON_BUTTON(CANCEL);
if (flags & TDCBF_CLOSE_BUTTON) TASKDIALOG_INIT_COMMON_BUTTON(CLOSE);
- if (!count) TASKDIALOG_INIT_COMMON_BUTTON(OK);
+ if (!count && !dialog_info->command_link_count) TASKDIALOG_INIT_COMMON_BUTTON(OK);
#undef TASKDIALOG_INIT_COMMON_BUTTON
dialog_info->button_count = count;
@@ -603,6 +640,19 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info)
dialog_height = y + size.cy;
}
+ /* Command links */
+ for (i = 0; i < dialog_info->command_link_count; i++)
+ {
+ x = main_icon_right + h_spacing;
+ y = dialog_height + v_spacing;
+ taskdialog_get_label_size(dialog_info, dialog_info->command_links[i], dialog_width - x - h_spacing, &size, FALSE);
+ size.cx = dialog_width - x - h_spacing;
+ /* Add spacing */
+ size.cy += 4;
+ SetWindowPos(dialog_info->command_links[i], 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 */
@@ -738,9 +788,12 @@ static void taskdialog_init(struct taskdialog_info *dialog_info, HWND hwnd)
taskdialog_add_content(dialog_info);
taskdialog_add_progress_bar(dialog_info);
taskdialog_add_radio_buttons(dialog_info);
+ taskdialog_add_command_links(dialog_info);
taskdialog_add_buttons(dialog_info);
/* Set default button */
+ if (!dialog_info->default_button && dialog_info->command_links)
+ dialog_info->default_button = dialog_info->command_links[0];
if (!dialog_info->default_button) dialog_info->default_button = dialog_info->buttons[0];
SendMessageW(dialog_info->hwnd, WM_NEXTDLGCTL, (WPARAM)dialog_info->default_button, TRUE);
id = GetWindowLongW(dialog_info->default_button, GWLP_ID);
@@ -756,6 +809,7 @@ static void taskdialog_destroy(struct taskdialog_info *dialog_info)
if (dialog_info->main_instruction_font) DeleteObject(dialog_info->main_instruction_font);
if (dialog_info->buttons) Free(dialog_info->buttons);
if (dialog_info->radio_buttons) Free(dialog_info->radio_buttons);
+ if (dialog_info->command_links) Free(dialog_info->command_links);
}
static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/dlls/comctl32/tests/taskdialog.c b/dlls/comctl32/tests/taskdialog.c
index 2cda04081f..33d3757308 100644
--- a/dlls/comctl32/tests/taskdialog.c
+++ b/dlls/comctl32/tests/taskdialog.c
@@ -323,7 +323,7 @@ static void test_callback(void)
static void test_buttons(void)
{
TASKDIALOGCONFIG info = {0};
-
+ static const DWORD command_link_flags[] = {0, TDF_USE_COMMAND_LINKS, TDF_USE_COMMAND_LINKS_NO_ICON};
TASKDIALOG_BUTTON custom_buttons[TEST_NUM_BUTTONS], radio_buttons[TEST_NUM_RADIO_BUTTONS];
const WCHAR button_format[] = {'%','0','2','d',0};
/* Each button has two digits as title, plus null-terminator */
@@ -373,31 +373,40 @@ static void test_buttons(void)
info.dwCommonButtons = TDCBF_CANCEL_BUTTON | TDCBF_CLOSE_BUTTON;
run_test(&info, IDCANCEL, 0, msg_return_press_cancel, "default button: unset default");
- /* Test with all common and custom buttons and invalid default ID */
- info.nDefaultButton = 0xff; /* Random ID, should also default to first created button */
- info.cButtons = TEST_NUM_BUTTONS;
- info.pButtons = custom_buttons;
- run_test(&info, ID_START_BUTTON, 0, msg_return_press_custom1, "default button: invalid default, with common buttons - 1");
-
- info.nDefaultButton = -1; /* Should work despite button ID -1 */
- run_test(&info, -1, 0, msg_return_press_custom10, "default button: invalid default, with common buttons - 2");
-
- info.nDefaultButton = -2; /* Should also default to first created button */
- run_test(&info, ID_START_BUTTON, 0, msg_return_press_custom1, "default button: invalid default, with common buttons - 3");
-
- /* Test with only custom buttons and invalid default ID */
- info.dwCommonButtons = 0;
- run_test(&info, ID_START_BUTTON, 0, msg_return_press_custom1, "default button: invalid default, no common buttons");
-
- /* Test with common and custom buttons and valid default ID */
- info.dwCommonButtons = TDCBF_OK_BUTTON | TDCBF_YES_BUTTON | TDCBF_NO_BUTTON
- | TDCBF_CANCEL_BUTTON | TDCBF_RETRY_BUTTON | TDCBF_CLOSE_BUTTON;
- info.nDefaultButton = IDRETRY;
- run_test(&info, IDRETRY, 0, msg_return_press_retry, "default button: valid default - 1");
-
- /* Test with common and custom buttons and valid default ID */
- info.nDefaultButton = ID_START_BUTTON + 3;
- run_test(&info, ID_START_BUTTON + 3, 0, msg_return_press_custom4, "default button: valid default - 2");
+ /* Custom buttons could be command links */
+ for (i = 0; i < ARRAY_SIZE(command_link_flags); i++)
+ {
+ info.dwFlags = command_link_flags[i];
+
+ /* Test with all common and custom buttons and invalid default ID */
+ info.nDefaultButton = 0xff; /* Random ID, should also default to first created button */
+ info.cButtons = TEST_NUM_BUTTONS;
+ info.pButtons = custom_buttons;
+ run_test(&info, ID_START_BUTTON, 0, msg_return_press_custom1,
+ "default button: invalid default, with common buttons - 1");
+
+ info.nDefaultButton = -1; /* Should work despite button ID -1 */
+ run_test(&info, -1, 0, msg_return_press_custom10, "default button: invalid default, with common buttons - 2");
+
+ info.nDefaultButton = -2; /* Should also default to first created button */
+ run_test(&info, ID_START_BUTTON, 0, msg_return_press_custom1,
+ "default button: invalid default, with common buttons - 3");
+
+ /* Test with only custom buttons and invalid default ID */
+ info.dwCommonButtons = 0;
+ run_test(&info, ID_START_BUTTON, 0, msg_return_press_custom1,
+ "default button: invalid default, no common buttons");
+
+ /* Test with common and custom buttons and valid default ID */
+ info.dwCommonButtons = TDCBF_OK_BUTTON | TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON
+ | TDCBF_RETRY_BUTTON | TDCBF_CLOSE_BUTTON;
+ info.nDefaultButton = IDRETRY;
+ run_test(&info, IDRETRY, 0, msg_return_press_retry, "default button: valid default - 1");
+
+ /* Test with common and custom buttons and valid default ID */
+ info.nDefaultButton = ID_START_BUTTON + 3;
+ run_test(&info, ID_START_BUTTON + 3, 0, msg_return_press_custom4, "default button: valid default - 2");
+ }
/* Test radio buttons */
info.nDefaultButton = 0;
--
2.17.1
1
0
Signed-off-by: Hua meng <161220092(a)smail.nju.edu.cn>
---
dlls/msvcp120/tests/msvcp120.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index 895ab36..aec66fb 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -402,6 +402,8 @@ static void (__thiscall *p_vector_base_v4__Internal_copy)(
static void (__thiscall *p_vector_base_v4__Internal_assign)(
vector_base_v4*, vector_base_v4*, size_t, void (__cdecl*)(void*, size_t),
void (__cdecl*)(void*, const void*, size_t), void (__cdecl*)(void*, const void*, size_t));
+static void (__thiscall *p_vector_base_v4__Internal_swap)(
+ vector_base_v4*, const vector_base_v4*);
static HMODULE msvcp;
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y)
@@ -548,6 +550,8 @@ static BOOL init(void)
"?_Internal_copy(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAAXAEBV123(a)_KP6AXPEAXPEBX1@Z(a)Z");
SET(p_vector_base_v4__Internal_assign,
"?_Internal_assign(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAAXAEBV123(a)_KP6AXPEAX1@ZP6AX2PEBX1(a)Z5@Z");
+ SET(p_vector_base_v4__Internal_swap,
+ "?_Internal_swap(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAAXAEAV123@@Z");
} else {
SET(p_tr2_sys__File_size,
"?_File_size(a)sys@tr2(a)std@@YA_KPBD(a)Z");
@@ -663,6 +667,8 @@ static BOOL init(void)
"?_Internal_copy(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEXABV123(a)IP6AXPAXPBXI@Z(a)Z");
SET(p_vector_base_v4__Internal_assign,
"?_Internal_assign(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEXABV123(a)IP6AXPAXI@ZP6AX1PBXI(a)Z4@Z");
+ SET(p_vector_base_v4__Internal_swap,
+ "?_Internal_swap(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEXAAV123@@Z");
#else
SET(p__Thrd_current,
"_Thrd_current");
@@ -706,6 +712,8 @@ static BOOL init(void)
"?_Internal_copy(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAXABV123(a)IP6AXPAXPBXI@Z(a)Z");
SET(p_vector_base_v4__Internal_assign,
"?_Internal_assign(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAXABV123(a)IP6AXPAXI@ZP6AX1PBXI(a)Z4@Z");
+ SET(p_vector_base_v4__Internal_swap,
+ "?_Internal_swap(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAXAAV123@@Z");
#endif
}
SET(p__Thrd_equal,
@@ -2851,6 +2859,39 @@ static void test_vector_base_v4(void)
CHECK_CALLED(concurrent_vector_int_destroy);
concurrent_vector_int_dtor(&v2);
+ concurrent_vector_int_ctor(&v2);
+ SET_EXPECT(concurrent_vector_int_alloc);
+ data = call_func3(p_vector_base_v4__Internal_push_back, &v2, sizeof(int), &idx);
+ ok(data != NULL, "_Internal_push_back returned NULL\n");
+ data = call_func3(p_vector_base_v4__Internal_push_back, &v2, sizeof(int), &idx);
+ ok(data != NULL, "_Internal_push_back returned NULL\n");
+ CHECK_CALLED(concurrent_vector_int_alloc);
+ SET_EXPECT(concurrent_vector_int_alloc);
+ data = call_func3(p_vector_base_v4__Internal_push_back, &v2, sizeof(int), &idx);
+ ok(data != NULL, "_Internal_push_back returned NULL\n");
+ CHECK_CALLED(concurrent_vector_int_alloc);
+ vector_elem_count += 3;
+ ok(idx == 2, "idx got %ld expected 2\n", (long)idx);
+ call_func2(p_vector_base_v4__Internal_swap,
+ &v2, &vector);
+ ok(v2.first_block == 1, "v2.first_block got %ld expected 1\n",
+ (long)v2.first_block);
+ ok(v2.early_size == 5, "v2.early_size got %ld expected 5\n",
+ (long)v2.early_size);
+ ok(vector.early_size == 3, "vector.early_size got %ld expected 3\n",
+ (long)vector.early_size);
+ call_func2(p_vector_base_v4__Internal_swap,
+ &v2, &vector);
+ ok(v2.early_size == 3, "v2.early_size got %ld expected 3\n",
+ (long)v2.early_size);
+ ok(vector.early_size == 5, "vector.early_size got %ld expected 5\n",
+ (long)vector.early_size);
+ SET_EXPECT(concurrent_vector_int_destroy);
+ size = (size_t)call_func2(p_vector_base_v4__Internal_clear,
+ &v2, concurrent_vector_int_destroy);
+ CHECK_CALLED(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);
--
2.11.0
1
0
June 16, 2018
Signed-off-by: Hua meng <161220092(a)smail.nju.edu.cn>
---
dlls/msvcp120/tests/msvcp120.c | 56 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index c34bd65..895ab36 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -40,6 +40,7 @@ struct expect_struct {
DEFINE_EXPECT(concurrent_vector_int_alloc);
DEFINE_EXPECT(concurrent_vector_int_destroy);
DEFINE_EXPECT(concurrent_vector_int_copy);
+ DEFINE_EXPECT(concurrent_vector_int_assign);
};
#define SET_EXPECT(func) \
@@ -114,6 +115,8 @@ static void * (WINAPI *call_thiscall_func3)( void *func, void *this, const void
const void *b );
static void * (WINAPI *call_thiscall_func4)( void *func, void *this, const void *a,
const void *b, const void *c );
+static void * (WINAPI *call_thiscall_func6)( void *func, void *this, const void *a,
+ const void *b, const void *c, const void *d, const void *e );
static void init_thiscall_thunk(void)
{
@@ -128,6 +131,7 @@ static void init_thiscall_thunk(void)
call_thiscall_func2 = (void *)thunk;
call_thiscall_func3 = (void *)thunk;
call_thiscall_func4 = (void *)thunk;
+ call_thiscall_func6 = (void *)thunk;
}
#define call_func1(func,_this) call_thiscall_func1(func,_this)
@@ -136,6 +140,8 @@ static void init_thiscall_thunk(void)
(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))
+#define call_func6(func,_this,a,b,c,d,e) call_thiscall_func6(func,_this,(const void*)(a),\
+ (const void*)(b),(const void*)(c),(const void*)(d),(const void*)(e))
#else
#define init_thiscall_thunk()
@@ -143,6 +149,7 @@ static void init_thiscall_thunk(void)
#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)
+#define call_func6(func,_this,a,b,c,d,e) func(_this,a,b,c,d,e)
#endif /* __i386__ */
static inline float __port_infinity(void)
@@ -392,6 +399,9 @@ 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 void (__thiscall *p_vector_base_v4__Internal_assign)(
+ vector_base_v4*, vector_base_v4*, size_t, void (__cdecl*)(void*, size_t),
+ void (__cdecl*)(void*, const void*, size_t), void (__cdecl*)(void*, const void*, size_t));
static HMODULE msvcp;
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y)
@@ -536,6 +546,8 @@ static BOOL init(void)
"?_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");
+ SET(p_vector_base_v4__Internal_assign,
+ "?_Internal_assign(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAAXAEBV123(a)_KP6AXPEAX1@ZP6AX2PEBX1(a)Z5@Z");
} else {
SET(p_tr2_sys__File_size,
"?_File_size(a)sys@tr2(a)std@@YA_KPBD(a)Z");
@@ -649,6 +661,8 @@ static BOOL init(void)
"?_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");
+ SET(p_vector_base_v4__Internal_assign,
+ "?_Internal_assign(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEXABV123(a)IP6AXPAXI@ZP6AX1PBXI(a)Z4@Z");
#else
SET(p__Thrd_current,
"_Thrd_current");
@@ -690,6 +704,8 @@ static BOOL init(void)
"?_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");
+ SET(p_vector_base_v4__Internal_assign,
+ "?_Internal_assign(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAXABV123(a)IP6AXPAXI@ZP6AX1PBXI(a)Z4@Z");
#endif
}
SET(p__Thrd_equal,
@@ -2509,6 +2525,12 @@ static void __cdecl concurrent_vector_int_copy(void *dst, const void *src, size_
memcpy(dst, src, n*sizeof(int));
}
+static void __cdecl concurrent_vector_int_assign(void *dst, const void *src, size_t n)
+{
+ CHECK_EXPECT2(concurrent_vector_int_assign);
+ memcpy(dst, src, n*sizeof(int));
+}
+
static void test_queue_base_v4(void)
{
queue_base_v4 queue;
@@ -2793,6 +2815,40 @@ static void test_vector_base_v4(void)
SET_EXPECT(concurrent_vector_int_destroy);
size = (size_t)call_func2(p_vector_base_v4__Internal_clear,
&v2, concurrent_vector_int_destroy);
+ CHECK_CALLED(concurrent_vector_int_destroy);
+ concurrent_vector_int_dtor(&v2);
+
+ concurrent_vector_int_ctor(&v2);
+ SET_EXPECT(concurrent_vector_int_alloc);
+ data = call_func3(p_vector_base_v4__Internal_push_back, &v2, sizeof(int), &idx);
+ CHECK_CALLED(concurrent_vector_int_alloc);
+ ok(data != NULL, "_Internal_push_back returned NULL\n");
+ data = call_func3(p_vector_base_v4__Internal_push_back, &v2, sizeof(int), &idx);
+ ok(data != NULL, "_Internal_push_back returned NULL\n");
+ SET_EXPECT(concurrent_vector_int_alloc);
+ data = call_func3(p_vector_base_v4__Internal_push_back, &v2, sizeof(int), &idx);
+ ok(data != NULL, "_Internal_push_back returned NULL\n");
+ CHECK_CALLED(concurrent_vector_int_alloc);
+ vector_elem_count += 3;
+ ok(idx == 2, "idx got %ld expected 2\n", (long)idx);
+ SET_EXPECT(concurrent_vector_int_assign);
+ SET_EXPECT(concurrent_vector_int_copy);
+ SET_EXPECT(concurrent_vector_int_alloc);
+ call_func6(p_vector_base_v4__Internal_assign, &v2, &vector, sizeof(int),
+ concurrent_vector_int_destroy, concurrent_vector_int_assign,
+ concurrent_vector_int_copy);
+ CHECK_CALLED(concurrent_vector_int_assign);
+ CHECK_CALLED(concurrent_vector_int_copy);
+ CHECK_CALLED(concurrent_vector_int_alloc);
+ ok(v2.first_block == 1, "v2.first_block got %ld expected 1\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);
+ CHECK_CALLED(concurrent_vector_int_destroy);
concurrent_vector_int_dtor(&v2);
SET_EXPECT(concurrent_vector_int_destroy);
--
2.11.0
1
0
[PATCH 1/2] hnetcfg/tests: Fix BSTR usage in test_NetFwAuthorizedApplication().
by Zebediah Figura June 16, 2018
by Zebediah Figura June 16, 2018
June 16, 2018
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/hnetcfg/tests/policy.c | 52 ++++++++++++++++++++-------------------------
1 file changed, 23 insertions(+), 29 deletions(-)
diff --git a/dlls/hnetcfg/tests/policy.c b/dlls/hnetcfg/tests/policy.c
index 4ee19d8..012bbcd 100644
--- a/dlls/hnetcfg/tests/policy.c
+++ b/dlls/hnetcfg/tests/policy.c
@@ -105,48 +105,42 @@ static void test_interfaces(void)
static void test_NetFwAuthorizedApplication(void)
{
INetFwAuthorizedApplication *app;
+ static WCHAR empty[] = {0};
+ WCHAR image[MAX_PATH];
HRESULT hr;
+ BSTR bstr;
hr = CoCreateInstance(&CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_INetFwAuthorizedApplication, (void**)&app);
ok(hr == S_OK, "got: %08x\n", hr);
- if(hr == S_OK)
- {
- BSTR image = SysAllocStringLen( NULL, MAX_PATH );
- static WCHAR empty[] = {0};
- BSTR bstr;
- if (!GetModuleFileNameW( NULL, image, MAX_PATH ))
- {
- ok(0, "Failed to get filename\n");
- SysFreeString( image );
- return;
- }
+ hr = GetModuleFileNameW(NULL, image, sizeof(image));
+ ok(hr, "GetModuleFileName failed: %u\n", GetLastError());
- hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, NULL);
- ok(hr == E_POINTER, "got: %08x\n", hr);
+ hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, NULL);
+ ok(hr == E_POINTER, "got: %08x\n", hr);
- hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
- ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY), "got: %08x\n", hr);
- ok(!bstr, "got: %s\n", wine_dbgstr_w(bstr));
+ hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
+ ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY), "got: %08x\n", hr);
+ ok(!bstr, "got: %s\n", wine_dbgstr_w(bstr));
- hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, NULL);
- ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "got: %08x\n", hr);
+ hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, NULL);
+ ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "got: %08x\n", hr);
- hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, empty);
- ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "got: %08x\n", hr);
+ hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, empty);
+ ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "got: %08x\n", hr);
- hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, image);
- ok(hr == S_OK, "got: %08x\n", hr);
+ bstr = SysAllocString(image);
+ hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, bstr);
+ ok(hr == S_OK, "got: %08x\n", hr);
+ SysFreeString(bstr);
- hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
- ok(hr == S_OK, "got: %08x\n", hr);
- ok(!lstrcmpiW(bstr,image), "got: %s\n", wine_dbgstr_w(bstr));
- SysFreeString( bstr );
+ hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
+ ok(hr == S_OK, "got: %08x\n", hr);
+ ok(!lstrcmpiW(bstr,image), "got: %s\n", wine_dbgstr_w(bstr));
+ SysFreeString(bstr);
- SysFreeString( image );
- INetFwAuthorizedApplication_Release(app);
- }
+ INetFwAuthorizedApplication_Release(app);
}
START_TEST(policy)
--
2.7.4
1
1
[PATCH v5 1/8] include: Add SYSTEM_FIRMWARE_TABLE_INFORMATION to winternl.h
by Alex Henrie June 16, 2018
by Alex Henrie June 16, 2018
June 16, 2018
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
include/winternl.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/include/winternl.h b/include/winternl.h
index 58c475dfff..6e0bd987b6 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -1579,6 +1579,23 @@ typedef struct _SYSTEM_TIME_ADJUSTMENT {
BOOLEAN TimeAdjustmentDisabled;
} SYSTEM_TIME_ADJUSTMENT, *PSYSTEM_TIME_ADJUSTMENT;
+typedef enum _SYSTEM_FIRMWARE_TABLE_ACTION
+{
+ SystemFirmwareTable_Enumerate = 0,
+ SystemFirmwareTable_Get = 1
+} SYSTEM_FIRMWARE_TABLE_ACTION, *PSYSTEM_FIRMWARE_TABLE_ACTION;
+
+/* System Information Class 0x4C */
+
+typedef struct _SYSTEM_FIRMWARE_TABLE_INFORMATION
+{
+ ULONG ProviderSignature;
+ SYSTEM_FIRMWARE_TABLE_ACTION Action;
+ ULONG TableID;
+ ULONG TableBufferLength;
+ UCHAR TableBuffer[1];
+} SYSTEM_FIRMWARE_TABLE_INFORMATION, *PSYSTEM_FIRMWARE_TABLE_INFORMATION;
+
typedef struct _TIME_FIELDS
{ CSHORT Year;
CSHORT Month;
--
2.17.1
3
15
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
June 15, 2018
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