[PATCH] atl/tests: Add tests for quotes in a string for rgs
Detlef Riekenberg
wine.dev at web.de
Sun May 8 17:16:27 CDT 2011
Single quotes in a string do not work (Wine and Windows)
in a rgs file.
What is the alternative to add a string with a single quote?
*.inf ?
RegSetValueEx ?
--
By by ... Detlef
---
dlls/atl/tests/registrar.c | 55 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 54 insertions(+), 1 deletions(-)
diff --git a/dlls/atl/tests/registrar.c b/dlls/atl/tests/registrar.c
index 9c5dd23..770aa9c 100644
--- a/dlls/atl/tests/registrar.c
+++ b/dlls/atl/tests/registrar.c
@@ -43,6 +43,10 @@ static const char textA[] =
" ForceRemove eebf73c4-50fd-478f-bbcf-db212221227a \n"
" { \n"
" val 'string' = s 'string' \n"
+" val '1single' = s '1single\'1 s' \n"
+" val '2single' = s '2single\'2 s\'x y' \n"
+" val '1double' = s '1double\"1 d' \n"
+" val '2double' = s '2double\"2 d\"x y' \n"
" val 'dword_quoted_dec' = d '1' \n"
" val 'dword_unquoted_dec' = d 1 \n"
" val 'dword_quoted_hex' = d '0xA' \n"
@@ -80,7 +84,8 @@ static void test_registrar(void)
DWORD size;
LONG lret;
HKEY key;
- BYTE bytes[4];
+ HKEY subkey;
+ BYTE bytes[64];
MultiByteToWideChar(CP_ACP, 0, textA, -1, textW, count);
hr = IRegistrar_StringRegister(registrar, textW);
@@ -89,6 +94,54 @@ static void test_registrar(void)
lret = RegOpenKeyA(HKEY_CLASSES_ROOT, "eebf73c4-50fd-478f-bbcf-db212221227a", &key);
ok(lret == ERROR_SUCCESS, "error %d opening registry key\n", lret);
+ /* a single quote in a string does not work */
+ size = sizeof(bytes);
+ lret = RegQueryValueExA(key, "1single", NULL, NULL, (LPBYTE) &bytes, &size);
+ ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %d\n", lret);
+ ok(!lstrcmpA(bytes, "1single"), "got: %s\n", bytes);
+
+ /* the parser stop at a single quote and the rest (space as seperator) is used as new key */
+ lret = RegOpenKeyA(key, "1", &subkey);
+ ok((lret == ERROR_SUCCESS) && (subkey != NULL),
+ "got %u and %p for 1 (expected ERROR_SUCCESS and != NULL)\n", lret, subkey);
+ RegCloseKey(subkey);
+
+ lret = RegOpenKeyA(key, "s'", &subkey);
+ ok((lret == ERROR_SUCCESS) && (subkey != NULL),
+ "got %u and %p for s' (expected ERROR_SUCCESS and != NULL)\n", lret, subkey);
+ RegCloseKey(subkey);
+
+ size = sizeof(bytes);
+ lret = RegQueryValueExA(key, "2single", NULL, NULL, (LPBYTE) &bytes, &size);
+ ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %d\n", lret);
+ ok(!lstrcmpA(bytes, "2single"), "got: %s\n", bytes);
+
+ lret = RegOpenKeyA(key, "2", &subkey);
+ ok((lret == ERROR_SUCCESS) && (subkey != NULL),
+ "got %u and %p for 2 (expected ERROR_SUCCESS and != NULL)\n", lret, subkey);
+ RegCloseKey(subkey);
+
+ lret = RegOpenKeyA(key, "s'x", &subkey);
+ ok((lret == ERROR_SUCCESS) && (subkey != NULL),
+ "got %u and %p for s'x (expected ERROR_SUCCESS and != NULL)\n", lret, subkey);
+ RegCloseKey(subkey);
+
+ lret = RegOpenKeyA(key, "y'", &subkey);
+ ok((lret == ERROR_SUCCESS) && (subkey != NULL),
+ "got %u and %p for y' (expected ERROR_SUCCESS and != NULL)\n", lret, subkey);
+ RegCloseKey(subkey);
+
+ /* double quotes in a string work */
+ size = sizeof(bytes);
+ lret = RegQueryValueExA(key, "1double", NULL, NULL, (LPBYTE) &bytes, &size);
+ ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %d\n", lret);
+ ok(!lstrcmpA(bytes, "1double\"1 d"), "got: %s\n", bytes);
+
+ size = sizeof(bytes);
+ lret = RegQueryValueExA(key, "2double", NULL, NULL, (LPBYTE) &bytes, &size);
+ ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %d\n", lret);
+ ok(!lstrcmpA(bytes, "2double\"2 d\"x y"), "got: %s\n", bytes);
+
size = sizeof(dword);
lret = RegQueryValueExA(key, "dword_unquoted_hex", NULL, NULL, (BYTE*)&dword, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %d\n", lret);
--
1.7.4.1
More information about the wine-patches
mailing list