Add information letting us know creation deletion of services has
worked.
comment out testing debug info.
Modified: trunk/reactos/subsys/system/sc/control.c
Modified: trunk/reactos/subsys/system/sc/create.c
Modified: trunk/reactos/subsys/system/sc/delete.c
Modified: trunk/reactos/subsys/system/sc/sc.c
Modified: trunk/reactos/subsys/system/sc/sc.h
Modified: trunk/reactos/subsys/system/sc/start.c
_____
Modified: trunk/reactos/subsys/system/sc/control.c
--- trunk/reactos/subsys/system/sc/control.c 2005-11-07 20:32:17 UTC
(rev 19041)
+++ trunk/reactos/subsys/system/sc/control.c 2005-11-07 21:14:03 UTC
(rev 19042)
@@ -20,7 +20,8 @@
{
SC_HANDLE hSc;
SERVICE_STATUS Status;
-
+
+#ifdef SCDBG
/* testing */
_tprintf(_T("service to control - %s\n\n"), ServiceName);
_tprintf(_T("command - %lu\n\n"), Control);
@@ -30,8 +31,8 @@
printf("%s\n", *Args);
Args++;
}
+#endif /* SCDBG */
-
hSc = OpenService(hSCManager, ServiceName,
SERVICE_INTERROGATE | SERVICE_PAUSE_CONTINUE |
SERVICE_STOP | SERVICE_USER_DEFINED_CONTROL |
@@ -46,7 +47,7 @@
if (! ControlService(hSc, Control, &Status))
{
- _tprintf(_T("controlService failed\n"));
+ _tprintf(_T("[SC] controlService FAILED %lu:\n\n"),
GetLastError());
ReportLastError();
return FALSE;
}
_____
Modified: trunk/reactos/subsys/system/sc/create.c
--- trunk/reactos/subsys/system/sc/create.c 2005-11-07 20:32:17 UTC
(rev 19041)
+++ trunk/reactos/subsys/system/sc/create.c 2005-11-07 21:14:03 UTC
(rev 19042)
@@ -19,7 +19,8 @@
if ((! ServiceName) || (! BinaryPathName))
return CreateUsage();
-
+
+#ifdef SCDBG
/* testing */
printf("service to create - %s\n", ServiceName);
printf("Binary path - %s\n", BinaryPathName);
@@ -29,7 +30,7 @@
printf("%s\n", *Options);
Options++;
}
-
+#endif
hSc = CreateService(hSCManager,
ServiceName,
ServiceName,
@@ -50,9 +51,8 @@
ReportLastError();
return FALSE;
}
- else
- {
- CloseServiceHandle(hSc);
- return TRUE;
- }
+
+ _tprintf(_T("[SC] CreateService SUCCESS\n"));
+ CloseServiceHandle(hSc);
+ return TRUE;
}
_____
Modified: trunk/reactos/subsys/system/sc/delete.c
--- trunk/reactos/subsys/system/sc/delete.c 2005-11-07 20:32:17 UTC
(rev 19041)
+++ trunk/reactos/subsys/system/sc/delete.c 2005-11-07 21:14:03 UTC
(rev 19042)
@@ -15,8 +15,10 @@
{
SC_HANDLE hSc;
+#ifdef SCDBG
/* testing */
printf("service to delete - %s\n\n", ServiceName);
+#endif
hSc = OpenService(hSCManager, ServiceName, DELETE);
@@ -34,6 +36,7 @@
return FALSE;
}
+ _tprintf(_T("[SC] DeleteService SUCCESS\n"));
CloseServiceHandle(hSc);
return TRUE;
}
_____
Modified: trunk/reactos/subsys/system/sc/sc.c
--- trunk/reactos/subsys/system/sc/sc.c 2005-11-07 20:32:17 UTC (rev
19041)
+++ trunk/reactos/subsys/system/sc/sc.c 2005-11-07 21:14:03 UTC (rev
19042)
@@ -58,8 +58,12 @@
_tprintf(_T("Remote service control is not yet
implemented\n"));
return 2;
}
-
- hSCManager = OpenSCManager(MachineName, NULL,
SC_MANAGER_ALL_ACCESS);
+
+ /* if we are emurating the services, we don't need administrator
access */
+ if ( (_tcsicmp(Command, _T("query")) == 0) || (_tcsicmp(Command,
_T("queryex")) == 0) )
+ hSCManager = OpenSCManager(MachineName, NULL,
SC_MANAGER_ENUMERATE_SERVICE);
+ else
+ hSCManager = OpenSCManager(MachineName, NULL,
SC_MANAGER_ALL_ACCESS);
if (hSCManager == NULL)
{
_tprintf(_T("[SC] OpenSCManager FAILED %lu:\n\n"),
GetLastError());
_____
Modified: trunk/reactos/subsys/system/sc/sc.h
--- trunk/reactos/subsys/system/sc/sc.h 2005-11-07 20:32:17 UTC (rev
19041)
+++ trunk/reactos/subsys/system/sc/sc.h 2005-11-07 21:14:03 UTC (rev
19042)
@@ -4,7 +4,7 @@
extern SC_HANDLE hSCManager; // declared in sc.c
-//#define DBG
+//#define SCDBG
/* control functions */
BOOL Query(LPCTSTR ServiceName, LPCTSTR *ServiceArgs, BOOL bExtended);
_____
Modified: trunk/reactos/subsys/system/sc/start.c
--- trunk/reactos/subsys/system/sc/start.c 2005-11-07 20:32:17 UTC
(rev 19041)
+++ trunk/reactos/subsys/system/sc/start.c 2005-11-07 21:14:03 UTC
(rev 19042)
@@ -14,9 +14,10 @@
BOOL Start(LPCTSTR ServiceName, LPCTSTR *ServiceArgs, INT ArgCount)
{
SC_HANDLE hSc;
- SERVICE_STATUS_PROCESS ServiceStatus;
+ SERVICE_STATUS_PROCESS ServiceStatus, ServiceStatus2;
DWORD BytesNeeded;
+#ifdef SCDBG
/* testing */
_tprintf(_T("service to start - %s\n\n"), ServiceName);
_tprintf(_T("Arguments :\n"));
@@ -25,7 +26,7 @@
printf("%s\n", *ServiceArgs);
ServiceArgs++;
}
-
+#endif
/* get a handle to the service requested for starting */
hSc = OpenService(hSCManager, ServiceName, SERVICE_ALL_ACCESS);
@@ -40,7 +41,7 @@
/* start the service opened */
if (! StartService(hSc, ArgCount, ServiceArgs))
{
- _tprintf(_T("StartService failed\n"));
+ _tprintf(_T("[SC] StartService FAILED %lu:\n\n"),
GetLastError());
ReportLastError();
return FALSE;
}
@@ -77,11 +78,22 @@
}
}
+ QueryServiceStatusEx(hSc, SC_STATUS_PROCESS_INFO,
(LPBYTE)&ServiceStatus2,
+ sizeof(SERVICE_STATUS_PROCESS), &BytesNeeded);
+
CloseServiceHandle(hSc);
if (ServiceStatus.dwCurrentState == SERVICE_RUNNING)
{
- _tprintf(_T("%s is running\n"), ServiceName);
+ _tprintf(_T("\nSERVICE_NAME: %s\n"), ServiceName);
+ _tprintf(_T("\tTYPE : %lu\n"),
ServiceStatus2.dwServiceType);
+ _tprintf(_T("\tSTATE : %lu\n"),
ServiceStatus2.dwCurrentState);
+ _tprintf(_T("\tWIN32_EXIT_CODE : %lu\n"),
ServiceStatus2.dwWin32ExitCode);
+ _tprintf(_T("\tCHECKPOINT : %lu\n"),
ServiceStatus2.dwCheckPoint);
+ _tprintf(_T("\tWAIT_HINT : %lu\n"),
ServiceStatus2.dwWaitHint);
+ _tprintf(_T("\tPID : %lu\n"),
ServiceStatus2.dwProcessId);
+ _tprintf(_T("\tFLAGS : %lu\n"),
ServiceStatus2.dwServiceFlags);
+
return TRUE;
}
else