reg: Parse key names and value names in the state machine.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2017-08-18 09:30:17 +00:00 committed by Alexandre Julliard
parent 3e87a70e82
commit 05659343c1
50 changed files with 801 additions and 400 deletions

View File

@ -12467,6 +12467,10 @@ msgstr "لم يتم تحديد أي أمر."
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "خطأ : تعذر إضافة المفاتيح للجهاز البعيد\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "ال&سجل"

View File

@ -12032,6 +12032,10 @@ msgstr "Файлът не е намерен.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Наистина ли искате да изтриете '%1'?"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&Регистър"

View File

@ -12329,6 +12329,12 @@ msgstr "regedit: No s'ha trobat el fitxer '%1'.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "regedit: No s'ha pogut obrir la clau de registre '%1'.\n"
#: reg.rc:69
#, fuzzy
#| msgid "regedit: Unrecognized escape sequence [\\%1!c!]\n"
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr "regedit: Seqüència d'escapada no reconeguda [\\%1!c!]\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registre"

View File

@ -12156,6 +12156,10 @@ msgstr "Nebyl zadán žádný příkaz."
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Chyba: Nepodařilo se přidat klíče na vzdálený stroj\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registr"

View File

@ -12422,6 +12422,10 @@ msgstr "Der blev ikke specificeret nogen kommando."
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Fejl: Kunne ikke tilføje nøgler til fjern maskinen\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&Register"

View File

@ -12227,6 +12227,12 @@ msgstr "regedit: Die Datei '%1' wurde nicht gefunden.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "regedit: Der Schlüssel '%1' konnte nicht geöffnet werden.\n"
#: reg.rc:69
#, fuzzy
#| msgid "regedit: Unrecognized escape sequence [\\%1!c!]\n"
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr "regedit: Unbekannte Escape-Sequenz [\\%1!c!]\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registrierung"

View File

@ -11801,6 +11801,10 @@ msgstr "Το αρχείο δε βρέθηκε.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr ""
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12136,6 +12136,10 @@ msgstr "reg: The file '%1' was not found.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "reg: Unable to open the registry key '%1'.\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr "reg: Unrecognized escape sequence [\\%1!c!]\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registry"

View File

@ -12136,6 +12136,10 @@ msgstr "reg: The file '%1' was not found.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "reg: Unable to open the registry key '%1'.\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr "reg: Unrecognized escape sequence [\\%1!c!]\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registry"

View File

@ -11745,6 +11745,10 @@ msgstr "Mi ne trovis la ĉenon %s"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Ĉu vi estas certa pri forigo de '%1'?"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registrejo"

View File

@ -12501,6 +12501,10 @@ msgstr "No se ha especificado un comando."
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Error: No se puede agregar claves al equipo remoto\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registro"

View File

@ -11786,6 +11786,10 @@ msgstr ""
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "پرونده‌های متنی (*.txt).\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12131,6 +12131,12 @@ msgstr "regedit: Tiedostoa '%1' ei löydy.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "regedit: Rekisteriavainta '%1' ei voida avata.\n"
#: reg.rc:69
#, fuzzy
#| msgid "regedit: Unrecognized escape sequence [\\%1!c!]\n"
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr "regedit: Tuntematon merkintä [\\%1!c!]\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Rekisteri"

View File

@ -12372,6 +12372,12 @@ msgstr "regedit : le fichier « %1 » est introuvable.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "regedit : impossible d'ouvrir la clé de registre « %1 ».\n"
#: reg.rc:69
#, fuzzy
#| msgid "regedit: Unrecognized escape sequence [\\%1!c!]\n"
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr "regedit : séquence d'échappement non reconnue [\\%1!c!]\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registre"

View File

@ -12213,6 +12213,10 @@ msgstr "מחרוזת החיפוש ׳%s׳ לא נמצאה"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Error: Unable to add keys to remote machine\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&רישום המערכת"

View File

@ -11587,6 +11587,10 @@ msgstr ""
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr ""
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -11973,6 +11973,10 @@ msgstr "Datoteka nije pronađena.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Datoteka se ne može otvoriti."
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registar"

View File

@ -12416,6 +12416,10 @@ msgstr "Nem volt parancs meghatározva."
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Hiba: nem lehet kulcsokat hozzáadni a távoli gépnél\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&Fájl"

View File

@ -12502,6 +12502,10 @@ msgstr "Non è stato specificato nessun comando."
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Errore: impossibile aggiungere chiavi alla macchina remota\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registro"

View File

@ -12143,6 +12143,12 @@ msgstr "regedit: ファイル '%1' が見つかりません。\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "regedit: レジストリ キー '%1' を開けません。\n"
#: reg.rc:69
#, fuzzy
#| msgid "regedit: Unrecognized escape sequence [\\%1!c!]\n"
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr "regedit: 認識できないエスケープ シーケンスです [%1!c!]\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "レジストリ(&R)"

