winevt_c 0.9.2 → 0.9.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: 62ac52ac62484de45eb4e077cafbff85c39a60ac5124c2aac2b1fee9773c776a
4
- data.tar.gz: 4ff194f6a8d885a66180ca1253a12018581dad3013f63ea12639df70f6c991c3
3
+ metadata.gz: f8e0f057816ea6023a893cda0b9af765f4f0b47bab15491fb71862114be55e61
4
+ data.tar.gz: 2dee722cd48e235222fb891106ba4c8fbe80f5141db4fad0237784acd8804704
5
5
  SHA512:
6
- metadata.gz: 1c3159de91ae1ed7d587d9af614c60ede745a12a7afbe6e77539475c77260cbd716fcfabcc958bc63e5c28dbc67d30668718c628f75642636249fb042c79c512
7
- data.tar.gz: 5c2617fd7b079656c511fa26f306665527cf83f9395eaacf1541462f42a5fb7c0860e404f230c21da09ea37ba802f5e0eacad3bebbd21d9a6bbe85772d7a6c80
6
+ metadata.gz: 442e12311a0ad1f3d26255a4d841174072e4fd1f50ab9b113654231a95f3d779c1b91e04449e1126cd16432f11de9427b4436e9954ac0ae1fa78cfcc45b378a2
7
+ data.tar.gz: 9f8d8c1d10a1c589514039de18acb0a0c2910f99928d44d90c1a21b523e145e1946f585438f52f1a5a4ddde5c9a4b54503ce1f96aa9d30e9b4d20a5169fc135f
@@ -41,7 +41,8 @@ void raise_system_error(VALUE error, DWORD errorCode);
41
41
  VALUE render_to_rb_str(EVT_HANDLE handle, DWORD flags);
42
42
  EVT_HANDLE connect_to_remote(LPWSTR computerName, LPWSTR domain,
43
43
  LPWSTR username, LPWSTR password,
44
- EVT_RPC_LOGIN_FLAGS flags);
44
+ EVT_RPC_LOGIN_FLAGS flags,
45
+ DWORD *error_code);
45
46
  WCHAR* get_description(EVT_HANDLE handle, LANGID langID, EVT_HANDLE hRemote);
46
47
  VALUE get_values(EVT_HANDLE handle);
47
48
  VALUE render_system_event(EVT_HANDLE handle, BOOL preserve_qualifiers);
@@ -91,7 +91,7 @@ rb_winevt_query_initialize(VALUE argc, VALUE *argv, VALUE self)
91
91
  EVT_HANDLE hRemoteHandle = NULL;
92
92
  DWORD len;
93
93
  VALUE wchannelBuf, wpathBuf;
94
- DWORD err;
94
+ DWORD err = ERROR_SUCCESS;
95
95
 
96
96
  rb_scan_args(argc, argv, "21", &channel, &xpath, &session);
97
97
  Check_Type(channel, T_STRING);
@@ -104,9 +104,8 @@ rb_winevt_query_initialize(VALUE argc, VALUE *argv, VALUE self)
104
104
  winevtSession->domain,
105
105
  winevtSession->username,
106
106
  winevtSession->password,
107
- winevtSession->flags);
108
-
109
- err = GetLastError();
107
+ winevtSession->flags,
108
+ &err);
110
109
  if (err != ERROR_SUCCESS) {
111
110
  raise_system_error(rb_eRuntimeError, err);
112
111
  }
@@ -208,9 +208,8 @@ rb_winevt_subscribe_subscribe(int argc, VALUE* argv, VALUE self)
208
208
  winevtSession->domain,
209
209
  winevtSession->username,
210
210
  winevtSession->password,
211
- winevtSession->flags);
212
-
213
- err = GetLastError();
211
+ winevtSession->flags,
212
+ &err);
214
213
  if (err != ERROR_SUCCESS) {
215
214
  raise_system_error(rb_eRuntimeError, err);
216
215
  }
