Re: [try 2] Test for window messages of a property sheet with custom dialog proc (bug 12104)

2010-11-13 Thread Bernhard Übelacker
Am Donnerstag 11 November 2010 schrieben Sie:
 On 11/06/2010 11:16 AM, Bernhard Übelacker wrote:
  Hello,
  this patch checks for correct arrival of messages to a subclassed property 
  page.
 
  For this bug http://bugs.winehq.org/show_bug.cgi?id=12104 specifically
  the first WM_SIZE message is interesting which is not sent in wine.
 
  I have changed the patch based on the feedback I got on my first mail.
  (http://www.winehq.org/pipermail/wine-devel/2010-October/087474.html)
 
  Now I am using the msg.h facilities for checking the messages.
 
  Kind regards,
  Bernhard
 
 
 Hi,
 
 Ever since this patch the shell32:shlexec tests fail on NT4 and W2K:
 
 http://test.winehq.org/data/tests/shell32:shlexec.html
 
 I can reproduce easily by running (on a clean Windows box):
 
 winetest-latest.exe comctl32:propsheet shell32:shlexec
 
 This will throw some error dialog boxes and I'm also unable to 
 double-click items in the Windows Explorer.
 
 Thoughts/Ideas/Suggestions?
 
 

Hello,
I can also reproduce this on a nt4 virtualbox.

When running an older winetest-latest from 2010-11-05 [1]
then there is already a crash in explorer.exe happening.

When running a winetest-latest from 2010-11-08 [2]
there is this crash also but then winetest-shell sleeps some time.
After this for example a double click on my computer does not open an
explorer window.

When I run both tests as single files from a make crosstest
I was not able to reproduce neither the explorer crash or the explorer
windows not opening.

Can someone provide some pointers how the winetest-latest.exe at the
testbot is built?

[1] http://testbot.winehq.org/JobDetails.pl?Key=6831#k104
[2] http://testbot.winehq.org/JobDetails.pl?Key=6895#k104

Kind regards,
Bernhard




Test for window messages of a property sheet with custom dialog proc (bug 12104)

2010-10-24 Thread Bernhard Übelacker
Hello,
the attached patch consists of a test case for following bug:
http://bugs.winehq.org/show_bug.cgi?id=12104

This test shows how cygwin's setup checks if a WM_SIZE message
was received (by the custom window proc).

In wine only the property page gets such a message - not the sheet.

If I got it right, tests which would fail in wine are prefixed with todo_wine?

I want to ask if this patch looks right for inclusion and if the
location (dlls/comctl32/tests/) is right?

Kind regards,
Bernhard
From e89af2359528a559deec7cc35cbc017ab977f079 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= bernha...@vr-web.de
Date: Sun, 24 Oct 2010 13:17:01 +0200
Subject: Test for window messages of a property sheet with custom dialog proc.
 (As seen in bug 12104 - Cygwin's setup.exe doesn't resize properly)

---
 dlls/comctl32/tests/propsheet.c |  122 +++
 dlls/comctl32/tests/resources.h |1 +
 dlls/comctl32/tests/rsrc.rc |7 ++
 3 files changed, 130 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/tests/propsheet.c b/dlls/comctl32/tests/propsheet.c
index bfbaaa0..6232442 100644
--- a/dlls/comctl32/tests/propsheet.c
+++ b/dlls/comctl32/tests/propsheet.c
@@ -525,6 +525,127 @@ static void test_custom_default_button(void)
 DestroyWindow(hdlg);
 }
 
