winevt_c 0.3.0-x86-mingw32 → 0.3.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec281ab900bda5f04c90ce925feb586e29baa7765b92c523054f99dad40874d4
4
- data.tar.gz: 74c01f7f85c5d3d26364883ceba104d1640a286736a654a079e9dbe7198a8186
3
+ metadata.gz: b582cc584307828fc5c24a683380dbe88f924b7a2a3b73193e38a60776a38874
4
+ data.tar.gz: d7391b6fa4177f0a4dffa481e4ed7d604cd51aced9e5a26086b5dd6c03a2752e
5
5
  SHA512:
6
- metadata.gz: 8d92bdbd2c84912e045678c8bff2cf6dfa08dac8472147e68c57a3ac6f5d87d1020fdbeed5a279b999ae50282909569edb5777790bcb20fd62ae9df3111114bb
7
- data.tar.gz: d5e37e9b7066db2b79e26ac89ebd43d92694640a0eeb7a8a9c0e18aa82b34d040bb217a74dca725710fd6ab6941381c1d98c2d4cfd3f2461f3e3ffcf052d1107
6
+ metadata.gz: c426b20aea9074e14b317fb5656c0ff5ea2e844d457d15ef17b951e20333663e4ee7fbddcb43f48b96492a6312791f7cc1b1ba22a8956baca2ae7965ff25be7c
7
+ data.tar.gz: 7afd306db4466ca77d98c6866ad8a8bab6e71cadfa956aa615a7dd46c3b60e41ac6083d10919ab77e14d9c073a4e7bf8bd093074478b885529328ba94b277928
@@ -12,7 +12,7 @@
12
12
  #endif /* __GNUC__ */
13
13
 
14
14
  #ifdef _WIN32_WINNT
15
- # undef WIN32_WINNT
15
+ # undef _WIN32_WINNT
16
16
  #endif /* WIN32_WINNT */
17
17
  #define _WIN32_WINNT MINIMUM_WINDOWS_VERSION
18
18
 
@@ -69,7 +69,7 @@ rb_winevt_subscribe_tail_p(VALUE self, VALUE rb_flag)
69
69
  }
70
70
 
71
71
  static VALUE
72
- rb_winevt_subscribe_subscribe(int argc, VALUE argv, VALUE self)
72
+ rb_winevt_subscribe_subscribe(int argc, VALUE *argv, VALUE self)
73
73
  {
74
74
  VALUE rb_path, rb_query, rb_bookmark;
75
75
  EVT_HANDLE hSubscription = NULL, hBookmark = NULL;
@@ -57,10 +57,9 @@ char* render_event(EVT_HANDLE handle, DWORD flags)
57
57
  FORMAT_MESSAGE_IGNORE_INSERTS,
58
58
  NULL, status,
59
59
  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
60
- &msgBuf, 0, NULL);
61
- result = wstr_to_mbstr(CP_ACP, msgBuf, -1);
60
+ msgBuf, 0, NULL);
62
61
 
63
- rb_raise(rb_eWinevtQueryError, "ErrorCode: %d\nError: %s\n", status, result);
62
+ rb_raise(rb_eWinevtQueryError, "ErrorCode: %d\nError: %s\n", status, msgBuf);
64
63
  }
65
64
 
66
65
  result = wstr_to_mbstr(CP_UTF8, buffer, -1);
@@ -121,10 +120,9 @@ VALUE get_values(EVT_HANDLE handle)
121
120
  FORMAT_MESSAGE_IGNORE_INSERTS,
122
121
  NULL, status,
123
122
  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
124
- &msgBuf, 0, NULL);
125
- result = wstr_to_mbstr(CP_ACP, msgBuf, -1);
123
+ msgBuf, 0, NULL);
126
124
 
127
- rb_raise(rb_eWinevtQueryError, "ErrorCode: %d\nError: %s\n", status, result);
125
+ rb_raise(rb_eWinevtQueryError, "ErrorCode: %d\nError: %s\n", status, msgBuf);
128
126
  }
129
127
 
130
128
  PEVT_VARIANT pRenderedValues = (PEVT_VARIANT)buffer;
@@ -295,10 +293,9 @@ char* get_description(EVT_HANDLE handle)
295
293
  FORMAT_MESSAGE_IGNORE_INSERTS,
296
294
  NULL, status,
297
295
  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
298
- &msgBuf, 0, NULL);
299
- result = wstr_to_mbstr(CP_ACP, msgBuf, -1);
296
+ msgBuf, 0, NULL);
300
297
 
301
- rb_raise(rb_eWinevtQueryError, "ErrorCode: %d\nError: %s\n", status, result);
298
+ rb_raise(rb_eWinevtQueryError, "ErrorCode: %d\nError: %s\n", status, msgBuf);
302
299
  }
303
300
 
304
301
  // Obtain buffer as EVT_VARIANT pointer. To avoid ErrorCide 87 in EvtRender.
Binary file
Binary file
Binary file
data/lib/winevt/query.rb CHANGED
@@ -1,6 +1,14 @@
1
1
  module Winevt
2
2
  class EventLog
3
3
  class Query
4
+ alias_method :each_raw, :each
5
+ def each
6
+ each_raw do |xml, message, string_inserts|
7
+ message = message.gsub(/(%\d+)/, '\1$s')
8
+ message = sprintf(message, *string_inserts) rescue message.gsub(/(%\d+)/, "?")
9
+ yield(xml, message, string_inserts)
10
+ end
11
+ end
4
12
  end
5
13
  end
6
14
  end
@@ -0,0 +1,14 @@
1
+ module Winevt
2
+ class EventLog
3
+ class Subscribe
4
+ alias_method :each_raw, :each
5
+ def each
6
+ each_raw do |xml, message, string_inserts|
7
+ message = message.gsub(/(%\d+)/, '\1$s')
8
+ message = sprintf(message, *string_inserts) rescue message.gsub(/(%\d+)/, "?")
9
+ yield(xml, message, string_inserts)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Winevt
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/lib/winevt.rb CHANGED
@@ -4,6 +4,7 @@ rescue LoadError
4
4
  require "winevt/winevt"
5
5
  end
6
6
  require "winevt/query"
7
+ require "winevt/subscribe"
7
8
  require "winevt/version"
8
9
 
9
10
  module Winevt
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winevt_c
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Hiroshi Hatake
@@ -117,6 +117,7 @@ files:
117
117
  - lib/winevt/2.5/winevt.so
118
118
  - lib/winevt/2.6/winevt.so
119
119
  - lib/winevt/query.rb
120
+ - lib/winevt/subscribe.rb
120
121
  - lib/winevt/version.rb
121
122
  - winevt_c.gemspec
122
123
  homepage: https://github.com/cosmo0920/winevt_c