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

atl: Support escaped quotes in registrar scripts.

parent 1e52895e
...@@ -118,12 +118,18 @@ static HRESULT get_word(LPCOLESTR *str, strbuf *buf) ...@@ -118,12 +118,18 @@ static HRESULT get_word(LPCOLESTR *str, strbuf *buf)
if(*iter == '}' || *iter == '=') { if(*iter == '}' || *iter == '=') {
strbuf_write(iter++, buf, 1); strbuf_write(iter++, buf, 1);
}else if(*iter == '\'') { }else if(*iter == '\'') {
iter2 = ++iter; for (;;)
iter = wcschr(iter, '\''); {
if(!iter) { iter2 = ++iter;
WARN("Unexpected end of script\n"); iter = wcschr(iter, '\'');
*str = iter; if(!iter) {
return DISP_E_EXCEPTION; WARN("Unexpected end of script\n");
*str = iter;
return DISP_E_EXCEPTION;
}
if (iter[1] != '\'') break;
iter++;
strbuf_write(iter2, buf, iter-iter2);
} }
strbuf_write(iter2, buf, iter-iter2); strbuf_write(iter2, buf, iter-iter2);
iter++; iter++;
......
...@@ -42,7 +42,9 @@ static const char textA[] = ...@@ -42,7 +42,9 @@ static const char textA[] =
"{ \n" "{ \n"
" ForceRemove eebf73c4-50fd-478f-bbcf-db212221227a \n" " ForceRemove eebf73c4-50fd-478f-bbcf-db212221227a \n"
" { \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_quoted_dec' = d '1' \n"
" val 'dword_unquoted_dec' = d 1 \n" " val 'dword_unquoted_dec' = d 1 \n"
" val 'dword_quoted_hex' = d '0xA' \n" " val 'dword_quoted_hex' = d '0xA' \n"
...@@ -81,6 +83,7 @@ static void test_registrar(void) ...@@ -81,6 +83,7 @@ static void test_registrar(void)
LONG lret; LONG lret;
HKEY key; HKEY key;
BYTE bytes[4]; BYTE bytes[4];
char buffer[16];
MultiByteToWideChar(CP_ACP, 0, textA, -1, textW, count); MultiByteToWideChar(CP_ACP, 0, textA, -1, textW, count);
hr = IRegistrar_StringRegister(registrar, textW); hr = IRegistrar_StringRegister(registrar, textW);
...@@ -94,6 +97,21 @@ static void test_registrar(void) ...@@ -94,6 +97,21 @@ static void test_registrar(void)
lret = RegOpenKeyA(HKEY_CURRENT_USER, "eebf73c4-50fd-478f-bbcf-db212221227a", &key); lret = RegOpenKeyA(HKEY_CURRENT_USER, "eebf73c4-50fd-478f-bbcf-db212221227a", &key);
ok(lret == ERROR_SUCCESS, "error %ld opening registry key\n", lret); 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); size = sizeof(dword);
lret = RegQueryValueExA(key, "dword_unquoted_hex", NULL, NULL, (BYTE*)&dword, &size); lret = RegQueryValueExA(key, "dword_unquoted_hex", NULL, NULL, (BYTE*)&dword, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %ld\n", lret); 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