+static WNDPROC oldWndProc;
+static BOOL clientRectValid;
+struct message_entry {
+UINT msg;
+CHAR source[10];
+};
+static const struct message_entry message_array[] = {
+{ PSCB_PRECREATE,   sheet_cb },
+{ PSCB_INITIALIZED, sheet_cb },
+{ WM_WINDOWPOSCHANGING, sheet_wp },
+{ WM_NCCALCSIZE,sheet_wp },
+{ WM_WINDOWPOSCHANGED,  sheet_wp },
+{ WM_MOVE,  sheet_wp },
+{ WM_SIZE,  sheet_wp }
+};
+
+static void check_message(HWND hwnd, UINT msg, PCHAR source)
+{
+static UINT msg_count;
+
+/*trace(check_message: msg[0x%08x] received by %s\n, msg, source);*/
+
+if (msg_count  sizeof(message_array)/sizeof(message_array[0]))
+{
+/* disabled because todo_wine would fail because some messages arrive correct in wine
+ok(message_array[msg_count].msg == msg,
+received message 0x%x when expecting 0x%x\n,
+msg, message_array[msg_count].msg);
+ok(strcmp(message_array[msg_count].source, source) == 0,
+receiver is %s when expecting %s\n,
+source, message_array[msg_count].source);
+*/
+
+msg_count++;
+}
+}
+
+static LRESULT CALLBACK sheet_callback_messages_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+check_message(hwnd, msg, sheet_wp);
+
+switch (msg)
+{
+case WM_SIZE:
+/*trace(sheet_callback_messages_proc: clientRectValid[%d]\n, clientRectValid);*/
+clientRectValid = TRUE;
+break;
+case WM_CTLCOLORSTATIC:
+keybd_event(VK_ESCAPE, 0, 0, 0);
+break;
+}
+
+return CallWindowProc (oldWndProc, hwnd, msg, wParam, lParam);
+}
+
+static int CALLBACK sheet_callback_messages(HWND hwnd, UINT msg, LPARAM lparam)
+{
+check_message(hwnd, msg, sheet_cb);
+
+switch (msg)
+{
+case PSCB_INITIALIZED:
+oldWndProc = (WNDPROC)GetWindowLongPtr (hwnd, GWLP_WNDPROC);
+SetWindowLongPtr (hwnd, GWLP_WNDPROC, (LONG_PTR)sheet_callback_messages_proc);
+return TRUE;
+}
+
+return TRUE;
+}
+
+static INT_PTR CALLBACK page_dlg_proc_messages(HWND hwnd, UINT msg, WPARAM wparam,
+   LPARAM lparam)
+{
+check_message(hwnd, msg, page);
+
+return FALSE;
+}
+
+static void test_messages(void)
+{
+HPROPSHEETPAGE hpsp[1];
+PROPSHEETPAGEA psp;
+PROPSHEETHEADERA psh;
+HWND hdlg;
+
+memset(psp, 0, sizeof(psp));
+psp.dwSize = sizeof(psp);
+psp.dwFlags = 0;
+psp.hInstance = GetModuleHandleA(NULL);
+U(psp).pszTemplate = MAKEINTRESOURCE(IDD_PROP_PAGE_MESSAGE_TEST);
+U2(psp).pszIcon = NULL;
+psp.pfnDlgProc = page_dlg_proc_messages;
+psp.lParam = 0;
+
+hpsp[0] = CreatePropertySheetPageA(psp);
+
+memset(psh, 0, sizeof(psh));
+psh.dwSize = sizeof(psh);
+psh.dwFlags = PSH_NOAPPLYNOW | PSH_WIZARD | PSH_USECALLBACK
+  /*| PSH_MODELESS */ | PSH_USEICONID;
+psh.pszCaption = test caption;
+psh.nPages = 1;
+psh.hwndParent = GetDesktopWindow();
+U3(psh).phpage = hpsp;
+psh.pfnCallback = sheet_callback_messages;
+
+hdlg = (HWND)PropertySheetA(psh);
+if (hdlg == INVALID_HANDLE_VALUE)
+{
+win_skip(comctl32 4.70 needs dwSize adjustment\n);
+psh.dwSize = sizeof(psh) - sizeof(HBITMAP) - sizeof(HPALETTE) - sizeof(HBITMAP);
+hdlg = (HWND)PropertySheetA(psh);
+}
+ShowWindow(hdlg,SW_NORMAL);
+
+todo_wine
+ok(clientRectValid, The required WM_SIZE was never sent to the sheet.\n);
+
+DestroyWindow(hdlg);
+}
+
 START_TEST(propsheet)
 {
 test_title();
@@ -533,4 +654,5 @@ 

winedbg: output of the bt command misses sometimes a frame

2010-02-06 Thread Bernhard Übelacker
Hello,
as I was debugging in wine I wondered if following behaviour is intended or
could be considered a bug (and should be filed in bugtracker?).

When the debugger's current position is on the opening curly bracket of a
function a bt command writes a different stack as if the current position
is on the next instruction in this function.

What me makes wonder is the frame 0 is always correct but the calling
function is not in the stack at all in the first bt:


Wine-dbgbt
Backtrace:
=0 0x7ebe3622 IsWindow(hwnd=0x20060) 
[/home/bernhard/data/entwicklung/2010/wine/wine-git/dlls/user32/win.c:2503] in 
user32 (0x0033b500)
  1 0x7e25429d create_window16+0x5c(cs=0x33b53c, className=QWidget, 
instance=0x40, unicode=1) 
[/home/bernhard/data/entwicklung/2010/wine/wine-git/dlls/user.exe16/message.c:2670]
 in user.exe16 (0x0033b520)
  2 0x7ebe0f91 CreateWindowExW+0x7e(exStyle=1024, className=QWidget, 
windowName=pica, style=114032640, x=-2147483648, y=-2147483648, 
width=-2147483648, height=-2147483648, parent=(nil), menu=(nil), 
instance=0x40, data=0x0(nil)) 
[/home/bernhard/data/entwicklung/2010/wine/wine-git/dlls/user32/win.c:1500] in 
user32 (0x0033b570)
  3 0x650778f3 in qtgui4 (+0x778f3) (0x8000)


Wine-dbgnext
2507if (!(ptr = WIN_GetPtr( hwnd ))) return FALSE;


Wine-dbgbt
Backtrace:
=0 0x7ebe3637 IsWindow+0x15(hwnd=0x20060) 
[/home/bernhard/data/entwicklung/2010/wine/wine-git/dlls/user32/win.c:2507] in 
user32 (0x0033b2b0)
  1 0x7ebe0bda WIN_CreateWindowEx+0x1201(cs=0x33b53c, className=QWidget, 
module=0x40, unicode=1) 
[/home/bernhard/data/entwicklung/2010/wine/wine-git/dlls/user32/win.c:1406] in 
user32 (0x0033b500)
  2 0x7e25429d create_window16+0x5c(cs=0x33b53c, className=QWidget, 
instance=0x40, unicode=1) 
[/home/bernhard/data/entwicklung/2010/wine/wine-git/dlls/user.exe16/message.c:2670]
 in user.exe16 (0x0033b520)
  3 0x7ebe0f91 CreateWindowExW+0x7e(exStyle=1024, className=QWidget, 
windowName=pica, style=114032640, x=-2147483648, y=-2147483648, 
width=-2147483648, height=-2147483648, parent=(nil), menu=(nil), 
instance=0x40, data=0x0(nil)) 
[/home/bernhard/data/entwicklung/2010/wine/wine-git/dlls/user32/win.c:1500] in 
user32 (0x0033b570)
  4 0x650778f3 in qtgui4 (+0x778f3) (0x8000)


Wine-dbg


Kind regards
Bernhard




user32: A window is after a call to SetParent invisible when hwnd and newParent is equal (bug 21497)

2010-02-02 Thread Bernhard Übelacker
(Resent, my first mail has not appeared on the list?)

Hello,
in SetParent the window (hwnd) get hidden by ShowWindow( hwnd, SW_HIDE ),
then a call to wineserver is done
and then the window is made visible again.

If this call to wineserver fails the window stays invisible.

This patch at least avoids this when hwnd and newParent is equal.
(If there are other cases this call could fail the window stays invisble.)

It could be observed in http://bugs.winehq.org/show_bug.cgi?id=21497

I want to ask for some comments what to change or if it could be sent to
wine-patches as it is?

Kind regards
Bernhard

---
 dlls/user32/tests/win.c |6 ++
 dlls/user32/win.c   |4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 6fb6ce0..82caccb 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -445,6 +445,12 @@ static void test_parent_owner(void)
 ret = SetParent( test, child );
 ok( ret == desktop, SetParent return value %p expected %p\n, ret, 
desktop );
 check_parents( test, child, child, 0, 0, hwndMain, test );
+
+ShowWindow( test, SW_SHOW );
+ret = SetParent( test, test );
+ok( ret == NULL, SetParent return value %p expected %p\n, ret, NULL );
+ok( GetWindowLongA( test, GWL_STYLE )  WS_VISIBLE, window is not visible 
after SetParent\n );
+check_parents( test, child, child, 0, 0, hwndMain, test );
 DestroyWindow( test );
 
 /* owned popup */
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index acf70a3..8308ba8 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -2690,8 +2690,8 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
 return 0;
 }
 
-/* Some applications try to set a child as a parent */
-if (IsChild(hwnd, parent))
+/* Some applications try to set a child as a parent or itself */
+if (IsChild(hwnd, parent) || hwnd == parent)
 {
 SetLastError( ERROR_INVALID_PARAMETER );
 return 0;
-- 
1.6.5