- Timestamp:
- 04/13/10 23:47:25 (3 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- d1029bd
- Parents:
- 5b10435
- Location:
- modules/CheckEventLog
- Files:
-
- 4 edited
-
CheckEventLog-2005.vcproj (modified) (2 diffs)
-
CheckEventLog.cpp (modified) (10 diffs)
-
Jamfile (modified) (1 diff)
-
eventlog_record.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
modules/CheckEventLog/CheckEventLog-2005.vcproj
r5b10435 redf0848 1572 1572 <FileConfiguration 1573 1573 Name="Debug|x64" 1574 > 1575 <Tool 1576 Name="VCCLCompilerTool" 1577 UsePrecompiledHeader="0" 1578 /> 1579 </FileConfiguration> 1580 </File> 1581 <File 1582 RelativePath="..\..\include\parsers\helpers.cpp" 1583 > 1584 <FileConfiguration 1585 Name="Release|Win32" 1586 > 1587 <Tool 1588 Name="VCCLCompilerTool" 1589 UsePrecompiledHeader="0" 1590 /> 1591 </FileConfiguration> 1592 <FileConfiguration 1593 Name="Release|x64" 1594 > 1595 <Tool 1596 Name="VCCLCompilerTool" 1597 UsePrecompiledHeader="0" 1598 /> 1599 </FileConfiguration> 1600 <FileConfiguration 1601 Name="Debug|Win32" 1602 > 1603 <Tool 1604 Name="VCCLCompilerTool" 1605 UsePrecompiledHeader="0" 1606 /> 1607 </FileConfiguration> 1608 <FileConfiguration 1609 Name="Debug|x64" 1610 > 1611 <Tool 1612 Name="VCCLCompilerTool" 1613 UsePrecompiledHeader="0" 1614 /> 1615 </FileConfiguration> 1616 <FileConfiguration 1617 Name="Distribution|Win32" 1618 > 1619 <Tool 1620 Name="VCCLCompilerTool" 1621 UsePrecompiledHeader="0" 1622 /> 1623 </FileConfiguration> 1624 <FileConfiguration 1625 Name="Distribution|x64" 1626 > 1627 <Tool 1628 Name="VCCLCompilerTool" 1629 UsePrecompiledHeader="0" 1630 /> 1631 </FileConfiguration> 1632 <FileConfiguration 1633 Name="Nightly|Win32" 1634 > 1635 <Tool 1636 Name="VCCLCompilerTool" 1637 UsePrecompiledHeader="0" 1638 /> 1639 </FileConfiguration> 1640 <FileConfiguration 1641 Name="Nightly|x64" 1642 > 1643 <Tool 1644 Name="VCCLCompilerTool" 1645 UsePrecompiledHeader="0" 1646 /> 1647 </FileConfiguration> 1648 <FileConfiguration 1649 Name="Debug-MemCheck|Win32" 1650 > 1651 <Tool 1652 Name="VCCLCompilerTool" 1653 UsePrecompiledHeader="0" 1654 /> 1655 </FileConfiguration> 1656 <FileConfiguration 1657 Name="Debug-MemCheck|x64" 1658 > 1659 <Tool 1660 Name="VCCLCompilerTool" 1661 UsePrecompiledHeader="0" 1662 /> 1663 </FileConfiguration> 1664 <FileConfiguration 1665 Name="OP5|Win32" 1666 > 1667 <Tool 1668 Name="VCCLCompilerTool" 1669 UsePrecompiledHeader="0" 1670 /> 1671 </FileConfiguration> 1672 <FileConfiguration 1673 Name="OP5|x64" 1574 1674 > 1575 1675 <Tool … … 2088 2188 </File> 2089 2189 <File 2190 RelativePath="..\..\include\parsers\helpers.hpp" 2191 > 2192 </File> 2193 <File 2090 2194 RelativePath="..\..\include\NSCHelper.h" 2091 2195 > -
modules/CheckEventLog/CheckEventLog.cpp
r5b10435 redf0848 36 36 37 37 #include <parsers/where.hpp> 38 #include <simple_timer.hpp> 38 39 39 40 #include "simple_registry.hpp" … … 44 45 45 46 46 class simple_timer { 47 unsigned long long start_time; 48 public: 49 simple_timer() { 50 start(); 51 } 52 53 void start() { 54 start_time = getFT(); 55 } 56 unsigned long long stop() { 57 unsigned int ret = getFT() - start_time; 58 start(); 59 return ret/1000; 60 } 61 62 private: 63 unsigned long long getFT() { 64 SYSTEMTIME systemTime; 65 GetSystemTime( &systemTime ); 66 FILETIME fileTime; 67 SystemTimeToFileTime( &systemTime, &fileTime ); 68 return static_cast<unsigned long long>(fileTime.dwHighDateTime) << 32 | fileTime.dwLowDateTime; 69 } 70 71 }; 47 72 48 73 49 BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) … … 154 130 } 155 131 long long get_written() { 156 if (record == NULL) throw _T("Whoops"); return record-> timeWritten();132 if (record == NULL) throw _T("Whoops"); return record->written(); 157 133 } 158 134 long long get_generated() { 159 if (record == NULL) throw _T("Whoops"); return record-> timeGenerated();135 if (record == NULL) throw _T("Whoops"); return record->generated(); 160 136 } 161 137 … … 334 310 if (data.bDebug && (i>data.debugThreshold)) 335 311 NSC_DEBUG_MSG_STD(_T("[") + strEx::itos(i) + _T("] Matched: + ") + (*cit3).second.to_string() + _T(" for: ") + record.render(data.bShowDescriptions, data.syntax)); 336 return true;312 return false; 337 313 } else if (bTmpMatched) { 338 314 if (data.bDebug && (i>data.debugThreshold)) … … 376 352 NSC_DEBUG_MSG_STD(_T("Type resolution succeeded: ") + ast_parser.result_as_tree()); 377 353 354 if (!ast_parser.bind(dummy) || dummy.has_error()) { 355 message = _T("Variable and function binding failed: ") + dummy.get_error(); 356 return false; 357 } 358 if (data.bDebug) 359 NSC_DEBUG_MSG_STD(_T("Binding succeeded: ") + ast_parser.result_as_tree()); 360 378 361 if (!ast_parser.static_eval(dummy) || dummy.has_error()) { 379 362 message = _T("Static evaluation failed: ") + dummy.get_error(); … … 383 366 NSC_DEBUG_MSG_STD(_T("Static evaluation succeeded: ") + ast_parser.result_as_tree()); 384 367 385 if (!ast_parser.bind(dummy) || dummy.has_error()) {386 message = _T("Variable and function binding failed: ") + dummy.get_error();387 return false;388 }389 if (data.bDebug)390 NSC_DEBUG_MSG_STD(_T("Binding succeeded: ") + ast_parser.result_as_tree());391 368 return true; 392 369 } … … 397 374 if (obj.has_error()) { 398 375 NSC_LOG_ERROR_STD(_T("Error: ") + obj.get_error()); 399 400 376 } 401 377 return ret; … … 703 679 filter_impl->boot(); 704 680 681 __time64_t ltime; 682 _time64(<ime); 683 705 684 NSC_DEBUG_MSG_STD(_T("Using: ") + filter_impl->get_name()); 706 685 … … 708 687 return NSCAPI::returnUNKNOWN; 709 688 } 689 710 690 711 691 NSC_DEBUG_MSG_STD(_T("Boot time: ") + strEx::itos(time.stop())); … … 729 709 DWORD dwRead, dwNeeded; 730 710 731 __time64_t ltime;732 _time64(<ime);733 711 734 712 //GetOldestEventLogRecord(hLog, &dwThisRecord); -
modules/CheckEventLog/Jamfile
r5b10435 redf0848 13 13 ../../include/parsers/grammar.cpp 14 14 ../../include/parsers/where.cpp 15 ../../include/parsers/helpers.cpp 15 16 16 17 : # requirements -
modules/CheckEventLog/eventlog_record.hpp
r5b10435 redf0848 13 13 inline __int64 timeWritten() const { 14 14 return (currentTime_-pevlr_->TimeWritten)*1000; 15 } 16 inline __int64 generated() const { 17 return pevlr_->TimeGenerated; 18 } 19 inline __int64 written() const { 20 return pevlr_->TimeWritten; 15 21 } 16 22 inline std::wstring eventSource() const { … … 205 211 strEx::replace(syntax, _T("%generated%"), strEx::format_date(get_time_generated(), date_format)); 206 212 strEx::replace(syntax, _T("%written%"), strEx::format_date(get_time_written(), date_format)); 213 strEx::replace(syntax, _T("%generated-raw%"), strEx::itos(pevlr_->TimeGenerated)); 214 strEx::replace(syntax, _T("%written-raw%"), strEx::itos(pevlr_->TimeWritten)); 207 215 strEx::replace(syntax, _T("%type%"), translateType(eventType())); 208 216 strEx::replace(syntax, _T("%severity%"), translateSeverity(severity()));
Note: See TracChangeset
for help on using the changeset viewer.








