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

parent handle to RegCreateKey(Ex).
- Add a test that shows this.
This commit is contained in:
Robert Shearman 2005-06-16 20:34:34 +00:00 committed by Alexandre Julliard
parent 816217e99e
commit 8cb3f92e53
2 changed files with 19 additions and 1 deletions

View File

@ -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();

View File

@ -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;