winevt_c 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/linux.yml +1 -1
- data/ext/winevt/winevt.c +2 -0
- data/ext/winevt/winevt_c.h +1 -0
- data/ext/winevt/winevt_subscribe.c +22 -1
- data/lib/winevt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80b819f8d9870a7c09c90b34ca7750ddf913df9056369cc8a34b6c8883c13205
|
4
|
+
data.tar.gz: 49c44fb51e996fa70daae1ee8cfb4e12629624dd0d03f261b9680aa241326abf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40985cde59f0eb8941fa07998a3461d20a02736c85765484778069790517519e273f82b75ee87499fb40f3b1018940de1ed67e31f1fc7e481b2d80f5dbcc617c
|
7
|
+
data.tar.gz: 862e1aa6620ec9763a82863ac5d74af158f13cb37637ea53434cf66f89e5ca039e16c52b9849a4f91b3326822ec2015cc6c5b298990259c0d8703b31d497e3d9
|
data/.github/workflows/linux.yml
CHANGED
data/ext/winevt/winevt.c
CHANGED
@@ -7,6 +7,7 @@ VALUE rb_cSubscribe;
|
|
7
7
|
VALUE rb_eWinevtQueryError;
|
8
8
|
VALUE rb_eChannelNotFoundError;
|
9
9
|
VALUE rb_eRemoteHandlerError;
|
10
|
+
VALUE rb_eSubscribeHandlerError;
|
10
11
|
|
11
12
|
static ID id_call;
|
12
13
|
|
@@ -20,6 +21,7 @@ Init_winevt(void)
|
|
20
21
|
rb_eWinevtQueryError = rb_define_class_under(rb_cQuery, "Error", rb_eStandardError);
|
21
22
|
rb_eChannelNotFoundError = rb_define_class_under(rb_cEventLog, "ChannelNotFoundError", rb_eStandardError);
|
22
23
|
rb_eRemoteHandlerError = rb_define_class_under(rb_cSubscribe, "RemoteHandlerError", rb_eRuntimeError);
|
24
|
+
rb_eSubscribeHandlerError = rb_define_class_under(rb_cSubscribe, "SubscribeHandlerError", rb_eRuntimeError);
|
23
25
|
|
24
26
|
Init_winevt_channel(rb_cEventLog);
|
25
27
|
Init_winevt_bookmark(rb_cEventLog);
|
data/ext/winevt/winevt_c.h
CHANGED
@@ -174,7 +174,7 @@ rb_winevt_subscribe_subscribe(int argc, VALUE* argv, VALUE self)
|
|
174
174
|
struct WinevtSession* winevtSession;
|
175
175
|
struct WinevtSubscribe* winevtSubscribe;
|
176
176
|
|
177
|
-
hSignalEvent = CreateEvent(NULL,
|
177
|
+
hSignalEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
|
178
178
|
|
179
179
|
TypedData_Get_Struct(
|
180
180
|
self, struct WinevtSubscribe, &rb_winevt_subscribe_type, winevtSubscribe);
|
@@ -341,6 +341,8 @@ rb_winevt_subscribe_next(VALUE self)
|
|
341
341
|
EVT_HANDLE hEvents[SUBSCRIBE_ARRAY_SIZE];
|
342
342
|
ULONG count = 0;
|
343
343
|
DWORD status = ERROR_SUCCESS;
|
344
|
+
DWORD dwWait = 0;
|
345
|
+
|
344
346
|
struct WinevtSubscribe* winevtSubscribe;
|
345
347
|
|
346
348
|
TypedData_Get_Struct(
|
@@ -355,6 +357,23 @@ rb_winevt_subscribe_next(VALUE self)
|
|
355
357
|
return Qfalse;
|
356
358
|
}
|
357
359
|
|
360
|
+
/* If a signalEvent notifies whether a state of processed event(s)
|
361
|
+
* is existing or not.
|
362
|
+
* For checking for a result of WaitForSingleObject,
|
363
|
+
* we need to raise SubscribeHandlerError exception when
|
364
|
+
* WAIT_FAILED is detected for further investigations.
|
365
|
+
* Note that we don't need to wait explicitly here.
|
366
|
+
* Because this function is inside of each enumerator.
|
367
|
+
* So, WaitForSingleObject should return immediately and should be
|
368
|
+
* processed with the latter each loops if there is no more items.
|
369
|
+
* Just intended to check that there is no errors here. */
|
370
|
+
dwWait = WaitForSingleObject(winevtSubscribe->signalEvent, 0);
|
371
|
+
if (dwWait == WAIT_FAILED) {
|
372
|
+
raise_system_error(rb_eSubscribeHandlerError, GetLastError());
|
373
|
+
} else if (dwWait != WAIT_OBJECT_0) {
|
374
|
+
return Qfalse;
|
375
|
+
}
|
376
|
+
|
358
377
|
if (!EvtNext(winevtSubscribe->subscription,
|
359
378
|
SUBSCRIBE_ARRAY_SIZE,
|
360
379
|
hEvents,
|
@@ -368,6 +387,8 @@ rb_winevt_subscribe_next(VALUE self)
|
|
368
387
|
if (ERROR_NO_MORE_ITEMS != status) {
|
369
388
|
return Qfalse;
|
370
389
|
}
|
390
|
+
|
391
|
+
ResetEvent(winevtSubscribe->signalEvent);
|
371
392
|
}
|
372
393
|
|
373
394
|
if (status == ERROR_SUCCESS) {
|
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.10.
|
4
|
+
version: 0.10.2
|
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: 2024-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|