[PATCH v2 1/2] advapi32/tests: Test implicit DACL_SECURITY_INFORMATION permission on a registry key.

Dmitry Timoshkov dmitry at baikal.ru
Tue Feb 9 08:34:29 CST 2021


v2: Rebased to current git.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/advapi32/tests/security.c | 38 ++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index e6d2f565943..ff180ae4da4 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -7943,6 +7943,43 @@ static void test_duplicate_token(void)
     CloseHandle(token);
 }
 
+static void test_regkey_security(void)
+{
+    HKEY hkey;
+    DWORD ret;
+    PSECURITY_DESCRIPTOR sd;
+    ACL *dacl;
+
+    ret = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Winetest", &hkey);
+    ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
+    RegCloseKey(hkey);
+
+    ret = RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Winetest", 0, KEY_QUERY_VALUE, &hkey);
+    ok(ret == ERROR_SUCCESS, "got %u\n", ret);
+
+    ret = get_obj_access(hkey);
+    ok(ret == KEY_QUERY_VALUE, "got %#x\n", ret);
+
+    sd = NULL;
+    dacl = NULL;
+    ret = GetSecurityInfo(hkey, SE_REGISTRY_KEY, DACL_SECURITY_INFORMATION, NULL, NULL, &dacl, NULL, &sd);
+todo_wine
+    ok(ret == ERROR_SUCCESS, "got %u\n", ret);
+todo_wine
+    ok(sd != NULL, "sd should not be NULL\n");
+todo_wine
+    ok(dacl != NULL, "dacl should not be NULL\n");
+
+    ret = SetSecurityInfo(hkey, SE_REGISTRY_KEY, DACL_SECURITY_INFORMATION, NULL, NULL, dacl, NULL);
+todo_wine
+    ok(ret == ERROR_SUCCESS, "got %u\n", ret);
+
+    LocalFree(sd);
+
+    RegDeleteKeyW(hkey, L"");
+    RegCloseKey(hkey);
+}
+
 START_TEST(security)
 {
     init();
@@ -8007,6 +8044,7 @@ START_TEST(security)
     test_create_process_token();
     test_pseudo_handle_security();
     test_duplicate_token();
+    test_regkey_security();
 
     /* Must be the last test, modifies process token */
     test_token_security_descriptor();
-- 
2.29.2




More information about the wine-devel mailing list