[REGEDIT] Add back import prompt message lost during Wine sync. CORE-18770

This commit is contained in:
Thomas Faber 2023-03-04 16:51:57 -05:00
parent 8b75dce45a
commit 910822b8f5
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -123,7 +123,11 @@ typedef enum {
ACTION_ADD, ACTION_EXPORT, ACTION_DELETE ACTION_ADD, ACTION_EXPORT, ACTION_DELETE
} REGEDIT_ACTION; } 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) static void PerformRegAction(REGEDIT_ACTION action, WCHAR **argv, int *i)
#endif
{ {
switch (action) { switch (action) {
case ACTION_ADD: { case ACTION_ADD: {
@ -131,6 +135,41 @@ static void PerformRegAction(REGEDIT_ACTION action, WCHAR **argv, int *i)
WCHAR *realname = NULL; WCHAR *realname = NULL;
FILE *reg_file; 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"-")) if (!lstrcmpW(filename, L"-"))
reg_file = stdin; reg_file = stdin;
else else
@ -190,6 +229,9 @@ BOOL ProcessCmdLine(WCHAR *cmdline)
WCHAR **argv; WCHAR **argv;
int argc, i; int argc, i;
REGEDIT_ACTION action = ACTION_ADD; REGEDIT_ACTION action = ACTION_ADD;
#ifdef __REACTOS__
BOOL silent = FALSE;
#endif
argv = CommandLineToArgvW(cmdline, &argc); argv = CommandLineToArgvW(cmdline, &argc);
@ -231,6 +273,10 @@ BOOL ProcessCmdLine(WCHAR *cmdline)
/* unhandled */; /* unhandled */;
break; break;
case 'S': case 'S':
#ifdef __REACTOS__
silent = TRUE;
break;
#endif
case 'V': case 'V':
/* ignored */; /* ignored */;
break; break;
@ -256,7 +302,11 @@ BOOL ProcessCmdLine(WCHAR *cmdline)
} }
for (; i < argc; i++) for (; i < argc; i++)
#ifdef __REACTOS__
PerformRegAction(action, argv, &i, silent);
#else
PerformRegAction(action, argv, &i); PerformRegAction(action, argv, &i);
#endif
LocalFree(argv); LocalFree(argv);