From: Bert Hubert Date: Sun, 30 Apr 2006 15:25:15 +0000 (+0000) Subject: reinstated hooks to NT event log X-Git-Tag: rec-3.1.2~51 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b55fa468520de78e7168e8cb4916cb7a68570735;p=pdns reinstated hooks to NT event log git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@813 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/ntservice.cc b/pdns/ntservice.cc index b92f03a9f..998266036 100644 --- a/pdns/ntservice.cc +++ b/pdns/ntservice.cc @@ -68,8 +68,9 @@ bool NTService::registerService( const std::string & description, bool registerL return false; // Could not open the Service Control Manager. GetModuleFileName( NULL, temp, sizeof( temp )); - + str << temp << " --ntservice"; + if ( CreateService( sc, getServiceName().c_str(), @@ -83,11 +84,11 @@ bool NTService::registerService( const std::string & description, bool registerL NULL, NULL, NULL, - NULL ) == NULL && GetLastError() != ERROR_SERVICE_EXISTS ) + NULL ) == NULL ) { - return false; // Don't we all like functions with 43 billion parameters? + if(GetLastError() != ERROR_SERVICE_EXISTS) + return false; // Don't we all like functions with 43 billion parameters? } - CloseServiceHandle( sc ); str.str( "" ); @@ -133,7 +134,7 @@ bool NTService::registerService( const std::string & description, bool registerL GetCurrentDirectory( sizeof( path ), path ); // FIXME: This really should be: str << path << "\\" << getServiceName() << "msg.dll"; - str << path << "\\pdnsmsg.dll"; + str << path << "\\Eventlogger.dll"; if ( RegSetValueEx( pkey, "EventMessageFile", 0, REG_SZ, reinterpret_cast< const unsigned char * >( str.str().c_str()), str.str().length()) != ERROR_SUCCESS ) { RegCloseKey( pkey );