From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/static.c | 38 ++++++++++++++++++++++++++++++++------ dlls/user32/tests/static.c | 18 ++++++++++++++++++ 2 files changed, 50 insertions(+), 6 deletions(-)
diff --git a/dlls/user32/static.c b/dlls/user32/static.c index a88203f5716..103767c6852 100644 --- a/dlls/user32/static.c +++ b/dlls/user32/static.c @@ -418,22 +418,48 @@ LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam switch (style) { case SS_ICON: { + const WCHAR *name = cs->lpszName; HICON hIcon; - if (unicode || IS_INTRESOURCE(cs->lpszName)) - hIcon = STATIC_LoadIconW(cs->hInstance, cs->lpszName, full_style); + + if (!unicode) + { + const char *nameA = (const char *)name; + if (nameA && nameA[0] == '\xff') + name = nameA[1] ? MAKEINTRESOURCEW(MAKEWORD(nameA[1], nameA[2])) : 0; + } + else if (name && name[0] == 0xffff) + { + name = MAKEINTRESOURCEW(name[1]); + } + + if (unicode || IS_INTRESOURCE(name)) + hIcon = STATIC_LoadIconW(cs->hInstance, name, full_style); else - hIcon = STATIC_LoadIconA(cs->hInstance, (LPCSTR)cs->lpszName, full_style); + hIcon = STATIC_LoadIconA(cs->hInstance, (const char *)name, full_style); STATIC_SetIcon(hwnd, hIcon, full_style); } break; case SS_BITMAP: if ((ULONG_PTR)cs->hInstance >> 16) { + const WCHAR *name = cs->lpszName; HBITMAP hBitmap; - if (unicode || IS_INTRESOURCE(cs->lpszName)) - hBitmap = LoadBitmapW(cs->hInstance, cs->lpszName); + + if (!unicode) + { + const char *nameA = (const char *)name; + if (nameA && nameA[0] == '\xff') + name = nameA[1] ? MAKEINTRESOURCEW(MAKEWORD(nameA[1], nameA[2])) : 0; + } + else if (name && name[0] == 0xffff) + { + name = MAKEINTRESOURCEW(name[1]); + } + + if (unicode || IS_INTRESOURCE(name)) + hBitmap = LoadBitmapW(cs->hInstance, name); else - hBitmap = LoadBitmapA(cs->hInstance, (LPCSTR)cs->lpszName); + hBitmap = LoadBitmapA(cs->hInstance, (const char *)name); STATIC_SetBitmap(hwnd, hBitmap, full_style); } break; diff --git a/dlls/user32/tests/static.c b/dlls/user32/tests/static.c index 09e399990cd..a02cb249d49 100644 --- a/dlls/user32/tests/static.c +++ b/dlls/user32/tests/static.c @@ -197,6 +197,24 @@ static void test_set_image(void)
DestroyWindow(hwnd); DeleteObject(image); + + hwnd = CreateWindowW(L"static", L"\uffff\x65", WS_VISIBLE|WS_CHILD|SS_BITMAP, 5, 5, 100, 100, + hMainWnd, (HMENU)CTRL_ID, GetModuleHandleW(NULL), 0); + + bmp = (HBITMAP)SendMessageW(hwnd, STM_GETIMAGE, IMAGE_BITMAP, 0); + ok(bmp != NULL, "got NULL\n"); + test_image(bmp); + + DestroyWindow(hwnd); + + hwnd = CreateWindowA("static", "\xff\x65\0", WS_VISIBLE|WS_CHILD|SS_BITMAP, 5, 5, 100, 100, + hMainWnd, (HMENU)CTRL_ID, GetModuleHandleW(NULL), 0); + + bmp = (HBITMAP)SendMessageW(hwnd, STM_GETIMAGE, IMAGE_BITMAP, 0); + ok(bmp != NULL, "got NULL\n"); + test_image(bmp); + + DestroyWindow(hwnd); }
static void test_STM_SETIMAGE(void)
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=121715
Your paranoid android.
=== debian11 (32 bit Hindi:India report) ===
user32: static.c:214: Test failed: got NULL static.c:151: Test failed: got 8584380 static.c:152: Test failed: got 0 static.c:153: Test failed: got 20 static.c:172: Test failed: bits: 00 00 00 00
From: Jacek Caban jacek@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53566 --- dlls/user32/dialog.c | 23 ++++++++++++- dlls/user32/tests/dialog.c | 63 +++++++++++++++++++++++++++++++++++ dlls/user32/tests/resource.rc | 10 ++++++ 3 files changed, 95 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index c8d1596a01b..fc7ddb303ff 100644 --- a/dlls/user32/dialog.c +++ b/dlls/user32/dialog.c @@ -220,8 +220,19 @@ static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template, const DLG_TEMPL } if (unicode) { + const WCHAR *caption = info.windowName; + WCHAR caption_buf[3]; + + if (IS_INTRESOURCE(caption) && caption) + { + caption_buf[0] = 0xffff; + caption_buf[1] = PtrToUlong( caption ); + caption_buf[2] = 0; + caption = caption_buf; + } + hwndCtrl = CreateWindowExW( info.exStyle | WS_EX_NOPARENTNOTIFY, - info.className, info.windowName, + info.className, caption, info.style | WS_CHILD, MulDiv(info.x, dlgInfo->xBaseUnit, 4), MulDiv(info.y, dlgInfo->yBaseUnit, 8), @@ -236,6 +247,7 @@ static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template, const DLG_TEMPL LPCSTR caption = (LPCSTR)info.windowName; LPSTR class_tmp = NULL; LPSTR caption_tmp = NULL; + char caption_buf[4];
if (!IS_INTRESOURCE(class)) { @@ -251,6 +263,15 @@ static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template, const DLG_TEMPL WideCharToMultiByte( CP_ACP, 0, info.windowName, -1, caption_tmp, len, NULL, NULL ); caption = caption_tmp; } + else if (caption) + { + caption_buf[0] = 0xff; + caption_buf[1] = PtrToUlong( caption ); + caption_buf[2] = PtrToUlong( caption ) >> 8; + caption_buf[3] = 0; + caption = caption_buf; + } + hwndCtrl = CreateWindowExA( info.exStyle | WS_EX_NOPARENTNOTIFY, class, caption, info.style | WS_CHILD, MulDiv(info.x, dlgInfo->xBaseUnit, 4), diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c index 0ac1d48a375..0b68dcc676b 100644 --- a/dlls/user32/tests/dialog.c +++ b/dlls/user32/tests/dialog.c @@ -2260,6 +2260,68 @@ static void test_capture_release(void) DestroyWindow(window); }
+static WNDPROC orig_static_proc; + +static LRESULT WINAPI test_static_create_procW(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch (msg) + { + case WM_NCCREATE: + case WM_CREATE: + { + CREATESTRUCTW *cs = (CREATESTRUCTW *)lparam; + ok(!wcscmp(cs->lpszName, L"\xffff\x6162"), "lpszName = %s\n", debugstr_w(cs->lpszName)); + break; + } + } + + return orig_static_proc(hwnd, msg, wparam, lparam); +} + +static LRESULT WINAPI test_static_create_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch (msg) + { + case WM_NCCREATE: + case WM_CREATE: + { + CREATESTRUCTA *cs = (CREATESTRUCTA *)lparam; + ok(!strcmp(cs->lpszName, "\xff\x62\x61"), "lpszName = "%s"\n", cs->lpszName); + break; + } + } + + return orig_static_proc(hwnd, msg, wparam, lparam); +} + +static void test_create_controls(void) +{ + HWND control; + INT_PTR ret; + + control = CreateWindowA("static", "", 0, 100, 200, 300, 400, NULL, NULL, NULL, NULL); + ok(control != 0, "failed to create control window\n"); + + orig_static_proc = (WNDPROC)SetClassLongPtrA(control, GCLP_WNDPROC, (ULONG_PTR)test_static_create_procA); + + ret = DialogBoxParamA(GetModuleHandleA(NULL), "IDD_SS_ICON_DIALOG", 0, DestroyOnCloseDlgWinProc, 0); + ok(0 == ret, "DialogBoxParamA returned %Id, expected 0\n", ret); + + SetClassLongPtrA(control, GCLP_WNDPROC, (ULONG_PTR)orig_static_proc); + DestroyWindow(control); + + control = CreateWindowW(L"static", L"", 0, 100, 200, 300, 400, NULL, NULL, NULL, NULL); + ok(control != 0, "failed to create control window\n"); + + orig_static_proc = (WNDPROC)SetClassLongPtrW(control, GCLP_WNDPROC, (ULONG_PTR)test_static_create_procW); + + ret = DialogBoxParamW(GetModuleHandleW(NULL), L"IDD_SS_ICON_DIALOG", 0, DestroyOnCloseDlgWinProc, 0); + ok(0 == ret, "DialogBoxParamW returned %Id, expected 0\n", ret); + + SetClassLongPtrW(control, GCLP_WNDPROC, (ULONG_PTR)orig_static_proc); + DestroyWindow(control); +} + START_TEST(dialog) { g_hinst = GetModuleHandleA (0); @@ -2273,6 +2335,7 @@ START_TEST(dialog) test_focus(); test_GetDlgItem(); test_GetDlgItemText(); + test_create_controls(); test_DialogBoxParam(); test_DisabledDialogTest(); test_MessageBoxFontTest(); diff --git a/dlls/user32/tests/resource.rc b/dlls/user32/tests/resource.rc index 89aaf5a61c5..67aa375f32c 100644 --- a/dlls/user32/tests/resource.rc +++ b/dlls/user32/tests/resource.rc @@ -276,3 +276,13 @@ FONT 8, "MS Shell Dlg" } MENUITEM "&Quit", 300 } + +IDD_SS_ICON_DIALOG DIALOG 0, 0, 186, 95 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL 0x6162, 1003, "STATIC", SS_ICON | WS_CHILD | WS_VISIBLE, 7, 57, 21, 20 + DEFPUSHBUTTON "OK",IDOK,129,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 +END
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=121716
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
user32: input.c:746: Test failed: 0 (a4/0): 00 from 00 -> 80 unexpected input.c:746: Test failed: 0 (a4/0): 41 from 01 -> 00 unexpected
=== w7u_el (32 bit report) ===
user32: input.c:4517: Test failed: SendInput triggered unexpected message 0xc042 input.c:2404: Test failed: Spurious WM_INPUT messages
=== w10pro64_zh_CN (64 bit report) ===
user32: msg.c:13063: Test failed: coords not changed: (101 101) (101 101) msg.c:13081: Test failed: coords not changed: (101 101) (101 101)
=== w8 (32 bit report) ===
user32: sysparams.c:2490: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2501: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w8adm (32 bit report) ===
user32: sysparams.c:2490: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2501: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w864 (32 bit report) ===
user32: sysparams.c:2490: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2501: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w1064v1809 (32 bit report) ===
user32: sysparams.c:2490: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2501: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w1064 (32 bit report) ===
user32: sysparams.c:2490: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2501: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w1064_tsign (32 bit report) ===
user32: sysparams.c:2490: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2501: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w10pro64 (32 bit report) ===
user32: sysparams.c:2490: Test failed: Waiting for the WM_DISPLAYCHANGE message timed out sysparams.c:2501: Test failed: Set bpp 32, but WM_DISPLAYCHANGE reported bpp -1
=== w1064_2qxl (64 bit report) ===
user32: win.c:4579: Test failed: hwnd 000000000003021A/000000000003021A message 0200 win.c:4583: Test failed: hwnd 000000000003021A/000000000003021A message 0201 win.c:4592: Test failed: hwnd 00000000000F0078/00000000000F0078 message 0202 win.c:4595: Test failed: hwnd 00000000000F0078/00000000000F0078 message 0201
=== w1064_tsign (64 bit report) ===
user32: win.c:10837: Test failed: pos = 01400154
=== debian11 (32 bit Hindi:India report) ===
user32: dialog.c:2289: Test failed: lpszName = "���ba" dialog.c:2289: Test failed: lpszName = "���ba" static.c:214: Test failed: got NULL static.c:151: Test failed: got 8584380 static.c:152: Test failed: got 0 static.c:153: Test failed: got 20 static.c:172: Test failed: bits: 00 00 00 00
On Mon Aug 22 12:49:15 2022 +0000, **** wrote:
Marvin replied on the mailing list:
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details: The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=121715 Your paranoid android. === debian11 (32 bit Hindi:India report) === user32: static.c:214: Test failed: got NULL static.c:151: Test failed: got 8584380 static.c:152: Test failed: got 0 static.c:153: Test failed: got 20 static.c:172: Test failed: bits: 00 00 00 00 _______________________________________________ wine-gitlab mailing list -- wine-gitlab@winehq.org To unsubscribe send an email to wine-gitlab-leave@winehq.org
It looks like CREATEPARAMS W/A conversion will need a special case as well.