Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-20706

[USER32] Created dialog must stay hidden if it's ended from within WM_INITDIALOG

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • None
    • Win32SS
    • None

    Description

      • Suppose you have a dialog whose resource has the WS_VISIBLE style.
      • Create this modal dialog with DialogBox(Param)(A/W).
      • In this dialog's dialogproc WM_INITDIALOG handler, after some work (for example, posting some messages to ourselves), invoke EndDialog() to terminate early the dialog, then return from the dialogproc.

      According to 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.

      When running on Windows such a scenario in step-by-step with a debugger (to slow things down enough to see any drawing artifacts happening), the dialog indeed doesn't show at all.
      When testing the same in ReactOS (and very certainly in Wine, by looking at its code), the dialog will very briefly appear before being terminated.

      Attachments

        Activity

          People

            hbelusca hbelusca
            hbelusca hbelusca
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: