From 7114e59e630cd8e9f0742c1379fb3138b904a26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 5 Oct 2012 20:08:16 +0000 Subject: [PATCH] [REGEDIT] - Re-number some resource IDs. - Add key exportation message-box error (thus removing some fwprintf calls). - Use IDS_MY_COMPUTER localized string instead of hardcoded one. svn path=/trunk/; revision=57490 --- reactos/base/applications/regedit/childwnd.c | 3 +- reactos/base/applications/regedit/framewnd.c | 25 ++-- .../base/applications/regedit/lang/bg-BG.rc | 1 + .../base/applications/regedit/lang/cs-CZ.rc | 1 + .../base/applications/regedit/lang/de-DE.rc | 1 + .../base/applications/regedit/lang/el-GR.rc | 1 + .../base/applications/regedit/lang/en-US.rc | 1 + .../base/applications/regedit/lang/es-ES.rc | 1 + .../base/applications/regedit/lang/fr-FR.rc | 3 +- .../base/applications/regedit/lang/hu-HU.rc | 1 + .../base/applications/regedit/lang/id-ID.rc | 1 + .../base/applications/regedit/lang/it-IT.rc | 1 + .../base/applications/regedit/lang/ja-JP.rc | 1 + .../base/applications/regedit/lang/ko-KR.rc | 1 + .../base/applications/regedit/lang/nl-NL.rc | 1 + .../base/applications/regedit/lang/no-NO.rc | 1 + .../base/applications/regedit/lang/pl-PL.rc | 1 + .../base/applications/regedit/lang/pt-BR.rc | 1 + .../base/applications/regedit/lang/pt-PT.rc | 1 + .../base/applications/regedit/lang/ro-RO.rc | 1 + .../base/applications/regedit/lang/ru-RU.rc | 1 + .../base/applications/regedit/lang/sk-SK.rc | 1 + .../base/applications/regedit/lang/sl-SI.rc | 1 + .../base/applications/regedit/lang/sv-SE.rc | 1 + .../base/applications/regedit/lang/th-TH.rc | 1 + .../base/applications/regedit/lang/uk-UA.rc | 1 + .../base/applications/regedit/lang/zh-CN.rc | 1 + .../base/applications/regedit/lang/zh-TW.rc | 1 + reactos/base/applications/regedit/regedit.c | 53 +++---- reactos/base/applications/regedit/resource.h | 133 +++++++++--------- reactos/base/applications/regedit/settings.c | 9 +- reactos/base/applications/regedit/treeview.c | 17 ++- 32 files changed, 150 insertions(+), 118 deletions(-) diff --git a/reactos/base/applications/regedit/childwnd.c b/reactos/base/applications/regedit/childwnd.c index 182ce299c4c..168861a87f1 100644 --- a/reactos/base/applications/regedit/childwnd.c +++ b/reactos/base/applications/regedit/childwnd.c @@ -325,7 +325,8 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa WNDPROC oldproc; HFONT hFont; WCHAR buffer[MAX_PATH]; - /* load "My Computer" string */ + + /* Load "My Computer" string */ LoadStringW(hInst, IDS_MY_COMPUTER, buffer, COUNT_OF(buffer)); g_pChildWnd = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ChildWnd)); diff --git a/reactos/base/applications/regedit/framewnd.c b/reactos/base/applications/regedit/framewnd.c index 1f5023d5e76..5c47c94b7eb 100644 --- a/reactos/base/applications/regedit/framewnd.c +++ b/reactos/base/applications/regedit/framewnd.c @@ -85,8 +85,7 @@ static void OnInitMenu(HWND hWnd) } else { - while(RemoveMenu(hMenu, s_nFavoriteMenuSubPos, MF_BYPOSITION)) - ; + while(RemoveMenu(hMenu, s_nFavoriteMenuSubPos, MF_BYPOSITION)) ; } lResult = RegOpenKeyW(HKEY_CURRENT_USER, s_szFavoritesRegKey, &hKey); @@ -436,7 +435,7 @@ static BOOL ImportRegistryFile(HWND hWnd) { BOOL bRet = FALSE; OPENFILENAME ofn; - WCHAR Caption[128], szTitle[256], szText[256]; + WCHAR Caption[128], szTitle[512], szText[512]; HKEY hKeyRoot; LPCWSTR pszKeyPath; @@ -455,14 +454,15 @@ static BOOL ImportRegistryFile(HWND hWnd) wcsicmp(ofn.lpstrFile + ofn.nFileExtension, L"reg") == 0) /* REGEDIT4 or Windows Registry Editor Version 5.00 */ { /* Open the file */ - FILE *fp = _wfopen(ofn.lpstrFile, L"r"); + FILE* fp = _wfopen(ofn.lpstrFile, L"r"); /* Import it */ if (fp == NULL || !import_registry_file(fp)) { - LPSTR p = GetMultiByteString(ofn.lpstrFile); - fwprintf(stderr, L"Can't open file \"%s\"\n", p); - HeapFree(GetProcessHeap(), 0, p); + /* Error opening the file */ + LoadStringW(hInst, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle)); + LoadStringW(hInst, IDS_IMPORT_ERROR, szText, COUNT_OF(szText)); + InfoMessageBox(hWnd, MB_OK | MB_ICONERROR, szTitle, szText, ofn.lpstrFile); bRet = FALSE; } else @@ -470,7 +470,7 @@ static BOOL ImportRegistryFile(HWND hWnd) /* Show successful import */ LoadStringW(hInst, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle)); LoadStringW(hInst, IDS_IMPORT_OK, szText, COUNT_OF(szText)); - MessageBoxW(NULL, szText, szTitle, MB_OK); + InfoMessageBox(hWnd, MB_OK | MB_ICONINFORMATION, szTitle, szText, ofn.lpstrFile); bRet = TRUE; } @@ -582,7 +582,7 @@ BOOL ExportRegistryFile(HWND hWnd) BOOL bRet = FALSE; OPENFILENAME ofn; WCHAR ExportKeyPath[_MAX_PATH]; - WCHAR Caption[128]; + WCHAR Caption[128], szTitle[512], szText[512]; HKEY hKeyRoot; LPCWSTR pszKeyPath; @@ -664,9 +664,10 @@ BOOL ExportRegistryFile(HWND hWnd) (ofn.nFilterIndex == 3 ? REG_FORMAT_4 : REG_FORMAT_5))) { - LPSTR p = GetMultiByteString(ofn.lpstrFile); - fwprintf(stderr, L"Can't open file \"%s\"\n", p); - HeapFree(GetProcessHeap(), 0, p); + /* Error creating the file */ + LoadStringW(hInst, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle)); + LoadStringW(hInst, IDS_EXPORT_ERROR, szText, COUNT_OF(szText)); + InfoMessageBox(hWnd, MB_OK | MB_ICONERROR, szTitle, szText, ofn.lpstrFile); bRet = FALSE; } else diff --git a/reactos/base/applications/regedit/lang/bg-BG.rc b/reactos/base/applications/regedit/lang/bg-BG.rc index 98c5d7c2489..d893726afa1 100644 --- a/reactos/base/applications/regedit/lang/bg-BG.rc +++ b/reactos/base/applications/regedit/lang/bg-BG.rc @@ -452,6 +452,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/cs-CZ.rc b/reactos/base/applications/regedit/lang/cs-CZ.rc index 1502b3b4f43..3fe8dab3c2a 100644 --- a/reactos/base/applications/regedit/lang/cs-CZ.rc +++ b/reactos/base/applications/regedit/lang/cs-CZ.rc @@ -437,6 +437,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/de-DE.rc b/reactos/base/applications/regedit/lang/de-DE.rc index a486f2d075a..c718cf750e3 100644 --- a/reactos/base/applications/regedit/lang/de-DE.rc +++ b/reactos/base/applications/regedit/lang/de-DE.rc @@ -437,6 +437,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/el-GR.rc b/reactos/base/applications/regedit/lang/el-GR.rc index 713cc85a805..2a3b458dfd7 100644 --- a/reactos/base/applications/regedit/lang/el-GR.rc +++ b/reactos/base/applications/regedit/lang/el-GR.rc @@ -437,6 +437,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/en-US.rc b/reactos/base/applications/regedit/lang/en-US.rc index 4bd02ae4c65..14fef6bdb8c 100644 --- a/reactos/base/applications/regedit/lang/en-US.rc +++ b/reactos/base/applications/regedit/lang/en-US.rc @@ -437,6 +437,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/es-ES.rc b/reactos/base/applications/regedit/lang/es-ES.rc index 8731cd89942..f6028047e4d 100644 --- a/reactos/base/applications/regedit/lang/es-ES.rc +++ b/reactos/base/applications/regedit/lang/es-ES.rc @@ -440,6 +440,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/fr-FR.rc b/reactos/base/applications/regedit/lang/fr-FR.rc index 1ff182e5fc8..1e35d35d9dd 100644 --- a/reactos/base/applications/regedit/lang/fr-FR.rc +++ b/reactos/base/applications/regedit/lang/fr-FR.rc @@ -432,7 +432,8 @@ STRINGTABLE DISCARDABLE BEGIN IDS_IMPORT_PROMPT "L'ajout d'informations peut involontairement modifier ou supprimer des valeurs et endommager le fonctionnement de composants. Si vous n'êtes pas sûr de la source de ces informations dans '%1', ne les ajoutez pas au Registre.\n\nÊtes-vous sûr de vouloir continuer ?" IDS_IMPORT_OK "Les clés et valeurs contenues dans '%1' ont été correctement ajoutées au Registre." - IDS_IMPORT_ERROR "Impossible d’importer '%1' à la suite d’une erreur lors de la lecture de ce fichier. Il s’agit d’une erreur disque, ou le fichier est endommagé." + IDS_IMPORT_ERROR "Impossible d'importer '%1' à la suite d'une erreur lors de la lecture de ce fichier. Il s'agit d'une erreur disque, ou le fichier est endommagé." + IDS_EXPORT_ERROR "Impossible d'exporter dans le fichier '%1' à la suite d'une erreur lors de sa création ou d'une tentative d'écriture, pouvant être due à une erreur de disque ou de système de fichiers." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/hu-HU.rc b/reactos/base/applications/regedit/lang/hu-HU.rc index 9692831cec0..29392b8c7d8 100644 --- a/reactos/base/applications/regedit/lang/hu-HU.rc +++ b/reactos/base/applications/regedit/lang/hu-HU.rc @@ -438,6 +438,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/id-ID.rc b/reactos/base/applications/regedit/lang/id-ID.rc index 979ebf95c5b..0ef5808c5f5 100644 --- a/reactos/base/applications/regedit/lang/id-ID.rc +++ b/reactos/base/applications/regedit/lang/id-ID.rc @@ -436,6 +436,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/it-IT.rc b/reactos/base/applications/regedit/lang/it-IT.rc index d487d39d9ec..8306942784f 100644 --- a/reactos/base/applications/regedit/lang/it-IT.rc +++ b/reactos/base/applications/regedit/lang/it-IT.rc @@ -439,6 +439,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/ja-JP.rc b/reactos/base/applications/regedit/lang/ja-JP.rc index 9daa499ac61..62ab90d610d 100644 --- a/reactos/base/applications/regedit/lang/ja-JP.rc +++ b/reactos/base/applications/regedit/lang/ja-JP.rc @@ -437,6 +437,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/ko-KR.rc b/reactos/base/applications/regedit/lang/ko-KR.rc index 73e144c9d67..5d7b4315401 100644 --- a/reactos/base/applications/regedit/lang/ko-KR.rc +++ b/reactos/base/applications/regedit/lang/ko-KR.rc @@ -422,6 +422,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/nl-NL.rc b/reactos/base/applications/regedit/lang/nl-NL.rc index 20a11d65177..9e5ff8830f8 100644 --- a/reactos/base/applications/regedit/lang/nl-NL.rc +++ b/reactos/base/applications/regedit/lang/nl-NL.rc @@ -437,6 +437,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/no-NO.rc b/reactos/base/applications/regedit/lang/no-NO.rc index 3185da9c598..2fbd6912f8e 100644 --- a/reactos/base/applications/regedit/lang/no-NO.rc +++ b/reactos/base/applications/regedit/lang/no-NO.rc @@ -437,6 +437,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/pl-PL.rc b/reactos/base/applications/regedit/lang/pl-PL.rc index fe2785744c9..7f9f0a7d78c 100644 --- a/reactos/base/applications/regedit/lang/pl-PL.rc +++ b/reactos/base/applications/regedit/lang/pl-PL.rc @@ -444,6 +444,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/pt-BR.rc b/reactos/base/applications/regedit/lang/pt-BR.rc index 399117c0c6f..b463f465ddc 100644 --- a/reactos/base/applications/regedit/lang/pt-BR.rc +++ b/reactos/base/applications/regedit/lang/pt-BR.rc @@ -438,6 +438,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/pt-PT.rc b/reactos/base/applications/regedit/lang/pt-PT.rc index 93c7dff8519..116e7fc84d2 100644 --- a/reactos/base/applications/regedit/lang/pt-PT.rc +++ b/reactos/base/applications/regedit/lang/pt-PT.rc @@ -439,6 +439,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/ro-RO.rc b/reactos/base/applications/regedit/lang/ro-RO.rc index 6aade9a4417..ece2edc80c6 100644 --- a/reactos/base/applications/regedit/lang/ro-RO.rc +++ b/reactos/base/applications/regedit/lang/ro-RO.rc @@ -435,6 +435,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/ru-RU.rc b/reactos/base/applications/regedit/lang/ru-RU.rc index 0b349d9119d..9bf863e6b5f 100644 --- a/reactos/base/applications/regedit/lang/ru-RU.rc +++ b/reactos/base/applications/regedit/lang/ru-RU.rc @@ -434,6 +434,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/sk-SK.rc b/reactos/base/applications/regedit/lang/sk-SK.rc index d8741117a2d..1696945f582 100644 --- a/reactos/base/applications/regedit/lang/sk-SK.rc +++ b/reactos/base/applications/regedit/lang/sk-SK.rc @@ -422,6 +422,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/sl-SI.rc b/reactos/base/applications/regedit/lang/sl-SI.rc index fe389f2d140..8971413b47f 100644 --- a/reactos/base/applications/regedit/lang/sl-SI.rc +++ b/reactos/base/applications/regedit/lang/sl-SI.rc @@ -437,6 +437,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/sv-SE.rc b/reactos/base/applications/regedit/lang/sv-SE.rc index 369f4f1c021..c7a25154a1f 100644 --- a/reactos/base/applications/regedit/lang/sv-SE.rc +++ b/reactos/base/applications/regedit/lang/sv-SE.rc @@ -437,6 +437,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/th-TH.rc b/reactos/base/applications/regedit/lang/th-TH.rc index b54d6ceab4a..98318350136 100644 --- a/reactos/base/applications/regedit/lang/th-TH.rc +++ b/reactos/base/applications/regedit/lang/th-TH.rc @@ -437,6 +437,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/uk-UA.rc b/reactos/base/applications/regedit/lang/uk-UA.rc index 9298a09bf3d..a19c3170378 100644 --- a/reactos/base/applications/regedit/lang/uk-UA.rc +++ b/reactos/base/applications/regedit/lang/uk-UA.rc @@ -438,6 +438,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/zh-CN.rc b/reactos/base/applications/regedit/lang/zh-CN.rc index db64878f382..6f98991630d 100644 --- a/reactos/base/applications/regedit/lang/zh-CN.rc +++ b/reactos/base/applications/regedit/lang/zh-CN.rc @@ -437,6 +437,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/lang/zh-TW.rc b/reactos/base/applications/regedit/lang/zh-TW.rc index 6e3647d3b2c..d2edd7a9528 100644 --- a/reactos/base/applications/regedit/lang/zh-TW.rc +++ b/reactos/base/applications/regedit/lang/zh-TW.rc @@ -438,6 +438,7 @@ BEGIN 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_IMPORT_OK "The keys and values contained in '%1' have been successfully added to the registry." IDS_IMPORT_ERROR "Cannot import '%1': Error opening the file. There may be a disk, file system error or file may not exist." + IDS_EXPORT_ERROR "Cannot export '%1': Error creating or writing to the file. There may be a disk or file system error." END STRINGTABLE DISCARDABLE diff --git a/reactos/base/applications/regedit/regedit.c b/reactos/base/applications/regedit/regedit.c index 66ce69f1005..8d9ee80dee2 100644 --- a/reactos/base/applications/regedit/regedit.c +++ b/reactos/base/applications/regedit/regedit.c @@ -146,9 +146,8 @@ BOOL PerformRegAction(REGEDIT_ACTION action, LPWSTR s, BOOL silent) get_file_name(&s, filename); if (!filename[0]) { - fwprintf(stderr, L"%s: No file name is specified\n", getAppName()); - // fwprintf(stderr, usage); - MessageBoxW(NULL, usage, NULL, MB_OK | MB_ICONINFORMATION); + InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, NULL, L"No file name is specified."); + InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, NULL, usage); exit(4); } @@ -165,27 +164,12 @@ BOOL PerformRegAction(REGEDIT_ACTION action, LPWSTR s, BOOL silent) goto cont; } + /* Open the file */ fp = _wfopen(filename, L"r"); - if (fp != NULL) + + /* Import it */ + if (fp == NULL || !import_registry_file(fp)) { - import_registry_file(fp); - - /* Show successful import */ - if (!silent) - { - LoadStringW(hInst, IDS_IMPORT_OK, szText, COUNT_OF(szText)); - InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, szTitle, szText, filename); - } - - fclose(fp); - } - else - { - //LPSTR p = GetMultiByteString(filename); - //perror(""); - fwprintf(stderr, L"%s: Can't open file \"%s\"\n", getAppName(), filename /*p*/); - //HeapFree(GetProcessHeap(), 0, p); - /* Error opening the file */ if (!silent) { @@ -193,6 +177,18 @@ BOOL PerformRegAction(REGEDIT_ACTION action, LPWSTR s, BOOL silent) InfoMessageBox(NULL, MB_OK | MB_ICONERROR, szTitle, szText, filename); } } + else + { + /* Show successful import */ + if (!silent) + { + LoadStringW(hInst, IDS_IMPORT_OK, szText, COUNT_OF(szText)); + InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, szTitle, szText, filename); + } + } + + /* Close the file */ + if (fp) fclose(fp); cont: get_file_name(&s, filename); @@ -206,9 +202,8 @@ cont: get_file_name(&s, reg_key_name); if (!reg_key_name[0]) { - fwprintf(stderr, L"%s: No registry key is specified for removal\n", getAppName()); - // fwprintf(stderr, usage); - MessageBoxW(NULL, usage, NULL, MB_OK | MB_ICONINFORMATION); + InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, NULL, L"No registry key is specified for removal."); + InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, NULL, usage); exit(6); } delete_registry_key(reg_key_name); @@ -223,9 +218,8 @@ cont: get_file_name(&s, filename); if (!filename[0]) { - fwprintf(stderr, L"%s: No file name is specified\n", getAppName()); - // fwprintf(stderr, usage); - MessageBoxW(NULL, usage, NULL, MB_OK | MB_ICONINFORMATION); + InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, NULL, L"No file name is specified."); + InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, NULL, usage); exit(7); } @@ -310,8 +304,7 @@ BOOL ProcessCmdLine(LPWSTR lpCmdLine) action = ACTION_EXPORT; break; case L'?': - //fwprintf(stderr, usage); - MessageBoxW(NULL, usage, NULL, MB_OK | MB_ICONINFORMATION); + InfoMessageBox(NULL, MB_OK | MB_ICONINFORMATION, NULL, usage); exit(3); break; default: diff --git a/reactos/base/applications/regedit/resource.h b/reactos/base/applications/regedit/resource.h index 176711f1504..688ef509beb 100644 --- a/reactos/base/applications/regedit/resource.h +++ b/reactos/base/applications/regedit/resource.h @@ -167,79 +167,80 @@ #define IDS_FLT_ALLFILES 31007 #define IDS_FLT_ALLFILES_FLT 31008 -#define IDS_ACCESS_FULLCONTROL 31101 -#define IDS_ACCESS_READ 31102 -#define IDS_ACCESS_QUERYVALUE 31103 -#define IDS_ACCESS_SETVALUE 31104 -#define IDS_ACCESS_CREATESUBKEY 31105 -#define IDS_ACCESS_ENUMERATESUBKEYS 31106 -#define IDS_ACCESS_NOTIFY 31107 -#define IDS_ACCESS_CREATELINK 31108 -#define IDS_ACCESS_DELETE 31109 -#define IDS_ACCESS_WRITEDAC 31110 -#define IDS_ACCESS_WRITEOWNER 31111 -#define IDS_ACCESS_READCONTROL 31112 +#define IDS_ACCESS_FULLCONTROL 31100 +#define IDS_ACCESS_READ 31101 +#define IDS_ACCESS_QUERYVALUE 31102 +#define IDS_ACCESS_SETVALUE 31103 +#define IDS_ACCESS_CREATESUBKEY 31104 +#define IDS_ACCESS_ENUMERATESUBKEYS 31105 +#define IDS_ACCESS_NOTIFY 31106 +#define IDS_ACCESS_CREATELINK 31107 +#define IDS_ACCESS_DELETE 31108 +#define IDS_ACCESS_WRITEDAC 31109 +#define IDS_ACCESS_WRITEOWNER 31110 +#define IDS_ACCESS_READCONTROL 31111 -#define IDS_INHERIT_THISKEYONLY 31121 -#define IDS_INHERIT_THISKEYANDSUBKEYS 31122 -#define IDS_INHERIT_SUBKEYSONLY 31123 -#define IDS_EXPAND 31124 -#define IDS_COLLAPSE 31125 -#define IDS_NEW_KEY 31126 -#define IDS_NEW_VALUE 31127 -#define IDS_GOTO_SUGGESTED_KEY 31128 +#define IDS_INHERIT_THISKEYONLY 31200 +#define IDS_INHERIT_THISKEYANDSUBKEYS 31201 +#define IDS_INHERIT_SUBKEYSONLY 31202 +#define IDS_EXPAND 31203 +#define IDS_COLLAPSE 31204 +#define IDS_NEW_KEY 31205 +#define IDS_NEW_VALUE 31206 +#define IDS_GOTO_SUGGESTED_KEY 31207 -#define IDS_IMPORT_PROMPT 31129 -#define IDS_IMPORT_OK 31130 -#define IDS_IMPORT_ERROR 31131 +#define IDS_IMPORT_PROMPT 31300 +#define IDS_IMPORT_OK 31301 +#define IDS_IMPORT_ERROR 31302 +#define IDS_EXPORT_ERROR 31303 -#define IDS_FINISHEDFIND 31132 +#define IDS_FINISHEDFIND 31304 -#define IDS_BUSNUMBER 31133 -#define IDS_INTERFACE 31134 +#define IDS_BUSNUMBER 31400 +#define IDS_INTERFACE 31401 -#define IDS_DMA_CHANNEL 31135 -#define IDS_DMA_PORT 31136 -#define IDS_INTERRUPT_VECTOR 31137 -#define IDS_INTERRUPT_LEVEL 31138 -#define IDS_INTERRUPT_AFFINITY 31139 -#define IDS_INTERRUPT_TYPE 31140 -#define IDS_MEMORY_ADDRESS 31141 -#define IDS_MEMORY_LENGTH 31142 -#define IDS_MEMORY_ACCESS 31143 -#define IDS_PORT_ADDRESS 31144 -#define IDS_PORT_LENGTH 31145 -#define IDS_PORT_ACCESS 31146 -#define IDS_SPECIFIC_RESERVED1 31147 -#define IDS_SPECIFIC_RESERVED2 31148 -#define IDS_SPECIFIC_DATASIZE 31149 +#define IDS_DMA_CHANNEL 31500 +#define IDS_DMA_PORT 31501 +#define IDS_INTERRUPT_VECTOR 31502 +#define IDS_INTERRUPT_LEVEL 31503 +#define IDS_INTERRUPT_AFFINITY 31504 +#define IDS_INTERRUPT_TYPE 31505 +#define IDS_MEMORY_ADDRESS 31506 +#define IDS_MEMORY_LENGTH 31507 +#define IDS_MEMORY_ACCESS 31508 +#define IDS_PORT_ADDRESS 31509 +#define IDS_PORT_LENGTH 31510 +#define IDS_PORT_ACCESS 31511 +#define IDS_SPECIFIC_RESERVED1 31512 +#define IDS_SPECIFIC_RESERVED2 31513 +#define IDS_SPECIFIC_DATASIZE 31514 -#define IDS_PORT_PORT_IO 31150 -#define IDS_PORT_MEMORY_IO 31151 -#define IDS_INTERRUPT_EDGE_SENSITIVE 31152 -#define IDS_INTERRUPT_LEVEL_SENSITIVE 31153 -#define IDS_MEMORY_READ_ONLY 31154 -#define IDS_MEMORY_WRITE_ONLY 31155 -#define IDS_MEMORY_READ_WRITE 31156 +#define IDS_PORT_PORT_IO 31520 +#define IDS_PORT_MEMORY_IO 31521 +#define IDS_INTERRUPT_EDGE_SENSITIVE 31522 +#define IDS_INTERRUPT_LEVEL_SENSITIVE 31523 +#define IDS_MEMORY_READ_ONLY 31524 +#define IDS_MEMORY_WRITE_ONLY 31525 +#define IDS_MEMORY_READ_WRITE 31526 -#define IDS_BUS_UNDEFINED 31157 -#define IDS_BUS_INTERNAL 31158 -#define IDS_BUS_ISA 31159 -#define IDS_BUS_EISA 31160 -#define IDS_BUS_MICROCHANNEL 31161 -#define IDS_BUS_TURBOCHANNEL 31162 -#define IDS_BUS_PCIBUS 31163 -#define IDS_BUS_VMEBUS 31164 -#define IDS_BUS_NUBUS 31165 -#define IDS_BUS_PCMCIABUS 31166 -#define IDS_BUS_CBUS 31167 -#define IDS_BUS_MPIBUS 31168 -#define IDS_BUS_MPSABUS 31169 -#define IDS_BUS_PROCESSORINTERNAL 31170 -#define IDS_BUS_INTERNALPOWERBUS 31171 -#define IDS_BUS_PNPISABUS 31172 -#define IDS_BUS_PNPBUS 31173 -#define IDS_BUS_UNKNOWNTYPE 31174 +#define IDS_BUS_UNDEFINED 31530 +#define IDS_BUS_INTERNAL 31531 +#define IDS_BUS_ISA 31532 +#define IDS_BUS_EISA 31533 +#define IDS_BUS_MICROCHANNEL 31534 +#define IDS_BUS_TURBOCHANNEL 31535 +#define IDS_BUS_PCIBUS 31536 +#define IDS_BUS_VMEBUS 31537 +#define IDS_BUS_NUBUS 31538 +#define IDS_BUS_PCMCIABUS 31539 +#define IDS_BUS_CBUS 31540 +#define IDS_BUS_MPIBUS 31541 +#define IDS_BUS_MPSABUS 31542 +#define IDS_BUS_PROCESSORINTERNAL 31543 +#define IDS_BUS_INTERNALPOWERBUS 31544 +#define IDS_BUS_PNPISABUS 31545 +#define IDS_BUS_PNPBUS 31546 +#define IDS_BUS_UNKNOWNTYPE 31547 #define IDD_EDIT_STRING 2000 #define IDC_VALUE_NAME 2001 diff --git a/reactos/base/applications/regedit/settings.c b/reactos/base/applications/regedit/settings.c index 7c6612d21d8..1d562ac1bab 100644 --- a/reactos/base/applications/regedit/settings.c +++ b/reactos/base/applications/regedit/settings.c @@ -129,8 +129,13 @@ extern void SaveSettings(void) if (keyPath) { rootName = get_root_key_name(hRootKey); - _snwprintf(szBuffer, COUNT_OF(szBuffer), L"My Computer\\%s\\%s", rootName, keyPath); - RegSetValueExW(hKey, L"LastKey", 0, REG_SZ, (LPBYTE) szBuffer, (DWORD)wcslen(szBuffer) * sizeof(WCHAR)); + + /* Load "My Computer" string and complete it */ + LoadStringW(hInst, IDS_MY_COMPUTER, szBuffer, COUNT_OF(szBuffer)); + wcscat(szBuffer, L"\\"); wcscat(szBuffer, rootName); + wcscat(szBuffer, L"\\"); wcscat(szBuffer, keyPath); + + RegSetValueExW(hKey, L"LastKey", 0, REG_SZ, (LPBYTE)szBuffer, (DWORD)wcslen(szBuffer) * sizeof(WCHAR)); } /* Get statusbar settings */ diff --git a/reactos/base/applications/regedit/treeview.c b/reactos/base/applications/regedit/treeview.c index 3a5cbf8683a..e1c258a3791 100644 --- a/reactos/base/applications/regedit/treeview.c +++ b/reactos/base/applications/regedit/treeview.c @@ -601,9 +601,7 @@ BOOL CreateNewKey(HWND hwndTV, HTREEITEM hItem) } else if (!hNewKey) { - WCHAR sz[256]; - wsprintf(sz, L"Cannot create new key!\n\nError Code: %d", nResult); - MessageBoxW(hFrameWnd, sz, NULL, MB_ICONERROR); + InfoMessageBox(hFrameWnd, MB_OK | MB_ICONERROR, NULL, L"Cannot create new key!\n\nError Code: %d", nResult); goto done; } } @@ -668,9 +666,16 @@ BOOL SelectNode(HWND hwndTV, LPCWSTR keyPath) LPCWSTR s; TVITEM tvi; - /* Total no-good hack */ - if (!_wcsnicmp(keyPath, L"My Computer\\", 12)) - keyPath += 12; + /* Load "My Computer" string... */ + LoadStringW(hInst, IDS_MY_COMPUTER, szBuffer, COUNT_OF(szBuffer)); + wcscat(szBuffer, L"\\"); + + /* ... and remove it from the key path */ + if (!_wcsnicmp(keyPath, szBuffer, wcslen(szBuffer))) + keyPath += wcslen(szBuffer); + + /* Reinitialize szBuffer */ + szBuffer[0] = L'\0'; hRoot = TreeView_GetRoot(hwndTV); hItem = hRoot;