Changeset 263
- Timestamp:
- 04/13/10 23:47:25 (22 months ago)
- Location:
- branches/stable
- Files:
-
- 2 added
- 11 edited
-
AutoBuild.h (modified) (1 diff)
-
changelog (modified) (1 diff)
-
include/parsers/ast.cpp (modified) (14 diffs)
-
include/parsers/ast.hpp (modified) (6 diffs)
-
include/parsers/eval.hpp (modified) (10 diffs)
-
include/parsers/grammar.cpp (modified) (2 diffs)
-
include/parsers/helpers.cpp (added)
-
include/parsers/helpers.hpp (added)
-
include/parsers/where.cpp (modified) (5 diffs)
-
modules/CheckEventLog/CheckEventLog-2005.vcproj (modified) (2 diffs)
-
modules/CheckEventLog/CheckEventLog.cpp (modified) (10 diffs)
-
modules/CheckEventLog/Jamfile (modified) (1 diff)
-
modules/CheckEventLog/eventlog_record.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/AutoBuild.h
r262 r263 3 3 // change the FALSE to TRUE for autoincrement of build number 4 4 #define INCREMENT_VERSION TRUE 5 #define FILEVER 0,3,8, 336 #define PRODUCTVER 0,3,8, 337 #define STRFILEVER _T("0.3.8. 33")8 #define STRPRODUCTVER _T("0.3.8. 33")9 #define STRPRODUCTDATE _T("2010-04- 08")5 #define FILEVER 0,3,8,41 6 #define PRODUCTVER 0,3,8,41 7 #define STRFILEVER _T("0.3.8.41") 8 #define STRPRODUCTVER _T("0.3.8.41") 9 #define STRPRODUCTDATE _T("2010-04-13") 10 10 #endif // AUTOBUILD_H -
branches/stable/changelog
r262 r263 6 6 * Fix depend onservice LanManWorkStation (old win) 7 7 * Fix RtlStringFromGUID problem on NT4 8 9 2010-04-09 MickeM 10 + Added support for dates in the new CheckEventLog so the following are equvivalent: 11 CheckEventLog debug=true file=application file=system MaxWarn=1 MaxCrit=1 "filter=generated lt -2d AND severity = 'error'" truncate=800 unique descriptions "syntax=%severity%: %source%: %strings% (%count%)" 12 CheckEventLog debug=true file=application file=system filter=new filter=in MaxWarn=1 MaxCrit=1 filter+generated=gt:2d filter+severity==error truncate=800 unique descriptions "syntax=%severity%: %source%: %strings% (%count%)" debug-threshold=100 13 14 2010-04-09 MickeM 15 + Added "like" keyword to comapre strings like so: 16 "filter=severity = 'error' AND strings like 'SQLEXPRESS'" 17 CheckEventLog debug=true file=application file=system MaxWarn=1 MaxCrit=1 "filter=severity = 'error' AND strings like 'SQLEXPRESS'" truncate=800 unique descriptions "syntax=%severity%: %source%: %strings% (%count%)" 18 * Fixed eventlog check issue (Reverted "major eventlog change" since it did in fact break to many things) 8 19 9 20 2010-04-04 MickeM -
branches/stable/include/parsers/ast.cpp
r262 r263 15 15 #include <parsers/ast.hpp> 16 16 17 #include <simple_timer.hpp> 17 18 18 19 namespace parsers { 19 20 namespace where { 20 21 22 21 23 22 template<typename THandler> … … 84 83 85 84 bool operator()(unary_fun<THandler> & expr) { 86 //expr.subject.force_type(type); 85 if (expr.is_transparent(type)) 86 expr.subject.force_type(type); 87 87 return true; 88 88 } … … 105 105 template<typename THandler> 106 106 void expression_ast<THandler>::force_type(value_type newtype) { 107 std::wcout << _T("Forcing type: ") << type_to_string(type) << _T(" to ") << type_to_string(newtype) << _T(" for ") << to_string() << std::endl; 107 108 if (type == newtype) 108 109 return; … … 153 154 154 155 void operator()(unary_fun<THandler> const& expr) { 155 result << _T("fun:") << expr.name << _T("(");156 result << _T("fun:") << (expr.is_bound()?_T("bound:"):_T("")) << expr.name << _T("("); 156 157 operator()(expr.subject); 157 158 //boost::apply_visitor(*this, expr.subject.expr); … … 195 196 196 197 THandler &handler; 197 visitor_get_int(THandler &handler) : handler(handler) {} 198 value_type type; 199 visitor_get_int(value_type type, THandler &handler) : type(type), handler(handler) {} 198 200 199 201 long long operator()(expression_ast<THandler> const& ast) { 200 std::wcout << _T("GET INT: ") << ast.to_string() << std::endl;201 202 return boost::apply_visitor(*this, ast.expr); 202 203 } … … 208 209 } 209 210 long long operator()(unary_fun<THandler> const& expr) { 210 return expr.evaluate(type _int, handler).get_int(handler);211 return expr.evaluate(type, handler).get_int(handler); 211 212 } 212 213 long long operator()(list_value<THandler> const& expr) { … … 230 231 template<typename THandler> 231 232 long long expression_ast<THandler>::get_int(THandler &handler) const { 232 visitor_get_int<THandler> visitor( handler);233 visitor_get_int<THandler> visitor(type, handler); 233 234 return boost::apply_visitor(visitor, expr); 234 235 } … … 309 310 } 310 311 312 313 template<typename THandler> 314 struct visitor_can_evaluate { 315 typedef bool result_type; 316 317 visitor_can_evaluate() {} 318 319 bool operator()(expression_ast<THandler> const& ast) { 320 return true; 321 } 322 bool operator()(binary_op<THandler> const& expr) { 323 return true; 324 } 325 bool operator()(unary_op<THandler> const& expr) { 326 return true; 327 } 328 bool operator()(unary_fun<THandler> const& expr) { 329 return true; 330 } 331 bool operator()(list_value<THandler> const& expr) { 332 return false; 333 } 334 bool operator()(string_value const& expr) { 335 return false; 336 } 337 bool operator()(int_value const& expr) { 338 return false; 339 } 340 bool operator()(variable<THandler> const& expr) { 341 return false; 342 } 343 bool operator()(nil const& expr) { 344 return false; 345 } 346 }; 311 347 template<typename THandler> 312 348 bool expression_ast<THandler>::can_evaluate() const { 313 if (boost::get<binary_op<THandler> >(&expr)) 314 return true; 315 if (boost::get<unary_op<THandler> >(&expr)) 316 return true; 317 if (boost::get<unary_fun<THandler> >(&expr)) 318 return true; 319 if (boost::get<expression_ast<THandler> >(&expr)) 320 return true; 321 return false; 322 } 349 visitor_can_evaluate<THandler> visitor; 350 return boost::apply_visitor(visitor, expr); 351 } 352 353 template<typename THandler> 354 struct visitor_evaluate { 355 typedef expression_ast<THandler> result_type; 356 357 THandler &handler; 358 value_type type; 359 visitor_evaluate(THandler &handler, value_type type) : handler(handler), type(type) {} 360 361 expression_ast<THandler> operator()(expression_ast<THandler> const& ast) { 362 return ast.evaluate(handler); 363 } 364 expression_ast<THandler> operator()(binary_op<THandler> const& op) { 365 return op.evaluate(handler); 366 } 367 expression_ast<THandler> operator()(unary_op<THandler> const& op) { 368 return op.evaluate(handler); 369 } 370 expression_ast<THandler> operator()(unary_fun<THandler> const& fun) { 371 return fun.evaluate(type, handler); 372 } 373 expression_ast<THandler> operator()(list_value<THandler> const& expr) { 374 return expression_ast<THandler>(int_value(FALSE)); 375 } 376 expression_ast<THandler> operator()(string_value const& expr) { 377 return expression_ast<THandler>(int_value(FALSE)); 378 } 379 expression_ast<THandler> operator()(int_value const& expr) { 380 return expression_ast<THandler>(int_value(FALSE)); 381 } 382 expression_ast<THandler> operator()(variable<THandler> const& expr) { 383 return expression_ast<THandler>(int_value(FALSE)); 384 } 385 expression_ast<THandler> operator()(nil const& expr) { 386 return expression_ast<THandler>(int_value(FALSE)); 387 } 388 }; 389 323 390 template<typename THandler> 324 391 expression_ast<THandler> expression_ast<THandler>::evaluate(THandler &handler) const { 392 visitor_evaluate<THandler> visitor(handler, get_type()); 393 return boost::apply_visitor(visitor, expr); 394 //simple_timer timer(to_string(), true); 395 /* 325 396 if (const binary_op<THandler> *op = boost::get<binary_op<THandler> >(&expr)) 326 397 return op->evaluate(handler); … … 332 403 return ast->evaluate(handler); 333 404 return *this; 405 */ 334 406 } 335 407 … … 351 423 factory<THandler>::bin_op_type impl = factory<THandler>::get_binary_operator(op); 352 424 if (get_return_type(op, type_invalid) == type_bool) { 353 return impl->evaluate(handler, right, left);425 return impl->evaluate(handler, left, right); 354 426 } 355 427 handler.error(_T("Missing operator implementation")); … … 360 432 factory<THandler>::un_op_type impl = factory<THandler>::get_unary_operator(op); 361 433 value_type type = get_return_type(op, type_invalid); 362 if (type == type_bool || type == type_int) {434 if (type_is_int(type)) { 363 435 return impl->evaluate(handler, subject); 364 436 } … … 366 438 return expression_ast<THandler>(int_value(FALSE)); 367 439 } 440 template<typename THandler> 441 bool unary_fun<THandler>::is_bound() const { 442 if (!e_fn.empty()) 443 return true; 444 if (i_fn) 445 return true; 446 return false; 447 } 448 368 449 template<typename THandler> 369 450 expression_ast<THandler> unary_fun<THandler>::evaluate(value_type type, THandler &handler) const { … … 372 453 if (i_fn) 373 454 return i_fn->evaluate(type, handler, subject); 374 handler.error(_T("Missing function binding: ") + name );455 handler.error(_T("Missing function binding: ") + name + _T("bound: ") + strEx::itos(is_bound())); 375 456 return expression_ast<THandler>(int_value(FALSE)); 376 457 } … … 398 479 } 399 480 } 481 template<typename THandler> 482 bool unary_fun<THandler>::is_transparent(value_type type) { 483 // TODO make the handler be allowed to have a say here 484 if (name == _T("neg")) 485 return true; 486 return false; 487 } 488 400 489 401 490 } -
branches/stable/include/parsers/ast.hpp
r262 r263 13 13 #include <boost/function.hpp> 14 14 15 #include <parsers/helpers.hpp> 16 15 17 #include <strEx.h> 16 18 … … 36 38 struct nil {}; 37 39 38 39 40 40 enum operators { 41 op_eq, op_le, op_lt, op_gt, op_ge, op_ne, op_in, op_nin, op_or, op_and, op_inv, op_not 41 op_eq, op_le, op_lt, op_gt, op_ge, op_ne, op_in, op_nin, op_or, op_and, op_inv, op_not, op_like 42 42 }; 43 43 … … 75 75 76 76 inline bool type_is_int(value_type type) { 77 return type == type_int || type == type_bool || (type >= type_custom_int && type < type_custom_int_end);77 return type == type_int || type == type_bool || type == type_date || (type >= type_custom_int && type < type_custom_int_end); 78 78 } 79 79 … … 104 104 return _T("unknown:") + strEx::itos(type); 105 105 } 106 inline std::wstring type_to_string(value_type type) { 107 return to_string(type); 108 } 106 109 107 110 inline std::wstring operator_to_string(operators const& identifier) { … … 112 115 if (identifier == op_eq) 113 116 return _T("="); 117 if (identifier == op_gt) 118 return _T(">"); 119 if (identifier == op_lt) 120 return _T("<"); 121 if (identifier == op_ge) 122 return _T(">="); 123 if (identifier == op_le) 124 return _T("<="); 114 125 return _T("?"); 115 126 } … … 245 256 std::wstring name; 246 257 expression_ast<THandler> subject; 258 bool is_transparent(value_type type); 259 bool is_bound() const; 247 260 }; 248 261 -
branches/stable/include/parsers/eval.hpp
r262 r263 16 16 if (type == type_string) 17 17 return eval_string(type, handler, left, right)?expression_ast<THandler>(int_value(TRUE)):expression_ast<THandler>(int_value(FALSE)); 18 handler.error(_T(" *** MISSING OPERATION IMPL ***"));18 handler.error(_T("missing impl for simple bool binary operator")); 19 19 return expression_ast<THandler>(int_value(FALSE)); 20 20 } … … 29 29 } 30 30 bool eval_string(value_type type, THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const { 31 handler.error(_T(" *** MISSING OPERATION IMPL ***"));31 handler.error(_T("missing impl for and binary operator")); 32 32 // TODO convert strings 33 33 return false; … … 40 40 } 41 41 bool eval_string(value_type type, THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const { 42 handler.error(_T(" *** MISSING OPERATION IMPL ***"));42 handler.error(_T("missing impl for or binary operator")); 43 43 // TODO convert strings 44 44 return false; … … 100 100 }; 101 101 template<typename THandler> 102 struct operator_like : public simple_bool_binary_operator_impl<THandler> { 103 bool eval_int(value_type type, THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const { 104 return false; 105 } 106 bool eval_string(value_type type, THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const { 107 std::wstring s1 = left.get_string(handler); 108 std::wstring s2 = right.get_string(handler); 109 bool res; 110 if (s1.size() > s2.size() && s2.size() > 0) 111 return s1.find(s2) != std::wstring::npos; 112 return s2.find(s1) != std::wstring::npos; 113 //if (res) 114 // std::wcout << _T("Found: ") << s1 << _T(" in ") << s2 << std::endl; 115 return res; 116 }; 117 }; 118 template<typename THandler> 102 119 struct operator_false : public binary_operator_impl<THandler>, unary_operator_impl<THandler>, binary_function_impl<THandler> { 103 120 expression_ast<THandler> evaluate(THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const { 104 handler.error(_T(" *** MISSING OPERATION IMPL ***"));121 handler.error(_T("missing impl for FALSE")); 105 122 return expression_ast<THandler>(int_value(FALSE)); 106 123 } 107 124 expression_ast<THandler> evaluate(THandler &handler, const expression_ast<THandler> &subject) const { 108 handler.error(_T(" *** MISSING OPERATION IMPL ***"));125 handler.error(_T("missing impl for FALSE")); 109 126 return expression_ast<THandler>(int_value(FALSE)); 110 127 } 111 128 expression_ast<THandler> evaluate(parsers::where::value_type type,THandler &handler, const expression_ast<THandler> &subject) const { 112 handler.error(_T(" *** MISSING OPERATION IMPL ***"));129 handler.error(_T("missing impl for FALSE")); 113 130 return expression_ast<THandler>(int_value(FALSE)); 114 131 } … … 117 134 template<typename THandler> 118 135 struct function_convert : public binary_function_impl<THandler> { 136 typename expression_ast<THandler> list_entry; 137 typedef typename expression_ast<THandler>::list_type list_type; 119 138 typename expression_ast<THandler>::list_type list; 120 139 bool single_item; … … 128 147 return expression_ast<THandler>(string_value(list.front().get_string(handler))); 129 148 } 130 handler.error(_T(" Failed to handle type: ") + to_string(type));149 handler.error(_T("1:Failed to handle type: ") + to_string(type)); 131 150 return expression_ast<THandler>(int_value(FALSE)); 132 } else { 133 std::wcout << _T("----------------------------------------------\n"); 134 std::wcout << list.size() << _T("\n"); 135 std::wcout << subject.to_string() << _T("\n"); 136 std::wcout << _T("----------------------------------------------\n"); 137 handler.error(_T("*** MISSING OPERATION IMPL ***")); 151 } 152 if (list.size()==2) { 153 list_type::const_iterator item = list.begin(); 154 list_type::const_iterator unit = item; 155 std::advance(unit, 1); 156 if (type == type_date) { 157 return expression_ast<THandler>(int_value(parse_time((*item).get_int(handler), (*unit).get_string(handler)))); 158 } 159 handler.error(_T("m:Failed to handle type: ") + to_string(type) + _T(" ") + (*item).to_string() + _T(", ") + (*unit).to_string()); 138 160 return expression_ast<THandler>(int_value(FALSE)); 139 161 } 140 } 162 std::wcout << _T("----------------------------------------------\n"); 163 std::wcout << list.size() << _T("\n"); 164 std::wcout << subject.to_string() << _T("\n"); 165 std::wcout << _T("----------------------------------------------\n"); 166 handler.error(_T("Missing implementation for convert function")); 167 return expression_ast<THandler>(int_value(FALSE)); 168 } 169 170 inline long long parse_time(unsigned int value, std::wstring unit) const { 171 long long now = constants::get_now(); 172 if (unit.empty()) 173 return now + value; 174 else if ( (unit == _T("s")) || (unit == _T("S")) ) 175 return now + (value); 176 else if ( (unit == _T("m")) || (unit == _T("M")) ) 177 return now + (value * 60); 178 else if ( (unit == _T("h")) || (unit == _T("H")) ) 179 return now + (value * 60 * 60); 180 else if ( (unit == _T("d")) || (unit == _T("D")) ) 181 return now + (value * 24 * 60 * 60); 182 else if ( (unit == _T("w")) || (unit == _T("W")) ) 183 return now + (value * 7 * 24 * 60 * 60); 184 return now + value; 185 } 186 141 187 }; 142 188 … … 150 196 if (type == type_string) 151 197 return eval_string(type, handler, subject)?expression_ast<THandler>(int_value(TRUE)):expression_ast<THandler>(int_value(FALSE)); 152 handler.error(_T(" *** MISSING OPERATION IMPL ***"));198 handler.error(_T("missing impl for bool unary operator")); 153 199 return expression_ast<THandler>(int_value(FALSE)); 154 200 } … … 158 204 159 205 template<typename THandler> 160 struct operator_not : public unary_operator_impl<THandler> { 206 struct operator_not : public unary_operator_impl<THandler>, binary_function_impl<THandler> { 207 operator_not(const expression_ast<THandler> &subject) {} 208 operator_not() {} 161 209 expression_ast<THandler> evaluate(THandler &handler, const expression_ast<THandler> &subject) const { 162 value_type type = subject.get_type(); 210 return evaluate(subject.get_type(), handler, subject); 211 } 212 expression_ast<THandler> evaluate(value_type type, THandler &handler, const expression_ast<THandler> &subject) const { 163 213 if (type == type_bool) 164 214 return subject.get_int(handler)?expression_ast<THandler>(int_value(TRUE)):expression_ast<THandler>(int_value(FALSE)); 165 215 if (type == type_int) 166 216 return expression_ast<THandler>(int_value(-subject.get_int(handler))); 167 handler.error(_T("*** MISSING OPERATION IMPL ***")); 217 if (type == type_date) { 218 long long now = constants::get_now(); 219 long long val = now - (subject.get_int(handler) - now); 220 return expression_ast<THandler>(int_value(val)); 221 } 222 handler.error(_T("missing impl for NOT operator")); 168 223 return expression_ast<THandler>(int_value(FALSE)); 169 224 } … … 185 240 if (op == op_ne) 186 241 return bin_op_type(new operator_impl::operator_ne<THandler>()); 242 if (op == op_like) 243 return bin_op_type(new operator_impl::operator_like<THandler>()); 187 244 188 245 if (op == op_and) … … 200 257 if (name == _T("auto_convert")) 201 258 return bin_fun_type(new operator_impl::function_convert<THandler>(subject)); 259 if (name == _T("neg")) 260 return bin_fun_type(new operator_impl::operator_not<THandler>(subject)); 202 261 std::wcout << _T("======== UNDEFINED FUNCTION: ") << name << std::endl; 203 262 return bin_fun_type(new operator_impl::operator_false<THandler>()); -
branches/stable/include/parsers/grammar.cpp
r262 r263 66 66 expression_ast<THandler> operator()(wchar_t const unit, expression_ast<THandler> const & vars) const { 67 67 list_value<THandler> args = list_value<THandler>(vars); 68 args += string_value(std::wstring( 0, unit));68 args += string_value(std::wstring(1, unit)); 69 69 return expression_ast<THandler>(unary_fun<THandler>(_T("convert"), args)); 70 70 } … … 154 154 | qi::lit("ge") [_val = op_ge] 155 155 | qi::lit("gt") [_val = op_gt] 156 | qi::lit("like") [_val = op_like] 156 157 ; 157 158 -
branches/stable/include/parsers/where.cpp
r262 r263 47 47 if (src == type_invalid || dst == type_invalid) 48 48 return false; 49 if (dst == type_tbd) 50 return false; 49 51 if (src == type_tbd) 50 return false;51 if (dst == type_tbd)52 52 return true; 53 53 if (src == type_int && dst == type_string) … … 71 71 return type_tbd; 72 72 if (handler.can_convert(rt, lt)) { 73 std::wcout << _T("FORCE 001") << std::endl; 73 74 right.force_type(lt); 74 75 return lt; 75 76 } 76 77 if (handler.can_convert(lt, rt)) { 78 std::wcout << _T("FORCE 002") << std::endl; 77 79 left.force_type(rt); 78 80 return rt; 79 81 } 80 82 if (can_convert(rt, lt)) { 83 std::wcout << _T("FORCE 003") << std::endl; 81 84 right.force_type(lt); 82 85 return rt; 83 86 } 84 87 if (can_convert(lt, rt)) { 88 std::wcout << _T("FORCE 004") << std::endl; 85 89 left.force_type(rt); 86 90 return lt; … … 160 164 161 165 bool operator()(unary_fun<THandler> & expr) { 162 if ((expr.name == _T("convert")) || (expr.name == _T("auto_convert") ) ) {166 if ((expr.name == _T("convert")) || (expr.name == _T("auto_convert") || expr.is_transparent(type_tbd) ) ) { 163 167 return boost::apply_visitor(*this, expr.subject.expr); 164 168 } … … 209 213 210 214 bool operator()(unary_fun<THandler> & expr) { 211 return false; 215 operator()(expr.subject); 216 return true; 212 217 } 213 218 214 219 bool operator()(list_value<THandler> & expr) { 215 // TODO: this is incorrect! 220 BOOST_FOREACH(expression_ast<THandler> e, expr.list) { 221 operator()(e); 222 } 216 223 return true; 217 224 } … … 234 241 template<typename THandler> 235 242 bool parser<THandler>::parse(std::wstring expr) { 243 constants::reset(); 244 std::wcout << _T("Current time is: ") << constants::get_now() << std::endl; 236 245 typedef std::wstring::const_iterator iterator_type; 237 246 typedef where_grammar<THandler, iterator_type> grammar; -
branches/stable/modules/CheckEventLog/CheckEventLog-2005.vcproj
r262 r263 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 > -
branches/stable/modules/CheckEventLog/CheckEventLog.cpp
r262 r263 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); -
branches/stable/modules/CheckEventLog/Jamfile
r262 r263 13 13 ../../include/parsers/grammar.cpp 14 14 ../../include/parsers/where.cpp 15 ../../include/parsers/helpers.cpp 15 16 16 17 : # requirements -
branches/stable/modules/CheckEventLog/eventlog_record.hpp
r262 r263 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.







