* 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"
{
case ACTION_ADD:
{
- WCHAR szTitle[512], szText[512];
+ WCHAR szText[512];
WCHAR filename[MAX_PATH];
FILE *fp;
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 */
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);
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);
}
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: