reg: Prompt the user to overwrite the export file if it already exists.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Hugh McMaster 2017-12-03 06:50:15 +00:00 committed by Alexandre Julliard
parent 17494012a0
commit 49f384727b
52 changed files with 332 additions and 12 deletions

View File

@ -12546,6 +12546,12 @@ msgstr "REG QUERY اسم المفتاح [/v اسم القيمة | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "خطأ : اسم المفتاح غير سليم\n"
#: reg.rc:72
#, fuzzy
#| msgid "The specified file already exists. Do you want to replace it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "الملف المحدد موجود بالفعل ، هل ترغب باستبداله ؟"
#: regedit.rc:34
msgid "&Registry"
msgstr "ال&سجل"

View File

@ -12070,6 +12070,13 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr "Невалидни знаци в пътя.\n"
#: reg.rc:72
#, fuzzy
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
"Файлът вече съществува.\n"
"Искате ли да го замените?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Регистър"

View File

@ -12410,6 +12410,12 @@ msgstr "REG QUERY nom_de_clau [/v nom_de_valor | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "reg: Nom de clau invàlid\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "El valor de registre '%1' ja existeix. El voleu sobreescriure?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registre"

View File

@ -12194,6 +12194,12 @@ msgstr "REG QUERY název_klíče [/v název_hodnoty | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "Chyba: Neplatný název klíče\n"
#: reg.rc:72
#, fuzzy
#| msgid "The specified file already exists. Do you want to replace it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Soubor již existuje. Chcete jej nahradit?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registr"

View File

@ -12501,6 +12501,12 @@ msgstr "REG QUERY nøgle_navn [/v værdi | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "Fejl: Ugyldigt nøgle navn\n"
#: reg.rc:72
#, fuzzy
#| msgid "The specified file already exists. Do you want to replace it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Filen findes allerede. Vil du erstatte den?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Register"

View File

@ -12273,6 +12273,12 @@ msgstr "REG IMPORT datei.reg\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "regedit: Ungültiger Systemschlüssel [%1]\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Der Wert '%1' existiert bereits. Möchten Sie ihn ersetzen?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registrierung"

View File

@ -11835,6 +11835,13 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr "Μη έγγυρος(οι) χαρακτήρας(ες) στο μονοπάτι.\n"
#: reg.rc:72
#, fuzzy
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
"Το αρχείο υπάρχει ήδη.\n"
"Θέλετε να το αντικαταστήσετε;"
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12180,6 +12180,10 @@ msgstr "REG EXPORT key_name file.reg [/y]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "reg: Invalid system key [%1]\n"
#: reg.rc:72
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "The file '%1' already exists. Do you want to overwrite it?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registry"

View File

@ -12180,6 +12180,10 @@ msgstr "REG EXPORT key_name file.reg [/y]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "reg: Invalid system key [%1]\n"
#: reg.rc:72
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "The file '%1' already exists. Do you want to overwrite it?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registry"

View File

@ -11781,6 +11781,12 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr "Nevalida nomo de kunuzata aparato.\n"
#: reg.rc:72
#, fuzzy
#| msgid "The specified file already exists. Do you want to replace it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Dosiero estas jam ekzistanta. Ĉu vi volas anstataŭi ĝin?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registrejo"

View File

@ -12580,6 +12580,12 @@ msgstr "REG QUERY nombre_clave [/v nombre_valor | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "Error: nombre de clave inválido\n"
#: reg.rc:72
#, fuzzy
#| msgid "The specified file already exists. Do you want to replace it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "El archivo ya existe. ¿Desea reemplazarlo?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registro"

View File

@ -11819,6 +11819,14 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr ""
#: reg.rc:72
#, fuzzy
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
"پرونده‌ای با نام '%s' وجود ندارد.\n"
"\n"
"آیا می‌خواهید یک پرونده‌ی جدید ایجاد کنید؟"
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12174,6 +12174,12 @@ msgstr "REG IMPORT tiedosto.reg\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "regedit: Järjestelmäavain [%1] ei kelpaa\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Rekisterin arvo '%1' on jo olemassa. Haluatko korvata sen?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Rekisteri"

