Wine-Devel
Threads by month
- ----- 2026 -----
- 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
- 4 participants
- 84544 discussions
March 11, 2022
All of the new tests that are marked todo_wine fail because Wine's
PathCombineW does not handle ".", "...", "....", or "foobar." correctly.
They will pass once PathCombineW is fixed.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52506
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
dlls/shell32/dde.c | 75 +++++---
dlls/shell32/tests/progman_dde.c | 318 ++++++++++++++++++++++++++++++-
2 files changed, 368 insertions(+), 25 deletions(-)
diff --git a/dlls/shell32/dde.c b/dlls/shell32/dde.c
index 5ab63136092..5138843f259 100644
--- a/dlls/shell32/dde.c
+++ b/dlls/shell32/dde.c
@@ -78,19 +78,49 @@ static inline BOOL Dde_OnWildConnect(HSZ hszTopic, HSZ hszService)
return FALSE;
}
+static WCHAR *sanitize_and_combine(const WCHAR *directory, WCHAR *name, BOOL icon)
+{
+ WCHAR *path;
+ int len, i;
+
+ len = lstrlenW(directory) + 1 + lstrlenW(name);
+ if (icon) len += 4;
+ path = heap_alloc((len + 1) * sizeof(WCHAR));
+
+ for (i = 0; i < lstrlenW(name); i++)
+ {
+ if (name[i] < ' ' || StrChrW(L"*/:<>?\\|", name[i]))
+ name[i] = '_';
+ }
+
+ PathCombineW(path, directory, name);
+
+ if (icon)
+ lstrcatW(path, L".lnk");
+
+ return path;
+}
+
/* Returned string must be freed by caller */
-static WCHAR *get_programs_path(const WCHAR *name)
+static WCHAR *get_programs_path(WCHAR *name, BOOL sanitize)
{
WCHAR *programs, *path;
int len;
SHGetKnownFolderPath(&FOLDERID_Programs, 0, NULL, &programs);
- len = lstrlenW(programs) + 1 + lstrlenW(name);
- path = heap_alloc((len + 1) * sizeof(*path));
- lstrcpyW(path, programs);
- lstrcatW(path, L"/");
- lstrcatW(path, name);
+ if (sanitize)
+ {
+ path = sanitize_and_combine(programs, name, FALSE);
+ }
+ else
+ {
+ len = lstrlenW(programs) + 1 + lstrlenW(name);
+ path = heap_alloc((len + 1) * sizeof(WCHAR));
+ lstrcpyW(path, programs);
+ lstrcatW(path, L"/");
+ lstrcatW(path, name);
+ }
CoTaskMemFree(programs);
@@ -109,9 +139,10 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic,
WCHAR *groups_data = heap_alloc(sizeof(WCHAR));
char *groups_dataA;
HDDEDATA ret;
+ static WCHAR star[] = L"*";
groups_data[0] = 0;
- programs = get_programs_path(L"*");
+ programs = get_programs_path(star, FALSE);
hfind = FindFirstFileW(programs, &finddata);
if (hfind)
{
@@ -162,10 +193,10 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
if (argc < 1) return DDE_FNOTPROCESSED;
- path = get_programs_path(argv[0]);
+ path = get_programs_path(argv[0], TRUE);
- CreateDirectoryW(path, NULL);
- ShellExecuteW(NULL, NULL, path, NULL, NULL, SW_SHOWNORMAL);
+ if (CreateDirectoryW(path, NULL))
+ ShellExecuteW(NULL, NULL, path, NULL, NULL, SW_SHOWNORMAL);
heap_free(last_group);
last_group = path;
@@ -178,7 +209,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
if (argc < 1) return DDE_FNOTPROCESSED;
- path = get_programs_path(argv[0]);
+ path = get_programs_path(argv[0], TRUE);
path2 = heap_alloc((lstrlenW(path) + 2) * sizeof(*path));
lstrcpyW(path2, path);
@@ -203,7 +234,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
* ignore its actual value. */
if (argc < 2) return DDE_FNOTPROCESSED;
- path = get_programs_path(argv[0]);
+ path = get_programs_path(argv[0], TRUE);
ShellExecuteW(NULL, NULL, path, NULL, NULL, SW_SHOWNORMAL);
@@ -250,26 +281,21 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
IShellLinkW_Release(link);
return DDE_FNOTPROCESSED;
}
- if (argc >= 2)
+ if (argc >= 2 && argv[1][0])
{
- len = lstrlenW(last_group) + 1 + lstrlenW(argv[1]) + 5;
- name = heap_alloc(len * sizeof(*name));
- swprintf( name, len, L"%s/%s.lnk", last_group, argv[1] );
+ name = sanitize_and_combine(last_group, argv[1], TRUE);
}
else
{
- const WCHAR *filename = PathFindFileNameW(argv[0]);
- len = PathFindExtensionW(filename) - filename;
- name = heap_alloc((lstrlenW(last_group) + 1 + len + 5) * sizeof(*name));
- swprintf( name, lstrlenW(last_group) + 1 + len + 5, L"%s/%.*s.lnk", last_group, len, filename );
+ WCHAR *filename = PathFindFileNameW(argv[0]);
+ *PathFindExtensionW(filename) = '\0';
+ name = sanitize_and_combine(last_group, filename, TRUE);
}
- hres = IPersistFile_Save(file, name, TRUE);
+ IPersistFile_Save(file, name, TRUE);
heap_free(name);
IPersistFile_Release(file);
IShellLinkW_Release(link);
-
- if (FAILED(hres)) return DDE_FNOTPROCESSED;
}
else if (!wcsicmp(command, L"DeleteItem") || !wcsicmp(command, L"ReplaceItem"))
{
@@ -280,7 +306,8 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
len = lstrlenW(last_group) + 1 + lstrlenW(argv[0]) + 5;
name = heap_alloc(len * sizeof(*name));
- swprintf( name, len, L"%s/%s.lnk", last_group, argv[0]);
+ PathCombineW(name, last_group, argv[0]);
+ lstrcatW(name, L".lnk");
ret = DeleteFileW(name);
diff --git a/dlls/shell32/tests/progman_dde.c b/dlls/shell32/tests/progman_dde.c
index 5d532f9222f..66b9ed0c87a 100644
--- a/dlls/shell32/tests/progman_dde.c
+++ b/dlls/shell32/tests/progman_dde.c
@@ -23,7 +23,7 @@
* functionality
* - Todo: Handle CommonGroupFlag
* Better AddItem Tests (Lots of parameters to test)
- * Tests for Invalid Characters in Names / Invalid Parameters
+ * Tests for invalid parameters
*/
#include <stdio.h>
@@ -425,6 +425,321 @@ static void test_request_groups(DWORD instance, HCONV hconv)
FindClose(hfind);
}
+static BOOL is_unsanitary(char c)
+{
+ return (c > 0 && c < ' ') || strchr("*/:<>?\\|", c) != NULL;
+}
+
+static void sanitize_name(const char *original_name, char *sanitized_name, BOOL group)
+{
+ BOOL at_end = TRUE;
+ int i;
+
+ i = strlen(original_name);
+ sanitized_name[i] = 0;
+
+ while (--i >= 0)
+ {
+ if (is_unsanitary(original_name[i]))
+ {
+ /* replaced in all positions */
+ sanitized_name[i] = '_';
+ at_end = FALSE;
+ }
+ else if (original_name[i] == '.' || (original_name[i] == ' ' && group))
+ {
+ /* left alone if in the middle of the string, dropped if at the end of the string */
+ sanitized_name[i] = at_end ? '\0' : original_name[i];
+ }
+ else
+ {
+ /* left alone in all positions */
+ sanitized_name[i] = original_name[i];
+ at_end = FALSE;
+ }
+ }
+}
+
+static void test_name_sanitization(DWORD instance, HCONV hConv)
+{
+ static const char test_chars[] = "\x01\x1F !#$%&'*+,-./:;<=>?@[\\]^`{|}~\x7F\x80\xFF";
+ char original_name[16], sanitized_icon_name[16], sanitized_group_name[16];
+ char buf[64];
+ UINT error;
+ int i;
+ char c;
+
+ if (0) /* the directory isn't deleted on windows < 7 */
+ {
+ error = dde_execute(instance, hConv, "[CreateGroup(\" \")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(check_exists(" "), "directory not created\n");
+ ok(!check_window_exists(" "), "window should not exist\n");
+
+ error = dde_execute(instance, hConv, "[DeleteGroup(\" \")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(!check_exists(" "), "directory should not exist\n");
+ }
+
+ if (GetUserDefaultUILanguage() == MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT))
+ {
+ error = dde_execute(instance, hConv, "[CreateGroup(\"\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ todo_wine ok(check_window_exists("Programs") || broken(TRUE) /* 2003 */, "window not created\n");
+
+ error = dde_execute(instance, hConv, "[CreateGroup(\".\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(!check_window_exists("Programs"), "window should not exist\n");
+
+ error = dde_execute(instance, hConv, "[CreateGroup(\"..\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ todo_wine ok(check_window_exists("Start Menu") || broken(TRUE) /* 2003 */, "window not created\n");
+
+ error = dde_execute(instance, hConv, "[CreateGroup(\"...\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ todo_wine ok(check_window_exists("Programs") || broken(TRUE) /* XP */, "window not created\n");
+
+ error = dde_execute(instance, hConv, "[CreateGroup(\"....\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(!check_window_exists("Programs"), "window should not exist\n");
+ }
+ else
+ {
+ skip("Directory names are probably not in English\n");
+ }
+
+ if (0) /* these calls will actually delete the start menu */
+ {
+ error = dde_execute(instance, hConv, "[DeleteGroup(\"\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(!check_exists("../Programs"), "directory should not exist\n");
+
+ error = dde_execute(instance, hConv, "[DeleteGroup(\"..\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(!check_exists("../../Start Menu"), "directory should not exist\n");
+ }
+
+ error = dde_execute(instance, hConv, "[CreateGroup(Group3)]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(check_exists("Group3"), "directory not created\n");
+ ok(check_window_exists("Group3"), "window not created\n");
+
+ error = dde_execute(instance, hConv, "[AddItem(notepad,\"\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(check_exists("Group3/notepad.lnk"), "link not created\n");
+
+ error = dde_execute(instance, hConv, "[DeleteItem(notepad)]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(!check_exists("Group3/notepad.lnk"), "link should not exist\n");
+
+ error = dde_execute(instance, hConv, "[AddItem(notepad,\" \")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(check_exists("Group3/ .lnk"), "link not created\n");
+
+ error = dde_execute(instance, hConv, "[DeleteItem(\" \")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(!check_exists("Group3/ .lnk"), "link should not exist\n");
+
+ error = dde_execute(instance, hConv, "[AddItem(notepad,\".\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ todo_wine ok(check_exists("Group3.lnk"), "link not created\n");
+
+ error = dde_execute(instance, hConv, "[DeleteItem(\".\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(!check_exists("Group3.lnk"), "link should not exist\n");
+
+ error = dde_execute(instance, hConv, "[AddItem(notepad,\"..\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(check_exists("../Programs.lnk"), "link not created\n");
+
+ error = dde_execute(instance, hConv, "[DeleteItem(\"..\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(!check_exists("../Programs.lnk"), "link should not exist\n");
+
+ error = dde_execute(instance, hConv, "[AddItem(notepad,\"...\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ todo_wine ok(check_exists("Group3/.lnk") || broken(TRUE) /* XP */, "link not created\n");
+
+ error = dde_execute(instance, hConv, "[DeleteItem(\"...\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(!check_exists("Group3/.lnk"), "link should not exist\n");
+
+ error = dde_execute(instance, hConv, "[AddItem(notepad,\"....\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ todo_wine ok(check_exists("Group3/.lnk") || broken(TRUE) /* XP */, "link not created\n");
+
+ error = dde_execute(instance, hConv, "[DeleteItem(\"....\")]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(!check_exists("Group3/.lnk"), "link should not exist\n");
+
+ /* Test sanitary group name with unsanitary icon names */
+
+ for (i = 0; i < sizeof(test_chars) - 1; i++)
+ {
+ c = test_chars[i];
+ winetest_push_context("char %d '%c'", c, c);
+
+ sprintf(original_name, "%03d_%c_.%c", c, c, c);
+ sanitize_name(original_name, sanitized_icon_name, FALSE);
+
+ sprintf(buf, "[AddItem(notepad,\"Notepad%s\")]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group3/Notepad%s.lnk", sanitized_icon_name);
+ todo_wine_if(c == '.') ok(check_exists(buf) || broken(c == '.') /* XP */, "link not created\n");
+ if (!check_exists(buf))
+ {
+ winetest_pop_context();
+ continue;
+ }
+
+ if (is_unsanitary(c))
+ {
+ sprintf(buf, "[ReplaceItem(\"Notepad%s\")]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %#x\n", error);
+ sprintf(buf, "Group3/Notepad%s.lnk", sanitized_icon_name);
+ ok(check_exists(buf), "link should still exist\n");
+
+ sprintf(buf, "[DeleteItem(\"Notepad%s\")]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %#x\n", error);
+ sprintf(buf, "Group3/Notepad%s.lnk", sanitized_icon_name);
+ ok(check_exists(buf), "link should still exist\n");
+ }
+ else
+ {
+ sprintf(buf, "[ReplaceItem(\"Notepad%s\")]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group3/Notepad%s.lnk", sanitized_icon_name);
+ ok(!check_exists(buf), "link should not exist\n");
+
+ sprintf(buf, "[AddItem(notepad,\"Notepad%s\")]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group3/Notepad%s.lnk", sanitized_icon_name);
+ ok(check_exists(buf), "link not created\n");
+
+ sprintf(buf, "[DeleteItem(\"Notepad%s\")]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group3/Notepad%s.lnk", sanitized_icon_name);
+ ok(!check_exists(buf), "link should not exist\n");
+ }
+
+ winetest_pop_context();
+ }
+
+ error = dde_execute(instance, hConv, "[DeleteGroup(Group3)]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ ok(!check_exists("Group3"), "directory should not exist\n");
+
+ for (i = 0; i < sizeof(test_chars) - 1; i++)
+ {
+ c = test_chars[i];
+ winetest_push_context("char %d '%c'", c, c);
+
+ sprintf(original_name, "%03d_%c_.%c", c, c, c);
+ sanitize_name(original_name, sanitized_group_name, TRUE);
+ sanitize_name(original_name, sanitized_icon_name, FALSE);
+
+ sprintf(buf, "[CreateGroup(\"Group%s\")]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group%s", sanitized_group_name);
+ ok(check_exists(buf), "directory not created\n");
+ ok(check_window_exists(buf) || broken(c == ' ') /* vista */, "window not created\n");
+
+ sprintf(buf, "[ShowGroup(\"Group%s\", 0)]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group%s", sanitized_group_name);
+ ok(check_window_exists(buf) || broken(c == ' ') /* vista */, "window not created\n");
+
+ /* Test unsanitary group name with sanitary icon name */
+
+ error = dde_execute(instance, hConv, "[AddItem(notepad,Notepad)]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group%s/Notepad.lnk", sanitized_group_name);
+ if (c == ' ')
+ {
+ /* Although no error is reported, no icon is created if the group name ends in a space */
+ ok(!check_exists(buf), "link should not exist\n");
+ goto delete_group;
+ }
+ todo_wine_if(c == '.') ok(check_exists(buf), "link not created\n");
+
+ error = dde_execute(instance, hConv, "[ReplaceItem(Notepad)]");
+ todo_wine_if(c == '.') ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group%s/Notepad.lnk", sanitized_group_name);
+ ok(!check_exists(buf), "link should not exist\n");
+
+ error = dde_execute(instance, hConv, "[AddItem(notepad,Notepad)]");
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group%s/Notepad.lnk", sanitized_group_name);
+ todo_wine_if(c == '.') ok(check_exists(buf), "link not created\n");
+
+ error = dde_execute(instance, hConv, "[DeleteItem(Notepad)]");
+ todo_wine_if(c == '.') ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group%s/Notepad.lnk", sanitized_group_name);
+ ok(!check_exists(buf), "link should not exist\n");
+
+ /* Test unsanitary group name with unsanitary icon name */
+
+ sprintf(buf, "[AddItem(notepad,\"Notepad%s\")]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group%s/Notepad%s.lnk", sanitized_group_name, sanitized_icon_name);
+ todo_wine_if(c == '.') ok(check_exists(buf) || broken(c == '.') /* XP */, "link not created\n");
+ if (!check_exists(buf)) goto delete_group;
+
+ if (is_unsanitary(c))
+ {
+ sprintf(buf, "[ReplaceItem(\"Notepad%s\")]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %#x\n", error);
+ sprintf(buf, "Group%s/Notepad%s.lnk", sanitized_group_name, sanitized_icon_name);
+ ok(check_exists(buf), "link should still exist\n");
+
+ sprintf(buf, "[DeleteItem(\"Notepad%s\")]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NOTPROCESSED, "expected DMLERR_NOTPROCESSED, got %#x\n", error);
+ sprintf(buf, "Group%s/Notepad%s.lnk", sanitized_group_name, sanitized_icon_name);
+ ok(check_exists(buf), "link should still exist\n");
+ }
+ else
+ {
+ sprintf(buf, "[ReplaceItem(\"Notepad%s\")]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group%s/Notepad%s.lnk", sanitized_group_name, sanitized_icon_name);
+ ok(!check_exists(buf), "link should not exist\n");
+
+ sprintf(buf, "[AddItem(notepad,\"Notepad%s\")]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group%s/Notepad%s.lnk", sanitized_group_name, sanitized_icon_name);
+ ok(check_exists(buf), "link not created\n");
+
+ sprintf(buf, "[DeleteItem(\"Notepad%s\")]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group%s/Notepad%s.lnk", sanitized_group_name, sanitized_icon_name);
+ ok(!check_exists(buf), "link should not exist\n");
+ }
+
+delete_group:
+ sprintf(buf, "[DeleteGroup(\"Group%s\")]", original_name);
+ error = dde_execute(instance, hConv, buf);
+ ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error);
+ sprintf(buf, "Group%s", sanitized_group_name);
+ ok(!check_exists(buf), "directory should not exist\n");
+
+ winetest_pop_context();
+ }
+}
+
START_TEST(progman_dde)
{
DWORD instance = 0;
@@ -479,6 +794,7 @@ START_TEST(progman_dde)
/* Run Tests */
test_progman_dde2(instance, hConv);
+ test_name_sanitization(instance, hConv);
/* Cleanup & Exit */
ret = DdeDisconnect(hConv);
--
2.35.1
2
1
[PATCH 1/2] windows.gaming.input: Return correct error from DllGetActivationFactory.
by Rémi Bernon March 11, 2022
by Rémi Bernon March 11, 2022
March 11, 2022
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
dlls/windows.gaming.input/main.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/windows.gaming.input/main.c b/dlls/windows.gaming.input/main.c
index c5b7f19c987..1ddd3a8fd23 100644
--- a/dlls/windows.gaming.input/main.c
+++ b/dlls/windows.gaming.input/main.c
@@ -169,7 +169,6 @@ HRESULT WINAPI DllGetActivationFactory( HSTRING class_str, IActivationFactory **
{
static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
const WCHAR *buffer = WindowsGetStringRawBuffer( class_str, NULL );
- HRESULT hr = REGDB_E_CLASSNOTREG;
TRACE( "class %s, factory %p.\n", debugstr_w(buffer), factory );
@@ -178,13 +177,14 @@ HRESULT WINAPI DllGetActivationFactory( HSTRING class_str, IActivationFactory **
*factory = NULL;
if (!wcscmp( buffer, RuntimeClass_Windows_Gaming_Input_RawGameController ))
- hr = ICustomGameControllerFactory_QueryInterface( controller_factory, &IID_IActivationFactory, (void **)factory );
+ ICustomGameControllerFactory_QueryInterface( controller_factory, &IID_IActivationFactory, (void **)factory );
if (!wcscmp( buffer, RuntimeClass_Windows_Gaming_Input_Gamepad ))
- hr = ICustomGameControllerFactory_QueryInterface( gamepad_factory, &IID_IActivationFactory, (void **)factory );
+ ICustomGameControllerFactory_QueryInterface( gamepad_factory, &IID_IActivationFactory, (void **)factory );
if (!wcscmp( buffer, RuntimeClass_Windows_Gaming_Input_Custom_GameControllerFactoryManager ))
- hr = IGameControllerFactoryManagerStatics2_QueryInterface( manager_factory, &IID_IActivationFactory, (void **)factory );
+ IGameControllerFactoryManagerStatics2_QueryInterface( manager_factory, &IID_IActivationFactory, (void **)factory );
- return hr;
+ if (*factory) return S_OK;
+ return CLASS_E_CLASSNOTAVAILABLE;
}
BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved )
--
2.35.1
1
1
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
---
dlls/nsiproxy.sys/icmp_echo.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/nsiproxy.sys/icmp_echo.c b/dlls/nsiproxy.sys/icmp_echo.c
index f36ff156bef..5f2b776745a 100644
--- a/dlls/nsiproxy.sys/icmp_echo.c
+++ b/dlls/nsiproxy.sys/icmp_echo.c
@@ -709,6 +709,7 @@ static NTSTATUS recv_msg( struct icmp_data *data, struct icmp_listen_params *par
TRACE( "recvmsg() rets %d errno %d addr_len %d iovlen %d msg_flags %x\n",
recvd, errno, msg.msg_namelen, (int)iov[0].iov_len, msg.msg_flags );
+ if (recvd < 0) goto skip;
if (!data->ops->parse_ip_hdr( &msg, recvd, &ip_hdr_len, &ctx )) goto skip;
if (recvd < ip_hdr_len + sizeof(*icmp_hdr)) goto skip;
2
1
March 11, 2022
From: Eric Pouech <eric.pouech(a)gmail.com>
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/nsiproxy.sys/icmp_echo.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/nsiproxy.sys/icmp_echo.c b/dlls/nsiproxy.sys/icmp_echo.c
index f36ff156bef..5f2b776745a 100644
--- a/dlls/nsiproxy.sys/icmp_echo.c
+++ b/dlls/nsiproxy.sys/icmp_echo.c
@@ -709,6 +709,7 @@ static NTSTATUS recv_msg( struct icmp_data *data, struct icmp_listen_params *par
TRACE( "recvmsg() rets %d errno %d addr_len %d iovlen %d msg_flags %x\n",
recvd, errno, msg.msg_namelen, (int)iov[0].iov_len, msg.msg_flags );
+ if (recvd < 0) goto skip;
if (!data->ops->parse_ip_hdr( &msg, recvd, &ip_hdr_len, &ctx )) goto skip;
if (recvd < ip_hdr_len + sizeof(*icmp_hdr)) goto skip;
--
2.23.0
1
0
[PATCH] dlls/user32/tests: enable compilation with long types (resource.c)
by Eric Pouech March 11, 2022
by Eric Pouech March 11, 2022
March 11, 2022
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
---
dlls/user32/tests/resource.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/dlls/user32/tests/resource.c b/dlls/user32/tests/resource.c
index 5d4c4e2f968..904a1f43fab 100644
--- a/dlls/user32/tests/resource.c
+++ b/dlls/user32/tests/resource.c
@@ -17,6 +17,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
#include <assert.h>
#include <windows.h>
@@ -51,10 +52,10 @@ static void test_LoadStringW(void)
return;
}
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(length2 > 0, "LoadStringW failed to load resource 2, ret %d, err %ld\n", length2, GetLastError());
ok(length1 == length2, "LoadStringW returned different values dependent on buflen. ret1 %d, ret2 %d\n",
length1, length2);
- ok(length1 > 0 && resourcepointer != NULL, "LoadStringW failed to get pointer to resource 2, ret %d, err %d\n",
+ ok(length1 > 0 && resourcepointer != NULL, "LoadStringW failed to get pointer to resource 2, ret %d, err %ld\n",
length1, GetLastError());
/* Copy the resource since it is not '\0' terminated, and add '\0' to the end */
@@ -109,22 +110,22 @@ static void test_LoadStringA (void)
}
ret = LoadStringA(hInst, 1, buf, sizeof(buf) );
- ok( ret > 0, "LoadString failed: ret %d err %d\n", ret, GetLastError());
+ ok( ret > 0, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
ret2 = LoadStringA( hInst, MAKELONG( 1, 0x8000 ), buf, sizeof(buf));
- ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
+ ok( ret2 == ret, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
ret2 = LoadStringA( hInst, MAKELONG( 1, 0xffff ), buf, sizeof(buf));
- ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
+ ok( ret2 == ret, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
ret = LoadStringA(hInst, 65534, buf, sizeof(buf) );
- ok( ret > 0, "LoadString failed: ret %d err %d\n", ret, GetLastError());
+ ok( ret > 0, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
ret2 = LoadStringA( hInst, MAKELONG( 65534, 0x8000 ), buf, sizeof(buf));
- ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
+ ok( ret2 == ret, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
ret2 = LoadStringA( hInst, MAKELONG( 65534, 0xffff ), buf, sizeof(buf));
- ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
+ ok( ret2 == ret, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
ret = LoadStringA(hInst, 0, buf, 0);
ok( ret == -1 || broken(ret == 0),
- "LoadStringA did not return -1 when called with buflen = 0, got %d, err %d\n",
+ "LoadStringA did not return -1 when called with buflen = 0, got %d, err %ld\n",
ret, GetLastError());
SetLastError(0xdeadbeef);
@@ -132,7 +133,7 @@ static void test_LoadStringA (void)
ret = LoadStringA(hInst, 1, buf, 1);
ok( !ret, "LoadString returned %d\n", ret);
ok( buf[0] == 0, "buf[0] = %c (%x)\n", buf[0], buf[0]);
- ok( GetLastError() == 0xdeadbeef, "GetLastError() = %d\n", GetLastError());
+ ok( GetLastError() == 0xdeadbeef, "GetLastError() = %ld\n", GetLastError());
}
static void test_accel1(void)
1
0
[PATCH] dlls/user32/tests: enable compilation with long types (listbox.c)
by Eric Pouech March 11, 2022
by Eric Pouech March 11, 2022
March 11, 2022
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
---
dlls/user32/tests/listbox.c | 211 ++++++++++++++++++++++---------------------
1 file changed, 106 insertions(+), 105 deletions(-)
diff --git a/dlls/user32/tests/listbox.c b/dlls/user32/tests/listbox.c
index cb2551002d6..75acd4baddc 100644
--- a/dlls/user32/tests/listbox.c
+++ b/dlls/user32/tests/listbox.c
@@ -16,6 +16,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
#include <assert.h>
#include <stdarg.h>
@@ -128,7 +129,7 @@ keypress (HWND handle, WPARAM keycode, BYTE scancode, BOOL extended)
}
#define listbox_field_ok(t, s, f, got) \
- ok (t.s.f==got.f, "style %#x, step " #s ", field " #f \
+ ok (t.s.f==got.f, "style %#lx, step " #s ", field " #f \
": expected %d, got %d\n", style, t.s.f, got.f)
#define listbox_todo_field_ok(t, s, f, got) \
@@ -223,7 +224,7 @@ static void check_item_height(void)
ok (SendMessageA(hLB, WM_SETFONT, (WPARAM)font, 0) == 0, "Can't set font\n");
itemHeight = SendMessageA(hLB, LB_GETITEMHEIGHT, 0, 0);
- ok (itemHeight == tm.tmHeight, "Item height wrong, got %d, expecting %d\n", itemHeight, tm.tmHeight);
+ ok (itemHeight == tm.tmHeight, "Item height wrong, got %d, expecting %ld\n", itemHeight, tm.tmHeight);
DestroyWindow (hLB);
@@ -249,7 +250,7 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
DWORD style = GetWindowLongA(GetWindow(hwnd, GW_CHILD), GWL_STYLE);
MEASUREITEMSTRUCT *mi = (void*)lparam;
- ok(wparam == mi->CtlID, "got wParam=%08lx, expected %08x\n", wparam, mi->CtlID);
+ ok(wparam == mi->CtlID, "got wParam=%08Ix, expected %08x\n", wparam, mi->CtlID);
ok(mi->CtlType == ODT_LISTBOX, "mi->CtlType = %u\n", mi->CtlType);
ok(mi->CtlID == 1, "mi->CtlID = %u\n", mi->CtlID);
ok(mi->itemHeight, "mi->itemHeight = 0\n");
@@ -265,7 +266,7 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
else
{
ok((void*)mi->itemData == strings[mi->itemID],
- "mi->itemData = %08lx, expected %p\n", mi->itemData, strings[mi->itemID]);
+ "mi->itemData = %08Ix, expected %p\n", mi->itemData, strings[mi->itemID]);
}
break;
}
@@ -274,9 +275,9 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
RECT rc_item, rc_client, rc_clip;
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lparam;
- trace("%p WM_DRAWITEM %08lx %08lx\n", hwnd, wparam, lparam);
+ trace("%p WM_DRAWITEM %08Ix %08Ix\n", hwnd, wparam, lparam);
- ok(wparam == dis->CtlID, "got wParam=%08lx instead of %08x\n",
+ ok(wparam == dis->CtlID, "got wParam=%08Ix instead of %08x\n",
wparam, dis->CtlID);
ok(dis->CtlType == ODT_LISTBOX, "wrong CtlType %04x\n", dis->CtlType);
@@ -386,14 +387,14 @@ static void test_ownerdraw(void)
SendMessageA(hLB, LB_GETITEMRECT, 0, (LPARAM)&rc);
trace("item 0 rect %s\n", wine_dbgstr_rect(&rc));
ok(!IsRectEmpty(&rc), "empty item rect\n");
- ok(rc.top < 0, "rc.top is not negative (%d)\n", rc.top);
+ ok(rc.top < 0, "rc.top is not negative (%ld)\n", rc.top);
DestroyWindow(hLB);
/* Both FIXED and VARIABLE, FIXED should override VARIABLE. */
hLB = CreateWindowA("listbox", "TestList", LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE | styles[i],
0, 0, 100, 100, NULL, NULL, NULL, 0);
- ok(hLB != NULL, "last error 0x%08x\n", GetLastError());
+ ok(hLB != NULL, "last error 0x%08lx\n", GetLastError());
ok(GetWindowLongA(hLB, GWL_STYLE) & LBS_OWNERDRAWVARIABLE, "Unexpected window style.\n");
@@ -785,70 +786,70 @@ static void test_changing_selection_styles(void)
for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
{
ret = SendMessageA(listbox, LB_INSERTSTRING, -1, (LPARAM)"x");
- ok(ret == k, "%u: Unexpected return value %d, expected %d.\n", j, ret, k);
+ ok(ret == k, "%u: Unexpected return value %ld, expected %d.\n", j, ret, k);
}
ret = SendMessageA(listbox, LB_GETCOUNT, 0, 0);
- ok(ret == ARRAY_SIZE(selexpect_multi), "%u: Unexpected count %d.\n", j, ret);
+ ok(ret == ARRAY_SIZE(selexpect_multi), "%u: Unexpected count %ld.\n", j, ret);
/* Select items with different methods */
ret = SendMessageA(listbox, LB_SETCURSEL, 2, 0);
- ok(ret == setcursel_expect, "%u: Unexpected return value %d.\n", j, ret);
+ ok(ret == setcursel_expect, "%u: Unexpected return value %ld.\n", j, ret);
ret = SendMessageA(listbox, LB_SELITEMRANGE, TRUE, MAKELPARAM(0, 0));
- ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
+ ok(ret == selitemrange_expect, "%u: Unexpected return value %ld.\n", j, ret);
ret = SendMessageA(listbox, LB_SELITEMRANGE, TRUE, MAKELPARAM(2, 2));
- ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
+ ok(ret == selitemrange_expect, "%u: Unexpected return value %ld.\n", j, ret);
/* Verify that the proper items are selected */
for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
{
ret = SendMessageA(listbox, LB_GETSEL, k, 0);
- ok(ret == selexpect[k], "%u: Unexpected selection state %d, expected %d.\n",
+ ok(ret == selexpect[k], "%u: Unexpected selection state %ld, expected %ld.\n",
j, ret, selexpect[k]);
}
/* Now change the selection style */
style = GetWindowLongA(listbox, GWL_STYLE);
ok((style & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == selstyles[j],
- "%u: unexpected window styles %#x.\n", j, style);
+ "%u: unexpected window styles %#lx.\n", j, style);
if (selstyles[j] & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL))
style &= ~selstyles[j];
else
style |= LBS_MULTIPLESEL | LBS_EXTENDEDSEL;
SetWindowLongA(listbox, GWL_STYLE, style);
style = GetWindowLongA(listbox, GWL_STYLE);
- ok(!(style & selstyles[j]), "%u: unexpected window styles %#x.\n", j, style);
+ ok(!(style & selstyles[j]), "%u: unexpected window styles %#lx.\n", j, style);
/* Verify that the same items are selected */
ret = SendMessageA(listbox, LB_GETSELCOUNT, 0, 0);
- ok(ret == getselcount_expect, "%u: expected %d from LB_GETSELCOUNT, got %d\n",
+ ok(ret == getselcount_expect, "%u: expected %ld from LB_GETSELCOUNT, got %ld\n",
j, getselcount_expect, ret);
for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
{
ret = SendMessageA(listbox, LB_GETSEL, k, 0);
- ok(ret == selexpect[k], "%u: Unexpected selection state %d, expected %d.\n",
+ ok(ret == selexpect[k], "%u: Unexpected selection state %ld, expected %ld.\n",
j, ret, selexpect[k]);
}
/* Lastly see if we can still change the selection as before with old style */
if (setcursel_expect != LB_ERR) setcursel_expect = 0;
ret = SendMessageA(listbox, LB_SETCURSEL, 0, 0);
- ok(ret == setcursel_expect, "%u: Unexpected return value %d.\n", j, ret);
+ ok(ret == setcursel_expect, "%u: Unexpected return value %ld.\n", j, ret);
ret = SendMessageA(listbox, LB_SELITEMRANGE, TRUE, MAKELPARAM(1, 1));
- ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
+ ok(ret == selitemrange_expect, "%u: Unexpected return value %ld.\n", j, ret);
ret = SendMessageA(listbox, LB_SELITEMRANGE, FALSE, MAKELPARAM(2, 2));
- ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
+ ok(ret == selitemrange_expect, "%u: Unexpected return value %ld.\n", j, ret);
/* And verify the selections */
selexpect = (selstyles[j] & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) ? selexpect_multi2 : selexpect_single2;
ret = SendMessageA(listbox, LB_GETSELCOUNT, 0, 0);
- ok(ret == getselcount_expect, "%u: expected %d from LB_GETSELCOUNT, got %d\n",
+ ok(ret == getselcount_expect, "%u: expected %ld from LB_GETSELCOUNT, got %ld\n",
j, getselcount_expect, ret);
for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
{
ret = SendMessageA(listbox, LB_GETSEL, k, 0);
- ok(ret == selexpect[k], "%u: Unexpected selection state %d, expected %d.\n",
+ ok(ret == selexpect[k], "%u: Unexpected selection state %ld, expected %ld.\n",
j, ret, selexpect[k]);
}
@@ -872,13 +873,13 @@ static void test_itemfrompoint(void)
/* For an empty listbox win2k returns 0x1ffff, win98 returns 0x10000, nt4 returns 0xffffffff */
r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( /* x */ 30, /* y */ 30 ));
- ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %x\n", r );
+ ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %lx\n", r );
r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( 700, 30 ));
- ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %x\n", r );
+ ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %lx\n", r );
r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( 30, 300 ));
- ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %x\n", r );
+ ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %lx\n", r );
id = SendMessageA( hList, LB_ADDSTRING, 0, (LPARAM) "hi");
ok( id == 0, "item id wrong\n");
@@ -886,17 +887,17 @@ static void test_itemfrompoint(void)
ok( id == 1, "item id wrong\n");
r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( /* x */ 30, /* y */ 30 ));
- ok( r == 0x1, "ret %x\n", r );
+ ok( r == 0x1, "ret %lx\n", r );
r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( /* x */ 30, /* y */ 601 ));
ok( r == 0x10001 || broken(r == 1), /* nt4 */
- "ret %x\n", r );
+ "ret %lx\n", r );
/* Resize control so that below assertions about sizes are valid */
r = SendMessageA( hList, LB_GETITEMRECT, 0, (LPARAM)&rc);
- ok( r == 1, "ret %x\n", r);
+ ok( r == 1, "ret %lx\n", r);
r = MoveWindow(hList, 1, 1, 600, (rc.bottom - rc.top + 1) * 9 / 2, TRUE);
- ok( r != 0, "ret %x\n", r);
+ ok( r != 0, "ret %lx\n", r);
id = SendMessageA( hList, LB_ADDSTRING, 0, (LPARAM) "hi2");
ok( id == 2, "item id wrong\n");
@@ -916,31 +917,31 @@ static void test_itemfrompoint(void)
SendMessageA( hList, LB_SETTOPINDEX, 1, 0);
r = SendMessageA( hList, LB_GETTOPINDEX, 0, 0);
- ok( r == 1, "top %d\n", r);
+ ok( r == 1, "top %ld\n", r);
r = SendMessageA( hList, LB_GETITEMRECT, 5, (LPARAM)&rc);
- ok( r == 1, "ret %x\n", r);
+ ok( r == 1, "ret %lx\n", r);
r = SendMessageA( hList, LB_GETITEMRECT, 6, (LPARAM)&rc);
- ok( r == 0, "ret %x\n", r);
+ ok( r == 0, "ret %lx\n", r);
r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(/* x */ 10, /* y */ 10) );
- ok( r == 1, "ret %x\n", r);
+ ok( r == 1, "ret %lx\n", r);
r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(1000, 10) );
ok( r == 0x10001 || broken(r == 1), /* nt4 */
- "ret %x\n", r );
+ "ret %lx\n", r );
r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(10, -10) );
ok( r == 0x10001 || broken(r == 1), /* nt4 */
- "ret %x\n", r );
+ "ret %lx\n", r );
r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(10, 100) );
ok( r == 0x10005 || broken(r == 5), /* nt4 */
- "item %x\n", r );
+ "item %lx\n", r );
r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(10, 200) );
ok( r == 0x10005 || broken(r == 5), /* nt4 */
- "item %x\n", r );
+ "item %lx\n", r );
DestroyWindow( hList );
}
@@ -993,7 +994,7 @@ static void test_listbox_LB_DIR(void)
ok(ret, "Failed to create test directory.\n");
file = CreateFileA( "wtest1.tmp.c", GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL );
- ok(file != INVALID_HANDLE_VALUE, "Error creating the test file: %d\n", GetLastError());
+ ok(file != INVALID_HANDLE_VALUE, "Error creating the test file: %ld\n", GetLastError());
CloseHandle( file );
/* NOTE: for this test to succeed, there must be no subdirectories
@@ -1017,7 +1018,7 @@ static void test_listbox_LB_DIR(void)
strcpy(pathBuffer, wildcard);
res = SendMessageA(hList, LB_DIR, 0, (LPARAM)pathBuffer);
}
- ok (res >= 0, "SendMessage(LB_DIR, 0, *) failed - 0x%08x\n", GetLastError());
+ ok (res >= 0, "SendMessage(LB_DIR, 0, *) failed - 0x%08lx\n", GetLastError());
/* There should be some content in the listbox */
itemCount = SendMessageA(hList, LB_GETCOUNT, 0, 0);
@@ -1044,7 +1045,7 @@ static void test_listbox_LB_DIR(void)
strcpy(pathBuffer, "w*.c");
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
res = SendMessageA(hList, LB_DIR, 0, (LPARAM)pathBuffer);
- ok (res >= 0, "SendMessage(LB_DIR, 0, w*.c) failed - 0x%08x\n", GetLastError());
+ ok (res >= 0, "SendMessage(LB_DIR, 0, w*.c) failed - 0x%08lx\n", GetLastError());
/* Path specification does NOT converted to uppercase */
ok (!strcmp(pathBuffer, "w*.c"),
@@ -1072,7 +1073,7 @@ static void test_listbox_LB_DIR(void)
strcpy(pathBuffer, wildcard);
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY, (LPARAM)pathBuffer);
- ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY, *) failed - 0x%08x\n", GetLastError());
+ ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY, *) failed - 0x%08lx\n", GetLastError());
/* There should be some content in the listbox.
* All files plus "[..]"
@@ -1101,7 +1102,7 @@ static void test_listbox_LB_DIR(void)
strcpy(pathBuffer, "w*.c");
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY, (LPARAM)pathBuffer);
- ok (res >= 0, "SendMessage(LB_DIR, DDL_DIRECTORY, w*.c) failed - 0x%08x\n", GetLastError());
+ ok (res >= 0, "SendMessage(LB_DIR, DDL_DIRECTORY, w*.c) failed - 0x%08lx\n", GetLastError());
/* There should be some content in the listbox. Since the parent directory does not
* fit w*.c, there should be exactly the same number of items as without DDL_DIRECTORY
@@ -1130,7 +1131,7 @@ static void test_listbox_LB_DIR(void)
strcpy(pathBuffer, wildcard);
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
res = SendMessageA(hList, LB_DIR, DDL_DRIVES|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
- ok (res >= 0, "SendMessage(LB_DIR, DDL_DRIVES|DDL_EXCLUSIVE, *) failed - 0x%08x\n", GetLastError());
+ ok (res >= 0, "SendMessage(LB_DIR, DDL_DRIVES|DDL_EXCLUSIVE, *) failed - 0x%08lx\n", GetLastError());
/* There should be some content in the listbox. In particular, there should
* be at least one element before, since the string "[-c-]" should
@@ -1177,7 +1178,7 @@ static void test_listbox_LB_DIR(void)
strcpy(pathBuffer, wildcard);
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
res = SendMessageA(hList, LB_DIR, DDL_DRIVES, (LPARAM)pathBuffer);
- ok (res > 0, "SendMessage(LB_DIR, DDL_DRIVES, *) failed - 0x%08x\n", GetLastError());
+ ok (res > 0, "SendMessage(LB_DIR, DDL_DRIVES, *) failed - 0x%08lx\n", GetLastError());
/* There should be some content in the listbox. In particular, there should
* be at least one element before, since the string "[-c-]" should
@@ -1205,7 +1206,7 @@ static void test_listbox_LB_DIR(void)
strcpy(pathBuffer, "w*.c");
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
res = SendMessageA(hList, LB_DIR, DDL_DRIVES, (LPARAM)pathBuffer);
- ok (res > 0, "SendMessage(LB_DIR, DDL_DRIVES, w*.c) failed - 0x%08x\n", GetLastError());
+ ok (res > 0, "SendMessage(LB_DIR, DDL_DRIVES, w*.c) failed - 0x%08lx\n", GetLastError());
/* There should be some content in the listbox. In particular, there should
* be at least one element before, since the string "[-c-]" should
@@ -1240,7 +1241,7 @@ static void test_listbox_LB_DIR(void)
strcpy(pathBuffer, wildcard);
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES, (LPARAM)pathBuffer);
- ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, *) failed - 0x%08x\n", GetLastError());
+ ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, *) failed - 0x%08lx\n", GetLastError());
/* There should be some content in the listbox. In particular, there should
* be exactly the number of plain files, plus the number of mapped drives.
@@ -1280,7 +1281,7 @@ static void test_listbox_LB_DIR(void)
strcpy(pathBuffer, "w*.c");
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES, (LPARAM)pathBuffer);
- ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, w*.c) failed - 0x%08x\n", GetLastError());
+ ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, w*.c) failed - 0x%08lx\n", GetLastError());
/* There should be some content in the listbox. In particular, there should
* be exactly the number of plain files, plus the number of mapped drives.
@@ -1314,7 +1315,7 @@ static void test_listbox_LB_DIR(void)
strcpy(pathBuffer, wildcard);
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
- ok (res != -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, *) failed err %u\n", GetLastError());
+ ok (res != -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, *) failed err %lu\n", GetLastError());
itemCount = SendMessageA(hList, LB_GETCOUNT, 0, 0);
ok (itemCount == itemCount_allDirs,
@@ -1356,7 +1357,7 @@ static void test_listbox_LB_DIR(void)
strcpy(pathBuffer, wildcard);
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
- ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, w*.c,) failed - 0x%08x\n", GetLastError());
+ ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, w*.c,) failed - 0x%08lx\n", GetLastError());
/* There should be no plain files on the listbox */
itemCount = SendMessageA(hList, LB_GETCOUNT, 0, 0);
@@ -1391,7 +1392,7 @@ static void test_listbox_LB_DIR(void)
strcpy(pathBuffer, "w*.c");
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
- ok (res >= 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, w*.c,) failed - 0x%08x\n", GetLastError());
+ ok (res >= 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, w*.c,) failed - 0x%08lx\n", GetLastError());
/* There should be no plain files on the listbox, and no [..], since it does not fit w*.c */
itemCount = SendMessageA(hList, LB_GETCOUNT, 0, 0);
@@ -1497,7 +1498,7 @@ static void test_listbox_dlgdir(void)
HANDLE file;
file = CreateFileA( "wtest1.tmp.c", GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL );
- ok(file != INVALID_HANDLE_VALUE, "Error creating the test file: %d\n", GetLastError());
+ ok(file != INVALID_HANDLE_VALUE, "Error creating the test file: %ld\n", GetLastError());
CloseHandle( file );
/* NOTE: for this test to succeed, there must be no subdirectories
@@ -1524,7 +1525,7 @@ static void test_listbox_dlgdir(void)
*/
strcpy(pathBuffer, "w*.c");
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL, 0);
- ok (res == 1, "DlgDirList(*.c, 0) returned %d - expected 1 - 0x%08x\n", res, GetLastError());
+ ok (res == 1, "DlgDirList(*.c, 0) returned %d - expected 1 - 0x%08lx\n", res, GetLastError());
/* Path specification gets converted to uppercase */
ok (!strcmp(pathBuffer, "W*.C"),
@@ -1562,7 +1563,7 @@ static void test_listbox_dlgdir(void)
strcpy(pathBuffer, "w*.c");
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
DDL_DIRECTORY);
- ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY) failed - 0x%08x\n", GetLastError());
+ ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY) failed - 0x%08lx\n", GetLastError());
/* There should be some content in the listbox. In particular, there should
* be exactly more elements than before, since the directories should
@@ -1609,7 +1610,7 @@ static void test_listbox_dlgdir(void)
strcpy(pathBuffer, "w*.c");
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
DDL_DRIVES);
- ok (res == 1, "DlgDirList(*.c, DDL_DRIVES) failed - 0x%08x\n", GetLastError());
+ ok (res == 1, "DlgDirList(*.c, DDL_DRIVES) failed - 0x%08lx\n", GetLastError());
/* There should be some content in the listbox. In particular, there should
* be at least one element before, since the string "[-c-]" should
@@ -1651,7 +1652,7 @@ static void test_listbox_dlgdir(void)
strcpy(pathBuffer, "w*.c");
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
DDL_DIRECTORY|DDL_DRIVES);
- ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_DRIVES) failed - 0x%08x\n", GetLastError());
+ ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_DRIVES) failed - 0x%08lx\n", GetLastError());
/* There should be some content in the listbox. In particular, there should
* be exactly the number of plain files, plus the number of mapped drives,
@@ -1698,7 +1699,7 @@ static void test_listbox_dlgdir(void)
strcpy(pathBuffer, "w*.c");
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
DDL_DIRECTORY|DDL_EXCLUSIVE);
- ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_EXCLUSIVE) failed - 0x%08x\n", GetLastError());
+ ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_EXCLUSIVE) failed - 0x%08lx\n", GetLastError());
/* There should be exactly one element: "[..]" */
itemCount = SendMessageA(g_listBox, LB_GETCOUNT, 0, 0);
@@ -1727,7 +1728,7 @@ static void test_listbox_dlgdir(void)
strcpy(pathBuffer, "w*.c");
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE);
- ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE) failed - 0x%08x\n", GetLastError());
+ ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE) failed - 0x%08lx\n", GetLastError());
/* There should be no plain files on the listbox */
itemCount = SendMessageA(g_listBox, LB_GETCOUNT, 0, 0);
@@ -1762,14 +1763,14 @@ static void test_listbox_dlgdir(void)
strcpy(pathBuffer, "*");
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
DDL_DIRECTORY|DDL_DRIVES);
- ok (res != 0, "DlgDirList(*, DDL_DIRECTORY|DDL_DRIVES) failed - 0x%08x\n", GetLastError());
+ ok (res != 0, "DlgDirList(*, DDL_DIRECTORY|DDL_DRIVES) failed - 0x%08lx\n", GetLastError());
SendMessageA(g_listBox, LB_SETCURSEL, -1, 0); /* Unselect any current selection */
memset(pathBuffer, 0, MAX_PATH);
SetLastError(0xdeadbeef);
res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
ok (GetLastError() == 0xdeadbeef,
- "DlgDirSelectEx() with no selection modified last error code from 0xdeadbeef to 0x%08x\n",
+ "DlgDirSelectEx() with no selection modified last error code from 0xdeadbeef to 0x%08lx\n",
GetLastError());
ok (res == 0, "DlgDirSelectEx() with no selection returned %d, expected 0\n", res);
/* WinXP-SP2 leaves pathBuffer untouched, but Win98 fills it with garbage. */
@@ -1791,7 +1792,7 @@ static void test_listbox_dlgdir(void)
SetLastError(0xdeadbeef);
res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
ok (GetLastError() == 0xdeadbeef,
- "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
+ "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
i, GetLastError());
ok(res == 1, "DlgDirSelectEx() thinks %s (%s) is not a drive/directory!\n", itemBuffer, pathBuffer);
@@ -1803,7 +1804,7 @@ static void test_listbox_dlgdir(void)
SetLastError(0xdeadbeef);
res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
ok (GetLastError() == 0xdeadbeef,
- "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
+ "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
i, GetLastError());
ok(res == 1, "DlgDirSelectEx() thinks %s (%s) is not a drive/directory!\n", itemBuffer, pathBuffer);
@@ -1820,7 +1821,7 @@ static void test_listbox_dlgdir(void)
SetLastError(0xdeadbeef);
res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
ok (GetLastError() == 0xdeadbeef,
- "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
+ "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
i, GetLastError());
ok(res == 0, "DlgDirSelectEx() thinks %s (%s) is a drive/directory!\n", itemBuffer, pathBuffer);
@@ -1854,7 +1855,7 @@ static void test_listbox_dlgdir(void)
SetLastError(0xdeadbeef);
res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
ok (GetLastError() == 0xdeadbeef,
- "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
+ "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
i, GetLastError());
ok(res == 1, "DlgDirSelectEx() thinks %s (%s) is not a drive/directory!\n", itemBuffer, pathBuffer);
@@ -1866,7 +1867,7 @@ static void test_listbox_dlgdir(void)
SetLastError(0xdeadbeef);
res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
ok (GetLastError() == 0xdeadbeef,
- "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
+ "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
i, GetLastError());
ok(res == 1, "DlgDirSelectEx() thinks %s (%s) is not a drive/directory!\n", itemBuffer, pathBuffer);
@@ -1883,7 +1884,7 @@ static void test_listbox_dlgdir(void)
SetLastError(0xdeadbeef);
res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
ok (GetLastError() == 0xdeadbeef,
- "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
+ "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
i, GetLastError());
ok(res == 0, "DlgDirSelectEx() thinks %s (%s) is a drive/directory!\n", itemBuffer, pathBuffer);
@@ -1915,7 +1916,7 @@ static void test_listbox_dlgdir(void)
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
ok(!res, "DlgDirList should have failed with 0 but %d was returned\n", res);
ok(GetLastError() == ERROR_NO_WILDCARD_CHARACTERS,
- "GetLastError should return 0x589, got 0x%X\n",GetLastError());
+ "GetLastError should return 0x589, got 0x%lX\n",GetLastError());
DestroyWindow(hWnd);
}
@@ -1940,9 +1941,9 @@ static void test_set_count( void )
ok( IsRectEmpty( &r ), "got non-empty rect\n");
ret = SendMessageA( listbox, LB_SETCOUNT, 100, 0 );
- ok( ret == 0, "got %d\n", ret );
+ ok( ret == 0, "got %ld\n", ret );
ret = SendMessageA( listbox, LB_GETCOUNT, 0, 0 );
- ok( ret == 100, "got %d\n", ret );
+ ok( ret == 100, "got %ld\n", ret );
GetUpdateRect( listbox, &r, TRUE );
ok( !IsRectEmpty( &r ), "got empty rect\n");
@@ -1952,15 +1953,15 @@ static void test_set_count( void )
ok( IsRectEmpty( &r ), "got non-empty rect\n");
ret = SendMessageA( listbox, LB_SETCOUNT, 99, 0 );
- ok( ret == 0, "got %d\n", ret );
+ ok( ret == 0, "got %ld\n", ret );
GetUpdateRect( listbox, &r, TRUE );
ok( !IsRectEmpty( &r ), "got empty rect\n");
ret = SendMessageA( listbox, LB_SETCOUNT, -5, 0 );
- ok( ret == 0, "got %d\n", ret );
+ ok( ret == 0, "got %ld\n", ret );
ret = SendMessageA( listbox, LB_GETCOUNT, 0, 0 );
- ok( ret == -5, "got %d\n", ret );
+ ok( ret == -5, "got %ld\n", ret );
DestroyWindow( listbox );
@@ -1970,8 +1971,8 @@ static void test_set_count( void )
SetLastError( 0xdeadbeef );
ret = SendMessageA( listbox, LB_SETCOUNT, 100, 0 );
- ok( ret == LB_ERR, "expected %d, got %d\n", LB_ERR, ret );
- ok( GetLastError() == ERROR_SETCOUNT_ON_BAD_LB, "Unexpected error %d.\n", GetLastError() );
+ ok( ret == LB_ERR, "expected %d, got %ld\n", LB_ERR, ret );
+ ok( GetLastError() == ERROR_SETCOUNT_ON_BAD_LB, "Unexpected error %ld.\n", GetLastError() );
DestroyWindow( listbox );
}
@@ -2014,7 +2015,7 @@ static void test_GetListBoxInfo(void)
lb_getlistboxinfo = 0;
ret = pGetListBoxInfo(listbox);
- ok(ret > 0, "got %d\n", ret);
+ ok(ret > 0, "got %ld\n", ret);
todo_wine
ok(lb_getlistboxinfo == 0, "got %d\n", lb_getlistboxinfo);
@@ -2040,45 +2041,45 @@ static void test_init_storage( void )
0, 0, 100, 100, parent, (HMENU)1, NULL, 0);
items_size = SendMessageA(listbox, LB_INITSTORAGE, 100, 0);
- ok(items_size >= 100, "expected at least 100, got %d\n", items_size);
+ ok(items_size >= 100, "expected at least 100, got %ld\n", items_size);
ret = SendMessageA(listbox, LB_INITSTORAGE, 0, 0);
- ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
+ ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
/* it doesn't grow since the space was already reserved */
ret = SendMessageA(listbox, LB_INITSTORAGE, items_size, 0);
- ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
+ ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
/* it doesn't shrink the reserved space */
ret = SendMessageA(listbox, LB_INITSTORAGE, 42, 0);
- ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
+ ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
/* now populate almost all of it so it's not reserved anymore */
if (styles[i] & LBS_NODATA)
{
ret = SendMessageA(listbox, LB_SETCOUNT, items_size - 1, 0);
- ok(ret == 0, "unexpected return value %d\n", ret);
+ ok(ret == 0, "unexpected return value %ld\n", ret);
}
else
{
for (j = 0; j < items_size - 1; j++)
{
ret = SendMessageA(listbox, LB_INSERTSTRING, -1, (LPARAM)"");
- ok(ret == j, "expected %d, got %d\n", j, ret);
+ ok(ret == j, "expected %d, got %ld\n", j, ret);
}
}
/* we still have one more reserved slot, so it doesn't grow yet */
ret = SendMessageA(listbox, LB_INITSTORAGE, 1, 0);
- ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
+ ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
/* fill the slot and check again, it should grow this time */
ret = SendMessageA(listbox, LB_INSERTSTRING, -1, (LPARAM)"");
- ok(ret == items_size - 1, "expected %d, got %d\n", items_size - 1, ret);
+ ok(ret == items_size - 1, "expected %ld, got %ld\n", items_size - 1, ret);
ret = SendMessageA(listbox, LB_INITSTORAGE, 0, 0);
- ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
+ ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
ret = SendMessageA(listbox, LB_INITSTORAGE, 1, 0);
- ok(ret > items_size, "expected it to grow past %d, got %d\n", items_size, ret);
+ ok(ret > items_size, "expected it to grow past %ld, got %ld\n", items_size, ret);
DestroyWindow(listbox);
}
@@ -2120,7 +2121,7 @@ static void test_extents(void)
listbox = create_listbox(WS_CHILD | WS_VISIBLE, parent);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
- ok(res == 0, "Got wrong initial horizontal extent: %u\n", res);
+ ok(res == 0, "Got wrong initial horizontal extent: %lu\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
@@ -2135,7 +2136,7 @@ static void test_extents(void)
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
- ok(res == 64, "Got wrong horizontal extent: %u\n", res);
+ ok(res == 64, "Got wrong horizontal extent: %lu\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
@@ -2150,7 +2151,7 @@ static void test_extents(void)
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 184, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
- ok(res == 184, "Got wrong horizontal extent: %u\n", res);
+ ok(res == 184, "Got wrong horizontal extent: %lu\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
@@ -2167,7 +2168,7 @@ static void test_extents(void)
listbox = create_listbox(WS_CHILD | WS_VISIBLE | WS_HSCROLL, parent);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
- ok(res == 0, "Got wrong initial horizontal extent: %u\n", res);
+ ok(res == 0, "Got wrong initial horizontal extent: %lu\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
@@ -2182,7 +2183,7 @@ static void test_extents(void)
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
- ok(res == 64, "Got wrong horizontal extent: %u\n", res);
+ ok(res == 64, "Got wrong horizontal extent: %lu\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
@@ -2197,7 +2198,7 @@ static void test_extents(void)
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 184, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
- ok(res == 184, "Got wrong horizontal extent: %u\n", res);
+ ok(res == 184, "Got wrong horizontal extent: %lu\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
@@ -2211,7 +2212,7 @@ static void test_extents(void)
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 0, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
- ok(res == 0, "Got wrong horizontal extent: %u\n", res);
+ ok(res == 0, "Got wrong horizontal extent: %lu\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
@@ -2228,7 +2229,7 @@ static void test_extents(void)
listbox = create_listbox(WS_CHILD | WS_VISIBLE | WS_HSCROLL | LBS_DISABLENOSCROLL, parent);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
- ok(res == 0, "Got wrong initial horizontal extent: %u\n", res);
+ ok(res == 0, "Got wrong initial horizontal extent: %lu\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
@@ -2243,7 +2244,7 @@ static void test_extents(void)
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
- ok(res == 64, "Got wrong horizontal extent: %u\n", res);
+ ok(res == 64, "Got wrong horizontal extent: %lu\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
@@ -2258,7 +2259,7 @@ static void test_extents(void)
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 184, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
- ok(res == 184, "Got wrong horizontal extent: %u\n", res);
+ ok(res == 184, "Got wrong horizontal extent: %lu\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
@@ -2272,7 +2273,7 @@ static void test_extents(void)
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 0, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
- ok(res == 0, "Got wrong horizontal extent: %u\n", res);
+ ok(res == 0, "Got wrong horizontal extent: %lu\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
@@ -2297,14 +2298,14 @@ static void test_WM_MEASUREITEM(void)
listbox = create_listbox(WS_CHILD | LBS_OWNERDRAWVARIABLE, parent);
data = SendMessageA(listbox, LB_GETITEMDATA, 0, 0);
- ok(data == (LRESULT)strings[0], "data = %08lx, expected %p\n", data, strings[0]);
+ ok(data == (LRESULT)strings[0], "data = %08Ix, expected %p\n", data, strings[0]);
DestroyWindow(parent);
parent = create_parent();
listbox = create_listbox(WS_CHILD | LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS, parent);
data = SendMessageA(listbox, LB_GETITEMDATA, 0, 0);
- ok(!data, "data = %08lx\n", data);
+ ok(!data, "data = %08Ix\n", data);
DestroyWindow(parent);
}
@@ -2375,27 +2376,27 @@ static void test_LBS_NODATA(void)
SetLastError(0xdeadbeef);
ret = SendMessageA(listbox, LB_FINDSTRING, 1, 0);
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
- ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
SetLastError(0xdeadbeef);
ret = SendMessageA(listbox, LB_FINDSTRING, 1, 42);
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
- ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
SetLastError(0xdeadbeef);
ret = SendMessageA(listbox, LB_FINDSTRINGEXACT, 1, 0);
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
- ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
SetLastError(0xdeadbeef);
ret = SendMessageA(listbox, LB_FINDSTRINGEXACT, 1, 42);
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
- ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
SetLastError(0xdeadbeef);
ret = SendMessageA(listbox, LB_SELECTSTRING, 1, 0);
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
- ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
SetLastError(0xdeadbeef);
ret = SendMessageA(listbox, LB_SELECTSTRING, 1, 42);
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
- ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
DestroyWindow(listbox);
@@ -2412,7 +2413,7 @@ static void test_LBS_NODATA(void)
ok(listbox != NULL, "Failed to create a listbox.\n");
style = GetWindowLongA(listbox, GWL_STYLE);
- ok((style & invalid_styles[i]) == invalid_styles[i], "%u: unexpected window styles %#x.\n", i, style);
+ ok((style & invalid_styles[i]) == invalid_styles[i], "%u: unexpected window styles %#lx.\n", i, style);
ret = SendMessageA(listbox, LB_SETCOUNT, 100, 0);
ok(ret == LB_ERR, "%u: unexpected return value %d.\n", i, ret);
DestroyWindow(listbox);
1
0
[PATCH 1/3] dlls/oleaut32/tests: get rid of EXPECTI864 macro (vartype.c)
by Eric Pouech March 11, 2022
by Eric Pouech March 11, 2022
March 11, 2022
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
---
dlls/oleaut32/tests/vartype.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/dlls/oleaut32/tests/vartype.c b/dlls/oleaut32/tests/vartype.c
index 995fd254208..a61907cc4bb 100644
--- a/dlls/oleaut32/tests/vartype.c
+++ b/dlls/oleaut32/tests/vartype.c
@@ -1875,11 +1875,6 @@ static void test_VarUI4ChangeTypeEx(void)
(ULONG)((LONG64)(x) >> 32), (ULONG)((x) & 0xffffffff), \
(ULONG)(out >> 32), (ULONG)(out & 0xffffffff), hres)
-#define EXPECTI864(x,y) \
- ok(hres == S_OK && (out >> 32) == (CONV_TYPE)(x) && (out & 0xffffffff) == (CONV_TYPE)(y), \
- "expected " #x "(%u,%u), got (%u,%u); hres=0x%08x\n", \
- (ULONG)(x), (ULONG)(y), \
- (ULONG)(out >> 32), (ULONG)(out & 0xffffffff), hres)
static void test_VarI8FromI1(void)
{
@@ -2011,7 +2006,7 @@ static void test_VarI8FromUI8(void)
CONVERT(VarI8FromUI8, 0); EXPECTI8(0);
CONVERT(VarI8FromUI8, 1); EXPECTI8(1);
- CONVERT_I8(VarI8FromUI8, 0x7fffffff, 0xffffffff); EXPECTI864(0x7fffffff, 0xffffffff);
+ CONVERT_I8(VarI8FromUI8, 0x7fffffff, 0xffffffff); EXPECTI8(0x7fffffffffffffffull);
CONVERT_I8(VarI8FromUI8, 0x80000000, 0); EXPECT_OVERFLOW;
}
@@ -2313,8 +2308,8 @@ static void test_VarUI8FromStr(void)
CONVERT_STR(VarUI8FromStr,"0",0); EXPECTI8(0);
CONVERT_STR(VarUI8FromStr,"-1",0); EXPECT_OVERFLOW;
CONVERT_STR(VarUI8FromStr,"2147483647",0); EXPECTI8(2147483647);
- CONVERT_STR(VarUI8FromStr,"18446744073709551614",0); EXPECTI864(0xFFFFFFFF,0xFFFFFFFE);
- CONVERT_STR(VarUI8FromStr,"18446744073709551615",0); EXPECTI864(0xFFFFFFFF,0xFFFFFFFF);
+ CONVERT_STR(VarUI8FromStr,"18446744073709551614",0); EXPECTI8(0xFFFFFFFFFFFFFFFEull);
+ CONVERT_STR(VarUI8FromStr,"18446744073709551615",0); EXPECTI8(0xFFFFFFFFFFFFFFFFull);
CONVERT_STR(VarUI8FromStr,"18446744073709551616",0); EXPECT_OVERFLOW;
CONVERT_STR(VarUI8FromStr,"-1.5",LOCALE_NOUSEROVERRIDE); EXPECT_OVERFLOW;
1
2
[PATCH v3 1/4] mf/tests: Check the number of input samples to get a H264 stream change.
by Rémi Bernon March 11, 2022
by Rémi Bernon March 11, 2022
March 11, 2022
We check that we can at least push two input samples at a time, which
matches what Call of Duty Black Ops 3 is doing, as it is not checking
ProcessInput result most of the time.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
v3: Rebase and fix uninitialized output_info.cbSize usage in PATCH 4.
dlls/mf/tests/mf.c | 43 ++++++++++++++++++++++++++++++++-----------
1 file changed, 32 insertions(+), 11 deletions(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index 2e126a1dbcf..ead2d56dc70 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -6619,6 +6619,7 @@ static void test_h264_decoder(void)
MFT_OUTPUT_DATA_BUFFER output;
const BYTE *h264_encoded_data;
ULONG h264_encoded_data_len;
+ IMFAttributes *attributes;
IMFMediaType *media_type;
IMFTransform *transform;
ULONG i, ret, flags;
@@ -6636,6 +6637,14 @@ static void test_h264_decoder(void)
&transform, &class_id))
goto failed;
+ hr = IMFTransform_GetAttributes(transform, &attributes);
+ todo_wine
+ ok(hr == S_OK, "GetAttributes returned %#lx\n", hr);
+ if (hr != S_OK) MFCreateAttributes(&attributes, 0);
+ hr = IMFAttributes_SetUINT32(attributes, &MF_LOW_LATENCY, 1);
+ ok(hr == S_OK, "SetUINT32 returned %#lx\n", hr);
+ IMFAttributes_Release(attributes);
+
/* no output type is available before an input type is set */
hr = IMFTransform_GetOutputAvailableType(transform, 0, 0, &media_type);
@@ -6830,6 +6839,7 @@ static void test_h264_decoder(void)
ok(!output.pEvents, "got pEvents %p\n", output.pEvents);
ok(status == 0, "got status %#lx\n", status);
+ i = 0;
sample = next_h264_sample(&h264_encoded_data, &h264_encoded_data_len);
while (1)
{
@@ -6848,19 +6858,30 @@ static void test_h264_decoder(void)
ret = IMFSample_Release(output.pSample);
ok(ret == 0, "Release returned %lu\n", ret);
- while (h264_encoded_data_len > 4)
- {
- hr = IMFTransform_ProcessInput(transform, 0, sample, 0);
- if (FAILED(hr)) break;
- ok(hr == S_OK, "ProcessInput returned %#lx\n", hr);
- ret = IMFSample_Release(sample);
- ok(ret <= 1, "Release returned %lu\n", ret);
- sample = next_h264_sample(&h264_encoded_data, &h264_encoded_data_len);
- }
- ok(hr == MF_E_NOTACCEPTING, "ProcessInput returned %#lx\n", hr);
- EXPECT_REF(sample, 1);
+ hr = IMFTransform_ProcessInput(transform, 0, sample, 0);
+ todo_wine
+ ok(hr == S_OK, "ProcessInput returned %#lx\n", hr);
+ ret = IMFSample_Release(sample);
+ ok(ret <= 1, "Release returned %lu\n", ret);
+ sample = next_h264_sample(&h264_encoded_data, &h264_encoded_data_len);
+
+ hr = IMFTransform_ProcessInput(transform, 0, sample, 0);
+ todo_wine
+ ok(hr == S_OK, "ProcessInput returned %#lx\n", hr);
+ ret = IMFSample_Release(sample);
+ ok(ret <= 1, "Release returned %lu\n", ret);
+ sample = next_h264_sample(&h264_encoded_data, &h264_encoded_data_len);
+ i++;
+
+ hr = IMFTransform_ProcessMessage(transform, MFT_MESSAGE_COMMAND_DRAIN, 0);
+ todo_wine
+ ok(hr == S_OK, "ProcessMessage returned %#lx\n", hr);
}
todo_wine
+ ok(i == 2, "got %lu iterations\n", i);
+ todo_wine
+ ok(h264_encoded_data_len == 44959, "got h264_encoded_data_len %lu\n", h264_encoded_data_len);
+ todo_wine
ok(hr == MF_E_TRANSFORM_STREAM_CHANGE, "ProcessOutput returned %#lx\n", hr);
ok(output.dwStreamID == 0, "got dwStreamID %lu\n", output.dwStreamID);
ok(!!output.pSample, "got pSample %p\n", output.pSample);
--
2.35.1
2
7
[RFC PATCH] advapi32/tests: Check the timezone name size limits in all languages.
by Francois Gouget March 10, 2022
by Francois Gouget March 10, 2022
March 10, 2022
The localized standard and daylight timezone names returned by
EnumDynamicTimeZoneInformation() must fit in a 32 character buffer.
But there is no such limitation in Wine's PO files and the regular
WineTest runs only cover some locales. So use SetThreadUILanguage() to
verify the translations in all the known languages.
Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=51619
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
Unfortunately SetThreadUILanguage() is a stub in Wine so this currently
has no effect where we need it.
Also while going through all of Wine's ~150 known languages only takes
about 35 seconds, this would benefit from some parallelization to
speed things up (see d3d11:d3d11 for instance). I can send a patch for
that if this approach is deemed worthwhile.
Note that on Windows we typically only install a few language packs,
resulting in only about 20 loops and a sub 4 second runtime. So the
optimization is not as necessary there.
---
dlls/advapi32/tests/registry.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c
index 6152a313803..4eefd18cf5f 100644
--- a/dlls/advapi32/tests/registry.c
+++ b/dlls/advapi32/tests/registry.c
@@ -4308,7 +4308,7 @@ static void test_RegLoadMUIString(void)
SetEnvironmentVariableA("WineMuiDat", NULL);
}
-static void test_EnumDynamicTimeZoneInformation(void)
+static BOOL CALLBACK test_EnumDynamicTimeZoneInformation(LPSTR value, LONG_PTR lParam)
{
LSTATUS status;
HKEY key, subkey;
@@ -4329,7 +4329,14 @@ static void test_EnumDynamicTimeZoneInformation(void)
if (!pEnumDynamicTimeZoneInformation)
{
win_skip("EnumDynamicTimeZoneInformation is not supported.\n");
- return;
+ return FALSE;
+ }
+
+ if (value)
+ {
+ LANGID lang = strtol(value, NULL, 16);
+ winetest_push_context("lang=%04x", lang);
+ ok(SetThreadUILanguage(lang) == lang, "SetThreadUILanguage(%04x) failed: gle=%lu\n", lang, GetLastError());
}
if (pRegLoadMUIStringW)
@@ -4473,6 +4480,8 @@ static void test_EnumDynamicTimeZoneInformation(void)
ok(!memcmp(&dtzi, &bogus_dtzi, sizeof(dtzi)), "mismatch\n");
RegCloseKey(key);
+ winetest_pop_context();
+ return TRUE;
}
START_TEST(registry)
@@ -4512,8 +4521,14 @@ START_TEST(registry)
test_RegNotifyChangeKeyValue();
test_performance_keys();
test_RegLoadMUIString();
- test_EnumDynamicTimeZoneInformation();
test_perflib_key();
+ if (SetThreadUILanguage(0xffff) == 0xffff)
+ {
+ skip("SetThreadUILanguage() is a stub; test the current UI language\n");
+ test_EnumDynamicTimeZoneInformation(NULL, 0);
+ }
+ else
+ EnumUILanguagesA(test_EnumDynamicTimeZoneInformation, MUI_LANGUAGE_ID, 0);
/* cleanup */
delete_key( hkey_main );
--
2.30.2
2
1
Much of the existing font dialog code is overly complicated and difficult
to follow. There are also bugs in the code, which cannot be fixed with
minimal changes due to the complexity of the existing source. For example,
changing the font face via the listbox unexpectedly changes the font size.
It is also unnecessary to recreate the list of available font sizes
each font face selection if the font type remains unchanged.
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
---
programs/conhost/window.c | 227 +++++++++-----------------------------
1 file changed, 55 insertions(+), 172 deletions(-)
diff --git a/programs/conhost/window.c b/programs/conhost/window.c
index abfc791c1ef..fb02ef9fd94 100644
--- a/programs/conhost/window.c
+++ b/programs/conhost/window.c
@@ -1206,13 +1206,6 @@ struct dialog_info
struct console *console;
struct console_config config;
HWND dialog; /* handle to active propsheet */
- int font_count; /* number of fonts */
- struct dialog_font_info
- {
- unsigned int height;
- unsigned int weight;
- WCHAR faceName[LF_FACESIZE];
- } *font; /* array of fonts */
};
/* dialog proc for the option property sheet */
@@ -1352,12 +1345,10 @@ static LRESULT WINAPI font_preview_proc( HWND hwnd, UINT msg, WPARAM wparam, LPA
struct dialog_info *di;
HFONT font, old_font;
PAINTSTRUCT ps;
- int size_idx;
di = (struct dialog_info *)GetWindowLongPtrW( GetParent( hwnd ), DWLP_USER );
BeginPaint( hwnd, &ps );
- size_idx = SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0, 0 );
font = (HFONT)GetWindowLongPtrW( hwnd, 0 );
if (font)
{
@@ -1373,7 +1364,7 @@ static LRESULT WINAPI font_preview_proc( HWND hwnd, UINT msg, WPARAM wparam, LPA
SetTextColor( ps.hdc, get_color( di, IDC_FNT_COLOR_FG ));
len = LoadStringW( GetModuleHandleW(NULL), IDS_FNT_PREVIEW, buf, ARRAY_SIZE(buf) );
if (len) TextOutW( ps.hdc, 0, 0, buf, len );
- TextOutW( ps.hdc, 0, di->font[size_idx].height, ascii, ARRAY_SIZE(ascii) - 1 );
+ TextOutW( ps.hdc, 0, di->config.cell_height, ascii, ARRAY_SIZE(ascii) - 1 );
SelectObject( ps.hdc, old_font );
}
EndPaint( hwnd, &ps );
@@ -1461,146 +1452,42 @@ static LRESULT WINAPI color_preview_proc( HWND hwnd, UINT msg, WPARAM wparam, LP
return 0;
}
-/* enumerates all the font names with at least one valid font */
-static int WINAPI font_enum_size2( const LOGFONTW *lf, const TEXTMETRICW *tm,
- DWORD font_type, LPARAM lparam )
-{
- struct dialog_info *di = (struct dialog_info *)lparam;
- TRACE( "%s\n", debugstr_textmetric( tm, font_type ));
- if (validate_font_metric( di->console, tm, font_type, 0 )) di->font_count++;
- return 1;
-}
-
-static int WINAPI font_enum( const LOGFONTW *lf, const TEXTMETRICW *tm,
- DWORD font_type, LPARAM lparam )
-{
- struct dialog_info *di = (struct dialog_info *)lparam;
-
- TRACE( "%s\n", debugstr_logfont( lf, font_type ));
-
- if (validate_font( di->console, lf, 0 ))
- {
- if (font_type & RASTER_FONTTYPE)
- {
- di->font_count = 0;
- EnumFontFamiliesW( di->console->window->mem_dc, lf->lfFaceName,
- font_enum_size2, (LPARAM)di );
- }
- else
- di->font_count = 1;
-
- if (di->font_count)
- SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_FONT, LB_ADDSTRING,
- 0, (LPARAM)lf->lfFaceName );
- }
- return 1;
-}
-
-static int WINAPI font_enum_size( const LOGFONTW *lf, const TEXTMETRICW *tm,
- DWORD font_type, LPARAM lparam )
-{
- struct dialog_info *di = (struct dialog_info *)lparam;
- WCHAR buf[32];
-
- TRACE( "%s\n", debugstr_textmetric( tm, font_type ));
-
- if (di->font_count == 0 && !(font_type & RASTER_FONTTYPE))
- {
- static const int sizes[] = {8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
- int i;
-
- di->font_count = ARRAY_SIZE(sizes);
- di->font = malloc( di->font_count * sizeof(di->font[0]) );
- for (i = 0; i < di->font_count; i++)
- {
- /* drop sizes where window size wouldn't fit on screen */
- if (sizes[i] * di->config.win_height > GetSystemMetrics( SM_CYSCREEN ))
- {
- di->font_count = i;
- break;
- }
- di->font[i].height = sizes[i];
- di->font[i].weight = 400;
- lstrcpyW( di->font[i].faceName, lf->lfFaceName );
- wsprintfW( buf, L"%d", sizes[i] );
- SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_SIZE, LB_INSERTSTRING, i, (LPARAM)buf );
- }
- /* don't need to enumerate other */
- return 0;
- }
-
- if (validate_font_metric( di->console, tm, font_type, 0 ))
- {
- int idx = 0;
-
- /* we want the string to be sorted with a numeric order, not a lexicographic...
- * do the job by hand... get where to insert the new string
- */
- while (idx < di->font_count && tm->tmHeight > di->font[idx].height)
- idx++;
- while (idx < di->font_count &&
- tm->tmHeight == di->font[idx].height &&
- tm->tmWeight > di->font[idx].weight)
- idx++;
- if (idx == di->font_count ||
- tm->tmHeight != di->font[idx].height ||
- tm->tmWeight < di->font[idx].weight)
- {
- /* here we need to add the new entry */
- wsprintfW( buf, L"%d", tm->tmHeight );
- SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_SIZE, LB_INSERTSTRING, idx, (LPARAM)buf );
-
- /* now grow our arrays and insert the values at the same index than in the list box */
- if (di->font_count)
- {
- di->font = realloc( di->font, sizeof(*di->font) * (di->font_count + 1) );
- if (idx != di->font_count)
- memmove( &di->font[idx + 1], &di->font[idx],
- (di->font_count - idx) * sizeof(*di->font) );
- }
- else
- di->font = malloc( sizeof(*di->font) );
- di->font[idx].height = tm->tmHeight;
- di->font[idx].weight = tm->tmWeight;
- lstrcpyW( di->font[idx].faceName, lf->lfFaceName );
- di->font_count++;
- }
- }
- return 1;
-}
-
static BOOL select_font( struct dialog_info *di )
{
- struct console_config config;
int font_idx, size_idx;
+ WCHAR face_name[LF_FACESIZE], height_buf[4];
+ size_t len;
+ unsigned int font_height;
+ LOGFONTW lf;
HFONT font, old_font;
DWORD_PTR args[2];
WCHAR buf[256];
WCHAR fmt[128];
- LOGFONTW lf;
font_idx = SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0, 0 );
size_idx = SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0, 0 );
- if (font_idx < 0 || size_idx < 0 || size_idx >= di->font_count)
+ if (font_idx < 0 || size_idx < 0)
return FALSE;
- fill_logfont( &lf, di->font[size_idx].faceName,
- wcslen(di->font[size_idx].faceName) * sizeof(WCHAR),
- di->font[size_idx].height, di->font[size_idx].weight );
- font = select_font_config( &config, di->console->output_cp, di->console->win, &lf );
+ len = SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_FONT, LB_GETTEXT, font_idx, (LPARAM)&face_name );
+ SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_SIZE, LB_GETTEXT, size_idx, (LPARAM)&height_buf );
+ font_height = _wtoi( height_buf );
+
+ fill_logfont( &lf, face_name, len * sizeof(WCHAR), font_height, FW_NORMAL );
+ font = select_font_config( &di->config, di->console->output_cp, di->console->win, &lf );
if (!font) return FALSE;
- if (config.cell_height != di->font[size_idx].height)
- TRACE( "mismatched heights (%u<>%u)\n", config.cell_height, di->font[size_idx].height );
+ if (di->config.cell_height != font_height)
+ TRACE( "mismatched heights (%u<>%u)\n", di->config.cell_height, font_height );
old_font = (HFONT)SendDlgItemMessageW( di->dialog, IDC_FNT_PREVIEW, WM_GETFONT, 0, 0 );
SendDlgItemMessageW( di->dialog, IDC_FNT_PREVIEW, WM_SETFONT, (WPARAM)font, TRUE );
if (old_font) DeleteObject( old_font );
LoadStringW( GetModuleHandleW(NULL), IDS_FNT_DISPLAY, fmt, ARRAY_SIZE(fmt) );
- args[0] = config.cell_width;
- args[1] = config.cell_height;
+ args[0] = di->config.cell_width;
+ args[1] = di->config.cell_height;
FormatMessageW( FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
fmt, 0, 0, buf, ARRAY_SIZE(buf), (__ms_va_list*)args );
@@ -1608,52 +1495,62 @@ static BOOL select_font( struct dialog_info *di )
return TRUE;
}
-/* fills the size list box according to selected family in font LB */
static BOOL fill_list_size( struct dialog_info *di, BOOL init )
{
- WCHAR face_name[LF_FACESIZE];
- int idx = 0;
-
- idx = SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0, 0 );
- if (idx < 0) return FALSE;
-
- SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_FONT, LB_GETTEXT, idx, (LPARAM)face_name );
- SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_SIZE, LB_RESETCONTENT, 0, 0 );
- free( di->font );
- di->font_count = 0;
- di->font = NULL;
-
- EnumFontFamiliesW( di->console->window->mem_dc, face_name, font_enum_size, (LPARAM)di );
-
if (init)
{
- int ref = -1;
- for (idx = 0; idx < di->font_count; idx++)
+ static const int sizes[] = {8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
+ unsigned int i, idx = 4;
+ WCHAR buf[4];
+
+ for (i = 0; i < ARRAY_SIZE(sizes); i++)
{
- if (!lstrcmpW( di->font[idx].faceName, di->config.face_name ) &&
- di->font[idx].height == di->config.cell_height &&
- di->font[idx].weight == di->config.font_weight)
- {
- if (ref == -1) ref = idx;
- else TRACE("Several matches found: ref=%d idx=%d\n", ref, idx);
- }
+ wsprintfW( buf, L"%u", sizes[i] );
+ SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_SIZE, LB_INSERTSTRING, -1, (LPARAM)buf );
+
+ if (di->config.cell_height == sizes[i]) idx = i;
}
- idx = (ref == -1) ? 0 : ref;
+
+ SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_SIZE, LB_SETCURSEL, idx, 0 );
}
- SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_SIZE, LB_SETCURSEL, idx, 0 );
select_font( di );
+
return TRUE;
}
+static int CALLBACK enum_list_font_proc( const LOGFONTW *lf, const TEXTMETRICW *tm,
+ DWORD font_type, LPARAM lparam )
+{
+ struct dialog_info *di = (struct dialog_info *)lparam;
+
+ if (font_type != TRUETYPE_FONTTYPE) return 1;
+
+ TRACE( "%s\n", debugstr_logfont( lf, font_type ));
+
+ if (validate_font( di->console, lf, 0 ))
+ SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_FONT, LB_ADDSTRING, 0, (LPARAM)lf->lfFaceName );
+
+ return 1;
+}
+
static BOOL fill_list_font( struct dialog_info *di )
{
- SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_FONT, LB_RESETCONTENT, 0, 0 );
- EnumFontFamiliesW( di->console->window->mem_dc, NULL, font_enum, (LPARAM)di );
+ LOGFONTW lf;
+
+ memset( &lf, 0, sizeof(lf) );
+ lf.lfCharSet = DEFAULT_CHARSET;
+ lf.lfFaceName[0] = 0;
+ lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
+
+ EnumFontFamiliesExW( di->console->window->mem_dc, &lf, enum_list_font_proc, (LPARAM)di, 0 );
+
if (SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_FONT, LB_SELECTSTRING,
-1, (LPARAM)di->config.face_name ) == LB_ERR)
SendDlgItemMessageW( di->dialog, IDC_FNT_LIST_FONT, LB_SETCURSEL, 0, 0 );
+
fill_list_size( di, TRUE );
+
return TRUE;
}
@@ -1668,7 +1565,7 @@ static INT_PTR WINAPI font_dialog_proc( HWND dialog, UINT msg, WPARAM wparam, LP
di = (struct dialog_info *)((PROPSHEETPAGEA*)lparam)->lParam;
di->dialog = dialog;
SetWindowLongPtrW( dialog, DWLP_USER, (DWORD_PTR)di );
- /* remove dialog from this control, font will be reset when listboxes are filled */
+ /* use default system font until user-selected font is applied */
SendDlgItemMessageW( dialog, IDC_FNT_PREVIEW, WM_SETFONT, 0, 0 );
fill_list_font( di );
SetWindowLongW( GetDlgItem( dialog, IDC_FNT_COLOR_BK ), 0, (di->config.attr >> 4) & 0x0F );
@@ -1702,18 +1599,6 @@ static INT_PTR WINAPI font_dialog_proc( HWND dialog, UINT msg, WPARAM wparam, LP
di->dialog = dialog;
break;
case PSN_APPLY:
- val = SendDlgItemMessageW( dialog, IDC_FNT_LIST_SIZE, LB_GETCURSEL, 0, 0 );
- if (val < di->font_count)
- {
- LOGFONTW lf;
-
- fill_logfont( &lf, di->font[val].faceName,
- wcslen(di->font[val].faceName) * sizeof(WCHAR),
- di->font[val].height, di->font[val].weight );
- DeleteObject( select_font_config( &di->config, di->console->output_cp,
- di->console->win, &lf ));
- }
-
val = (GetWindowLongW( GetDlgItem( dialog, IDC_FNT_COLOR_BK ), 0 ) << 4) |
GetWindowLongW( GetDlgItem( dialog, IDC_FNT_COLOR_FG ), 0 );
di->config.attr = val;
@@ -1978,8 +1863,6 @@ static BOOL config_dialog( struct console *console, BOOL current )
}
else current_config( console, &di.config );
prev_config = di.config;
- di.font_count = 0;
- di.font = NULL;
wndclass.style = 0;
wndclass.lpfnWndProc = font_preview_proc;
--
2.35.1
2
1