Author: gedmurphy
Date: Tue Jul 10 18:54:30 2007
New Revision: 27566
URL:
http://svn.reactos.org/svn/reactos?rev=27566&view=rev
Log:
fix SetServiceStatus to now call ScmrSetServiceStatus to set the service data
Modified:
trunk/reactos/dll/win32/advapi32/service/scm.c
trunk/reactos/dll/win32/advapi32/service/sctrl.c
Modified: trunk/reactos/dll/win32/advapi32/service/scm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/service…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/service/scm.c (original)
+++ trunk/reactos/dll/win32/advapi32/service/scm.c Tue Jul 10 18:54:30 2007
@@ -1829,6 +1829,69 @@
return TRUE;
}
+/**********************************************************************
+ * SetServiceObjectSecurity
+ *
+ * @implemented
+ */
+BOOL STDCALL
+SetServiceObjectSecurity(SC_HANDLE hService,
+ SECURITY_INFORMATION dwSecurityInformation,
+ PSECURITY_DESCRIPTOR lpSecurityDescriptor)
+{
+ PSECURITY_DESCRIPTOR SelfRelativeSD = NULL;
+ ULONG Length;
+ NTSTATUS Status;
+ DWORD dwError;
+
+ Length = 0;
+ Status = RtlMakeSelfRelativeSD(lpSecurityDescriptor,
+ SelfRelativeSD,
+ &Length);
+ if (Status != STATUS_BUFFER_TOO_SMALL)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ SelfRelativeSD = HeapAlloc(GetProcessHeap(), 0, Length);
+ if (SelfRelativeSD == NULL)
+ {
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
+ }
+
+ Status = RtlMakeSelfRelativeSD(lpSecurityDescriptor,
+ SelfRelativeSD,
+ &Length);
+ if (!NT_SUCCESS(Status))
+ {
+ HeapFree(GetProcessHeap(), 0, SelfRelativeSD);
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
+ }
+
+ HandleBind();
+
+ /* Call to services.exe using RPC */
+ dwError = ScmrSetServiceObjectSecurity(BindingHandle,
+ (unsigned int)hService,
+ dwSecurityInformation,
+ (unsigned char *)SelfRelativeSD,
+ Length);
+
+ HeapFree(GetProcessHeap(), 0, SelfRelativeSD);
+
+ if (dwError != ERROR_SUCCESS)
+ {
+ DPRINT1("ScmrServiceObjectSecurity() failed (Error %lu)\n", dwError);
+ SetLastError(dwError);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/**********************************************************************
* QueryServiceStatus
@@ -1896,66 +1959,34 @@
return TRUE;
}
-
-/**********************************************************************
- * SetServiceObjectSecurity
- *
- * @implemented
- */
-BOOL STDCALL
-SetServiceObjectSecurity(SC_HANDLE hService,
- SECURITY_INFORMATION dwSecurityInformation,
- PSECURITY_DESCRIPTOR lpSecurityDescriptor)
-{
- PSECURITY_DESCRIPTOR SelfRelativeSD = NULL;
- ULONG Length;
- NTSTATUS Status;
- DWORD dwError;
-
- Length = 0;
- Status = RtlMakeSelfRelativeSD(lpSecurityDescriptor,
- SelfRelativeSD,
- &Length);
- if (Status != STATUS_BUFFER_TOO_SMALL)
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- return FALSE;
- }
-
- SelfRelativeSD = HeapAlloc(GetProcessHeap(), 0, Length);
- if (SelfRelativeSD == NULL)
- {
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return FALSE;
- }
-
- Status = RtlMakeSelfRelativeSD(lpSecurityDescriptor,
- SelfRelativeSD,
- &Length);
- if (!NT_SUCCESS(Status))
- {
- HeapFree(GetProcessHeap(), 0, SelfRelativeSD);
- SetLastError(RtlNtStatusToDosError(Status));
- return FALSE;
- }
-
- HandleBind();
-
- /* Call to services.exe using RPC */
- dwError = ScmrSetServiceObjectSecurity(BindingHandle,
- (unsigned int)hService,
- dwSecurityInformation,
- (unsigned char *)SelfRelativeSD,
- Length);
-
- HeapFree(GetProcessHeap(), 0, SelfRelativeSD);
-
- if (dwError != ERROR_SUCCESS)
- {
- DPRINT1("ScmrServiceObjectSecurity() failed (Error %lu)\n", dwError);
- SetLastError(dwError);
- return FALSE;
- }
+/**********************************************************************
+ * SetServiceStatus
+ *
+ * @implemented
+ */
+BOOL STDCALL
+SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus,
+ LPSERVICE_STATUS lpServiceStatus)
+{
+ DWORD dwError;
+
+ DPRINT("SetServiceStatus() called\n");
+ DPRINT("ThreadId %lu, data addr %p called\n", hServiceStatus,
lpServiceStatus);
+
+ HandleBind();
+
+ /* Call to services.exe using RPC */
+ dwError = ScmrSetServiceStatus(BindingHandle,
+ (unsigned long)hServiceStatus,
+ lpServiceStatus);
+ if (dwError != ERROR_SUCCESS)
+ {
+ DPRINT1("ScmrSetServiceStatus() failed (Error %lu)\n", dwError);
+ SetLastError(dwError);
+ return FALSE;
+ }
+
+ DPRINT("SetServiceStatus() done (ret %lu\n", dwError);
return TRUE;
}
Modified: trunk/reactos/dll/win32/advapi32/service/sctrl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/service…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/service/sctrl.c (original)
+++ trunk/reactos/dll/win32/advapi32/service/sctrl.c Tue Jul 10 18:54:30 2007
@@ -64,7 +64,7 @@
return NULL;
}
-
+/*
static PACTIVE_SERVICE
ScLookupServiceByThreadId(DWORD ThreadId)
{
@@ -82,7 +82,7 @@
return NULL;
}
-
+*/
static DWORD WINAPI
ScServiceMainStub(LPVOID Context)
@@ -487,32 +487,6 @@
/**********************************************************************
- * SetServiceStatus
- *
- * @implemented
- */
-BOOL STDCALL
-SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus,
- LPSERVICE_STATUS lpServiceStatus)
-{
- PACTIVE_SERVICE Service;
-
- Service = ScLookupServiceByThreadId((DWORD)hServiceStatus);
- if (!Service)
- {
- SetLastError(ERROR_INVALID_HANDLE);
- return FALSE;
- }
-
- RtlCopyMemory(&Service->ServiceStatus,
- lpServiceStatus,
- sizeof(SERVICE_STATUS));
-
- return TRUE;
-}
-
-
-/**********************************************************************
* StartServiceCtrlDispatcherA
*
* @unimplemented