user32: Fix nameA pointer in alloc_menu_nameW.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52651 Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1f8738d537
commit
fa77147b5b
|
@ -174,6 +174,7 @@ static BOOL alloc_menu_nameW( struct client_menu_name *ret, const WCHAR *menu_na
|
|||
DWORD lenA = WideCharToMultiByte( CP_ACP, 0, menu_name, lenW, NULL, 0, NULL, NULL );
|
||||
ret->nameW = HeapAlloc( GetProcessHeap(), 0, lenA + lenW * sizeof(WCHAR) );
|
||||
if (!ret->nameW) return FALSE;
|
||||
ret->nameA = (char *)(ret->nameW + lenW);
|
||||
memcpy( ret->nameW, menu_name, lenW * sizeof(WCHAR) );
|
||||
WideCharToMultiByte( CP_ACP, 0, menu_name, lenW, ret->nameA, lenA, NULL, NULL );
|
||||
}
|
||||
|
|
|
@ -1545,6 +1545,53 @@ static void test_uxtheme(void)
|
|||
UnregisterClassA(class_name, GetModuleHandleA(NULL));
|
||||
}
|
||||
|
||||
static void test_class_name(void)
|
||||
{
|
||||
WCHAR class_name[] = L"ClassNameTest";
|
||||
HINSTANCE hinst = GetModuleHandleW(0);
|
||||
WNDCLASSEXW wcex;
|
||||
const WCHAR *nameW;
|
||||
const char *nameA;
|
||||
UINT_PTR res;
|
||||
HWND hwnd;
|
||||
|
||||
memset(&wcex, 0, sizeof wcex);
|
||||
wcex.cbSize = sizeof wcex;
|
||||
wcex.lpfnWndProc = ClassTest_WndProc;
|
||||
wcex.hIcon = LoadIconW(0, (LPCWSTR)IDI_APPLICATION);
|
||||
wcex.hInstance = hinst;
|
||||
wcex.lpszClassName = class_name;
|
||||
wcex.lpszMenuName = L"menu name";
|
||||
ok(RegisterClassExW(&wcex), "RegisterClassExW returned 0\n");
|
||||
hwnd = CreateWindowExW(0, class_name, NULL, WS_OVERLAPPEDWINDOW,
|
||||
0, 0, 0, 0, NULL, NULL, hinst, 0);
|
||||
ok(hwnd != NULL, "Window was not created\n");
|
||||
|
||||
nameA = (const char *)GetClassLongPtrA(hwnd, GCLP_MENUNAME);
|
||||
ok(!strcmp(nameA, "menu name"), "unexpected class name %s\n", debugstr_a(nameA));
|
||||
nameW = (const WCHAR *)GetClassLongPtrW(hwnd, GCLP_MENUNAME);
|
||||
ok(!wcscmp(nameW, L"menu name"), "unexpected class name %s\n", debugstr_w(nameW));
|
||||
|
||||
res = SetClassLongPtrA(hwnd, GCLP_MENUNAME, (LONG_PTR)"nameA");
|
||||
todo_wine
|
||||
ok(res, "SetClassLongPtrA returned 0\n");
|
||||
nameA = (const char *)GetClassLongPtrA(hwnd, GCLP_MENUNAME);
|
||||
ok(!strcmp(nameA, "nameA"), "unexpected class name %s\n", debugstr_a(nameA));
|
||||
nameW = (const WCHAR *)GetClassLongPtrW(hwnd, GCLP_MENUNAME);
|
||||
ok(!wcscmp(nameW, L"nameA"), "unexpected class name %s\n", debugstr_w(nameW));
|
||||
|
||||
res = SetClassLongPtrW(hwnd, GCLP_MENUNAME, (LONG_PTR)L"nameW");
|
||||
todo_wine
|
||||
ok(res, "SetClassLongPtrW returned 0\n");
|
||||
nameA = (const char *)GetClassLongPtrA(hwnd, GCLP_MENUNAME);
|
||||
ok(!strcmp(nameA, "nameW"), "unexpected class name %s\n", debugstr_a(nameA));
|
||||
nameW = (const WCHAR *)GetClassLongPtrW(hwnd, GCLP_MENUNAME);
|
||||
ok(!wcscmp(nameW, L"nameW"), "unexpected class name %s\n", debugstr_w(nameW));
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
UnregisterClassW(class_name, hinst);
|
||||
}
|
||||
|
||||
START_TEST(class)
|
||||
{
|
||||
char **argv;
|
||||
|
@ -1578,6 +1625,7 @@ START_TEST(class)
|
|||
test_icons();
|
||||
test_comctl32_classes();
|
||||
test_actctx_classes();
|
||||
test_class_name();
|
||||
|
||||
/* this test unregisters the Button class so it should be executed at the end */
|
||||
test_instances();
|
||||
|
|
Loading…
Reference in New Issue