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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d3ebf96df7a93d6d2a4dae15cba8cc7a76617e752f758aeb8c355c43abd988d
4
- data.tar.gz: de33f1ee85dacba17dbe5b32e98a45d4a57fdde7d931db70dd3b4e054f22c82b
3
+ metadata.gz: 80b819f8d9870a7c09c90b34ca7750ddf913df9056369cc8a34b6c8883c13205
4
+ data.tar.gz: 49c44fb51e996fa70daae1ee8cfb4e12629624dd0d03f261b9680aa241326abf
5
5
  SHA512:
6
- metadata.gz: 83bbe0ca77653a773bf29005236478865f1efb9917f312b5fc8f37485a3ddd068962f4eb2bac7da99916fcd0553b78ed140ac1900441c397e767bad39915c09d
7
- data.tar.gz: fdf8aba88fb62518e52ea4dc65d44247706c5a578e078c224a850323737af2d886afc525fd431ca2652a8a65e375bfc2c960b94667e4839c155ab82f5b3462f1
6
+ metadata.gz: 40985cde59f0eb8941fa07998a3461d20a02736c85765484778069790517519e273f82b75ee87499fb40f3b1018940de1ed67e31f1fc7e481b2d80f5dbcc617c
7
+ data.tar.gz: 862e1aa6620ec9763a82863ac5d74af158f13cb37637ea53434cf66f89e5ca039e16c52b9849a4f91b3326822ec2015cc6c5b298990259c0d8703b31d497e3d9
@@ -8,7 +8,7 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- ruby: [ '2.4', '2.5', '2.6', '2.7', '3.0' ]
11
+ ruby: [ '3.0', '3.1', '3.2' ]
12
12
  os:
13
13
  - ubuntu-latest
14
14
  name: Ruby ${{ matrix.ruby }} building fat gem testing on ${{ matrix.os }}
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);
@@ -61,6 +61,7 @@ extern VALUE rb_cSubscribe;
61
61
  extern VALUE rb_eWinevtQueryError;
62
62
  extern VALUE rb_eChannelNotFoundError;
63
63
  extern VALUE rb_eRemoteHandlerError;
64
+ extern VALUE rb_eSubscribeHandlerError;
64
65
  extern VALUE rb_cLocale;
65
66
  extern VALUE rb_cSession;
66
67
 
@@ -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, FALSE, FALSE, 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) {
@@ -1,3 +1,3 @@
1
1
  module Winevt
2
- VERSION = "0.10.1"
2
+ VERSION = "0.10.2"
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.10.1
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: 2022-09-21 00:00:00.000000000 Z
11
+ date: 2024-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler