Rob Shearman : advapi32: Add tests for the off-by-one fixing behaviour of RegSetValueExA and RegSetValueExW .

Alexandre Julliard julliard at winehq.org
Mon Feb 18 08:50:43 CST 2008


Module: wine
Branch: master
Commit: cca635b472cdf3072ac81599a519208c21d4d27b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cca635b472cdf3072ac81599a519208c21d4d27b

Author: Rob Shearman <rob at codeweavers.com>
Date:   Sat Feb 16 15:36:18 2008 +0000

advapi32: Add tests for the off-by-one fixing behaviour of RegSetValueExA and RegSetValueExW.

---

 dlls/advapi32/tests/registry.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c
index c3f4b2b..4122326 100644
--- a/dlls/advapi32/tests/registry.c
+++ b/dlls/advapi32/tests/registry.c
@@ -349,6 +349,12 @@ static void test_set_value(void)
     test_hkey_main_Value_A(name1A, emptyA, sizeof(emptyA));
     test_hkey_main_Value_W(name1W, emptyW, sizeof(emptyW));
 
+    /* test RegSetValueExA with off-by-one size */
+    ret = RegSetValueExA(hkey_main, name1A, 0, REG_SZ, (const BYTE *)string1A, sizeof(string1A)-sizeof(string1A[0]));
+    ok(ret == ERROR_SUCCESS, "RegSetValueExA failed: %d, GLE=%d\n", ret, GetLastError());
+    test_hkey_main_Value_A(name1A, string1A, sizeof(string1A));
+    test_hkey_main_Value_W(name1W, string1W, sizeof(string1W));
+
     /* test RegSetValueExA with normal string */
     ret = RegSetValueExA(hkey_main, name1A, 0, REG_SZ, (const BYTE *)string1A, sizeof(string1A));
     ok(ret == ERROR_SUCCESS, "RegSetValueExA failed: %d, GLE=%d\n", ret, GetLastError());
@@ -393,6 +399,12 @@ static void test_set_value(void)
     ret = RegSetValueW(hkey_main, NULL, REG_MULTI_SZ, string2W, sizeof(string2W));
     ok(ret == ERROR_INVALID_PARAMETER, "RegSetValueW should have returned ERROR_INVALID_PARAMETER instead of %d\n", ret);
 
+    /* test RegSetValueExW with off-by-one size */
+    ret = RegSetValueExW(hkey_main, name1W, 0, REG_SZ, (const BYTE *)string1W, sizeof(string1W)-sizeof(string1W[0]));
+    ok(ret == ERROR_SUCCESS, "RegSetValueExW failed: %d, GLE=%d\n", ret, GetLastError());
+    test_hkey_main_Value_A(name1A, string1A, sizeof(string1A));
+    test_hkey_main_Value_W(name1W, string1W, sizeof(string1W));
+
     /* test RegSetValueExW with normal string */
     ret = RegSetValueExW(hkey_main, name1W, 0, REG_SZ, (const BYTE *)string1W, sizeof(string1W));
     ok(ret == ERROR_SUCCESS, "RegSetValueExW failed: %d, GLE=%d\n", ret, GetLastError());




More information about the wine-cvs mailing list