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>
This commit is contained in:
Dmitry Timoshkov 2017-08-18 19:42:11 +08:00 committed by Alexandre Julliard
parent a62a8601db
commit 3d66e753e7
2 changed files with 8 additions and 7 deletions

View File

@ -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 );
}

View File

@ -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());