Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- 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
- 1149 messages
Re: Bug #45385 related to keyboard and probably wineserver - where to start the search
by John Found
On Thu, 28 Jun 2018 14:04:31 +0200
Kai Krakow <kai(a)kaishome.de> wrote:
>
> But this should answer the OPs question why it is done in this way.
>
Well, for me the code is still entangled, and not very legible.
Nevertheless I understood how it works and it seems to be correct.
Thank you and all thread contributors above. :)
Regards.
P.S. Actually I found another possible reason for the researched bug, but will ask about it in another post below.
--
John Found <johnfound(a)asm32.info>
June 28, 2018
[PATCH] user32/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/user32/tests/class.c | 16 ++++++-------
dlls/user32/tests/clipboard.c | 4 ++--
dlls/user32/tests/combo.c | 4 ++--
dlls/user32/tests/cursoricon.c | 2 +-
dlls/user32/tests/dde.c | 12 +++++-----
dlls/user32/tests/dialog.c | 8 +++----
dlls/user32/tests/edit.c | 6 ++---
dlls/user32/tests/input.c | 13 +++++------
dlls/user32/tests/listbox.c | 2 +-
dlls/user32/tests/menu.c | 19 ++++++++-------
dlls/user32/tests/monitor.c | 6 ++---
dlls/user32/tests/msg.c | 26 ++++++++++-----------
dlls/user32/tests/resource.c | 4 ++--
dlls/user32/tests/scroll.c | 2 +-
dlls/user32/tests/sysparams.c | 50 ++++++++++++++++++++--------------------
dlls/user32/tests/text.c | 8 +++----
dlls/user32/tests/uitools.c | 2 +-
dlls/user32/tests/win.c | 52 +++++++++++++++++++++---------------------
dlls/user32/tests/wsprintf.c | 8 +++----
19 files changed, 121 insertions(+), 123 deletions(-)
diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c
index 9b3b2b30f3..53fa2f12e3 100644
--- a/dlls/user32/tests/class.c
+++ b/dlls/user32/tests/class.c
@@ -169,7 +169,7 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
}
/* check GetClassName */
- i = GetClassNameW(hTestWnd, str, sizeof(str)/sizeof(str[0]));
+ i = GetClassNameW(hTestWnd, str, ARRAY_SIZE(str));
ok(i == lstrlenW(className),
"GetClassName returned incorrect length\n");
ok(!lstrcmpW(className,str),
@@ -725,7 +725,7 @@ static void test_builtinproc(void)
ok(IsWindowUnicode(hwnd) ||
broken(!IsWindowUnicode(hwnd)) /* Windows 8 and 10 */,
"Windows should be Unicode\n");
- SendMessageW(hwnd, WM_GETTEXT, sizeof(buf) / sizeof(buf[0]), (LPARAM)buf);
+ SendMessageW(hwnd, WM_GETTEXT, ARRAY_SIZE(buf), (LPARAM)buf);
if (IsWindowUnicode(hwnd))
ok(memcmp(buf, unistring, sizeof(unistring)) == 0, "WM_GETTEXT invalid return\n");
else
@@ -939,7 +939,7 @@ static const struct
static void test_extra_values(void)
{
int i;
- for(i=0; i< sizeof(extra_values)/sizeof(extra_values[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(extra_values); i++)
{
WNDCLASSEXA wcx;
BOOL ret = GetClassInfoExA(NULL,extra_values[i].name,&wcx);
@@ -1133,7 +1133,7 @@ static void test_comctl32_class( const char *name )
name++;
- GetTempPathA(sizeof(path)/sizeof(path[0]), path);
+ GetTempPathA(ARRAY_SIZE(path), path);
strcat(path, "comctl32_class.manifest");
create_manifest_file(path, comctl32_manifest);
@@ -1161,7 +1161,7 @@ static void test_comctl32_class( const char *name )
if (!ret)
goto skiptest;
- MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, sizeof(nameW)/sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, ARRAY_SIZE(nameW));
ret = GetClassInfoW( 0, nameW, &wcW );
ok( ret, "GetClassInfoW failed for %s\n", name );
module = GetModuleHandleA( "comctl32" );
@@ -1187,7 +1187,7 @@ static void test_comctl32_class( const char *name )
ret = GetClassInfoA( 0, name, &wcA );
ok( ret || broken(!ret) /* <= winxp */, "GetClassInfoA failed for %s\n", name );
if (!ret) return;
- MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, sizeof(nameW)/sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, ARRAY_SIZE(nameW));
ret = GetClassInfoW( 0, nameW, &wcW );
ok( ret, "GetClassInfoW failed for %s\n", name );
module = GetModuleHandleA( "comctl32" );
@@ -1243,7 +1243,7 @@ static void test_comctl32_classes(void)
};
winetest_get_mainargs( &argv );
- for (i = 0; i < sizeof(classes) / sizeof(classes[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(classes); i++)
{
memset( &startup, 0, sizeof(startup) );
startup.cb = sizeof( startup );
@@ -1322,7 +1322,7 @@ static void test_actctx_classes(void)
HWND hwnd;
char path[MAX_PATH];
- GetTempPathA(sizeof(path)/sizeof(path[0]), path);
+ GetTempPathA(ARRAY_SIZE(path), path);
strcat(path, "actctx_classes.manifest");
create_manifest_file(path, main_manifest);
diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c
index 3d3ef8b4c1..4436ece70d 100644
--- a/dlls/user32/tests/clipboard.c
+++ b/dlls/user32/tests/clipboard.c
@@ -711,7 +711,7 @@ static void test_synthesized(void)
r = CloseClipboard();
ok(r, "gle %d\n", GetLastError());
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
r = OpenClipboard(NULL);
ok(r, "%u: gle %d\n", i, GetLastError());
@@ -2044,7 +2044,7 @@ static void test_string_data(void)
char bufferA[12];
WCHAR bufferW[12];
- for (i = 0; i < sizeof(test_data) / sizeof(test_data[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(test_data); i++)
{
/* 1-byte Unicode strings crash on Win64 */
#ifdef _WIN64
diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c
index ad706ea754..3358e846a0 100644
--- a/dlls/user32/tests/combo.c
+++ b/dlls/user32/tests/combo.c
@@ -291,7 +291,7 @@ static void test_WM_LBUTTONDOWN(void)
hCombo = CreateWindowA("ComboBox", "Combo", WS_VISIBLE|WS_CHILD|CBS_DROPDOWN,
0, 0, 200, 150, hMainWnd, (HMENU)COMBO_ID, NULL, 0);
- for (i = 0; i < sizeof(choices)/sizeof(UINT); i++){
+ for (i = 0; i < ARRAY_SIZE(choices); i++){
sprintf(buffer, stringFormat, choices[i]);
result = SendMessageA(hCombo, CB_ADDSTRING, 0, (LPARAM)buffer);
ok(result == i,
@@ -709,7 +709,7 @@ static void test_listbox_size(DWORD style)
{10, 100, TRUE},
};
- for(test = 0; test < sizeof(info_height) / sizeof(info_height[0]); test++)
+ for(test = 0; test < ARRAY_SIZE(info_height); test++)
{
const struct list_size_info *info_test = &info_height[test];
int height_item; /* Height of a list item */
diff --git a/dlls/user32/tests/cursoricon.c b/dlls/user32/tests/cursoricon.c
index 3d56815848..8404ee71ab 100644
--- a/dlls/user32/tests/cursoricon.c
+++ b/dlls/user32/tests/cursoricon.c
@@ -2533,7 +2533,7 @@ static void test_PrivateExtractIcons(void)
static const test_icon_entries_t icon_desc[] = {{0,0,TRUE}, {16,16,TRUE}, {32,32}, {64,64,TRUE}};
- create_ico_file("extract.ico", icon_desc, sizeof(icon_desc)/sizeof(*icon_desc));
+ create_ico_file("extract.ico", icon_desc, ARRAY_SIZE(icon_desc));
ret = PrivateExtractIconsA("extract.ico", 0, 32, 32, &icon, NULL, 1, 0);
ok(ret == 1, "PrivateExtractIconsA returned %u\n", ret);
diff --git a/dlls/user32/tests/dde.c b/dlls/user32/tests/dde.c
index d63a0f65aa..eed2ac437e 100644
--- a/dlls/user32/tests/dde.c
+++ b/dlls/user32/tests/dde.c
@@ -2396,7 +2396,7 @@ static WCHAR test_cmd_w_to_w[][32] = {
{ 0x4efa, 0x4efc, 0x0061, 0x4efe, 0 }, /* some Chinese chars */
{ 0x0061, 0x0062, 0x0063, 0x9152, 0 }, /* Chinese with latin characters begin */
};
-static const int nb_callbacks = 5 + sizeof(test_cmd_w_to_w)/sizeof(test_cmd_w_to_w[0]);
+static const int nb_callbacks = 5 + ARRAY_SIZE(test_cmd_w_to_w);
static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV hconv,
HSZ hsz1, HSZ hsz2, HDDEDATA hdata,
@@ -2480,7 +2480,7 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
size_a = strlen(test_cmd_a_to_a) + 1;
size_w = (lstrlenW(cmd_w) + 1) * sizeof(WCHAR);
size_a_to_w = MultiByteToWideChar( CP_ACP, 0, test_cmd_a_to_a, -1, test_cmd_a_to_w,
- sizeof(test_cmd_a_to_w)/sizeof(WCHAR) ) * sizeof(WCHAR);
+ ARRAY_SIZE(test_cmd_a_to_w)) * sizeof(WCHAR);
size_w_to_a = WideCharToMultiByte( CP_ACP, 0, cmd_w, -1,
test_cmd_w_to_a, sizeof(test_cmd_w_to_a), NULL, NULL );
switch (str_index)
@@ -2528,7 +2528,7 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
/* double A->W mapping */
/* NT uses the full size, XP+ only until the first null */
DWORD nt_size = MultiByteToWideChar( CP_ACP, 0, (char *)cmd_w, size_w, test_cmd_a_to_w,
- sizeof(test_cmd_a_to_w)/sizeof(WCHAR) ) * sizeof(WCHAR);
+ ARRAY_SIZE(test_cmd_a_to_w)) * sizeof(WCHAR);
DWORD xp_size = MultiByteToWideChar( CP_ACP, 0, (char *)cmd_w, -1, NULL, 0 ) * sizeof(WCHAR);
ok(size == xp_size || broken(size == nt_size) ||
broken(str_index == 4 && IsDBCSLeadByte(cmd_w[0])) /* East Asian */,
@@ -2554,7 +2554,7 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
{
todo_wine ok(size == size_w, "Wrong size %d expected %d, msg_index=%d\n", size, size_w, msg_index);
MultiByteToWideChar(CP_ACP, 0, test_cmd_w_to_a, size_w, test_cmd_a_to_w,
- sizeof(test_cmd_a_to_w)/sizeof(WCHAR));
+ ARRAY_SIZE(test_cmd_a_to_w));
todo_wine ok(!lstrcmpW((WCHAR*)buffer, cmd_w),
"Expected %s got %s, msg_index=%d\n", wine_dbgstr_w(cmd_w), wine_dbgstr_w((WCHAR *)buffer), msg_index);
}
@@ -2562,7 +2562,7 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
{
todo_wine ok(size == size_w, "Wrong size %d expected %d, msg_index=%d\n", size, size_w, msg_index);
MultiByteToWideChar(CP_ACP, 0, test_cmd_w_to_a, size_w, test_cmd_a_to_w,
- sizeof(test_cmd_a_to_w)/sizeof(WCHAR));
+ ARRAY_SIZE(test_cmd_a_to_w));
if (!is_cjk())
todo_wine ok(!lstrcmpW((WCHAR*)buffer, test_cmd_a_to_w), "Expected %s, got %s, msg_index=%d\n",
wine_dbgstr_w(test_cmd_a_to_w), wine_dbgstr_w((WCHAR*)buffer), msg_index);
@@ -2663,7 +2663,7 @@ static void test_end_to_end_client(BOOL type_a)
err = DdeGetLastError(client_pid);
ok(err == DMLERR_NO_ERROR, "wrong dde error %x\n", err);
- for (i = 0; i < sizeof(test_cmd_w_to_w)/sizeof(test_cmd_w_to_w[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(test_cmd_w_to_w); i++)
{
hdata = DdeClientTransaction((LPBYTE)test_cmd_w_to_w[i],
(lstrlenW(test_cmd_w_to_w[i]) + 1) * sizeof(WCHAR),
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index ab3eec88bc..807a85b4ea 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -161,7 +161,7 @@ static BOOL CreateWindows (HINSTANCE hinst)
*/
if (p->id >= numwnds)
{
- if (p->id >= sizeof(hwnd)/sizeof(hwnd[0]))
+ if (p->id >= ARRAY_SIZE(hwnd))
{
trace ("Control %ld is out of range\n", p->id);
return FALSE;
@@ -1045,7 +1045,7 @@ static void test_GetDlgItemText(void)
BOOL ret;
strcpy(string, "Overwrite Me");
- ret = GetDlgItemTextA(NULL, 0, string, sizeof(string)/sizeof(string[0]));
+ ret = GetDlgItemTextA(NULL, 0, string, ARRAY_SIZE(string));
ok(!ret, "GetDlgItemText(NULL) shouldn't have succeeded\n");
ok(string[0] == '\0' || broken(!strcmp(string, "Overwrite Me")),
@@ -1461,7 +1461,7 @@ static INT_PTR CALLBACK test_aw_conversion_dlgproc(HWND hdlg, UINT msg, WPARAM w
(BYTE)buff[0], (BYTE)buff[1], len);
memset(buffW, 0xff, sizeof(buffW));
- len = GetWindowTextW(hdlg, buffW, sizeof(buffW)/sizeof(buffW[0]));
+ len = GetWindowTextW(hdlg, buffW, ARRAY_SIZE(buffW));
ok(buffW[0] == 'W' && buffW[1] == 0xffff && len == 0, "Unexpected window text %#x, %#x, len %d\n",
buffW[0], buffW[1], len);
@@ -1567,7 +1567,7 @@ static INT_PTR CALLBACK test_aw_conversion_dlgproc2(HWND hdlg, UINT msg, WPARAM
ok(!strcmp(buff, testtext) && len == 0, "Unexpected window text %s, len %d\n", buff, len);
memset(buffW, 0xff, sizeof(buffW));
- len = GetWindowTextW(hdlg, buffW, sizeof(buffW)/sizeof(buffW[0]));
+ len = GetWindowTextW(hdlg, buffW, ARRAY_SIZE(buffW));
ok(buffW[0] == 0 && buffW[1] == 0xffff && len == 0, "Unexpected window text %#x, %#x, len %d\n",
buffW[0], buffW[1], len);
diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c
index 01418bf551..00c05fdef0 100644
--- a/dlls/user32/tests/edit.c
+++ b/dlls/user32/tests/edit.c
@@ -2956,7 +2956,7 @@ static void test_EM_GETLINE(void)
hwnd[0] = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
hwnd[1] = create_editcontrolW(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
- for (i = 0; i < sizeof(hwnd)/sizeof(hwnd[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(hwnd); i++)
{
static const WCHAR strW[] = {'t','e','x','t',0};
static const char *str = "text";
@@ -2984,13 +2984,13 @@ static void test_EM_GETLINE(void)
ok(!strcmp(buff, str), "Unexpected line data %s.\n", buff);
memset(buffW, 0, sizeof(buffW));
- *(WORD *)buffW = sizeof(buffW)/sizeof(buffW[0]);
+ *(WORD *)buffW = ARRAY_SIZE(buffW);
r = SendMessageW(hwnd[i], EM_GETLINE, 0, (LPARAM)buffW);
ok(r == lstrlenW(strW), "Failed to get a line %d.\n", r);
ok(!lstrcmpW(buffW, strW), "Unexpected line data %s.\n", wine_dbgstr_w(buffW));
memset(buffW, 0, sizeof(buffW));
- *(WORD *)buffW = sizeof(buffW)/sizeof(buffW[0]);
+ *(WORD *)buffW = ARRAY_SIZE(buffW);
r = SendMessageW(hwnd[i], EM_GETLINE, 1, (LPARAM)buffW);
ok(r == lstrlenW(strW), "Failed to get a line %d.\n", r);
ok(!lstrcmpW(buffW, strW), "Unexpected line data %s.\n", wine_dbgstr_w(buffW));
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 8fa1de23e1..03b84007b1 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -943,8 +943,7 @@ static void test_Input_blackbox(void)
i.u.ki.time = 0;
i.u.ki.dwExtraInfo = 0;
- for (ii = 0; ii < sizeof(sendinput_test)/sizeof(struct sendinput_test_s)-1;
- ii++) {
+ for (ii = 0; ii < ARRAY_SIZE(sendinput_test)-1; ii++) {
GetKeyboardState(ks1);
i.u.ki.wScan = ii+1 /* useful for debugging */;
i.u.ki.dwFlags = sendinput_test[ii].dwFlags;
@@ -1520,12 +1519,12 @@ static void test_GetRawInputDeviceList(void)
ok(ret > 0, "expected non-zero\n");
/* check if variable changes from larger to smaller value */
- devcount = odevcount = sizeof(devices) / sizeof(devices[0]);
+ devcount = odevcount = ARRAY_SIZE(devices);
oret = ret = pGetRawInputDeviceList(devices, &odevcount, sizeof(devices[0]));
ok(ret > 0, "expected non-zero\n");
ok(devcount == odevcount, "expected %d, got %d\n", devcount, odevcount);
devcount = odevcount;
- odevcount = sizeof(devices) / sizeof(devices[0]);
+ odevcount = ARRAY_SIZE(devices);
ret = pGetRawInputDeviceList(NULL, &odevcount, sizeof(devices[0]));
ok(ret == 0, "expected 0, got %d\n", ret);
ok(odevcount == oret, "expected %d, got %d\n", oret, odevcount);
@@ -1567,7 +1566,7 @@ static void test_key_map(void)
"Scan code -> vKey = %x (not VK_RSHIFT)\n", kR);
/* test that MAPVK_VSC_TO_VK prefers the non-numpad vkey if there's ambiguity */
- for (i = 0; i < sizeof(numpad_collisions)/sizeof(numpad_collisions[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(numpad_collisions); i++)
{
UINT numpad_scan = MapVirtualKeyExA(numpad_collisions[i][0], MAPVK_VK_TO_VSC, kl);
UINT other_scan = MapVirtualKeyExA(numpad_collisions[i][1], MAPVK_VK_TO_VSC, kl);
@@ -1665,7 +1664,7 @@ static void test_ToUnicode(void)
"ToUnicode didn't null-terminate the buffer when there was room.\n");
}
- for (i = 0; i < sizeof(utests) / sizeof(utests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(utests); i++)
{
UINT vk = utests[i].vk, mod = utests[i].modifiers, scan;
@@ -1808,7 +1807,7 @@ static void test_key_names(void)
ok( buffer[0] == 0, "wrong string '%s'\n", buffer );
memset( bufferW, 0xcc, sizeof(bufferW) );
- ret = GetKeyNameTextW( lparam, bufferW, sizeof(bufferW)/sizeof(WCHAR) );
+ ret = GetKeyNameTextW( lparam, bufferW, ARRAY_SIZE(bufferW));
ok( ret > 0, "wrong len %u for %s\n", ret, wine_dbgstr_w(bufferW) );
ok( ret == lstrlenW(bufferW), "wrong len %u for %s\n", ret, wine_dbgstr_w(bufferW) );
diff --git a/dlls/user32/tests/listbox.c b/dlls/user32/tests/listbox.c
index 88d3adb728..c6edc76ea2 100644
--- a/dlls/user32/tests/listbox.c
+++ b/dlls/user32/tests/listbox.c
@@ -51,7 +51,7 @@ static int strcmp_aw(LPCWSTR strw, const char *stra)
WCHAR buf[1024];
if (!stra) return 1;
- MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, sizeof(buf)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, ARRAY_SIZE(buf));
return lstrcmpW(strw, buf);
}
diff --git a/dlls/user32/tests/menu.c b/dlls/user32/tests/menu.c
index 0f6e8618a6..7f338ce9b1 100644
--- a/dlls/user32/tests/menu.c
+++ b/dlls/user32/tests/menu.c
@@ -668,7 +668,7 @@ static void test_menu_ownerdraw(void)
ok( ret, "AppendMenu failed for %d\n", k-1);
}
MOD_maxid = k-1;
- assert( k <= sizeof(MOD_rc)/sizeof(RECT));
+ assert( k <= ARRAY_SIZE(MOD_rc));
/* display the menu */
TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL);
@@ -986,14 +986,14 @@ static void test_menu_bmp_and_string(void)
for( ispop=1; ispop >= 0; ispop--){
static SIZE bmsizes[]= {
{10,10},{38,38},{1,30},{55,5}};
- for( szidx=0; szidx < sizeof( bmsizes) / sizeof( SIZE); szidx++) {
+ for( szidx=0; szidx < ARRAY_SIZE(bmsizes); szidx++) {
HBITMAP hbm = CreateBitmap( bmsizes[szidx].cx, bmsizes[szidx].cy,1,1,bmfill);
HBITMAP bitmaps[] = { HBMMENU_CALLBACK, hbm, HBMMENU_POPUP_CLOSE, NULL };
ok( hbm != 0, "CreateBitmap failed err %d\n", GetLastError());
- for( txtidx = 0; txtidx < sizeof(MOD_txtsizes)/sizeof(MOD_txtsizes[0]); txtidx++) {
+ for( txtidx = 0; txtidx < ARRAY_SIZE(MOD_txtsizes); txtidx++) {
for( hassub = 0; hassub < 2 ; hassub++) { /* add submenu item */
for( mnuopt = 0; mnuopt < 3 ; mnuopt++){ /* test MNS_NOCHECK/MNS_CHECKORBMP */
- for( bmpidx = 0; bmpidx <sizeof(bitmaps)/sizeof(HBITMAP); bmpidx++) {
+ for( bmpidx = 0; bmpidx <ARRAY_SIZE(bitmaps); bmpidx++) {
/* no need to test NULL bitmaps of several sizes */
if( !bitmaps[bmpidx] && szidx > 0) continue;
/* the HBMMENU_POPUP not to test for menu bars */
@@ -2757,9 +2757,8 @@ static void test_menu_resource_layout(void)
ok(ret, "AppendMenu failed\n");
count = GetMenuItemCount(hmenu);
- ok(count == sizeof(menu_data)/sizeof(menu_data[0]),
- "expected %u menu items, got %u\n",
- (UINT)(sizeof(menu_data)/sizeof(menu_data[0])), count);
+ ok(count == ARRAY_SIZE(menu_data), "expected %u menu items, got %u\n",
+ (UINT) ARRAY_SIZE(menu_data), count);
for (i = 0; i < count; i++)
{
@@ -2978,9 +2977,9 @@ static void test_InsertMenu(void)
};
HMENU hmenu;
-#define create_menu(a) create_menu_from_data((a), sizeof(a)/sizeof((a)[0]))
-#define create_menuitem(a) create_menuitem_from_data((a), sizeof(a)/sizeof((a)[0]))
-#define compare_menu(h, a) compare_menu_data((h), (a), sizeof(a)/sizeof((a)[0]))
+#define create_menu(a) create_menu_from_data((a), ARRAY_SIZE(a))
+#define create_menuitem(a) create_menuitem_from_data((a), ARRAY_SIZE(a))
+#define compare_menu(h, a) compare_menu_data((h), (a), ARRAY_SIZE(a))
hmenu = create_menu(in1);
compare_menu(hmenu, out1);
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c
index 4d7b020e14..f4c1a4b17c 100644
--- a/dlls/user32/tests/monitor.c
+++ b/dlls/user32/tests/monitor.c
@@ -398,7 +398,7 @@ static void test_monitors(void)
/* tests for cbSize in MONITORINFO */
monitor = pMonitorFromWindow( 0, MONITOR_DEFAULTTOPRIMARY );
- for (i = 0; i < (sizeof(testdatami) / sizeof(testdatami[0])); i++)
+ for (i = 0; i < ARRAY_SIZE(testdatami); i++)
{
memset( &mi, 0, sizeof(mi) );
mi.cbSize = testdatami[i].cbSize;
@@ -420,7 +420,7 @@ static void test_monitors(void)
}
/* tests for cbSize in MONITORINFOEXA */
- for (i = 0; i < (sizeof(testdatamiexa) / sizeof(testdatamiexa[0])); i++)
+ for (i = 0; i < ARRAY_SIZE(testdatamiexa); i++)
{
memset( &miexa, 0, sizeof(miexa) );
miexa.cbSize = testdatamiexa[i].cbSize;
@@ -433,7 +433,7 @@ static void test_monitors(void)
}
/* tests for cbSize in MONITORINFOEXW */
- for (i = 0; i < (sizeof(testdatamiexw) / sizeof(testdatamiexw[0])); i++)
+ for (i = 0; i < ARRAY_SIZE(testdatamiexw); i++)
{
memset( &miexw, 0, sizeof(miexw) );
miexw.cbSize = testdatamiexw[i].cbSize;
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index a0f2cbeef0..1f2c0dd1f7 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -4966,7 +4966,7 @@ static void test_WM_DEVICECHANGE(HWND hwnd)
DBT_DEVICETYPESPECIFIC,
DBT_CUSTOMEVENT};
- for (i = 0; i < sizeof(wparams)/sizeof(wparams[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(wparams); i++)
{
SetLastError(0xdeadbeef);
ret = PostMessageA(hwnd, WM_DEVICECHANGE, wparams[i], 0);
@@ -6273,7 +6273,7 @@ static void test_button_messages(void)
hfont2 = CreateFontIndirectA(&logfont);
ok(hfont2 != NULL, "Failed to create Tahoma font\n");
- for (i = 0; i < sizeof(button)/sizeof(button[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(button); i++)
{
MSG msg;
DWORD style, state;
@@ -6686,7 +6686,7 @@ static void test_static_messages(void)
subclass_static();
- for (i = 0; i < sizeof(static_ctrl)/sizeof(static_ctrl[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(static_ctrl); i++)
{
hwnd = CreateWindowExA(0, "my_static_class", "test", static_ctrl[i].style | WS_POPUP,
0, 0, 50, 14, 0, 0, 0, NULL);
@@ -9729,13 +9729,13 @@ static void test_timers_no_wnd(void)
win_skip("SetCoalescableTimer not available.\n");
/* Check what happens when we're running out of timers */
- for (i=0; i<sizeof(ids)/sizeof(ids[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(ids); i++)
{
SetLastError(0xdeadbeef);
ids[i] = SetTimer(NULL, 0, USER_TIMER_MAXIMUM, tfunc);
if (!ids[i]) break;
}
- ok(i != sizeof(ids)/sizeof(ids[0]), "all timers were created successfully\n");
+ ok(i != ARRAY_SIZE(ids), "all timers were created successfully\n");
ok(GetLastError()==ERROR_NO_MORE_USER_HANDLES || broken(GetLastError()==0xdeadbeef),
"GetLastError() = %d\n", GetLastError());
while (i > 0) KillTimer(NULL, ids[--i]);
@@ -10113,7 +10113,7 @@ static void test_winevents(void)
ok_sequence(WmEmptySeq, "empty notify winevents", FALSE);
}
- for (i = 0; i < sizeof(WmWinEventsSeq)/sizeof(WmWinEventsSeq[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(WmWinEventsSeq); i++)
pNotifyWinEvent(events[i].message, hwnd, events[i].wParam, events[i].lParam);
ok_sequence(WmWinEventsSeq, "notify winevents", FALSE);
@@ -12797,7 +12797,7 @@ static void test_ShowWindow(void)
ok(EqualRect(&win_rc, &wp.rcNormalPosition), "expected %s got %s\n", wine_dbgstr_rect(&win_rc),
wine_dbgstr_rect(&wp.rcNormalPosition));
- for (i = 0; i < sizeof(sw)/sizeof(sw[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(sw); i++)
{
static const char * const sw_cmd_name[13] =
{
@@ -14660,20 +14660,20 @@ static void test_defwinproc(void)
flush_events();
buffA[0] = 0;
- GetWindowTextA(hwnd, buffA, sizeof(buffA)/sizeof(*buffA));
+ GetWindowTextA(hwnd, buffA, ARRAY_SIZE(buffA));
ok(!strcmp(buffA, "test_defwndproc"), "unexpected window text, %s\n", buffA);
/* Zero high word of the lParam */
res = DefWindowProcA(hwnd, WM_SETTEXT, 0, 0x1234);
ok(res == 0, "WM_SETTEXT was expected to fail, %ld\n", res);
- GetWindowTextA(hwnd, buffA, sizeof(buffA)/sizeof(*buffA));
+ GetWindowTextA(hwnd, buffA, ARRAY_SIZE(buffA));
ok(!strcmp(buffA, "test_defwndproc"), "unexpected window text, %s\n", buffA);
res = DefWindowProcW(hwnd, WM_SETTEXT, 0, 0x1234);
ok(res == 0, "WM_SETTEXT was expected to fail, %ld\n", res);
- GetWindowTextA(hwnd, buffA, sizeof(buffA)/sizeof(*buffA));
+ GetWindowTextA(hwnd, buffA, ARRAY_SIZE(buffA));
ok(!strcmp(buffA, "test_defwndproc"), "unexpected window text, %s\n", buffA);
GetCursorPos(&pos);
@@ -14933,7 +14933,7 @@ static void test_PostMessage(void)
PostMessageA(hwnd, WM_USER+1, 0x1234, 0x5678);
PostMessageA(0, WM_USER+2, 0x5678, 0x1234);
- for (i = 0; i < sizeof(data)/sizeof(data[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(data); i++)
{
memset(&msg, 0xab, sizeof(msg));
ret = PeekMessageA(&msg, data[i].hwnd, 0, 0, PM_NOREMOVE);
@@ -14991,7 +14991,7 @@ static void test_broadcast(void)
oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)broadcast_test_proc);
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
- for (i = 0; i < sizeof(messages)/sizeof(messages[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(messages); i++)
{
BOOL ret;
MSG msg;
@@ -15321,7 +15321,7 @@ static void test_WaitForInputIdle( char *argv0 )
thread = CreateThread( NULL, 0, wait_idle_thread, NULL, 0, &id );
- for (i = 0; i < sizeof(wait_idle_expect)/sizeof(wait_idle_expect[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(wait_idle_expect); i++)
{
ResetEvent( start_event );
ResetEvent( end_event );
diff --git a/dlls/user32/tests/resource.c b/dlls/user32/tests/resource.c
index 2388adb64f..5d4c4e2f96 100644
--- a/dlls/user32/tests/resource.c
+++ b/dlls/user32/tests/resource.c
@@ -50,7 +50,7 @@ static void test_LoadStringW(void)
win_skip( "LoadStringW does not return a pointer to the resource\n" );
return;
}
- length2 = LoadStringW(hInst, 2, returnedstringw, sizeof(returnedstringw) /sizeof(WCHAR)); /* get resource string */
+ length2 = LoadStringW(hInst, 2, returnedstringw, ARRAY_SIZE(returnedstringw)); /* get resource string */
ok(length2 > 0, "LoadStringW failed to load resource 2, ret %d, err %d\n", length2, GetLastError());
ok(length1 == length2, "LoadStringW returned different values dependent on buflen. ret1 %d, ret2 %d\n",
length1, length2);
@@ -93,7 +93,7 @@ static void test_LoadStringA (void)
int ret, ret2;
assert (sizeof str < sizeof buf);
- for (i = 0; i < sizeof tests / sizeof tests[0]; i++) {
+ for (i = 0; i < ARRAY_SIZE(tests); i++) {
const unsigned int bufsiz = tests[i].bufsiz;
const unsigned int expected = tests[i].expected;
const int len = LoadStringA (hInst, 0, buf, bufsiz);
diff --git a/dlls/user32/tests/scroll.c b/dlls/user32/tests/scroll.c
index 0bda5dd0f4..291d11af0f 100644
--- a/dlls/user32/tests/scroll.c
+++ b/dlls/user32/tests/scroll.c
@@ -514,7 +514,7 @@ static void scrollbar_test_init(void)
wc.lpfnWndProc = scroll_init_proc;
RegisterClassExA(&wc);
- for(i = 0; i < sizeof style / sizeof style[0]; i++)
+ for(i = 0; i < ARRAY_SIZE(style); i++)
{
/* need not to destroy these windows due creation abort */
CreateWindowExA(0, cls_name, NULL, style[i],
diff --git a/dlls/user32/tests/sysparams.c b/dlls/user32/tests/sysparams.c
index ce056e9160..3db058f950 100644
--- a/dlls/user32/tests/sysparams.c
+++ b/dlls/user32/tests/sysparams.c
@@ -710,7 +710,7 @@ static void test_SPI_SETMOUSE( void ) /* 4 */
POINT proj_change7[] = { {6, 6}, {14, 6}, {32, 6}, {40, 40}, {44, 40}, {400, 400} };
POINT proj_change8[] = { {6, 6}, {28, 6}, {32, 6}, {40, 40}, {44, 40}, {400, 400} };
- int nchange = sizeof( req_change ) / sizeof( POINT );
+ int nchange = ARRAY_SIZE(req_change);
trace("testing SPI_{GET,SET}MOUSE\n");
SetLastError(0xdeadbeef);
@@ -875,7 +875,7 @@ static void test_SPI_SETKEYBOARDSPEED( void ) /* 10 */
if (!test_error_msg(rc,"SPI_{GET,SET}KEYBOARDSPEED"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
char buf[10];
@@ -964,7 +964,7 @@ static void test_SPI_SETSCREENSAVETIMEOUT( void ) /* 14 */
if (!test_error_msg(rc,"SPI_{GET,SET}SCREENSAVETIMEOUT"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
char buf[10];
@@ -1001,7 +1001,7 @@ static void test_SPI_SETSCREENSAVEACTIVE( void ) /* 17 */
if (!test_error_msg(rc,"SPI_{GET,SET}SCREENSAVEACTIVE"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
@@ -1042,7 +1042,7 @@ static void test_SPI_SETKEYBOARDDELAY( void ) /* 23 */
if (!test_error_msg(rc,"SPI_{GET,SET}KEYBOARDDELAY"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT delay;
char buf[10];
@@ -1143,7 +1143,7 @@ static void test_SPI_SETICONTITLEWRAP( void ) /* 26 */
if (!test_error_msg(rc,"SPI_{GET,SET}ICONTITLEWRAP"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
UINT regval;
@@ -1187,7 +1187,7 @@ static void test_SPI_SETMENUDROPALIGNMENT( void ) /* 28 */
if (!test_error_msg(rc,"SPI_{GET,SET}MENUDROPALIGNMENT"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
@@ -1223,7 +1223,7 @@ static void test_SPI_SETDOUBLECLKWIDTH( void ) /* 29 */
trace("testing SPI_{GET,SET}DOUBLECLKWIDTH\n");
old_width = GetSystemMetrics( SM_CXDOUBLECLK );
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
char buf[10];
@@ -1257,7 +1257,7 @@ static void test_SPI_SETDOUBLECLKHEIGHT( void ) /* 30 */
trace("testing SPI_{GET,SET}DOUBLECLKHEIGHT\n");
old_height = GetSystemMetrics( SM_CYDOUBLECLK );
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
char buf[10];
@@ -1347,7 +1347,7 @@ static void test_SPI_SETMOUSEBUTTONSWAP( void ) /* 33 */
trace("testing SPI_{GET,SET}MOUSEBUTTONSWAP\n");
old_b = GetSystemMetrics( SM_SWAPBUTTON );
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
SetLastError(0xdeadbeef);
rc=SystemParametersInfoA( SPI_SETMOUSEBUTTONSWAP, vals[i], 0,
@@ -1402,7 +1402,7 @@ static void test_SPI_SETDRAGFULLWINDOWS( void ) /* 37 */
if (!test_error_msg(rc,"SPI_{GET,SET}DRAGFULLWINDOWS"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
@@ -1925,7 +1925,7 @@ static void test_SPI_SETSHOWSOUNDS( void ) /* 57 */
if (!test_error_msg(rc,"SPI_{GET,SET}SHOWSOUNDS"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
@@ -1962,7 +1962,7 @@ static void test_SPI_SETKEYBOARDPREF( void ) /* 69 */
if (!test_error_msg(rc,"SPI_{GET,SET}KEYBOARDPREF"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
BOOL v;
@@ -1997,7 +1997,7 @@ static void test_SPI_SETSCREENREADER( void ) /* 71 */
if (!test_error_msg(rc,"SPI_{GET,SET}SCREENREADER"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
BOOL v;
@@ -2036,7 +2036,7 @@ static void test_SPI_SETFONTSMOOTHING( void ) /* 75 */
SystemParametersInfoA( SPI_GETFONTSMOOTHINGCONTRAST, 0, &old_contrast, 0 );
SystemParametersInfoA( SPI_GETFONTSMOOTHINGORIENTATION, 0, &old_orient, 0 );
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
@@ -2113,7 +2113,7 @@ static void test_SPI_SETLOWPOWERACTIVE( void ) /* 85 */
if (!test_error_msg(rc,"SPI_{GET,SET}LOWPOWERACTIVE"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
@@ -2151,7 +2151,7 @@ static void test_SPI_SETPOWEROFFACTIVE( void ) /* 86 */
if (!test_error_msg(rc,"SPI_{GET,SET}POWEROFFACTIVE"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
@@ -2189,7 +2189,7 @@ static void test_SPI_SETSNAPTODEFBUTTON( void ) /* 95 */
if (!test_error_msg(rc,"SPI_GETSNAPTODEFBUTTON"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
@@ -2224,7 +2224,7 @@ static void test_SPI_SETMOUSEHOVERWIDTH( void ) /* 99 */
if (!test_error_msg(rc,"SPI_{GET,SET}MOUSEHOVERWIDTH"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
char buf[10];
@@ -2261,7 +2261,7 @@ static void test_SPI_SETMOUSEHOVERHEIGHT( void ) /* 101 */
if (!test_error_msg(rc,"SPI_{GET,SET}MOUSEHOVERHEIGHT"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
char buf[10];
@@ -2302,7 +2302,7 @@ static void test_SPI_SETMOUSEHOVERTIME( void ) /* 103 */
if (!test_error_msg(rc,"SPI_{GET,SET}MOUSEHOVERTIME"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
char buf[10];
@@ -2341,7 +2341,7 @@ static void test_SPI_SETWHEELSCROLLLINES( void ) /* 105 */
if (!test_error_msg(rc,"SPI_{GET,SET}WHEELSCROLLLINES"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
char buf[10];
@@ -2380,7 +2380,7 @@ static void test_SPI_SETMENUSHOWDELAY( void ) /* 107 */
if (!test_error_msg(rc,"SPI_{GET,SET}MENUSHOWDELAY"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
char buf[10];
@@ -2419,7 +2419,7 @@ static void test_SPI_SETWHEELSCROLLCHARS( void ) /* 108 */
if (!test_error_msg(rc,"SPI_{GET,SET}WHEELSCROLLCHARS"))
return;
- for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
+ for (i=0;i<ARRAY_SIZE(vals);i++)
{
UINT v;
char buf[10];
@@ -2489,7 +2489,7 @@ static void test_WM_DISPLAYCHANGE(void)
displaychange_sem = CreateSemaphoreW(NULL, 0, 1, NULL);
- for(i = 0; i < sizeof(test_bpps)/sizeof(test_bpps[0]); i++) {
+ for(i = 0; i < ARRAY_SIZE(test_bpps); i++) {
last_bpp = -1;
memset(&mode, 0, sizeof(mode));
diff --git a/dlls/user32/tests/text.c b/dlls/user32/tests/text.c
index c5bcd50716..359721fcd9 100644
--- a/dlls/user32/tests/text.c
+++ b/dlls/user32/tests/text.c
@@ -765,7 +765,7 @@ static void test_CharToOem_OemToChar(void)
char oem;
WCHAR uni, expect;
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
const char *expected = tests[i].ret ? helloWorld : "";
const char *src = tests[i].src ? helloWorld : NULL;
@@ -792,7 +792,7 @@ static void test_CharToOem_OemToChar(void)
ok(!strcmp(buf, expected), "test %d: got '%s'\n", i, buf);
}
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
const char *expected = tests[i].ret ? helloWorld : "";
const WCHAR *src = tests[i].src ? helloWorldW : NULL;
@@ -804,12 +804,12 @@ static void test_CharToOem_OemToChar(void)
ok(!strcmp(buf, expected), "test %d: got '%s'\n", i, buf);
memset(buf, 0, sizeof(buf));
- ret = CharToOemBuffW(src, dst, sizeof(helloWorldW)/sizeof(WCHAR));
+ ret = CharToOemBuffW(src, dst, ARRAY_SIZE(helloWorldW));
ok(ret == tests[i].ret, "test %d: expected %d, got %d\n", i, tests[i].ret, ret);
ok(!strcmp(buf, expected), "test %d: got '%s'\n", i, buf);
}
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
const WCHAR *expected = tests[i].ret ? helloWorldW : emptyW;
const char *src = tests[i].src ? helloWorld : NULL;
diff --git a/dlls/user32/tests/uitools.c b/dlls/user32/tests/uitools.c
index b52fe3a03a..07cf776a95 100644
--- a/dlls/user32/tests/uitools.c
+++ b/dlls/user32/tests/uitools.c
@@ -175,7 +175,7 @@ static void test_IsRectEmpty(void)
{{-109, -107, -103, -101}, FALSE},
};
- for (i = 0; i < sizeof(rtest)/sizeof(rtest[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(rtest); i++) {
ret = IsRectEmpty(&rtest[i].rect);
ok(ret == rtest[i].ret, "Test %d: IsRectEmpty returned %s for %s\n", i,
ret ? "TRUE" : "FALSE", wine_dbgstr_rect(&rtest[i].rect));
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 1f10d66dcd..d7f8843c98 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -2158,7 +2158,7 @@ static void test_mdi(void)
client_cs.hWindowMenu = 0;
client_cs.idFirstChild = 1;
- for (i = 0; i < sizeof(style)/sizeof(style[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(style); i++)
{
SCROLLINFO si;
BOOL ret, gotit;
@@ -6390,7 +6390,7 @@ static void test_set_window_style(void)
cls.lpszClassName = "TestSetWindowStylesClass";
ok(RegisterClassA(&cls), "RegisterClass failed\n");
- for (i = 0; i < sizeof(tests) / sizeof(*tests); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
expected_style = tests[i].style;
if (tests[i].creation_style & WS_MINIMIZE)
@@ -6857,7 +6857,7 @@ static void test_gettext(void)
num_gettext_msgs = 0;
memset( bufW, 0xcc, sizeof(bufW) );
g_wm_gettext_override.buffW = bufW;
- buf_len = GetWindowTextW( hwnd2, bufW, sizeof(bufW)/sizeof(WCHAR) );
+ buf_len = GetWindowTextW( hwnd2, bufW, ARRAY_SIZE(bufW));
ok( buf_len == 0, "got %d\n", buf_len );
ok( *bufW == 0, "got %x\n", *bufW );
ok( num_gettext_msgs == 1, "got %u WM_GETTEXT messages\n", num_gettext_msgs );
@@ -6955,7 +6955,7 @@ static void test_gettext(void)
memset( bufW, 0x1c, sizeof(bufW) );
g_wm_gettext_override.dont_terminate = TRUE;
- buf_len = GetWindowTextW( hwnd, bufW, sizeof(bufW)/sizeof(bufW[0]) );
+ buf_len = GetWindowTextW( hwnd, bufW, ARRAY_SIZE(bufW));
ok( buf_len == 4, "Unexpected text length, %d\n", buf_len );
ok( !memcmp(bufW, textW, 4 * sizeof(WCHAR)), "Unexpected window text, %s\n", wine_dbgstr_w(bufW) );
ok( bufW[4] == 0, "Unexpected buffer contents, %#x\n", bufW[4] );
@@ -6974,7 +6974,7 @@ static void test_gettext(void)
memset( bufW, 0x1c, sizeof(bufW) );
g_wm_gettext_override.dont_terminate = TRUE;
- buf_len = GetWindowTextW( hwnd2, bufW, sizeof(bufW)/sizeof(bufW[0]) );
+ buf_len = GetWindowTextW( hwnd2, bufW, ARRAY_SIZE(bufW));
ok( buf_len == 4, "Unexpected text length, %d\n", buf_len );
ok( !memcmp(bufW, textW, 4 * sizeof(WCHAR)), "Unexpected window text, %s\n", wine_dbgstr_w(bufW) );
ok( bufW[4] == 0x1c1c, "Unexpected buffer contents, %#x\n", bufW[4] );
@@ -7399,7 +7399,7 @@ static void test_hwnd_message(void)
if (parent) ok( !IsWindowVisible( parent ), "HWND_MESSAGE parent is visible\n" );
/* GetWindowLong */
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
SetLastError( 0xdeadbeef );
result = GetWindowLongPtrW( parent, tests[i].offset );
@@ -7679,14 +7679,14 @@ static void test_fullscreen(void)
cls.lpszClassName = "fullscreen_class";
RegisterClassA(&cls);
- for (i = 0; i < sizeof(t_style)/sizeof(t_style[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(t_style); i++)
{
DWORD style, ex_style;
/* avoid a WM interaction */
assert(!(t_style[i] & WS_VISIBLE));
- for (j = 0; j < sizeof(t_ex_style)/sizeof(t_ex_style[0]); j++)
+ for (j = 0; j < ARRAY_SIZE(t_ex_style); j++)
{
int fixup;
@@ -8430,7 +8430,7 @@ static void create_window_tree(HWND parent, HWND *window, int size)
memset(window, 0, size * sizeof(window[0]));
pos = 0;
- for (i = 0; i < sizeof(style)/sizeof(style[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(style); i++)
{
assert(pos < size);
window[pos] = CreateWindowExA(0, "my_window", NULL, style[i] | WS_CHILD,
@@ -8577,7 +8577,7 @@ static void test_child_window_from_point(void)
ok(parent != 0, "CreateWindowEx failed\n");
trace("parent %p\n", parent);
- create_window_tree(parent, window, sizeof(window)/sizeof(window[0]));
+ create_window_tree(parent, window, ARRAY_SIZE(window));
found_invisible = 0;
found_disabled = 0;
@@ -8586,14 +8586,14 @@ static void test_child_window_from_point(void)
found_extransparent = 0;
/* FIXME: also test WindowFromPoint, ChildWindowFromPoint, ChildWindowFromPointEx */
- for (i = 0; i < sizeof(real_child_pos)/sizeof(real_child_pos[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(real_child_pos); i++)
{
struct window_attributes attrs;
pt.x = pt.y = 50;
hwnd = RealChildWindowFromPoint(parent, pt);
ok(hwnd != 0, "RealChildWindowFromPoint failed\n");
- ret = window_to_index(hwnd, window, sizeof(window)/sizeof(window[0]));
+ ret = window_to_index(hwnd, window, ARRAY_SIZE(window));
/* FIXME: remove once Wine is fixed */
todo_wine_if (ret != real_child_pos[i])
ok(ret == real_child_pos[i], "expected %d, got %d\n", real_child_pos[i], ret);
@@ -9782,7 +9782,7 @@ static void test_LockWindowUpdate(HWND parent)
UpdateWindow(parent);
flush_events(TRUE);
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
HDC hdc;
POINT p = {10, 10};
@@ -10047,7 +10047,7 @@ static void test_desktop( void )
DWORD_PTR result;
int i;
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
SetLastError( 0xdeadbeef );
result = GetWindowLongPtrW( desktop, tests[i].offset );
@@ -10143,7 +10143,7 @@ static void test_topmost(void)
ok(!is_topmost(hwnd), "hwnd %p topmost state is wrong\n", hwnd);
ok(!is_topmost(hwnd2), "hwnd %p topmost state is wrong\n", hwnd2);
check_z_order(hwnd, hwnd2, 0, owner, FALSE);
- reset_window_state(state, sizeof(state)/sizeof(state[0]));
+ reset_window_state(state, ARRAY_SIZE(state));
swp_after(hwnd, HWND_TOPMOST);
ok(!is_topmost(owner), "hwnd %p topmost state is wrong\n", owner);
@@ -10183,7 +10183,7 @@ todo_wine
ok(!is_topmost(hwnd2), "hwnd %p topmost state is wrong\n", hwnd2);
if (!is_wine) /* FIXME: remove once Wine is fixed */
check_z_order(hwnd, 0, hwnd2, owner, FALSE);
- reset_window_state(state, sizeof(state)/sizeof(state[0]));
+ reset_window_state(state, ARRAY_SIZE(state));
swp_after(hwnd, HWND_TOPMOST);
ok(!is_topmost(owner), "hwnd %p topmost state is wrong\n", owner);
@@ -10197,7 +10197,7 @@ todo_wine
ok(!is_topmost(hwnd2), "hwnd %p topmost state is wrong\n", hwnd2);
if (!is_wine) /* FIXME: remove once Wine is fixed */
check_z_order(hwnd, 0, hwnd2, owner, FALSE);
- reset_window_state(state, sizeof(state)/sizeof(state[0]));
+ reset_window_state(state, ARRAY_SIZE(state));
swp_after(hwnd, HWND_TOPMOST);
ok(!is_topmost(owner), "hwnd %p topmost state is wrong\n", owner);
@@ -10218,7 +10218,7 @@ if (!is_wine) /* FIXME: remove once Wine is fixed */
ok(!is_topmost(hwnd2), "hwnd %p topmost state is wrong\n", hwnd2);
if (!is_wine) /* FIXME: remove once Wine is fixed */
check_z_order(hwnd, 0, hwnd2, owner, FALSE);
- reset_window_state(state, sizeof(state)/sizeof(state[0]));
+ reset_window_state(state, ARRAY_SIZE(state));
hwnd_child2 = create_tool_window(WS_VISIBLE|WS_POPUP, hwnd);
ok(hwnd_child2 != 0, "Failed to create popup window (%d)\n", GetLastError());
@@ -10268,7 +10268,7 @@ todo_wine
if (!is_wine) /* FIXME: remove once Wine is fixed */
check_z_order(hwnd, hwnd2, 0, owner, FALSE);
check_z_order(hwnd_child, hwnd_child2, 0, hwnd, FALSE);
- reset_window_state(state, sizeof(state)/sizeof(state[0]));
+ reset_window_state(state, ARRAY_SIZE(state));
swp_after(hwnd, HWND_TOPMOST);
ok(!is_topmost(owner), "hwnd %p topmost state is wrong\n", owner);
@@ -10292,7 +10292,7 @@ todo_wine
ok(!is_topmost(hwnd_grandchild), "hwnd %p topmost state is wrong\n", hwnd_grandchild);
check_z_order(hwnd, hwnd2, 0, owner, FALSE);
check_z_order(hwnd_child, hwnd_child2, 0, hwnd, FALSE);
- reset_window_state(state, sizeof(state)/sizeof(state[0]));
+ reset_window_state(state, ARRAY_SIZE(state));
swp_after(hwnd, HWND_TOPMOST);
ok(!is_topmost(owner), "hwnd %p topmost state is wrong\n", owner);
@@ -10316,7 +10316,7 @@ todo_wine
ok(!is_topmost(hwnd_grandchild), "hwnd %p topmost state is wrong\n", hwnd_grandchild);
check_z_order(hwnd, hwnd2, 0, owner, FALSE);
check_z_order(hwnd_child, hwnd_child2, 0, hwnd, FALSE);
- reset_window_state(state, sizeof(state)/sizeof(state[0]));
+ reset_window_state(state, ARRAY_SIZE(state));
swp_after(hwnd_child, HWND_TOPMOST);
ok(!is_topmost(owner), "hwnd %p topmost state is wrong\n", owner);
@@ -10350,7 +10350,7 @@ todo_wine
if (!is_wine) /* FIXME: remove once Wine is fixed */
check_z_order(hwnd, hwnd2, 0, owner, FALSE);
check_z_order(hwnd_child, hwnd_child2, 0, hwnd, FALSE);
- reset_window_state(state, sizeof(state)/sizeof(state[0]));
+ reset_window_state(state, ARRAY_SIZE(state));
swp_after(hwnd_child, HWND_TOPMOST);
ok(!is_topmost(owner), "hwnd %p topmost state is wrong\n", owner);
@@ -10373,7 +10373,7 @@ todo_wine
if (!is_wine) /* FIXME: remove once Wine is fixed */
check_z_order(hwnd, hwnd2, 0, owner, FALSE);
check_z_order(hwnd_child, hwnd_child2, 0, hwnd, FALSE);
- reset_window_state(state, sizeof(state)/sizeof(state[0]));
+ reset_window_state(state, ARRAY_SIZE(state));
swp_after(hwnd_grandchild, HWND_TOPMOST);
ok(!is_topmost(owner), "hwnd %p topmost state is wrong\n", owner);
@@ -10394,7 +10394,7 @@ if (!is_wine) /* FIXME: remove once Wine is fixed */
check_z_order(hwnd, hwnd2, 0, owner, FALSE);
if (!is_wine) /* FIXME: remove once Wine is fixed */
check_z_order(hwnd_child, 0, hwnd_child2, hwnd, FALSE);
- reset_window_state(state, sizeof(state)/sizeof(state[0]));
+ reset_window_state(state, ARRAY_SIZE(state));
swp_after(hwnd_child, HWND_TOPMOST);
ok(!is_topmost(owner), "hwnd %p topmost state is wrong\n", owner);
@@ -10418,7 +10418,7 @@ if (!is_wine) /* FIXME: remove once Wine is fixed */
check_z_order(hwnd, 0, hwnd2, owner, FALSE);
if (!is_wine) /* FIXME: remove once Wine is fixed */
check_z_order(hwnd_child, 0, hwnd_child2, hwnd, FALSE);
- reset_window_state(state, sizeof(state)/sizeof(state[0]));
+ reset_window_state(state, ARRAY_SIZE(state));
swp_after(hwnd_child, HWND_TOPMOST);
ok(!is_topmost(owner), "hwnd %p topmost state is wrong\n", owner);
@@ -10442,7 +10442,7 @@ if (!is_wine) /* FIXME: remove once Wine is fixed */
check_z_order(hwnd, hwnd2, 0, owner, FALSE);
if (!is_wine) /* FIXME: remove once Wine is fixed */
check_z_order(hwnd_child, 0, hwnd_child2, hwnd, FALSE);
- reset_window_state(state, sizeof(state)/sizeof(state[0]));
+ reset_window_state(state, ARRAY_SIZE(state));
DestroyWindow(hwnd_grandchild);
DestroyWindow(hwnd_child);
diff --git a/dlls/user32/tests/wsprintf.c b/dlls/user32/tests/wsprintf.c
index f0e80b2ad6..f79b6306a7 100644
--- a/dlls/user32/tests/wsprintf.c
+++ b/dlls/user32/tests/wsprintf.c
@@ -66,7 +66,7 @@ static void wsprintfATest(void)
win_skip( "I64 formats not supported\n" );
return;
}
- for (i = 0; i < sizeof(i64_formats)/sizeof(i64_formats[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(i64_formats); i++)
{
rc = wsprintfA(buf, i64_formats[i].fmt, i64_formats[i].value);
ok(rc == strlen(i64_formats[i].res), "%u: wsprintfA length failure: rc=%d\n", i, rc);
@@ -98,10 +98,10 @@ static void wsprintfWTest(void)
win_skip( "I64 formats not supported\n" );
return;
}
- for (i = 0; i < sizeof(i64_formats)/sizeof(i64_formats[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(i64_formats); i++)
{
- MultiByteToWideChar( CP_ACP, 0, i64_formats[i].fmt, -1, fmt, sizeof(fmt)/sizeof(WCHAR) );
- MultiByteToWideChar( CP_ACP, 0, i64_formats[i].res, -1, res, sizeof(res)/sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, i64_formats[i].fmt, -1, fmt, ARRAY_SIZE(fmt));
+ MultiByteToWideChar( CP_ACP, 0, i64_formats[i].res, -1, res, ARRAY_SIZE(res));
rc = wsprintfW(buf, fmt, i64_formats[i].value);
ok(rc == lstrlenW(res), "%u: wsprintfW length failure: rc=%d\n", i, rc);
ok(!lstrcmpW(buf, res), "%u: wrong result [%s]\n", i, wine_dbgstr_w(buf));
--
2.14.4
June 28, 2018
[PATCH] user32/tests: Avoid ARRAY_SIZE-like macros
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/user32/tests/monitor.c | 3 +--
dlls/user32/tests/win.c | 15 ++++++---------
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c
index dfdca49e79..4d7b020e14 100644
--- a/dlls/user32/tests/monitor.c
+++ b/dlls/user32/tests/monitor.c
@@ -150,7 +150,6 @@ static const struct vid_mode vid_modes_test[] = {
{0, 0, 0, 0, DM_DISPLAYFREQUENCY, 0}
*/
};
-#define vid_modes_cnt (sizeof(vid_modes_test) / sizeof(vid_modes_test[0]))
static void test_ChangeDisplaySettingsEx(void)
{
@@ -237,7 +236,7 @@ static void test_ChangeDisplaySettingsEx(void)
memset(&dm, 0, sizeof(dm));
dm.dmSize = sizeof(dm);
- for (i = 0; i < vid_modes_cnt; i++)
+ for (i = 0; i < ARRAY_SIZE(vid_modes_test); i++)
{
dm.dmPelsWidth = vid_modes_test[i].w;
dm.dmPelsHeight = vid_modes_test[i].h;
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index ac706aa4bf..1f10d66dcd 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -84,8 +84,6 @@ static const char* szAWRClass = "Winsize";
static HMENU hmenu;
static DWORD our_pid;
-#define COUNTOF(arr) (sizeof(arr)/sizeof(arr[0]))
-
static void dump_minmax_info( const MINMAXINFO *minmax )
{
trace("Reserved=%d,%d MaxSize=%d,%d MaxPos=%d,%d MinTrack=%d,%d MaxTrack=%d,%d\n",
@@ -5289,9 +5287,9 @@ static void test_AWR_window_size(BOOL menu)
/* A exhaustive check of all the styles takes too long
* so just do a (hopefully representative) sample
*/
- for (i = 0; i < COUNTOF(styles); ++i)
+ for (i = 0; i < ARRAY_SIZE(styles); ++i)
test_AWRwindow(szAWRClass, styles[i], 0, menu);
- for (i = 0; i < COUNTOF(exStyles); ++i) {
+ for (i = 0; i < ARRAY_SIZE(exStyles); ++i) {
test_AWRwindow(szAWRClass, WS_POPUP, exStyles[i], menu);
test_AWRwindow(szAWRClass, WS_THICKFRAME, exStyles[i], menu);
}
@@ -5306,13 +5304,13 @@ static void test_AWR_flags(void)
DWORD i, j, k, style, exstyle;
RECT rect, rect2;
- for (i = 0; i < (1 << COUNTOF(styles)); i++)
+ for (i = 0; i < (1 << ARRAY_SIZE(styles)); i++)
{
- for (k = style = 0; k < COUNTOF(styles); k++) if (i & (1 << k)) style |= styles[k];
+ for (k = style = 0; k < ARRAY_SIZE(styles); k++) if (i & (1 << k)) style |= styles[k];
- for (j = 0; j < (1 << COUNTOF(exStyles)); j++)
+ for (j = 0; j < (1 << ARRAY_SIZE(exStyles)); j++)
{
- for (k = exstyle = 0; k < COUNTOF(exStyles); k++) if (j & (1 << k)) exstyle |= exStyles[k];
+ for (k = exstyle = 0; k < ARRAY_SIZE(exStyles); k++) if (j & (1 << k)) exstyle |= exStyles[k];
SetRect( &rect, 100, 100, 200, 200 );
rect2 = rect;
AdjustWindowRectEx( &rect, style, FALSE, exstyle );
@@ -5329,7 +5327,6 @@ static void test_AWR_flags(void)
}
}
}
-#undef COUNTOF
#define SHOWSYSMETRIC(SM) trace(#SM "=%d\n", GetSystemMetrics(SM))
--
2.14.4
June 28, 2018
Re: [PATCH v2 1/4] explorer: Add a private message to notify the graphics driver when activity occurs.
by Zebediah Figura
On 27/06/18 19:43, Alexandre Julliard wrote:
> Zebediah Figura <zfigura(a)codeweavers.com> writes:
>
>> @@ -661,6 +665,11 @@ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPAR
>> }
>> return 0;
>>
>> + case WM_WINE_NOTIFY_ACTIVITY:
>> + if (wine_notify_activity)
>> + wine_notify_activity();
>> + return 0;
>> +
>> default:
>> return DefWindowProcW( hwnd, message, wp, lp );
>> }
>
> I think it would be cleaner to have the drivers wrap the desktop winproc
> so that we don't need to define new driver functions. The Android driver
> already does this.
>
Thanks; I'll look into this.
June 28, 2018
[PATCH] hnetcfg: Store the long path in INetFwAuthorizedApplication_put_ProcessImageFileName().
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/hnetcfg/apps.c | 14 ++++++++++++--
dlls/hnetcfg/tests/policy.c | 1 +
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/hnetcfg/apps.c b/dlls/hnetcfg/apps.c
index 69eabd6..21e1007 100644
--- a/dlls/hnetcfg/apps.c
+++ b/dlls/hnetcfg/apps.c
@@ -268,9 +268,9 @@ static HRESULT WINAPI fw_app_put_ProcessImageFileName(
{
fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
UNIVERSAL_NAME_INFOW *info;
+ DWORD sz, longsz;
WCHAR *path;
DWORD res;
- DWORD sz;
FIXME("%p, %s\n", This, debugstr_w(image));
@@ -298,9 +298,19 @@ static HRESULT WINAPI fw_app_put_ProcessImageFileName(
sz = GetFullPathNameW(image, 0, NULL, NULL);
if (!(path = heap_alloc(++sz * sizeof(WCHAR))))
return E_OUTOFMEMORY;
-
GetFullPathNameW(image, sz, path, NULL);
+ longsz = GetLongPathNameW(path, path, sz);
+ if (longsz > sz)
+ {
+ if (!(path = heap_realloc(path, longsz * sizeof(WCHAR))))
+ {
+ heap_free(path);
+ return E_OUTOFMEMORY;
+ }
+ GetLongPathNameW(path, path, longsz);
+ }
+
SysFreeString( This->filename );
This->filename = SysAllocString(path);
heap_free(path);
diff --git a/dlls/hnetcfg/tests/policy.c b/dlls/hnetcfg/tests/policy.c
index 389be16..4e90ceb 100644
--- a/dlls/hnetcfg/tests/policy.c
+++ b/dlls/hnetcfg/tests/policy.c
@@ -140,6 +140,7 @@ static void test_NetFwAuthorizedApplication(void)
SysFreeString(bstr);
GetFullPathNameW(image, ARRAY_SIZE(fullpath), fullpath, NULL);
+ GetLongPathNameW(fullpath, fullpath, ARRAY_SIZE(fullpath));
info = (UNIVERSAL_NAME_INFOW *)&netpath;
sz = sizeof(netpath);
--
2.7.4
June 28, 2018
[PATCH] gdi32: Add DECLSPEC_HOTPATCH to GetDIBits
by Alex Henrie
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
Fixes https://bugs.winehq.org/show_bug.cgi?id=45346
Although this patch fixes the bug in question, Zeb and I would like to
know: Since all exported Windows API functions support hotpatching,[1]
why do we add __attribute__((__ms_hook_prologue__)) attribute to
functions ad hoc instead of making it part of the definitions of
__stdcall and __cdecl in windef.h?
[1] https://blogs.msdn.microsoft.com/oldnewthing/20110921-00/?p=9583
---
dlls/gdi32/dib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index c7dcdb122c..1312bf0533 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -1208,7 +1208,7 @@ BITMAPINFO *copy_packed_dib( const BITMAPINFO *src_info, UINT usage )
* Success: Number of scan lines copied from bitmap
* Failure: 0
*/
-INT WINAPI GetDIBits(
+INT WINAPI DECLSPEC_HOTPATCH GetDIBits(
HDC hdc, /* [in] Handle to device context */
HBITMAP hbitmap, /* [in] Handle to bitmap */
UINT startscan, /* [in] First scan line to set in dest bitmap */
--
2.18.0
June 28, 2018
[PATCH] configure: Allow building bcrypt with GnuTLS support on macOS.
by Hans Leidekker
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
configure.ac | 1 -
1 file changed, 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 9c38cfb376..d10acde146 100644
--- a/configure.ac
+++ b/configure.ac
@@ -789,7 +789,6 @@ case $host_os in
LIBS="$LIBS $SECURITY_LIBS"
AC_CHECK_FUNCS(SSLCopyPeerCertificates)
LIBS="$ac_save_LIBS"
- with_gnutls=${with_gnutls:-no}
fi
if test "$ac_cv_header_CoreAudio_CoreAudio_h" = "yes" -a "$ac_cv_header_AudioUnit_AudioUnit_h" = "yes"
then
--
2.11.0
June 28, 2018
Seeking for future maintainer of Tea CI
by Qian Hong
Dear folks,
(Long time no see, hey!)
I know many Wine contributors are in WineConf, some of you might even
be missing me <grin>, so it's the perfect time to raise this topic :)
And I know new Wine contributors join the community every year, so I
should introduce a bit about myself ^_^
I'm Qian Hong, a former Wine contributor since 2012. In 2016, I move
my focus from upstream Wine to Tea CI https://tea-ci.org
Tea CI is a *C*ontinuous *I*ntegration platform which supports
building both Linux application and Windows application, it's the only
platform which supports building Windows application without depending
on any Windows License because of the utilizing of Wine. For people
who aren't familiar with fashion words like CI, think about it like
our Wine TestBot, which builds and tests software automatically.
Here are some examples of how people use Tea CI:
https://tea-ci.org/mamedev/mame
https://tea-ci.org/concurrencykit/ck
https://tea-ci.org/Alexpux/MINGW-packages
There are currently 200 registered users of Tea CI, while only a few
of them are active.
I (co)founded Tea CI as a non-profit project for some ambitious goals,
which I'm shy to tell anymore because it doesn't work out. I admit it
is not very successful, it wasn't updated for more than one year,
Msys2/MinGW packages are outdated, Wine compatibility issues are
remaining unfixed, Web UI is not friendly enough, documentation is not
complete, the future is unclear, etc... However, I do appreciate lots
of people who helped Tea CI in many different ways, including but not
limited to Wine/Wine Staging developers, Cygwin/Msys2/GDB developers,
Drone CI developers, Mozilla RR developer, Arch developer, and many
many more.
I was considering shutting down Tea CI because lacking maintenance and
other reasons, however, I received positive feedback from some users:
>>>
XXX (A startup) is happy to cover your server costs as a sponsor. If
it is 98 EUR per month we can cover full cost. Would that help towards
keeping it active?
<<<
>>>
it is very convenient to do windows builds and I would use it
more if it were updated and taken care of. I do have (and had) a few
projects that could use it, some of them were commercial.
<<<
>>>
I think this is one of a few projects providing windows builds
without actual windows server. This alone makes it worth the while.
<<<
>>>
I would be willing to support the project financially (though not the
full amount), if someone would be maintaining and improving it (perhaps
under your supervision?).
<<<
>>>
It's been a solid platform, and even though we only build 'tiny'
builds on a single platform, and not most of the components, we've
done it for practically every commit these last 18 months.
It will be a shame to lose it, and I'm not sure what out-of-the-box
solution would replace it for Msys2/MinGW.
<<<
>>>
We are currently using Tea CI in a major project, ConcurrencyKit. CK
is a very UNIX oriented library, so Tea CI made things very easy.
<<<
To be fair, I should also share negative feedback like:
>>>
I last used TeaCI for about a year starting ~2 years ago, using it
once to twice a week. ultimately, various bugs from ancient Cygwin
versions led me move most of my infrastructure to MSVC and use
AppVeyor. I appreciate all the money and hard work you have put in,
but ultimately, I have no issue if TeaCI shuts down.
<<<
As one might see, it could be a pity if no one maintains Tea CI.
However, due to personal reasons, I'm not able to spend enough time
and energy to improve Tea CI, that's why I am hoping to transfer the
owner of Tea CI. The most challenging part of Tea CI is keeping Wine
compatible with Cygwin/Msys2, which requires experienced Wine
development skills, and most people who have the skill are subscribing
to this list :)
I know looking for future maintainers of Tea CI is much harder than
looking for a job, people who have the skill are likely to have no
time. However, I am still very keen to ask: by any chance, would
anyone be interested in taking a look, or at least raise a discussion
during/after WineConf?
If anyone is interested in a follow up of the discussion, I'm glad to
answer any questions about Tea CI.
Looking forward to hearing from you!
--
Regards,
Qian Hong
June 28, 2018
[PATCH 2/2] inetcpl.cpl: Add partial support for writing DefaultConnectionSettings registry setting
by Piotr Caban
IE 10+ saves connection information in this key. .NET 4.6.2 is using the
key to read proxy settings.
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
---
dlls/inetcpl.cpl/connections.c | 83
+++++++++++++++++++++++++++++++++++++++++-
1 file changed, 81 insertions(+), 2 deletions(-)
June 28, 2018
[PATCH 1/2] inetcpl.cpl: Add proxy server settings dialog
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
---
dlls/inetcpl.cpl/Makefile.in | 1 +
dlls/inetcpl.cpl/connections.c | 178
+++++++++++++++++++++++++++++++++++++++++
dlls/inetcpl.cpl/inetcpl.c | 6 ++
dlls/inetcpl.cpl/inetcpl.h | 6 ++
dlls/inetcpl.cpl/inetcpl.rc | 14 ++++
5 files changed, 205 insertions(+)
create mode 100644 dlls/inetcpl.cpl/connections.c
June 28, 2018