advapi32: Add tests for the off-by-one fixing behaviour of RegSetValueExA and RegSetValueExW.
This commit is contained in:
parent
628183c2f9
commit
cca635b472
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue