0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

Better error message if CreateService() fails.

This commit is contained in:
Justin Dearing 2010-07-06 04:42:18 +08:00 committed by Eliot
parent 94053aebc8
commit e486468edc

View File

@ -88,11 +88,12 @@ namespace mongo {
SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
SERVICE_AUTO_START, SERVICE_ERROR_NORMAL,
commandLineWide.str().c_str(), NULL, NULL, L"\0\0", NULL, NULL );
if ( schService == NULL ) {
log() << "Error creating service." << endl;
::CloseServiceHandle( schSCManager );
return false;
}
if ( schService == NULL ) {
DWORD err = ::GetLastError();
log() << "Error creating service: " << GetWinErrMsg(err) << endl;
::CloseServiceHandle( schSCManager );
return false;
}
log() << "Service creation successful." << endl;
log() << "Service can be started from the command line via 'net start \"" << toUtf8String(serviceName) << "\"'." << endl;