View File

@ -12453,6 +12453,12 @@ msgstr "REG QUERY nom_de_clé [/v nom_de_valeur | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "reg : nom de clé invalide\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "La valeur de registre « %1 » existe déjà. Voulez-vous la remplacer ?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registre"

View File

@ -12251,6 +12251,13 @@ msgstr "REG QUERY key_name [/v value_name | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "Error: Invalid key name\n"
#: reg.rc:72
#, fuzzy
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
"הקובץ כבר קיים.\n"
"האם ברצונך להחליף אותו?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&רישום המערכת"

View File

@ -11619,6 +11619,10 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr ""
#: reg.rc:72
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12011,6 +12011,12 @@ msgstr "REG QUERY ime_ključa [/v ime_vrijednosti | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "Greška: Neispravan naziv ključa\n"
#: reg.rc:72
#, fuzzy
#| msgid "The specified file already exists. Do you want to replace it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Odabrana datoteka već postoji. Želite li je zamijeniti?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registar"

View File

@ -12495,6 +12495,12 @@ msgstr "REG QUERY kulcs_név [/v érték_név | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "Hiba: Érvénytelen kulcsnév\n"
#: reg.rc:72
#, fuzzy
#| msgid "The specified file already exists. Do you want to replace it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "A fájl már létezik. Lecseréli a fájlt?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Fájl"

View File

@ -12581,6 +12581,12 @@ msgstr "REG QUERY nome_della_chiave [/v nome_del_valore | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "Errore: nome della chiave non valido\n"
#: reg.rc:72
#, fuzzy
#| msgid "The specified file already exists. Do you want to replace it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Il file specificato esiste già. Vuoi sostituirlo?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registro"

View File

@ -12210,6 +12210,12 @@ msgstr "REG IMPORT ファイル.reg\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "regedit: システム キーが無効です [%1]\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "レジストリ値 '%1' はすでに存在します。上書きしますか?"
#: regedit.rc:34
msgid "&Registry"
msgstr "レジストリ(&R)"

View File

@ -12571,6 +12571,12 @@ msgstr "REG QUERY 키 이름 [/v 값| /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "오류: 올바르지 않은 키 이름\n"
#: reg.rc:72
#, fuzzy
#| msgid "The specified file already exists. Do you want to replace it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "지정된 파일은 이미 존재합니다.덮어 쓰시겠습니까?"
#: regedit.rc:34
msgid "&Registry"
msgstr "레지스트리(&R)"

View File

@ -12197,6 +12197,12 @@ msgstr "REG IMPORT failas.reg\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "regedit: Netinkamas sisteminis raktas [%1]\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Registro reikšmė „%1“ jau egzistuoja. Ar norite ją perrašyti?"
#: regedit.rc:34
msgid "&Registry"
msgstr "R&egistras"

View File

@ -11619,6 +11619,10 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr ""
#: reg.rc:72
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12227,6 +12227,12 @@ msgstr "REG QUERY nøkkelnavn [/v verdi | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "regedit: Ugyldig systemnøkkel [%1]\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Registerverdien \"%1\" finnes fra før. Vil du erstatte den?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Register"

View File

@ -12506,6 +12506,12 @@ msgstr "REG QUERY sleutel_naam [/v waarde_naam | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "Fout: Foutieve sleutelnaam\n"
#: reg.rc:72
#, fuzzy
#| msgid "The specified file already exists. Do you want to replace it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Het gespecifeerde bestand bestaat reeds. Wilt u het vervangen?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registerbestand"

View File

@ -11619,6 +11619,10 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr ""
#: reg.rc:72
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -11619,6 +11619,10 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr ""
#: reg.rc:72
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12275,6 +12275,12 @@ msgstr "REG QUERY nazwa_klucza [/v nazwa_wartości | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "regedit: Nieprawidłowy klucz systemowy [%1]\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Wartość rejestru '%1' już istnieje. Czy chesz ją zastąpić?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Rejestr"

View File

