Commit 3d66e753 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

user32: DialogBoxParam should return -1 when dialog control creation fails.

parent a62a8601
......@@ -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 );
}
......
......@@ -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());
......
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