Author: gedmurphy Date: Wed Aug 29 13:42:31 2007 New Revision: 28644
URL: http://svn.reactos.org/svn/reactos?rev=28644&view=rev Log: Add functionality for changing the service config. unused at the moment.
Modified: trunk/reactos/base/applications/mscutils/servman/precomp.h trunk/reactos/base/applications/mscutils/servman/query.c
Modified: trunk/reactos/base/applications/mscutils/servman/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils/... ============================================================================== --- trunk/reactos/base/applications/mscutils/servman/precomp.h (original) +++ trunk/reactos/base/applications/mscutils/servman/precomp.h Wed Aug 29 13:42:31 2007 @@ -74,7 +74,7 @@ /* query.c */ ENUM_SERVICE_STATUS_PROCESS* GetSelectedService(PMAIN_WND_INFO Info); LPQUERY_SERVICE_CONFIG GetServiceConfig(LPTSTR lpServiceName); -VOID SetServiceConfig(LPQUERY_SERVICE_CONFIG); +BOOL SetServiceConfig(LPQUERY_SERVICE_CONFIG pServiceConfig, LPTSTR lpServiceName, LPTSTR lpPassword); LPTSTR GetServiceDescription(LPTSTR lpServiceName); LPTSTR GetExecutablePath(LPTSTR lpServiceName); BOOL RefreshServiceList(PMAIN_WND_INFO Info);
Modified: trunk/reactos/base/applications/mscutils/servman/query.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils/... ============================================================================== --- trunk/reactos/base/applications/mscutils/servman/query.c (original) +++ trunk/reactos/base/applications/mscutils/servman/query.c Wed Aug 29 13:42:31 2007 @@ -90,10 +90,53 @@ }
-VOID -SetServiceConfig(LPQUERY_SERVICE_CONFIG pServiceConfig) -{ - +BOOL +SetServiceConfig(LPQUERY_SERVICE_CONFIG pServiceConfig, + LPTSTR lpServiceName, + LPTSTR lpPassword) +{ + SC_HANDLE hSCManager; + SC_HANDLE hSc; + SC_LOCK scLock; + BOOL bRet = FALSE; + + hSCManager = OpenSCManager(NULL, + NULL, + SC_MANAGER_LOCK); + if (hSCManager) + { + scLock = LockServiceDatabase(hSCManager); + if (scLock) + { + hSc = OpenService(hSCManager, + lpServiceName, + SERVICE_QUERY_CONFIG); + if (hSc) + { + if (ChangeServiceConfig(hSc, + pServiceConfig->dwServiceType, + pServiceConfig->dwStartType, + pServiceConfig->dwErrorControl, + pServiceConfig->lpBinaryPathName, + pServiceConfig->lpLoadOrderGroup, + &pServiceConfig->dwTagId, + pServiceConfig->lpDependencies, + pServiceConfig->lpServiceStartName, + lpPassword, + pServiceConfig->lpDisplayName)) + { + bRet = TRUE; + } + } + + UnlockServiceDatabase(scLock); + } + } + + if (!bRet) + GetError(); + + return bRet; }