[PATCH 4/5] regedit: Abort processign and exit gracefully on error
Hugh McMaster
hugh.mcmaster at outlook.com
Mon Jul 10 06:28:45 CDT 2017
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
programs/regedit/regedit.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/programs/regedit/regedit.c b/programs/regedit/regedit.c
index bed0a7e928..07cf9bf4d8 100644
--- a/programs/regedit/regedit.c
+++ b/programs/regedit/regedit.c
@@ -87,7 +87,7 @@ typedef enum {
ACTION_ADD, ACTION_EXPORT, ACTION_DELETE
} REGEDIT_ACTION;
-static void PerformRegAction(REGEDIT_ACTION action, WCHAR **argv, int *i)
+static BOOL perform_reg_action(REGEDIT_ACTION action, WCHAR **argv, int *i)
{
switch (action) {
case ACTION_ADD: {
@@ -113,7 +113,7 @@ static void PerformRegAction(REGEDIT_ACTION action, WCHAR **argv, int *i)
{
output_message(STRING_FILE_NOT_FOUND, filename);
HeapFree(GetProcessHeap(), 0, realname);
- return;
+ return FALSE;
}
reg_file = _wfopen(realname, rb_mode);
if (reg_file == NULL)
@@ -122,7 +122,7 @@ static void PerformRegAction(REGEDIT_ACTION action, WCHAR **argv, int *i)
_wperror(regedit);
output_message(STRING_CANNOT_OPEN_FILE, filename);
HeapFree(GetProcessHeap(), 0, realname);
- return;
+ return FALSE;
}
}
import_registry_file(reg_file);
@@ -148,9 +148,9 @@ static void PerformRegAction(REGEDIT_ACTION action, WCHAR **argv, int *i)
}
default:
output_message(STRING_UNHANDLED_ACTION);
- exit(1);
- break;
+ return FALSE;
}
+ return TRUE;
}
BOOL ProcessCmdLine(WCHAR *cmdline)
@@ -227,7 +227,10 @@ BOOL ProcessCmdLine(WCHAR *cmdline)
}
for (; i < argc; i++)
- PerformRegAction(action, argv, &i);
+ {
+ if (!perform_reg_action(action, argv, &i))
+ break;
+ }
LocalFree(argv);
--
2.11.0
More information about the wine-patches
mailing list