@ -12371,6 +12371,12 @@ msgstr "REG QUERY nome_chave [/v nome_valor | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "reg: Nome de chave inválido\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "O valor do registro '%1' já existe. Deseja sobrescrevê-lo?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registro"

View File

@ -12372,6 +12372,12 @@ msgstr "REG QUERY nome_chave [/v nome_valor | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "Erro: Nome de chave inválido\n"
#: reg.rc:72
#, fuzzy
#| msgid "The specified file already exists. Do you want to replace it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "O ficheiro especificado já existe. Deseja substituí-lo?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registo"

View File

@ -11704,6 +11704,10 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr ""
#: reg.rc:72
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12306,6 +12306,12 @@ msgstr "REG QUERY nume_cheie [/v nume_valoare | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "reg: Nume de cheie nevalid\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Valoare de registru „%1” există deja. Doriți să o înlocuiți?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registru"

View File

@ -12195,6 +12195,12 @@ msgstr "REG IMPORT file.reg\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "regedit: неверный системный ключ [%1]\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Значение «%1» уже существует. Вы хотите заменить его?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Реестр"

View File

@ -11944,6 +11944,16 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr "Nesprávny názov.\n"
#: reg.rc:72
#, fuzzy
#| msgid ""
#| "File already exists.\n"
#| "Do you want to replace it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
"Súbor už existuje.\n"
"Prajete si ho prepísať?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registry"

View File

@ -12524,6 +12524,12 @@ msgstr "REG QUERY ime_ključa [/v ime_vrednosti | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "Napaka: neveljavno ime ključa\n"
#: reg.rc:72
#, fuzzy
#| msgid "The specified file already exists. Do you want to replace it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Določena datoteka že obstaja. Ali jo želite zamenjati?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Register"

View File

@ -12326,6 +12326,13 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr "Неисправна синтакса.\n"
#: reg.rc:72
#, fuzzy
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
"Датотека већ постоји.\n"
"Желите ли да је замените?"
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12484,6 +12484,13 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr "Neispravna sintaksa.\n"
#: reg.rc:72
#, fuzzy
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
"Datoteka već postoji.\n"
"Želite li da je zamenite?"
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12196,6 +12196,12 @@ msgstr "REG QUERY nyckelnamn [/v värdenamn | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "reg: Ogiltigt nyckelnamn\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Värdet '%1' finns redan i registret. Vill du ersätta det?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Register"

View File

@ -11619,6 +11619,10 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr ""
#: reg.rc:72
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -11866,6 +11866,18 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr ""
#: reg.rc:72
#, fuzzy
#| msgid ""
#| "File '%s' does not exist.\n"
#| "\n"
#| "Do you want to create a new file?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
"ไม่พบแฟ้ม '%s' ที่ต้องการเปิด\n"
"\n"
"คุณต้องการสร้างใหม่ไม่?"
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12252,6 +12252,12 @@ msgstr "REG QUERY anahtar_adı [/v değer_adı | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "reg: Geçersiz anahtar adı\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Belirtilen '%1' kayıt defteri değeri zaten var. Üzerine yazılsın mı?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Kayıt Defteri"

View File

@ -12327,6 +12327,12 @@ msgstr "REG QUERY <ключ> [/v <параметр> | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "reg: невірне ім'я ключа\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "Значення реєстру '%1' вже існує. Ви хочете його замінити?"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Реєстр"

View File

@ -11770,6 +11770,10 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr ""
#: reg.rc:72
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -11546,6 +11546,10 @@ msgstr ""
msgid "reg: Invalid system key [%1]\n"
msgstr ""
#: reg.rc:72
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12013,6 +12013,12 @@ msgstr "REG IMPORT file.reg\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "regedit: 无效的键名 [%1]\n"
#: reg.rc:72
#, fuzzy
#| msgid "The registry value '%1' already exists. Do you want to overwrite it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "注册表值 '%1' 已经存在。您想要覆盖它吗?"
#: regedit.rc:34
msgid "&Registry"
msgstr "注册表(&R)"

View File

