From: "Erich E. Hoover" <ehoover@mymail.mines.edu>
Subject: [PATCH 1/7] advapi32: Support service objects in SetSecurityInfo (try 5).
Message-Id: <CAEU2+vqHd-Wzq8+EuKw28rjsByzQzsMLkYimcdy6yp12dzxnLg@mail.gmail.com>
Date: Mon, 17 Dec 2012 18:55:15 -0700

Patches 1-6 in this series fix a non-fatal page fault with the Visio
installer (Bug #32360) and patch 7 fixes an intermittent 64-bit test
failure.  Patches 1-4 implement support for service objects
(SE_SERVICE) and patches 5-6 implement support for registry objects
(SE_REGISTRY_KEY).  With these patches SetNamedSecurityInfo and
GetNamedSecurityInfo should now be back to normal.

This patch adds support for service objects (SE_SERVICE) in
SetSecurityInfo by returning success and outputting an error message.

From 1e5a334d27c6fc33fc1a6b4cbe0df8c6e485fe31 Mon Sep 17 00:00:00 2001
From: Erich Hoover <ehoover@mines.edu>
Date: Mon, 17 Dec 2012 13:34:04 -0700
Subject: advapi32: Support service objects in SetSecurityInfo.

---
 dlls/advapi32/security.c |   11 ++++++++++-
 dlls/advapi32/service.c  |    3 +++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index d857591..b78a3d2 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -5648,7 +5648,16 @@ DWORD WINAPI SetSecurityInfo(HANDLE handle, SE_OBJECT_TYPE ObjectType,
     if (SecurityInfo & SACL_SECURITY_INFORMATION)
         SetSecurityDescriptorSacl(&sd, TRUE, pSacl, FALSE);
 
-    status = NtSetSecurityObject(handle, SecurityInfo, &sd);
+    switch (ObjectType)
+    {
+    case SE_SERVICE:
+        FIXME("stub: Service objects are not supported at this time.\n");
+        status = STATUS_SUCCESS; /* Implement SetServiceObjectSecurity */
+        break;
+    default:
+        status = NtSetSecurityObject(handle, SecurityInfo, &sd);
+        break;
+    }
     return RtlNtStatusToDosError(status);
 }
 
diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c
index fc98880..9a952e1 100644
--- a/dlls/advapi32/service.c
+++ b/dlls/advapi32/service.c
@@ -2196,6 +2196,9 @@ BOOL WINAPI QueryServiceObjectSecurity(SC_HANDLE hService,
 
 /******************************************************************************
  * SetServiceObjectSecurity [ADVAPI32.@]
+ *
+ * NOTES
+ *  - SetSecurityInfo should be updated to call this function once it's implemented.
  */
 BOOL WINAPI SetServiceObjectSecurity(SC_HANDLE hService,
        SECURITY_INFORMATION dwSecurityInformation,
-- 
1.7.9.5