winevt_c 0.4.2 → 0.4.3

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: '0981a5360392cd5a0a16cda1d2f1bc88dd199ee2a3a1df9b5a58ad5aedacd9f0'
4
- data.tar.gz: 93114a7d1062c2911ba1b59ae16b7d573c831eb56f14120f8faed963ec07ac25
3
+ metadata.gz: 3a5d94caad29076c31d994b6d495bde3fee2075e71a022ed93bb932875460dae
4
+ data.tar.gz: c1543988397b3f6c6efb1d1d2a7ad6d563ffb0625ae36625e94af8557fc1254f
5
5
  SHA512:
6
- metadata.gz: 03cdfea8f51c5aba392b12c710c7e6250a8eb860c4badaa5493d958768f2090a85da494c000a43cdd73c0ea1edd01d63fa539b93de4c87eb34305a5b1370a780
7
- data.tar.gz: 99da720ae70548866887793bf225aa2ec09702924f92b7b3819afb81403079084c8bb1ac258b5fcf3a3303c9df9bf1d717a6fe306aa2b421d90dbed638b9dc2d
6
+ metadata.gz: 8e90522798144758a74201138a4d408654ab8e7ab807b0c237649955e35a9f6d268ef1cf994737edbd8e4e2ea4665cd353d3ebec00aa83c35eb695d44b4ac5b2
7
+ data.tar.gz: 93127bb279833ceac0cb6df8178b4fb5cd7517c249f3d3810b22c596a63b03195c72470ebefdd944d1833d6e814856463a251855f20b7362b89df38656370b54
@@ -42,7 +42,7 @@ rb_winevt_channel_each(VALUE self)
42
42
  {
43
43
  EVT_HANDLE hChannels;
44
44
  struct WinevtChannel *winevtChannel;
45
- char *errBuf;
45
+ char *errBuf = NULL;
46
46
  char * result;
47
47
  LPWSTR buffer = NULL;
48
48
  LPWSTR temp = NULL;
@@ -74,7 +74,7 @@ rb_winevt_subscribe_subscribe(int argc, VALUE *argv, VALUE self)
74
74
  VALUE rb_path, rb_query, rb_bookmark;
75
75
  EVT_HANDLE hSubscription = NULL, hBookmark = NULL;
76
76
  HANDLE hSignalEvent;
77
- DWORD len, flags;
77
+ DWORD len, flags = 0L;
78
78
  VALUE wpathBuf, wqueryBuf;
79
79
  PWSTR path, query;
80
80
  DWORD status = ERROR_SUCCESS;
@@ -67,7 +67,7 @@ WCHAR* render_event(EVT_HANDLE handle, DWORD flags)
67
67
  VALUE errmsg = rb_str_new2(msgBuf);
68
68
  LocalFree(msgBuf);
69
69
 
70
- rb_raise(rb_eWinevtQueryError, "ErrorCode: %d\nError: %s\n", status, RSTRING_PTR(errmsg));
70
+ rb_raise(rb_eWinevtQueryError, "ErrorCode: %ld\nError: %s\n", status, RSTRING_PTR(errmsg));
71
71
  }
72
72
 
73
73
  result = _wcsdup(buffer);
@@ -108,8 +108,9 @@ VALUE get_values(EVT_HANDLE handle)
108
108
  do {
109
109
  if (bufferSizeNeeded > bufferSize) {
110
110
  bufferSize = bufferSizeNeeded;
111
- buffer.resize(bufferSize);
112
- if (buffer.c_str() == NULL) {
111
+ try {
112
+ buffer.resize(bufferSize);
113
+ } catch (std::bad_alloc e) {
113
114
  status = ERROR_OUTOFMEMORY;
114
115
  bufferSize = 0;
115
116
  rb_raise(rb_eWinevtQueryError, "Out of memory");
@@ -142,7 +143,7 @@ VALUE get_values(EVT_HANDLE handle)
142
143
  VALUE errmsg = rb_str_new2(msgBuf);
143
144
  LocalFree(msgBuf);
144
145
 
145
- rb_raise(rb_eWinevtQueryError, "ErrorCode: %d\nError: %s\n", status, RSTRING_PTR(errmsg));
146
+ rb_raise(rb_eWinevtQueryError, "ErrorCode: %lu\nError: %s\n", status, RSTRING_PTR(errmsg));
146
147
  }
147
148
 
148
149
  PEVT_VARIANT pRenderedValues = (PEVT_VARIANT)buffer.c_str();
@@ -344,7 +345,7 @@ static std::wstring get_message(EVT_HANDLE hMetadata, EVT_HANDLE handle)
344
345
  }
345
346
 
346
347
  if (status != ERROR_INSUFFICIENT_BUFFER)
347
- rb_raise(rb_eWinevtQueryError, "ErrorCode: %d", status);
348
+ rb_raise(rb_eWinevtQueryError, "ErrorCode: %lu", status);
348
349
  }
349
350
 
350
351
  if (status == ERROR_INSUFFICIENT_BUFFER) {
@@ -382,7 +383,7 @@ static std::wstring get_message(EVT_HANDLE hMetadata, EVT_HANDLE handle)
382
383
  goto cleanup;
383
384
  }
384
385
 
385
- rb_raise(rb_eWinevtQueryError, "ErrorCode: %d", status);
386
+ rb_raise(rb_eWinevtQueryError, "ErrorCode: %lu", status);
386
387
  }
387
388
  }
388
389
  }
@@ -438,7 +439,7 @@ WCHAR* get_description(EVT_HANDLE handle)
438
439
  VALUE errmsg = rb_str_new2(msgBuf);
439
440
  LocalFree(msgBuf);
440
441
 
441
- rb_raise(rb_eWinevtQueryError, "ErrorCode: %d\nError: %s\n", status, RSTRING_PTR(errmsg));
442
+ rb_raise(rb_eWinevtQueryError, "ErrorCode: %lu\nError: %s\n", status, RSTRING_PTR(errmsg));
442
443
  }
443
444
 
444
445
  // Obtain buffer as EVT_VARIANT pointer. To avoid ErrorCide 87 in EvtRender.
@@ -1,3 +1,3 @@
1
1
  module Winevt
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
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.4.2
4
+ version: 0.4.3
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-01 00:00:00.000000000 Z
11
+ date: 2019-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler