Author: ekohl
Date: Sun Sep 25 12:07:52 2011
New Revision: 53850
URL:
http://svn.reactos.org/svn/reactos?rev=53850&view=rev
Log:
[SERVICES]
- Silence debug messages.
- Fix typos.
- Add missing database locks.
- RControlService: Return ERROR_INVALID_PARAMETER on illegal control code.
Modified:
trunk/reactos/base/system/services/database.c
trunk/reactos/base/system/services/rpcserver.c
Modified: trunk/reactos/base/system/services/database.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/datab…
==============================================================================
--- trunk/reactos/base/system/services/database.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/database.c [iso-8859-1] Sun Sep 25 12:07:52 2011
@@ -146,7 +146,7 @@
ImageEntry = ImageEntry->Flink;
}
- DPRINT1("Couldn't find a matching image\n");
+ DPRINT("Couldn't find a matching image\n");
return NULL;
@@ -1368,7 +1368,7 @@
OVERLAPPED Overlapped = {0, 0, 0, 0, 0};
#endif
- DPRINT1("ScmWaitForServiceConnect()\n");
+ DPRINT("ScmWaitForServiceConnect()\n");
#ifdef USE_ASYNCHRONOUS_IO
Overlapped.hEvent = (HANDLE)NULL;
@@ -1377,19 +1377,21 @@
&Overlapped);
if (bResult == FALSE)
{
- DPRINT1("ConnectNamedPipe() returned FALSE\n");
+ DPRINT("ConnectNamedPipe() returned FALSE\n");
dwError = GetLastError();
if (dwError == ERROR_IO_PENDING)
{
- DPRINT1("dwError: ERROR_IO_PENDING\n");
+ DPRINT("dwError: ERROR_IO_PENDING\n");
dwError = WaitForSingleObject(Service->lpImage->hControlPipe,
dwPipeTimeout);
- DPRINT1("WaitForSingleObject() returned %lu\n", dwError);
+ DPRINT("WaitForSingleObject() returned %lu\n", dwError);
if (dwError == WAIT_TIMEOUT)
{
+ DPRINT("WaitForSingleObject() returned WAIT_TIMEOUT\n");
+
bResult = CancelIo(Service->lpImage->hControlPipe);
if (bResult == FALSE)
{
@@ -1420,7 +1422,7 @@
}
}
- DPRINT1("Control pipe connected!\n");
+ DPRINT("Control pipe connected!\n");
Overlapped.hEvent = (HANDLE) NULL;
@@ -1432,18 +1434,18 @@
&Overlapped);
if (bResult == FALSE)
{
- DPRINT1("ReadFile() returned FALSE\n");
+ DPRINT("ReadFile() returned FALSE\n");
dwError = GetLastError();
if (dwError == ERROR_IO_PENDING)
{
- DPRINT1("dwError: ERROR_IO_PENDING\n");
+ DPRINT("dwError: ERROR_IO_PENDING\n");
dwError = WaitForSingleObject(Service->lpImage->hControlPipe,
dwPipeTimeout);
if (dwError == WAIT_TIMEOUT)
{
- DPRINT1("WaitForSingleObject() returned WAIT_TIMEOUT\n");
+ DPRINT("WaitForSingleObject() returned WAIT_TIMEOUT\n");
bResult = CancelIo(Service->lpImage->hControlPipe);
if (bResult == FALSE)
@@ -1455,9 +1457,9 @@
}
else if (dwError == ERROR_SUCCESS)
{
- DPRINT1("WaitForSingleObject() returned ERROR_SUCCESS\n");
-
- DPRINT1("Process Id: %lu\n", dwProcessId);
+ DPRINT("WaitForSingleObject() returned ERROR_SUCCESS\n");
+
+ DPRINT("Process Id: %lu\n", dwProcessId);
bResult = GetOverlappedResult(Service->lpImage->hControlPipe,
&Overlapped,
Modified: trunk/reactos/base/system/services/rpcserver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcse…
==============================================================================
--- trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] Sun Sep 25 12:07:52 2011
@@ -609,11 +609,7 @@
if (dwControl >= 128 && dwControl <= 255)
DesiredAccess = SERVICE_USER_DEFINED_CONTROL;
else
- DesiredAccess = SERVICE_QUERY_CONFIG |
- SERVICE_CHANGE_CONFIG |
- SERVICE_QUERY_STATUS |
- SERVICE_START |
- SERVICE_PAUSE_CONTINUE;
+ return ERROR_INVALID_PARAMETER;
break;
}
@@ -862,7 +858,9 @@
return ERROR_INVALID_HANDLE;
}
- /* FIXME: Lock the service list */
+ /* Lock the service database */
+ ScmLockDatabaseShared();
+
/* hack */
Status = RtlCreateSecurityDescriptor(&ObjectDescriptor,
SECURITY_DESCRIPTOR_REVISION);
@@ -873,7 +871,8 @@
cbBufSize,
&dwBytesNeeded);
- /* FIXME: Unlock the service list */
+ /* Unlock the service database */
+ ScmUnlockDatabase();
if (NT_SUCCESS(Status))
{
@@ -975,9 +974,12 @@
return RtlNtStatusToDosError(Status);
RpcRevertToSelf();
-
- /* FIXME: Lock service database */
-
+#endif
+
+ /* Lock the service database exclusive */
+ ScmLockDatabaseExclusive();
+
+#if 0
Status = RtlSetSecurityObject(dwSecurityInformation,
(PSECURITY_DESCRIPTOR)lpSecurityDescriptor,
&lpService->lpSecurityDescriptor,
@@ -1011,7 +1013,8 @@
NtClose(hToken);
#endif
- /* FIXME: Unlock service database */
+ /* Unlock service database */
+ ScmUnlockDatabase();
DPRINT("RSetServiceObjectSecurity() done (Error %lu)\n", dwError);
@@ -1053,7 +1056,7 @@
return ERROR_INVALID_HANDLE;
}
- /* Lock the srevice database shared */
+ /* Lock the service database shared */
ScmLockDatabaseShared();
/* Return service status information */