Commit c0acfe1e authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

user32/tests: Don't try to detect Win9x/WinMe several times.

parent c35c7a68
...@@ -63,6 +63,8 @@ static const char* szAWRClass = "Winsize"; ...@@ -63,6 +63,8 @@ static const char* szAWRClass = "Winsize";
static HMENU hmenu; static HMENU hmenu;
static DWORD our_pid; static DWORD our_pid;
static BOOL is_win9x = FALSE;
#define COUNTOF(arr) (sizeof(arr)/sizeof(arr[0])) #define COUNTOF(arr) (sizeof(arr)/sizeof(arr[0]))
static void dump_minmax_info( const MINMAXINFO *minmax ) static void dump_minmax_info( const MINMAXINFO *minmax )
...@@ -646,7 +648,6 @@ static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR ...@@ -646,7 +648,6 @@ static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR
} }
case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGING:
{ {
BOOL is_win9x = GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == 0;
WINDOWPOS *winpos = (WINDOWPOS *)lparam; WINDOWPOS *winpos = (WINDOWPOS *)lparam;
trace("main: WM_WINDOWPOSCHANGING %p after %p, x %d, y %d, cx %d, cy %d flags %08x\n", trace("main: WM_WINDOWPOSCHANGING %p after %p, x %d, y %d, cx %d, cy %d flags %08x\n",
winpos->hwnd, winpos->hwndInsertAfter, winpos->hwnd, winpos->hwndInsertAfter,
...@@ -855,7 +856,6 @@ static void test_nonclient_area(HWND hwnd) ...@@ -855,7 +856,6 @@ static void test_nonclient_area(HWND hwnd)
DWORD style, exstyle; DWORD style, exstyle;
RECT rc_window, rc_client, rc; RECT rc_window, rc_client, rc;
BOOL menu; BOOL menu;
BOOL is_win9x = GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == 0;
LRESULT ret; LRESULT ret;
style = GetWindowLongA(hwnd, GWL_STYLE); style = GetWindowLongA(hwnd, GWL_STYLE);
...@@ -1039,9 +1039,9 @@ static void test_shell_window(void) ...@@ -1039,9 +1039,9 @@ static void test_shell_window(void)
HWND hwnd1, hwnd2, hwnd3, hwnd4, hwnd5; HWND hwnd1, hwnd2, hwnd3, hwnd4, hwnd5;
HWND shellWindow, nextWnd; HWND shellWindow, nextWnd;
if (!GetWindowLongW(GetDesktopWindow(), GWL_STYLE)) if (is_win9x)
{ {
trace("Skipping shell window test on Win9x\n"); win_skip("Skipping shell window test on Win9x\n");
return; return;
} }
...@@ -1906,7 +1906,6 @@ static void test_SetWindowPos(HWND hwnd) ...@@ -1906,7 +1906,6 @@ static void test_SetWindowPos(HWND hwnd)
{ {
RECT orig_win_rc, rect; RECT orig_win_rc, rect;
LONG_PTR old_proc; LONG_PTR old_proc;
BOOL is_win9x = GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == 0;
SetRect(&rect, 111, 222, 333, 444); SetRect(&rect, 111, 222, 333, 444);
ok(!GetWindowRect(0, &rect), "GetWindowRect succeeded\n"); ok(!GetWindowRect(0, &rect), "GetWindowRect succeeded\n");
...@@ -1969,7 +1968,6 @@ static void test_SetMenu(HWND parent) ...@@ -1969,7 +1968,6 @@ static void test_SetMenu(HWND parent)
{ {
HWND child; HWND child;
HMENU hMenu, ret; HMENU hMenu, ret;
BOOL is_win9x = GetWindowLongPtrW(parent, GWLP_WNDPROC) == 0;
BOOL retok; BOOL retok;
DWORD style; DWORD style;
...@@ -2272,7 +2270,7 @@ static void test_vis_rgn( HWND hwnd ) ...@@ -2272,7 +2270,7 @@ static void test_vis_rgn( HWND hwnd )
ok( GetRandomRgn( hdc, hrgn, SYSRGN ) != 0, "GetRandomRgn failed\n" ); ok( GetRandomRgn( hdc, hrgn, SYSRGN ) != 0, "GetRandomRgn failed\n" );
GetWindowRect( hwnd, &win_rect ); GetWindowRect( hwnd, &win_rect );
GetRgnBox( hrgn, &rgn_rect ); GetRgnBox( hrgn, &rgn_rect );
if (GetVersion() & 0x80000000) if (is_win9x)
{ {
trace("win9x, mapping to screen coords\n"); trace("win9x, mapping to screen coords\n");
MapWindowPoints( hwnd, 0, (POINT *)&rgn_rect, 2 ); MapWindowPoints( hwnd, 0, (POINT *)&rgn_rect, 2 );
...@@ -2804,7 +2802,7 @@ static void test_capture_4(void) ...@@ -2804,7 +2802,7 @@ static void test_capture_4(void)
/* set main window to have initial capture */ /* set main window to have initial capture */
SetCapture(hwnd); SetCapture(hwnd);
if (!GetWindowLongW(GetDesktopWindow(), GWL_STYLE)) if (is_win9x)
{ {
win_skip("TrackPopupMenu test crashes on Win9x/WinMe\n"); win_skip("TrackPopupMenu test crashes on Win9x/WinMe\n");
} }
...@@ -3220,6 +3218,7 @@ static void test_SetParent(void) ...@@ -3220,6 +3218,7 @@ static void test_SetParent(void)
BOOL ret; BOOL ret;
HWND desktop = GetDesktopWindow(); HWND desktop = GetDesktopWindow();
HMENU hMenu; HMENU hMenu;
/* FIXME: This detection is not correct as it also covers (all?) XP+ */
BOOL is_win9x = GetWindowLongPtrW(desktop, GWLP_WNDPROC) == 0; BOOL is_win9x = GetWindowLongPtrW(desktop, GWLP_WNDPROC) == 0;
HWND parent, child1, child2, child3, child4, sibling; HWND parent, child1, child2, child3, child4, sibling;
...@@ -3280,6 +3279,8 @@ static void test_SetParent(void) ...@@ -3280,6 +3279,8 @@ static void test_SetParent(void)
check_parents(child3, child2, child2, child2, 0, child2, parent); check_parents(child3, child2, child2, child2, 0, child2, parent);
check_parents(child4, desktop, child2, child2, child2, child4, parent); check_parents(child4, desktop, child2, child2, child2, child4, parent);
} }
else
skip("Win9x/WinMe crash\n");
hMenu = CreateMenu(); hMenu = CreateMenu();
sibling = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW, sibling = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW,
...@@ -5918,6 +5919,10 @@ START_TEST(win) ...@@ -5918,6 +5919,10 @@ START_TEST(win)
if (!RegisterWindowClasses()) assert(0); if (!RegisterWindowClasses()) assert(0);
SetLastError(0xdeafbeef);
GetWindowLongPtrW(GetDesktopWindow(), GWLP_WNDPROC);
is_win9x = (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED);
hhook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId()); hhook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId());
if (!hhook) win_skip( "Cannot set CBT hook, skipping some tests\n" ); if (!hhook) win_skip( "Cannot set CBT hook, skipping some tests\n" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment