winevt_c 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/winevt/winevt.c +2 -0
- data/ext/winevt/winevt_c.h +3 -1
- data/ext/winevt/winevt_query.c +3 -0
- data/ext/winevt/winevt_subscribe.c +8 -1
- data/ext/winevt/winevt_utils.cpp +10 -0
- 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: 9d3ebf96df7a93d6d2a4dae15cba8cc7a76617e752f758aeb8c355c43abd988d
|
4
|
+
data.tar.gz: de33f1ee85dacba17dbe5b32e98a45d4a57fdde7d931db70dd3b4e054f22c82b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83bbe0ca77653a773bf29005236478865f1efb9917f312b5fc8f37485a3ddd068962f4eb2bac7da99916fcd0553b78ed140ac1900441c397e767bad39915c09d
|
7
|
+
data.tar.gz: fdf8aba88fb62518e52ea4dc65d44247706c5a578e078c224a850323737af2d886afc525fd431ca2652a8a65e375bfc2c960b94667e4839c155ab82f5b3462f1
|
data/ext/winevt/winevt.c
CHANGED
@@ -5,6 +5,7 @@ VALUE rb_cQuery;
|
|
5
5
|
VALUE rb_cEventLog;
|
6
6
|
VALUE rb_cSubscribe;
|
7
7
|
VALUE rb_eWinevtQueryError;
|
8
|
+
VALUE rb_eChannelNotFoundError;
|
8
9
|
VALUE rb_eRemoteHandlerError;
|
9
10
|
|
10
11
|
static ID id_call;
|
@@ -17,6 +18,7 @@ Init_winevt(void)
|
|
17
18
|
rb_cQuery = rb_define_class_under(rb_cEventLog, "Query", rb_cObject);
|
18
19
|
rb_cSubscribe = rb_define_class_under(rb_cEventLog, "Subscribe", rb_cObject);
|
19
20
|
rb_eWinevtQueryError = rb_define_class_under(rb_cQuery, "Error", rb_eStandardError);
|
21
|
+
rb_eChannelNotFoundError = rb_define_class_under(rb_cEventLog, "ChannelNotFoundError", rb_eStandardError);
|
20
22
|
rb_eRemoteHandlerError = rb_define_class_under(rb_cSubscribe, "RemoteHandlerError", rb_eRuntimeError);
|
21
23
|
|
22
24
|
Init_winevt_channel(rb_cEventLog);
|
data/ext/winevt/winevt_c.h
CHANGED
@@ -37,7 +37,8 @@ VALUE wstr_to_rb_str(UINT cp, const WCHAR* wstr, int clen);
|
|
37
37
|
#if defined(__cplusplus)
|
38
38
|
[[ noreturn ]]
|
39
39
|
#endif /* __cplusplus */
|
40
|
-
void
|
40
|
+
void raise_system_error(VALUE error, DWORD errorCode);
|
41
|
+
void raise_channel_not_found_error(VALUE channelPath);
|
41
42
|
VALUE render_to_rb_str(EVT_HANDLE handle, DWORD flags);
|
42
43
|
EVT_HANDLE connect_to_remote(LPWSTR computerName, LPWSTR domain,
|
43
44
|
LPWSTR username, LPWSTR password,
|
@@ -58,6 +59,7 @@ extern VALUE rb_cChannel;
|
|
58
59
|
extern VALUE rb_cBookmark;
|
59
60
|
extern VALUE rb_cSubscribe;
|
60
61
|
extern VALUE rb_eWinevtQueryError;
|
62
|
+
extern VALUE rb_eChannelNotFoundError;
|
61
63
|
extern VALUE rb_eRemoteHandlerError;
|
62
64
|
extern VALUE rb_cLocale;
|
63
65
|
extern VALUE rb_cSession;
|
data/ext/winevt/winevt_query.c
CHANGED
@@ -131,6 +131,9 @@ rb_winevt_query_initialize(VALUE argc, VALUE *argv, VALUE self)
|
|
131
131
|
hRemoteHandle, evtChannel, evtXPath, EvtQueryChannelPath | EvtQueryTolerateQueryErrors);
|
132
132
|
err = GetLastError();
|
133
133
|
if (err != ERROR_SUCCESS) {
|
134
|
+
if (err == ERROR_EVT_CHANNEL_NOT_FOUND) {
|
135
|
+
raise_channel_not_found_error(channel);
|
136
|
+
}
|
134
137
|
raise_system_error(rb_eRuntimeError, err);
|
135
138
|
}
|
136
139
|
winevtQuery->offset = 0L;
|
@@ -248,10 +248,17 @@ rb_winevt_subscribe_subscribe(int argc, VALUE* argv, VALUE self)
|
|
248
248
|
if (hSignalEvent != NULL) {
|
249
249
|
CloseHandle(hSignalEvent);
|
250
250
|
}
|
251
|
+
|
251
252
|
if (rb_obj_is_kind_of(rb_session, rb_cSession)) {
|
252
253
|
rb_raise(rb_eRemoteHandlerError, "Remoting subscription is not working. errCode: %ld\n", status);
|
253
|
-
}
|
254
|
+
}
|
255
|
+
|
256
|
+
switch (status) {
|
257
|
+
case ERROR_EVT_CHANNEL_NOT_FOUND:
|
258
|
+
raise_channel_not_found_error(rb_path);
|
259
|
+
default:
|
254
260
|
raise_system_error(rb_eWinevtQueryError, status);
|
261
|
+
break;
|
255
262
|
}
|
256
263
|
}
|
257
264
|
|
data/ext/winevt/winevt_utils.cpp
CHANGED
@@ -56,6 +56,16 @@ raise_system_error(VALUE error, DWORD errorCode)
|
|
56
56
|
#pragma GCC diagnostic pop
|
57
57
|
}
|
58
58
|
|
59
|
+
void
|
60
|
+
raise_channel_not_found_error(VALUE channelPath)
|
61
|
+
{
|
62
|
+
#pragma GCC diagnostic push
|
63
|
+
#pragma GCC diagnostic ignored "-Wformat="
|
64
|
+
#pragma GCC diagnostic ignored "-Wformat-extra-args"
|
65
|
+
rb_raise(rb_eChannelNotFoundError, "Channel Not Found: %" PRIsVALUE, channelPath);
|
66
|
+
#pragma GCC diagnostic pop
|
67
|
+
}
|
68
|
+
|
59
69
|
VALUE
|
60
70
|
render_to_rb_str(EVT_HANDLE handle, DWORD flags)
|
61
71
|
{
|
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.1
|
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-
|
11
|
+
date: 2022-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|