- Timestamp:
- 02/12/09 20:28:56 (4 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- b1ac2fa
- Parents:
- 04f2743
- Location:
- include
- Files:
-
- 5 edited
-
REGSettings.h (modified) (2 diffs)
-
ServiceCmd.cpp (modified) (8 diffs)
-
Socket.h (modified) (2 diffs)
-
checkHelpers.hpp (modified) (3 diffs)
-
config.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
include/REGSettings.h
rfebff5f r1d53fe0 148 148 DWORD type; 149 149 DWORD cbData = sizeof(DWORD); 150 BYTE *bData = new BYTE[cbData+1]; 151 bRet = RegQueryValueEx(hTemp, lpszKey, NULL, &type, bData, &cbData); 150 DWORD buffer; 151 //BYTE *bData = new BYTE[cbData+1]; 152 bRet = RegQueryValueEx(hTemp, lpszKey, NULL, &type, reinterpret_cast<LPBYTE>(&buffer), &cbData ); 152 153 if (type != REG_DWORD) { 153 154 bRet = -1; … … 155 156 RegCloseKey(hTemp); 156 157 if (bRet == ERROR_SUCCESS) { 157 ret = static_cast<DWORD>(*bData);158 } 159 delete [] bData;158 ret = buffer; 159 } 160 //delete [] bData; 160 161 return ret; 161 162 } -
include/ServiceCmd.cpp
r3692371 r1d53fe0 21 21 #include <iostream> 22 22 #include <msvc_wrappers.h> 23 #include <error.hpp> 23 24 24 25 namespace serviceControll { … … 45 46 schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); 46 47 if (!schSCManager) 47 throw SCException(_T("OpenSCManager failed ."));48 throw SCException(_T("OpenSCManager failed:") + error::lookup::last_error()); 48 49 schService = CreateService( 49 50 schSCManager, // SCManager database … … 67 68 throw SCException(_T("Service already installed!")); 68 69 } 69 throw SCException(_T("Unable to install service.") , err);70 throw SCException(_T("Unable to install service.") + error::lookup::last_error(err)); 70 71 } 71 72 std::wcout << _T("Service ") << szName << _T(" installed...") << std::endl;; … … 84 85 schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); 85 86 if (!schSCManager) 86 throw SCException(_T("OpenSCManager failed ."));87 throw SCException(_T("OpenSCManager failed: ") + error::lookup::last_error()); 87 88 schService = OpenService(schSCManager, szName, SERVICE_ALL_ACCESS); 88 89 if (!schService) { 89 90 DWORD err = GetLastError(); 90 91 CloseServiceHandle(schSCManager); 91 throw SCException(_T("Unable to open service ."), err);92 throw SCException(_T("Unable to open service: ") + error::lookup::last_error(err)); 92 93 } 93 94 BOOL result = ChangeServiceConfig(schService, dwServiceType, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE , NULL, NULL, NULL, … … 118 119 DWORD err = GetLastError(); 119 120 CloseServiceHandle(schSCManager); 120 throw SCException(_T("Unable to open service ."), err);121 throw SCException(_T("Unable to open service: ") + error::lookup::last_error(err)); 121 122 } 122 123 … … 150 151 schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS ); 151 152 if (!schSCManager) 152 throw SCException(_T("OpenSCManager failed ."));153 throw SCException(_T("OpenSCManager failed: ") + error::lookup::last_error()); 153 154 schService = OpenService(schSCManager, name.c_str(), SERVICE_ALL_ACCESS); 154 155 if (schService) { … … 172 173 CloseServiceHandle(schService); 173 174 } else { 174 CloseServiceHandle(schSCManager); 175 throw SCException(_T("OpenService failed.")); 175 std::wstring err = _T("OpenService failed: ") + error::lookup::last_error(); 176 CloseServiceHandle(schSCManager); 177 throw SCException(err); 176 178 } 177 179 CloseServiceHandle(schSCManager); … … 187 189 schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS ); 188 190 if (!schSCManager) 189 throw SCException(_T("OpenSCManager failed ."));191 throw SCException(_T("OpenSCManager failed: ") + error::lookup::last_error()); 190 192 schService = OpenService(schSCManager, name.c_str(), SERVICE_ALL_ACCESS); 191 193 if (schService) { -
include/Socket.h
r846bbe4 r1d53fe0 507 507 bindAddres_ = INADDR_ANY; 508 508 listenQue_ = queLength; 509 threadManager_.createThread(this); 509 try { 510 threadManager_.createThread(this); 511 } catch (ThreadException e) { 512 throw SocketException(_T("Could not start thread (got exception in thread): ") + e.e_); 513 } 510 514 } 511 515 virtual void StopListener() { … … 518 522 } catch (ThreadException e) { 519 523 tBase::close(); 520 throw SocketException(_T("Could not terminate thread (got exception in thread) ."));524 throw SocketException(_T("Could not terminate thread (got exception in thread): ") + e.e_); 521 525 } 522 526 tBase::close(); -
include/checkHelpers.hpp
r04f2743 r1d53fe0 137 137 std::wstring tstr; 138 138 if (crit.check(value, getAlias(), tstr, critical)) { 139 std::wcout << _T("crit") << std::endl;139 //std::wcout << _T("crit") << std::endl; 140 140 NSCHelper::escalteReturnCodeToCRIT(returnCode); 141 141 } else if (warn.check(value, getAlias(), tstr, warning)) { 142 std::wcout << _T("warn") << std::endl;142 //std::wcout << _T("warn") << std::endl; 143 143 NSCHelper::escalteReturnCodeToWARN(returnCode); 144 144 }else if (show == showLong) { 145 std::wcout << _T("long") << std::endl;145 //std::wcout << _T("long") << std::endl; 146 146 tstr = getAlias() + _T(": ") + TContents::toStringLong(value); 147 147 }else if (show == showShort) { 148 std::wcout << _T("short") << std::endl;148 //std::wcout << _T("short") << std::endl; 149 149 tstr = getAlias() + _T(": ") + TContents::toStringShort(value); 150 150 } 151 std::wcout << _T("result: ") << tstr << _T("--") << std::endl;152 151 if (perfData) 153 152 perf += gatherPerfData(value); … … 682 681 return true; 683 682 } else { 683 NSC_DEBUG_MSG_STD(_T("Missing bounds for check: ") + lable); 684 684 //std::cout << "No bounds specified..." << std::endl; 685 685 } … … 757 757 } else { 758 758 NSC_DEBUG_MSG_STD(_T("Missing bounds for maxmin-bounds check: ") + alias); 759 return min.gatherPerfData(alias, value, 0, 0); 759 760 } 760 761 return _T(""); -
include/config.h
rbb8b6d1 r1d53fe0 184 184 #define NSCA_CACHE_HOST _T("cache_hostname") 185 185 #define NSCA_CACHE_HOST_DEFAULT 0 186 #define NSCA_TIME_DELTA _T("time_delay") 187 #define NSCA_TIME_DELTA_DEFAULT _T("0") 186 188 187 189 #define C_SYSTEM_SVC_ALL_0 _T("check_all_services[SERVICE_BOOT_START]")
Note: See TracChangeset
for help on using the changeset viewer.








