winevt_c 0.5.0 → 0.5.1

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: 2c5fe0d33a16157b78dd2d2dba8f35aab97d17fd4a331dcbcca982dd1b19bf6c
4
- data.tar.gz: 9a54b57a79cce2295c03b640d66f09bca1f862b8514e9eebd4e0ec424ad1a134
3
+ metadata.gz: 75744148e9ca94521748b06833b718e340adff8024aa2d2c95560561b2f78067
4
+ data.tar.gz: c9ccac540fa71ee98862084e765d93ef99e82e0da8ffa539bad5fe01ade3206b
5
5
  SHA512:
6
- metadata.gz: 0cdf4bcb81c5cd0cbd3c26a552e9310cb14cc528daa22d0216ad9af86e65978f9757267677b7a399754cc1f6e490df84616fb1af943ad8494239efc25a4c5bcb
7
- data.tar.gz: f10753a472d9306ec0ac217e5186787382d33921809a7d48cc3cf0a99abe7dacab2c1b784a2bcc6444fc42a51f7d8c6c51fc81648e2adb71e5ac6cd3059e0999
6
+ metadata.gz: c3fa73323e1d79dc1336c8d9d0984f9a00e0f683b38e4fcbd9ffc46c101a6e5727bf542210c59171e997c9fea0662b8b1078a9f7b44748c933623b47de5693c2
7
+ data.tar.gz: 2e32151fa6b178f98c7c6f97e28e5cbcdd83050bb738cade7cf85f23ba6faf6b8dd09c81c8d51a7460428dff57345fd922aab405b4756b2311632badca8abd2a
@@ -1,5 +1,4 @@
1
1
  require 'winevt'
2
- require 'rexml/document'
3
2
 
4
3
  @query = Winevt::EventLog::Query.new("Application", "*[System[(Level <= 3) and TimeCreated[timediff(@SystemTime) <= 86400000]]]")
5
4
 
@@ -1,22 +1,13 @@
1
1
  require 'winevt'
2
- require 'rexml/document'
3
2
 
4
3
  @subscribe = Winevt::EventLog::Subscribe.new
5
4
  @subscribe.tail = true
6
- @subscribe.subscribe("Security", "*[System[(Level <= 4) and TimeCreated[timediff(@SystemTime) <= 86400000]]]")
7
- while (1) do
8
- if @subscribe.next
9
- eventlog = @subscribe.render
10
- message = @subscribe.message
11
- string_inserts = @subscribe.string_inserts
12
- message = message.gsub(/(%\d+)/, '\1$s')
13
- message = sprintf(message, *string_inserts)
14
-
5
+ @subscribe.subscribe(
6
+ "Security", "*[System[(Level <= 4) and TimeCreated[timediff(@SystemTime) <= 86400000]]]"
7
+ )
8
+ while true do
9
+ @subscribe.each do |eventlog, message, string_inserts|
15
10
  puts ({eventlog: eventlog, data: message})
16
- @subscribe.close_handle # Dispose EVT_HANDLE variable which is allocated in EvtNext
17
- else
18
- printf(".")
19
- sleep(1)
20
11
  end
12
+ sleep(1)
21
13
  end
22
- puts @subscribe.bookmark
@@ -27,7 +27,7 @@ wstr_to_rb_str(UINT cp, const WCHAR *wstr, int clen)
27
27
  VALUE vstr;
28
28
  CHAR *ptr;
29
29
  int len = WideCharToMultiByte(cp, 0, wstr, clen, nullptr, 0, nullptr, nullptr);
30
- ptr = (CHAR*)ALLOCV_N(CHAR, vstr, len);
30
+ ptr = ALLOCV_N(CHAR, vstr, len);
31
31
  WideCharToMultiByte(cp, 0, wstr, clen, ptr, len, nullptr, nullptr);
32
32
  VALUE str = rb_utf8_str_new_cstr(ptr);
33
33
  ALLOCV_END(vstr);
@@ -1,3 +1,3 @@
1
1
  module Winevt
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winevt_c
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Hatake
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-09 00:00:00.000000000 Z
11
+ date: 2019-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler