Index: base/applications/regedit/lang/bg-BG.rc =================================================================== --- base/applications/regedit/lang/bg-BG.rc (revision 55567) +++ base/applications/regedit/lang/bg-BG.rc (working copy) @@ -445,8 +445,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Да бъдат ли добавени данните в регистъра?" - IDS_IMPORTED_OK "Сведенията са добавени в регистъра" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/cs-CZ.rc =================================================================== --- base/applications/regedit/lang/cs-CZ.rc (revision 55567) +++ base/applications/regedit/lang/cs-CZ.rc (working copy) @@ -430,8 +430,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Přidat data do registru?" - IDS_IMPORTED_OK "Data přidána do registru." + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/de-DE.rc =================================================================== --- base/applications/regedit/lang/de-DE.rc (revision 55567) +++ base/applications/regedit/lang/de-DE.rc (working copy) @@ -430,8 +430,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/el-GR.rc =================================================================== --- base/applications/regedit/lang/el-GR.rc (revision 55567) +++ base/applications/regedit/lang/el-GR.rc (working copy) @@ -430,8 +430,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/en-US.rc =================================================================== --- base/applications/regedit/lang/en-US.rc (revision 55567) +++ base/applications/regedit/lang/en-US.rc (working copy) @@ -430,8 +430,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/es-ES.rc =================================================================== --- base/applications/regedit/lang/es-ES.rc (revision 55567) +++ base/applications/regedit/lang/es-ES.rc (working copy) @@ -433,8 +433,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Agregar los datos al registro?" - IDS_IMPORTED_OK "La información ha sido agregada al registro" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/fr-FR.rc =================================================================== --- base/applications/regedit/lang/fr-FR.rc (revision 55567) +++ base/applications/regedit/lang/fr-FR.rc (working copy) @@ -433,8 +433,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/hu-HU.rc =================================================================== --- base/applications/regedit/lang/hu-HU.rc (revision 55567) +++ base/applications/regedit/lang/hu-HU.rc (working copy) @@ -431,8 +431,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/id-ID.rc =================================================================== --- base/applications/regedit/lang/id-ID.rc (revision 55567) +++ base/applications/regedit/lang/id-ID.rc (working copy) @@ -430,8 +430,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/it-IT.rc =================================================================== --- base/applications/regedit/lang/it-IT.rc (revision 55567) +++ base/applications/regedit/lang/it-IT.rc (working copy) @@ -433,8 +433,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Aggiungere l'informazione al registro?" - IDS_IMPORTED_OK "L'informazione è stata aggiunta al registro" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/ja-JP.rc =================================================================== --- base/applications/regedit/lang/ja-JP.rc (revision 55567) +++ base/applications/regedit/lang/ja-JP.rc (working copy) @@ -430,8 +430,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/ko-KR.rc =================================================================== --- base/applications/regedit/lang/ko-KR.rc (revision 55567) +++ base/applications/regedit/lang/ko-KR.rc (working copy) @@ -415,8 +415,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/nl-NL.rc =================================================================== --- base/applications/regedit/lang/nl-NL.rc (revision 55567) +++ base/applications/regedit/lang/nl-NL.rc (working copy) @@ -430,8 +430,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/no-NO.rc =================================================================== --- base/applications/regedit/lang/no-NO.rc (revision 55567) +++ base/applications/regedit/lang/no-NO.rc (working copy) @@ -430,8 +430,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/pl-PL.rc =================================================================== --- base/applications/regedit/lang/pl-PL.rc (revision 55567) +++ base/applications/regedit/lang/pl-PL.rc (working copy) @@ -437,8 +437,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Czy dodać dane do rejestru?" - IDS_IMPORTED_OK "Dane dopisane do rejestru" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/pt-BR.rc =================================================================== --- base/applications/regedit/lang/pt-BR.rc (revision 55567) +++ base/applications/regedit/lang/pt-BR.rc (working copy) @@ -431,8 +431,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/pt-PT.rc =================================================================== --- base/applications/regedit/lang/pt-PT.rc (revision 55567) +++ base/applications/regedit/lang/pt-PT.rc (working copy) @@ -432,8 +432,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/ro-RO.rc =================================================================== --- base/applications/regedit/lang/ro-RO.rc (revision 55567) +++ base/applications/regedit/lang/ro-RO.rc (working copy) @@ -428,8 +428,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Adăugați data în registru?" - IDS_IMPORTED_OK "Informația adăugată în registru" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/ru-RU.rc =================================================================== --- base/applications/regedit/lang/ru-RU.rc (revision 55567) +++ base/applications/regedit/lang/ru-RU.rc (working copy) @@ -427,8 +427,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Добавить данные в реестр?" - IDS_IMPORTED_OK "Информация добавлена в реестр" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/sk-SK.rc =================================================================== --- base/applications/regedit/lang/sk-SK.rc (revision 55567) +++ base/applications/regedit/lang/sk-SK.rc (working copy) @@ -415,8 +415,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/sl-SI.rc =================================================================== --- base/applications/regedit/lang/sl-SI.rc (revision 55567) +++ base/applications/regedit/lang/sl-SI.rc (working copy) @@ -430,8 +430,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/sv-SE.rc =================================================================== --- base/applications/regedit/lang/sv-SE.rc (revision 55567) +++ base/applications/regedit/lang/sv-SE.rc (working copy) @@ -430,8 +430,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/th-TH.rc =================================================================== --- base/applications/regedit/lang/th-TH.rc (revision 55567) +++ base/applications/regedit/lang/th-TH.rc (working copy) @@ -430,8 +430,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Add the data to the registry?" - IDS_IMPORTED_OK "Information added to the registry" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/uk-UA.rc =================================================================== --- base/applications/regedit/lang/uk-UA.rc (revision 55567) +++ base/applications/regedit/lang/uk-UA.rc (working copy) @@ -431,8 +431,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "Додати дані до реєстру?" - IDS_IMPORTED_OK "Інформація була додана до реєстру" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/zh-CN.rc =================================================================== --- base/applications/regedit/lang/zh-CN.rc (revision 55567) +++ base/applications/regedit/lang/zh-CN.rc (working copy) @@ -430,8 +430,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "增加资料到注册表?" - IDS_IMPORTED_OK "资料已被加到注册表" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/lang/zh-TW.rc =================================================================== --- base/applications/regedit/lang/zh-TW.rc (revision 55567) +++ base/applications/regedit/lang/zh-TW.rc (working copy) @@ -431,8 +431,9 @@ STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT "新增資料至登錄?" - IDS_IMPORTED_OK "資料已被新增至登錄" + IDS_IMPORTED_OK "The keys and values contained in '%1' have been successfully added to the registry." + IDS_IMPORT_PROMPT "Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in '%1', do not add it to registry.\n\nAre you sure you want to continue?" + IDS_ERROR_OPENING "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." END STRINGTABLE DISCARDABLE Index: base/applications/regedit/regedit.c =================================================================== --- base/applications/regedit/regedit.c (revision 55567) +++ base/applications/regedit/regedit.c (working copy) @@ -1,57 +1,59 @@ /* - * Windows regedit.exe registry editor implementation. - * - * Copyright 2002 Andriy Palamarchuk - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ +* Windows regedit.exe registry editor implementation. +* +* Copyright 2002 Andriy Palamarchuk +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include static const char *usage = - "Usage:\n" - " regedit filename\n" - " regedit /E filename [regpath]\n" - " regedit /D regpath\n" - "\n" - "filename - registry file name\n" - "regpath - name of the registry key\n" - "\n" - "When is called without any switches adds contents of the specified\n" - "registry file to the registry\n" - "\n" - "Switches:\n" - " /E - exports contents of the specified registry key to the specified\n" - " file. Exports the whole registry if no key is specified.\n" - " /D - deletes specified registry key\n" - " /S - silent execution, can be used with any other switch.\n" - " The only existing mode, exists for compatibility with Windows regedit.\n" - " /V - advanced mode, can be used with any other switch.\n" - " Ignored, exists for compatibility with Windows regedit.\n" - " /L - location of system.dat file. Can be used with any other switch.\n" - " Ignored. Exists for compatibility with Windows regedit.\n" - " /R - location of user.dat file. Can be used with any other switch.\n" - " Ignored. Exists for compatibility with Windows regedit.\n" - " /? - print this help. Any other switches are ignored.\n" - " /C - create registry from. Not implemented.\n" - "\n" - "The switches are case-insensitive, can be prefixed either by '-' or '/'.\n" - "This program is command-line compatible with Microsoft Windows\n" - "regedit.\n"; +"Usage:\n" +" regedit filename\n" +" regedit /E filename [regpath]\n" +" regedit /D regpath\n" +"\n" +"filename - registry file name\n" +"regpath - name of the registry key\n" +"\n" +"When is called without any switches adds contents of the specified\n" +"registry file to the registry\n" +"\n" +"Switches:\n" +" /E - exports contents of the specified registry key to the specified\n" +" file. Exports the whole registry if no key is specified.\n" +" /D - deletes specified registry key\n" +" /S - silent execution, can be used with any other switch.\n" +" The only existing mode, exists for compatibility with Windows regedit.\n" +" /V - advanced mode, can be used with any other switch.\n" +" Ignored, exists for compatibility with Windows regedit.\n" +" /L - location of system.dat file. Can be used with any other switch.\n" +" Ignored. Exists for compatibility with Windows regedit.\n" +" /R - location of user.dat file. Can be used with any other switch.\n" +" Ignored. Exists for compatibility with Windows regedit.\n" +" /? - print this help. Any other switches are ignored.\n" +" /C - create registry from. Not implemented.\n" +"\n" +"The switches are case-insensitive, can be prefixed either by '-' or '/'.\n" +"This program is command-line compatible with Microsoft Windows\n" +"regedit.\n"; +BOOL bShowDialogs = TRUE; + typedef enum { ACTION_UNDEF, ACTION_ADD, ACTION_EXPORT, ACTION_DELETE @@ -64,72 +66,30 @@ } /****************************************************************************** - * Copies file name from command line string to the buffer. - * Rewinds the command line string pointer to the next non-space character - * after the file name. - * Buffer contains an empty string if no filename was found; - * - * params: - * command_line - command line current position pointer - * where *s[0] is the first symbol of the file name. - * file_name - buffer to write the file name to. - */ -void get_file_name(LPWSTR *command_line, LPWSTR file_name) +* Copies file name from command line string to the buffer. +* Buffer contains an empty string if no filename was found; +* +* params: +* file_name - buffer to write the file name to. +*/ +void get_file_name(LPWSTR file_name) { - WCHAR *s = *command_line; - int pos = 0; /* position of pointer "s" in *command_line */ file_name[0] = 0; + int nArgs; + LPWSTR *szArglist; - if (!s[0]) + szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs); + if( NULL == szArglist ) { + fprintf(stderr, "CommandLineToArgvW failed\n"); return; } - - if (s[0] == L'"') - { - s++; - (*command_line)++; - while(s[0] != L'"') - { - if (!s[0]) - { - fprintf(stderr, "%s: Unexpected end of file name!\n", getAppName()); - exit(1); - } - s++; - pos++; - } - } else - { - while(s[0] && !iswspace(s[0])) - { - s++; - pos++; - } - } - memcpy(file_name, *command_line, pos * sizeof((*command_line)[0])); - /* remove the last backslash */ - if (file_name[pos - 1] == L'\\') - { - file_name[pos - 1] = L'\0'; - } - else - { - file_name[pos] = L'\0'; - } + /* Last parameter is filename */ + _tcscpy(file_name, szArglist[nArgs-1]); - if (s[0]) - { - s++; - pos++; - } - while(s[0] && iswspace(s[0])) - { - s++; - pos++; - } - (*command_line) += pos; + // Free memory allocated for CommandLineToArgvW arguments. + LocalFree(szArglist); } BOOL PerformRegAction(REGEDIT_ACTION action, LPWSTR s) @@ -138,76 +98,102 @@ switch (action) { case ACTION_ADD: - { - WCHAR filename[MAX_PATH]; - FILE *fp; - - get_file_name(&s, filename); - if (!filename[0]) { - fprintf(stderr, "%s: No file name is specified\n", getAppName()); - fprintf(stderr, usage); - exit(4); - } + TCHAR filename[MAX_PATH]; + FILE *fp; - while(filename[0]) - { - fp = _wfopen(filename, L"r"); - if (fp == NULL) + get_file_name(filename); + if (!filename[0]) { - LPSTR p = GetMultiByteString(filename); - perror(""); - fprintf(stderr, "%s: Can't open file \"%s\"\n", getAppName(), p); - HeapFree(GetProcessHeap(), 0, p); - exit(5); + fprintf(stderr, "%s: No file name is specified\n", getAppName()); + fprintf(stderr, usage); + exit(4); } - import_registry_file(fp); - get_file_name(&s, filename); - LoadString(hInst, IDS_APP_TITLE, szTitle, sizeof(szTitle)); - LoadString(hInst, IDS_IMPORTED_OK, szText, sizeof(szTitle)); - /* show successful import */ - MessageBox(NULL, szText, szTitle, MB_OK); + + if(filename[0]) + { + fp = _tfopen(filename, TEXT("r")); + if (fp == NULL) + { + LPSTR p = GetMultiByteString(filename); + perror(""); + fprintf(stderr, "%s: Can't open file \"%s\"\n", getAppName(), p); + + if (bShowDialogs == TRUE) + { + LoadString(hInst, IDS_APP_TITLE, szTitle, sizeof(szTitle)); + LoadString(hInst, IDS_ERROR_OPENING, szText, sizeof(szTitle)); + + TCHAR szBuffer[MAX_PATH + 256]; + DWORD_PTR pArgs[] = { (DWORD_PTR)filename }; + + FormatMessage(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY, + szText, 0, 0, szBuffer, sizeof(szBuffer), (va_list*)pArgs); + + /* Error opening the file*/ + MessageBox(NULL, szBuffer, szTitle, MB_OK | MB_ICONERROR); + } + + HeapFree(GetProcessHeap(), 0, p); + exit(5); + } + import_registry_file(fp); + + if (bShowDialogs == TRUE) + { + LoadString(hInst, IDS_APP_TITLE, szTitle, sizeof(szTitle)); + LoadString(hInst, IDS_IMPORTED_OK, szText, sizeof(szTitle)); + + TCHAR szBuffer[MAX_PATH + 256]; + DWORD_PTR pArgs[] = { (DWORD_PTR)filename }; + + FormatMessage(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY, + szText, 0, 0, szBuffer, sizeof(szBuffer), (va_list*)pArgs); + + /* show successful import */ + MessageBox(NULL, szBuffer, szTitle, MB_OK | MB_ICONINFORMATION); + } + } + break; } - break; - } case ACTION_DELETE: - { - WCHAR reg_key_name[KEY_MAX_LEN]; - get_file_name(&s, reg_key_name); - if (!reg_key_name[0]) { - fprintf(stderr, "%s: No registry key is specified for removal\n", getAppName()); - fprintf(stderr, usage); - exit(6); + WCHAR reg_key_name[KEY_MAX_LEN]; + get_file_name(reg_key_name); + if (!reg_key_name[0]) + { + fprintf(stderr, "%s: No registry key is specified for removal\n", getAppName()); + fprintf(stderr, usage); + exit(6); + } + delete_registry_key(reg_key_name); + break; } - delete_registry_key(reg_key_name); - break; - } case ACTION_EXPORT: - { - WCHAR filename[MAX_PATH]; - - filename[0] = _T('\0'); - get_file_name(&s, filename); - if (!filename[0]) { - fprintf(stderr, "%s: No file name is specified\n", getAppName()); - fprintf(stderr, usage); - exit(7); - } + WCHAR filename[MAX_PATH]; - if (s[0]) - { - WCHAR reg_key_name[KEY_MAX_LEN]; - get_file_name(&s, reg_key_name); - export_registry_key(filename, reg_key_name, REG_FORMAT_4); + filename[0] = _T('\0'); + get_file_name(filename); + if (!filename[0]) + { + fprintf(stderr, "%s: No file name is specified\n", getAppName()); + fprintf(stderr, usage); + exit(7); + } + + if (s[0]) + { + WCHAR reg_key_name[KEY_MAX_LEN]; + get_file_name(reg_key_name); + export_registry_key(filename, reg_key_name, REG_FORMAT_4); + } + else + { + export_registry_key(filename, NULL, REG_FORMAT_4); + } + break; } - else - { - export_registry_key(filename, NULL, REG_FORMAT_4); - } - break; - } default: fprintf(stderr, "%s: Unhandled action!\n", getAppName()); exit(8); @@ -217,12 +203,12 @@ } /** - * Process unknown switch. - * - * Params: - * chu - the switch character in upper-case. - * s - the command line string where s points to the switch character. - */ +* Process unknown switch. +* +* Params: +* chu - the switch character in upper-case. +* s - the command line string where s points to the switch character. +*/ static void error_unknown_switch(WCHAR chu, LPWSTR s) { if (iswalpha(chu)) @@ -232,7 +218,7 @@ else { fprintf(stderr, "%s: Alphabetic character is expected after '%c' " - "in swit ch specification\n", getAppName(), *(s - 1)); + "in swit ch specification\n", getAppName(), *(s - 1)); } exit(1); } @@ -256,7 +242,8 @@ { if (chu == L'S' || chu == L'V') { - /* ignore these switches */ + /* silence dialogs */ + bShowDialogs = FALSE; } else { @@ -316,19 +303,31 @@ } if (*s && action == ACTION_UNDEF) - { - TCHAR szTitle[256], szText[256]; - LoadString(hInst, IDS_APP_TITLE, szTitle, sizeof(szTitle)); - LoadString(hInst, IDS_IMPORT_PROMPT, szText, sizeof(szTitle)); - /* request import confirmation */ - if (MessageBox(NULL, szText, szTitle, MB_YESNO) == IDYES) - { - action = ACTION_ADD; - } - else return TRUE; + { + if (bShowDialogs == TRUE) + { + TCHAR szTitle[256], szText[256], szFilePath[256]; + TCHAR szBuffer[MAX_PATH + 256]; + DWORD_PTR pArgs[] = { (DWORD_PTR)szFilePath }; + LoadString(hInst, IDS_APP_TITLE, szTitle, sizeof(szTitle)); + LoadString(hInst, IDS_IMPORT_PROMPT, szText, sizeof(szTitle)/sizeof(WCHAR)); + + szFilePath[0] = '\0'; + get_file_name(szFilePath); + + FormatMessage(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY, + szText, 0, 0, szBuffer, sizeof(szBuffer), (va_list*)pArgs); + if (MessageBox(NULL, szBuffer, szTitle, MB_YESNO | MB_ICONWARNING) == IDYES) + { + action = ACTION_ADD; + } + else return TRUE; } - if (action == ACTION_UNDEF) - return FALSE; + else + action = ACTION_ADD; + } + if (action == ACTION_UNDEF) + return FALSE; return PerformRegAction(action, s); } Index: base/applications/regedit/resource.h =================================================================== --- base/applications/regedit/resource.h (revision 55567) +++ base/applications/regedit/resource.h (working copy) @@ -235,6 +235,7 @@ #define IDS_BUS_PNPISABUS 31171 #define IDS_BUS_PNPBUS 31172 #define IDS_BUS_UNKNOWNTYPE 31173 +#define IDS_ERROR_OPENING 31174 #define IDD_EDIT_STRING 2000 #define IDC_VALUE_NAME 2001