Commit 8cb3f92e authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- All versions of Windows ignore the access rights of the passed in

parent handle to RegCreateKey(Ex). - Add a test that shows this.
parent 816217e9
......@@ -330,6 +330,22 @@ static void test_reg_open_key()
ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", ret);
}
static void test_reg_create_key()
{
LONG ret;
HKEY hkey1, hkey2;
ret = RegCreateKeyExA(hkey_main, "Subkey1", 0, NULL, 0, KEY_NOTIFY, NULL, &hkey1, NULL);
ok(!ret, "RegCreateKeyExA failed with error %ld\n", ret);
/* should succeed: all versions of Windows ignore the access rights
* to the parent handle */
ret = RegCreateKeyExA(hkey1, "Subkey2", 0, NULL, 0, KEY_SET_VALUE, NULL, &hkey2, NULL);
ok(!ret, "RegCreateKeyExA failed with error %ld\n", ret);
/* clean up */
RegDeleteKey(hkey2, NULL);
RegDeleteKey(hkey1, NULL);
}
static void test_reg_close_key()
{
DWORD ret = 0;
......@@ -435,6 +451,7 @@ START_TEST(registry)
test_enum_value();
test_query_value_ex();
test_reg_open_key();
test_reg_create_key();
test_reg_close_key();
test_reg_delete_key();
......
......@@ -1690,7 +1690,8 @@ DECL_HANDLER(create_key)
if (access & MAXIMUM_ALLOWED) access = KEY_ALL_ACCESS; /* FIXME: needs general solution */
reply->hkey = 0;
if (!(name = copy_req_path( req->namelen, !req->parent ))) return;
if ((parent = get_hkey_obj( req->parent, KEY_CREATE_SUB_KEY )))
/* NOTE: no access rights are required from the parent handle to create a key */
if ((parent = get_hkey_obj( req->parent, 0 )))
{
int flags = (req->options & REG_OPTION_VOLATILE) ? KEY_VOLATILE : KEY_DIRTY;
......
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