From: Zhiyi Zhang zzhang@codeweavers.com
I also tested creating the Unicode version of these comctl32 controls locally and got the same result. --- dlls/comctl32/tests/misc.c | 62 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)
diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c index 4bcfe1d1d4e..f281751566d 100644 --- a/dlls/comctl32/tests/misc.c +++ b/dlls/comctl32/tests/misc.c @@ -1361,6 +1361,66 @@ static void test_RegisterClassNameW(BOOL v6) winetest_pop_context(); }
+static void test_CCM_SETVERSION(BOOL v6) +{ + unsigned int i, j; + LRESULT lr; + HWND hwnd; + + static const char *class_names[] = + { + WC_LISTVIEWA, + REBARCLASSNAMEA, + TOOLBARCLASSNAMEA, + }; + + for (i = 0; i < ARRAY_SIZE(class_names); ++i) + { + winetest_push_context("v%d %s", v6 ? 6 : 5, class_names[i]); + + hwnd = CreateWindowA(class_names[i], "test", WS_POPUP | WS_VISIBLE, 0, 0, 50, 50, + NULL, 0, 0, 0); + ok(hwnd != NULL, "CreateWindowA failed, error %lu.\n", GetLastError()); + + lr = SendMessageA(hwnd, CCM_GETVERSION, 0, 0); + todo_wine_if(lr != (v6 ? 6 : 0)) + ok(lr == (v6 ? 6 : 0), "Got unexpected %Id.\n", lr); + + for (j = 0; j <= 7; j++) + { + winetest_push_context("%d", j); + + lr = SendMessageA(hwnd, CCM_SETVERSION, j, 0); + if (v6) + { + todo_wine_if(lr != 6) + ok(lr == 6, "Got unexpected %Id.\n", lr); + } + else + { + if (j >= 6) + todo_wine_if(lr != -1) + ok(lr == -1, "Got unexpected %Id.\n", lr); + else + todo_wine_if(lr != (j == 0 ? 0 : (j - 1))) + ok(lr == (j == 0 ? 0 : (j - 1)), "Got unexpected %Id.\n", lr); + } + + if (!strcmp(class_names[i], TOOLBARCLASSNAMEA)) + { + lr = SendMessageA(hwnd, TB_GETUNICODEFORMAT, 0, 0); + todo_wine_if(j >= 5) + ok(lr == 0, "Got unexpected %Id.\n", lr); + } + + winetest_pop_context(); + } + + DestroyWindow(hwnd); + winetest_pop_context(); + } +} + START_TEST(misc) { ULONG_PTR ctx_cookie; @@ -1377,6 +1437,7 @@ START_TEST(misc) test_WM_SETFONT(); test_version(FALSE); test_RegisterClassNameW(FALSE); + test_CCM_SETVERSION(FALSE);
FreeLibrary(hComctl32);
@@ -1395,6 +1456,7 @@ START_TEST(misc) test_WM_SETFONT(); test_version(TRUE); test_RegisterClassNameW(TRUE); + test_CCM_SETVERSION(TRUE);
unload_v6_module(ctx_cookie, hCtx); FreeLibrary(hComctl32);
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/tests/misc.c | 1 - dlls/comctl32/toolbar.c | 4 ---- 2 files changed, 5 deletions(-)
diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c index f281751566d..2b6bdf81435 100644 --- a/dlls/comctl32/tests/misc.c +++ b/dlls/comctl32/tests/misc.c @@ -1409,7 +1409,6 @@ static void test_CCM_SETVERSION(BOOL v6) if (!strcmp(class_names[i], TOOLBARCLASSNAMEA)) { lr = SendMessageA(hwnd, TB_GETUNICODEFORMAT, 0, 0); - todo_wine_if(j >= 5) ok(lr == 0, "Got unexpected %Id.\n", lr); }
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index da66d3972c3..5922afd729a 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -5120,10 +5120,6 @@ TOOLBAR_SetVersion (TOOLBAR_INFO *infoPtr, INT iVersion) INT iOldVersion = infoPtr->iVersion;
infoPtr->iVersion = iVersion; - - if (infoPtr->iVersion >= 5) - TOOLBAR_SetUnicodeFormat(infoPtr, TRUE); - return iOldVersion; }
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/listview.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index b2856db471c..c954ac221ff 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -9624,7 +9624,11 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, WPARAM wParam, const CREATESTRUCTW * infoPtr->nMeasureItemHeight = 0; infoPtr->xTrackLine = -1; /* no track line */ infoPtr->itemEdit.fEnabled = FALSE; - infoPtr->iVersion = COMCTL32_VERSION; +#if __WINE_COMCTL32_VERSION == 6 + infoPtr->iVersion = 6; +#else + infoPtr->iVersion = 0; +#endif infoPtr->colRectsDirty = FALSE; infoPtr->selected_column = -1; infoPtr->hHotCursor = LoadCursorW(NULL, (LPWSTR)IDC_HAND); @@ -11439,9 +11443,12 @@ static inline LRESULT LISTVIEW_GetVersion(const LISTVIEW_INFO *infoPtr) */ static LRESULT LISTVIEW_SetVersion(LISTVIEW_INFO *infoPtr, DWORD iVersion) { +#if __WINE_COMCTL32_VERSION == 6 + return infoPtr->iVersion; +#else INT iOldVersion = infoPtr->iVersion;
- if (iVersion > COMCTL32_VERSION) + if (iVersion > 5) return -1;
infoPtr->iVersion = iVersion; @@ -11449,6 +11456,7 @@ static LRESULT LISTVIEW_SetVersion(LISTVIEW_INFO *infoPtr, DWORD iVersion) TRACE("new version %ld\n", iVersion);
return iOldVersion; +#endif }
/***
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/rebar.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c index 7bb8f33ae06..51f13db3aa9 100644 --- a/dlls/comctl32/rebar.c +++ b/dlls/comctl32/rebar.c @@ -2862,9 +2862,12 @@ REBAR_SetUnicodeFormat (REBAR_INFO *infoPtr, BOOL unicode) static LRESULT REBAR_SetVersion (REBAR_INFO *infoPtr, INT iVersion) { +#if __WINE_COMCTL32_VERSION == 6 + return infoPtr->iVersion; +#else INT iOldVersion = infoPtr->iVersion;
- if (iVersion > COMCTL32_VERSION) + if (iVersion > 5) return -1;
infoPtr->iVersion = iVersion; @@ -2872,6 +2875,7 @@ REBAR_SetVersion (REBAR_INFO *infoPtr, INT iVersion) TRACE("new version %d\n", iVersion);
return iOldVersion; +#endif }
@@ -3256,6 +3260,11 @@ REBAR_NCCreate (HWND hwnd, const CREATESTRUCTW *cs) infoPtr->fStatus = 0; infoPtr->hFont = GetStockObject (SYSTEM_FONT); infoPtr->bands = DPA_Create(8); +#if __WINE_COMCTL32_VERSION == 6 + infoPtr->iVersion = 6; +#else + infoPtr->iVersion = 0; +#endif
/* issue WM_NOTIFYFORMAT to get unicode status of parent */ REBAR_NotifyFormat(infoPtr, NF_REQUERY);
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/tests/misc.c | 4 ---- dlls/comctl32/toolbar.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c index 2b6bdf81435..4e33a4cc8dd 100644 --- a/dlls/comctl32/tests/misc.c +++ b/dlls/comctl32/tests/misc.c @@ -1383,7 +1383,6 @@ static void test_CCM_SETVERSION(BOOL v6) ok(hwnd != NULL, "CreateWindowA failed, error %lu.\n", GetLastError());
lr = SendMessageA(hwnd, CCM_GETVERSION, 0, 0); - todo_wine_if(lr != (v6 ? 6 : 0)) ok(lr == (v6 ? 6 : 0), "Got unexpected %Id.\n", lr);
for (j = 0; j <= 7; j++) @@ -1393,16 +1392,13 @@ static void test_CCM_SETVERSION(BOOL v6) lr = SendMessageA(hwnd, CCM_SETVERSION, j, 0); if (v6) { - todo_wine_if(lr != 6) ok(lr == 6, "Got unexpected %Id.\n", lr); } else { if (j >= 6) - todo_wine_if(lr != -1) ok(lr == -1, "Got unexpected %Id.\n", lr); else - todo_wine_if(lr != (j == 0 ? 0 : (j - 1))) ok(lr == (j == 0 ? 0 : (j - 1)), "Got unexpected %Id.\n", lr); }
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index 5922afd729a..2c5ce1a7840 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -5117,10 +5117,17 @@ TOOLBAR_SetColorScheme (TOOLBAR_INFO *infoPtr, const COLORSCHEME *lParam) static LRESULT TOOLBAR_SetVersion (TOOLBAR_INFO *infoPtr, INT iVersion) { +#if __WINE_COMCTL32_VERSION == 6 + return infoPtr->iVersion; +#else INT iOldVersion = infoPtr->iVersion;
+ if (iVersion > 5) + return -1; + infoPtr->iVersion = iVersion; return iOldVersion; +#endif }
@@ -6056,7 +6063,11 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs) infoPtr->dwDTFlags = (lpcs->style & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS: DT_CENTER | DT_END_ELLIPSIS; infoPtr->bAnchor = FALSE; /* no anchor highlighting */ infoPtr->bDragOutSent = FALSE; +#if __WINE_COMCTL32_VERSION == 6 + infoPtr->iVersion = 6; +#else infoPtr->iVersion = 0; +#endif infoPtr->hwndSelf = hwnd; infoPtr->bDoRedraw = TRUE; infoPtr->clrBtnHighlight = CLR_DEFAULT;
From: Zhiyi Zhang zzhang@codeweavers.com
--- include/commctrl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/commctrl.h b/include/commctrl.h index 235704a76dd..5a67c1284a0 100644 --- a/include/commctrl.h +++ b/include/commctrl.h @@ -59,7 +59,7 @@ enum _LI_METRIC WINCOMMCTRLAPI HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE, const WCHAR *, int, int, HICON *); WINCOMMCTRLAPI HRESULT WINAPI LoadIconMetric(HINSTANCE, const WCHAR *, int, HICON *);
-#define COMCTL32_VERSION 5 /* dll version */ +#define COMCTL32_VERSION 6 /* dll version */
#define ICC_LISTVIEW_CLASSES 0x00000001 /* listview, header */ #define ICC_TREEVIEW_CLASSES 0x00000002 /* treeview, tooltips */
Nikolay Sivov (@nsivov) commented about dlls/comctl32/tests/misc.c:
winetest_pop_context();}
+static void test_CCM_SETVERSION(BOOL v6) +{
- unsigned int i, j;
- LRESULT lr;
- HWND hwnd;
- static const char *class_names[] =
- {
WC_LISTVIEWA,REBARCLASSNAMEA,TOOLBARCLASSNAMEA,- };
Is it only supported for those three controls?
Nikolay Sivov (@nsivov) commented about dlls/comctl32/tests/misc.c:
else{if (j >= 6)todo_wine_if(lr != -1)ok(lr == -1, "Got unexpected %Id.\n", lr);elsetodo_wine_if(lr != (j == 0 ? 0 : (j - 1)))ok(lr == (j == 0 ? 0 : (j - 1)), "Got unexpected %Id.\n", lr);}if (!strcmp(class_names[i], TOOLBARCLASSNAMEA)){lr = SendMessageA(hwnd, TB_GETUNICODEFORMAT, 0, 0);todo_wine_if(j >= 5)ok(lr == 0, "Got unexpected %Id.\n", lr);}
I think this should go to toolbar tests.
Nikolay Sivov (@nsivov) commented about dlls/comctl32/toolbar.c:
static LRESULT TOOLBAR_SetVersion (TOOLBAR_INFO *infoPtr, INT iVersion) { +#if __WINE_COMCTL32_VERSION == 6
- return infoPtr->iVersion;
+#else INT iOldVersion = infoPtr->iVersion;
- if (iVersion > 5)
return -1;- infoPtr->iVersion = iVersion; return iOldVersion;
+#endif }
Could you factor this out to a helper that we could use from all three controls if it's exactly the same?
Nikolay Sivov (@nsivov) commented about include/commctrl.h:
WINCOMMCTRLAPI HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE, const WCHAR *, int, int, HICON *); WINCOMMCTRLAPI HRESULT WINAPI LoadIconMetric(HINSTANCE, const WCHAR *, int, HICON *);
-#define COMCTL32_VERSION 5 /* dll version */ +#define COMCTL32_VERSION 6 /* dll version */
I wouldn't mind if we removed it instead completely, it doesn't look useful and we are not going to introduce sdk checks in the headers. Current MS SDK has it conditional to winxp sdk version, and same could be done for mingw-w64 headers for compatibility.