@ -12455,6 +12455,12 @@ msgstr "REG QUERY 索引鍵名稱 [/v 值名稱 | /ve] [/s]\n"
msgid "reg: Invalid system key [%1]\n"
msgstr "錯誤:無效的索引鍵名稱\n"
#: reg.rc:72
#, fuzzy
#| msgid "The specified file already exists. Do you want to replace it?"
msgid "The file '%1' already exists. Do you want to overwrite it?"
msgstr "檔案已經存在。您要取代嗎?"
#: regedit.rc:34
msgid "&Registry"
msgstr "註冊表(&R)"

View File

@ -17,6 +17,7 @@
*/
#include <windows.h>
#include <stdlib.h>
#include <wine/unicode.h>
#include <wine/debug.h>
@ -25,6 +26,44 @@
WINE_DEFAULT_DEBUG_CHANNEL(reg);
static HANDLE create_file(const WCHAR *filename, DWORD action)
{
return CreateFileW(filename, GENERIC_WRITE, 0, NULL, action, FILE_ATTRIBUTE_NORMAL, NULL);
}
static HANDLE get_file_handle(WCHAR *filename, BOOL overwrite_file)
{
HANDLE hFile = create_file(filename, overwrite_file ? CREATE_ALWAYS : CREATE_NEW);
if (hFile == INVALID_HANDLE_VALUE)
{
DWORD error = GetLastError();
if (error == ERROR_FILE_EXISTS)
{
if (!ask_confirm(STRING_OVERWRITE_FILE, filename))
{
output_message(STRING_CANCELLED);
exit(0);
}
hFile = create_file(filename, CREATE_ALWAYS);
}
else
{
WCHAR *str;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, 0, (WCHAR *)&str, 0, NULL);
output_writeconsole(str, lstrlenW(str));
LocalFree(str);
exit(1);
}
}
return hFile;
}
static BOOL is_overwrite_switch(const WCHAR *s)
{
if (strlenW(s) > 2)
@ -40,6 +79,8 @@ int reg_export(int argc, WCHAR *argv[])
{
HKEY root, hkey;
WCHAR *path, *long_key;
BOOL overwrite_file = FALSE;
HANDLE hFile;
if (argc == 3 || argc > 5)
goto error;
@ -47,7 +88,7 @@ int reg_export(int argc, WCHAR *argv[])
if (!parse_registry_key(argv[2], &root, &path, &long_key))
return 1;
if (argc == 5 && !is_overwrite_switch(argv[4]))
if (argc == 5 && !(overwrite_file = is_overwrite_switch(argv[4])))
goto error;
if (RegOpenKeyExW(root, path, 0, KEY_READ, &hkey))
@ -56,7 +97,9 @@ int reg_export(int argc, WCHAR *argv[])
return 1;
}
hFile = get_file_handle(argv[3], overwrite_file);
FIXME(": operation not yet implemented\n");
CloseHandle(hFile);
RegCloseKey(hkey);

View File

@ -111,7 +111,7 @@ BOOL heap_free(void *buf)
return HeapFree(GetProcessHeap(), 0, buf);
}
static void output_writeconsole(const WCHAR *str, DWORD wlen)
void output_writeconsole(const WCHAR *str, DWORD wlen)
{
DWORD count, ret;
@ -176,7 +176,7 @@ static void WINAPIV output_string(const WCHAR *fmt, ...)
}
/* ask_confirm() adapted from programs/cmd/builtins.c */
static BOOL ask_confirm(unsigned int msgid, WCHAR *reg_info)
BOOL ask_confirm(unsigned int msgid, WCHAR *reg_info)
{
HMODULE hmod;
WCHAR Ybuffer[4];

View File

@ -27,7 +27,9 @@
void *heap_xalloc(size_t size);
void *heap_xrealloc(void *buf, size_t size);
BOOL heap_free(void *buf);
void output_writeconsole(const WCHAR *str, DWORD wlen);
void WINAPIV output_message(unsigned int id, ...);
BOOL ask_confirm(unsigned int msgid, WCHAR *reg_info);
HKEY path_get_rootkey(const WCHAR *path);
BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long_key);

