https://git.reactos.org/?p=reactos.git;a=commitdiff;h=910822b8f5ffae49f25486786dc248e287948366

commit 910822b8f5ffae49f25486786dc248e287948366
Author:     Thomas Faber <[email protected]>
AuthorDate: Sat Mar 4 16:51:57 2023 -0500
Commit:     Thomas Faber <[email protected]>
CommitDate: Tue Mar 7 19:41:51 2023 -0500

    [REGEDIT] Add back import prompt message lost during Wine sync. CORE-18770
---
 base/applications/regedit/regedit.c | 50 +++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/base/applications/regedit/regedit.c 
b/base/applications/regedit/regedit.c
index 573a6341433..35fa13f037d 100644
--- a/base/applications/regedit/regedit.c
+++ b/base/applications/regedit/regedit.c
@@ -123,7 +123,11 @@ typedef enum {
     ACTION_ADD, ACTION_EXPORT, ACTION_DELETE
 } REGEDIT_ACTION;
 
+#ifdef __REACTOS__
+static void PerformRegAction(REGEDIT_ACTION action, WCHAR **argv, int *i, BOOL 
silent)
+#else
 static void PerformRegAction(REGEDIT_ACTION action, WCHAR **argv, int *i)
+#endif
 {
     switch (action) {
     case ACTION_ADD: {
@@ -131,6 +135,41 @@ static void PerformRegAction(REGEDIT_ACTION action, WCHAR 
**argv, int *i)
             WCHAR *realname = NULL;
             FILE *reg_file;
 
+#ifdef __REACTOS__
+            /* Request import confirmation */
+            if (!silent)
+            {
+                WCHAR szText[512];
+                int choice;
+                UINT mbType = MB_YESNO;
+
+                LoadStringW(hInst, IDS_IMPORT_PROMPT, szText, 
ARRAY_SIZE(szText));
+
+                if (argv[*i + 1] != NULL)
+                {
+                    /* Enable three buttons if there's another file coming */
+                    mbType = MB_YESNOCANCEL;
+                }
+
+                choice = InfoMessageBox(NULL, mbType | MB_ICONQUESTION, 
szTitle, szText, filename);
+                switch (choice)
+                {
+                    case IDNO:
+                        return;
+                    case IDCANCEL:
+                        /* The cancel case is useful if the user is importing 
more than one registry file
+                         * at a time, and wants to back out anytime during the 
import process. This way, the
+                         * user doesn't have to resort to ending the regedit 
process abruptly just to cancel
+                         * the operation.
+                         * To achieve this, we skip all further command line 
arguments.
+                         */
+                        *i = INT_MAX - 1;
+                        return;
+                    default:
+                        break;
+                }
+            }
+#endif
             if (!lstrcmpW(filename, L"-"))
                 reg_file = stdin;
             else
@@ -190,6 +229,9 @@ BOOL ProcessCmdLine(WCHAR *cmdline)
     WCHAR **argv;
     int argc, i;
     REGEDIT_ACTION action = ACTION_ADD;
+#ifdef __REACTOS__
+    BOOL silent = FALSE;
+#endif
 
     argv = CommandLineToArgvW(cmdline, &argc);
 
@@ -231,6 +273,10 @@ BOOL ProcessCmdLine(WCHAR *cmdline)
             /* unhandled */;
             break;
         case 'S':
+#ifdef __REACTOS__
+            silent = TRUE;
+            break;
+#endif
         case 'V':
             /* ignored */;
             break;
@@ -256,7 +302,11 @@ BOOL ProcessCmdLine(WCHAR *cmdline)
     }
 
     for (; i < argc; i++)
+#ifdef __REACTOS__
+        PerformRegAction(action, argv, &i, silent);
+#else
         PerformRegAction(action, argv, &i);
+#endif
 
     LocalFree(argv);
 

Reply via email to