Module: wine Branch: stable Commit: 89d3f104d7949daa68a414c14c159ef53c4210f0 URL: https://source.winehq.org/git/wine.git/?a=commit;h=89d3f104d7949daa68a414c14...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Fri Aug 18 19:42:11 2017 +0800
user32: DialogBoxParam should return -1 when dialog control creation fails.
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit 3d66e753e7eb00495690bf54abc27943a9e089db) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/user32/dialog.c | 14 ++++++++------ dlls/user32/tests/dialog.c | 1 - 2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index 8b77ae2..c2aad8d 100644 --- a/dlls/user32/dialog.c +++ b/dlls/user32/dialog.c @@ -835,11 +835,12 @@ INT_PTR WINAPI DialogBoxParamA( HINSTANCE hInst, LPCSTR name, HRSRC hrsrc; LPCDLGTEMPLATEA ptr;
+ if (owner && !IsWindow(owner)) return 0; + if (!(hrsrc = FindResourceA( hInst, name, (LPSTR)RT_DIALOG ))) return -1; if (!(ptr = LoadResource(hInst, hrsrc))) return -1; - hwnd = DIALOG_CreateIndirect( hInst, ptr, owner, dlgProc, param, FALSE, &owner ); - if (hwnd) return DIALOG_DoDialogBox( hwnd, owner ); - return 0; + if (!(hwnd = DIALOG_CreateIndirect( hInst, ptr, owner, dlgProc, param, FALSE, &owner ))) return -1; + return DIALOG_DoDialogBox( hwnd, owner ); }
@@ -853,11 +854,12 @@ INT_PTR WINAPI DialogBoxParamW( HINSTANCE hInst, LPCWSTR name, HRSRC hrsrc; LPCDLGTEMPLATEW ptr;
+ if (owner && !IsWindow(owner)) return 0; + if (!(hrsrc = FindResourceW( hInst, name, (LPWSTR)RT_DIALOG ))) return -1; if (!(ptr = LoadResource(hInst, hrsrc))) return -1; - hwnd = DIALOG_CreateIndirect( hInst, ptr, owner, dlgProc, param, TRUE, &owner ); - if (hwnd) return DIALOG_DoDialogBox( hwnd, owner ); - return 0; + if (!(hwnd = DIALOG_CreateIndirect( hInst, ptr, owner, dlgProc, param, TRUE, &owner ))) return -1; + return DIALOG_DoDialogBox( hwnd, owner ); }
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c index 45886aa..1970e8f 100644 --- a/dlls/user32/tests/dialog.c +++ b/dlls/user32/tests/dialog.c @@ -1273,7 +1273,6 @@ static void test_DialogBoxParamA(void)
SetLastError(0xdeadbeef); ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_DIALOG_INVALID_CLASS", 0, DestroyDlgWinProc, 0); -todo_wine ok(ret == -1, "DialogBoxParamA returned %ld, expected -1\n", ret); ok(GetLastError() == 0, "got %d\n", GetLastError());