@@ -242,13 +241,13 @@ rb_winevt_subscribe_subscribe(int argc, VALUE* argv, VALUE self)
242
241
  hSubscription =
243
242
  EvtSubscribe(hRemoteHandle, hSignalEvent, path, query, hBookmark, NULL, NULL, flags);
244
243
  if (!hSubscription) {
244
+ status = GetLastError();
245
245
  if (hBookmark != NULL) {
246
246
  EvtClose(hBookmark);
247
247
  }
248
248
  if (hSignalEvent != NULL) {
249
249
  CloseHandle(hSignalEvent);
250
250
  }
251
- status = GetLastError();
252
251
  if (rb_obj_is_kind_of(rb_session, rb_cSession)) {
253
252
  rb_raise(rb_eRemoteHandlerError, "Remoting subscription is not working. errCode: %ld\n", status);
254
253
  } else {
@@ -272,13 +271,13 @@ rb_winevt_subscribe_subscribe(int argc, VALUE* argv, VALUE self)
272
271
  } else {
273
272
  winevtSubscribe->bookmark = EvtCreateBookmark(NULL);
274
273
  if (winevtSubscribe->bookmark == NULL) {
274
+ status = GetLastError();
275
275
  if (hSubscription != NULL) {
276
276
  EvtClose(hSubscription);
277
277
  }
278
278
  if (hSignalEvent != NULL) {
279
279
  CloseHandle(hSignalEvent);
280
280
  }
281
- status = GetLastError();
282
281
  raise_system_error(rb_eWinevtQueryError, status);
283
282
  }
284
283
  }
@@ -78,7 +78,7 @@ render_to_rb_str(EVT_HANDLE handle, DWORD flags)
78
78
 
79
79
  EVT_HANDLE
80
80
  connect_to_remote(LPWSTR computerName, LPWSTR domain, LPWSTR username, LPWSTR password,
81
- EVT_RPC_LOGIN_FLAGS flags)
81
+ EVT_RPC_LOGIN_FLAGS flags, DWORD *error_code)
82
82
  {
83
83
  EVT_HANDLE hRemote = NULL;
84
84
  EVT_RPC_LOGIN Credentials;
@@ -92,6 +92,10 @@ connect_to_remote(LPWSTR computerName, LPWSTR domain, LPWSTR username, LPWSTR pa
92
92
  Credentials.Flags = flags;
93
93
 
94
94
  hRemote = EvtOpenSession(EvtRpcLogin, &Credentials, 0, 0);
95
+ if (!hRemote) {
96
+ *error_code = GetLastError();
97
+ return hRemote;
98
+ }
95
99
 
96
100
  SecureZeroMemory(&Credentials, sizeof(EVT_RPC_LOGIN));
97
101
 
@@ -569,13 +573,13 @@ render_system_event(EVT_HANDLE hEvent, BOOL preserve_qualifiers)
569
573
  pRenderedValues,
570
574
  &dwBufferUsed,
571
575
  &dwPropertyCount);
576
+ status = GetLastError();
572
577
  } else {
573
578
  EvtClose(hContext);
574
579
  rb_raise(rb_eRuntimeError, "Failed to malloc memory with %lu\n", status);
575
580
  }
576
581
  }
577
582
 
578
- status = GetLastError();
579
583
  if (ERROR_SUCCESS != status) {
580
584
  EvtClose(hContext);
581
585
  ALLOCV_END(vRenderedValues);
@@ -1,3 +1,3 @@
1
1
  module Winevt
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.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.9.2
4
+ version: 0.9.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: 2021-04-23 00:00:00.000000000 Z
11
+ date: 2021-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  - !ruby/object:Gem::Version
162
162
  version: '0'
163
163
  requirements: []
164
- rubygems_version: 3.0.3
164
+ rubygems_version: 3.1.6
165
165
  signing_key:
166
166
  specification_version: 4
167
167
  summary: Windows Event Log API bindings from winevt.h.