View File

@ -68,4 +68,5 @@ STRINGTABLE
STRING_ESCAPE_SEQUENCE, "reg: Unrecognized escape sequence [\\%1!c!]\n"
STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n"
STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n"
STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?"
}

View File

@ -58,3 +58,4 @@
#define STRING_ESCAPE_SEQUENCE 135
#define STRING_EXPORT_USAGE 136
#define STRING_INVALID_SYSTEM_KEY 137
#define STRING_OVERWRITE_FILE 138

View File

@ -4289,7 +4289,7 @@ static BOOL compare_export_(unsigned line, const char *filename, const char *exp
lok(!lstrcmpW(fbuf, wstr), "export data does not match expected data\n");
ret = DeleteFileA(filename);
todo_wine lok(ret, "DeleteFile failed: %u\n", GetLastError());
lok(ret, "DeleteFile failed: %u\n", GetLastError());
exit:
HeapFree(GetProcessHeap(), 0, fbuf);
@ -4442,7 +4442,7 @@ static void test_export(void)
else /* Windows XP (32-bit) and older */
win_skip("File overwrite flag [/y] not supported; skipping position tests\n");
todo_wine ok(compare_export("file.reg", empty_key_test, 0), "compare_export() failed\n");
ok(compare_export("file.reg", empty_key_test, TODO_REG_COMPARE), "compare_export() failed\n");
/* Test registry export with a simple data structure */
dword = 0x100;
@ -4451,7 +4451,7 @@ static void test_export(void)
run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine ok(compare_export("file.reg", simple_test, 0), "compare_export() failed\n");
ok(compare_export("file.reg", simple_test, TODO_REG_COMPARE), "compare_export() failed\n");
/* Test registry export with a complex data structure */
add_key(hkey, "Subkey1", &subkey);
@ -4489,7 +4489,7 @@ static void test_export(void)
run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine ok(compare_export("file.reg", complex_test, 0), "compare_export() failed\n");
ok(compare_export("file.reg", complex_test, TODO_REG_COMPARE), "compare_export() failed\n");
err = delete_tree(HKEY_CURRENT_USER, KEY_BASE);
ok(err == ERROR_SUCCESS, "delete_tree() failed: %d\n", err);
@ -4503,7 +4503,7 @@ static void test_export(void)
run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine ok(compare_export("file.reg", key_order_test, 0), "compare_export() failed\n");
ok(compare_export("file.reg", key_order_test, TODO_REG_COMPARE), "compare_export() failed\n");
delete_key(hkey, "Subkey1");
delete_key(hkey, "Subkey2");
@ -4518,7 +4518,7 @@ static void test_export(void)
run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine ok(compare_export("file.reg", value_order_test, 0), "compare_export() failed\n");
ok(compare_export("file.reg", value_order_test, TODO_REG_COMPARE), "compare_export() failed\n");
delete_key(HKEY_CURRENT_USER, KEY_BASE);
@ -4536,7 +4536,7 @@ static void test_export(void)
run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine ok(compare_export("file.reg", empty_hex_test, 0), "compare_export() failed\n");
ok(compare_export("file.reg", empty_hex_test, TODO_REG_COMPARE), "compare_export() failed\n");
delete_key(HKEY_CURRENT_USER, KEY_BASE);
@ -4554,7 +4554,7 @@ static void test_export(void)
run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine ok(compare_export("file.reg", empty_hex_test2, 0), "compare_export() failed\n");
ok(compare_export("file.reg", empty_hex_test2, TODO_REG_COMPARE), "compare_export() failed\n");
delete_key(HKEY_CURRENT_USER, KEY_BASE);
@ -4573,7 +4573,7 @@ static void test_export(void)
run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine ok(compare_export("file.reg", hex_types_test, 0), "compare_export() failed\n");
ok(compare_export("file.reg", hex_types_test, TODO_REG_COMPARE), "compare_export() failed\n");
delete_key(HKEY_CURRENT_USER, KEY_BASE);
}