https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6f60301d25a29583d3959fc957aa6530b076ab41

commit 6f60301d25a29583d3959fc957aa6530b076ab41
Author:     Denis Robert <[email protected]>
AuthorDate: Mon Dec 23 14:24:21 2024 +0100
Commit:     GitHub <[email protected]>
CommitDate: Mon Dec 23 16:24:21 2024 +0300

    [NEWDEV] Fix bad use of PropSheet_SetCurSelByID (#7574)
    
    PropSheet_SetCurSelByID() was badly called in response of PSN_WIZBACK or
    PSN_WIZNEXT notifications. See the reference on these notification codes:
    
    https://learn.microsoft.com/en-us/windows/win32/controls/psn-wizback
    
    > Returns 0 to allow the wizard to go to the previous page. Returns -1 to
    > prevent the wizard from changing pages. To display a particular page,
    > return its dialog resource identifier.
    > (...)
    > To set the return value, the dialog box procedure for the page must call
    > the SetWindowLong function with the DWL_MSGRESULT value and return TRUE.
    
    This bug sometimes causes the wrong page to appear (e.g. "Previous" in
    IDD_NODRIVER should come back in IDD_CHSOURCE, but goes to IDD_WELCOME).
---
 dll/win32/newdev/wizard.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/dll/win32/newdev/wizard.c b/dll/win32/newdev/wizard.c
index 3dd231a4013..5204bcdf5d2 100644
--- a/dll/win32/newdev/wizard.c
+++ b/dll/win32/newdev/wizard.c
@@ -545,9 +545,9 @@ WelcomeDlgProc(
                     if (SendDlgItemMessage(hwndDlg, IDC_RADIO_AUTO, 
BM_GETCHECK, (WPARAM)0, (LPARAM)0) == BST_CHECKED)
                     {
                         if (PrepareFoldersToScan(DevInstData, TRUE, FALSE, 
NULL))
-                            PropSheet_SetCurSelByID(GetParent(hwndDlg), 
IDD_SEARCHDRV);
+                            SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, 
IDD_SEARCHDRV);
                         else
-                            PropSheet_SetCurSelByID(GetParent(hwndDlg), 
IDD_INSTALLFAILED);
+                            SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, 
IDD_INSTALLFAILED);
                     }
                     return TRUE;
 
@@ -759,11 +759,11 @@ CHSourceDlgProc(
                             IsDlgButtonChecked(hwndDlg, IDC_CHECK_PATH),
                             GetDlgItem(hwndDlg, IDC_COMBO_PATH)))
                         {
-                            PropSheet_SetCurSelByID(GetParent(hwndDlg), 
IDD_SEARCHDRV);
+                            SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, 
IDD_SEARCHDRV);
                         }
                         else
                         {
-                            PropSheet_SetCurSelByID(GetParent(hwndDlg), 
IDD_INSTALLFAILED);
+                            SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, 
IDD_INSTALLFAILED);
                         }
                     }
                     else
@@ -1059,7 +1059,7 @@ NoDriverDlgProc(
                     hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
                     ShowWindow(hwndControl, SW_SHOW);
                     EnableWindow(hwndControl, TRUE);
-                    PropSheet_SetCurSelByID(GetParent(hwndDlg), IDD_CHSOURCE);
+                    SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CHSOURCE);
                     return TRUE;
 
                 case PSN_WIZFINISH:

Reply via email to