Alexandre Julliard : atl: Support escaped quotes in registrar scripts.
Alexandre Julliard
julliard at winehq.org
Tue Jun 7 15:41:22 CDT 2022
Module: wine
Branch: master
Commit: 6f485a361f6b38bacf228b90f35f1200756555ee
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6f485a361f6b38bacf228b90f35f1200756555ee
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Jun 7 19:36:02 2022 +0200
atl: Support escaped quotes in registrar scripts.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/atl/registrar.c | 18 ++++++++++++------
dlls/atl/tests/registrar.c | 20 +++++++++++++++++++-
2 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/dlls/atl/registrar.c b/dlls/atl/registrar.c
index 5a3eef7dd4f..5e03b42132c 100644
--- a/dlls/atl/registrar.c
+++ b/dlls/atl/registrar.c
@@ -118,12 +118,18 @@ static HRESULT get_word(LPCOLESTR *str, strbuf *buf)
if(*iter == '}' || *iter == '=') {
strbuf_write(iter++, buf, 1);
}else if(*iter == '\'') {
- iter2 = ++iter;
- iter = wcschr(iter, '\'');
- if(!iter) {
- WARN("Unexpected end of script\n");
- *str = iter;
- return DISP_E_EXCEPTION;
+ for (;;)
+ {
+ iter2 = ++iter;
+ iter = wcschr(iter, '\'');
+ if(!iter) {
+ 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);
iter++;
diff --git a/dlls/atl/tests/registrar.c b/dlls/atl/tests/registrar.c
index e332bbce0de..ab31f9532b1 100644
--- a/dlls/atl/tests/registrar.c
+++ b/dlls/atl/tests/registrar.c
@@ -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);
More information about the wine-cvs
mailing list