Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
96e44ddb
Commit
96e44ddb
authored
Aug 12, 2009
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Aug 12, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Return 0 from DefDlgProc and dialog loop for invalid dialog handles.
parent
95d3a722
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
9 deletions
+18
-9
defdlg.c
dlls/user32/defdlg.c
+6
-3
dialog.c
dlls/user32/dialog.c
+1
-1
dialog.c
dlls/user32/tests/dialog.c
+11
-5
No files found.
dlls/user32/defdlg.c
View file @
96e44ddb
...
...
@@ -345,7 +345,10 @@ DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create )
wndPtr
=
WIN_GetPtr
(
hwnd
);
if
(
!
wndPtr
||
wndPtr
==
WND_OTHER_PROCESS
||
wndPtr
==
WND_DESKTOP
)
{
SetLastError
(
ERROR_INVALID_WINDOW_HANDLE
);
return
NULL
;
}
dlgInfo
=
wndPtr
->
dlgInfo
;
...
...
@@ -382,7 +385,7 @@ LRESULT WINAPI DefDlgProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam,
BOOL
result
=
FALSE
;
/* Perform DIALOGINFO initialization if not done */
if
(
!
(
dlgInfo
=
DIALOG_get_info
(
hwnd32
,
TRUE
)))
return
-
1
;
if
(
!
(
dlgInfo
=
DIALOG_get_info
(
hwnd32
,
TRUE
)))
return
0
;
SetWindowLongPtrW
(
hwnd32
,
DWLP_MSGRESULT
,
0
);
...
...
@@ -433,7 +436,7 @@ LRESULT WINAPI DefDlgProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
BOOL
result
=
FALSE
;
/* Perform DIALOGINFO initialization if not done */
if
(
!
(
dlgInfo
=
DIALOG_get_info
(
hwnd
,
TRUE
)))
return
-
1
;
if
(
!
(
dlgInfo
=
DIALOG_get_info
(
hwnd
,
TRUE
)))
return
0
;
SetWindowLongPtrW
(
hwnd
,
DWLP_MSGRESULT
,
0
);
...
...
@@ -484,7 +487,7 @@ LRESULT WINAPI DefDlgProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
DLGPROC
dlgproc
;
/* Perform DIALOGINFO initialization if not done */
if
(
!
(
dlgInfo
=
DIALOG_get_info
(
hwnd
,
TRUE
)))
return
-
1
;
if
(
!
(
dlgInfo
=
DIALOG_get_info
(
hwnd
,
TRUE
)))
return
0
;
SetWindowLongPtrW
(
hwnd
,
DWLP_MSGRESULT
,
0
);
...
...
dlls/user32/dialog.c
View file @
96e44ddb
...
...
@@ -809,7 +809,7 @@ INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
if
(
!
GetMessageW
(
&
msg
,
0
,
0
,
0
))
break
;
}
if
(
!
IsWindow
(
hwnd
))
return
-
1
;
if
(
!
IsWindow
(
hwnd
))
return
0
;
if
(
!
(
dlgInfo
->
flags
&
DF_END
)
&&
!
IsDialogMessageW
(
hwnd
,
&
msg
))
{
TranslateMessage
(
&
msg
);
...
...
dlls/user32/tests/dialog.c
View file @
96e44ddb
...
...
@@ -932,12 +932,12 @@ static INT_PTR CALLBACK DestroyOnCloseDlgWinProc (HWND hDlg, UINT uiMsg,
static
void
test_DialogBoxParamA
(
void
)
{
int
ret
;
INT_PTR
ret
;
HWND
hwnd_invalid
=
(
HWND
)
0x4444
;
SetLastError
(
0xdeadbeef
);
ret
=
DialogBoxParamA
(
GetModuleHandle
(
NULL
),
"IDD_DIALOG"
,
hwnd_invalid
,
0
,
0
);
ok
(
0
==
ret
||
broken
(
ret
==
-
1
),
"DialogBoxParamA returned %d, expected 0
\n
"
,
ret
);
ok
(
0
==
ret
||
broken
(
ret
==
-
1
),
"DialogBoxParamA returned %
l
d, expected 0
\n
"
,
ret
);
ok
(
ERROR_INVALID_WINDOW_HANDLE
==
GetLastError
()
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"got %d, expected ERROR_INVALID_WINDOW_HANDLE
\n
"
,
GetLastError
());
...
...
@@ -945,7 +945,7 @@ static void test_DialogBoxParamA(void)
/* Test a dialog which destroys itself on WM_INITDIALOG. */
SetLastError
(
0xdeadbeef
);
ret
=
DialogBoxParamA
(
GetModuleHandle
(
NULL
),
"IDD_DIALOG"
,
0
,
DestroyDlgWinProc
,
0
);
ok
(
-
1
==
ret
,
"DialogBoxParamA returned %d, expected -1
\n
"
,
ret
);
ok
(
-
1
==
ret
,
"DialogBoxParamA returned %
l
d, expected -1
\n
"
,
ret
);
ok
(
ERROR_INVALID_WINDOW_HANDLE
==
GetLastError
()
||
GetLastError
()
==
ERROR_SUCCESS
||
broken
(
GetLastError
()
==
0xdeadbeef
),
...
...
@@ -953,14 +953,20 @@ static void test_DialogBoxParamA(void)
/* Test a dialog which destroys itself on WM_CLOSE. */
ret
=
DialogBoxParamA
(
GetModuleHandle
(
NULL
),
"IDD_DIALOG"
,
0
,
DestroyOnCloseDlgWinProc
,
0
);
todo_wine
ok
(
0
==
ret
,
"DialogBoxParamA returned %
d, expected 0
\n
"
,
ret
);
ok
(
0
==
ret
,
"DialogBoxParamA returned %l
d, expected 0
\n
"
,
ret
);
SetLastError
(
0xdeadbeef
);
ret
=
DialogBoxParamA
(
GetModuleHandle
(
NULL
),
"RESOURCE_INVALID"
,
0
,
0
,
0
);
ok
(
-
1
==
ret
,
"DialogBoxParamA returned %d, expected -1
\n
"
,
ret
);
ok
(
-
1
==
ret
,
"DialogBoxParamA returned %
l
d, expected -1
\n
"
,
ret
);
ok
(
ERROR_RESOURCE_NAME_NOT_FOUND
==
GetLastError
()
||
broken
(
GetLastError
()
==
0xdeadbeef
),
"got %d, expected ERROR_RESOURCE_NAME_NOT_FOUND
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
DefDlgProcA
(
0
,
WM_ERASEBKGND
,
0
,
0
);
ok
(
ret
==
0
,
"DefDlgProcA returned %ld, expected 0
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_WINDOW_HANDLE
,
"got %d, expected ERROR_INVALID_WINDOW_HANDLE
\n
"
,
GetLastError
());
}
static
void
test_DisabledDialogTest
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment