Author: rmeggins
Update of /cvs/dirsec/winsync/passwordsync/passsync
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv30046/passwordsync/passsync
Modified Files:
ntservice.cpp
Log Message:
Resolves: bug 482892
Bug Description: Passsync service start and stop messages in Windows event
viewer are not logged correctly
Reviewed by: nkinder (Thanks!)
Fix Description: For some reason, the code was not detecting that the service
had already been installed and was installing it again. We do not need to
install the service in this code, that is done in the .msi file now. I just
got rid of that old code.
Platforms tested: Windows 2003 Server
Flag Day: no
Doc impact: no
Index: ntservice.cpp
===================================================================
RCS file: /cvs/dirsec/winsync/passwordsync/passsync/ntservice.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ntservice.cpp 12 Mar 2009 14:39:40 -0000 1.7
+++ ntservice.cpp 17 Mar 2009 15:40:51 -0000 1.8
@@ -199,40 +199,6 @@
// Get the executable file path
TCHAR szFilePath[_MAX_PATH];
::GetModuleFileName(NULL, szFilePath, sizeof(szFilePath)/sizeof(*szFilePath));
- int didinstall = FALSE;
-
- // install if not already installed
- if (!IsInstalled()) {
- // Open the Service Control Manager
- SC_HANDLE hSCM = ::OpenSCManager(NULL, // local machine
- NULL, // ServicesActive database
- SC_MANAGER_ALL_ACCESS); // full access
- if (!hSCM) return FALSE;
-
- // Create the service
- SC_HANDLE hService = ::CreateService(hSCM,
- m_szServiceName,
- m_szServiceName,
- SERVICE_ALL_ACCESS,
- SERVICE_WIN32_OWN_PROCESS,
- SERVICE_DEMAND_START, // start condition
- SERVICE_ERROR_NORMAL,
- szFilePath,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL);
- if (!hService) {
- ::CloseServiceHandle(hSCM);
- return FALSE;
- }
- // clean up
- ::CloseServiceHandle(hService);
- ::CloseServiceHandle(hSCM);
- didinstall = TRUE;
- }
-
// make registry entries to support logging messages
// Add the source name as a subkey under the Application
// key in the EventLog service portion of the registry.
@@ -268,10 +234,6 @@
sizeof(DWORD));
::RegCloseKey(hKey);
- if (didinstall) {
- LogEvent(EVENTLOG_INFORMATION_TYPE, EVMSG_INSTALLED, m_szServiceName);
- }
-
return TRUE;
}
Show replies by thread