From f9f3b21fb3a8b8266fa25ae7acb6790195b78f83 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Fri, 4 Jul 2014 10:10:45 -0600 Subject: [PATCH] advapi32: Implement RegSetKeySecurity on top of NtSetSecurityObject. --- dlls/advapi32/registry.c | 4 ++-- dlls/advapi32/tests/registry.c | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index d568ae06440..bb68b3dcde0 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -2488,9 +2488,9 @@ LSTATUS WINAPI RegSetKeySecurity( HKEY hkey, SECURITY_INFORMATION SecurityInfo, if (!pSecurityDesc) return ERROR_INVALID_PARAMETER; - FIXME(":(%p,%d,%p): stub\n",hkey,SecurityInfo,pSecurityDesc); + if (!(hkey = get_special_root_hkey( hkey, 0 ))) return ERROR_INVALID_HANDLE; - return ERROR_SUCCESS; + return RtlNtStatusToDosError( NtSetSecurityObject( hkey, SecurityInfo, pSecurityDesc ) ); } diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 0626aff3bbd..85f50ce8b1e 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -1103,14 +1103,15 @@ static void test_reg_open_key(void) } else { - /* The "sanctioned" methods of setting a registry ACL aren't implemented in Wine. */ - bRet = SetKernelObjectSecurity(hkRoot64, DACL_SECURITY_INFORMATION, sd); - ok(bRet == TRUE, - "Expected SetKernelObjectSecurity to return TRUE, got %d, last error %u\n", bRet, GetLastError()); + LONG error; - bRet = SetKernelObjectSecurity(hkRoot32, DACL_SECURITY_INFORMATION, sd); - ok(bRet == TRUE, - "Expected SetKernelObjectSecurity to return TRUE, got %d, last error %u\n", bRet, GetLastError()); + error = RegSetKeySecurity(hkRoot64, DACL_SECURITY_INFORMATION, sd); + ok(error == ERROR_SUCCESS, + "Expected RegSetKeySecurity to return success, got error %u\n", error); + + bRet = RegSetKeySecurity(hkRoot32, DACL_SECURITY_INFORMATION, sd); + ok(error == ERROR_SUCCESS, + "Expected RegSetKeySecurity to return success, got error %u\n", error); hkResult = NULL; ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine", 0, KEY_WOW64_64KEY | KEY_READ, &hkResult); @@ -1264,14 +1265,13 @@ static void test_reg_create_key(void) } else { - /* The "sanctioned" methods of setting a registry ACL aren't implemented in Wine. */ - bRet = SetKernelObjectSecurity(hkRoot64, DACL_SECURITY_INFORMATION, sd); - ok(bRet == TRUE, - "Expected SetKernelObjectSecurity to return TRUE, got %d, last error %u\n", bRet, GetLastError()); + ret = RegSetKeySecurity(hkRoot64, DACL_SECURITY_INFORMATION, sd); + ok(ret == ERROR_SUCCESS, + "Expected RegSetKeySecurity to return success, got error %u\n", ret); - bRet = SetKernelObjectSecurity(hkRoot32, DACL_SECURITY_INFORMATION, sd); - ok(bRet == TRUE, - "Expected SetKernelObjectSecurity to return TRUE, got %d, last error %u\n", bRet, GetLastError()); + ret = RegSetKeySecurity(hkRoot32, DACL_SECURITY_INFORMATION, sd); + ok(ret == ERROR_SUCCESS, + "Expected RegSetKeySecurity to return success, got error %u\n", ret); hkey1 = NULL; ret = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine", 0, NULL, 0,