View File

@ -12491,6 +12491,10 @@ msgstr "어떤 명령도 정의되지 않았습니다."
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "오류: 원격 머신에 키를 더하는 것은 가능하지 않습니다\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "레지스트리(&R)"

View File

@ -12154,6 +12154,12 @@ msgstr "regedit: Failas „%1“ nerastas.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "regedit: Nepavyko atverti registro rakto „%1“.\n"
#: reg.rc:69
#, fuzzy
#| msgid "regedit: Unrecognized escape sequence [\\%1!c!]\n"
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr "regedit: Neatpažinta kaitos seka [\\%1!c!]\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "R&egistras"

View File

@ -11587,6 +11587,10 @@ msgstr ""
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr ""
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12145,6 +12145,12 @@ msgstr "regedit: Filen \"%1\" ble ikke funnet.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "regedit: Kan ikke åpne registernøkkelen \"%1\".\n"
#: reg.rc:69
#, fuzzy
#| msgid "regedit: Unrecognized escape sequence [\\%1!c!]\n"
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr "regedit: Ukjent escape-sekvens [\\%1!c!]\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Register"

View File

@ -12468,6 +12468,10 @@ msgstr "Er was geen opdracht opgegeven."
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Fout: Sleutels konden niet toegevoegd worden aan de remote machine\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registerbestand"

View File

@ -11587,6 +11587,10 @@ msgstr ""
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr ""
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -11587,6 +11587,10 @@ msgstr ""
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr ""
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12202,6 +12202,12 @@ msgstr "regedit: Nie znaleziono pliku '%1'.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "regedit: Nie udało się otworzyć klucza rejestru '%1'.\n"
#: reg.rc:69
#, fuzzy
#| msgid "regedit: Unrecognized escape sequence [\\%1!c!]\n"
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr "regedit: Nierozpoznana sekwencja wyjściowa [\\%1!c!]\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Rejestr"

View File

@ -12290,6 +12290,12 @@ msgstr "regedit: O arquivo '%1' não foi encontrado.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "regedit: Não foi possível abrir a chave de registro '%1'.\n"
#: reg.rc:69
#, fuzzy
#| msgid "regedit: Unrecognized escape sequence [\\%1!c!]\n"
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr "regedit: Sequência de escape não reconhecida [\\%1!c!]\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registro"

View File

@ -12293,6 +12293,10 @@ msgstr "Nenhum comando indicado."
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Erro: Incapaz de adicionar chaves à máquina remota\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registo"

View File

@ -11672,6 +11672,10 @@ msgstr ""
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Tuot las datotecas (*.*).\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12227,6 +12227,10 @@ msgstr "regedit: Fișierul „%1” nu a fost găsit.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "regedit: Nu s-a putut deschide cheia de registru „%1”.\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registru"

View File

@ -12151,6 +12151,12 @@ msgstr "regedit: файл «%1» не найден.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "regedit: не удалось открыть ключ «%1».\n"
#: reg.rc:69
#, fuzzy
#| msgid "regedit: Unrecognized escape sequence [\\%1!c!]\n"
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr "regedit: неизвестная управляющая последовательность [\\%1!c!]\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Реестр"

View File

@ -11908,6 +11908,10 @@ msgstr "Nebol špecifikovaný žiadny príkaz."
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Chyba: Nemožno ukončiť proces \"%1\".\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&Registry"

View File

@ -12445,6 +12445,10 @@ msgstr "Ukaz ni bil naveden."
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Napaka: ni mogoče dodati ključa na oddaljen računalnik\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&Register"

View File

@ -12291,6 +12291,10 @@ msgstr "%s путања није пронађена"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Желите ли да избришете „%1“?"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12449,6 +12449,10 @@ msgstr "%s putanja nije pronađena"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Želite li da izbrišete „%1“?"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12117,6 +12117,10 @@ msgstr "Inget kommando angavs."
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "reg: Kan inte få tillgång till fjärrmaskin\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "&Register"

View File

@ -11587,6 +11587,10 @@ msgstr ""
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr ""
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -11833,6 +11833,10 @@ msgstr "ไม่พบแฟ้ม.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "แฟ้มตํารา (*.txt).\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -12169,6 +12169,14 @@ msgstr "regedit: '%1' dosyası bulunamadı.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "regedit: '%1' kayıt anahtarıılamıyor.\n"
#: reg.rc:69
#, fuzzy
#| msgid "regedit: Unrecognized escape sequence [\\%1!c!]\n"
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
"regedit: Bilinmeyen kaçış sırası [\\%1!c!]\n"
"\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Kayıt Defteri"

View File

