Commit 6f485a36 authored by Alexandre Julliard's avatar Alexandre Julliard

atl: Support escaped quotes in registrar scripts.

parent 1e52895e
......@@ -118,6 +118,8 @@ static HRESULT get_word(LPCOLESTR *str, strbuf *buf)
if(*iter == '}' || *iter == '=') {
strbuf_write(iter++, buf, 1);
}else if(*iter == '\'') {
for (;;)
{
iter2 = ++iter;
iter = wcschr(iter, '\'');
if(!iter) {
......@@ -125,6 +127,10 @@ static HRESULT get_word(LPCOLESTR *str, strbuf *buf)
*str = iter;
return DISP_E_EXCEPTION;
}
if (iter[1] != '\'') break;
iter++;
strbuf_write(iter2, buf, iter-iter2);
}
strbuf_write(iter2, buf, iter-iter2);
iter++;
}else {
......
......@@ -42,7 +42,9 @@ static const char textA[] =
"{ \n"
" ForceRemove eebf73c4-50fd-478f-bbcf-db212221227a \n"
" { \n"
" val 'string' = s 'string' \n"
" val 'str1' = s 'string' \n"
" val 'str2' = s 'str\\\"ing' \n"
" val 'str3' = s 'str''ing' \n"
" val 'dword_quoted_dec' = d '1' \n"
" val 'dword_unquoted_dec' = d 1 \n"
" val 'dword_quoted_hex' = d '0xA' \n"
......@@ -81,6 +83,7 @@ static void test_registrar(void)
LONG lret;
HKEY key;
BYTE bytes[4];
char buffer[16];
MultiByteToWideChar(CP_ACP, 0, textA, -1, textW, count);
hr = IRegistrar_StringRegister(registrar, textW);
......@@ -94,6 +97,21 @@ static void test_registrar(void)
lret = RegOpenKeyA(HKEY_CURRENT_USER, "eebf73c4-50fd-478f-bbcf-db212221227a", &key);
ok(lret == ERROR_SUCCESS, "error %ld opening registry key\n", lret);
size = sizeof(buffer);
lret = RegQueryValueExA(key, "str1", NULL, NULL, (BYTE*)buffer, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %ld\n", lret);
ok(!strcmp( buffer, "string"), "wrong data %s\n", debugstr_a(buffer));
size = sizeof(buffer);
lret = RegQueryValueExA(key, "str2", NULL, NULL, (BYTE*)buffer, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %ld\n", lret);
ok(!strcmp( buffer, "str\\\"ing"), "wrong data %s\n", debugstr_a(buffer));
size = sizeof(buffer);
lret = RegQueryValueExA(key, "str3", NULL, NULL, (BYTE*)buffer, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %ld\n", lret);
ok(!strcmp( buffer, "str'ing"), "wrong data %s\n", debugstr_a(buffer));
size = sizeof(dword);
lret = RegQueryValueExA(key, "dword_unquoted_hex", NULL, NULL, (BYTE*)&dword, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %ld\n", lret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment