[USER32_WINETEST]

* Sync with Wine 1.7.17.
CORE-8080

svn path=/trunk/; revision=62785
This commit is contained in:
Amine Khaldi
2014-04-18 22:26:13 +00:00
parent 4498108070
commit 5f7347300b
19 changed files with 1732 additions and 802 deletions
+13 -11
View File
@@ -59,7 +59,7 @@ static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR
static BOOL init_procs(void)
{
WNDCLASSA cls;
HANDLE user32 = GetModuleHandle("user32");
HANDLE user32 = GetModuleHandleA("user32.dll");
pBroadcastA = (PBROADCAST)GetProcAddress(user32, "BroadcastSystemMessageA");
if (!pBroadcastA)
pBroadcastA = (PBROADCAST)GetProcAddress(user32, "BroadcastSystemMessage");
@@ -82,7 +82,7 @@ static BOOL init_procs(void)
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, IDC_ARROW);
cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "MainWindowClass";
@@ -92,7 +92,7 @@ static BOOL init_procs(void)
if (!CreateWindowExA(0, "MainWindowClass", "Main window", WS_CAPTION | WS_SYSMENU |
WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP, 100, 100, 200,
200, 0, 0, GetModuleHandle(0), NULL))
200, 0, 0, GetModuleHandleA(NULL), NULL))
return FALSE;
return TRUE;
}
@@ -119,7 +119,8 @@ static void test_parameters(PBROADCAST broadcast, const char *functionname)
ok(!ret || broken(ret), "Returned: %d\n", ret);
if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
#if 0 /* TODO: Check the hang flags */
if (0) /* TODO: Check the hang flags */
{
SetLastError(0xcafebabe);
recips = BSM_APPLICATIONS;
ret = broadcast( BSF_QUERY|(BSF_NOHANG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0 );
@@ -143,7 +144,7 @@ static void test_parameters(PBROADCAST broadcast, const char *functionname)
ret = broadcast( BSF_POSTMESSAGE|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0 );
ok(0, "Last error: %08x\n", GetLastError());
ok(0, "Returned: %d\n", ret);
#endif
}
recips = BSM_APPLICATIONS;
ResetEvent(hevent);
@@ -204,31 +205,32 @@ static void test_parametersEx(PBROADCASTEX broadcastex)
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
ok(!ret, "Returned: %d\n", ret);
#if 0 /* TODO: Check the hang flags */
if (0) /* TODO: Check the hang flags */
{
SetLastError(0xcafebabe);
recips = BSM_APPLICATIONS;
ret = broadcast( BSF_QUERY|(BSF_NOHANG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
ret = broadcastex( BSF_QUERY|(BSF_NOHANG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
ok(0, "Last error: %08x\n", GetLastError());
ok(0, "Returned: %d\n", ret);
SetLastError(0xcafebabe);
recips = BSM_APPLICATIONS;
ret = broadcast( BSF_QUERY|(BSF_NOHANG|BSF_NOTIMEOUTIFNOTHUNG), &recips, WM_NULL, 30000, 0, NULL );
ret = broadcastex( BSF_QUERY|(BSF_NOHANG|BSF_NOTIMEOUTIFNOTHUNG), &recips, WM_NULL, 30000, 0, NULL );
ok(0, "Last error: %08x\n", GetLastError());
ok(0, "Returned: %d\n", ret);
SetLastError(0xcafebabe);
recips = BSM_APPLICATIONS;
ret = broadcast( BSF_QUERY|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
ret = broadcastex( BSF_QUERY|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
ok(0, "Last error: %08x\n", GetLastError());
ok(0, "Returned: %d\n", ret);
SetLastError(0xcafebabe);
recips = BSM_APPLICATIONS;
ret = broadcast( BSF_POSTMESSAGE|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
ret = broadcastex( BSF_POSTMESSAGE|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
ok(0, "Last error: %08x\n", GetLastError());
ok(0, "Returned: %d\n", ret);
#endif
}
recips = BSM_APPLICATIONS;
ResetEvent(hevent);
+18 -10
View File
@@ -270,6 +270,7 @@ static void test_synthesized(void)
}
static CRITICAL_SECTION clipboard_cs;
static HWND next_wnd;
static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
switch(msg) {
@@ -277,12 +278,19 @@ static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARA
EnterCriticalSection(&clipboard_cs);
LeaveCriticalSection(&clipboard_cs);
break;
case WM_CHANGECBCHAIN:
if (next_wnd == (HWND)wp)
next_wnd = (HWND)lp;
else if (next_wnd)
SendMessageA(next_wnd, msg, wp, lp);
break;
case WM_USER:
ChangeClipboardChain(hwnd, next_wnd);
PostQuitMessage(0);
break;
}
return DefWindowProc(hwnd, msg, wp, lp);
return DefWindowProcA(hwnd, msg, wp, lp);
}
static DWORD WINAPI clipboard_thread(void *param)
@@ -292,7 +300,7 @@ static DWORD WINAPI clipboard_thread(void *param)
EnterCriticalSection(&clipboard_cs);
SetLastError(0xdeadbeef);
SetClipboardViewer(win);
next_wnd = SetClipboardViewer(win);
ok(GetLastError() == 0xdeadbeef, "GetLastError = %d\n", GetLastError());
LeaveCriticalSection(&clipboard_cs);
@@ -307,14 +315,14 @@ static DWORD WINAPI clipboard_thread(void *param)
ok(r, "CloseClipboard failed: %d\n", GetLastError());
LeaveCriticalSection(&clipboard_cs);
r = PostMessage(win, WM_USER, 0, 0);
r = PostMessageA(win, WM_USER, 0, 0);
ok(r, "PostMessage failed: %d\n", GetLastError());
return 0;
}
static void test_messages(void)
{
WNDCLASS cls;
WNDCLASSA cls;
HWND win;
MSG msg;
HANDLE thread;
@@ -324,25 +332,25 @@ static void test_messages(void)
memset(&cls, 0, sizeof(cls));
cls.lpfnWndProc = clipboard_wnd_proc;
cls.hInstance = GetModuleHandle(0);
cls.hInstance = GetModuleHandleA(NULL);
cls.lpszClassName = "clipboard_test";
RegisterClass(&cls);
RegisterClassA(&cls);
win = CreateWindow("clipboard_test", NULL, 0, 0, 0, 0, 0, NULL, 0, NULL, 0);
win = CreateWindowA("clipboard_test", NULL, 0, 0, 0, 0, 0, NULL, 0, NULL, 0);
ok(win != NULL, "CreateWindow failed: %d\n", GetLastError());
thread = CreateThread(NULL, 0, clipboard_thread, (void*)win, 0, &tid);
ok(thread != NULL, "CreateThread failed: %d\n", GetLastError());
while(GetMessage(&msg, NULL, 0, 0)) {
while(GetMessageA(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
DispatchMessageA(&msg);
}
ok(WaitForSingleObject(thread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
CloseHandle(thread);
UnregisterClass("clipboard_test", GetModuleHandle(0));
UnregisterClassA("clipboard_test", GetModuleHandleA(NULL));
DeleteCriticalSection(&clipboard_cs);
}
+1 -1
View File
@@ -60,7 +60,7 @@ static INT CALLBACK is_font_installed_proc(const LOGFONTA *elf, const TEXTMETRIC
return 0;
}
static int is_font_installed(const char *name)
static BOOL is_font_installed(const char *name)
{
HDC hdc = GetDC(NULL);
BOOL ret = !EnumFontFamiliesA(hdc, name, is_font_installed_proc, 0);
+33 -33
View File
@@ -304,7 +304,7 @@ static BOOL (WINAPI *pGetCursorInfo)(CURSORINFO *);
static BOOL (WINAPI *pGetIconInfoExA)(HICON,ICONINFOEXA *);
static BOOL (WINAPI *pGetIconInfoExW)(HICON,ICONINFOEXW *);
static const int is_win64 = (sizeof(void *) > sizeof(int));
static const BOOL is_win64 = (sizeof(void *) > sizeof(int));
static LRESULT CALLBACK callback_child(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -328,7 +328,7 @@ static LRESULT CALLBACK callback_child(HWND hwnd, UINT msg, WPARAM wParam, LPARA
return 0;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
return DefWindowProcA(hwnd, msg, wParam, lParam);
}
static LRESULT CALLBACK callback_parent(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -339,12 +339,12 @@ static LRESULT CALLBACK callback_parent(HWND hwnd, UINT msg, WPARAM wParam, LPAR
return TRUE;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
return DefWindowProcA(hwnd, msg, wParam, lParam);
}
static void do_child(void)
{
WNDCLASS class;
WNDCLASSA class;
MSG msg;
BOOL ret;
@@ -353,7 +353,7 @@ static void do_child(void)
class.lpfnWndProc = callback_child;
class.cbClsExtra = 0;
class.cbWndExtra = 0;
class.hInstance = GetModuleHandle(NULL);
class.hInstance = GetModuleHandleA(NULL);
class.hIcon = NULL;
class.hCursor = NULL;
class.hbrBackground = NULL;
@@ -361,7 +361,7 @@ static void do_child(void)
class.lpszClassName = "cursor_child";
SetLastError(0xdeadbeef);
ret = RegisterClass(&class);
ret = RegisterClassA(&class);
ok(ret, "Failed to register window class. Error: %u\n", GetLastError());
/* Create a window. */
@@ -370,14 +370,14 @@ static void do_child(void)
ok(child != 0, "CreateWindowA failed. Error: %u\n", GetLastError());
/* Let the parent know our HWND. */
PostMessage(parent, PROC_INIT, (WPARAM) child, 0);
PostMessageA(parent, PROC_INIT, (WPARAM) child, 0);
/* Receive messages. */
while ((ret = GetMessage(&msg, 0, 0, 0)))
while ((ret = GetMessageA(&msg, 0, 0, 0)))
{
ok(ret != -1, "GetMessage failed. Error: %u\n", GetLastError());
TranslateMessage(&msg);
DispatchMessage(&msg);
DispatchMessageA(&msg);
}
}
@@ -386,7 +386,7 @@ static void do_parent(void)
char path_name[MAX_PATH];
PROCESS_INFORMATION info;
STARTUPINFOA startup;
WNDCLASS class;
WNDCLASSA class;
MSG msg;
BOOL ret;
@@ -395,7 +395,7 @@ static void do_parent(void)
class.lpfnWndProc = callback_parent;
class.cbClsExtra = 0;
class.cbWndExtra = 0;
class.hInstance = GetModuleHandle(NULL);
class.hInstance = GetModuleHandleA(NULL);
class.hIcon = NULL;
class.hCursor = NULL;
class.hbrBackground = NULL;
@@ -403,7 +403,7 @@ static void do_parent(void)
class.lpszClassName = "cursor_parent";
SetLastError(0xdeadbeef);
ret = RegisterClass(&class);
ret = RegisterClassA(&class);
ok(ret, "Failed to register window class. Error: %u\n", GetLastError());
/* Create a window. */
@@ -422,17 +422,17 @@ static void do_parent(void)
child_process = info.hProcess;
/* Wait for child window handle. */
while ((child == 0) && (ret = GetMessage(&msg, parent, 0, 0)))
while ((child == 0) && (ret = GetMessageA(&msg, parent, 0, 0)))
{
ok(ret != -1, "GetMessage failed. Error: %u\n", GetLastError());
TranslateMessage(&msg);
DispatchMessage(&msg);
DispatchMessageA(&msg);
}
}
static void finish_child_process(void)
{
SendMessage(child, WM_CLOSE, 0, 0);
SendMessageA(child, WM_CLOSE, 0, 0);
winetest_wait_child_process( child_process );
CloseHandle(child_process);
}
@@ -462,7 +462,7 @@ static void test_child_process(void)
SetCursor(cursor);
/* Destroy the cursor. */
SendMessage(child, WM_USER+1, 0, (LPARAM) cursor);
SendMessageA(child, WM_USER+1, 0, (LPARAM) cursor);
}
static BOOL color_match(COLORREF a, COLORREF b)
@@ -486,8 +486,8 @@ static void test_CopyImage_Check(HBITMAP bitmap, UINT flags, INT copyWidth, INT
ok(copy != NULL, "CopyImage() failed\n");
if (copy != NULL)
{
GetObject(bitmap, sizeof(origBitmap), &origBitmap);
GetObject(copy, sizeof(copyBitmap), &copyBitmap);
GetObjectA(bitmap, sizeof(origBitmap), &origBitmap);
GetObjectA(copy, sizeof(copyBitmap), &copyBitmap);
orig_is_dib = (origBitmap.bmBits != NULL);
copy_is_dib = (copyBitmap.bmBits != NULL);
@@ -688,7 +688,7 @@ static void test_initial_cursor(void)
/* Check what handle GetCursor() returns if a cursor is not set yet. */
SetLastError(0xdeadbeef);
cursor2 = LoadCursor(NULL, IDC_WAIT);
cursor2 = LoadCursorA(NULL, (LPCSTR)IDC_WAIT);
todo_wine {
ok(cursor == cursor2, "cursor (%p) is not IDC_WAIT (%p).\n", cursor, cursor2);
}
@@ -710,7 +710,7 @@ static void test_icon_info_dbg(HICON hIcon, UINT exp_cx, UINT exp_cy, UINT exp_m
ok_(__FILE__, line)(info.yHotspot == exp_cy/2, "info.yHotspot = %u\n", info.yHotspot);
ok_(__FILE__, line)(info.hbmMask != 0, "info.hbmMask is NULL\n");
ret = GetObject(info.hbmMask, sizeof(bmMask), &bmMask);
ret = GetObjectA(info.hbmMask, sizeof(bmMask), &bmMask);
ok_(__FILE__, line)(ret == sizeof(bmMask), "GetObject(info.hbmMask) failed, ret %u\n", ret);
if (exp_bpp == 1)
@@ -725,7 +725,7 @@ static void test_icon_info_dbg(HICON hIcon, UINT exp_cx, UINT exp_cy, UINT exp_m
display_bpp = GetDeviceCaps(hdc, BITSPIXEL);
ReleaseDC(0, hdc);
ret = GetObject(info.hbmColor, sizeof(bmColor), &bmColor);
ret = GetObjectA(info.hbmColor, sizeof(bmColor), &bmColor);
ok_(__FILE__, line)(ret == sizeof(bmColor), "GetObject(info.hbmColor) failed, ret %u\n", ret);
ok_(__FILE__, line)(bmColor.bmBitsPixel == display_bpp /* XP */ ||
@@ -1043,7 +1043,7 @@ static void test_LoadImageBitmap(const char * test_desc, HBITMAP hbm)
DWORD ret, pixel = 0;
HDC hdc = GetDC(NULL);
ret = GetObject(hbm, sizeof(bm), &bm);
ret = GetObjectA(hbm, sizeof(bm), &bm);
ok(ret == sizeof(bm), "GetObject returned %d\n", ret);
memset(&bmi, 0, sizeof(bmi));
@@ -1219,7 +1219,7 @@ static void test_LoadImage(void)
DeleteFileA("icon.ico");
/* Test a system icon */
handle = LoadIcon( 0, IDI_HAND );
handle = LoadIconA( 0, (LPCSTR)IDI_HAND );
ok(handle != NULL, "LoadImage() failed.\n");
if (pGetIconInfoExA)
{
@@ -1976,7 +1976,7 @@ static void check_DrawState_Size(HDC hdc, BOOL maskvalue, UINT32 color, int bpp,
SetPixelV(hdc, 2, 2, background);
/* Let DrawState calculate the size of the icon (it's 1x1) */
DrawState(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 0, 0, (DST_ICON | flags ));
DrawStateA(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 0, 0, (DST_ICON | flags ));
result = GetPixel(hdc, 0, 0);
passed[0] = color_match(result, background);
@@ -1990,7 +1990,7 @@ static void check_DrawState_Size(HDC hdc, BOOL maskvalue, UINT32 color, int bpp,
* width/height 2x2 if the icon is only 1x1 pixels in size should
* result in drawing it with size 1x1. The size parameters must be
* ignored if a Icon has to be drawn! */
DrawState(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 2, 2, (DST_ICON | flags ));
DrawStateA(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 2, 2, (DST_ICON | flags ));
result = GetPixel(hdc, 0, 0);
passed[1] = color_match(result, background);
@@ -2026,7 +2026,7 @@ static void check_DrawState_Color(HDC hdc, BOOL maskvalue, UINT32 color, int bpp
/* Set color of the pixel that will be checked afterwards */
SetPixelV(hdc, 1, 1, background);
DrawState(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 0, 0, ( DST_ICON | flags ));
DrawStateA(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 0, 0, ( DST_ICON | flags ));
/* Check the color of the pixel is correct */
result = GetPixel(hdc, 1, 1);
@@ -2095,7 +2095,7 @@ static DWORD CALLBACK set_cursor_thread( void *arg )
{
HCURSOR ret;
PeekMessage( 0, 0, 0, 0, PM_NOREMOVE ); /* create a msg queue */
PeekMessageA( 0, 0, 0, 0, PM_NOREMOVE ); /* create a msg queue */
if (parent_id)
{
BOOL ret = AttachThreadInput( GetCurrentThreadId(), parent_id, TRUE );
@@ -2214,7 +2214,7 @@ static DWORD CALLBACK show_cursor_thread( void *arg )
DWORD count = (DWORD_PTR)arg;
int ret;
PeekMessage( 0, 0, 0, 0, PM_NOREMOVE ); /* create a msg queue */
PeekMessageA( 0, 0, 0, 0, PM_NOREMOVE ); /* create a msg queue */
if (parent_id)
{
BOOL ret = AttachThreadInput( GetCurrentThreadId(), parent_id, TRUE );
@@ -2242,8 +2242,8 @@ static void test_ShowCursor(void)
ok( info.flags & CURSOR_SHOWING, "cursor not shown in info\n" );
}
event_start = CreateEvent( NULL, FALSE, FALSE, NULL );
event_next = CreateEvent( NULL, FALSE, FALSE, NULL );
event_start = CreateEventW( NULL, FALSE, FALSE, NULL );
event_next = CreateEventW( NULL, FALSE, FALSE, NULL );
count = ShowCursor( TRUE );
ok( count == 1, "wrong count %d\n", count );
@@ -2448,7 +2448,7 @@ static void test_DestroyCursor(void)
DeleteObject(cursorInfo.hbmColor);
/* Try testing DestroyCursor() now using LoadCursor() cursors. */
cursor = LoadCursor(NULL, IDC_ARROW);
cursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
SetLastError(0xdeadbeef);
ret = DestroyCursor(cursor);
@@ -2463,11 +2463,11 @@ static void test_DestroyCursor(void)
ok(error == 0xdeadbeef, "Last error: 0x%08x\n", error);
/* Check if LoadCursor() returns the same handle with the same icon. */
cursor2 = LoadCursor(NULL, IDC_ARROW);
cursor2 = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
ok(cursor2 == cursor, "cursor == %p, cursor2 == %p\n", cursor, cursor2);
/* Check if LoadCursor() returns the same handle with a different icon. */
cursor2 = LoadCursor(NULL, IDC_WAIT);
cursor2 = LoadCursorA(NULL, (LPCSTR)IDC_WAIT);
ok(cursor2 != cursor, "cursor == %p, cursor2 == %p\n", cursor, cursor2);
}
+5 -4
View File
@@ -40,7 +40,8 @@ static void test_dc_attributes(void)
{
HDC hdc, old_hdc;
HDC hdcs[20];
INT i, rop, def_rop, found_dc;
INT i, rop, def_rop;
BOOL found_dc;
/* test cache DC */
@@ -59,7 +60,7 @@ static void test_dc_attributes(void)
ReleaseDC( hwnd_cache, hdc );
old_hdc = hdc;
found_dc = 0;
found_dc = FALSE;
for (i = 0; i < 20; i++)
{
hdc = hdcs[i] = GetDCEx( hwnd_cache, 0, DCX_USESTYLE | DCX_NORESETATTRS );
@@ -68,7 +69,7 @@ static void test_dc_attributes(void)
ok( rop == def_rop, "wrong ROP2 %d after release %p/%p\n", rop, old_hdc, hdc );
if (hdc == old_hdc)
{
found_dc = 1;
found_dc = TRUE;
SetROP2( hdc, R2_WHITE );
}
}
@@ -581,7 +582,7 @@ START_TEST(dce)
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, IDC_ARROW);
cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "cache_class";
+7 -7
View File
@@ -2397,8 +2397,8 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
char str[MAX_PATH];
static int msg_index = 0;
static HCONV conversation = 0;
static char test_service [] = "TestDDEService";
static char test_topic [] = "TestDDETopic";
static const char test_service [] = "TestDDEService";
static const char test_topic [] = "TestDDETopic";
msg_index++;
@@ -2586,10 +2586,10 @@ static void test_end_to_end_client(BOOL type_a)
HSZ server, topic;
HCONV hconv;
HDDEDATA hdata;
static char test_service[] = "TestDDEService";
static WCHAR test_service_w[] = {'T','e','s','t','D','D','E','S','e','r','v','i','c','e',0};
static char test_topic[] = "TestDDETopic";
static WCHAR test_topic_w[] = {'T','e','s','t','D','D','E','T','o','p','i','c',0};
static const char test_service[] = "TestDDEService";
static const WCHAR test_service_w[] = {'T','e','s','t','D','D','E','S','e','r','v','i','c','e',0};
static const char test_topic[] = "TestDDETopic";
static const WCHAR test_topic_w[] = {'T','e','s','t','D','D','E','T','o','p','i','c',0};
trace("Start end to end client %s\n", type_a ? "ASCII" : "UNICODE");
@@ -2651,7 +2651,7 @@ static void test_end_to_end_server(HANDLE hproc, HANDLE hthread, BOOL type_a)
BOOL ret;
DWORD res;
HDDEDATA hdata;
static CHAR test_service[] = "TestDDEService";
static const char test_service[] = "TestDDEService";
trace("start end to end server %s\n", type_a ? "ASCII" : "UNICODE");
server_pid = 0;
+1 -1
View File
@@ -54,7 +54,7 @@ static HWND g_hwndInitialFocusT1, g_hwndInitialFocusT2, g_hwndInitialFocusGroupB
static LONG g_styleInitialFocusT1, g_styleInitialFocusT2;
static BOOL g_bInitialFocusInitDlgResult, g_bReceivedCommand;
static int g_terminated;
static BOOL g_terminated;
typedef struct {
INT_PTR id;
+76 -76
View File
@@ -246,7 +246,7 @@ static BOOL do_test( HWND hwnd, int seqnr, const KEV td[] )
if (winetest_debug > 1)
trace("======== key stroke sequence #%d: %s =============\n",
seqnr + 1, buf);
while( PeekMessage(&msg,hwnd,WM_KEYFIRST,WM_KEYLAST,PM_REMOVE) ) {
while( PeekMessageA(&msg,hwnd,WM_KEYFIRST,WM_KEYLAST,PM_REMOVE) ) {
if (winetest_debug > 1)
trace("message[%d] %-15s wParam %04lx lParam %08lx time %x\n", i,
MSGNAME[msg.message - WM_KEYFIRST], msg.wParam, msg.lParam, msg.time);
@@ -344,8 +344,8 @@ static void test_Input_whitebox(void)
wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = WndProc;
wclass.hInstance = hInstance;
wclass.hIcon = LoadIconA( 0, IDI_APPLICATION );
wclass.hCursor = LoadCursorA( NULL, IDC_ARROW );
wclass.hIcon = LoadIconA( 0, (LPCSTR)IDI_APPLICATION );
wclass.hCursor = LoadCursorA( NULL, (LPCSTR)IDC_ARROW );
wclass.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 );
wclass.lpszMenuName = 0;
wclass.cbClsExtra = 0;
@@ -362,7 +362,7 @@ static void test_Input_whitebox(void)
UpdateWindow( hWndTest);
/* flush pending messages */
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
SetFocus( hWndTest );
TestSysKeys( hWndTest );
@@ -390,13 +390,13 @@ static void empty_message_queue(void)
while (diff > 0)
{
if (MsgWaitForMultipleObjects(0, NULL, FALSE, min_timeout, QS_ALLINPUT) == WAIT_TIMEOUT) break;
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
if (is_keyboard_message(msg.message) || is_mouse_message(msg.message))
ok(msg.time != 0, "message %#x has time set to 0\n", msg.message);
TranslateMessage(&msg);
DispatchMessage(&msg);
DispatchMessageA(&msg);
}
diff = time - GetTickCount();
}
@@ -437,83 +437,83 @@ static const struct sendinput_test_s {
} sendinput_test[] = {
/* test ALT+F */
/* 0 */
{VK_LMENU, 0, 0, {{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {0}},
{VK_LMENU, 0, FALSE, {{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook|wparam, VK_LMENU}, {WM_SYSKEYDOWN}, {0}}},
{'F', 0, 0, {{'F', 0x00}, {0}},
{'F', 0, FALSE, {{'F', 0x00}, {0}},
{{WM_SYSKEYDOWN, hook}, {WM_SYSKEYDOWN},
{WM_SYSCHAR},
{WM_SYSCOMMAND}, {0}}},
{'F', KEYEVENTF_KEYUP, 0, {{'F', 0x80}, {0}},
{'F', KEYEVENTF_KEYUP, FALSE, {{'F', 0x80}, {0}},
{{WM_SYSKEYUP, hook}, {WM_SYSKEYUP}, {0}}},
{VK_LMENU, KEYEVENTF_KEYUP, 0, {{VK_MENU, 0x80}, {VK_LMENU, 0x80}, {0}},
{VK_LMENU, KEYEVENTF_KEYUP, FALSE, {{VK_MENU, 0x80}, {VK_LMENU, 0x80}, {0}},
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
/* test CTRL+O */
/* 4 */
{VK_LCONTROL, 0, 0, {{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
{VK_LCONTROL, 0, FALSE, {{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook}, {WM_KEYDOWN}, {0}}},
{'O', 0, 0, {{'O', 0x00}, {0}},
{'O', 0, FALSE, {{'O', 0x00}, {0}},
{{WM_KEYDOWN, hook}, {WM_KEYDOWN}, {WM_CHAR}, {0}}},
{'O', KEYEVENTF_KEYUP, 0, {{'O', 0x80}, {0}},
{'O', KEYEVENTF_KEYUP, FALSE, {{'O', 0x80}, {0}},
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
{VK_LCONTROL, KEYEVENTF_KEYUP, 0, {{VK_CONTROL, 0x80}, {VK_LCONTROL, 0x80}, {0}},
{VK_LCONTROL, KEYEVENTF_KEYUP, FALSE, {{VK_CONTROL, 0x80}, {VK_LCONTROL, 0x80}, {0}},
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
/* test ALT+CTRL+X */
/* 8 */
{VK_LMENU, 0, 0, {{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {0}},
{VK_LMENU, 0, FALSE, {{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook}, {WM_SYSKEYDOWN}, {0}}},
{VK_LCONTROL, 0, 0, {{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
{VK_LCONTROL, 0, FALSE, {{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook}, {WM_KEYDOWN}, {0}}},
{'X', 0, 0, {{'X', 0x00}, {0}},
{'X', 0, FALSE, {{'X', 0x00}, {0}},
{{WM_KEYDOWN, hook}, {WM_KEYDOWN}, {0}}},
{'X', KEYEVENTF_KEYUP, 0, {{'X', 0x80}, {0}},
{'X', KEYEVENTF_KEYUP, FALSE, {{'X', 0x80}, {0}},
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
{VK_LCONTROL, KEYEVENTF_KEYUP, 0, {{VK_CONTROL, 0x80}, {VK_LCONTROL, 0x80}, {0}},
{VK_LCONTROL, KEYEVENTF_KEYUP, FALSE, {{VK_CONTROL, 0x80}, {VK_LCONTROL, 0x80}, {0}},
{{WM_SYSKEYUP, hook}, {WM_SYSKEYUP}, {0}}},
{VK_LMENU, KEYEVENTF_KEYUP, 0, {{VK_MENU, 0x80}, {VK_LMENU, 0x80}, {0}},
{VK_LMENU, KEYEVENTF_KEYUP, FALSE, {{VK_MENU, 0x80}, {VK_LMENU, 0x80}, {0}},
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
/* test SHIFT+A */
/* 14 */
{VK_LSHIFT, 0, 0, {{VK_SHIFT, 0x00}, {VK_LSHIFT, 0x00}, {0}},
{VK_LSHIFT, 0, FALSE, {{VK_SHIFT, 0x00}, {VK_LSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook}, {WM_KEYDOWN}, {0}}},
{'A', 0, 0, {{'A', 0x00}, {0}},
{'A', 0, FALSE, {{'A', 0x00}, {0}},
{{WM_KEYDOWN, hook}, {WM_KEYDOWN}, {WM_CHAR}, {0}}},
{'A', KEYEVENTF_KEYUP, 0, {{'A', 0x80}, {0}},
{'A', KEYEVENTF_KEYUP, FALSE, {{'A', 0x80}, {0}},
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
{VK_LSHIFT, KEYEVENTF_KEYUP, 0, {{VK_SHIFT, 0x80}, {VK_LSHIFT, 0x80}, {0}},
{VK_LSHIFT, KEYEVENTF_KEYUP, FALSE, {{VK_SHIFT, 0x80}, {VK_LSHIFT, 0x80}, {0}},
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
/* test L-SHIFT & R-SHIFT: */
/* RSHIFT == LSHIFT */
/* 18 */
{VK_RSHIFT, 0, 0,
{VK_RSHIFT, 0, FALSE,
/* recent windows versions (>= w2k3) correctly report an RSHIFT transition */
{{VK_SHIFT, 0x00}, {VK_LSHIFT, 0x00, TRUE}, {VK_RSHIFT, 0x00, TRUE}, {0}},
{{WM_KEYDOWN, hook|wparam, VK_RSHIFT},
{WM_KEYDOWN}, {0}}},
{VK_RSHIFT, KEYEVENTF_KEYUP, 0,
{VK_RSHIFT, KEYEVENTF_KEYUP, FALSE,
{{VK_SHIFT, 0x80}, {VK_LSHIFT, 0x80, TRUE}, {VK_RSHIFT, 0x80, TRUE}, {0}},
{{WM_KEYUP, hook, hook|wparam, VK_RSHIFT},
{WM_KEYUP}, {0}}},
/* LSHIFT | KEYEVENTF_EXTENDEDKEY == RSHIFT */
/* 20 */
{VK_LSHIFT, KEYEVENTF_EXTENDEDKEY, 0,
{VK_LSHIFT, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_SHIFT, 0x00}, {VK_RSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_LSHIFT, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam, VK_SHIFT, 0}, {0}}},
{VK_LSHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 0,
{VK_LSHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_SHIFT, 0x80}, {VK_RSHIFT, 0x80}, {0}},
{{WM_KEYUP, hook|wparam|lparam, VK_LSHIFT, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_SHIFT, KF_UP}, {0}}},
/* RSHIFT | KEYEVENTF_EXTENDEDKEY == RSHIFT */
/* 22 */
{VK_RSHIFT, KEYEVENTF_EXTENDEDKEY, 0,
{VK_RSHIFT, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_SHIFT, 0x00}, {VK_RSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_RSHIFT, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam, VK_SHIFT, 0}, {0}}},
{VK_RSHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 0,
{VK_RSHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_SHIFT, 0x80}, {VK_RSHIFT, 0x80}, {0}},
{{WM_KEYUP, hook|wparam|lparam, VK_RSHIFT, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_SHIFT, KF_UP}, {0}}},
@@ -524,21 +524,21 @@ static const struct sendinput_test_s {
*/
/* SHIFT == LSHIFT */
/* 24 */
{VK_SHIFT, 0, 0,
{VK_SHIFT, 0, FALSE,
{{VK_SHIFT, 0x00}, {VK_LSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook/* |wparam */|lparam, VK_SHIFT, 0},
{WM_KEYDOWN, wparam|lparam, VK_SHIFT, 0}, {0}}},
{VK_SHIFT, KEYEVENTF_KEYUP, 0,
{VK_SHIFT, KEYEVENTF_KEYUP, FALSE,
{{VK_SHIFT, 0x80}, {VK_LSHIFT, 0x80}, {0}},
{{WM_KEYUP, hook/*|wparam*/|lparam, VK_SHIFT, LLKHF_UP},
{WM_KEYUP, wparam|lparam, VK_SHIFT, KF_UP}, {0}}},
/* SHIFT | KEYEVENTF_EXTENDEDKEY == RSHIFT */
/* 26 */
{VK_SHIFT, KEYEVENTF_EXTENDEDKEY, 0,
{VK_SHIFT, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_SHIFT, 0x00}, {VK_RSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook/*|wparam*/|lparam, VK_SHIFT, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam, VK_SHIFT, 0}, {0}}},
{VK_SHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 0,
{VK_SHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_SHIFT, 0x80}, {VK_RSHIFT, 0x80}, {0}},
{{WM_KEYUP, hook/*|wparam*/|lparam, VK_SHIFT, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_SHIFT, KF_UP}, {0}}},
@@ -546,51 +546,51 @@ static const struct sendinput_test_s {
/* test L-CONTROL & R-CONTROL: */
/* RCONTROL == LCONTROL */
/* 28 */
{VK_RCONTROL, 0, 0,
{VK_RCONTROL, 0, FALSE,
{{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam, VK_RCONTROL},
{WM_KEYDOWN, wparam|lparam, VK_CONTROL, 0}, {0}}},
{VK_RCONTROL, KEYEVENTF_KEYUP, 0,
{VK_RCONTROL, KEYEVENTF_KEYUP, FALSE,
{{VK_CONTROL, 0x80}, {VK_LCONTROL, 0x80}, {0}},
{{WM_KEYUP, hook|wparam, VK_RCONTROL},
{WM_KEYUP, wparam|lparam, VK_CONTROL, KF_UP}, {0}}},
/* LCONTROL | KEYEVENTF_EXTENDEDKEY == RCONTROL */
/* 30 */
{VK_LCONTROL, KEYEVENTF_EXTENDEDKEY, 0,
{VK_LCONTROL, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_CONTROL, 0x00}, {VK_RCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_LCONTROL, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam, VK_CONTROL, KF_EXTENDED}, {0}}},
{VK_LCONTROL, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 0,
{VK_LCONTROL, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_CONTROL, 0x80}, {VK_RCONTROL, 0x80}, {0}},
{{WM_KEYUP, hook|wparam|lparam, VK_LCONTROL, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_CONTROL, KF_UP|KF_EXTENDED}, {0}}},
/* RCONTROL | KEYEVENTF_EXTENDEDKEY == RCONTROL */
/* 32 */
{VK_RCONTROL, KEYEVENTF_EXTENDEDKEY, 0,
{VK_RCONTROL, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_CONTROL, 0x00}, {VK_RCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_RCONTROL, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam, VK_CONTROL, KF_EXTENDED}, {0}}},
{VK_RCONTROL, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 0,
{VK_RCONTROL, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_CONTROL, 0x80}, {VK_RCONTROL, 0x80}, {0}},
{{WM_KEYUP, hook|wparam|lparam, VK_RCONTROL, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_CONTROL, KF_UP|KF_EXTENDED}, {0}}},
/* CONTROL == LCONTROL */
/* 34 */
{VK_CONTROL, 0, 0,
{VK_CONTROL, 0, FALSE,
{{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook/*|wparam, VK_CONTROL*/},
{WM_KEYDOWN, wparam|lparam, VK_CONTROL, 0}, {0}}},
{VK_CONTROL, KEYEVENTF_KEYUP, 0,
{VK_CONTROL, KEYEVENTF_KEYUP, FALSE,
{{VK_CONTROL, 0x80}, {VK_LCONTROL, 0x80}, {0}},
{{WM_KEYUP, hook/*|wparam, VK_CONTROL*/},
{WM_KEYUP, wparam|lparam, VK_CONTROL, KF_UP}, {0}}},
/* CONTROL | KEYEVENTF_EXTENDEDKEY == RCONTROL */
/* 36 */
{VK_CONTROL, KEYEVENTF_EXTENDEDKEY, 0,
{VK_CONTROL, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_CONTROL, 0x00}, {VK_RCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook/*|wparam*/|lparam, VK_CONTROL, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam, VK_CONTROL, KF_EXTENDED}, {0}}},
{VK_CONTROL, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 0,
{VK_CONTROL, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_CONTROL, 0x80}, {VK_RCONTROL, 0x80}, {0}},
{{WM_KEYUP, hook/*|wparam*/|lparam, VK_CONTROL, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_CONTROL, KF_UP|KF_EXTENDED}, {0}}},
@@ -598,13 +598,13 @@ static const struct sendinput_test_s {
/* test L-MENU & R-MENU: */
/* RMENU == LMENU */
/* 38 */
{VK_RMENU, 0, 0,
{VK_RMENU, 0, FALSE,
{{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {VK_CONTROL, 0x00, 1}, {VK_LCONTROL, 0x01, 1}, {0}},
{{WM_SYSKEYDOWN, hook|wparam|optional, VK_LCONTROL},
{WM_SYSKEYDOWN, hook|wparam, VK_RMENU},
{WM_KEYDOWN, wparam|lparam|optional, VK_CONTROL, 0},
{WM_SYSKEYDOWN, wparam|lparam, VK_MENU, 0}, {0}}},
{VK_RMENU, KEYEVENTF_KEYUP, 1,
{VK_RMENU, KEYEVENTF_KEYUP, TRUE,
{{VK_MENU, 0x80}, {VK_LMENU, 0x80}, {VK_CONTROL, 0x81, 1}, {VK_LCONTROL, 0x80, 1}, {0}},
{{WM_KEYUP, hook|wparam|optional, VK_LCONTROL},
{WM_KEYUP, hook|wparam, VK_RMENU},
@@ -613,24 +613,24 @@ static const struct sendinput_test_s {
{WM_SYSCOMMAND, optional}, {0}}},
/* LMENU | KEYEVENTF_EXTENDEDKEY == RMENU */
/* 40 */
{VK_LMENU, KEYEVENTF_EXTENDEDKEY, 0,
{VK_LMENU, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_MENU, 0x00}, {VK_RMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook|wparam|lparam, VK_LMENU, LLKHF_EXTENDED},
{WM_SYSKEYDOWN, wparam|lparam, VK_MENU, KF_EXTENDED}, {0}}},
{VK_LMENU, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 1,
{VK_LMENU, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, TRUE,
{{VK_MENU, 0x80}, {VK_RMENU, 0x80}, {0}},
{{WM_KEYUP, hook|wparam|lparam, VK_LMENU, LLKHF_UP|LLKHF_EXTENDED},
{WM_SYSKEYUP, wparam|lparam, VK_MENU, KF_UP|KF_EXTENDED},
{WM_SYSCOMMAND}, {0}}},
/* RMENU | KEYEVENTF_EXTENDEDKEY == RMENU */
/* 42 */
{VK_RMENU, KEYEVENTF_EXTENDEDKEY, 0,
{VK_RMENU, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_MENU, 0x00}, {VK_RMENU, 0x00}, {VK_CONTROL, 0x00, 1}, {VK_LCONTROL, 0x01, 1}, {0}},
{{WM_SYSKEYDOWN, hook|wparam|lparam|optional, VK_LCONTROL, 0},
{WM_SYSKEYDOWN, hook|wparam|lparam, VK_RMENU, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam|optional, VK_CONTROL, 0},
{WM_SYSKEYDOWN, wparam|lparam, VK_MENU, KF_EXTENDED}, {0}}},
{VK_RMENU, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 1,
{VK_RMENU, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, TRUE,
{{VK_MENU, 0x80}, {VK_RMENU, 0x80}, {VK_CONTROL, 0x81, 1}, {VK_LCONTROL, 0x80, 1}, {0}},
{{WM_KEYUP, hook|wparam|lparam|optional, VK_LCONTROL, LLKHF_UP},
{WM_KEYUP, hook|wparam|lparam, VK_RMENU, LLKHF_UP|LLKHF_EXTENDED},
@@ -639,23 +639,23 @@ static const struct sendinput_test_s {
{WM_SYSCOMMAND, optional}, {0}}},
/* MENU == LMENU */
/* 44 */
{VK_MENU, 0, 0,
{VK_MENU, 0, FALSE,
{{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook/*|wparam, VK_MENU*/},
{WM_SYSKEYDOWN, wparam|lparam, VK_MENU, 0}, {0}}},
{VK_MENU, KEYEVENTF_KEYUP, 1,
{VK_MENU, KEYEVENTF_KEYUP, TRUE,
{{VK_MENU, 0x80}, {VK_LMENU, 0x80}, {0}},
{{WM_KEYUP, hook/*|wparam, VK_MENU*/},
{WM_SYSKEYUP, wparam|lparam, VK_MENU, KF_UP},
{WM_SYSCOMMAND}, {0}}},
/* MENU | KEYEVENTF_EXTENDEDKEY == RMENU */
/* 46 */
{VK_MENU, KEYEVENTF_EXTENDEDKEY, 0,
{VK_MENU, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_MENU, 0x00}, {VK_RMENU, 0x00}, {VK_CONTROL, 0x00, 1}, {VK_LCONTROL, 0x01, 1}, {0}},
{{WM_SYSKEYDOWN, hook|wparam|lparam|optional, VK_CONTROL, 0},
{WM_SYSKEYDOWN, hook/*|wparam*/|lparam, VK_MENU, LLKHF_EXTENDED},
{WM_SYSKEYDOWN, wparam|lparam, VK_MENU, KF_EXTENDED}, {0}}},
{VK_MENU, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 1,
{VK_MENU, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, TRUE,
{{VK_MENU, 0x80}, {VK_RMENU, 0x80}, {VK_CONTROL, 0x81, 1}, {VK_LCONTROL, 0x80, 1}, {0}},
{{WM_KEYUP, hook|wparam|lparam|optional, VK_CONTROL, LLKHF_UP},
{WM_KEYUP, hook/*|wparam*/|lparam, VK_MENU, LLKHF_UP|LLKHF_EXTENDED},
@@ -664,24 +664,24 @@ static const struct sendinput_test_s {
/* test LSHIFT & RSHIFT */
/* 48 */
{VK_LSHIFT, 0, 0,
{VK_LSHIFT, 0, FALSE,
{{VK_SHIFT, 0x00}, {VK_LSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_LSHIFT, 0},
{WM_KEYDOWN, wparam|lparam, VK_SHIFT, 0}, {0}}},
{VK_RSHIFT, KEYEVENTF_EXTENDEDKEY, 0,
{VK_RSHIFT, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_RSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_RSHIFT, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam, VK_SHIFT, 0}, {0}}},
{VK_RSHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 0,
{VK_RSHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_RSHIFT, 0x80}, {0}},
{{WM_KEYUP, hook|wparam|lparam, VK_RSHIFT, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, optional}, {0}}},
{VK_LSHIFT, KEYEVENTF_KEYUP, 0,
{VK_LSHIFT, KEYEVENTF_KEYUP, FALSE,
{{VK_SHIFT, 0x80}, {VK_LSHIFT, 0x80}, {0}},
{{WM_KEYUP, hook|wparam, VK_LSHIFT},
{WM_KEYUP, wparam|lparam, VK_SHIFT, KF_UP}, {0}}},
{0, 0, 0, {{0}}, {{0}}} /* end */
{0, 0, FALSE, {{0}}, {{0}}} /* end */
};
static struct message sent_messages[MAXKEYMESSAGES];
@@ -696,7 +696,7 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2, const struct sendinp
const struct message *expected = test->expected_messages;
while (t->wVk) {
int matched = ((ks1[t->wVk]&0x80) == (t->before_state&0x80)
BOOL matched = ((ks1[t->wVk]&0x80) == (t->before_state&0x80)
&& (ks2[t->wVk]&0x80) == (~t->before_state&0x80));
if (!matched && !t->optional && test->_todo_wine)
@@ -865,7 +865,7 @@ static LRESULT CALLBACK WndProc2(HWND hWnd, UINT Msg, WPARAM wParam,
sent_messages[sent_messages_cnt++].lParam = HIWORD(lParam) & (KF_UP|KF_EXTENDED);
}
}
return DefWindowProc(hWnd, Msg, wParam, lParam);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
}
static LRESULT CALLBACK hook_proc(int code, WPARAM wparam, LPARAM lparam)
@@ -911,7 +911,7 @@ static void test_Input_blackbox(void)
skip("Skipping Input_blackbox test on non-US keyboard\n");
return;
}
window = CreateWindow("Static", NULL, WS_POPUP|WS_HSCROLL|WS_VSCROLL
window = CreateWindowA("Static", NULL, WS_POPUP|WS_HSCROLL|WS_VSCROLL
|WS_VISIBLE, 0, 0, 200, 60, NULL, NULL,
NULL, NULL);
ok(window != NULL, "error: %d\n", (int) GetLastError());
@@ -929,7 +929,7 @@ static void test_Input_blackbox(void)
* key state set by SendInput(). */
empty_message_queue();
prevWndProc = SetWindowLongPtr(window, GWLP_WNDPROC, (LONG_PTR) WndProc2);
prevWndProc = SetWindowLongPtrA(window, GWLP_WNDPROC, (LONG_PTR) WndProc2);
ok(prevWndProc != 0 || (prevWndProc == 0 && GetLastError() == 0),
"error: %d\n", (int) GetLastError());
@@ -1160,8 +1160,8 @@ static void test_Input_unicode(void)
wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = unicode_wnd_proc;
wclass.hInstance = hInstance;
wclass.hIcon = LoadIcon(0, IDI_APPLICATION);
wclass.hCursor = LoadCursor( NULL, IDC_ARROW);
wclass.hIcon = LoadIconW(0, (LPCWSTR)IDI_APPLICATION);
wclass.hCursor = LoadCursorW( NULL, (LPCWSTR)IDC_ARROW);
wclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wclass.lpszMenuName = 0;
wclass.cbClsExtra = 0;
@@ -1171,7 +1171,7 @@ static void test_Input_unicode(void)
return;
}
hModuleImm32 = LoadLibrary("imm32.dll");
hModuleImm32 = LoadLibraryA("imm32.dll");
if (hModuleImm32) {
pImmDisableIME = (void *)GetProcAddress(hModuleImm32, "ImmDisableIME");
if (pImmDisableIME)
@@ -1280,7 +1280,7 @@ static void test_mouse_ll_hook(void)
RECT rc;
GetCursorPos(&pt_org);
hwnd = CreateWindow("static", "Title", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
hwnd = CreateWindowA("static", "Title", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
10, 10, 200, 200, NULL, NULL, NULL, NULL);
SetCursorPos(100, 100);
@@ -1503,34 +1503,34 @@ static void test_key_map(void)
{ VK_NUMPAD9, VK_PRIOR },
};
s = MapVirtualKeyEx(VK_SHIFT, MAPVK_VK_TO_VSC, kl);
s = MapVirtualKeyExA(VK_SHIFT, MAPVK_VK_TO_VSC, kl);
ok(s != 0, "MapVirtualKeyEx(VK_SHIFT) should return non-zero\n");
sL = MapVirtualKeyEx(VK_LSHIFT, MAPVK_VK_TO_VSC, kl);
sL = MapVirtualKeyExA(VK_LSHIFT, MAPVK_VK_TO_VSC, kl);
ok(s == sL || broken(sL == 0), /* win9x */
"%x != %x\n", s, sL);
kL = MapVirtualKeyEx(0x2a, MAPVK_VSC_TO_VK, kl);
kL = MapVirtualKeyExA(0x2a, MAPVK_VSC_TO_VK, kl);
ok(kL == VK_SHIFT, "Scan code -> vKey = %x (not VK_SHIFT)\n", kL);
kR = MapVirtualKeyEx(0x36, MAPVK_VSC_TO_VK, kl);
kR = MapVirtualKeyExA(0x36, MAPVK_VSC_TO_VK, kl);
ok(kR == VK_SHIFT, "Scan code -> vKey = %x (not VK_SHIFT)\n", kR);
kL = MapVirtualKeyEx(0x2a, MAPVK_VSC_TO_VK_EX, kl);
kL = MapVirtualKeyExA(0x2a, MAPVK_VSC_TO_VK_EX, kl);
ok(kL == VK_LSHIFT || broken(kL == 0), /* win9x */
"Scan code -> vKey = %x (not VK_LSHIFT)\n", kL);
kR = MapVirtualKeyEx(0x36, MAPVK_VSC_TO_VK_EX, kl);
kR = MapVirtualKeyExA(0x36, MAPVK_VSC_TO_VK_EX, kl);
ok(kR == VK_RSHIFT || broken(kR == 0), /* win9x */
"Scan code -> vKey = %x (not VK_RSHIFT)\n", kR);
/* test that MAPVK_VSC_TO_VK prefers the non-numpad vkey if there's ambiguity */
for (i = 0; i < sizeof(numpad_collisions)/sizeof(numpad_collisions[0]); i++)
{
UINT numpad_scan = MapVirtualKeyEx(numpad_collisions[i][0], MAPVK_VK_TO_VSC, kl);
UINT other_scan = MapVirtualKeyEx(numpad_collisions[i][1], MAPVK_VK_TO_VSC, kl);
UINT numpad_scan = MapVirtualKeyExA(numpad_collisions[i][0], MAPVK_VK_TO_VSC, kl);
UINT other_scan = MapVirtualKeyExA(numpad_collisions[i][1], MAPVK_VK_TO_VSC, kl);
/* do they really collide for this layout? */
if (numpad_scan && other_scan == numpad_scan)
{
UINT vkey = MapVirtualKeyEx(numpad_scan, MAPVK_VSC_TO_VK, kl);
UINT vkey = MapVirtualKeyExA(numpad_scan, MAPVK_VSC_TO_VK, kl);
ok(vkey != numpad_collisions[i][0],
"Got numpad vKey %x for scan code %x when there was another choice\n",
vkey, numpad_scan);
File diff suppressed because it is too large Load Diff
+69 -7
View File
@@ -31,6 +31,7 @@ static BOOL (WINAPI *pEnumDisplayDevicesA)(LPCSTR,DWORD,LPDISPLAY_DEVICEA,DWORD)
static BOOL (WINAPI *pEnumDisplayMonitors)(HDC,LPRECT,MONITORENUMPROC,LPARAM);
static BOOL (WINAPI *pGetMonitorInfoA)(HMONITOR,LPMONITORINFO);
static HMONITOR (WINAPI *pMonitorFromPoint)(POINT,DWORD);
static HMONITOR (WINAPI *pMonitorFromRect)(LPCRECT,DWORD);
static HMONITOR (WINAPI *pMonitorFromWindow)(HWND,DWORD);
static void init_function_pointers(void)
@@ -48,6 +49,7 @@ static void init_function_pointers(void)
GET_PROC(EnumDisplayMonitors)
GET_PROC(GetMonitorInfoA)
GET_PROC(MonitorFromPoint)
GET_PROC(MonitorFromRect)
GET_PROC(MonitorFromWindow)
#undef GET_PROC
@@ -161,7 +163,7 @@ static void test_ChangeDisplaySettingsEx(void)
}
SetLastError(0xdeadbeef);
res = EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);
res = EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm);
ok(res, "EnumDisplaySettings error %u\n", GetLastError());
width = dm.dmPelsWidth;
@@ -291,12 +293,13 @@ static void test_ChangeDisplaySettingsEx(void)
static void test_monitors(void)
{
HMONITOR monitor, primary;
HMONITOR monitor, primary, nearest;
POINT pt;
RECT rc;
if (!pMonitorFromPoint || !pMonitorFromWindow)
if (!pMonitorFromPoint || !pMonitorFromWindow || !pMonitorFromRect)
{
win_skip("MonitorFromPoint or MonitorFromWindow are not available\n");
win_skip("MonitorFromPoint, MonitorFromWindow, or MonitorFromRect is not available\n");
return;
}
@@ -310,6 +313,65 @@ static void test_monitors(void)
ok( monitor == primary, "got %p, should get primary %p for MONITOR_DEFAULTTOPRIMARY\n", monitor, primary );
monitor = pMonitorFromWindow( 0, MONITOR_DEFAULTTONEAREST );
ok( monitor == primary, "got %p, should get primary %p for MONITOR_DEFAULTTONEAREST\n", monitor, primary );
SetRect( &rc, 0, 0, 1, 1 );
monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL );
ok( monitor == primary, "got %p, should get primary %p\n", monitor, primary );
monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTOPRIMARY );
ok( monitor == primary, "got %p, should get primary %p\n", monitor, primary );
monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONEAREST );
ok( monitor == primary, "got %p, should get primary %p\n", monitor, primary );
/* Empty rect at 0,0 is considered inside the primary monitor */
SetRect( &rc, 0, 0, -1, -1 );
monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL );
ok( monitor == primary, "got %p, should get primary %p\n", monitor, primary );
/* Even if there is a monitor left of the primary, the primary will have the most overlapping area */
SetRect( &rc, -1, 0, 2, 1 );
monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL );
ok( monitor == primary, "got %p, should get primary %p\n", monitor, primary );
/* But the width of the rect doesn't matter if it's empty. */
SetRect( &rc, -1, 0, 2, -1 );
monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL );
ok( monitor != primary, "got primary %p\n", monitor );
if (!pGetMonitorInfoA)
{
win_skip("GetMonitorInfoA is not available\n");
return;
}
/* Search for a monitor that has no others equally near to (left, top-1) */
SetRect( &rc, -1, -2, 2, 0 );
monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL );
nearest = primary;
while (monitor != NULL)
{
MONITORINFO mi;
BOOL ret;
ok( monitor != primary, "got primary %p\n", monitor );
nearest = monitor;
mi.cbSize = sizeof(mi);
ret = pGetMonitorInfoA( monitor, &mi );
ok( ret, "GetMonitorInfo failed\n" );
SetRect( &rc, mi.rcMonitor.left-1, mi.rcMonitor.top-2, mi.rcMonitor.left+2, mi.rcMonitor.top );
monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL );
}
SetRect( &rc, rc.left+1, rc.top+1, rc.left+2, rc.top+2 );
monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL );
ok( monitor == NULL, "got %p\n", monitor );
monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTOPRIMARY );
ok( monitor == primary, "got %p, should get primary %p\n", monitor, primary );
monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONEAREST );
ok( monitor == nearest, "got %p, should get nearest %p\n", monitor, nearest );
}
static BOOL CALLBACK find_primary_mon(HMONITOR hmon, HDC hdc, LPRECT rc, LPARAM lp)
@@ -356,12 +418,12 @@ static void test_work_area(void)
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom);
SetLastError(0xdeadbeef);
ret = SystemParametersInfo(SPI_GETWORKAREA, 0, &rc_work, 0);
ret = SystemParametersInfoA(SPI_GETWORKAREA, 0, &rc_work, 0);
ok(ret, "SystemParametersInfo error %u\n", GetLastError());
trace("work area (%d,%d-%d,%d)\n", rc_work.left, rc_work.top, rc_work.right, rc_work.bottom);
ok(EqualRect(&rc_work, &mi.rcWork), "work area is different\n");
hwnd = CreateWindowEx(0, "static", NULL, WS_OVERLAPPEDWINDOW|WS_VISIBLE,100,100,10,10,0,0,0,NULL);
hwnd = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW|WS_VISIBLE,100,100,10,10,0,0,0,NULL);
ok(hwnd != 0, "CreateWindowEx failed\n");
ret = GetWindowRect(hwnd, &rc_normal);
@@ -383,7 +445,7 @@ static void test_work_area(void)
else
ok(EqualRect(&rc_normal, &wp.rcNormalPosition), "normal pos is different\n");
SetWindowLong(hwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
SetWindowLongA(hwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
wp.length = sizeof(wp);
ret = GetWindowPlacement(hwnd, &wp);
+177 -44
View File
@@ -444,20 +444,20 @@ static const struct message WmShowOverlappedSeq[] = {
{ WM_NCPAINT, sent|wparam|optional, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
{ WM_ERASEBKGND, sent|optional },
{ HCBT_ACTIVATE, hook },
{ HCBT_ACTIVATE, hook|optional },
{ EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
{ WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
{ WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
{ WM_NCPAINT, sent|wparam|optional, 1 },
{ WM_ACTIVATEAPP, sent|wparam, 1 },
{ WM_NCACTIVATE, sent|wparam, 1 },
{ WM_ACTIVATEAPP, sent|wparam|optional, 1 },
{ WM_NCACTIVATE, sent|wparam|optional, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
{ WM_ACTIVATE, sent|wparam, 1 },
{ HCBT_SETFOCUS, hook },
{ WM_ACTIVATE, sent|wparam|optional, 1 },
{ HCBT_SETFOCUS, hook|optional },
{ WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
{ WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
{ EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_SETFOCUS, sent|wparam|defwinproc, 0 },
{ WM_SETFOCUS, sent|wparam|defwinproc|optional, 0 },
{ WM_GETTEXT, sent|optional },
{ WM_NCPAINT, sent|wparam|optional, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
@@ -488,19 +488,19 @@ static const struct message WmShowMaxOverlappedSeq[] = {
{ WM_GETMINMAXINFO, sent|defwinproc },
{ WM_NCCALCSIZE, sent|wparam, TRUE },
{ EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
{ HCBT_ACTIVATE, hook },
{ HCBT_ACTIVATE, hook|optional },
{ EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
{ WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
{ WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
{ WM_ACTIVATEAPP, sent|wparam, 1 },
{ WM_NCACTIVATE, sent|wparam, 1 },
{ WM_ACTIVATEAPP, sent|wparam|optional, 1 },
{ WM_NCACTIVATE, sent|wparam|optional, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
{ WM_ACTIVATE, sent|wparam, 1 },
{ HCBT_SETFOCUS, hook },
{ WM_ACTIVATE, sent|wparam|optional, 1 },
{ HCBT_SETFOCUS, hook|optional },
{ WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
{ WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
{ EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_SETFOCUS, sent|wparam|defwinproc, 0 },
{ WM_SETFOCUS, sent|wparam|defwinproc|optional, 0 },
{ WM_GETTEXT, sent|optional },
{ WM_NCPAINT, sent|wparam|optional, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
@@ -549,20 +549,27 @@ static const struct message WmShowRestoreMinOverlappedSeq[] = {
{ HCBT_MINMAX, hook|lparam, 0, SW_RESTORE },
{ WM_QUERYOPEN, sent|optional },
{ WM_GETTEXT, sent|optional },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED|SWP_NOCOPYBITS },
{ WM_GETMINMAXINFO, sent|defwinproc },
{ WM_NCCALCSIZE, sent|wparam, TRUE },
{ HCBT_ACTIVATE, hook },
{ WM_NCACTIVATE, sent|wparam|optional, 1 },
{ WM_WINDOWPOSCHANGING, sent|optional }, /* SWP_NOSIZE|SWP_NOMOVE */
{ WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
{ WM_NCCALCSIZE, sent|wparam|optional, TRUE },
{ WM_MOVE, sent|optional },
{ WM_SIZE, sent|wparam|optional, SIZE_RESTORED },
{ WM_GETTEXT, sent|optional },
{ WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_FRAMECHANGED|SWP_STATECHANGED|SWP_NOCOPYBITS },
{ WM_GETMINMAXINFO, sent|defwinproc|optional },
{ WM_NCCALCSIZE, sent|wparam|optional, TRUE },
{ HCBT_ACTIVATE, hook|optional },
{ WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
{ WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
{ WM_ACTIVATEAPP, sent|wparam, 1 },
{ WM_NCACTIVATE, sent|wparam, 1 },
{ WM_ACTIVATEAPP, sent|wparam|optional, 1 },
{ WM_NCACTIVATE, sent|wparam|optional, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
{ WM_ACTIVATE, sent|wparam, 1 },
{ HCBT_SETFOCUS, hook },
{ WM_ACTIVATE, sent|wparam|optional, 1 },
{ HCBT_SETFOCUS, hook|optional },
{ WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
{ WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
{ WM_SETFOCUS, sent|wparam|defwinproc, 0 },
{ WM_SETFOCUS, sent|wparam|defwinproc|optional, 0 },
{ WM_GETTEXT, sent|optional },
{ WM_NCPAINT, sent|wparam|optional, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
@@ -570,9 +577,13 @@ static const struct message WmShowRestoreMinOverlappedSeq[] = {
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_STATECHANGED|SWP_FRAMECHANGED|SWP_NOCOPYBITS },
{ WM_MOVE, sent|defwinproc },
{ WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
{ HCBT_SETFOCUS, hook|optional },
{ WM_SETFOCUS, sent|wparam|optional, 0 },
{ WM_NCCALCSIZE, sent|wparam|optional, TRUE },
{ WM_NCPAINT, sent|wparam|optional, 1 },
{ WM_ERASEBKGND, sent|optional },
{ HCBT_SETFOCUS, hook|optional },
{ WM_SETFOCUS, sent|wparam|optional, 0 },
{ WM_ACTIVATE, sent|wparam, 1 },
{ WM_GETTEXT, sent|optional },
{ WM_PAINT, sent|optional },
@@ -584,9 +595,9 @@ static const struct message WmShowRestoreMinOverlappedSeq[] = {
/* ShowWindow(SW_SHOWMINIMIZED) for a not visible overlapped window */
static const struct message WmShowMinOverlappedSeq[] = {
{ HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
{ HCBT_SETFOCUS, hook },
{ HCBT_SETFOCUS, hook|optional },
{ EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_KILLFOCUS, sent },
{ WM_KILLFOCUS, sent|optional },
{ WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
{ WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 },
{ WM_GETTEXT, sent|optional },
@@ -603,10 +614,10 @@ static const struct message WmShowMinOverlappedSeq[] = {
{ EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
{ EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
{ EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
{ WM_NCACTIVATE, sent|wparam, 0 },
{ WM_NCACTIVATE, sent|wparam|optional, 0 },
{ WM_GETTEXT, sent|defwinproc|optional },
{ WM_ACTIVATE, sent },
{ WM_ACTIVATEAPP, sent|wparam, 0 },
{ WM_ACTIVATE, sent|optional },
{ WM_ACTIVATEAPP, sent|wparam|optional, 0 },
/* Vista sometimes restores the window right away... */
{ WM_SYSCOMMAND, sent|optional|wparam, SC_RESTORE },
@@ -652,7 +663,7 @@ static const struct message WmHideOverlappedSeq[] = {
{ WM_ACTIVATE, sent|wparam|optional, 0 },
{ WM_ACTIVATEAPP, sent|wparam|optional, 0 },
{ HCBT_SETFOCUS, hook|optional },
{ WM_KILLFOCUS, sent|wparam, 0 },
{ WM_KILLFOCUS, sent|wparam|optional, 0 },
{ WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
{ WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 },
{ 0 }
@@ -1719,6 +1730,38 @@ static const struct message WmSHOWNATopInvisible[] = {
{ 0 }
};
static const struct message WmTrackPopupMenu[] = {
{ HCBT_CREATEWND, hook },
{ WM_ENTERMENULOOP, sent|wparam|lparam, TRUE, 0 },
{ WM_INITMENU, sent|lparam, 0, 0 },
{ WM_INITMENUPOPUP, sent|lparam, 0, 0 },
{ 0x0093, sent|optional },
{ 0x0094, sent|optional },
{ 0x0094, sent|optional },
{ WM_ENTERIDLE, sent|wparam, 2 },
{ WM_CAPTURECHANGED, sent },
{ HCBT_DESTROYWND, hook },
{ WM_UNINITMENUPOPUP, sent|lparam, 0, 0 },
{ WM_MENUSELECT, sent|wparam|lparam, 0xffff0000, 0 },
{ WM_EXITMENULOOP, sent|wparam|lparam, 1, 0 },
{ 0 }
};
static const struct message WmTrackPopupMenuEmpty[] = {
{ HCBT_CREATEWND, hook },
{ WM_ENTERMENULOOP, sent|wparam|lparam, TRUE, 0 },
{ WM_INITMENU, sent|lparam, 0, 0 },
{ WM_INITMENUPOPUP, sent|lparam, 0, 0 },
{ 0x0093, sent|optional },
{ 0x0094, sent|optional },
{ 0x0094, sent|optional },
{ WM_CAPTURECHANGED, sent },
{ WM_EXITMENULOOP, sent|wparam|lparam, 1, 0 },
{ HCBT_DESTROYWND, hook },
{ WM_UNINITMENUPOPUP, sent|lparam, 0, 0 },
{ 0 }
};
static BOOL after_end_dialog, test_def_id, paint_loop_done;
static int sequence_cnt, sequence_size;
static struct recvd_message* sequence;
@@ -4516,6 +4559,7 @@ static void test_messages(void)
HMENU hmenu;
MSG msg;
LRESULT res;
POINT pos;
flush_sequence();
@@ -4776,13 +4820,23 @@ static void test_messages(void)
after_end_dialog = FALSE;
test_def_id = FALSE;
hwnd = CreateWindowExA(0, "TestDialogClass", NULL, WS_POPUP,
ok(GetCursorPos(&pos), "GetCursorPos failed\n");
ok(SetCursorPos(109, 109), "SetCursorPos failed\n");
hwnd = CreateWindowExA(0, "TestDialogClass", NULL, WS_POPUP|WS_CHILD,
0, 0, 100, 100, 0, 0, GetModuleHandleA(0), NULL);
ok(hwnd != 0, "Failed to create custom dialog window\n");
flush_sequence();
trace("call ShowWindow(%p, SW_SHOW)\n", hwnd);
ShowWindow(hwnd, SW_SHOW);
ok_sequence(WmShowCustomDialogSeq, "ShowCustomDialog", TRUE);
flush_events();
flush_sequence();
ok(DrawMenuBar(hwnd), "DrawMenuBar failed: %d\n", GetLastError());
flush_events();
ok_sequence(WmDrawMenuBarSeq, "DrawMenuBar", FALSE);
ok(SetCursorPos(pos.x, pos.y), "SetCursorPos failed\n");
DestroyWindow(hwnd);
flush_sequence();
@@ -4793,7 +4847,8 @@ static void test_messages(void)
flush_sequence();
/* Message sequence for SetMenu */
ok(!DrawMenuBar(hwnd), "DrawMenuBar should return FALSE for a window without a menu\n");
ok(!DrawMenuBar(hwnd), "DrawMenuBar should return FALSE for a destroyed window\n");
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "last error is %d\n", GetLastError());
ok_sequence(WmEmptySeq, "DrawMenuBar for a window without a menu", FALSE);
hmenu = CreateMenu();
@@ -10816,8 +10871,11 @@ static const struct message WmShowNoActivate_1[] = {
};
static const struct message WmShowNoActivate_2[] = {
{ HCBT_MINMAX, hook|lparam, 0, SW_SHOWNOACTIVATE },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
{ HCBT_ACTIVATE, hook|optional },
{ WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
{ HCBT_SETFOCUS, hook|optional },
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
{ WM_MOVE, sent|defwinproc },
{ WM_SIZE, sent|wparam|defwinproc, SIZE_RESTORED },
{ HCBT_SETFOCUS, hook|optional },
@@ -10937,16 +10995,18 @@ static const struct message WmMinimize_1[] = {
static const struct message WmMinimize_2[] = {
{ HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
{ HCBT_SETFOCUS, hook|optional },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
{ WM_MOVE, sent|defwinproc },
{ WM_SIZE, sent|wparam|lparam|defwinproc, SIZE_MINIMIZED, 0 },
{ 0 }
};
static const struct message WmMinimize_3[] = {
{ HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
{ HCBT_ACTIVATE, hook|optional },
{ WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
{ WM_MOVE, sent|defwinproc },
{ WM_SIZE, sent|wparam|lparam|defwinproc, SIZE_MINIMIZED, 0 },
{ 0 }
@@ -11284,12 +11344,9 @@ if (0) /* FIXME: Wine behaves completely different here */
win_rc.left, win_rc.top, win_rc.right, win_rc.bottom,
wp.rcNormalPosition.left, wp.rcNormalPosition.top,
wp.rcNormalPosition.right, wp.rcNormalPosition.bottom);
flush_events();
flush_sequence();
}
DestroyWindow(hwnd);
flush_events();
}
static INT_PTR WINAPI test_dlg_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
@@ -12084,7 +12141,11 @@ static void test_unicode_wm_char(void)
PostMessageW( hwnd, WM_CHAR, 0x3b1, 0 );
ok( GetMessageW( &msg, hwnd, 0, 0 ), "no message\n" );
while (GetMessageW( &msg, hwnd, 0, 0 ))
{
if (!ignore_message( msg.message )) break;
}
ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
ok( msg.wParam == 0x3b1, "bad wparam %lx\n", msg.wParam );
@@ -14260,6 +14321,80 @@ static void test_layered_window(void)
DeleteObject( bmp );
}
static HMENU hpopupmenu;
static LRESULT WINAPI cancel_popup_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (ignore_message( message )) return 0;
switch (message) {
case WM_ENTERIDLE:
todo_wine ok(GetCapture() == hwnd, "expected %p, got %p\n", hwnd, GetCapture());
EndMenu();
break;
case WM_INITMENU:
case WM_INITMENUPOPUP:
case WM_UNINITMENUPOPUP:
ok((HMENU)wParam == hpopupmenu, "expected %p, got %lx\n", hpopupmenu, wParam);
break;
}
return MsgCheckProc (FALSE, hwnd, message, wParam, lParam);
}
static void test_TrackPopupMenu(void)
{
HWND hwnd;
BOOL ret;
hwnd = CreateWindowExA(0, "TestWindowClass", NULL, 0,
0, 0, 1, 1, 0,
NULL, NULL, 0);
ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)cancel_popup_proc);
hpopupmenu = CreatePopupMenu();
ok(hpopupmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
AppendMenuA(hpopupmenu, MF_STRING, 100, "item 1");
AppendMenuA(hpopupmenu, MF_STRING, 100, "item 2");
flush_events();
flush_sequence();
ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL);
ok_sequence(WmTrackPopupMenu, "TrackPopupMenu", TRUE);
ok(ret == 1, "TrackPopupMenu failed with error %i\n", GetLastError());
DestroyMenu(hpopupmenu);
DestroyWindow(hwnd);
}
static void test_TrackPopupMenuEmpty(void)
{
HWND hwnd;
BOOL ret;
hwnd = CreateWindowExA(0, "TestWindowClass", NULL, 0,
0, 0, 1, 1, 0,
NULL, NULL, 0);
ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)cancel_popup_proc);
hpopupmenu = CreatePopupMenu();
ok(hpopupmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
flush_events();
flush_sequence();
ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL);
ok_sequence(WmTrackPopupMenuEmpty, "TrackPopupMenuEmpty", TRUE);
todo_wine ok(ret == 0, "TrackPopupMenu succeeded\n");
DestroyMenu(hpopupmenu);
DestroyWindow(hwnd);
}
static void init_funcs(void)
{
HMODULE hKernel32 = GetModuleHandleA("kernel32.dll");
@@ -14337,7 +14472,6 @@ START_TEST(msg)
pUnhookWinEvent = 0;
}
hEvent_hook = 0;
test_SetFocus();
test_SetParent();
test_PostMessage();
@@ -14357,9 +14491,6 @@ START_TEST(msg)
test_combobox_messages();
test_wmime_keydown_message();
test_paint_messages();
if(!winetest_interactive)
skip("ReactOS ActivateActCtx seems to be broken.\n");
else
test_interthread_messages();
test_message_conversion();
test_accelerators();
@@ -14392,6 +14523,8 @@ START_TEST(msg)
test_keyflags();
test_hotkey();
test_layered_window();
test_TrackPopupMenu();
test_TrackPopupMenuEmpty();
/* keep it the last test, under Windows it tends to break the tests
* which rely on active/foreground windows being correct.
*/
+57 -34
View File
@@ -23,7 +23,7 @@
#include "wine/test.h"
static UINT (WINAPI *pPrivateExtractIconsA)(LPCTSTR, int, int, int, HICON *, UINT *, UINT, UINT) = NULL;
static UINT (WINAPI *pPrivateExtractIconsA)(LPCSTR, int, int, int, HICON *, UINT *, UINT, UINT) = NULL;
static void init_function_pointers(void)
{
@@ -33,7 +33,7 @@ static void init_function_pointers(void)
static void test_LoadStringW(void)
{
HINSTANCE hInst = GetModuleHandle(NULL);
HINSTANCE hInst = GetModuleHandleA(NULL);
WCHAR copiedstringw[128], returnedstringw[128], *resourcepointer = NULL;
char copiedstring[128], returnedstring[128];
int length1, length2, retvalue;
@@ -79,7 +79,7 @@ static void test_LoadStringW(void)
static void test_LoadStringA (void)
{
HINSTANCE hInst = GetModuleHandle (NULL);
HINSTANCE hInst = GetModuleHandleA(NULL);
static const char str[] = "String resource"; /* same in resource.rc */
char buf[128];
struct string_test {
@@ -148,7 +148,7 @@ static void test_accel1(void)
ac[n].key = 0;
ac[n++].fVirt = 0;
hAccel = CreateAcceleratorTable( &ac[0], n );
hAccel = CreateAcceleratorTableA( &ac[0], n );
ok( hAccel != NULL, "create accelerator table\n");
r = DestroyAcceleratorTable( hAccel );
@@ -176,13 +176,13 @@ static void test_accel1(void)
ac[n].key = 0xffff;
ac[n++].fVirt = 0x0001;
hAccel = CreateAcceleratorTable( &ac[0], n );
hAccel = CreateAcceleratorTableA( &ac[0], n );
ok( hAccel != NULL, "create accelerator table\n");
r = CopyAcceleratorTable( hAccel, NULL, 0 );
r = CopyAcceleratorTableA( hAccel, NULL, 0 );
ok( r == n, "two entries in table %u/%u\n", r, n);
r = CopyAcceleratorTable( hAccel, &ac[0], n );
r = CopyAcceleratorTableA( hAccel, &ac[0], n );
ok( r == n, "still should be two entries in table %u/%u\n", r, n);
n=0;
@@ -213,7 +213,7 @@ done:
r = DestroyAcceleratorTable( hAccel );
ok( r, "destroy accelerator table\n");
hAccel = CreateAcceleratorTable( &ac[0], 0 );
hAccel = CreateAcceleratorTableA( &ac[0], 0 );
ok( !hAccel || broken(hAccel != NULL), /* nt4 */ "zero elements should fail\n");
/* these will on crash win2k
@@ -246,36 +246,36 @@ static void test_accel2(void)
*/
/* try a zero count */
hac = CreateAcceleratorTable( &ac[0], 0 );
hac = CreateAcceleratorTableA( &ac[0], 0 );
ok( !hac || broken(hac != NULL), /* nt4 */ "fail\n");
if (!hac) ok( !DestroyAcceleratorTable( hac ), "destroy failed\n");
/* creating one accelerator should work */
hac = CreateAcceleratorTable( &ac[0], 1 );
hac = CreateAcceleratorTableA( &ac[0], 1 );
ok( hac != NULL , "fail\n");
ok( 1 == CopyAcceleratorTable( hac, out, 1 ), "copy failed\n");
ok( 1 == CopyAcceleratorTableA( hac, out, 1 ), "copy failed\n");
ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
/* how about two of the same type? */
hac = CreateAcceleratorTable( &ac[0], 2);
hac = CreateAcceleratorTableA( &ac[0], 2);
ok( hac != NULL , "fail\n");
res = CopyAcceleratorTable( hac, NULL, 100 );
res = CopyAcceleratorTableA( hac, NULL, 100 );
ok( res == 2, "copy null failed %d\n", res);
res = CopyAcceleratorTable( hac, NULL, 0 );
res = CopyAcceleratorTableA( hac, NULL, 0 );
ok( res == 2, "copy null failed %d\n", res);
res = CopyAcceleratorTable( hac, NULL, 1 );
res = CopyAcceleratorTableA( hac, NULL, 1 );
ok( res == 2, "copy null failed %d\n", res);
ok( 1 == CopyAcceleratorTable( hac, out, 1 ), "copy 1 failed\n");
ok( 2 == CopyAcceleratorTable( hac, out, 2 ), "copy 2 failed\n");
ok( 1 == CopyAcceleratorTableA( hac, out, 1 ), "copy 1 failed\n");
ok( 2 == CopyAcceleratorTableA( hac, out, 2 ), "copy 2 failed\n");
ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
/* ok( !memcmp( ac, out, sizeof ac ), "tables different\n"); */
/* how about two of the same type with a non-zero key? */
ac[0].key = 0x20;
ac[1].key = 0x20;
hac = CreateAcceleratorTable( &ac[0], 2);
hac = CreateAcceleratorTableA( &ac[0], 2);
ok( hac != NULL , "fail\n");
ok( 2 == CopyAcceleratorTable( hac, out, 2 ), "copy 2 failed\n");
ok( 2 == CopyAcceleratorTableA( hac, out, 2 ), "copy 2 failed\n");
ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
/* ok( !memcmp( ac, out, sizeof ac ), "tables different\n"); */
@@ -284,17 +284,17 @@ static void test_accel2(void)
ac[0].key = 0x40;
ac[1].fVirt = FVIRTKEY;
ac[1].key = 0x40;
hac = CreateAcceleratorTable( &ac[0], 2);
hac = CreateAcceleratorTableA( &ac[0], 2);
ok( hac != NULL , "fail\n");
ok( 2 == CopyAcceleratorTable( hac, out, 2 ), "copy 2 failed\n");
ok( 2 == CopyAcceleratorTableA( hac, out, 2 ), "copy 2 failed\n");
/* ok( !memcmp( ac, out, sizeof ac ), "tables different\n"); */
ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
/* how virtual key codes */
ac[0].fVirt = FVIRTKEY;
hac = CreateAcceleratorTable( &ac[0], 1);
hac = CreateAcceleratorTableA( &ac[0], 1);
ok( hac != NULL , "fail\n");
ok( 1 == CopyAcceleratorTable( hac, out, 2 ), "copy 2 failed\n");
ok( 1 == CopyAcceleratorTableA( hac, out, 2 ), "copy 2 failed\n");
/* ok( !memcmp( ac, out, sizeof ac/2 ), "tables different\n"); */
ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
@@ -302,9 +302,9 @@ static void test_accel2(void)
ac[0].cmd = 0xffff;
ac[0].fVirt = 0xff;
ac[0].key = 0xffff;
hac = CreateAcceleratorTable( &ac[0], 1);
hac = CreateAcceleratorTableA( &ac[0], 1);
ok( hac != NULL , "fail\n");
ok( 1 == CopyAcceleratorTable( hac, out, 1 ), "copy 1 failed\n");
ok( 1 == CopyAcceleratorTableA( hac, out, 1 ), "copy 1 failed\n");
/* ok( memcmp( ac, out, sizeof ac/2 ), "tables not different\n"); */
ok( out[0].cmd == ac[0].cmd, "cmd modified\n");
ok( out[0].fVirt == (ac[0].fVirt&0x7f), "fVirt not modified\n");
@@ -313,9 +313,9 @@ static void test_accel2(void)
/* how turning on all bits? */
memset( ac, 0xff, sizeof ac );
hac = CreateAcceleratorTable( &ac[0], 2);
hac = CreateAcceleratorTableA( &ac[0], 2);
ok( hac != NULL , "fail\n");
res = CopyAcceleratorTable( hac, out, 2 );
res = CopyAcceleratorTableA( hac, out, 2 );
ok( res == 2, "copy 2 failed %d\n", res);
/* ok( memcmp( ac, out, sizeof ac ), "tables not different\n"); */
ok( out[0].cmd == ac[0].cmd, "cmd modified\n");
@@ -331,13 +331,32 @@ static void test_accel2(void)
}
static void test_PrivateExtractIcons(void) {
CONST CHAR szShell32Dll[] = "shell32.dll";
const CHAR szShell32Dll[] = "shell32.dll";
HICON ahIcon[256];
UINT aIconId[256];
UINT cIcons, cIcons2;
UINT i, aIconId[256], cIcons, cIcons2;
if (!pPrivateExtractIconsA) return;
cIcons = pPrivateExtractIconsA("", 0, 16, 16, ahIcon, aIconId, 1, 0);
ok(cIcons == ~0u, "got %u\n", cIcons);
cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, NULL, NULL, 1, 0);
ok(cIcons == 1 || broken(cIcons == 2) /* win2k */, "got %u\n", cIcons);
ahIcon[0] = (HICON)0xdeadbeef;
cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, ahIcon, NULL, 1, 0);
ok(cIcons == 1, "got %u\n", cIcons);
ok(ahIcon[0] != (HICON)0xdeadbeef, "icon not set\n");
DestroyIcon(ahIcon[0]);
ahIcon[0] = (HICON)0xdeadbeef;
aIconId[0] = 0xdeadbeef;
cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, ahIcon, aIconId, 1, 0);
ok(cIcons == 1, "got %u\n", cIcons);
ok(ahIcon[0] != (HICON)0xdeadbeef, "icon not set\n");
ok(aIconId[0] != 0xdeadbeef, "id not set\n");
DestroyIcon(ahIcon[0]);
cIcons = pPrivateExtractIconsA(szShell32Dll, 0, 16, 16, NULL, NULL, 0, 0);
cIcons2 = pPrivateExtractIconsA(szShell32Dll, 4, MAKELONG(32,16), MAKELONG(32,16),
NULL, NULL, 256, 0);
@@ -350,14 +369,18 @@ static void test_PrivateExtractIcons(void) {
cIcons = pPrivateExtractIconsA(szShell32Dll, 0, 16, 16, ahIcon, aIconId, 3, 0);
ok(cIcons == 3, "Three icons requested got cIcons=%d\n", cIcons);
for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]);
/* count must be a multiple of two when getting two sizes */
cIcons = pPrivateExtractIconsA(szShell32Dll, 0, MAKELONG(16,32), MAKELONG(16,32),
ahIcon, aIconId, 3, 0);
ok(cIcons == 0 /* vista */ || cIcons == 4, "Three icons requested got cIcons=%d\n", cIcons);
for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]);
cIcons = pPrivateExtractIconsA(szShell32Dll, 0, MAKELONG(16,32), MAKELONG(16,32),
ahIcon, aIconId, 4, 0);
ok(cIcons == 4, "Four icons requested got cIcons=%d\n", cIcons);
for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]);
}
static void test_LoadImage(void)
@@ -365,14 +388,14 @@ static void test_LoadImage(void)
HBITMAP bmp;
HRSRC hres;
bmp = LoadBitmapA(GetModuleHandle(NULL), MAKEINTRESOURCE(100));
bmp = LoadBitmapA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(100));
ok(bmp != NULL, "Could not load a bitmap resource\n");
if (bmp) DeleteObject(bmp);
hres = FindResource(GetModuleHandle(NULL), "#100", RT_BITMAP);
hres = FindResourceA(GetModuleHandleA(NULL), "#100", (LPCSTR)RT_BITMAP);
ok(hres != NULL, "Could not find a bitmap resource with a numeric string\n");
bmp = LoadBitmapA(GetModuleHandle(NULL), "#100");
bmp = LoadBitmapA(GetModuleHandleA(NULL), "#100");
ok(bmp != NULL, "Could not load a bitmap resource with a numeric string\n");
if (bmp) DeleteObject(bmp);
}
+3 -3
View File
@@ -56,7 +56,7 @@ static void scrollbar_test_track(void)
{
/* test that scrollbar tracking is terminated when
* the control looses mouse capture */
SendMessage( hScroll, WM_LBUTTONDOWN, 0, MAKELPARAM( 1, 1));
SendMessageA( hScroll, WM_LBUTTONDOWN, 0, MAKELPARAM( 1, 1));
/* a normal return from the sendmessage */
/* not normal for instance by closing the windws */
ok( IsWindow( hScroll), "Scrollbar has gone!\n");
@@ -467,7 +467,7 @@ static void scrollbar_test_init(void)
wc.cbSize = sizeof wc;
wc.style = CS_VREDRAW | CS_HREDRAW;
wc.hInstance = GetModuleHandleA(0);
wc.hCursor = LoadCursorA(NULL, IDC_ARROW);
wc.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
wc.hbrBackground = GetStockObject(WHITE_BRUSH);
wc.lpszClassName = cls_name;
wc.lpfnWndProc = scroll_init_proc;
@@ -495,7 +495,7 @@ START_TEST ( scroll )
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandleA(NULL);
wc.hIcon = NULL;
wc.hCursor = LoadCursorA(NULL, IDC_IBEAM);
wc.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_IBEAM);
wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
wc.lpszMenuName = NULL;
wc.lpszClassName = "MyTestWnd";
+11 -11
View File
@@ -50,14 +50,14 @@ static void flush_events(void)
while (diff > 0)
{
if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
diff = time - GetTickCount();
}
}
static HWND build_static(DWORD style)
{
return CreateWindow("static", "Test", WS_VISIBLE|WS_CHILD|style, 5, 5, 100, 100, hMainWnd, (HMENU)CTRL_ID, NULL, 0);
return CreateWindowA("static", "Test", WS_VISIBLE|WS_CHILD|style, 5, 5, 100, 100, hMainWnd, (HMENU)CTRL_ID, NULL, 0);
}
static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
@@ -76,7 +76,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
break;
}
return DefWindowProc(hwnd, msg, wparam, lparam);
return DefWindowProcA(hwnd, msg, wparam, lparam);
}
static void test_updates(int style, int flags)
@@ -119,24 +119,24 @@ static void test_updates(int style, int flags)
START_TEST(static)
{
static char szClassName[] = "testclass";
WNDCLASSEX wndclass;
static const char szClassName[] = "testclass";
WNDCLASSEXA wndclass;
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = GetModuleHandle(NULL);
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hInstance = GetModuleHandleA(NULL);
wndclass.hIcon = LoadIconA(NULL, (LPCSTR)IDI_APPLICATION);
wndclass.hIconSm = LoadIconA(NULL, (LPCSTR)IDI_APPLICATION);
wndclass.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
wndclass.lpszClassName = szClassName;
wndclass.lpszMenuName = NULL;
RegisterClassEx(&wndclass);
RegisterClassExA(&wndclass);
hMainWnd = CreateWindow(szClassName, "Test", WS_OVERLAPPEDWINDOW, 0, 0, 500, 500, NULL, NULL, GetModuleHandle(NULL), NULL);
hMainWnd = CreateWindowA(szClassName, "Test", WS_OVERLAPPEDWINDOW, 0, 0, 500, 500, NULL, NULL, GetModuleHandleA(NULL), NULL);
ShowWindow(hMainWnd, SW_SHOW);
test_updates(0, 0);
+2 -1
View File
@@ -2869,8 +2869,9 @@ static void test_EnumDisplaySettings(void)
if (!EnumDisplaySettingsA(NULL, num, &devmode)) {
DWORD le = GetLastError();
ok(le == ERROR_NO_MORE_FILES ||
le == ERROR_MOD_NOT_FOUND /* Win8 */ ||
le == 0xdeadbeef, /* XP, 2003 */
"Expected ERROR_NO_MORE_FILES or 0xdeadbeef, got %d for %d\n", le, num);
"Expected ERROR_NO_MORE_FILES, ERROR_MOD_NOT_FOUND or 0xdeadbeef, got %d for %d\n", le, num);
break;
}
num++;
+50
View File
@@ -63,7 +63,57 @@ static void test_FillRect(void)
ReleaseDC(0, hdc);
}
static void test_SubtractRect(void)
{
RECT rect1;
RECT rect2;
RECT rectr;
BOOL result;
/* source rectangles don't intersect */
SetRect(&rect1, 50, 50, 150, 100);
SetRect(&rect2, 250, 200, 1500, 1000);
result = SubtractRect(&rectr, &rect1, &rect2);
ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n");
ok(result && rectr.left == 50 && rectr.top == 50 && rectr.right ==150
&& rectr.bottom == 100, "wrong rect subtraction of SubtractRect "
"(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);
/* source rect 2 partially overlaps rect 1 */
SetRect(&rect1, 2431, 626, 3427, 1608);
SetRect(&rect2, 2499, 626, 3427, 1608);
result = SubtractRect(&rectr, &rect1, &rect2);
ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n");
ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499
&& rectr.bottom == 1608, "wrong rect subtraction of SubtractRect "
"(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);
/* source rect 2 partially overlaps rect 1 - dest is src rect 2 */
SetRect(&rect1, 2431, 626, 3427, 1608);
SetRect(&rect2, 2499, 626, 3427, 1608);
result = SubtractRect(&rect2, &rect1, &rect2);
ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n");
ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499
&& rectr.bottom == 1608, "wrong rect subtraction of SubtractRect "
"(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);
/* source rect 2 completely overlaps rect 1 */
SetRect(&rect1, 250, 250, 400, 500);
SetRect(&rect2, 50, 50, 1500, 1000);
result = SubtractRect(&rectr, &rect1, &rect2);
ok(!result, "SubtractRect returned TRUE but subtraction should be empty "
"(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);
/* source rect 2 completely overlaps rect 1 - dest is src rect 2 */
SetRect(&rect1, 250, 250, 400, 500);
SetRect(&rect2, 50, 50, 1500, 1000);
result = SubtractRect(&rect2, &rect1, &rect2);
ok(!result, "SubtractRect returned TRUE but subtraction should be empty "
"(dest rect={%d, %d, %d, %d})\n", rect2.left, rect2.top, rect2.right, rect2.bottom);
}
START_TEST(uitools)
{
test_FillRect();
test_SubtractRect();
}
File diff suppressed because it is too large Load Diff
+470 -18
View File
@@ -53,7 +53,7 @@ static void register_class(void)
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
cls.hCursor = LoadCursorA(0, IDC_ARROW);
cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "WinStationClass";
@@ -79,7 +79,7 @@ static DWORD CALLBACK thread( LPVOID arg )
ok( GetLastError() == ERROR_BUSY || broken(GetLastError() == 0xdeadbeef), /* wow64 */
"bad last error %d\n", GetLastError() );
print_object( d1 );
d2 = CreateDesktop( "foobar2", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
d2 = CreateDesktopA( "foobar2", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
trace( "created desktop %p\n", d2 );
ok( d2 != 0, "CreateDesktop failed\n" );
@@ -136,7 +136,7 @@ static void test_handles(void)
TRUE, DUPLICATE_SAME_ACCESS ), "DuplicateHandle failed\n" );
ok( CloseHandle(w2), "closing dup win station handle failed\n" );
w2 = CreateWindowStation("WinSta0", 0, WINSTA_ALL_ACCESS, NULL );
w2 = CreateWindowStationA("WinSta0", 0, WINSTA_ALL_ACCESS, NULL );
le = GetLastError();
ok( w2 != 0 || le == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%u)\n", le );
if (w2 != 0)
@@ -148,39 +148,39 @@ static void test_handles(void)
"bad last error %d\n", GetLastError() );
ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" );
w2 = CreateWindowStation("WinSta0", 0, WINSTA_ALL_ACCESS, NULL );
w2 = CreateWindowStationA("WinSta0", 0, WINSTA_ALL_ACCESS, NULL );
ok( CloseHandle( w2 ), "CloseHandle failed\n" );
}
else if (le == ERROR_ACCESS_DENIED)
win_skip( "Not enough privileges for CreateWindowStation\n" );
w2 = OpenWindowStation("winsta0", TRUE, WINSTA_ALL_ACCESS );
w2 = OpenWindowStationA("winsta0", TRUE, WINSTA_ALL_ACCESS );
ok( w2 != 0, "OpenWindowStation failed\n" );
ok( w2 != w1, "OpenWindowStation returned default handle\n" );
ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" );
w2 = OpenWindowStation("dummy name", TRUE, WINSTA_ALL_ACCESS );
w2 = OpenWindowStationA("dummy name", TRUE, WINSTA_ALL_ACCESS );
ok( !w2, "open dummy win station succeeded\n" );
CreateMutexA( NULL, 0, "foobar" );
w2 = CreateWindowStation("foobar", 0, WINSTA_ALL_ACCESS, NULL );
w2 = CreateWindowStationA("foobar", 0, WINSTA_ALL_ACCESS, NULL );
le = GetLastError();
ok( w2 != 0 || le == ERROR_ACCESS_DENIED, "create foobar station failed (%u)\n", le );
if (w2 != 0)
{
w3 = OpenWindowStation("foobar", TRUE, WINSTA_ALL_ACCESS );
w3 = OpenWindowStationA("foobar", TRUE, WINSTA_ALL_ACCESS );
ok( w3 != 0, "open foobar station failed\n" );
ok( w3 != w2, "open foobar station returned same handle\n" );
ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" );
ok( CloseWindowStation( w3 ), "CloseWindowStation failed\n" );
w3 = OpenWindowStation("foobar", TRUE, WINSTA_ALL_ACCESS );
w3 = OpenWindowStationA("foobar", TRUE, WINSTA_ALL_ACCESS );
ok( !w3, "open foobar station succeeded\n" );
w2 = CreateWindowStation("foobar1", 0, WINSTA_ALL_ACCESS, NULL );
w2 = CreateWindowStationA("foobar1", 0, WINSTA_ALL_ACCESS, NULL );
ok( w2 != 0, "create foobar station failed\n" );
w3 = CreateWindowStation("foobar2", 0, WINSTA_ALL_ACCESS, NULL );
w3 = CreateWindowStationA("foobar2", 0, WINSTA_ALL_ACCESS, NULL );
ok( w3 != 0, "create foobar station failed\n" );
ok( GetHandleInformation( w2, &flags ), "GetHandleInformation failed\n" );
ok( GetHandleInformation( w3, &flags ), "GetHandleInformation failed\n" );
@@ -233,10 +233,10 @@ static void test_handles(void)
TRUE, DUPLICATE_SAME_ACCESS ), "DuplicateHandle failed\n" );
ok( CloseHandle(d2), "closing dup desktop handle failed\n" );
d2 = OpenDesktop( "dummy name", 0, TRUE, DESKTOP_ALL_ACCESS );
d2 = OpenDesktopA( "dummy name", 0, TRUE, DESKTOP_ALL_ACCESS );
ok( !d2, "open dummy desktop succeeded\n" );
d2 = CreateDesktop( "foobar", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
d2 = CreateDesktopA( "foobar", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
ok( d2 != 0, "create foobar desktop failed\n" );
SetLastError( 0xdeadbeef );
ok( !CloseWindowStation( (HWINSTA)d2 ), "CloseWindowStation succeeded on desktop\n" );
@@ -244,18 +244,18 @@ static void test_handles(void)
"bad last error %d\n", GetLastError() );
SetLastError( 0xdeadbeef );
d3 = CreateDesktop( "foobar", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
d3 = CreateDesktopA( "foobar", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
ok( d3 != 0, "create foobar desktop again failed\n" );
ok( GetLastError() == 0xdeadbeef, "bad last error %d\n", GetLastError() );
ok( CloseDesktop( d3 ), "CloseDesktop failed\n" );
d3 = OpenDesktop( "foobar", 0, TRUE, DESKTOP_ALL_ACCESS );
d3 = OpenDesktopA( "foobar", 0, TRUE, DESKTOP_ALL_ACCESS );
ok( d3 != 0, "open foobar desktop failed\n" );
ok( d3 != d2, "open foobar desktop returned same handle\n" );
ok( CloseDesktop( d2 ), "CloseDesktop failed\n" );
ok( CloseDesktop( d3 ), "CloseDesktop failed\n" );
d3 = OpenDesktop( "foobar", 0, TRUE, DESKTOP_ALL_ACCESS );
d3 = OpenDesktopA( "foobar", 0, TRUE, DESKTOP_ALL_ACCESS );
ok( !d3, "open foobar desktop succeeded\n" );
ok( !CloseHandle(d1), "closing thread desktop handle succeeded\n" );
@@ -270,6 +270,9 @@ static void test_handles(void)
trace( "get other thread desktop: %p\n", GetThreadDesktop(id) );
WaitForSingleObject( hthread, INFINITE );
CloseHandle( hthread );
/* clean side effect */
SetProcessWindowStation( w1 );
}
/* Enumeration tests */
@@ -294,7 +297,8 @@ static BOOL CALLBACK open_window_station_callbackA(LPSTR winsta, LPARAM lp)
static void test_enumstations(void)
{
BOOL ret;
DWORD ret;
HWINSTA hwinsta;
if (0) /* Crashes instead */
{
@@ -304,6 +308,15 @@ static void test_enumstations(void)
ok(GetLastError() == ERROR_INVALID_PARAMETER, "LastError is set to %08x\n", GetLastError());
}
hwinsta = CreateWindowStationA("winsta_test", 0, WINSTA_ALL_ACCESS, NULL);
ret = GetLastError();
ok(hwinsta != NULL || ret == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%u)\n", ret);
if (!hwinsta)
{
win_skip("Not enough privileges for CreateWindowStation\n");
return;
}
SetLastError(0xdeadbeef);
ret = EnumWindowStationsA(open_window_station_callbackA, 0x12345);
ok(ret == 0x12345, "EnumWindowStationsA returned %x\n", ret);
@@ -383,7 +396,7 @@ static void test_getuserobjectinformation(void)
DWORD size;
BOOL ret;
desk = CreateDesktop("foobarTest", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
desk = CreateDesktopA("foobarTest", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
ok(desk != 0, "open foobarTest desktop failed\n");
strcpy(buffer, "blahblah");
@@ -475,6 +488,442 @@ static void test_getuserobjectinformation(void)
ok(CloseDesktop(desk), "CloseDesktop failed\n");
}
static void test_inputdesktop(void)
{
HDESK input_desk, old_input_desk, thread_desk, old_thread_desk, new_desk;
DWORD ret;
CHAR name[1024];
INPUT inputs[1];
inputs[0].type = INPUT_KEYBOARD;
U(inputs[0]).ki.wVk = 0;
U(inputs[0]).ki.wScan = 0x3c0;
U(inputs[0]).ki.dwFlags = KEYEVENTF_UNICODE;
/* OpenInputDesktop creates new handles for each calls */
old_input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
ok(old_input_desk != NULL, "OpenInputDesktop failed!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(old_input_desk, UOI_NAME, name, 1024, NULL);
ok(ret, "GetUserObjectInformation failed!\n");
ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
ok(input_desk != NULL, "OpenInputDesktop failed!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(input_desk, UOI_NAME, name, 1024, NULL);
ok(ret, "GetUserObjectInformation failed!\n");
ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
ok(old_input_desk != input_desk, "returned the same handle!\n");
ret = CloseDesktop(input_desk);
ok(ret, "CloseDesktop failed!\n");
/* by default, GetThreadDesktop is the input desktop, SendInput should success. */
old_thread_desk = GetThreadDesktop(GetCurrentThreadId());
ok(old_thread_desk != NULL, "GetThreadDesktop faile!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(old_thread_desk, UOI_NAME, name, 1024, NULL);
ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
SetLastError(0xdeadbeef);
ret = SendInput(1, inputs, sizeof(INPUT));
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
ok(ret == 1, "unexpected return count %d\n", ret);
/* Set thread desktop to the new desktop, SendInput should fail. */
new_desk = CreateDesktopA("new_desk", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
ok(new_desk != NULL, "CreateDesktop failed!\n");
ret = SetThreadDesktop(new_desk);
ok(ret, "SetThreadDesktop failed!\n");
thread_desk = GetThreadDesktop(GetCurrentThreadId());
ok(thread_desk == new_desk, "thread desktop doesn't match!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(thread_desk, UOI_NAME, name, 1024, NULL);
ok(!strcmp(name, "new_desk"), "unexpected desktop %s\n", name);
SetLastError(0xdeadbeef);
ret = SendInput(1, inputs, sizeof(INPUT));
if(broken(GetLastError() == 0xdeadbeef))
{
SetThreadDesktop(old_thread_desk);
CloseDesktop(old_input_desk);
CloseDesktop(input_desk);
CloseDesktop(new_desk);
win_skip("Skip tests on NT4\n");
return;
}
todo_wine
ok(GetLastError() == ERROR_ACCESS_DENIED, "unexpected last error %08x\n", GetLastError());
ok(ret == 1 || broken(ret == 0) /* Win64 */, "unexpected return count %d\n", ret);
/* Set thread desktop back to the old thread desktop, SendInput should success. */
ret = SetThreadDesktop(old_thread_desk);
ok(ret, "SetThreadDesktop failed!\n");
thread_desk = GetThreadDesktop(GetCurrentThreadId());
ok(thread_desk == old_thread_desk, "thread desktop doesn't match!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(thread_desk, UOI_NAME, name, 1024, NULL);
ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
SetLastError(0xdeadbeef);
ret = SendInput(1, inputs, sizeof(INPUT));
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
ok(ret == 1, "unexpected return count %d\n", ret);
/* Set thread desktop to the input desktop, SendInput should success. */
ret = SetThreadDesktop(old_input_desk);
ok(ret, "SetThreadDesktop failed!\n");
thread_desk = GetThreadDesktop(GetCurrentThreadId());
ok(thread_desk == old_input_desk, "thread desktop doesn't match!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(thread_desk, UOI_NAME, name, 1024, NULL);
ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
SetLastError(0xdeadbeef);
ret = SendInput(1, inputs, sizeof(INPUT));
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
ok(ret == 1, "unexpected return count %d\n", ret);
/* Switch input desktop to the new desktop, SendInput should fail. */
ret = SwitchDesktop(new_desk);
ok(ret, "SwitchDesktop failed!\n");
input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
ok(input_desk != NULL, "OpenInputDesktop failed!\n");
ok(input_desk != new_desk, "returned the same handle!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(input_desk, UOI_NAME, name, 1024, NULL);
ok(ret, "GetUserObjectInformation failed!\n");
todo_wine
ok(!strcmp(name, "new_desk"), "unexpected desktop %s\n", name);
ret = CloseDesktop(input_desk);
ok(ret, "CloseDesktop failed!\n");
SetLastError(0xdeadbeef);
ret = SendInput(1, inputs, sizeof(INPUT));
todo_wine
ok(GetLastError() == ERROR_ACCESS_DENIED, "unexpected last error %08x\n", GetLastError());
ok(ret == 1 || broken(ret == 0) /* Win64 */, "unexpected return count %d\n", ret);
/* Set thread desktop to the new desktop, SendInput should success. */
ret = SetThreadDesktop(new_desk);
ok(ret, "SetThreadDesktop failed!\n");
thread_desk = GetThreadDesktop(GetCurrentThreadId());
ok(thread_desk == new_desk, "thread desktop doesn't match!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(thread_desk, UOI_NAME, name, 1024, NULL);
ok(!strcmp(name, "new_desk"), "unexpected desktop %s\n", name);
SetLastError(0xdeadbeef);
ret = SendInput(1, inputs, sizeof(INPUT));
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
ok(ret == 1, "unexpected return count %d\n", ret);
/* Switch input desktop to the old input desktop, set thread desktop to the old
* thread desktop, clean side effects. SendInput should success. */
ret = SwitchDesktop(old_input_desk);
input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
ok(input_desk != NULL, "OpenInputDesktop failed!\n");
ok(input_desk != old_input_desk, "returned the same handle!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(input_desk, UOI_NAME, name, 1024, NULL);
ok(ret, "GetUserObjectInformation failed!\n");
ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
ret = SetThreadDesktop(old_thread_desk);
ok(ret, "SetThreadDesktop failed!\n");
thread_desk = GetThreadDesktop(GetCurrentThreadId());
ok(thread_desk == old_thread_desk, "thread desktop doesn't match!\n");
memset(name, 0, sizeof(name));
ret = GetUserObjectInformationA(thread_desk, UOI_NAME, name, 1024, NULL);
ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
SetLastError(0xdeadbeef);
ret = SendInput(1, inputs, sizeof(INPUT));
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
ok(ret == 1, "unexpected return count %d\n", ret);
/* free resources */
ret = CloseDesktop(input_desk);
ok(ret, "CloseDesktop failed!\n");
ret = CloseDesktop(old_input_desk);
ok(ret, "CloseDesktop failed!\n");
ret = CloseDesktop(new_desk);
ok(ret, "CloseDesktop failed!\n");
}
static void test_inputdesktop2(void)
{
HWINSTA w1, w2;
HDESK thread_desk, new_desk, input_desk, hdesk;
DWORD ret;
thread_desk = GetThreadDesktop(GetCurrentThreadId());
ok(thread_desk != NULL, "GetThreadDesktop failed!\n");
w1 = GetProcessWindowStation();
ok(w1 != NULL, "GetProcessWindowStation failed!\n");
SetLastError(0xdeadbeef);
w2 = CreateWindowStationA("winsta_test", 0, WINSTA_ALL_ACCESS, NULL);
ret = GetLastError();
ok(w2 != NULL || ret == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%u)\n", ret);
if (!w2)
{
win_skip("Not enough privileges for CreateWindowStation\n");
return;
}
ret = EnumDesktopsA(GetProcessWindowStation(), desktop_callbackA, 0);
ok(!ret, "EnumDesktopsA failed!\n");
input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
ok(input_desk != NULL, "OpenInputDesktop failed!\n");
ret = CloseDesktop(input_desk);
ok(ret, "CloseDesktop failed!\n");
ret = SetProcessWindowStation(w2);
ok(ret, "SetProcessWindowStation failed!\n");
hdesk = GetThreadDesktop(GetCurrentThreadId());
ok(hdesk != NULL, "GetThreadDesktop failed!\n");
ok(hdesk == thread_desk, "thread desktop should not change after winstation changed!\n");
ret = EnumDesktopsA(GetProcessWindowStation(), desktop_callbackA, 0);
new_desk = CreateDesktopA("desk_test", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
ok(new_desk != NULL, "CreateDesktop failed!\n");
ret = EnumDesktopsA(GetProcessWindowStation(), desktop_callbackA, 0);
ok(!ret, "EnumDesktopsA failed!\n");
SetLastError(0xdeadbeef);
input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
ok(input_desk == NULL, "OpenInputDesktop should fail on non default winstation!\n");
ok(GetLastError() == ERROR_INVALID_FUNCTION || broken(GetLastError() == 0xdeadbeef), "last error %08x\n", GetLastError());
hdesk = OpenDesktopA("desk_test", 0, TRUE, DESKTOP_ALL_ACCESS);
ok(hdesk != NULL, "OpenDesktop failed!\n");
SetLastError(0xdeadbeef);
ret = SwitchDesktop(hdesk);
todo_wine
ok(!ret, "Switch to desktop belong to non default winstation should fail!\n");
todo_wine
ok(GetLastError() == ERROR_ACCESS_DENIED || broken(GetLastError() == 0xdeadbeef), "last error %08x\n", GetLastError());
ret = SetThreadDesktop(hdesk);
ok(ret, "SetThreadDesktop failed!\n");
/* clean side effect */
ret = SetThreadDesktop(thread_desk);
todo_wine
ok(ret, "SetThreadDesktop should success even desktop is not belong to process winstation!\n");
ret = SetProcessWindowStation(w1);
ok(ret, "SetProcessWindowStation failed!\n");
ret = SetThreadDesktop(thread_desk);
ok(ret, "SetThreadDesktop failed!\n");
ret = CloseWindowStation(w2);
ok(ret, "CloseWindowStation failed!\n");
ret = CloseDesktop(new_desk);
ok(ret, "CloseDesktop failed!\n");
ret = CloseDesktop(hdesk);
ok(ret, "CloseDesktop failed!\n");
}
static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_DESTROY)
{
trace("destroying hwnd %p\n", hWnd);
PostQuitMessage(0);
return 0;
}
return DefWindowProcA( hWnd, msg, wParam, lParam );
}
typedef struct tag_wnd_param
{
const char *wnd_name;
HWND hwnd;
HDESK hdesk;
HANDLE hevent;
} wnd_param;
static DWORD WINAPI create_window(LPVOID param)
{
wnd_param *param1 = param;
DWORD ret;
MSG msg;
ret = SetThreadDesktop(param1->hdesk);
ok(ret, "SetThreadDesktop failed!\n");
param1->hwnd = CreateWindowA("test_class", param1->wnd_name, WS_POPUP, 0, 0, 100, 100, NULL, NULL, NULL, NULL);
ok(param1->hwnd != 0, "CreateWindowA failed!\n");
ret = SetEvent(param1->hevent);
ok(ret, "SetEvent failed!\n");
while (GetMessageA(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessageA(&msg);
}
return 0;
}
static DWORD set_foreground(HWND hwnd)
{
HWND hwnd_fore;
DWORD set_id, fore_id, ret;
char win_text[1024];
hwnd_fore = GetForegroundWindow();
GetWindowTextA(hwnd_fore, win_text, 1024);
set_id = GetWindowThreadProcessId(hwnd, NULL);
fore_id = GetWindowThreadProcessId(hwnd_fore, NULL);
trace("\"%s\" %p %08x hwnd %p %08x\n", win_text, hwnd_fore, fore_id, hwnd, set_id);
ret = AttachThreadInput(set_id, fore_id, TRUE);
trace("AttachThreadInput returned %08x\n", ret);
ret = ShowWindow(hwnd, SW_SHOWNORMAL);
trace("ShowWindow returned %08x\n", ret);
ret = SetWindowPos(hwnd, HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
trace("set topmost returned %08x\n", ret);
ret = SetWindowPos(hwnd, HWND_NOTOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
trace("set notopmost returned %08x\n", ret);
ret = SetForegroundWindow(hwnd);
trace("SetForegroundWindow returned %08x\n", ret);
Sleep(250);
AttachThreadInput(set_id, fore_id, FALSE);
return ret;
}
static void test_foregroundwindow(void)
{
HWND hwnd, hwnd_test, partners[2], hwnds[2];
HDESK hdesks[2];
int thread_desk_id, input_desk_id, hwnd_id;
WNDCLASSA wclass;
wnd_param param;
DWORD ret, timeout, timeout_old;
char win_text[1024];
#define DESKTOPS 2
memset( &wclass, 0, sizeof(wclass) );
wclass.lpszClassName = "test_class";
wclass.lpfnWndProc = WndProc;
RegisterClassA(&wclass);
param.wnd_name = "win_name";
hdesks[0] = GetThreadDesktop(GetCurrentThreadId());
ok(hdesks[0] != NULL, "OpenDesktop failed!\n");
SetLastError(0xdeadbeef);
hdesks[1] = CreateDesktopA("desk2", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
ret = GetLastError();
ok(hdesks[1] != NULL || ret == ERROR_ACCESS_DENIED, "CreateDesktop failed (%u)\n", ret);
if(!hdesks[1])
{
win_skip("Not enough privileges for CreateDesktop\n");
return;
}
ret = SystemParametersInfoA(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &timeout_old, 0);
if(!ret)
{
win_skip("Skip tests on NT4\n");
CloseDesktop(hdesks[1]);
return;
}
trace("old timeout %d\n", timeout_old);
timeout = 0;
ret = SystemParametersInfoA(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, 0, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
ok(ret, "set foreground lock timeout failed!\n");
ret = SystemParametersInfoA(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &timeout, 0);
ok(ret, "get foreground lock timeout failed!\n");
ok(timeout == 0, "unexpected timeout %d\n", timeout);
for (thread_desk_id = 0; thread_desk_id < DESKTOPS; thread_desk_id++)
{
param.hdesk = hdesks[thread_desk_id];
param.hevent = CreateEventA(NULL, TRUE, FALSE, NULL);
CreateThread(NULL, 0, create_window, &param, 0, NULL);
ret = WaitForSingleObject(param.hevent, INFINITE);
ok(ret == WAIT_OBJECT_0, "wait failed!\n");
hwnds[thread_desk_id] = param.hwnd;
}
for (thread_desk_id = 0; thread_desk_id < DESKTOPS; thread_desk_id++)
{
param.hdesk = hdesks[thread_desk_id];
param.hevent = CreateEventA(NULL, TRUE, FALSE, NULL);
CreateThread(NULL, 0, create_window, &param, 0, NULL);
ret = WaitForSingleObject(param.hevent, INFINITE);
ok(ret == WAIT_OBJECT_0, "wait failed!\n");
partners[thread_desk_id] = param.hwnd;
}
trace("hwnd0 %p hwnd1 %p partner0 %p partner1 %p\n", hwnds[0], hwnds[1], partners[0], partners[1]);
for (hwnd_id = 0; hwnd_id < DESKTOPS; hwnd_id++)
for (thread_desk_id = 0; thread_desk_id < DESKTOPS; thread_desk_id++)
for (input_desk_id = 0; input_desk_id < DESKTOPS; input_desk_id++)
{
trace("testing thread_desk %d input_desk %d hwnd %d\n",
thread_desk_id, input_desk_id, hwnd_id);
hwnd_test = hwnds[hwnd_id];
ret = SetThreadDesktop(hdesks[thread_desk_id]);
ok(ret, "set thread desktop failed!\n");
ret = SwitchDesktop(hdesks[input_desk_id]);
ok(ret, "switch desktop failed!\n");
set_foreground(partners[0]);
set_foreground(partners[1]);
hwnd = GetForegroundWindow();
ok(hwnd != hwnd_test, "unexpected foreground window %p\n", hwnd);
ret = set_foreground(hwnd_test);
hwnd = GetForegroundWindow();
GetWindowTextA(hwnd, win_text, 1024);
trace("hwnd %p name %s\n", hwnd, win_text);
if (input_desk_id == hwnd_id)
{
if (input_desk_id == thread_desk_id)
{
ok(ret, "SetForegroundWindow failed!\n");
ok(hwnd == hwnd_test , "unexpected foreground window %p\n", hwnd);
}
else
{
todo_wine ok(ret, "SetForegroundWindow failed!\n");
todo_wine ok(hwnd == 0, "unexpected foreground window %p\n", hwnd);
}
}
else
{
if (input_desk_id == thread_desk_id)
{
ok(!ret, "SetForegroundWindow should fail!\n");
ok(hwnd == partners[input_desk_id] , "unexpected foreground window %p\n", hwnd);
}
else
{
todo_wine ok(!ret, "SetForegroundWindow should fail!\n");
todo_wine ok(hwnd == 0, "unexpected foreground window %p\n", hwnd);
}
}
}
/* Clean up */
for (thread_desk_id = DESKTOPS - 1; thread_desk_id >= 0; thread_desk_id--)
{
ret = SetThreadDesktop(hdesks[thread_desk_id]);
ok(ret, "set thread desktop failed!\n");
SendMessageA(hwnds[thread_desk_id], WM_DESTROY, 0, 0);
SendMessageA(partners[thread_desk_id], WM_DESTROY, 0, 0);
}
ret = SwitchDesktop(hdesks[0]);
ok(ret, "switch desktop failed!\n");
CloseDesktop(hdesks[1]);
ret = SystemParametersInfoA(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UlongToPtr(timeout_old), SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
ok(ret, "set foreground lock timeout failed!\n");
ret = SystemParametersInfoA(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &timeout, 0);
ok(ret, "get foreground lock timeout failed!\n");
ok(timeout == timeout_old, "unexpected timeout %d\n", timeout);
}
START_TEST(winstation)
{
/* Check whether this platform supports WindowStation calls */
@@ -487,8 +936,11 @@ START_TEST(winstation)
return;
}
test_inputdesktop();
test_inputdesktop2();
test_enumstations();
test_enumdesktops();
test_handles();
test_getuserobjectinformation();
test_foregroundwindow();
}
+8 -8
View File
@@ -113,16 +113,16 @@ static void wsprintfWTest(void)
static void CharUpperTest(void)
{
INT_PTR i,out,failed;
INT_PTR i, out;
BOOL failed = FALSE;
failed = 0;
for (i=0;i<256;i++)
{
out = (INT_PTR)CharUpper((LPTSTR)i);
out = (INT_PTR)CharUpperA((LPSTR)i);
/* printf("%0x ",out); */
if ((out >> 16) != 0)
{
failed = 1;
failed = TRUE;
break;
}
}
@@ -131,16 +131,16 @@ static void CharUpperTest(void)
static void CharLowerTest(void)
{
INT_PTR i,out,failed;
INT_PTR i, out;
BOOL failed = FALSE;
failed = 0;
for (i=0;i<256;i++)
{
out = (INT_PTR)CharLower((LPTSTR)i);
out = (INT_PTR)CharLowerA((LPSTR)i);
/* printf("%0x ",out); */
if ((out >> 16) != 0)
{
failed = 1;
failed = TRUE;
break;
}
}