Changeset 36c340d in nscp for modules


Ignore:
Timestamp:
02/25/05 21:47:45 (8 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2, stable
Children:
8223547
Parents:
a1e1922
Message:

Multiple fixes in various places.

  • Added threadding blocks "core"
  • Added new Module (CheckDisk)
  • Added new option [log] / debug=1 to enable debug logs.
  • Added more error messages
  • other minor tweaks and fixes
Location:
modules
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • modules/CheckDisk/CheckDisk.cpp

    ra1e1922 r36c340d  
    5050    if (!(wfd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) { 
    5151      size += (wfd.nFileSizeHigh * ((long long)MAXDWORD+1)) + (long long)wfd.nFileSizeLow; 
    52       NSC_LOG_ERROR_STD(wfd.cFileName + ": " + strEx::itos((wfd.nFileSizeHigh * ((long long)MAXDWORD+1)) + (long long)wfd.nFileSizeLow) + " --- " + strEx::itos(size)); 
    5352    } 
    5453    return true; 
     
    8382} 
    8483 
    85  
    86 // CheckDirectorySize&<Directory>&<Directory>... 
    87 // request: CheckDirectorySize&<warning>&<max>&<Directory>&<Directory>... 
    88 // Return: <return state>&<return string>... 
    89 // <return state> 0 - No errors 
    90 //          1 - Unknown 
    91 //          2 - Errors 
    92 // <return string>  <directory> <size mb> ... 
    93 // test: CheckDirectorySize&1024M&4096M&c:\WINDOWS\*.* 
    94 //       CheckDirectorySize 
     84std::string CheckDisk::CheckFileSize(const unsigned int argLen, char **char_args) { 
     85  // CheckFileSize 
     86  // request: CheckFileSize&<option>&<option>... 
     87  // <option>     MaxWarn=<size gmkb> 
     88  //          MaxCrit=<size gmkb> 
     89  //          MinWarn=<size gmkb> 
     90  //          MinCrit=<size gmkb> 
     91  //          ShowAll 
     92  //          File=<path> 
     93  //          File:<shortname>=<path> 
     94  // 
     95  // Return: <return state>&<return string>... 
     96  // <return state> 0 - No errors 
     97  //          1 - Unknown 
     98  //          2 - Errors 
     99  // <size gmkb> is a size with a possible modifier letter (such as G for gigabyte, M for Megabyte, K for kilobyte etc) 
     100  // Examples: 
     101  // <return string>  <directory> <size gmkb> ... |<shortname>=<size>:<warn>:<crit> 
     102  // test: CheckFileSize&ShowAll&MaxWarn=1024M&MaxCrit=4096M&File:WIN=c:\WINDOWS\*.* 
     103  //       CheckFileSize 
     104  // 
     105  // check_nscp -H <ip> -p <port> -s <passwd> -c <commandstring> 
     106  // 
     107  // ./check_nscp -H 192.168.0.167 -p 1234 -s pwd -c 'CheckFileSize&ShowAll&MaxWarn=1024M&MaxCrit=4096M&File:WIN=c:\WINDOWS\*.*' 
     108  // WIN: 1G (2110962363B)|WIN:2110962363:1073741824:4294967296 
     109  NSC_DEBUG_MSG("CheckFileSize"); 
     110  std::string perfData; 
     111  std::string ret; 
     112  NSCAPI::returnCodes returnCode = NSCAPI::returnOK; 
     113  std::list<std::string> args = NSCHelper::makelist(argLen, char_args); 
     114  if (args.empty()) 
     115    return "Missing argument(s)."; 
     116  long long maxWarn = 0; 
     117  long long maxCrit = 0; 
     118  long long minWarn = 0; 
     119  long long minCrit = 0; 
     120  bool bShowAll = false; 
     121  std::list<std::pair<std::string,std::string> > paths; 
     122 
     123  std::list<std::string>::const_iterator cit; 
     124  for (cit=args.begin();cit!=args.end();++cit) { 
     125    std::string arg = *cit; 
     126    std::pair<std::string,std::string> p = strEx::split(arg,"="); 
     127    if (p.first == "File") { 
     128      paths.push_back(std::pair<std::string,std::string>("",p.second)); 
     129    } else if (p.first == "MaxWarn") { 
     130      maxWarn = strEx::stoi64_as_BKMG(p.second); 
     131    } else if (p.first == "MinWarn") { 
     132      minWarn = strEx::stoi64_as_BKMG(p.second); 
     133    } else if (p.first == "MaxCrit") { 
     134      maxCrit = strEx::stoi64_as_BKMG(p.second); 
     135    } else if (p.first == "MinCrit") { 
     136      minCrit = strEx::stoi64_as_BKMG(p.second); 
     137    } else if (p.first == "ShowAll") { 
     138      bShowAll = true; 
     139    } else if (p.first.find(":") != std::string::npos) { 
     140      std::pair<std::string,std::string> p2 = strEx::split(p.first,":"); 
     141      if (p2.first == "File") { 
     142        paths.push_back(std::pair<std::string,std::string>(p2.second,p.second)); 
     143      } else { 
     144        return "Unknown command: " + p.first; 
     145      } 
     146    } else { 
     147      return "Unknown command: " + p.first; 
     148    } 
     149  } 
     150  NSC_DEBUG_MSG_STD("Bounds: critical " + strEx::itos(minCrit) + " > siez > " + strEx::itos(maxCrit)); 
     151  NSC_DEBUG_MSG_STD("Bounds: warning " + strEx::itos(minWarn) + " > size > " + strEx::itos(maxWarn)); 
     152  NSC_DEBUG_MSG_STD("Showall: " + ((bShowAll)?"yeap":"noop")); 
     153 
     154  std::list<std::pair<std::string,std::string> >::const_iterator pit; 
     155  for (pit = paths.begin(); pit != paths.end(); ++pit) { 
     156    std::string tstr; 
     157    GetSize sizeFinder; 
     158    std::string sName = (*pit).first; 
     159    if (sName.empty()) 
     160      sName = (*pit).second; 
     161    RecursiveScanDirectory((*pit).second, sizeFinder); 
     162 
     163    if ((maxCrit!=0) && (sizeFinder.getSize() > maxCrit)) { 
     164      tstr = sName + ": " + strEx::itos_as_BKMG(sizeFinder.getSize()); 
     165      returnCode = NSCAPI::returnCRIT; 
     166    } else if (sizeFinder.getSize() < minCrit) { 
     167      tstr = sName + ": " + strEx::itos_as_BKMG(sizeFinder.getSize()); 
     168      NSCHelper::escalteReturnCodeToCRIT(returnCode); 
     169    } else if ((maxWarn!=0)&&(sizeFinder.getSize() > maxWarn)) { 
     170      tstr = sName +  ": " + strEx::itos_as_BKMG(sizeFinder.getSize()); 
     171      NSCHelper::escalteReturnCodeToWARN(returnCode); 
     172    } else if (sizeFinder.getSize() < minWarn) { 
     173      tstr = sName +  ": " + strEx::itos_as_BKMG(sizeFinder.getSize()); 
     174      NSCHelper::escalteReturnCodeToWARN(returnCode); 
     175    } else if (bShowAll) { 
     176      tstr = sName +  ": " + strEx::itos_as_BKMG(sizeFinder.getSize()); 
     177    } 
     178    if (!(*pit).first.empty()) 
     179      perfData += (*pit).first + "=" + strEx::itos(sizeFinder.getSize()) + ";" + strEx::itos(maxWarn) + ";" + strEx::itos(maxCrit) + " "; 
     180    if (!ret.empty() && !tstr.empty()) 
     181      ret += ", "; 
     182    if (!tstr.empty()) 
     183      ret += tstr; 
     184  } 
     185  if (ret.empty()) 
     186    ret = "OK all file sizes are within bounds."; 
     187  if (!perfData.empty()) 
     188    ret += "|" + perfData; 
     189  return NSCHelper::returnNSCP(returnCode, ret); 
     190} 
     191 
     192 
    95193#define BUFFER_SIZE 1024*64 
    96194 
    97195std::string CheckDisk::handleCommand(const std::string command, const unsigned int argLen, char **char_args) { 
    98   std::string ret; 
    99   if (command == "CheckDirectorySize") { 
    100     std::list<std::string> args = NSCHelper::makelist(argLen, char_args); 
    101     if (args.size() < 3) 
    102       return "Missing argument(s)." + strEx::itos((int)args.size()); 
    103     int iWarn = strEx::stoi64_as_BKMG(args.front()); args.pop_front(); 
    104     int iMax = strEx::stoi64_as_BKMG(args.front()); args.pop_front(); 
    105  
    106     std::list<std::string>::const_iterator cit; 
    107     for (cit=args.begin();cit!=args.end();++cit) { 
    108       GetSize size; 
    109       RecursiveScanDirectory(*cit, size); 
    110       if (!ret.empty()) 
    111         ret += ", "; 
    112       ret += (*cit) + ": " + strEx::itos_as_BKMG(size.getSize()); 
    113     } 
    114   } 
    115   return ret; 
     196  if (command == "CheckFileSize") { 
     197    return CheckFileSize(argLen, char_args); 
     198//  } else if (command == "CheckFileDate") { 
     199  }  
     200  return ""; 
    116201} 
    117202 
  • modules/CheckDisk/CheckDisk.def

    ra1e1922 r36c340d  
    1 LIBRARY NSClientCompat 
     1LIBRARY CheckDisk 
    22 
    33EXPORTS 
  • modules/CheckDisk/CheckDisk.h

    ra1e1922 r36c340d  
    1515  bool hasMessageHandler(); 
    1616  std::string handleCommand(const std::string command, const unsigned int argLen, char **args); 
     17 
     18  // Check commands 
     19  std::string CheckFileSize(const unsigned int argLen, char **char_args); 
    1720}; 
  • modules/CheckDisk/CheckDisk.vcproj

    ra1e1922 r36c340d  
    2020        Name="VCCLCompilerTool" 
    2121        Optimization="0" 
    22         PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CHECKDISK_EXPORTS" 
     22        AdditionalIncludeDirectories="../include;../../include" 
     23        PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_STLP_USE_STATIC_LIB;_STLP_USE_NEWALLOC" 
    2324        MinimalRebuild="TRUE" 
    2425        BasicRuntimeChecks="3" 
     
    3233      <Tool 
    3334        Name="VCLinkerTool" 
    34         OutputFile="$(OutDir)/CheckDisk.dll" 
     35        OutputFile="../../Debug/modules/$(ProjectName).dll" 
    3536        LinkIncremental="2" 
     37        ModuleDefinitionFile="CheckDisk.def" 
    3638        GenerateDebugInformation="TRUE" 
    3739        ProgramDatabaseFile="$(OutDir)/CheckDisk.pdb" 
     
    8688        OptimizeReferences="2" 
    8789        EnableCOMDATFolding="2" 
     90        ImportLibrary="$(OutDir)/CheckDisk.lib" 
     91        TargetMachine="1"/> 
     92      <Tool 
     93        Name="VCMIDLTool"/> 
     94      <Tool 
     95        Name="VCPostBuildEventTool"/> 
     96      <Tool 
     97        Name="VCPreBuildEventTool"/> 
     98      <Tool 
     99        Name="VCPreLinkEventTool"/> 
     100      <Tool 
     101        Name="VCResourceCompilerTool"/> 
     102      <Tool 
     103        Name="VCWebServiceProxyGeneratorTool"/> 
     104      <Tool 
     105        Name="VCXMLDataGeneratorTool"/> 
     106      <Tool 
     107        Name="VCWebDeploymentTool"/> 
     108      <Tool 
     109        Name="VCManagedWrapperGeneratorTool"/> 
     110      <Tool 
     111        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
     112    </Configuration> 
     113    <Configuration 
     114      Name="Dynamic Linkage|Win32" 
     115      OutputDirectory="$(ConfigurationName)" 
     116      IntermediateDirectory="$(ConfigurationName)" 
     117      ConfigurationType="2" 
     118      CharacterSet="2"> 
     119      <Tool 
     120        Name="VCCLCompilerTool" 
     121        AdditionalIncludeDirectories="../include;../../include" 
     122        PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" 
     123        RuntimeLibrary="2" 
     124        UsePrecompiledHeader="3" 
     125        WarningLevel="3" 
     126        Detect64BitPortabilityProblems="TRUE" 
     127        DebugInformationFormat="3"/> 
     128      <Tool 
     129        Name="VCCustomBuildTool"/> 
     130      <Tool 
     131        Name="VCLinkerTool" 
     132        OutputFile="../../Release/modules/$(ProjectName).dll" 
     133        LinkIncremental="1" 
     134        ModuleDefinitionFile="CheckDisk.def" 
     135        GenerateDebugInformation="TRUE" 
     136        SubSystem="2" 
     137        OptimizeReferences="2" 
     138        EnableCOMDATFolding="2" 
     139        ImportLibrary="$(OutDir)/CheckDisk.lib" 
     140        TargetMachine="1"/> 
     141      <Tool 
     142        Name="VCMIDLTool"/> 
     143      <Tool 
     144        Name="VCPostBuildEventTool"/> 
     145      <Tool 
     146        Name="VCPreBuildEventTool"/> 
     147      <Tool 
     148        Name="VCPreLinkEventTool"/> 
     149      <Tool 
     150        Name="VCResourceCompilerTool"/> 
     151      <Tool 
     152        Name="VCWebServiceProxyGeneratorTool"/> 
     153      <Tool 
     154        Name="VCXMLDataGeneratorTool"/> 
     155      <Tool 
     156        Name="VCWebDeploymentTool"/> 
     157      <Tool 
     158        Name="VCManagedWrapperGeneratorTool"/> 
     159      <Tool 
     160        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
     161    </Configuration> 
     162    <Configuration 
     163      Name="Debug Dynamic Linkage|Win32" 
     164      OutputDirectory="$(ConfigurationName)" 
     165      IntermediateDirectory="$(ConfigurationName)" 
     166      ConfigurationType="2" 
     167      CharacterSet="2"> 
     168      <Tool 
     169        Name="VCCLCompilerTool" 
     170        Optimization="0" 
     171        AdditionalIncludeDirectories="../include;../../include" 
     172        PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_STLP_USE_NEWALLOC;_STLP_DEBUG=1" 
     173        MinimalRebuild="TRUE" 
     174        BasicRuntimeChecks="3" 
     175        RuntimeLibrary="3" 
     176        UsePrecompiledHeader="3" 
     177        WarningLevel="3" 
     178        Detect64BitPortabilityProblems="TRUE" 
     179        DebugInformationFormat="4"/> 
     180      <Tool 
     181        Name="VCCustomBuildTool"/> 
     182      <Tool 
     183        Name="VCLinkerTool" 
     184        OutputFile="../../Debug/modules/$(ProjectName).dll" 
     185        LinkIncremental="2" 
     186        ModuleDefinitionFile="CheckDisk.def" 
     187        GenerateDebugInformation="TRUE" 
     188        ProgramDatabaseFile="$(OutDir)/CheckDisk.pdb" 
     189        SubSystem="2" 
    88190        ImportLibrary="$(OutDir)/CheckDisk.lib" 
    89191        TargetMachine="1"/> 
     
    133235        <FileConfiguration 
    134236          Name="Release|Win32"> 
     237          <Tool 
     238            Name="VCCLCompilerTool" 
     239            UsePrecompiledHeader="1"/> 
     240        </FileConfiguration> 
     241        <FileConfiguration 
     242          Name="Dynamic Linkage|Win32"> 
     243          <Tool 
     244            Name="VCCLCompilerTool" 
     245            UsePrecompiledHeader="1"/> 
     246        </FileConfiguration> 
     247        <FileConfiguration 
     248          Name="Debug Dynamic Linkage|Win32"> 
    135249          <Tool 
    136250            Name="VCCLCompilerTool" 
  • modules/CheckEventLog/CheckEventLog.cpp

    ra0528c4 r36c340d  
    2929 
    3030std::string CheckEventLog::getModuleName() { 
    31   return "NSClient compatibility Module."; 
     31  return "Event log Checker."; 
    3232} 
    3333NSCModuleWrapper::module_version CheckEventLog::getModuleVersion() { 
     
    104104      DWORD eventType_; 
    105105      std::string eventSource_; 
     106      boost::regex eventSourceRegExp_; 
    106107      bool notSetValue_; 
    107108      DWORD writtenBeforeDelta_ ; 
     
    109110      DWORD generatedBeforeDelta_; 
    110111      DWORD generatedAfterDelta_; 
     112      boost::regex regexp_; 
    111113 
    112114      searchQueryItem(bool notSetValue)  
     
    115117        generatedBeforeDelta_(0), generatedAfterDelta_(0)  
    116118      {} 
     119      searchQueryItem& operator=(const searchQueryItem &other) { 
     120        eventType_ = other.eventType_; 
     121        eventSource_ = other.eventSource_; 
     122        notSetValue_ = other.notSetValue_; 
     123        writtenBeforeDelta_ = other.writtenBeforeDelta_; 
     124        writtenAfterDelta_ = other.writtenAfterDelta_; 
     125        generatedBeforeDelta_ = other.generatedBeforeDelta_; 
     126        generatedAfterDelta_ = other.generatedAfterDelta_; 
     127        try { 
     128          regexp_ = other.regexp_; 
     129        } catch (const boost::bad_expression e) { 
     130          throw (std::string)"Invalid syntax in regular expression:" + other.toString(); 
     131        } 
     132        try { 
     133          eventSourceRegExp_ = other.eventSourceRegExp_; 
     134        } catch (const boost::bad_expression e) { 
     135          throw (std::string)"Invalid syntax in event source regular expression:" + other.toString(); 
     136        } 
     137        return *this; 
     138      } 
    117139 
    118140      inline bool matchDateWritten(DWORD now, DWORD written) const { 
     
    150172      } 
    151173      inline bool matchSource(std::string eventSource) const { 
    152         if (eventSource_.empty()) 
     174        if ((eventSource_.empty())&&eventSourceRegExp_.empty()) 
    153175          return notSetValue_; 
    154         return eventSource_ == eventSource; 
     176        else if (eventSource_.empty()) 
     177          return boost::regex_match(eventSource, eventSourceRegExp_); 
     178        else if (eventSourceRegExp_.empty()) 
     179          return eventSource_ == eventSource; 
     180        return boost::regex_match(eventSource, eventSourceRegExp_) && (eventSource_ == eventSource); 
     181      } 
     182      inline bool matchRegexp(std::string msg) const { 
     183        if (regexp_.empty()) 
     184          return notSetValue_; 
     185        return boost::regex_match(msg, regexp_); 
    155186      } 
    156187      std::string toString() const { 
    157188        std::stringstream ss; 
     189        ss << "    Regexp: " << regexp_ << std::endl; 
    158190        ss << "    Event type: " << eventType_ << std::endl; 
    159191        ss << "    Event source: " << eventSource_ << std::endl; 
     192        ss << "    Event source Regexp: " << eventSourceRegExp_ << std::endl; 
    160193        ss << "    Written delta: " << writtenAfterDelta_ << " > " << writtenBeforeDelta_ << std::endl; 
    161194        ss << "    Generated delta: " << generatedAfterDelta_ << " > " << generatedBeforeDelta_ << std::endl; 
     
    167200    searchQueryBundle() : require(true), exclude(false) {} 
    168201    std::string toString() { 
    169       return "  Required:\n" + require.toString()  + "\n  Exlude:\n" + exclude.toString(); 
     202      return "  Required:\n" + require.toString()  + "\n  Exclude:\n" + exclude.toString(); 
    170203    } 
    171204  }; 
     
    189222  else if (p.first == "eventSource") 
    190223    item.eventSource_ = p.second; 
     224  else if (p.first == "eventSourceRegexp") { 
     225    try { 
     226      std::string s = p.second; 
     227      NSC_DEBUG_MSG_STD("Attempting to make regexp from: " + s); 
     228      item.eventSourceRegExp_ = s; 
     229      NSC_DEBUG_MSG_STD("success..."); 
     230    } catch (const boost::bad_expression e) { 
     231      item.eventSourceRegExp_ = ""; 
     232      throw (std::string)"Invalid syntax in regular expression:" + p.second; 
     233    } 
     234  } 
     235  else if (p.first == "generatedBeforeDelta") 
     236    item.generatedBeforeDelta_ = strEx::stoi(p.second); 
     237  else if (p.first == "generatedAfterDelta") 
     238    item.generatedAfterDelta_ = strEx::stoi(p.second); 
     239  else if (p.first == "writtenBeforeDelta") 
     240    item.writtenBeforeDelta_ = strEx::stoi(p.second); 
     241  else if (p.first == "writtenAfterDelta") 
     242    item.writtenAfterDelta_ = strEx::stoi(p.second); 
     243  else if (p.first == "regexp") { 
     244    try { 
     245      item.regexp_ = p.second; 
     246    } catch (const boost::bad_expression e) { 
     247      item.regexp_ = ""; 
     248      throw (std::string)"Invalid syntax in regular expression:" + p.second; 
     249    } 
     250  } else 
     251    throw (std::string)"Invalid argument: " + p.first; 
    191252} 
    192253void addToQueryBundle(searchQuery::searchQueryBundle &bundle, std::string arg) { 
     
    196257  else if (p.first == "exclude") 
    197258    addToQueryItem(bundle.exclude, p.second); 
     259  else 
     260    throw (std::string)"Invalid require/exclude: " + p.first; 
    198261} 
    199262void addToQuery(searchQuery &q, std::string arg) { 
     
    212275    else if (p.first == "descriptions") 
    213276      q.descriptions = true; 
    214   } 
    215 } 
    216  
    217 searchQuery buildQury(std::list<std::string> args) { 
    218   searchQuery ret; 
     277    else 
     278      throw (std::string)"Invalid argument: " + arg; 
     279  } 
     280} 
     281 
     282void buildQury(searchQuery &query, std::list<std::string> args) { 
    219283  for (std::list<std::string>::const_iterator it = args.begin(); it!=args.end(); it++) { 
    220     addToQuery(ret, *it); 
    221   } 
    222   return ret; 
    223 } 
    224 // huffa&CheckEventLog&Application&1&<type>&<query>&huffa... 
     284    NSC_DEBUG_MSG_STD("Adding: " + *it); 
     285    addToQuery(query, *it); 
     286  } 
     287} 
     288// CheckEventLog 
    225289// request: CheckEventLog&<logfile>&<Query strings> 
    226290// Return: <return state>&<log entry 1> - <log entry 2>... 
     
    228292//          1 - Unknown 
    229293//          2 - Errors 
     294// Examples: 
     295// CheckEventLog&Application&1&<type>&<query>&huffa... 
     296// CheckEventLog&Application&warn.require.eventType=warning&critical.require.eventType=error&truncate=1024&descriptions&all.exclude.eventSourceRegexp=^(Win|Msi|NSClient\+\+|Userenv|ASP\.NET|LoadPerf|Outlook|Application E|NSClient).* 
    230297#define BUFFER_SIZE 1024*64 
    231298 
     
    233300  if (command != "CheckEventLog") 
    234301    return ""; 
     302  NSCAPI::returnCodes rCode = NSCAPI::returnOK; 
    235303  std::list<std::string> args = NSCHelper::makelist(argLen, char_args); 
    236304  if (args.size() < 2) 
     
    238306  std::string ret; 
    239307  bool critical = false; 
     308  searchQuery query; 
    240309  std::string logFile = args.front(); args.pop_front(); 
    241   searchQuery query = buildQury(args); 
     310  try { 
     311    buildQury(query, args); 
     312  } catch (std::string s) { 
     313    return NSCHelper::returnNSCP(NSCAPI::returnUNKNOWN, s); 
     314  } 
    242315  NSC_DEBUG_MSG_STD("Base query: " + query.toString()); 
    243316 
    244317  HANDLE hLog = OpenEventLog(NULL, logFile.c_str()); 
    245318  if (hLog == NULL)  
    246     return "Could not open the Application event log."; 
     319    return NSCHelper::returnNSCP(NSCAPI::returnUNKNOWN, "Could not open the Application event log."); 
    247320 
    248321  DWORD dwThisRecord, dwRead, dwNeeded; 
     
    271344        query.critical.require.matchSource(record.eventSource()) && 
    272345        query.critical.require.matchDateGenerated(currentTime, record.timeGenerated()) && 
    273         query.critical.require.matchDateWritten(currentTime, record.timeWritten()) 
     346        query.critical.require.matchDateWritten(currentTime, record.timeWritten()) && 
     347        query.critical.require.matchRegexp(record.enumStrings()) 
    274348        ) { 
    275349          match = true; 
     
    278352      if ( query.critical.exclude.matchType(record.eventType()) || 
    279353        query.critical.exclude.matchSource(record.eventSource()) || 
    280         query.critical.require.matchDateGenerated(currentTime, record.timeGenerated()) || 
    281         query.critical.require.matchDateWritten(currentTime, record.timeWritten()) 
     354        query.critical.exclude.matchDateGenerated(currentTime, record.timeGenerated()) || 
     355        query.critical.exclude.matchDateWritten(currentTime, record.timeWritten()) || 
     356        query.critical.exclude.matchRegexp(record.enumStrings()) 
    282357        ) { 
    283358          match = false; 
     
    287362      if ( query.warn.require.matchType(record.eventType()) && 
    288363        query.warn.require.matchSource(record.eventSource()) && 
    289         query.critical.require.matchDateGenerated(currentTime, record.timeGenerated()) && 
    290         query.critical.require.matchDateWritten(currentTime, record.timeWritten()) 
     364        query.warn.require.matchDateGenerated(currentTime, record.timeGenerated()) && 
     365        query.warn.require.matchDateWritten(currentTime, record.timeWritten()) && 
     366        query.warn.require.matchRegexp(record.enumStrings()) 
    291367        ) 
    292368        match = true; 
    293369      if ( query.warn.exclude.matchType(record.eventType()) || 
    294370        query.warn.exclude.matchSource(record.eventSource()) || 
    295         query.critical.require.matchDateGenerated(currentTime, record.timeGenerated()) || 
    296         query.critical.require.matchDateWritten(currentTime, record.timeWritten()) 
     371        query.warn.exclude.matchDateGenerated(currentTime, record.timeGenerated()) || 
     372        query.warn.exclude.matchDateWritten(currentTime, record.timeWritten()) || 
     373        query.warn.exclude.matchRegexp(record.enumStrings()) 
    297374        ) 
    298375        match = false; 
     
    324401    ret = "WARNING: " + ret; 
    325402  else  
    326     ret = "OK: No errors/warnings in eventlog."; 
     403    ret = "OK: No errors/warnings in event log."; 
    327404  if (query.truncate != 0) 
    328405    ret = ret.substr(0, query.truncate); 
    329   return ret; 
     406  return NSCHelper::returnNSCP(rCode, ret); 
    330407} 
    331408 
  • modules/CheckEventLog/CheckEventLog.def

    ra0528c4 r36c340d  
    1 LIBRARY ConsoleLogger 
     1LIBRARY CheckEventLog 
    22 
    33EXPORTS 
  • modules/CheckEventLog/CheckEventLog.vcproj

    ra0528c4 r36c340d  
    2121        Optimization="0" 
    2222        AdditionalIncludeDirectories="../include;../../include" 
    23         PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_STLP_USE_STATIC_LIB;_STLP_USE_NEWALLOC" 
     23        PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_STLP_USE_STATIC_LIB;_STLP_USE_NEWALLOC,_STLP_DEBUG" 
    2424        MinimalRebuild="TRUE" 
    2525        BasicRuntimeChecks="3" 
     
    9696      <Tool 
    9797        Name="VCPreBuildEventTool"/> 
     98      <Tool 
     99        Name="VCPreLinkEventTool"/> 
     100      <Tool 
     101        Name="VCResourceCompilerTool"/> 
     102      <Tool 
     103        Name="VCWebServiceProxyGeneratorTool"/> 
     104      <Tool 
     105        Name="VCXMLDataGeneratorTool"/> 
     106      <Tool 
     107        Name="VCWebDeploymentTool"/> 
     108      <Tool 
     109        Name="VCManagedWrapperGeneratorTool"/> 
     110      <Tool 
     111        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
     112    </Configuration> 
     113    <Configuration 
     114      Name="Dynamic Linkage|Win32" 
     115      OutputDirectory="$(ConfigurationName)" 
     116      IntermediateDirectory="$(ConfigurationName)" 
     117      ConfigurationType="2" 
     118      CharacterSet="2"> 
     119      <Tool 
     120        Name="VCCLCompilerTool" 
     121        AdditionalIncludeDirectories="../include;../../include" 
     122        PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_STLP_USE_STATIC_LIB;SYSTRAY_EXPORTS" 
     123        RuntimeLibrary="0" 
     124        UsePrecompiledHeader="3" 
     125        WarningLevel="3" 
     126        Detect64BitPortabilityProblems="TRUE" 
     127        DebugInformationFormat="3"/> 
     128      <Tool 
     129        Name="VCCustomBuildTool"/> 
     130      <Tool 
     131        Name="VCLinkerTool" 
     132        OutputFile="../../Release/modules/$(ProjectName).dll" 
     133        LinkIncremental="1" 
     134        ModuleDefinitionFile="CheckEventLog.def" 
     135        GenerateDebugInformation="TRUE" 
     136        SubSystem="2" 
     137        OptimizeReferences="2" 
     138        EnableCOMDATFolding="2" 
     139        ImportLibrary="$(OutDir)/CheckEventLog.lib" 
     140        TargetMachine="1"/> 
     141      <Tool 
     142        Name="VCMIDLTool"/> 
     143      <Tool 
     144        Name="VCPostBuildEventTool"/> 
     145      <Tool 
     146        Name="VCPreBuildEventTool" 
     147        ExcludedFromBuild="TRUE"/> 
     148      <Tool 
     149        Name="VCPreLinkEventTool"/> 
     150      <Tool 
     151        Name="VCResourceCompilerTool"/> 
     152      <Tool 
     153        Name="VCWebServiceProxyGeneratorTool"/> 
     154      <Tool 
     155        Name="VCXMLDataGeneratorTool"/> 
     156      <Tool 
     157        Name="VCWebDeploymentTool"/> 
     158      <Tool 
     159        Name="VCManagedWrapperGeneratorTool"/> 
     160      <Tool 
     161        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
     162    </Configuration> 
     163    <Configuration 
     164      Name="Debug Dynamic Linkage|Win32" 
     165      OutputDirectory="$(ConfigurationName)" 
     166      IntermediateDirectory="$(ConfigurationName)" 
     167      ConfigurationType="2" 
     168      CharacterSet="2"> 
     169      <Tool 
     170        Name="VCCLCompilerTool" 
     171        Optimization="0" 
     172        AdditionalIncludeDirectories="../include;../../include" 
     173        PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_STLP_USE_NEWALLOC;_STLP_DEBUG=1" 
     174        MinimalRebuild="TRUE" 
     175        BasicRuntimeChecks="3" 
     176        RuntimeLibrary="3" 
     177        UsePrecompiledHeader="3" 
     178        WarningLevel="3" 
     179        Detect64BitPortabilityProblems="TRUE" 
     180        DebugInformationFormat="4"/> 
     181      <Tool 
     182        Name="VCCustomBuildTool"/> 
     183      <Tool 
     184        Name="VCLinkerTool" 
     185        OutputFile="../../Debug/modules/$(ProjectName).dll" 
     186        LinkIncremental="2" 
     187        ModuleDefinitionFile="CheckEventLog.def" 
     188        GenerateDebugInformation="TRUE" 
     189        ProgramDatabaseFile="$(OutDir)/CheckEventLog.pdb" 
     190        SubSystem="2" 
     191        ImportLibrary="$(OutDir)/CheckEventLog.lib" 
     192        TargetMachine="1"/> 
     193      <Tool 
     194        Name="VCMIDLTool"/> 
     195      <Tool 
     196        Name="VCPostBuildEventTool"/> 
     197      <Tool 
     198        Name="VCPreBuildEventTool" 
     199        ExcludedFromBuild="TRUE"/> 
    98200      <Tool 
    99201        Name="VCPreLinkEventTool"/> 
     
    135237        <FileConfiguration 
    136238          Name="Release|Win32"> 
     239          <Tool 
     240            Name="VCCLCompilerTool" 
     241            UsePrecompiledHeader="1"/> 
     242        </FileConfiguration> 
     243        <FileConfiguration 
     244          Name="Dynamic Linkage|Win32"> 
     245          <Tool 
     246            Name="VCCLCompilerTool" 
     247            UsePrecompiledHeader="1"/> 
     248        </FileConfiguration> 
     249        <FileConfiguration 
     250          Name="Debug Dynamic Linkage|Win32"> 
    137251          <Tool 
    138252            Name="VCCLCompilerTool" 
  • modules/CheckEventLog/stdafx.h

    ra1e1922 r36c340d  
    1010// Windows Header Files: 
    1111#include <windows.h> 
    12  
     12#include <boost/regex.hpp>  
    1313#include <string> 
    14  
    1514 
    1615#include <NSCAPI.h> 
  • modules/ConsoleLogger/ConsoleLogger.vcproj

    ra0528c4 r36c340d  
    111111        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
    112112    </Configuration> 
     113    <Configuration 
     114      Name="Dynamic Linkage|Win32" 
     115      OutputDirectory="$(ConfigurationName)" 
     116      IntermediateDirectory="$(ConfigurationName)" 
     117      ConfigurationType="2" 
     118      CharacterSet="2"> 
     119      <Tool 
     120        Name="VCCLCompilerTool" 
     121        AdditionalIncludeDirectories="../include;../../include" 
     122        PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" 
     123        RuntimeLibrary="2" 
     124        UsePrecompiledHeader="3" 
     125        WarningLevel="3" 
     126        Detect64BitPortabilityProblems="TRUE" 
     127        DebugInformationFormat="3"/> 
     128      <Tool 
     129        Name="VCCustomBuildTool"/> 
     130      <Tool 
     131        Name="VCLinkerTool" 
     132        OutputFile="../../Release/modules/$(ProjectName).dll" 
     133        LinkIncremental="1" 
     134        ModuleDefinitionFile="ConsoleLogger.def" 
     135        GenerateDebugInformation="TRUE" 
     136        SubSystem="2" 
     137        OptimizeReferences="2" 
     138        EnableCOMDATFolding="2" 
     139        ImportLibrary="$(OutDir)/ConsoleLogger.lib" 
     140        TargetMachine="1"/> 
     141      <Tool 
     142        Name="VCMIDLTool"/> 
     143      <Tool 
     144        Name="VCPostBuildEventTool"/> 
     145      <Tool 
     146        Name="VCPreBuildEventTool"/> 
     147      <Tool 
     148        Name="VCPreLinkEventTool"/> 
     149      <Tool 
     150        Name="VCResourceCompilerTool"/> 
     151      <Tool 
     152        Name="VCWebServiceProxyGeneratorTool"/> 
     153      <Tool 
     154        Name="VCXMLDataGeneratorTool"/> 
     155      <Tool 
     156        Name="VCWebDeploymentTool"/> 
     157      <Tool 
     158        Name="VCManagedWrapperGeneratorTool"/> 
     159      <Tool 
     160        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
     161    </Configuration> 
     162    <Configuration 
     163      Name="Debug Dynamic Linkage|Win32" 
     164      OutputDirectory="$(ConfigurationName)" 
     165      IntermediateDirectory="$(ConfigurationName)" 
     166      ConfigurationType="2" 
     167      CharacterSet="2"> 
     168      <Tool 
     169        Name="VCCLCompilerTool" 
     170        Optimization="0" 
     171        AdditionalIncludeDirectories="../include;../../include" 
     172        PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_STLP_USE_NEWALLOC;_STLP_DEBUG=1" 
     173        MinimalRebuild="TRUE" 
     174        BasicRuntimeChecks="3" 
     175        RuntimeLibrary="3" 
     176        UsePrecompiledHeader="3" 
     177        WarningLevel="3" 
     178        Detect64BitPortabilityProblems="TRUE" 
     179        DebugInformationFormat="4"/> 
     180      <Tool 
     181        Name="VCCustomBuildTool"/> 
     182      <Tool 
     183        Name="VCLinkerTool" 
     184        OutputFile="../../Debug/modules/$(ProjectName).dll" 
     185        LinkIncremental="2" 
     186        ModuleDefinitionFile="ConsoleLogger.def" 
     187        GenerateDebugInformation="TRUE" 
     188        ProgramDatabaseFile="$(OutDir)/ConsoleLogger.pdb" 
     189        SubSystem="2" 
     190        ImportLibrary="$(OutDir)/ConsoleLogger.lib" 
     191        TargetMachine="1"/> 
     192      <Tool 
     193        Name="VCMIDLTool"/> 
     194      <Tool 
     195        Name="VCPostBuildEventTool"/> 
     196      <Tool 
     197        Name="VCPreBuildEventTool"/> 
     198      <Tool 
     199        Name="VCPreLinkEventTool"/> 
     200      <Tool 
     201        Name="VCResourceCompilerTool"/> 
     202      <Tool 
     203        Name="VCWebServiceProxyGeneratorTool"/> 
     204      <Tool 
     205        Name="VCXMLDataGeneratorTool"/> 
     206      <Tool 
     207        Name="VCWebDeploymentTool"/> 
     208      <Tool 
     209        Name="VCManagedWrapperGeneratorTool"/> 
     210      <Tool 
     211        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
     212    </Configuration> 
    113213  </Configurations> 
    114214  <References> 
     
    135235        <FileConfiguration 
    136236          Name="Release|Win32"> 
     237          <Tool 
     238            Name="VCCLCompilerTool" 
     239            UsePrecompiledHeader="1"/> 
     240        </FileConfiguration> 
     241        <FileConfiguration 
     242          Name="Dynamic Linkage|Win32"> 
     243          <Tool 
     244            Name="VCCLCompilerTool" 
     245            UsePrecompiledHeader="1"/> 
     246        </FileConfiguration> 
     247        <FileConfiguration 
     248          Name="Debug Dynamic Linkage|Win32"> 
    137249          <Tool 
    138250            Name="VCCLCompilerTool" 
  • modules/FileLogger/FileLogger.vcproj

    ra0528c4 r36c340d  
    111111        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
    112112    </Configuration> 
     113    <Configuration 
     114      Name="Dynamic Linkage|Win32" 
     115      OutputDirectory="$(ConfigurationName)" 
     116      IntermediateDirectory="$(ConfigurationName)" 
     117      ConfigurationType="2" 
     118      CharacterSet="2"> 
     119      <Tool 
     120        Name="VCCLCompilerTool" 
     121        AdditionalIncludeDirectories="../include;../../include" 
     122        PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" 
     123        RuntimeLibrary="2" 
     124        UsePrecompiledHeader="3" 
     125        WarningLevel="3" 
     126        Detect64BitPortabilityProblems="TRUE" 
     127        DebugInformationFormat="3"/> 
     128      <Tool 
     129        Name="VCCustomBuildTool"/> 
     130      <Tool 
     131        Name="VCLinkerTool" 
     132        OutputFile="../../Release/modules/$(ProjectName).dll" 
     133        LinkIncremental="1" 
     134        ModuleDefinitionFile="FileLogger.def" 
     135        GenerateDebugInformation="TRUE" 
     136        SubSystem="2" 
     137        OptimizeReferences="2" 
     138        EnableCOMDATFolding="2" 
     139        ImportLibrary="$(OutDir)/FileLogger.lib" 
     140        TargetMachine="1"/> 
     141      <Tool 
     142        Name="VCMIDLTool"/> 
     143      <Tool 
     144        Name="VCPostBuildEventTool"/> 
     145      <Tool 
     146        Name="VCPreBuildEventTool"/> 
     147      <Tool 
     148        Name="VCPreLinkEventTool"/> 
     149      <Tool 
     150        Name="VCResourceCompilerTool"/> 
     151      <Tool 
     152        Name="VCWebServiceProxyGeneratorTool"/> 
     153      <Tool 
     154        Name="VCXMLDataGeneratorTool"/> 
     155      <Tool 
     156        Name="VCWebDeploymentTool"/> 
     157      <Tool 
     158        Name="VCManagedWrapperGeneratorTool"/> 
     159      <Tool 
     160        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
     161    </Configuration> 
     162    <Configuration 
     163      Name="Debug Dynamic Linkage|Win32" 
     164      OutputDirectory="$(ConfigurationName)" 
     165      IntermediateDirectory="$(ConfigurationName)" 
     166      ConfigurationType="2" 
     167      CharacterSet="2"> 
     168      <Tool 
     169        Name="VCCLCompilerTool" 
     170        Optimization="0" 
     171        AdditionalIncludeDirectories="../include;../../include" 
     172        PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_STLP_USE_NEWALLOC;_STLP_DEBUG=1" 
     173        MinimalRebuild="TRUE" 
     174        BasicRuntimeChecks="3" 
     175        RuntimeLibrary="3" 
     176        UsePrecompiledHeader="3" 
     177        WarningLevel="3" 
     178        Detect64BitPortabilityProblems="TRUE" 
     179        DebugInformationFormat="4"/> 
     180      <Tool 
     181        Name="VCCustomBuildTool"/> 
     182      <Tool 
     183        Name="VCLinkerTool" 
     184        OutputFile="../../Debug/modules/$(ProjectName).dll" 
     185        LinkIncremental="2" 
     186        ModuleDefinitionFile="FileLogger.def" 
     187        GenerateDebugInformation="TRUE" 
     188        ProgramDatabaseFile="$(OutDir)/FileLogger.pdb" 
     189        SubSystem="2" 
     190        ImportLibrary="$(OutDir)/FileLogger.lib" 
     191        TargetMachine="1"/> 
     192      <Tool 
     193        Name="VCMIDLTool"/> 
     194      <Tool 
     195        Name="VCPostBuildEventTool"/> 
     196      <Tool 
     197        Name="VCPreBuildEventTool"/> 
     198      <Tool 
     199        Name="VCPreLinkEventTool"/> 
     200      <Tool 
     201        Name="VCResourceCompilerTool"/> 
     202      <Tool 
     203        Name="VCWebServiceProxyGeneratorTool"/> 
     204      <Tool 
     205        Name="VCXMLDataGeneratorTool"/> 
     206      <Tool 
     207        Name="VCWebDeploymentTool"/> 
     208      <Tool 
     209        Name="VCManagedWrapperGeneratorTool"/> 
     210      <Tool 
     211        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
     212    </Configuration> 
    113213  </Configurations> 
    114214  <References> 
     
    135235        <FileConfiguration 
    136236          Name="Release|Win32"> 
     237          <Tool 
     238            Name="VCCLCompilerTool" 
     239            UsePrecompiledHeader="1"/> 
     240        </FileConfiguration> 
     241        <FileConfiguration 
     242          Name="Dynamic Linkage|Win32"> 
     243          <Tool 
     244            Name="VCCLCompilerTool" 
     245            UsePrecompiledHeader="1"/> 
     246        </FileConfiguration> 
     247        <FileConfiguration 
     248          Name="Debug Dynamic Linkage|Win32"> 
    137249          <Tool 
    138250            Name="VCCLCompilerTool" 
  • modules/NSClientCompat/NSClientCompat.cpp

    r3baaa4d r36c340d  
    4747 */ 
    4848bool NSClientCompat::unloadModule() { 
    49   if (!pdhThread.exitThread()) 
     49  if (!pdhThread.exitThread(20000)) 
    5050    NSC_LOG_ERROR("Could not exit the thread, memory leak and potential corruption may be the result..."); 
    5151  return true; 
  • modules/NSClientCompat/NSClientCompat.vcproj

    ra1e1922 r36c340d  
    113113        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
    114114    </Configuration> 
     115    <Configuration 
     116      Name="Dynamic Linkage|Win32" 
     117      OutputDirectory="$(ConfigurationName)" 
     118      IntermediateDirectory="$(ConfigurationName)" 
     119      ConfigurationType="2" 
     120      CharacterSet="2"> 
     121      <Tool 
     122        Name="VCCLCompilerTool" 
     123        AdditionalIncludeDirectories="../include;../../include" 
     124        PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" 
     125        RuntimeLibrary="2" 
     126        UsePrecompiledHeader="3" 
     127        WarningLevel="3" 
     128        Detect64BitPortabilityProblems="TRUE" 
     129        DebugInformationFormat="3"/> 
     130      <Tool 
     131        Name="VCCustomBuildTool"/> 
     132      <Tool 
     133        Name="VCLinkerTool" 
     134        AdditionalDependencies="Pdh.lib" 
     135        OutputFile="../../Release/modules/$(ProjectName).dll" 
     136        LinkIncremental="1" 
     137        ModuleDefinitionFile="NSClientCompat.def" 
     138        GenerateDebugInformation="TRUE" 
     139        SubSystem="2" 
     140        OptimizeReferences="2" 
     141        EnableCOMDATFolding="2" 
     142        ImportLibrary="$(OutDir)/NSClientCompat.lib" 
     143        TargetMachine="1"/> 
     144      <Tool 
     145        Name="VCMIDLTool"/> 
     146      <Tool 
     147        Name="VCPostBuildEventTool"/> 
     148      <Tool 
     149        Name="VCPreBuildEventTool"/> 
     150      <Tool 
     151        Name="VCPreLinkEventTool"/> 
     152      <Tool 
     153        Name="VCResourceCompilerTool"/> 
     154      <Tool 
     155        Name="VCWebServiceProxyGeneratorTool"/> 
     156      <Tool 
     157        Name="VCXMLDataGeneratorTool"/> 
     158      <Tool 
     159        Name="VCWebDeploymentTool"/> 
     160      <Tool 
     161        Name="VCManagedWrapperGeneratorTool"/> 
     162      <Tool 
     163        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
     164    </Configuration> 
     165    <Configuration 
     166      Name="Debug Dynamic Linkage|Win32" 
     167      OutputDirectory="$(ConfigurationName)" 
     168      IntermediateDirectory="$(ConfigurationName)" 
     169      ConfigurationType="2" 
     170      CharacterSet="2"> 
     171      <Tool 
     172        Name="VCCLCompilerTool" 
     173        Optimization="0" 
     174        AdditionalIncludeDirectories="../include;../../include" 
     175        PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_STLP_USE_NEWALLOC;_STLP_DEBUG=1" 
     176        MinimalRebuild="TRUE" 
     177        BasicRuntimeChecks="3" 
     178        RuntimeLibrary="3" 
     179        UsePrecompiledHeader="3" 
     180        WarningLevel="3" 
     181        Detect64BitPortabilityProblems="TRUE" 
     182        DebugInformationFormat="4"/> 
     183      <Tool 
     184        Name="VCCustomBuildTool"/> 
     185      <Tool 
     186        Name="VCLinkerTool" 
     187        AdditionalDependencies="Pdh.lib" 
     188        OutputFile="../../Debug/modules/$(ProjectName).dll" 
     189        LinkIncremental="2" 
     190        ModuleDefinitionFile="NSClientCompat.def" 
     191        GenerateDebugInformation="TRUE" 
     192        ProgramDatabaseFile="$(OutDir)/NSClientCompat.pdb" 
     193        SubSystem="2" 
     194        ImportLibrary="$(OutDir)/NSClientCompat.lib" 
     195        TargetMachine="1"/> 
     196      <Tool 
     197        Name="VCMIDLTool"/> 
     198      <Tool 
     199        Name="VCPostBuildEventTool"/> 
     200      <Tool 
     201        Name="VCPreBuildEventTool"/> 
     202      <Tool 
     203        Name="VCPreLinkEventTool"/> 
     204      <Tool 
     205        Name="VCResourceCompilerTool"/> 
     206      <Tool 
     207        Name="VCWebServiceProxyGeneratorTool"/> 
     208      <Tool 
     209        Name="VCXMLDataGeneratorTool"/> 
     210      <Tool 
     211        Name="VCWebDeploymentTool"/> 
     212      <Tool 
     213        Name="VCManagedWrapperGeneratorTool"/> 
     214      <Tool 
     215        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
     216    </Configuration> 
    115217  </Configurations> 
    116218  <References> 
     
    153255            UsePrecompiledHeader="1"/> 
    154256        </FileConfiguration> 
     257        <FileConfiguration 
     258          Name="Dynamic Linkage|Win32"> 
     259          <Tool 
     260            Name="VCCLCompilerTool" 
     261            UsePrecompiledHeader="1"/> 
     262        </FileConfiguration> 
     263        <FileConfiguration 
     264          Name="Debug Dynamic Linkage|Win32"> 
     265          <Tool 
     266            Name="VCCLCompilerTool" 
     267            UsePrecompiledHeader="1"/> 
     268        </FileConfiguration> 
    155269      </File> 
    156270    </Filter> 
  • modules/NSClientCompat/PDHCollector.cpp

    ra1e1922 r36c340d  
    8585  pdh.addCounter("\\\\.\\Processor(_total)\\% Processor Time", &cpu); 
    8686 
    87   pdh.open(); 
     87  try { 
     88    pdh.open(); 
     89  } catch (const PDH::PDHException &e) { 
     90    NSC_LOG_ERROR_STD("Failed to open performance counters: " + e.str_); 
     91    return 0; 
     92  } 
    8893 
    8994  startRunning(); 
     
    9398      if (!mutex.hasMutex())  
    9499        NSC_LOG_ERROR("Failed to get Mutex!"); 
    95       else 
    96         pdh.collect(); 
     100      else { 
     101        try { 
     102          pdh.collect(); 
     103        } catch (const PDH::PDHException &e) { 
     104          NSC_LOG_ERROR_STD("Failed to query performance counters: " + e.str_); 
     105        } 
     106      } 
    97107    } 
    98108    Sleep(CHECK_INTERVAL*1000); 
    99109  } 
    100110 
    101   pdh.close(); 
     111  try { 
     112    pdh.close(); 
     113  } catch (const PDH::PDHException &e) { 
     114    NSC_LOG_ERROR_STD("Failed to close performance counters: " + e.str_); 
     115  } 
    102116  NSC_DEBUG_MSG("PDHCollector - shutdown!"); 
    103117  return 0; 
     
    153167/** 
    154168 * 
    155  * Memory commited bytes (your guess is as good as mine to what this is :) 
     169 * Memory committed bytes (your guess is as good as mine to what this is :) 
    156170 * @return Some form of memory check 
    157171 */ 
  • modules/SysTray/SysTray.vcproj

    ra0528c4 r36c340d  
    108108        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
    109109    </Configuration> 
     110    <Configuration 
     111      Name="Dynamic Linkage|Win32" 
     112      OutputDirectory="$(ConfigurationName)" 
     113      IntermediateDirectory="$(ConfigurationName)" 
     114      ConfigurationType="2" 
     115      CharacterSet="2"> 
     116      <Tool 
     117        Name="VCCLCompilerTool" 
     118        AdditionalIncludeDirectories="../include;../../include" 
     119        PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" 
     120        RuntimeLibrary="2" 
     121        UsePrecompiledHeader="3" 
     122        WarningLevel="3" 
     123        Detect64BitPortabilityProblems="TRUE" 
     124        DebugInformationFormat="3"/> 
     125      <Tool 
     126        Name="VCCustomBuildTool"/> 
     127      <Tool 
     128        Name="VCLinkerTool" 
     129        OutputFile="../../Release/modules/$(ProjectName).dll" 
     130        LinkIncremental="1" 
     131        ModuleDefinitionFile="SysTray.def" 
     132        GenerateDebugInformation="TRUE" 
     133        SubSystem="2" 
     134        OptimizeReferences="2" 
     135        EnableCOMDATFolding="2" 
     136        ImportLibrary="$(OutDir)/SysTray.lib" 
     137        TargetMachine="1"/> 
     138      <Tool 
     139        Name="VCMIDLTool"/> 
     140      <Tool 
     141        Name="VCPostBuildEventTool"/> 
     142      <Tool 
     143        Name="VCPreBuildEventTool"/> 
     144      <Tool 
     145        Name="VCPreLinkEventTool"/> 
     146      <Tool 
     147        Name="VCResourceCompilerTool"/> 
     148      <Tool 
     149        Name="VCWebServiceProxyGeneratorTool"/> 
     150      <Tool 
     151        Name="VCXMLDataGeneratorTool"/> 
     152      <Tool 
     153        Name="VCWebDeploymentTool"/> 
     154      <Tool 
     155        Name="VCManagedWrapperGeneratorTool"/> 
     156      <Tool 
     157        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
     158    </Configuration> 
     159    <Configuration 
     160      Name="Debug Dynamic Linkage|Win32" 
     161      OutputDirectory="$(ConfigurationName)" 
     162      IntermediateDirectory="$(ConfigurationName)" 
     163      ConfigurationType="2" 
     164      CharacterSet="2"> 
     165      <Tool 
     166        Name="VCCLCompilerTool" 
     167        Optimization="0" 
     168        AdditionalIncludeDirectories="../include;../../include" 
     169        PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_STLP_USE_NEWALLOC;_STLP_DEBUG=1" 
     170        MinimalRebuild="TRUE" 
     171        BasicRuntimeChecks="3" 
     172        RuntimeLibrary="3" 
     173        UsePrecompiledHeader="3" 
     174        WarningLevel="3" 
     175        Detect64BitPortabilityProblems="TRUE" 
     176        DebugInformationFormat="4"/> 
     177      <Tool 
     178        Name="VCCustomBuildTool"/> 
     179      <Tool 
     180        Name="VCLinkerTool" 
     181        OutputFile="../../Debug/modules/$(ProjectName).dll" 
     182        ModuleDefinitionFile="SysTray.def" 
     183        GenerateDebugInformation="TRUE" 
     184        ImportLibrary="$(OutDir)/SysTray.lib" 
     185        TargetMachine="1"/> 
     186      <Tool 
     187        Name="VCMIDLTool"/> 
     188      <Tool 
     189        Name="VCPostBuildEventTool"/> 
     190      <Tool 
     191        Name="VCPreBuildEventTool"/> 
     192      <Tool 
     193        Name="VCPreLinkEventTool"/> 
     194      <Tool 
     195        Name="VCResourceCompilerTool"/> 
     196      <Tool 
     197        Name="VCWebServiceProxyGeneratorTool"/> 
     198      <Tool 
     199        Name="VCXMLDataGeneratorTool"/> 
     200      <Tool 
     201        Name="VCWebDeploymentTool"/> 
     202      <Tool 
     203        Name="VCManagedWrapperGeneratorTool"/> 
     204      <Tool 
     205        Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 
     206    </Configuration> 
    110207  </Configurations> 
    111208  <References> 
     
    133230            UsePrecompiledHeader="1"/> 
    134231        </FileConfiguration> 
     232        <FileConfiguration 
     233          Name="Dynamic Linkage|Win32"> 
     234          <Tool 
     235            Name="VCCLCompilerTool" 
     236            UsePrecompiledHeader="1"/> 
     237        </FileConfiguration> 
     238        <FileConfiguration 
     239          Name="Debug Dynamic Linkage|Win32"> 
     240          <Tool 
     241            Name="VCCLCompilerTool" 
     242            UsePrecompiledHeader="1"/> 
     243        </FileConfiguration> 
    135244      </File> 
    136245      <File 
Note: See TracChangeset for help on using the changeset viewer.