@ -12246,6 +12246,12 @@ msgstr "regedit: Файл '%1' не знайдено.\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "regedit: Неможливо відкрити ключ '%1'.\n"
#: reg.rc:69
#, fuzzy
#| msgid "regedit: Unrecognized escape sequence [\\%1!c!]\n"
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr "regedit: Нерозпізнана послідовність [\\%1!c!]\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "&Реєстр"

View File

@ -11736,6 +11736,10 @@ msgstr ""
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "Fitchîs tekse (*.txt).\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -11514,6 +11514,10 @@ msgstr ""
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr ""
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr ""

View File

@ -11937,6 +11937,12 @@ msgstr "regedit: 找不到文件 '%1'。\n"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "regedit: 无法打开注册表键 '%1'。\n"
#: reg.rc:69
#, fuzzy
#| msgid "regedit: Unrecognized escape sequence [\\%1!c!]\n"
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr "regedit: 无法识别的转义序列 [\\%1!c!]\n"
#: regedit.rc:34
msgid "&Registry"
msgstr "注册表(&R)"

View File

@ -12376,6 +12376,10 @@ msgstr "沒有任何命令被指定。"
msgid "reg: Unable to open the registry key '%1'.\n"
msgstr "錯誤:無法加入索引鍵到遠端機器\n"
#: reg.rc:69
msgid "reg: Unrecognized escape sequence [\\%1!c!]\n"
msgstr ""
#: regedit.rc:34
msgid "&Registry"
msgstr "註冊表(&R)"

View File

