[SNDVOL32] Add the small line dialog
[reactos.git] / base / applications / regedit / regedit.c
index 8d9ee80..5f553d8 100644 (file)
@@ -18,8 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <regedit.h>
-
+#include "regedit.h"
 
 static const LPCWSTR usage =
     L"Usage:\n"
@@ -139,7 +138,7 @@ BOOL PerformRegAction(REGEDIT_ACTION action, LPWSTR s, BOOL silent)
     {
         case ACTION_ADD:
         {
-            WCHAR szTitle[512], szText[512];
+            WCHAR szText[512];
             WCHAR filename[MAX_PATH];
             FILE *fp;
 
@@ -147,21 +146,34 @@ BOOL PerformRegAction(REGEDIT_ACTION action, LPWSTR s, BOOL silent)
             if (!filename[0])
             {
                 InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, NULL, L"No file name is specified.");
-                InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, NULL, usage);
+                InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, szTitle, usage);
                 exit(4);
             }
 
-            LoadStringW(hInst, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle));
-
             while (filename[0])
             {
                 /* Request import confirmation */
                 if (!silent)
                 {
+                    int choice;
+
                     LoadStringW(hInst, IDS_IMPORT_PROMPT, szText, COUNT_OF(szText));
 
-                    if (InfoMessageBox(NULL, MB_YESNO | MB_ICONWARNING, szTitle, szText, filename) != IDYES)
-                        goto cont;
+                    choice = InfoMessageBox(NULL, MB_YESNOCANCEL | MB_ICONWARNING, szTitle, szText, filename);
+
+                    switch (choice)
+                    {
+                        case IDNO:
+                            goto cont;
+                        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. */
+                            return TRUE;
+                        default:
+                            break;
+                    }
                 }
 
                 /* Open the file */
@@ -203,7 +215,7 @@ cont:
             if (!reg_key_name[0])
             {
                 InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, NULL, L"No registry key is specified for removal.");
-                InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, NULL, usage);
+                InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, szTitle, usage);
                 exit(6);
             }
             delete_registry_key(reg_key_name);
@@ -219,7 +231,7 @@ cont:
             if (!filename[0])
             {
                 InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, NULL, L"No file name is specified.");
-                InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, NULL, usage);
+                InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, szTitle, usage);
                 exit(7);
             }
 
@@ -304,7 +316,7 @@ BOOL ProcessCmdLine(LPWSTR lpCmdLine)
                         action = ACTION_EXPORT;
                         break;
                     case L'?':
-                        InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, NULL, usage);
+                        InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, szTitle, usage);
                         exit(3);
                         break;
                     default: