Files
reactos/win32ss
Hermès Bélusca-Maïto 614e1ab762 [USER32] DIALOG_CreateIndirect: Add missing DF_END checks and other remarks (#9362)
CORE-20706

The `DF_END` flag is set when `EndDialog()` is invoked. When this is done
in a dialog's `WM_INITDIALOG` handler, further processing is halted after
the handler returns.
This ensures in particular that the dialog isn't shown[^1], stays hidden,
since it's going to be automatically destroyed next.

- Add a `DF_END` check just after invoking the `WM_INITDIALOG` handler,
  and don't execute the focus-assignment code block if the flag is set.

- Don't continue if the dialog has been forcefully destroyed (with a direct
  `DestroyWindow()` call) in `WM_INITDIALOG`.

- Don't try to make the dialog visible if the `DF_END` flag has been set.

- Add a TODO to remember we have to handle `DS_SETFOREGROUND`.

[^1]: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enddialog#remarks
  > A dialog box procedure can call EndDialog at any time, even during the
  > processing of the WM_INITDIALOG message. If your application calls the
  > function while WM_INITDIALOG is being processed, the dialog box is
  > destroyed before it is shown and before the input focus is set.
2026-08-14 13:11:55 +02:00
..