@ -47,6 +47,11 @@ enum parser_state
{
HEADER, /* parsing the registry file version header */
PARSE_WIN31_LINE, /* parsing a Windows 3.1 registry line */
LINE_START, /* at the beginning of a registry line */
KEY_NAME, /* parsing a key name */
DEFAULT_VALUE_NAME, /* parsing a default value name */
QUOTED_VALUE_NAME, /* parsing a double-quoted value name */
DATA_START, /* preparing for data parsing operations */
SET_VALUE, /* adding a value to the registry */
NB_PARSER_STATES
};
@ -71,12 +76,22 @@ typedef WCHAR *(*parser_state_func)(struct parser *parser, WCHAR *pos);
/* parser state machine functions */
static WCHAR *header_state(struct parser *parser, WCHAR *pos);
static WCHAR *parse_win31_line_state(struct parser *parser, WCHAR *pos);
static WCHAR *line_start_state(struct parser *parser, WCHAR *pos);
static WCHAR *key_name_state(struct parser *parser, WCHAR *pos);
static WCHAR *default_value_name_state(struct parser *parser, WCHAR *pos);
static WCHAR *quoted_value_name_state(struct parser *parser, WCHAR *pos);
static WCHAR *data_start_state(struct parser *parser, WCHAR *pos);
static WCHAR *set_value_state(struct parser *parser, WCHAR *pos);
static const parser_state_func parser_funcs[NB_PARSER_STATES] =
{
header_state, /* HEADER */
parse_win31_line_state, /* PARSE_WIN31_LINE */
line_start_state, /* LINE_START */
key_name_state, /* KEY_NAME */
default_value_name_state, /* DEFAULT_VALUE_NAME */
quoted_value_name_state, /* QUOTED_VALUE_NAME */
data_start_state, /* DATA_START */
set_value_state, /* SET_VALUE */
};
@ -88,6 +103,59 @@ static inline enum parser_state set_state(struct parser *parser, enum parser_sta
return ret;
}
/******************************************************************************
* Replaces escape sequences with their character equivalents and
* null-terminates the string on the first non-escaped double quote.
*
* Assigns a pointer to the remaining unparsed data in the line.
* Returns TRUE or FALSE to indicate whether a closing double quote was found.
*/
static BOOL unescape_string(WCHAR *str, WCHAR **unparsed)
{
int str_idx = 0; /* current character under analysis */
int val_idx = 0; /* the last character of the unescaped string */
int len = lstrlenW(str);
BOOL ret;
for (str_idx = 0; str_idx < len; str_idx++, val_idx++)
{
if (str[str_idx] == '\\')
{
str_idx++;
switch (str[str_idx])
{
case 'n':
str[val_idx] = '\n';
break;
case 'r':
str[val_idx] = '\r';
break;
case '0':
str[val_idx] = '\0';
break;
case '\\':
case '"':
str[val_idx] = str[str_idx];
break;
default:
if (!str[str_idx]) return FALSE;
output_message(STRING_ESCAPE_SEQUENCE, str[str_idx]);
str[val_idx] = str[str_idx];
break;
}
}
else if (str[str_idx] == '"')
break;
else
str[val_idx] = str[str_idx];
}
ret = (str[str_idx] == '"');
*unparsed = str + str_idx + 1;
str[val_idx] = '\0';
return ret;
}
static HKEY parse_key_name(WCHAR *key_name, WCHAR **key_path)
{
if (!key_name) return 0;
@ -206,6 +274,8 @@ static WCHAR *header_state(struct parser *parser, WCHAR *pos)
break;
case REG_VERSION_40:
case REG_VERSION_50:
set_state(parser, LINE_START);
break;
default:
get_line(NULL); /* Reset static variables */
return NULL;
@ -253,6 +323,120 @@ static WCHAR *parse_win31_line_state(struct parser *parser, WCHAR *pos)
return value;
}
/* handler for parser LINE_START state */
static WCHAR *line_start_state(struct parser *parser, WCHAR *pos)
{
WCHAR *line, *p;
if (!(line = get_line(parser->file)))
return NULL;
for (p = line; *p; p++)
{
switch (*p)
{
case '[':
set_state(parser, KEY_NAME);
return p + 1;
case '@':
set_state(parser, DEFAULT_VALUE_NAME);
return p;
case '"':
set_state(parser, QUOTED_VALUE_NAME);
return p + 1;
case ' ':
case '\t':
break;
default:
return p;
}
}
return p;
}
/* handler for parser KEY_NAME state */
static WCHAR *key_name_state(struct parser *parser, WCHAR *pos)
{
WCHAR *p = pos, *key_end;
if (*p == ' ' || *p == '\t' || !(key_end = strrchrW(p, ']')))
goto done;
*key_end = 0;
if (*p == '-')
{
FIXME("key deletion not yet implemented\n");
goto done;
}
else if (open_key(parser, p) != ERROR_SUCCESS)
output_message(STRING_OPEN_KEY_FAILED, p);
done:
set_state(parser, LINE_START);
return p;
}
/* handler for parser DEFAULT_VALUE_NAME state */
static WCHAR *default_value_name_state(struct parser *parser, WCHAR *pos)
{
heap_free(parser->value_name);
parser->value_name = NULL;
set_state(parser, DATA_START);
return pos + 1;
}
/* handler for parser QUOTED_VALUE_NAME state */
static WCHAR *quoted_value_name_state(struct parser *parser, WCHAR *pos)
{
WCHAR *val_name = pos, *p;
if (parser->value_name)
{
heap_free(parser->value_name);
parser->value_name = NULL;
}
if (!unescape_string(val_name, &p))
goto invalid;
/* copy the value name in case we need to parse multiple lines and the buffer is overwritten */
parser->value_name = heap_xalloc((lstrlenW(val_name) + 1) * sizeof(WCHAR));
lstrcpyW(parser->value_name, val_name);
set_state(parser, DATA_START);
return p;
invalid:
set_state(parser, LINE_START);
return val_name;
}
/* handler for parser DATA_START state */
static WCHAR *data_start_state(struct parser *parser, WCHAR *pos)
{
WCHAR *p = pos;
unsigned int len;
while (*p == ' ' || *p == '\t') p++;
if (*p != '=') goto invalid;
p++;
while (*p == ' ' || *p == '\t') p++;
/* trim trailing whitespace */
len = strlenW(p);
while (len > 0 && (p[len - 1] == ' ' || p[len - 1] == '\t')) len--;
p[len] = 0;
/* FIXME: data parsing not yet implemented */
invalid:
set_state(parser, LINE_START);
return p;
}
/* handler for parser SET_VALUE state */
static WCHAR *set_value_state(struct parser *parser, WCHAR *pos)
{
@ -406,6 +590,7 @@ int reg_import(const WCHAR *filename)
parser.reg_version = -1;
parser.hkey = NULL;
parser.key_name = NULL;
parser.value_name = NULL;
parser.data_type = 0;
parser.data = NULL;
parser.data_size = 0;
@ -422,9 +607,11 @@ int reg_import(const WCHAR *filename)
else if (parser.reg_version == REG_VERSION_40 || parser.reg_version == REG_VERSION_50)
{
FIXME(": operation not yet implemented\n");
heap_free(parser.value_name);
goto error;
}
heap_free(parser.value_name);
close_key(&parser);
fclose(fp);

View File

@ -65,4 +65,5 @@ STRINGTABLE
STRING_IMPORT_USAGE, "REG IMPORT file.reg\n"
STRING_FILE_NOT_FOUND, "reg: The file '%1' was not found.\n"
STRING_OPEN_KEY_FAILED, "reg: Unable to open the registry key '%1'.\n"
STRING_ESCAPE_SEQUENCE, "reg: Unrecognized escape sequence [\\%1!c!]\n"
}

View File

@ -55,3 +55,4 @@
#define STRING_IMPORT_USAGE 132
#define STRING_FILE_NOT_FOUND 133
#define STRING_OPEN_KEY_FAILED 134
#define STRING_ESCAPE_SEQUENCE 135

File diff suppressed because it is too large Load Diff