winevt_c 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +15 -0
- data/Rakefile +2 -2
- data/ext/winevt/winevt_c.h +1 -1
- data/ext/winevt/winevt_subscribe.c +36 -12
- data/lib/winevt/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1e26f9f7aef69fdf599f08c4c309fd1a60e00178d0a4db7a24b76cde7376254
|
4
|
+
data.tar.gz: 20e705a60f389912acd1594eecd0ea1a79230de00e887b0033016ccf72d8383f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec1d0dfbf4c1ec66619a709e012c76ab5487944f1c2970520b09ed46d9f3689d8ab5dcfc4499e34aeb2cde111f571e652cbf6bf337c20c5b7d5d836ef602d4ab
|
7
|
+
data.tar.gz: '01842dfd20afb70a08a928baf7d38c1c3c3df79a7ffd9303275d25623520b1f3e81adfcfcd43a730e8e36cb6931933c48871bd72bb3a21b9bbc33bde91bda366'
|
data/.travis.yml
ADDED
data/Rakefile
CHANGED
@@ -27,8 +27,8 @@ desc 'Build gems for Windows per rake-compiler-dock'
|
|
27
27
|
task 'gem:native' do
|
28
28
|
# See RUBY_CC_VERSION in https://github.com/rake-compiler/rake-compiler-dock/blob/master/Dockerfile.mri
|
29
29
|
RakeCompilerDock.sh <<-EOS
|
30
|
-
gem install bundler --no-doc && bundle
|
31
|
-
|
30
|
+
gem install bundler yard --no-doc && bundle
|
31
|
+
rake cross native gem RUBY_CC_VERSION=2.4.0:2.5.0:2.6.0
|
32
32
|
EOS
|
33
33
|
end
|
34
34
|
|
data/ext/winevt/winevt_c.h
CHANGED
@@ -88,42 +88,43 @@ rb_winevt_subscribe_initialize(VALUE self)
|
|
88
88
|
winevtSubscribe->lastTime = 0;
|
89
89
|
winevtSubscribe->currentRate = 0;
|
90
90
|
winevtSubscribe->renderAsXML = TRUE;
|
91
|
+
winevtSubscribe->readExistingEvents = TRUE;
|
91
92
|
|
92
93
|
return Qnil;
|
93
94
|
}
|
94
95
|
|
95
96
|
/*
|
96
|
-
* This method specifies whether
|
97
|
+
* This method specifies whether read existing events or not.
|
97
98
|
*
|
98
|
-
* @param
|
99
|
+
* @param rb_read_existing_events_p [Boolean]
|
99
100
|
*/
|
100
101
|
static VALUE
|
101
|
-
|
102
|
+
rb_winevt_subscribe_set_read_existing_events(VALUE self, VALUE rb_read_existing_events_p)
|
102
103
|
{
|
103
104
|
struct WinevtSubscribe* winevtSubscribe;
|
104
105
|
|
105
106
|
TypedData_Get_Struct(
|
106
107
|
self, struct WinevtSubscribe, &rb_winevt_subscribe_type, winevtSubscribe);
|
107
108
|
|
108
|
-
winevtSubscribe->
|
109
|
+
winevtSubscribe->readExistingEvents = RTEST(rb_read_existing_events_p);
|
109
110
|
|
110
111
|
return Qnil;
|
111
112
|
}
|
112
113
|
|
113
114
|
/*
|
114
|
-
* This method returns whether
|
115
|
+
* This method returns whether read existing events or not.
|
115
116
|
*
|
116
117
|
* @return [Boolean]
|
117
118
|
*/
|
118
119
|
static VALUE
|
119
|
-
|
120
|
+
rb_winevt_subscribe_read_existing_events_p(VALUE self)
|
120
121
|
{
|
121
122
|
struct WinevtSubscribe* winevtSubscribe;
|
122
123
|
|
123
124
|
TypedData_Get_Struct(
|
124
125
|
self, struct WinevtSubscribe, &rb_winevt_subscribe_type, winevtSubscribe);
|
125
126
|
|
126
|
-
return winevtSubscribe->
|
127
|
+
return winevtSubscribe->readExistingEvents ? Qtrue : Qfalse;
|
127
128
|
}
|
128
129
|
|
129
130
|
/*
|
@@ -194,19 +195,30 @@ rb_winevt_subscribe_subscribe(int argc, VALUE* argv, VALUE self)
|
|
194
195
|
|
195
196
|
if (hBookmark) {
|
196
197
|
flags |= EvtSubscribeStartAfterBookmark;
|
197
|
-
} else if (winevtSubscribe->
|
198
|
-
flags |= EvtSubscribeToFutureEvents;
|
199
|
-
} else {
|
198
|
+
} else if (winevtSubscribe->readExistingEvents) {
|
200
199
|
flags |= EvtSubscribeStartAtOldestRecord;
|
200
|
+
} else {
|
201
|
+
flags |= EvtSubscribeToFutureEvents;
|
201
202
|
}
|
202
203
|
|
203
204
|
hSubscription =
|
204
205
|
EvtSubscribe(NULL, hSignalEvent, path, query, hBookmark, NULL, NULL, flags);
|
205
206
|
if (!hSubscription) {
|
207
|
+
if (hBookmark != NULL) {
|
208
|
+
EvtClose(hBookmark);
|
209
|
+
}
|
210
|
+
if (hSignalEvent != NULL) {
|
211
|
+
CloseHandle(hSignalEvent);
|
212
|
+
}
|
206
213
|
status = GetLastError();
|
207
214
|
raise_system_error(rb_eWinevtQueryError, status);
|
208
215
|
}
|
209
216
|
|
217
|
+
if (winevtSubscribe->subscription != NULL) {
|
218
|
+
// should be disgarded the old event subscription handle.
|
219
|
+
EvtClose(winevtSubscribe->subscription);
|
220
|
+
}
|
221
|
+
|
210
222
|
ALLOCV_END(wpathBuf);
|
211
223
|
ALLOCV_END(wqueryBuf);
|
212
224
|
|
@@ -217,6 +229,12 @@ rb_winevt_subscribe_subscribe(int argc, VALUE* argv, VALUE self)
|
|
217
229
|
} else {
|
218
230
|
winevtSubscribe->bookmark = EvtCreateBookmark(NULL);
|
219
231
|
if (winevtSubscribe->bookmark == NULL) {
|
232
|
+
if (hSubscription != NULL) {
|
233
|
+
EvtClose(hSubscription);
|
234
|
+
}
|
235
|
+
if (hSignalEvent != NULL) {
|
236
|
+
CloseHandle(hSignalEvent);
|
237
|
+
}
|
220
238
|
status = GetLastError();
|
221
239
|
raise_system_error(rb_eWinevtQueryError, status);
|
222
240
|
}
|
@@ -517,8 +535,14 @@ Init_winevt_subscribe(VALUE rb_cEventLog)
|
|
517
535
|
rb_define_method(rb_cSubscribe, "next", rb_winevt_subscribe_next, 0);
|
518
536
|
rb_define_method(rb_cSubscribe, "each", rb_winevt_subscribe_each, 0);
|
519
537
|
rb_define_method(rb_cSubscribe, "bookmark", rb_winevt_subscribe_get_bookmark, 0);
|
520
|
-
|
521
|
-
|
538
|
+
/*
|
539
|
+
* @since 0.7.0
|
540
|
+
*/
|
541
|
+
rb_define_method(rb_cSubscribe, "read_existing_events?", rb_winevt_subscribe_read_existing_events_p, 0);
|
542
|
+
/*
|
543
|
+
* @since 0.7.0
|
544
|
+
*/
|
545
|
+
rb_define_method(rb_cSubscribe, "read_existing_events=", rb_winevt_subscribe_set_read_existing_events, 1);
|
522
546
|
rb_define_method(rb_cSubscribe, "rate_limit", rb_winevt_subscribe_get_rate_limit, 0);
|
523
547
|
rb_define_method(rb_cSubscribe, "rate_limit=", rb_winevt_subscribe_set_rate_limit, 1);
|
524
548
|
rb_define_method(
|
data/lib/winevt/version.rb
CHANGED
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.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Hatake
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,6 +110,7 @@ extra_rdoc_files: []
|
|
110
110
|
files:
|
111
111
|
- ".clang-format"
|
112
112
|
- ".gitignore"
|
113
|
+
- ".travis.yml"
|
113
114
|
- Gemfile
|
114
115
|
- LICENSE.txt
|
115
116
|
- README.md
|
@@ -155,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
156
|
version: '0'
|
156
157
|
requirements: []
|
157
158
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.7.
|
159
|
+
rubygems_version: 2.7.6.2
|
159
160
|
signing_key:
|
160
161
|
specification_version: 4
|
161
162
|
summary: Windows Event Log API bindings from winevt.h.
|