- Timestamp:
- 06/22/09 13:23:18 (4 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- 4580c6c, cf87b57
- Parents:
- b39c1f3
- Location:
- modules
- Files:
-
- 5 edited
-
CheckDisk/CheckDisk.cpp (modified) (7 diffs)
-
CheckEventLog/CheckEventLog-2005.vcproj (modified) (1 diff)
-
CheckEventLog/CheckEventLog.cpp (modified) (5 diffs)
-
NRPEListener/NRPEListener.cpp (modified) (1 diff)
-
NSCAAgent/NSCAThread.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
modules/CheckDisk/CheckDisk.cpp
rb1ac2fa rdcd5462 25 25 #include <filter_framework.hpp> 26 26 #include <error.hpp> 27 27 #include <file_helpers.hpp> 28 28 29 29 CheckDisk gCheckDisk; … … 115 115 NSC_DEBUG_MSG_STD(_T("Found a file dont do recursive scan: ") + dir); 116 116 // It is a file check it an return (dont check recursivly) 117 pattern_type single_path = split_path(dir); 117 pattern_type single_path = split_path_ex(dir); 118 NSC_DEBUG_MSG_STD(_T("Path is: ") + single_path.first); 118 119 HANDLE hFind = FindFirstFile(dir.c_str(), &wfd); 119 120 if (hFind != INVALID_HANDLE_VALUE) { … … 318 319 }; 319 320 typedef std::pair<std::wstring,std::wstring> pattern_type; 320 pattern_type split_path (std::wstring path) {321 pattern_type split_path_ex(std::wstring path) { 321 322 std::wstring baseDir; 323 if (file_helpers::checks::is_directory(path)) { 324 return pattern_type(path, _T("")); 325 } 322 326 std::wstring::size_type pos = path.find_last_of('\\'); 323 327 if (pos == std::wstring::npos) { … … 325 329 } 326 330 NSC_DEBUG_MSG_STD(_T("Looking for: path: ") + path.substr(0, pos) + _T(", pattern: ") + path.substr(pos+1)); 331 return pattern_type(path.substr(0, pos), path.substr(pos+1)); 332 } 333 334 typedef std::pair<std::wstring,std::wstring> pattern_type; 335 pattern_type split_pattern(std::wstring path) { 336 std::wstring baseDir; 337 if (file_helpers::checks::exists(path)) { 338 return pattern_type(path, _T("")); 339 } 340 std::wstring::size_type pos = path.find_last_of('\\'); 341 if (pos == std::wstring::npos) { 342 pattern_type(path, _T("*.*")); 343 } 344 NSC_DEBUG_MSG_STD(_T("Looking for: pattern: ") + path.substr(0, pos) + _T(", pattern: ") + path.substr(pos+1)); 327 345 return pattern_type(path.substr(0, pos), path.substr(pos+1)); 328 346 } … … 365 383 get_size sizeFinder; 366 384 NSC_error errors; 367 pattern_type splitpath = split_pat h(path.data);385 pattern_type splitpath = split_pattern(path.data); 368 386 recursive_scan<get_size>(splitpath.first, splitpath.second, -1, -1, sizeFinder, &errors); 369 387 if (sizeFinder.hasError()) { … … 653 671 654 672 NSC_error errors; 655 pattern_type splitpath = split_pat h(path);673 pattern_type splitpath = split_pattern(path); 656 674 recursive_scan<find_first_file_info>(splitpath.first, splitpath.second, -1, -1, finder, &errors); 657 675 if (finder.hasError()) { … … 717 735 NSC_error errors; 718 736 for (std::list<std::wstring>::const_iterator pit = paths.begin(); pit != paths.end(); ++pit) { 719 pattern_type path = split_pat h(*pit);737 pattern_type path = split_pattern(*pit); 720 738 recursive_scan<file_filter_function>(path.first, path.second, 0, max_dir_depth, finder, &errors); 721 739 if (finder.hasError()) { -
modules/CheckEventLog/CheckEventLog-2005.vcproj
r3692371 rdcd5462 613 613 Name="VCCLCompilerTool" 614 614 AdditionalIncludeDirectories="../include;../../include" 615 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS; USE_BOOST"615 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;" 616 616 UsePrecompiledHeader="2" 617 617 WarningLevel="3" -
modules/CheckEventLog/CheckEventLog.cpp
r1d53fe0 rdcd5462 29 29 #include <error.hpp> 30 30 #include <map> 31 #include <vector> 31 32 32 33 CheckEventLog gCheckEventLog; … … 315 316 316 317 std::wstring render_message() { 317 DWORD *dwArgs = new DWORD[pevlr_->NumStrings+1]; 318 std::vector<std::wstring> args; 319 TCHAR* *pArgs = new TCHAR*[pevlr_->NumStrings+1]; 318 320 TCHAR* p = reinterpret_cast<TCHAR*>(reinterpret_cast<LPBYTE>(pevlr_) + pevlr_->StringOffset); 319 321 for (unsigned int i =0;i<pevlr_->NumStrings;i++) { 320 dwArgs[i] = reinterpret_cast<DWORD>(p); 322 args.push_back(p); 323 pArgs[i] = p; 321 324 DWORD len = wcslen(p); 322 p += len+1; 323 } 324 325 /* 326 TCHAR **_sz = (TCHAR**)GlobalAlloc(GPTR, (pevlr_->NumStrings)*sizeof(TCHAR *)); 327 register UINT z; 328 TCHAR* p = reinterpret_cast<TCHAR*>(reinterpret_cast<LPBYTE>(pevlr_) + pevlr_->StringOffset); 329 for(unsigned int z = 0; z < pevlr_->NumStrings; z++) { 330 DWORD len = wcslen(p); 331 _sz[z] = (TCHAR *)GlobalAlloc(GPTR, (len+1) * sizeof(TCHAR)); 332 wcscpy_s(_sz[z], len, p); 333 p += len+1; 334 } 335 */ 325 p = &(p[len+1]); 326 //p += len+1; 327 } 328 336 329 std::wstring ret; 337 330 strEx::splitList dlls = strEx::splitEx(get_dll(), _T(";")); 338 331 for (strEx::splitList::const_iterator cit = dlls.begin(); cit != dlls.end(); ++cit) { 339 332 //std::wstring msg = error::format::message::from_module((*cit), eventID(), _sz); 340 std::wstring msg = error::format::message::from_module((*cit), eventID(), dwArgs); 341 if (msg.empty()) { 342 msg = error::format::message::from_module((*cit), pevlr_->EventID, dwArgs); 333 std::wstring msg; 334 try { 335 msg = error::format::message::from_module_x64((*cit), eventID(), pArgs, pevlr_->NumStrings); 336 if (msg.empty()) { 337 msg = error::format::message::from_module_x64((*cit), pevlr_->EventID, pArgs, pevlr_->NumStrings); 338 } 339 } catch (...) { 340 msg = _T("Unknown exception getting message"); 343 341 } 344 342 strEx::replace(msg, _T("\n"), _T(" ")); … … 354 352 } 355 353 } 356 delete [] dwArgs;354 delete [] pArgs; 357 355 return ret; 358 356 } … … 597 595 return NSCAPI::returnUNKNOWN; 598 596 } 597 bool buffer_error_reported = false; 599 598 600 599 for (std::list<std::wstring>::const_iterator cit2 = files.begin(); cit2 != files.end(); ++cit2) { … … 628 627 DWORD err = GetLastError(); 629 628 if (err == ERROR_INSUFFICIENT_BUFFER) { 630 NSC_LOG_ERROR_STD(_T("EvenlogBuffer is too small change the value of ") + EVENTLOG_BUFFER + _T("=") + strEx::itos(dwNeeded+1) + _T(" under [EventLog] in nsc.ini : ") + error::lookup::last_error(err)); 629 if (!buffer_error_reported) { 630 NSC_LOG_ERROR_STD(_T("EvenlogBuffer is too small change the value of ") + EVENTLOG_BUFFER + _T("=") + strEx::itos(dwNeeded+1) + _T(" under [EventLog] in nsc.ini : ") + error::lookup::last_error(err)); 631 buffer_error_reported = true; 632 } 631 633 } else if (err == ERROR_HANDLE_EOF) { 632 634 break; -
modules/NRPEListener/NRPEListener.cpp
rb39c1f3 rdcd5462 324 324 } catch (NRPEPacket::NRPEPacketException e) { 325 325 NSC_LOG_ERROR_STD(_T("NRPESocketException: ") + e.getMessage()); 326 NRPEPacket err(NRPEPacket::responsePacket, NRPEPacket::version2, NSCAPI::returnUNKNOWN, _T("Could not construct return paket in NRPE handler check clientside (nsclient.log) logs..."), buffer_length_);327 326 try { 328 block.copyFrom(out.getBuffer(), out.getBufferLength()); 327 NRPEPacket err(NRPEPacket::responsePacket, NRPEPacket::version2, NSCAPI::returnUNKNOWN, _T("Could not construct return paket in NRPE handler check clientside (nsclient.log) logs..."), buffer_length_); 328 block.copyFrom(err.getBuffer(), err.getBufferLength()); 329 329 } catch (NRPEPacket::NRPEPacketException e) { 330 330 NSC_LOG_ERROR_STD(_T("NRPESocketException (again): ") + e.getMessage()); -
modules/NSCAAgent/NSCAThread.cpp
rb1ac2fa rdcd5462 74 74 else 75 75 timeDelta_ = strEx::stoui_as_time(tmpstr); 76 timeDelta_ = timeDelta_ / 1000; 76 77 NSC_DEBUG_MSG_STD(_T("Time difference for NSCA server is: ") + strEx::itos(timeDelta_)); 77 78 checkIntervall_ = NSCModuleHelper::getSettingsInt(NSCA_AGENT_SECTION_TITLE, NSCA_INTERVAL, NSCA_INTERVAL_DEFAULT);
Note: See TracChangeset
for help on using the changeset viewer.








